/[gzz]/gzz/gfx/demo/irregu3.py
ViewVC logotype

Diff of /gzz/gfx/demo/irregu3.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35 by jvk, Wed Oct 30 15:42:39 2002 UTC revision 1.36 by jvk, Thu Oct 31 17:35:54 2002 UTC
# Line 63  def init(profile): Line 63  def init(profile):
63      using_multitex = 0      using_multitex = 0
64    
65      if profile == "NV_PROG":      if profile == "NV_PROG":
66          code = """!FP1.0;          radius = 2
67          # Compute one pixel difference of texcoords in R0          dh = [ sqrt(radius**2 - d**2) for d in range(0,radius+1) ]
         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;  
68    
69          # Add c * sqrt(1 - r^2)          code = """!!FP1.0;
70          ...          # Inputs:
71                    # f[TEX0].xy texture coordinates
72          # Take maximum          # f[TEX0].z  displacement
73          ...          # f[TEX1].xy one-pixel difference of texcoords in the 1D slice
74            # f[TEX1].z  one-pixel difference of displacement
75    
76            # Read texture and add dh[0] value multiplied by R0.z
77            TEX R1, f[TEX0], TEX0, 2D;
78            MAD R1, %s, f[TEX1].z, R1;
79    
80            MOV R2, f[TEX0];
81            MOV R3, f[TEX0];
82            """ % dh[0]
83                    
84            for i in range(1,len(dh)):
85                code += """
86                # Read texture at +/- r and take the maximum
87                ADD R2, R2, f[TEX1];
88                ADD R3, R3, -f[TEX1];
89                TEX R4, R2, TEX0, 2D;
90                TEX R5, R3, TEX0, 2D;
91                MAX R4, R4, R5
92                """
93    
94                if dh[i]:
95                    code += """
96                    # Add dh[r] value multiplied by f[TEX1].z
97                    MAD R4, %s, f[TEX1].z, R4
98                    """  % dh[i]
99    
100                code += """
101                # Store maximum found in R1
102                MAX R1, R1, R4
103                """
104    
105            code += """
106            # Add displacement and use as output color
107            ADD o[COLR], R1, f[TEX0].z;
108          """          """
109            
110      if profile == "NV_SHAD":      if profile == "NV_SHAD":

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26