1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 19:19:56 +00:00

Theoretically, at least, fix everything (except hte sky issue which is resolved in another branch)

This commit is contained in:
AnyOldName3 2017-11-05 14:37:36 +00:00
parent d0587a3ad5
commit 3f63ebce77
4 changed files with 7 additions and 4 deletions

View file

@ -210,7 +210,7 @@ namespace MWRender
settings->setReceivesShadowTraversalMask(~0u);
//settings->setShadowMapProjectionHint(osgShadow::ShadowSettings::PERSPECTIVE_SHADOW_MAP);
settings->setBaseShadowTextureUnit(1);
settings->setBaseShadowTextureUnit(7);
//settings->setMinimumShadowMapNearFarRatio(0);
//settings->setNumShadowMapsPerLight(1);
//settings->setShadowMapProjectionHint(osgShadow::ShadowSettings::ORTHOGRAPHIC_SHADOW_MAP);

View file

@ -46,6 +46,7 @@ varying vec4 passColor;
varying vec3 passViewPos;
varying vec3 passNormal;
uniform int shadowTextureUnit0;
varying vec4 shadowSpaceCoords;
#include "lighting.glsl"
@ -104,6 +105,6 @@ void main(void)
passNormal = gl_Normal.xyz;
// This matrix has the opposite handedness to the others used here, so multiplication must have the vector to the left. Alternatively it could be transposed after construction, but that's extra work for the GPU just to make the code look a tiny bit cleaner.
mat4 eyePlaneMat = mat4(gl_EyePlaneS[1], gl_EyePlaneT[1], gl_EyePlaneR[1], gl_EyePlaneQ[1]);
mat4 eyePlaneMat = mat4(gl_EyePlaneS[shadowTextureUnit0], gl_EyePlaneT[shadowTextureUnit0], gl_EyePlaneR[shadowTextureUnit0], gl_EyePlaneQ[shadowTextureUnit0]);
shadowSpaceCoords = viewPos * eyePlaneMat;
}

View file

@ -14,6 +14,7 @@ varying vec4 passColor;
varying vec3 passViewPos;
varying vec3 passNormal;
uniform int shadowTextureUnit0;
varying vec4 shadowSpaceCoords;
#include "lighting.glsl"
@ -38,6 +39,6 @@ void main(void)
uv = gl_MultiTexCoord0.xy;
// This matrix has the opposite handedness to the others used here, so multiplication must have the vector to the left. Alternatively it could be transposed after construction, but that's extra work for the GPU just to make the code look a tiny bit cleaner.
mat4 eyePlaneMat = mat4(gl_EyePlaneS[1], gl_EyePlaneT[1], gl_EyePlaneR[1], gl_EyePlaneQ[1]);
mat4 eyePlaneMat = mat4(gl_EyePlaneS[shadowTextureUnit0], gl_EyePlaneT[shadowTextureUnit0], gl_EyePlaneR[shadowTextureUnit0], gl_EyePlaneQ[shadowTextureUnit0]);
shadowSpaceCoords = viewPos * eyePlaneMat;
}

View file

@ -4,6 +4,7 @@ varying vec3 screenCoordsPassthrough;
varying vec4 position;
varying float depthPassthrough;
uniform int shadowTextureUnit0;
varying vec4 shadowSpaceCoords;
void main(void)
@ -23,6 +24,6 @@ void main(void)
depthPassthrough = gl_Position.z;
// This matrix has the opposite handedness to the others used here, so multiplication must have the vector to the left. Alternatively it could be transposed after construction, but that's extra work for the GPU just to make the code look a tiny bit cleaner.
mat4 eyePlaneMat = mat4(gl_EyePlaneS[1], gl_EyePlaneT[1], gl_EyePlaneR[1], gl_EyePlaneQ[1]);
mat4 eyePlaneMat = mat4(gl_EyePlaneS[shadowTextureUnit0], gl_EyePlaneT[shadowTextureUnit0], gl_EyePlaneR[shadowTextureUnit0], gl_EyePlaneQ[shadowTextureUnit0]);
shadowSpaceCoords = (gl_ModelViewMatrix * gl_Vertex) * eyePlaneMat;
}