/[libvob]/libvob/vob/demo/fpfont.py
ViewVC logotype

Diff of /libvob/vob/demo/fpfont.py

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

revision 1.3 by tjl, Fri Apr 11 12:52:51 2003 UTC revision 1.4 by tjl, Fri Apr 11 20:41:24 2003 UTC
# Line 93  tex = getCachedTexture(args[7]) Line 93  tex = getCachedTexture(args[7])
93    
94  # 16 * texel [1/512]  # 16 * texel [1/512]
95    
96  fp = [  from vob.putil import cg
97    
98    fp = [GL.createProgram(cg.compile("""
99    void main(
100            float2 t : TEXCOORD0,
101            uniform float2 meas: register(c0),
102            uniform sampler2D t0: TEXUNIT0,
103            out half4 color: COLOR) {
104    //    if(tex2D(t0, t).x > 0) discard;
105        half4 ders;
106        ders.xy = ddx(t);
107        ders.zw = ddy(t);
108    
109        half2 dx = ders.xy;
110        half2 dy = ders.zw;
111        
112        half4 dersq = ders * ders;
113    
114        half2 dersums = dersq.xz + dersq.yw;
115        half l = max(dersums.x, dersums.y);
116        l = sqrt(l);
117        // l = max(length(ddx(t)), length(ddy(t)))
118    
119        // * 512 = texture width
120        // / 2 = half, for radius
121        // / 2 = half, for x-sampling pattern
122        half maxrad = l * 512 / 2 / 2 * meas.y;
123    
124        half4 c0 = tex2D(t0, t + meas.x*(dx+dy));
125    
126    
127        half4 c1 = tex2D(t0, t + meas.x*(dx-dy));
128        half4 c2 = tex2D(t0, t + meas.x*(-dx+dy));
129        half4 c3 = tex2D(t0, t + meas.x*(-dx-dy));
130    
131        half4 dists = half4(
132            // c0.x + c0.w * 256,
133            c0.w + c0.x * 256,
134            c1.x + c1.w * 256,
135            c2.x + c2.w * 256,
136            c3.x + c3.w * 256);
137    
138    
139        dists *= 16;
140    
141    
142        fixed c = dot(dists <= maxrad, fixed4(1,1,1,1)) / 4;
143    
144        fixed rgb = (1 - c);
145    
146        color.xyz = rgb;
147    //    color.y = c0.x - maxrad * 1000;
148     //   color.z = c0.w + maxrad * 1000;
149        color.w = 1;
150    
151    }
152    
153    
154    """, "fp30")),
155  GL.createProgram("""!!FP1.0  GL.createProgram("""!!FP1.0
156    DECLARE meas;
157  MOV R10, f[TEX0].xyzw;  MOV R10, f[TEX0].xyzw;
158  DDX R8, R10;  DDX R8, R10;
159  DDY R9, R10;  DDY R9, R10;
# Line 449  class Scene(vob.util.PS2Reader.Listener) Line 508  class Scene(vob.util.PS2Reader.Listener)
508          parcs = vs.orthoCS(0, "para", 0, 0, 0, 0, 0)          parcs = vs.orthoCS(0, "para", 0, 0, 0, 0, 0)
509    
510    
511          vs.put( GLRen.createProgramLocalParameterARB("FRAGMENT_PROGRAM_ARB", 0),          vs.put( GLRen.createProgramNamedParameterNV(fpid, "meas"),
512              parcs)              parcs)
513    
514          cs = vs.rotateCS(cs, "b", self.a)          cs = vs.rotateCS(cs, "b", self.a)

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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