/[gzz]/gzz/gfx/demo/irregu3.py
ViewVC logotype

Diff of /gzz/gfx/demo/irregu3.py

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

revision 1.19 by jvk, Fri Oct 25 08:48:12 2002 UTC revision 1.20 by jvk, Fri Oct 25 09:17:53 2002 UTC
# Line 6  ripple_scale = .25 Line 6  ripple_scale = .25
6  size = 256  size = 256
7  lodbias = 0  lodbias = 0
8    
9    use_texture = 0
10    
11    matrices = [ "1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1",
12                 "4 0 0 0.005  0 1 0 0  0 0 1 0  0 0 0 1" ]
13    
14  profiles = []  profiles = []
15    
16  if (GL.hasExtension("GL_NV_register_combiners") and  if (GL.hasExtension("GL_NV_register_combiners") and
# Line 136  def globalkey(k): Line 141  def globalkey(k):
141      if "F1" <= k <= "F4":      if "F1" <= k <= "F4":
142          global profiles          global profiles
143          init(profiles[int(k[1]) - 1])          init(profiles[int(k[1]) - 1])
144        elif k == "m":
145            global matrices
146            matrices = matrices[1:] + matrices[:1]
147        elif k == "t":
148            global use_texture
149            use_texture = not use_texture
150                    
151    
152    
# Line 196  def getIrregu(invert, x0, y0, x1, y1, ou Line 207  def getIrregu(invert, x0, y0, x1, y1, ou
207      dotvec = js(vec)      dotvec = js(vec)
208    
209      code = """      code = """
210      PushAttrib ENABLE_BIT      PushAttrib ENABLE_BIT TEXTURE_BIT
211    
212      BindTexture TEXTURE_2D %(texid)s      BindTexture TEXTURE_2D %(texid)s
213      TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR      TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
# Line 299  class IrreguScene: Line 310  class IrreguScene:
310          vs.matcher.add(cs4, "4")          vs.matcher.add(cs4, "4")
311          vs.map.put(GLRen.createTextureMatrix(), cs4)          vs.map.put(GLRen.createTextureMatrix(), cs4)
312    
313            texid = getCachedTexture([4, 4, 0, 3, "RGB", "RGB", "geometric",
314                                      ["type", "1", "scale", ".25", "bias", ".75"]]).getTexId()
315    
316            if use_texture:
317                tex2d = "Enable"
318            else:
319                tex2d = "Disable"
320            
321          paint = """          paint = """
322              PushAttrib ENABLE_BIT              PushAttrib ENABLE_BIT
323              Enable STENCIL_TEST              Enable STENCIL_TEST
324              Disable ALPHA_TEST              Disable ALPHA_TEST
325              StencilFunc EQUAL 0 255              StencilFunc EQUAL 0 255
326              StencilOp ZERO ZERO ZERO              StencilOp ZERO ZERO ZERO
327              Disable TEXTURE_2D              %(tex2d)s TEXTURE_2D
328                BindTexture TEXTURE_2D %(texid)s
329                TexParameter TEXTURE_2D TEXTURE_MIN_FILTER NEAREST
330                TexParameter TEXTURE_2D TEXTURE_MAG_FILTER NEAREST
331                #TexEnv TEXTURE_ENV TEXTURE_ENV_MODE MODULATE
332              Begin QUAD_STRIP              Begin QUAD_STRIP
333                TexCoord 0 0
334              Vertex %(x0)s %(y0)s              Vertex %(x0)s %(y0)s
335                TexCoord 2.25 0
336              Vertex %(x1)s %(y0)s              Vertex %(x1)s %(y0)s
337                TexCoord 0 2.25
338              Vertex %(x0)s %(y1)s              Vertex %(x0)s %(y1)s
339                TexCoord 2.25 2.25
340              Vertex %(x1)s %(y1)s              Vertex %(x1)s %(y1)s
341              End              End
342              PopAttrib              PopAttrib
# Line 318  class IrreguScene: Line 345  class IrreguScene:
345          vs.map.put(getDListNocoords("""          vs.map.put(getDListNocoords("""
346              PushMatrix              PushMatrix
347    
348              MultMatrix  1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1              MultMatrix  %s
349          """))          """ % matrices[0]))
350    
351          vs.map.put(getDList(getIrregu(0,x0,-1,x1,-1,1, texscale, self.angle) +          vs.map.put(getDList(getIrregu(0,x0,-1,x1,-1,1, texscale, self.angle) +
352                              getIrregu(0,+1,y0,+1,y1,1, texscale, self.angle) +                              getIrregu(0,+1,y0,+1,y1,1, texscale, self.angle) +

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

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