Changeset 6963
- Timestamp:
- 06/13/07 20:22:19
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenSceneGraph-Data/trunk/shaders/overlay_perspective_main.frag
r6959 r6963 2 2 uniform sampler2D texture_1; 3 3 4 uniform float y0; 5 uniform float inverse_one_minus_y0; 4 uniform float exponent_scale; 5 uniform float exponent_offset; 6 7 #if 1 8 vec4 warp(in vec4 source) 9 { 10 float divisor = exp2(source.y); 11 return vec4(source.x/divisor, source.y, source.z, source.w); 12 } 13 #else 14 vec4 warp(in vec4 source) 15 { 16 return source; 17 } 18 #endif 6 19 7 20 void main() 8 21 { 22 vec4 coord = gl_TexCoord[1]; 23 coord.x = coord.x*2.0 - 1.0; 24 coord.y = coord.y*2.0 - 1.0; 25 26 vec4 warped = warp(coord); 27 warped.x = (warped.x + 1.0)*0.5; 28 warped.y = (warped.y + 1.0)*0.5; 29 9 30 vec4 base_color = texture2D(texture_0, gl_TexCoord[0].xy); 10 vec4 overlay_color = texture2D(texture_1, gl_TexCoord[1].xy);31 vec4 overlay_color = texture2D(texture_1, warped ); 11 32 vec3 mixed_color = mix(base_color.rgb, overlay_color.rgb, overlay_color.a); 12 33 gl_FragColor = vec4(mixed_color, base_color.a); OpenSceneGraph-Data/trunk/shaders/overlay_perspective_rtt.vert
r6959 r6963 1 uniform float y0;2 uniform float inverse_one_minus_y0;1 uniform float exponent_offset; 2 uniform float exponent_scale; 3 3 4 4 vec3 fnormal(void) … … 37 37 } 38 38 39 #if 1 40 vec4 warp(in vec4 source) 41 { 42 float divisor = exp2(source.y/source.w); 43 return vec4(source.x/divisor, source.y, source.z, source.w); 44 } 45 #else 46 vec4 warp(in vec4 source) 47 { 48 return source; 49 } 50 #endif 51 39 52 void main() 40 53 { 41 gl_Position = ftransform();54 gl_Position = warp(ftransform()); 42 55 43 56 vec4 ambient = vec4(0.0); … … 55 68 56 69 gl_FrontColor = color; 70 gl_FrontColor.x = 0.0; 57 71 }
