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

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

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

revision 1.3 by tjl, Tue Apr 29 12:21:47 2003 UTC revision 1.4 by tjl, Wed Apr 30 08:37:54 2003 UTC
# Line 6  from vob.putil.demokeys import * Line 6  from vob.putil.demokeys import *
6  from vob.paper.texcache import getCachedTexture  from vob.paper.texcache import getCachedTexture
7    
8  noise = getCachedTexture(  noise = getCachedTexture(
9      [1024, 1024, 0, 4, "RGBA", "RGBA", "noise",      [1024, 512, 0, 4, "RGBA", "RGBA", "noise",
10          [ "freq", "100", "bias", ".5", "scale", ".8" ]]          [ "freq", "100", "bias", ".5", "scale", ".8" ]]
11      )      )
12    
13    lnoise = getCachedTexture(
14        [256, 256, 0, 4, "RGBA", "RGBA", "noise",
15            [ "freq", "10", "bias", ".5", "scale", ".8" ]]
16        )
17    
18    turb = getCachedTexture(
19        [512, 512, 0, 4, "RGBA", "RGBA", "fnoise",
20            [ "turb", "1",  "freq", "1", "scale", ".3", "bias", ".3",
21                "freq2", "100", "df", "1",
22                 ]]
23        )
24    
25    
26    
27  vp = [  vp = [
# Line 35  void main( Line 47  void main(
47      float inter = frac(4*pos.x);      float inter = frac(4*pos.x);
48      float edgeind = fmod(floor(4*pos.x), 4) ;      float edgeind = fmod(floor(4*pos.x), 4) ;
49    
50    
51      float4 xa = float4(0,0,0,1);      float4 xa = float4(0,0,0,1);
52      float4 xb = float4(0,0,0,1);      float4 xb = float4(0,0,0,1);
53    
# Line 44  void main( Line 57  void main(
57      xb.x = (edgeind >= 1 && edgeind < 3);      xb.x = (edgeind >= 1 && edgeind < 3);
58      xb.y = (edgeind >= 0 && edgeind < 2);      xb.y = (edgeind >= 0 && edgeind < 2);
59    
60    /* DOESN'T WORK
61    
62        float4 xa = edge[edgeind];
63        float4 xb = edge[edgeind+1];
64    */
65    
66    
67      float4 x = lerp(xa, xb, inter);      float4 x = lerp(xa, xb, inter);
# Line 90  GL.createProgram(cg.compile(""" Line 108  GL.createProgram(cg.compile("""
108  void main(  void main(
109          float4 p: TEXCOORD0,          float4 p: TEXCOORD0,
110          out float4 ocol: COLOR,          out float4 ocol: COLOR,
111          uniform sampler2D t0: TEXUNIT0          uniform sampler2D t0: TEXUNIT0,
112            uniform sampler2D t1: TEXUNIT1
113  ) {  ) {
114      float3 dark = float3(186, 71, 18) / 255.0;      float3 dark = float3(186, 71, 18) / 255.0;
115      float3 light = float3(249, 233, 50) / 255.0;      float3 light = float3(249, 233, 50) / 255.0;
116    
117      float4 dtex = tex2D(t0, p.xy * float2(4, 1));      float4 dtex = tex2D(t0, p.xy * float2(4, 2));
118        float4 atex = tex2D(t1, p.xy * float2(2, 2));
119    
120      ocol.xyz = lerp(dark, light, dtex.x);      ocol.xyz = lerp(dark, light, dtex.x);
121      ocol.w = .1 + .8*smoothstep(.5, 1.3, p.w);      ocol.w = .1 + .5*smoothstep(.5, 1.3, p.w) +
122            (.5 * smoothstep(.5, .6, atex.x));
123    
124        // ocol.xyz = 0;
125    
126  }  }
127  """, "arbfp1")),  """, "arbfp1")),
128  ]  ]
# Line 141  class Scene: Line 166  class Scene:
166          TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR          TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
167          TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 20          TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 20
168    
169            ActiveTextureARB TEXTURE1
170    
171            BindTexture TEXTURE_2D %s
172            TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
173            TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
174            TexParameter TEXTURE_2D TEXTURE_MAX_ANISOTROPY_EXT 20
175    
176            ActiveTextureARB TEXTURE0
177    
178          """ % (          """ % (
179                  vp[0].getProgId(),                  vp[0].getProgId(),
180                  fp[0].getProgId(),                  fp[0].getProgId(),
181                  noise.getTexId(),                  turb.getTexId(),
182                    lnoise.getTexId(),
183                      )))                      )))
184    
185          vs.put(GLRen.createQuad(40,40,1),          vs.put(GLRen.createQuad(40,40,1),

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