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: Fri, 01 Nov 2002 15:23:23 -0500

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

Modified files:
        gfx/demo       : irregu3.py 

Log message:
        Fix scaling problems in fragment program and multi-texture profiles

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

Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.39 gzz/gfx/demo/irregu3.py:1.40
--- gzz/gfx/demo/irregu3.py:1.39        Fri Nov  1 14:15:31 2002
+++ gzz/gfx/demo/irregu3.py     Fri Nov  1 15:22:57 2002
@@ -69,12 +69,12 @@
         dh = [ sqrt(radius**2 - d**2) for d in range(0,radius+1) ]
 
         prog_inner = GL.createProgram("""!!FP1.0
-        # f[TEX0].xy texture coordinates
+        # f[TEX0].xyw texture coordinates
         # f[TEX2].xy texture HI and LO component weights
         # f[TEX2].w  displacement (added to the weighted texture value)
 
         # Read texture
-        TEX R0, f[TEX0], TEX0, 2D;
+        TXP R0, f[TEX0], TEX0, 2D;
 
         # Weight, add displacement, and use as output color
         DP4 o[COLR], R0, f[TEX2];
@@ -83,7 +83,7 @@
 
         code = """!!FP1.0
         # Inputs:
-        # f[TEX0].xy texture coordinates        
+        # f[TEX0].xyw texture coordinates        
         # f[TEX1].xy one-pixel difference of texcoords in the 1D slice
         # f[TEX1].w  one-pixel difference of displacement
 
@@ -91,7 +91,7 @@
         # f[TEX2].w  displacement (added to the weighted texture value)
 
         # Read texture, weight, and add displacement
-        TEX R0, f[TEX0], TEX0, 2D;
+        TXP R0, f[TEX0], TEX0, 2D;
         DP4 R0, R0, f[TEX2];
 
         # Add dh[0] value multiplied by f[TEX1].w
@@ -104,10 +104,10 @@
         for i in range(1,len(dh)):
             code += """
             # Read texture at +/- r
-            ADD R2, R2, f[TEX1];
-            ADD R3, R3, -f[TEX1];
-            TEX R4, R2, TEX0, 2D;
-            TEX R5, R3, TEX0, 2D;
+            ADD R2.xy, R2, f[TEX1];
+            ADD R3.xy, R3, -f[TEX1];
+            TXP R4, R2, TEX0, 2D;
+            TXP R5, R3, TEX0, 2D;
 
             # Weight, add displacement, and take the maximum
             DP4 R4, R4, f[TEX2];
@@ -492,14 +492,14 @@
         # XXX: scaling doesn't work properly because the coordinate
         #      transformation is not known here
         #
-        # t:     distance between texcoords
+        # m:     distance between texcoords
         # alpha: value added to the displacement values
         # blue:  value added to the middle displacement (in addition to alpha)
-        t = 1. / scale
+        m = 1.0 / (striplen * scale)
         alpha = 1.5 / (scale * ripple_scale * texscale)
-        blue = 1. / (scale * ripple_scale * texscale)
+        blue = 1.0 / (scale * ripple_scale * texscale)
 
-        print t*scale,alpha*256,blue*256
+        #print m*scale,alpha*256,blue*256
         
         code += """
         ActiveTexture TEXTURE1
@@ -517,8 +517,8 @@
         Color 0 0 %(blue)s %(alpha)s
         """ % locals()
 
-        dx = cos(angle) * t
-        dy = sin(angle) * t
+        dx = m * (x1 - x0)
+        dy = m * (y1 - y0)
         
         texcoords += [ [ vecmul((x0+dx,y0+dy,0,texscale), w0),
                          vecmul((x0+dx,y0+dy,0,texscale), w1),
@@ -553,7 +553,7 @@
         dx = cos(angle)
         dy = sin(angle)
 
-        m = texscale / (striplen * scale)
+        m = 1.0 / (striplen * scale)
         vec = (m * (x1 - x0),
                m * (y1 - y0),
                0,




reply via email to

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