gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx demo/paperbasis.py libpaper/textures.py


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx demo/paperbasis.py libpaper/textures.py
Date: Tue, 26 Nov 2002 05:28:50 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/11/26 05:28:49

Modified files:
        gfx/demo       : paperbasis.py 
        gfx/libpaper   : textures.py 

Log message:
        tripleproduct

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paperbasis.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/textures.py.diff?tr1=1.38&tr2=1.39&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/paperbasis.py
diff -u gzz/gfx/demo/paperbasis.py:1.19 gzz/gfx/demo/paperbasis.py:1.20
--- gzz/gfx/demo/paperbasis.py:1.19     Tue Nov 26 04:30:44 2002
+++ gzz/gfx/demo/paperbasis.py  Tue Nov 26 05:28:49 2002
@@ -59,27 +59,42 @@
     """),
     "BAND2" : nvcode.parseCombiner("""
        SPARE0 = ((2*TEX0-1) . (2*TEX1-1)) * 4
+       SPARE1 = ((2*TEX0-1).(2*CONST0-1)) * 2
+       SPARE1.a = ((TEX1.blue)*(TEX0.blue)) * 4
 
        SPARE0 = ((+SPARE0)*(+SPARE0)) * 2
-       SPARE1 = ((2*TEX0-1).(2*CONST0-1)) * 2
+       SPARE1 = (SPARE1) + (SPARE1.a)
 
        color = SPARE0 * SPARE1
        alpha = 1
     """),
     "BAND3" : nvcode.parseCombiner("""
        SPARE0 = ((2*TEX0-1) . (2*TEX1-1)) * 4
+       SPARE1 = ((2*TEX0-1).(2*CONST0-1)) * 2
+       SPARE1.a = ((TEX1.blue)*(TEX0.blue)) * 4
 
        SPARE0 = ((+SPARE0)*(+SPARE0)) * 2
-       SPARE1 = ((2*TEX0-1).(2*CONST0-1)) * 2
+       SPARE1 = (SPARE1) + (SPARE1.a)
 
        EF = SPARE0 * SPARE1
        color = EF*COL0 + (1-EF)*COL1
        alpha = 1
     """),
+    "BANDX_2" : nvcode.parseCombiner("""
+       SPARE0 = ((2*TEX0-1) * (2*TEX1-1)) * 4
+       SPARE1 = ((2*TEX0-1).(2*CONST0-1)) * 2
+       SPARE1.a = ((TEX1.blue)*(TEX0.blue)) * 4
+
+       SPARE0 = ((+SPARE0).(2*CONST0-1)) * 2
+       SPARE1 = (SPARE1) + (SPARE1.a)
+
+       color = SPARE0 
+       alpha = 1
+    """),
 }
 
 
-def getpaper(vecs, cols, tex0comb, isectcomb, tex1comb):
+def getpaper(vecs, cols, t0, t1, tex0comb, isectcomb, tex1comb):
     pap = Paper()
     pap.setNPasses(1)
     ppass = pap.getPass(0)
@@ -91,12 +106,14 @@
             ActiveTexture TEXTURE0
     """)
 
-    texid = gfx.libpaper.textures.ptextures["RGB2"][1].getTexId();
+    # texid = gfx.libpaper.textures.ptextures["RGB2"][1].getTexId();
+    texid0 = gfx.libpaper.textures.getNamed("RGB2", t0).getTexId()
+    texid1 = gfx.libpaper.textures.getNamed("RGB2", t1).getTexId()
     
     constcode = """
         ActiveTexture TEXTURE0
         Enable TEXTURE_2D
-        BindTexture TEXTURE_2D %(texid)s
+        BindTexture TEXTURE_2D %(texid0)s
         TexParameter TEXTURE_2D TEXTURE_WRAP_S REPEAT
         TexParameter TEXTURE_2D TEXTURE_WRAP_T REPEAT
         TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
@@ -104,7 +121,7 @@
         
         ActiveTexture TEXTURE1
         Enable TEXTURE_2D
-        BindTexture TEXTURE_2D %(texid)s
+        BindTexture TEXTURE_2D %(texid1)s
         TexParameter TEXTURE_2D TEXTURE_WRAP_S REPEAT
         TexParameter TEXTURE_2D TEXTURE_WRAP_T REPEAT
         TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
@@ -129,7 +146,7 @@
     """ % locals()
 
     return GLRen.createBasisPaperQuad(pap, 0, 0, 1, 1,
-                                   2.8,
+                                   3.0,
                                       constcode + texcodes[tex0comb],
                                       constcode + texcodes[tex1comb],
                                       constcode + texcodes[isectcomb])
@@ -202,7 +219,9 @@
         elif k == "Right": self.x0 += self.deltac
 
     def place(self, vs, into, t1, c, t2):
-        pq = getpaper(self.vecs, self.cols, t1, c, t2)
+        pq = getpaper(self.vecs, self.cols, 
+           "pyramid", "triangle",
+           t1, c, t2)
 
 
         # cs1 and cs2 specify the mapping from the texture coords
@@ -299,11 +318,19 @@
        
        self.pt.place(vs,
            vs.orthoCS(0, "S4", 0, 200, 400, 200, 200),
-           "RGB0", "BAND2", "RGB1")
+           "RGB0", "BAND1", "RGB1")
        
        self.pt.place(vs,
            vs.orthoCS(0, "S5", 0, 200, 550, 200, 200),
+           "RGB0", "BAND2", "RGB1")
+       
+       self.pt.place(vs,
+           vs.orthoCS(0, "S6", 0, 500, 550, 200, 200),
            "RGB0", "BAND3", "RGB1")
+       
+       self.pt.place(vs,
+           vs.orthoCS(0, "S8", 0, 500, 150, 400, 400),
+           "RGB0", "BANDX_2", "RGB1")
 
 currentScene = PaperFlowScene()        
 
Index: gzz/gfx/libpaper/textures.py
diff -u gzz/gfx/libpaper/textures.py:1.38 gzz/gfx/libpaper/textures.py:1.39
--- gzz/gfx/libpaper/textures.py:1.38   Sat Nov 23 14:03:35 2002
+++ gzz/gfx/libpaper/textures.py        Tue Nov 26 05:28:49 2002
@@ -50,6 +50,17 @@
         return self.name
 
 
+def getNamed(type, name):
+    """Get a texture of the particular type
+    with the given name.
+
+    E.g. getNamed("RGB2", "turb")
+    """
+
+    for t in ptextures[type]:
+       if t.getName() == name:
+           return t
+    return None
 
 initialized = 0
 def init(texture_components, texture_format):




reply via email to

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