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: Sun, 01 Dec 2002 01:20:59 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/12/01 01:20:57

Modified files:
        gfx/demo       : irregu4.py 

Log message:
        Shape screenshots

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

Patches:
Index: gzz/gfx/demo/irregu4.py
diff -u gzz/gfx/demo/irregu4.py:1.34 gzz/gfx/demo/irregu4.py:1.35
--- gzz/gfx/demo/irregu4.py:1.34        Sat Nov 30 16:42:58 2002
+++ gzz/gfx/demo/irregu4.py     Sun Dec  1 01:20:57 2002
@@ -649,46 +649,108 @@
 
 
 class ShapeScene:
+    def key(self, k):
+        pass
+
+    def __init__(self, type = 0, outer = 1, alphatest = 1, tex = 1, color = 1, 
inside = 1, xs = 600, ys = 600):
+        self.type = type
+        self.outer = outer
+        self.alphatest = alphatest
+        self.inside = inside
+        self.tex = tex
+        self.color = color
+        self.xs = xs
+        self.ys = ys
+    
     def scene(self, vs):
         putnoc(vs, background((1.0,1.0,1.0)))
 
-        xs = 256
-        ys = 256
+        shape = 9
+        texscale = 1.3
+        linewidth = 4
+        refsize = 128
+        scale_pow = 0
+        border0 = -.25
+        border1 = .25 
+        texslicing = 0.0
 
-        w = 2
-        h = 2
-        for y in range(0,h):
-            for x in range(0,w):
+        dice = 1.0 / 36 * 16 + 1E-5
 
-                
-                shape = 10
-                texscale = 1
-                linewidth = 4
-                refsize = 128
-                scale_pow = 0
-                border0 = -.5 * ripple_scale * texscale
-                border1 = .5 * ripple_scale * texscale 
-                texslicing = 0.0
-                
-                edge = GLRen.createIrregularEdge(
-                    shape, texscale, linewidth, refsize, scale_pow,
-                    border0, border1, texslicing,
-                    "0 0 0 1 0 0 0 0", "", 0, 0, SLICE_1D + Y_COLOR, # + 
INSIDE,
-                    stdcode, 1.0)
-                
-                cs1 = vs.coords.affineCoordsys(0, 10,
-                                               (x+1) * xs, (y+1) * ys,
-                                               xs/3., 0, 0, ys/3.,
-                                               )
+        code = stdcode
+
+        if self.type == 1:
+            texslicing = 1
+
+        if not self.alphatest:
+            code += "Disable ALPHA_TEST\n"
+
+        if not self.tex:
+            code += "Disable TEXTURE_2D\n"
+
+        if self.type == 2:
+            if not self.outer:
+                border0,border1=0,0
+            inner = GLRen.createIrregularEdge(
+                shape,
+                texscale, linewidth, refsize, scale_pow,
+                border0, border1, 1.0,
+                "", "", 0, 0,
+                65536,
+                offset_code + parseCombiner("color = 1"), 1.0)
+            outer = GLRen.createIrregularEdge(shape,
+                texscale, linewidth, refsize, scale_pow,
+                border0, border1, 1.0,
+                "", "", 0, 0,
+                SHIFTS8 + 65536,
+                offset_code, 1.0)
+        else:
+            inside = self.inside * INSIDE
+
+            if self.color:
+                c1 = "1 1 1 1 0 0 0 0"
+            else:
+                c1 = "0 0 0 0 0 0 0 0"
+
+            outer = GLRen.createIrregularEdge(
+                shape, texscale, linewidth, refsize, scale_pow,
+                border0, border1, texslicing,
+                c1, "", 0, 0, SLICE_1D + Y_COLOR + SHIFTS8 + inside,
+                code + """
+                BlendFunc ZERO ZERO
+                Enable BLEND
+                """, dice)
+            if self.outer:
+                code += parseCombiner("""
+                SPARE0.alpha = TEX0.alpha + COL0.alpha
+                alpha = SPARE0.alpha
+                color = 1
+                Enable REGISTER_COMBINERS_NV
+                PolygonMode FRONT_AND_BACK FILL
+                #PolygonMode FRONT_AND_BACK LINE
+                """)
+            code += """
+                Disable BLEND
+            """
             
-                vs.matcher.add(cs1, "1,%s,%s" % (x,y))
+            inner = GLRen.createIrregularEdge(
+                shape, texscale, linewidth, refsize, scale_pow,
+                border0, border1, texslicing,
+                c1, "", 0, 0, SLICE_1D + Y_COLOR + inside,
+                code, dice)
                 
-                cs2 = vs.coords.affineCoordsys(0, 0,  0, 0,   1, 0, 0, 1);
-                vs.matcher.add(cs1, "2")
+        cs1 = vs.coords.affineCoordsys(0, 10,
+                                       self.xs*.5, self.ys*.5,
+                                       self.xs * .4, 0, 0, self.ys * .4,
+                                       )
+            
+        vs.matcher.add(cs1, "1")
                 
-                vs.map.put(edge, cs1, cs2)
-
+        cs2 = vs.coords.affineCoordsys(0, 0,  0, 0,   1, 0, 0, 1);
+        vs.matcher.add(cs1, "2")
 
+        if self.outer or self.type == 2:
+            vs.map.put(outer, cs1, cs2)
+        vs.map.put(inner, cs1, cs2)
 
 class StillMotionScene:
     def __init__(self, type = 0, flag = 0):
@@ -885,7 +947,6 @@
     saveanim.saveframe(filename, w)
 
 def makeScreenshots():
-    w.setLocation(0,0,1024,768)
 
     # flag = 0: canvas edge shown
     # flag = 1: no canvas edge shown
@@ -897,26 +958,51 @@
     # other parameters are hardcoded
     # with if's in StillMotionScene class
 
-    ## pre-computed angles
-    #ps = StillMotionScene(type = "0b", flag = 1)
-    #r(ps, "shots/motion0b.png")
-
-    ps = StillMotionScene(type = 0)
-    r(ps, "shots/motion.png")
-
-    ps = StillMotionScene(type = 0, flag = 1)
-    r(ps, "shots/motion0.png")
-    ps = StillMotionScene(type = 1, flag = 1)
-    r(ps, "shots/motion1.png")
-
-    if globals().has_key("texHILO"):
-        ps = StillMotionScene(type = 2, flag = 2)
-        r(ps, "shots/motion2.png")
+    if 0:
+        w.setLocation(0,0,1024,768)
+        ## pre-computed angles
+        #ps = StillMotionScene(type = "0b", flag = 1)
+        #r(ps, "shots/motion0b.png")
+
+        ps = StillMotionScene(type = 0)
+        r(ps, "shots/motion.png")
+
+        ps = StillMotionScene(type = 0, flag = 1)
+        r(ps, "shots/motion0.png")
+        ps = StillMotionScene(type = 1, flag = 1)
+        r(ps, "shots/motion1.png")
+
+        if globals().has_key("texHILO"):
+            ps = StillMotionScene(type = 2, flag = 2)
+            r(ps, "shots/motion2.png")
+
+
+    if 1:
+        w.setLocation(0,0,600,600)
+
+        ps = ShapeScene(type = 0)
+        r(ps, "shots/shape1Ddispl.png")
+        ps = ShapeScene(type = 0, outer = 0, inside = 0, color = 1, alphatest 
= 0, tex = 0)
+        r(ps, "shots/shape1Dcolor.png")
+        ps = ShapeScene(type = 0, outer = 0, inside = 0, color = 1, alphatest 
= 0, tex = 1)
+        r(ps, "shots/shape1Ddispltex_color.png")
+        ps = ShapeScene(type = 0, outer = 0, inside = 0, color = 0, alphatest 
= 0, tex = 1)
+        r(ps, "shots/shape1Ddispltex.png")
+        ps = ShapeScene(type = 1)
+        r(ps, "shots/shape1Doffset.png")
+        ps = ShapeScene(type = 1, outer = 0, inside = 0, color = 1, alphatest 
= 0, tex = 1)
+        r(ps, "shots/shape1Doffsettex_color.png")
+        ps = ShapeScene(type = 1, outer = 0, inside = 0, color = 0, alphatest 
= 0, tex = 1)
+        r(ps, "shots/shape1Doffsettex.png")
+        ps = ShapeScene(type = 2)
+        r(ps, "shots/shape2D.png")
+        ps = ShapeScene(type = 2, outer = 0)
+        r(ps, "shots/shape2Dorig.png")
 
 currentScene = IrreguScene()
 
-#currentScene = StillMotionScene(type = 1, flag = 1)
+#currentScene = ShapeScene(type = 2, outer = 0)
 
-#currentScene = ShapeScene()
+#currentScene = StillMotionScene(type = 1, flag = 1)
 
 #GL.call("PolygonMode FRONT_AND_BACK FILL")




reply via email to

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