1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-25 15:09:41 +00:00
openmw-tes3mp/files/shaders/terrain_vertex.glsl

50 lines
1.2 KiB
Text
Raw Normal View History

#version 120
2020-08-05 22:54:45 +00:00
#include "interface_util.glsl"
varying vec2 VS_NAME(uv);
varying float VS_NAME(euclideanDepth);
varying float VS_NAME(linearDepth);
#define PER_PIXEL_LIGHTING (@normalMap || @forcePPL)
#if !PER_PIXEL_LIGHTING
2020-08-05 22:54:45 +00:00
centroid varying vec4 VS_NAME(lighting);
centroid varying vec3 VS_NAME(shadowDiffuseLighting);
#endif
2020-08-05 22:54:45 +00:00
centroid varying vec4 VS_NAME(passColor);
varying vec3 VS_NAME(passViewPos);
varying vec3 VS_NAME(passNormal);
#include "shadows_vertex.glsl"
2017-09-20 23:25:48 +00:00
#include "lighting.glsl"
2020-08-05 22:54:45 +00:00
void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
vec4 viewPos = (gl_ModelViewMatrix * gl_Vertex);
gl_ClipVertex = viewPos;
2020-08-05 22:54:45 +00:00
VS_NAME(euclideanDepth) = length(viewPos.xyz);
VS_NAME(linearDepth) = gl_Position.z;
2020-06-15 08:43:51 +00:00
#if (!PER_PIXEL_LIGHTING || @shadows_enabled)
vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
2020-06-15 08:43:51 +00:00
#endif
#if !PER_PIXEL_LIGHTING
2020-08-05 22:54:45 +00:00
VS_NAME(lighting) = doLighting(viewPos.xyz, viewNormal, gl_Color, VS_NAME(shadowDiffuseLighting));
#endif
2020-08-05 22:54:45 +00:00
VS_NAME(passColor) = gl_Color;
VS_NAME(passNormal) = gl_Normal.xyz;
VS_NAME(passViewPos) = viewPos.xyz;
2020-08-05 22:54:45 +00:00
VS_NAME(uv) = gl_MultiTexCoord0.xy;
2017-09-20 23:25:48 +00:00
2020-06-15 08:43:51 +00:00
#if (@shadows_enabled)
setupShadowCoords(viewPos, viewNormal);
2020-06-15 08:43:51 +00:00
#endif
}