/[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.26 by jvk, Mon Oct 28 18:55:14 2002 UTC revision 1.27 by jvk, Tue Oct 29 09:43:44 2002 UTC
# Line 33  def init(profile): Line 33  def init(profile):
33      global tex, texinv      global tex, texinv
34      global texenv_inner, texenv_outer, alphalevel, w0, w1      global texenv_inner, texenv_outer, alphalevel, w0, w1
35      global colmap0, colmap1      global colmap0, colmap1
36      global using_shader      global using_shader, using_secondary_color
37    
38      using_shader = 0      using_shader = 0
39        using_secondary_color = 0
40            
41      if profile == "NV_SHAD":      if profile == "NV_SHAD":
42          print "Using 2-vector HILO displacement texture with GL_NV_texture_shader"          print "Using 2-vector HILO displacement texture with GL_NV_texture_shader"
# Line 94  def init(profile): Line 95  def init(profile):
95    
96      elif profile == "NV_COMB":      elif profile == "NV_COMB":
97          print "Using full displacement resolution textures with GL_NV_register_combiners"          print "Using full displacement resolution textures with GL_NV_register_combiners"
98    
99            using_secondary_color = 1
100            
101          from gfx.libutil.nvcode import combinercode          from gfx.libutil.nvcode import combinercode
102          texenv_outer = combinercode("""          texenv = combinercode("""
103          SecondaryColorEXT %(dotvec)s          Color %s
104            
105          Enable REGISTER_COMBINERS_NV          Enable REGISTER_COMBINERS_NV
106          CombinerParameterNV NUM_GENERAL_COMBINERS_NV 2          CombinerParameterNV NUM_GENERAL_COMBINERS_NV 2
107            
108          # Compute TEXTURE . SECONDARY_COLOR dot product          # SPARE0 <- TEXTURE0 . COLOR
109          CI0 RGB A TEXTURE0 UNSIGNED_IDENTITY_NV RGB          CI0 RGB A TEXTURE0 UNSIGNED_IDENTITY_NV RGB
110          CI0 RGB B SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB          CI0 RGB B PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
111          CO0 RGB SPARE0_NV DISCARD_NV DISCARD_NV NONE NONE TRUE FALSE FALSE          CO0 RGB SPARE0_NV DISCARD_NV DISCARD_NV NONE NONE TRUE FALSE FALSE
112            
113          # Add PRIMARY_COLOR          # SPARE0.alpha <- TEXTURE0.alpha * COLOR.alpha + SEC_COLOR.b
         CI1 RGB A SPARE0_NV UNSIGNED_IDENTITY_NV RGB  
         CI1 RGB B ZERO UNSIGNED_INVERT_NV RGB  
         CI1 RGB C PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB  
         CI1 RGB D ZERO UNSIGNED_INVERT_NV RGB  
         CO1 RGB DISCARD_NV DISCARD_NV SPARE0_NV NONE NONE FALSE FALSE FALSE  
           
         # Use as alpha  
         FCI G SPARE0_NV UNSIGNED_IDENTITY_NV BLUE  
         """)  
           
         texenv_inner = combinercode("""  
         SecondaryColorEXT 0 0 0  
           
         Enable REGISTER_COMBINERS_NV  
         CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1  
           
114          CI0 ALPHA A TEXTURE0 UNSIGNED_IDENTITY_NV ALPHA          CI0 ALPHA A TEXTURE0 UNSIGNED_IDENTITY_NV ALPHA
115          CI0 ALPHA B ZERO UNSIGNED_INVERT_NV ALPHA          CI0 ALPHA B PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV ALPHA
116          CI0 ALPHA C PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE          CI0 ALPHA C SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE
117          CI0 ALPHA D ZERO UNSIGNED_INVERT_NV ALPHA          CI0 ALPHA D ZERO UNSIGNED_INVERT_NV ALPHA
118          CO0 ALPHA DISCARD_NV DISCARD_NV SPARE0_NV NONE NONE FALSE FALSE FALSE          CO0 ALPHA DISCARD_NV DISCARD_NV SPARE0_NV NONE NONE FALSE FALSE FALSE
119                    
120            # SPARE0.alpha <- SPARE0 + SPARE0.alpha
121            CI1 ALPHA A SPARE0_NV UNSIGNED_IDENTITY_NV BLUE
122            CI1 ALPHA B ZERO UNSIGNED_INVERT_NV ALPHA
123            CI1 ALPHA C SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA
124            CI1 ALPHA D ZERO UNSIGNED_INVERT_NV ALPHA
125            CO1 ALPHA DISCARD_NV DISCARD_NV SPARE0_NV NONE NONE FALSE FALSE FALSE
126            
127            # alpha <- SPARE0.alpha
128          FCI G SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA          FCI G SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA
129          """)          """)
130    
131            texenv_inner = texenv % "0 0 0 1"
132            texenv_outer = texenv % "%(dotvec)s 0"
133                    
134          alphalevel = 1          alphalevel = 1
135          w0,w1 = 1,1          w0,w1 = 1,1
# Line 141  def init(profile): Line 139  def init(profile):
139          tex_scale = 1          tex_scale = 1
140          tex_bias = 0          tex_bias = 0
141          tex_format = [ 4, "RGBA", "RGBA" ]          tex_format = [ 4, "RGBA", "RGBA" ]
142            
143      elif profile == "DOT3":      elif profile == "DOT3":
144          print "Using 1/4 displacement resolution textures with GL_EXT_texture_env_dot3"          print "Using 1/4 displacement resolution textures with GL_EXT_texture_env_dot3"
145            
# Line 339  def getIrregu(invert, x0, y0, x1, y1, ou Line 337  def getIrregu(invert, x0, y0, x1, y1, ou
337    
338      for i in range(0,4):      for i in range(0,4):
339          code += """          code += """
340          Color %s          %s %s
341          TexCoord %s          TexCoord %s
342          """ % (js(cols[i]), js(texcoords[0][i]))          """ % (("Color", "SecondaryColorEXT")[using_secondary_color],
343                   js(cols[i]), js(texcoords[0][i]))
344    
345          for u in range(1,len(texcoords)):          for u in range(1,len(texcoords)):
346              code += """              code += """

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

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