2 * \file cube_map_gouraud_vert.glsl
3 * \brief Cube map vertex shader with Gouraud shading,
4 * uses external function applyLighting().
12 uniform mat4 modelViewMatrix;
13 uniform mat4 mvpMatrix;
14 uniform mat3 normalMatrix;
15 uniform mat4 invViewMatrix;
17 smooth out vec4 emissionAmbientDiffuse;
18 smooth out vec4 specular;
19 smooth out vec3 texCoord0;
22 // --- declarations ---
25 void applyLighting(const in vec3 ecVertex, const in vec3 ecNormal,
26 out vec4 emissionAmbientDiffuse, out vec4 specular);
29 // --- implementations ---
34 // transform vertex position and normal into eye coordinates
35 vec3 ecVertex = (modelViewMatrix * vVertex).xyz;
36 vec3 ecNormal = normalMatrix * vNormal;
38 // apply lighting model (to be defined in separate shader)
39 applyLighting(ecVertex, ecNormal, emissionAmbientDiffuse, specular);
41 // compute reflection for cube mapping
42 vec4 ecReflection = vec4(reflect(normalize(ecVertex), normalize(ecNormal)), 0.);
45 gl_Position = mvpMatrix * vVertex;
46 texCoord0 = (invViewMatrix * ecReflection).stp;