mirror of https://github.com/axmolengine/axmol.git
27 lines
765 B
GLSL
27 lines
765 B
GLSL
#version 310 es
|
|
precision highp float;
|
|
precision highp int;
|
|
layout(location = 0) in vec2 v_texture_coord;
|
|
layout(location = 1) in vec4 v_position;
|
|
layout(binding = 0) uniform sampler2D u_sampler0;
|
|
layout(binding = 1) uniform sampler2D u_sampler1;
|
|
layout(std140, binding = 0) uniform fs_ub {
|
|
vec3 u_target_pos;
|
|
vec4 u_color;
|
|
};
|
|
|
|
layout(location = 0) out vec4 FragColor;
|
|
|
|
void main(void)
|
|
{
|
|
|
|
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);
|
|
vec2 coord;
|
|
coord.x = dot(v_position.xyz - u_target_pos, UVector) + 0.5;
|
|
coord.y = dot(v_position.xyz - u_target_pos, VVector) + 0.5;
|
|
|
|
FragColor = u_color*texture(u_sampler0,v_texture_coord)*texture(u_sampler1,coord);
|
|
}
|