Changeset 6976
- Timestamp:
- 06/14/07 19:07:23
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenSceneGraph-Data/trunk/shaders/overlay_perspective_main.frag
r6963 r6976 2 2 uniform sampler2D texture_1; 3 3 4 uniform float exponent_scale; 5 uniform float exponent_offset; 4 uniform float y0; 6 5 7 6 #if 1 8 7 vec4 warp(in vec4 source) 9 8 { 10 float divisor = exp2(source.y);11 return vec4(source.x /divisor, source.y, source.z, source.w);9 float inv_divisor = 1.0 / (source.y + y0); 10 return vec4(source.x * (1.0 + y0 ) * inv_divisor , (source.y * y0 + 1.0 ) * inv_divisor, source.z, source.w); 12 11 } 13 12 #else … … 29 28 30 29 vec4 base_color = texture2D(texture_0, gl_TexCoord[0].xy); 31 vec4 overlay_color = texture2D(texture_1, warped );30 vec4 overlay_color = texture2D(texture_1, warped.xy ); 32 31 vec3 mixed_color = mix(base_color.rgb, overlay_color.rgb, overlay_color.a); 33 32 gl_FragColor = vec4(mixed_color, base_color.a); OpenSceneGraph-Data/trunk/shaders/overlay_perspective_rtt.vert
r6963 r6976 1 uniform float exponent_offset; 2 uniform float exponent_scale; 1 uniform float y0; 2 3 4 #if 1 5 vec4 warp(in vec4 source) 6 { 7 float divisor = source.y + y0; 8 return vec4(source.x * (1.0 + y0 ), source.y * y0 + 1.0, (source.z * y0 + 1.0)*0.05, source.w * divisor); 9 } 10 #else 11 vec4 warp(in vec4 source) 12 { 13 return source; 14 } 15 #endif 16 3 17 4 18 vec3 fnormal(void) … … 36 50 specular += gl_LightSource[i].specular * pf; 37 51 } 38 39 #if 140 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 #else46 vec4 warp(in vec4 source)47 {48 return source;49 }50 #endif51 52 52 void main() 53 53 { … … 66 66 diffuse * gl_FrontMaterial.diffuse + 67 67 specular * gl_FrontMaterial.specular; 68 68 69 #if 0 70 if (gl_Position.y < 0.0) color.r = 0.0; 71 if (gl_Position.x < 0.0) color.g = 0.0; 72 #endif 69 73 gl_FrontColor = color; 70 gl_FrontColor.x = 0.0; 74 75 71 76 }
