You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/files/shaders/objects_vertex.glsl

76 lines
1.5 KiB
Plaintext

#version 120
#if @diffuseMap
varying vec2 diffuseMapUV;
#endif
9 years ago
#if @darkMap
varying vec2 darkMapUV;
#endif
#if @detailMap
varying vec2 detailMapUV;
#endif
#if @emissiveMap
varying vec2 emissiveMapUV;
#endif
#if @normalMap
varying vec2 normalMapUV;
varying vec3 viewTangent;
#endif
9 years ago
varying float depth;
#define PER_PIXEL_LIGHTING @normalMap
#if !PER_PIXEL_LIGHTING
varying vec4 lighting;
#else
varying vec3 passViewPos;
varying vec3 passViewNormal;
varying vec4 passColour;
#endif
#include "lighting.glsl"
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
9 years ago
depth = gl_Position.z;
vec4 viewPos = (gl_ModelViewMatrix * gl_Vertex);
gl_ClipVertex = viewPos;
vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
#if @diffuseMap
diffuseMapUV = (gl_TextureMatrix[@diffuseMapUV] * gl_MultiTexCoord@diffuseMapUV).xy;
#endif
#if @darkMap
darkMapUV = (gl_TextureMatrix[@darkMapUV] * gl_MultiTexCoord@darkMapUV).xy;
#endif
#if @detailMap
detailMapUV = (gl_TextureMatrix[@detailMap] * gl_MultiTexCoord@detailMap).xy;
#endif
#if @emissiveMap
emissiveMapUV = (gl_TextureMatrix[@emissiveMapUV] * gl_MultiTexCoord@emissiveMapUV).xy;
#endif
#if @normalMap
normalMapUV = (gl_TextureMatrix[@normalMapUV] * gl_MultiTexCoord@normalMapUV).xy;
viewTangent = normalize(gl_NormalMatrix * gl_MultiTexCoord7.xyz);
#endif
#if !PER_PIXEL_LIGHTING
lighting = doLighting(viewPos.xyz, viewNormal, gl_Color);
#else
passViewPos = viewPos.xyz;
passViewNormal = viewNormal;
passColour = gl_Color;
#endif
}