/[libvob]/libvob/vob/demo/multifil/randgraph.py
ViewVC logotype

Diff of /libvob/vob/demo/multifil/randgraph.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by jvk, Fri Jun 27 11:53:15 2003 UTC revision 1.21 by jvk, Fri Jun 27 12:06:06 2003 UTC
# Line 27  from org.nongnu.libvob.gl import GL, GLR Line 27  from org.nongnu.libvob.gl import GL, GLR
27  from vob.putil import cg  from vob.putil import cg
28  from vob.putil.misc import *  from vob.putil.misc import *
29  from vob.putil.demokeys import *  from vob.putil.demokeys import *
 from vob.paper.texcache import getCachedTexture  
30    
31  from vob.fillet import light3d;  from vob.fillet import light3d
32    
33  from random import Random  from random import Random
   
 noise = getCachedTexture(  
     [1024, 512, 0, 4, "RGBA", "RGBA", "noise",  
         [ "freq", "100", "bias", ".5", "scale", ".8" ]]  
     )  
34            
35  class Scene:  class Scene:
36      "Random graph"      "Random graph"
# Line 49  class Scene: Line 43  class Scene:
43          )          )
44      def scene(self, vs):      def scene(self, vs):
45          vs.put( background((.5,1,.2)))          vs.put( background((.5,1,.2)))
         vs.put(getDListNocoords("""  
             PushAttrib POLYGON_BIT ENABLE_BIT  
             Enable DEPTH_TEST  
             DepthFunc LEQUAL  
             LineWidth %s  
             PolygonOffset -100 -100  
             ShadeModel SMOOTH  
         """ % self.linewidth))  
   
         if self.lines:  
             vs.put(getDListNocoords("PolygonMode FRONT_AND_BACK LINE"))  
   
         border = 2  
         conns = GLRen.createSortedConnections(  
             GLRen.createFilletSpan2(border, self.dice,  
                                     1 +  
                                     4 * self.depthColor +  
                                     8 * (1-self.fillets) +  
                                     16 * self.ellipses +  
                                     64 * self.stretched +  
                                     128 * self.sectors), 2)  
           
         conns_l = GLRen.createSortedConnections(  
             GLRen.createFilletSpan2(border, self.dice,  
                                     2 +  
                                     4 * self.depthColor +  
                                     8 * (1-self.fillets) +  
                                     16 * self.ellipses +  
                                     64 * self.stretched +  
                                     128 * self.sectors), 2)  
   
         conns3d =  GLRen.createIterConnections(  
             GLRen.createFillet3D(border, self.dice, 0), 2);  
   
46    
47          rng = Random(self.seed)          rng = Random(self.seed)
48          N2 = 2*self.N/3          N2 = 2*self.N/3
# Line 134  class Scene: Line 94  class Scene:
94                  if node["conns"]:                  if node["conns"]:
95                      vs.put(conns, [thick, angle, node["cs"]] + node["conns"])                      vs.put(conns, [thick, angle, node["cs"]] + node["conns"])
96    
97          if self.fillet3d:          light3d.drawFillets(self, vs, pc)
             vs.put(getDListNocoords("""  
             Color 1 1 1  
             BindProgram VERTEX_PROGRAM_ARB %s  
             Enable VERTEX_PROGRAM_ARB  
             MatrixMode PROJECTION  
             PushMatrix  
             MatrixMode MODELVIEW  
             PushMatrix  
             """ % light3d.vp[0].getProgId()))  
   
             if self.texture:  
                 vs.put(getDListNocoords("""  
                 BindTexture TEXTURE_2D %s  
                 TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR  
                 TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR  
                 TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 20  
                 TexEnv TEXTURE_ENV TEXTURE_ENV_MODE MODULATE  
                 Enable TEXTURE_2D  
                 """ % noise.getTexId()))  
   
             if self.perspective:  
                 vs.put(getDListNocoords("""  
                 MatrixMode PROJECTION  
                 LoadIdentity  
                 Frustum -400 400 -400 400 500 2500  
                 Scale 1 1 -1  
                 MatrixMode MODELVIEW  
                 LoadIdentity  
                 Scale 1 1 -1  
                 uLookAt 400 400 -1000 400 400 400 0 -1 0  
                 """))  
   
             pc(conns3d)  
   
             vs.put(getDListNocoords("""  
             MatrixMode PROJECTION  
             PopMatrix  
             MatrixMode MODELVIEW  
             PopMatrix  
             """))  
         else:  
             vs.put(getDListNocoords("""  
             Color 1 1 1  
             """))  
             if self.drawInside: pc(conns)  
             vs.put(getDListNocoords("""  
             Color 0 0 0  
             """))  
             if self.drawEdge: pc(conns_l)  
               
         vs.put(getDListNocoords("""  
             BindProgram VERTEX_PROGRAM_ARB 0  
             BindTexture TEXTURE_2D 0  
             PopAttrib  
         """))  
   

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26