axmol/tests/cpp-tests/Content/MeshRendererTest/cube_map.vert

21 lines
518 B
GLSL
Raw Normal View History

2015-01-29 09:28:14 +08:00
attribute vec4 a_position;
attribute vec3 a_normal;
varying vec3 v_reflect;
//uniforms
uniform mat4 u_MVPMatrix;
uniform mat4 u_MVMatrix;
uniform mat3 u_NormalMatrix;
2015-01-29 09:28:14 +08:00
void main(void)
{
gl_Position = u_MVPMatrix * a_position;
2015-01-29 09:28:14 +08:00
// compute reflect
vec4 positionWorldViewSpace = u_MVMatrix * a_position;
2015-04-14 14:20:31 +08:00
vec3 vEyeVertex = normalize(positionWorldViewSpace.xyz);
2015-01-29 09:28:14 +08:00
vec3 v_normalVector = u_NormalMatrix * a_normal;
2015-04-14 14:20:31 +08:00
v_reflect = normalize(reflect(-vEyeVertex, v_normalVector));
2015-01-29 09:28:14 +08:00
}