Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef GL_ES
- precision mediump float;
- #endif
- varying vec2 v_texCoord;
- varying vec4 v_v2Position;
- uniform sampler2D u_texture;
- uniform vec2 u_v2LightPositions[8];
- uniform int u_iLightStatus[8];
- uniform float u_fRadiusSquared[8];
- void main()
- {
- vec4 currentTexelColor = texture2D(u_texture, v_texCoord);
- float gray = dot(currentTexelColor.rgb, vec3( 0.299, 0.587, 0.114 ) );
- for(int i = 0; i < 8; i++)
- {
- float fDistance_x = v_v2Position.x - u_v2LightPositions[i].x;
- float fDistance_y = v_v2Position.y - u_v2LightPositions[i].y;
- if( ( u_iLightStatus[i] == 1 ) && (fDistance_x * fDistance_x ) + (fDistance_y * fDistance_y ) < u_fRadiusSquared[i] )
- {
- gl_FragColor = currentTexelColor;
- return;
- }
- }
- gl_FragColor = vec4( gray, gray, gray, currentTexelColor.a );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement