Code: Select all
uniform int objects = 0;
uniform vec2 positions[50];
uniform float radii[50];
varying vec2 texPos;
#ifdef VERTEX
vec4 position(mat4 transform_projection, vec4 vertex_position)
{
// The order of operations matters when doing matrix multiplication.
texPos = (TransformMatrix*VertexPosition).xy;
return transform_projection * vertex_position;
}
#endif
#ifdef PIXEL
vec4 effect( vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords ) {
for (int i = 0; i < objects; i++) {
// vec2 screen_point = (vec4(positions[i],0 ,0) * ProjectionMatrix).xy;
// if (distance(screen_point, screen_coords) < radii[i])
// return vec4(distance(vec2(0,0), texPos)<1,0,0,1);
}
return vec4(distance(vec2(0,0), texPos)<1,0,0,1);
}
#endif