2016-02-19 01:30:15 +01:00
|
|
|
#version 120
|
|
|
|
|
|
|
|
varying vec2 uv;
|
|
|
|
varying float depth;
|
|
|
|
|
|
|
|
#define PER_PIXEL_LIGHTING (@normalMap || @forcePPL)
|
|
|
|
|
|
|
|
#if !PER_PIXEL_LIGHTING
|
2018-04-12 00:39:11 +03:00
|
|
|
centroid varying vec4 lighting;
|
2018-05-11 19:15:04 +01:00
|
|
|
centroid varying vec3 shadowDiffuseLighting;
|
2016-02-19 01:30:15 +01:00
|
|
|
#else
|
2018-04-12 00:39:11 +03:00
|
|
|
centroid varying vec4 passColor;
|
2016-02-19 01:30:15 +01:00
|
|
|
#endif
|
2016-02-20 19:54:47 +01:00
|
|
|
varying vec3 passViewPos;
|
2016-03-22 21:00:31 +01:00
|
|
|
varying vec3 passNormal;
|
2016-02-19 01:30:15 +01:00
|
|
|
|
2018-06-24 23:40:52 +01:00
|
|
|
#include "shadows_vertex.glsl"
|
2017-09-21 00:25:48 +01:00
|
|
|
|
2016-02-19 01:30:15 +01:00
|
|
|
#include "lighting.glsl"
|
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
|
|
|
depth = gl_Position.z;
|
|
|
|
|
|
|
|
vec4 viewPos = (gl_ModelViewMatrix * gl_Vertex);
|
|
|
|
gl_ClipVertex = viewPos;
|
2019-01-30 22:28:00 +00:00
|
|
|
|
|
|
|
vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
|
2016-02-19 01:30:15 +01:00
|
|
|
|
|
|
|
#if !PER_PIXEL_LIGHTING
|
2017-09-21 01:59:02 +01:00
|
|
|
lighting = doLighting(viewPos.xyz, viewNormal, gl_Color, shadowDiffuseLighting);
|
2016-02-19 01:30:15 +01:00
|
|
|
#else
|
|
|
|
passColor = gl_Color;
|
|
|
|
#endif
|
2016-03-22 21:00:31 +01:00
|
|
|
passNormal = gl_Normal.xyz;
|
2016-02-20 19:54:47 +01:00
|
|
|
passViewPos = viewPos.xyz;
|
2016-02-19 01:30:15 +01:00
|
|
|
|
|
|
|
uv = gl_MultiTexCoord0.xy;
|
2017-09-21 00:25:48 +01:00
|
|
|
|
2019-01-30 22:28:00 +00:00
|
|
|
setupShadowCoords(viewPos, viewNormal);
|
2016-02-19 01:30:15 +01:00
|
|
|
}
|