Changes between Version 1 and Version 2 of Support/Tutorials/ShadersSampleGrayingOut
- Timestamp:
- 07/02/08 07:35:40 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Support/Tutorials/ShadersSampleGrayingOut
v1 v2 6 6 7 7 {{{ 8 uniform vec4 grayScaleWeights; 8 uniform sampler2D testTexture; 9 uniform vec4 grayScaleWeights; // [0.3, 0.59, 0.11, 1.0] 10 uniform vec4 screenCenterAndInOut; // [screenCenterX, screenCenterY, inRange, outRange] 9 11 10 12 void main( void ) 11 13 { 12 13 14 // Fetch the regular RGB texel color from the texture 14 15 vec4 texelColor = texture2D( testTexture, gl_TexCoord[0].xy ); … … 29 30 // 30 31 31 // grayScaleWeights = vec4(1,1,1,1);32 33 32 vec4 scaledColor = texelColor * grayScaleWeights; 34 33 float luminance = scaledColor.r + scaledColor.g + scaledColor.b; 35 34 36 // 37 float screenCenterX = 640; 38 float screenCenterY = 512; 39 40 float deltaX = screenCenterX - gl_FragCoord.x; 41 float deltaY = screenCenterY - gl_FragCoord.y; 35 float deltaX = screenCenterAndInOut.x - gl_FragCoord.x; 36 float deltaY = screenCenterAndInOut.y - gl_FragCoord.y; 42 37 43 38 float dist = sqrt(deltaX * deltaX + deltaY * deltaY); 44 float inRange = 50.;45 float outRange = 600.;39 float inRange = screenCenterAndInOut.z; 40 float outRange = screenCenterAndInOut.w; 46 41 47 42 if (dist < inRange) 48 43 { 49 50 44 gl_FragColor = texelColor; 51 45 } … … 70 64 } 71 65 }}} 72 73 Todo:74 * Need to pass uniforms to vary the cone of visibility.75 * Need to pass parameters in for center of screen.
