mirror of https://github.com/axmolengine/axmol.git
25 lines
615 B
GLSL
25 lines
615 B
GLSL
#version 310 es
|
|
layout(location = 0) in vec4 a_position;
|
|
layout(location = 1) in vec3 a_normal;
|
|
|
|
layout(location = 0) out vec3 v_reflect;
|
|
//uniforms
|
|
|
|
layout(std140, binding = 0) uniform vs_ub {
|
|
mat4 u_MVPMatrix;
|
|
mat4 u_MVMatrix;
|
|
mat3 u_NormalMatrix;
|
|
};
|
|
|
|
void main(void)
|
|
{
|
|
gl_Position = u_MVPMatrix * a_position;
|
|
|
|
// compute reflect
|
|
vec4 positionWorldViewSpace = u_MVMatrix * a_position;
|
|
vec3 vEyeVertex = normalize(positionWorldViewSpace.xyz);
|
|
|
|
vec3 v_normalVector = u_NormalMatrix * a_normal;
|
|
v_reflect = normalize(reflect(-vEyeVertex, v_normalVector));
|
|
}
|