gzz-commits
[Top][All Lists]
Advanced

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

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


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/demo irregu4.py
Date: Mon, 11 Nov 2002 10:37:14 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/11/11 10:37:13

Modified files:
        gfx/demo       : irregu4.py 

Log message:
        Visualize texture slicing, adding color, and alpha test

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

Patches:
Index: gzz/gfx/demo/irregu4.py
diff -u gzz/gfx/demo/irregu4.py:1.3 gzz/gfx/demo/irregu4.py:1.4
--- gzz/gfx/demo/irregu4.py:1.3 Mon Nov 11 09:51:09 2002
+++ gzz/gfx/demo/irregu4.py     Mon Nov 11 10:37:13 2002
@@ -29,7 +29,12 @@
         self.xs = 1
         self.ys = 1
         self.scale = 1
-        
+
+        self.flags = 255
+
+        self.initcode()
+
+    def initcode(self):
         code = combinercode("""
                 PushAttrib ENABLE_BIT TEXTURE_BIT
         
@@ -191,15 +196,12 @@
         border1 = .5
         ripple_scale = .25
 
-        self.inner = GLRen.createIrregularEdge(
-            texscale, linewidth, scale_pow, border0, border1, ripple_scale,
-            "1 1 1 1", "0 0 0 0", 0, 0,
-            Y_SECCOLOR + SLICE_1D,
-            inner_code, 1.0); 
+        SLICE = (SLICE_2D, SLICE_1D)[self.flags >> 4 & 1]
+
         self.outer = GLRen.createIrregularEdge(
             texscale, linewidth, scale_pow, border0, border1, ripple_scale,
             "1 1 1 1", "0 0 0 0", 3, 0,
-            Y_SECCOLOR + SLICE_1D + DOTVEC_COLOR + INTERP_DOTVEC,
+            Y_SECCOLOR + SLICE + DOTVEC_COLOR + INTERP_DOTVEC,
             outer_code, 1.0);
 
         if (GL.getGLFloat("MAX_GENERAL_COMBINERS_NV")[0] >= 4 and
@@ -210,9 +212,31 @@
             self.outer = GLRen.createIrregularEdge(
                 texscale, linewidth, scale_pow, border0, border1, ripple_scale,
                 "1 1 1 1", "0 0 0 0", 0, 1,
-                Y_SECCOLOR + SLICE_1D,
+                Y_SECCOLOR + SLICE,
                 outer_code, 1.0);
+
+        stdcode = """
+            PushAttrib ENABLE_BIT TEXTURE_BIT
+            BindTexture TEXTURE_2D %s
+            TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
+            TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
+            Enable TEXTURE_2D
+            TexEnv TEXTURE_ENV TEXTURE_ENV_MODE ADD
+            Enable ALPHA_TEST
+            AlphaFunc GEQUAL 1.0
+            """  % texINTENSITY.getTexId() 
         
+        if (self.flags & 1) == 0:
+            stdcode += "Disable TEXTURE_2D\n"
+        if (self.flags & 4) == 0:
+            stdcode += "Disable ALPHA_TEST\n"
+            
+        self.inner = GLRen.createIrregularEdge(
+            texscale, linewidth, scale_pow, border0, border1, ripple_scale,
+            ("0 0 0 0", "1 1 1 1")[self.flags >> 1 & 1], "0 0 0 0", 0, 0,
+            SLICE + Y_COLOR, stdcode, 1.0);
+ 
+
     def scene(self, vs):
         putnoc(vs, self.bg)
 
@@ -230,8 +254,17 @@
                                        self.scale * 150)
        vs.matcher.add(cs1, "1")
 
-        vs.map.put(self.outer, cs1, cs2)
-        vs.map.put(self.inner, cs1, cs2)
+        if self.flags & 8:
+            vs.map.put(self.outer, cs1, cs2)
+
+        if self.flags & 7:
+            vs.map.put(self.inner, cs1, cs2)
+
+        print "1: ADD TEXTURE", self.flags >> 0& 1
+        print "2: ADD COLOR", self.flags >> 1 & 1
+        print "3: ALPHA_TEST", self.flags >> 2 & 1
+        print "4: OUTER EDGE", self.flags >> 3 & 1
+        print "5: 1D SLICE", self.flags >> 4 & 1
 
     def key(self, k):
         if 0: pass
@@ -249,6 +282,10 @@
         elif k == "Y": self.ys -= .1
         elif k == "+": self.scale += .1
         elif k == "-": self.scale -= .1
+        elif "1" <= k <= "9":
+            self.flags ^= 1 << int(k) - 1
+            self.initcode()
+        
 
 
 currentScene = IrreguScene()




reply via email to

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