gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx/demo irregu3.py


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/demo irregu3.py
Date: Tue, 29 Oct 2002 04:43:44 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/29 04:43:44

Modified files:
        gfx/demo       : irregu3.py 

Log message:
        Rewrite register combiner code to compute 
dot4(texture,color)+secondary_color; allows using four different stored angles 
or interpolating the outer edge towards the inner edge to facilitate better 
magnification

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.26&tr2=1.27&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.26 gzz/gfx/demo/irregu3.py:1.27
--- gzz/gfx/demo/irregu3.py:1.26        Mon Oct 28 13:55:14 2002
+++ gzz/gfx/demo/irregu3.py     Tue Oct 29 04:43:44 2002
@@ -33,9 +33,10 @@
     global tex, texinv
     global texenv_inner, texenv_outer, alphalevel, w0, w1
     global colmap0, colmap1
-    global using_shader
+    global using_shader, using_secondary_color
 
     using_shader = 0
+    using_secondary_color = 0
     
     if profile == "NV_SHAD":
         print "Using 2-vector HILO displacement texture with 
GL_NV_texture_shader"
@@ -94,44 +95,41 @@
 
     elif profile == "NV_COMB":
         print "Using full displacement resolution textures with 
GL_NV_register_combiners"
+
+        using_secondary_color = 1
     
         from gfx.libutil.nvcode import combinercode
-        texenv_outer = combinercode("""
-        SecondaryColorEXT %(dotvec)s
-
+        texenv = combinercode("""
+        Color %s
+        
         Enable REGISTER_COMBINERS_NV
         CombinerParameterNV NUM_GENERAL_COMBINERS_NV 2
-        
-        # Compute TEXTURE . SECONDARY_COLOR dot product
+
+        # SPARE0 <- TEXTURE0 . COLOR
         CI0 RGB A TEXTURE0 UNSIGNED_IDENTITY_NV RGB
-        CI0 RGB B SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
+        CI0 RGB B PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV RGB
         CO0 RGB SPARE0_NV DISCARD_NV DISCARD_NV NONE NONE TRUE FALSE FALSE
-        
-        # Add PRIMARY_COLOR
-        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
-        
+
+        # SPARE0.alpha <- TEXTURE0.alpha * COLOR.alpha + SEC_COLOR.b
         CI0 ALPHA A TEXTURE0 UNSIGNED_IDENTITY_NV ALPHA
-        CI0 ALPHA B ZERO UNSIGNED_INVERT_NV ALPHA
-        CI0 ALPHA C PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE
+        CI0 ALPHA B PRIMARY_COLOR_NV UNSIGNED_IDENTITY_NV ALPHA
+        CI0 ALPHA C SECONDARY_COLOR_NV UNSIGNED_IDENTITY_NV BLUE
         CI0 ALPHA D ZERO UNSIGNED_INVERT_NV ALPHA
         CO0 ALPHA DISCARD_NV DISCARD_NV SPARE0_NV NONE NONE FALSE FALSE FALSE
         
+        # SPARE0.alpha <- SPARE0 + SPARE0.alpha
+        CI1 ALPHA A SPARE0_NV UNSIGNED_IDENTITY_NV BLUE
+        CI1 ALPHA B ZERO UNSIGNED_INVERT_NV ALPHA
+        CI1 ALPHA C SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA
+        CI1 ALPHA D ZERO UNSIGNED_INVERT_NV ALPHA
+        CO1 ALPHA DISCARD_NV DISCARD_NV SPARE0_NV NONE NONE FALSE FALSE FALSE
+        
+        # alpha <- SPARE0.alpha
         FCI G SPARE0_NV UNSIGNED_IDENTITY_NV ALPHA
         """)
+
+        texenv_inner = texenv % "0 0 0 1"
+        texenv_outer = texenv % "%(dotvec)s 0"
         
         alphalevel = 1
         w0,w1 = 1,1
@@ -141,7 +139,7 @@
         tex_scale = 1
         tex_bias = 0
         tex_format = [ 4, "RGBA", "RGBA" ]
-        
+
     elif profile == "DOT3":
         print "Using 1/4 displacement resolution textures with 
GL_EXT_texture_env_dot3"
     
@@ -339,9 +337,10 @@
 
     for i in range(0,4):
         code += """
-        Color %s
+        %s %s
         TexCoord %s
-        """ % (js(cols[i]), js(texcoords[0][i]))
+        """ % (("Color", "SecondaryColorEXT")[using_secondary_color],
+               js(cols[i]), js(texcoords[0][i]))
 
         for u in range(1,len(texcoords)):
             code += """




reply via email to

[Prev in Thread] Current Thread [Next in Thread]