/[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.7 by tjl, Wed Apr 23 14:30:00 2003 UTC revision 1.8 by tjl, Tue Apr 29 11:22:41 2003 UTC
# Line 118  void main( Line 118  void main(
118          uniform float2 meas: register(c0),          uniform float2 meas: register(c0),
119          uniform sampler2D t0: TEXUNIT0,          uniform sampler2D t0: TEXUNIT0,
120          out half4 color: COLOR) {          out half4 color: COLOR) {
121        float2 tx = ddx(t);
122        float2 ty = ddy(t);
123    
124        float le = sqrt(length(tx) * length(ty));
125    
126        t -= .5*(tx + ty);
127    
128        float c = 1;
129    
130        float2 dx = tx, dy = ty;
131        half4 c0 = tex2D(t0, t + c*(dx+dy));
132        half4 c1 = tex2D(t0, t + c*(dx));
133        half4 c2 = tex2D(t0, t + c*(dy));
134        half4 c3 = tex2D(t0, t );
135    
136        half4 dists = 256 * 16 * half4(
137            c0.x,
138            c1.x,
139            c2.x,
140            c3.x);
141    
142        float tdx = (dists.x + dists.y - dists.z - dists.w);
143        float tdy = (dists.x + dists.z - dists.y - dists.w);
144    
145        float ax = abs(tdx);
146        float ay = abs(tdy);
147    
148        float maxx = max(ax, ay);
149        float minx = min(ax, ay);
150    
151        float angle = (maxx < .001 ? 0 : minx / maxx);
152    
153        float grayval = .25 * dot(clamp((dists + le) / le, 0,1),
154                            half(1).xxxx).x;
155    
156        color.x = (angle * angle);
157        color.y = .25 * dot((dists>float(0.).xxxx), half(1).xxxx).x;
158        color.z = grayval;
159    
160        float tres = (1 - angle*angle);
161    
162        float tt = .25;
163    
164        color.xyz = smoothstep(
165                tt * tres, tt + (1-tt) * (1-tres),
166            grayval
167                );
168    //    color.x = grayval;
169    //    color.x = !isfinite(angle);
170    //    color.y = !isfinite(tdx);
171    //    color.z = !isfinite(tdy);
172    
173        color.w = (grayval < 1);
174        color.w = 1;
175    
176    }
177    
178    
179    """, "fp30")),
180    
181    GL.createProgram(cg.compile("""
182    void main(
183            float2 t : TEXCOORD0,
184            uniform float2 meas: register(c0),
185            uniform sampler2D t0: TEXUNIT0,
186            out half4 color: COLOR) {
187  //    if(tex2D(t0, t).x > 0) discard;  //    if(tex2D(t0, t).x > 0) discard;
188      half4 ders;      half4 ders;
189      ders.xy = ddx(t);      ders.xy = ddx(t);

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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