|
@@ -3,7 +3,6 @@ attribute vec3 position;
|
|
|
|
|
|
#ifdef NORMAL
|
|
#ifdef NORMAL
|
|
attribute vec3 normal;
|
|
attribute vec3 normal;
|
|
- uniform vec3 lightData;
|
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#include<bonesDeclaration>
|
|
#include<bonesDeclaration>
|
|
@@ -16,14 +15,6 @@ attribute vec3 position;
|
|
#include<helperFunctions>
|
|
#include<helperFunctions>
|
|
|
|
|
|
uniform mat4 viewProjection;
|
|
uniform mat4 viewProjection;
|
|
-uniform vec3 biasAndScale;
|
|
|
|
-uniform vec2 depthValues;
|
|
|
|
-
|
|
|
|
-varying float vDepthMetric;
|
|
|
|
-
|
|
|
|
-#ifdef USEDISTANCE
|
|
|
|
-varying vec3 vPositionW;
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
#ifdef ALPHATEST
|
|
#ifdef ALPHATEST
|
|
varying vec2 vUV;
|
|
varying vec2 vUV;
|
|
@@ -36,9 +27,7 @@ attribute vec2 uv2;
|
|
#endif
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#ifdef DEPTHCLAMP
|
|
|
|
-varying float z;
|
|
|
|
-#endif
|
|
|
|
|
|
+#include<shadowMapVertexDeclaration>
|
|
|
|
|
|
#include<clipPlaneVertexDeclaration>
|
|
#include<clipPlaneVertexDeclaration>
|
|
|
|
|
|
@@ -56,50 +45,12 @@ vec3 positionUpdated = position;
|
|
|
|
|
|
vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);
|
|
vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);
|
|
|
|
|
|
-// Normal inset Bias.
|
|
|
|
-#ifdef NORMAL
|
|
|
|
- mat3 normalWorld = mat3(finalWorld);
|
|
|
|
-
|
|
|
|
- #ifdef NONUNIFORMSCALING
|
|
|
|
- normalWorld = transposeMat3(inverseMat3(normalWorld));
|
|
|
|
- #endif
|
|
|
|
-
|
|
|
|
- vec3 worldNor = normalize(normalWorld * normal);
|
|
|
|
-
|
|
|
|
- #ifdef DIRECTIONINLIGHTDATA
|
|
|
|
- vec3 worldLightDir = normalize(-lightData.xyz);
|
|
|
|
- #else
|
|
|
|
- vec3 directionToLight = lightData.xyz - worldPos.xyz;
|
|
|
|
- vec3 worldLightDir = normalize(directionToLight);
|
|
|
|
- #endif
|
|
|
|
-
|
|
|
|
- float ndl = dot(worldNor, worldLightDir);
|
|
|
|
- float sinNL = sqrt(1.0 - ndl * ndl);
|
|
|
|
- float normalBias = biasAndScale.y * sinNL;
|
|
|
|
-
|
|
|
|
- worldPos.xyz -= worldNor * normalBias;
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-#ifdef USEDISTANCE
|
|
|
|
-vPositionW = worldPos.xyz;
|
|
|
|
-#endif
|
|
|
|
|
|
+#include<shadowMapVertexNormalBias>
|
|
|
|
|
|
// Projection.
|
|
// Projection.
|
|
gl_Position = viewProjection * worldPos;
|
|
gl_Position = viewProjection * worldPos;
|
|
|
|
|
|
-
|
|
|
|
-#ifdef DEPTHTEXTURE
|
|
|
|
- // Depth texture Linear bias.
|
|
|
|
- gl_Position.z += biasAndScale.x * gl_Position.w;
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-#ifdef DEPTHCLAMP
|
|
|
|
- z = gl_Position.z;
|
|
|
|
- gl_Position.z = 0.0;
|
|
|
|
-#elif !defined(USEDISTANCE)
|
|
|
|
- // Color Texture Linear bias.
|
|
|
|
- vDepthMetric = ((gl_Position.z + depthValues.x) / (depthValues.y)) + biasAndScale.x;
|
|
|
|
-#endif
|
|
|
|
|
|
+#include<shadowMapVertexMetric>
|
|
|
|
|
|
#ifdef ALPHATEST
|
|
#ifdef ALPHATEST
|
|
#ifdef UV1
|
|
#ifdef UV1
|