irrlicht/media/cubeMapReflection.vert
cutealien 8310a3fbad Avoid warning and make local variable lower-case.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6000 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-12-12 16:32:41 +00:00

28 lines
837 B
GLSL

uniform int StyleUVW ; // 0 = specular reflection, 1 = diffuse reflection, 2 = use model vertex coordinates for uvw.
uniform vec3 CameraPos;
uniform mat4 World;
void main(void)
{
gl_Position = ftransform(); // same as gl_ModelViewProjectionMatrix * gl_Vertex;
// compute the reflection vector, and assign it to texcoord 0
if ( StyleUVW == 0 )
{
vec4 worldPos = World*gl_Vertex;
vec3 viewNormal = normalize(worldPos.xyz - CameraPos); // view vector
gl_TexCoord[0] = vec4( reflect( viewNormal, normalize(gl_Normal) ), 1.0 );
}
else if ( StyleUVW == 1 )
{
// just use the normal for the reflection vector
gl_TexCoord[0] = vec4(normalize(gl_Normal), 1.0);
}
else if ( StyleUVW == 2 )
{
// use vertex-coordinates for texture coordinates
gl_TexCoord[0] = normalize(gl_Vertex);
}
}