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: Thu, 31 Oct 2002 12:35:54 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/31 12:35:54

Modified files:
        gfx/demo       : irregu3.py 

Log message:
        More fragment program

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

Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.35 gzz/gfx/demo/irregu3.py:1.36
--- gzz/gfx/demo/irregu3.py:1.35        Wed Oct 30 10:42:39 2002
+++ gzz/gfx/demo/irregu3.py     Thu Oct 31 12:35:54 2002
@@ -63,37 +63,48 @@
     using_multitex = 0
 
     if profile == "NV_PROG":
-        code = """!FP1.0;
-        # Compute one pixel difference of texcoords in R0
-        DDX R0, f[TEX0];
-        DDY R1, f[TEX0];
-        MUL R0, R0, R0;
-        MAD R0, R1, R1;
-        RSQ R1.x, R0.x;
-        RSQ R1.y, R0.y;
-        MUL R0, R1;
-
-        # Compute texcoord +/- 1 pixel
-        ADD R1, f[TEX0], R0;
-        ADD R2, f[TEX0], -R0;
-
-        # Compute texcoord +/- 2 pixels
-        ADD R3, R1, R0;
-        ADD R4, R2, -R0;
-
-        # Read texture
-        TEX R0, R0, TEX0, 2D;
-        TEX R1, R1, TEX0, 2D;
-        TEX R2, R2, TEX0, 2D;
-        TEX R3, R3, TEX0, 2D;
-        TEX R4, R4, TEX0, 2D;
+        radius = 2
+        dh = [ sqrt(radius**2 - d**2) for d in range(0,radius+1) ]
 
-        # Add c * sqrt(1 - r^2) 
-        ...
-        
-        # Take maximum
-        ...
+        code = """!!FP1.0;
+        # Inputs:
+        # f[TEX0].xy texture coordinates
+        # f[TEX0].z  displacement
+        # f[TEX1].xy one-pixel difference of texcoords in the 1D slice
+        # f[TEX1].z  one-pixel difference of displacement
+
+        # Read texture and add dh[0] value multiplied by R0.z
+        TEX R1, f[TEX0], TEX0, 2D;
+        MAD R1, %s, f[TEX1].z, R1;
+
+        MOV R2, f[TEX0];
+        MOV R3, f[TEX0];
+        """ % dh[0]
         
+        for i in range(1,len(dh)):
+            code += """
+            # Read texture at +/- r and take the maximum
+            ADD R2, R2, f[TEX1];
+            ADD R3, R3, -f[TEX1];
+            TEX R4, R2, TEX0, 2D;
+            TEX R5, R3, TEX0, 2D;
+            MAX R4, R4, R5
+            """
+
+            if dh[i]:
+                code += """
+                # Add dh[r] value multiplied by f[TEX1].z
+                MAD R4, %s, f[TEX1].z, R4
+                """  % dh[i]
+
+            code += """
+            # Store maximum found in R1
+            MAX R1, R1, R4
+            """
+
+        code += """
+        # Add displacement and use as output color
+        ADD o[COLR], R1, f[TEX0].z;
         """
     
     if profile == "NV_SHAD":




reply via email to

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