2014-12-18 16:09:29 +08:00
|
|
|
#ifdef GL_ES
|
2014-12-19 15:31:06 +08:00
|
|
|
varying mediump vec2 v_texture_coord;
|
2014-12-18 16:09:29 +08:00
|
|
|
varying mediump vec4 v_position;
|
|
|
|
#else
|
2014-12-19 15:31:06 +08:00
|
|
|
varying vec2 v_texture_coord;
|
2014-12-18 16:09:29 +08:00
|
|
|
varying vec4 v_position;
|
|
|
|
#endif
|
2015-09-02 16:30:24 +08:00
|
|
|
uniform sampler2D u_sampler0;
|
|
|
|
uniform sampler2D u_sampler1;
|
2014-12-18 16:09:29 +08:00
|
|
|
uniform vec3 u_target_pos;
|
|
|
|
uniform vec4 u_color;
|
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
|
2014-12-22 14:17:48 +08:00
|
|
|
float Radius = 4.0;//project range
|
|
|
|
vec3 UVector = vec3(1.0, 0.0, 0.0)/(2.0 * Radius);
|
|
|
|
vec3 VVector = vec3(0.0, 0.0, -1.0)/(-2.0 * Radius);
|
2014-12-18 16:09:29 +08:00
|
|
|
vec2 coord;
|
2014-12-22 14:17:48 +08:00
|
|
|
coord.x = dot(v_position.xyz - u_target_pos, UVector) + 0.5;
|
|
|
|
coord.y = dot(v_position.xyz - u_target_pos, VVector) + 0.5;
|
2014-12-18 16:09:29 +08:00
|
|
|
|
2015-09-02 16:30:24 +08:00
|
|
|
gl_FragColor = u_color*texture2D(u_sampler0,v_texture_coord)*texture2D(u_sampler1,coord);
|
2014-12-18 16:09:29 +08:00
|
|
|
}
|