Fixed an isse where shader compilation would fail for shadows because of deprecated usage of varying in glsl1.5 shaders.
Alsofixed an issue with the filter version of the shadow processor git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10788 75d07b2b-3a1a-0410-a2c5-0572b91ccdcaexperimental
parent
1a94e65176
commit
5bc840e57a
@ -0,0 +1,78 @@ |
||||
#import "Common/ShaderLib/Skinning.glsllib" |
||||
uniform mat4 m_LightViewProjectionMatrix0; |
||||
uniform mat4 m_LightViewProjectionMatrix1; |
||||
uniform mat4 m_LightViewProjectionMatrix2; |
||||
uniform mat4 m_LightViewProjectionMatrix3; |
||||
|
||||
uniform mat4 g_WorldViewProjectionMatrix; |
||||
uniform mat4 g_WorldMatrix; |
||||
uniform mat4 g_ViewMatrix; |
||||
uniform vec3 m_LightPos; |
||||
|
||||
out vec4 projCoord0; |
||||
out vec4 projCoord1; |
||||
out vec4 projCoord2; |
||||
out vec4 projCoord3; |
||||
|
||||
#ifdef POINTLIGHT |
||||
uniform mat4 m_LightViewProjectionMatrix4; |
||||
uniform mat4 m_LightViewProjectionMatrix5; |
||||
out vec4 projCoord4; |
||||
out vec4 projCoord5; |
||||
out vec4 worldPos; |
||||
#endif |
||||
|
||||
#ifdef PSSM |
||||
out float shadowPosition; |
||||
#endif |
||||
out vec3 lightVec; |
||||
|
||||
out vec2 texCoord; |
||||
|
||||
in vec3 inPosition; |
||||
|
||||
#ifdef DISCARD_ALPHA |
||||
in vec2 inTexCoord; |
||||
#endif |
||||
|
||||
const mat4 biasMat = mat4(0.5, 0.0, 0.0, 0.0, |
||||
0.0, 0.5, 0.0, 0.0, |
||||
0.0, 0.0, 0.5, 0.0, |
||||
0.5, 0.5, 0.5, 1.0); |
||||
|
||||
|
||||
void main(){ |
||||
vec4 modelSpacePos = vec4(inPosition, 1.0); |
||||
|
||||
#ifdef NUM_BONES |
||||
Skinning_Compute(modelSpacePos); |
||||
#endif |
||||
gl_Position = g_WorldViewProjectionMatrix * modelSpacePos; |
||||
|
||||
#ifndef POINTLIGHT |
||||
#ifdef PSSM |
||||
shadowPosition = gl_Position.z; |
||||
#endif |
||||
vec4 worldPos=vec4(0.0); |
||||
#endif |
||||
// get the vertex in world space |
||||
worldPos = g_WorldMatrix * modelSpacePos; |
||||
|
||||
#ifdef DISCARD_ALPHA |
||||
texCoord = inTexCoord; |
||||
#endif |
||||
// populate the light view matrices array and convert vertex to light viewProj space |
||||
projCoord0 = biasMat * m_LightViewProjectionMatrix0 * worldPos; |
||||
projCoord1 = biasMat * m_LightViewProjectionMatrix1 * worldPos; |
||||
projCoord2 = biasMat * m_LightViewProjectionMatrix2 * worldPos; |
||||
projCoord3 = biasMat * m_LightViewProjectionMatrix3 * worldPos; |
||||
#ifdef POINTLIGHT |
||||
projCoord4 = biasMat * m_LightViewProjectionMatrix4 * worldPos; |
||||
projCoord5 = biasMat * m_LightViewProjectionMatrix5 * worldPos; |
||||
#else |
||||
|
||||
vec4 vLightPos = g_ViewMatrix * vec4(m_LightPos,1.0); |
||||
vec4 vPos = g_ViewMatrix * worldPos; |
||||
lightVec = vLightPos.xyz - vPos.xyz; |
||||
#endif |
||||
} |
@ -1,10 +1,9 @@ |
||||
uniform mat4 g_WorldViewProjectionMatrix; |
||||
|
||||
attribute vec4 inPosition; |
||||
attribute vec2 inTexCoord; |
||||
varying vec2 texCoord; |
||||
|
||||
void main() { |
||||
gl_Position = inPosition * 2.0 - 1.0; //vec4(pos, 0.0, 1.0); |
||||
vec2 pos = inPosition.xy * 2.0 - 1.0; |
||||
gl_Position = vec4(pos, 0.0, 1.0); |
||||
texCoord = inTexCoord; |
||||
} |
@ -1,12 +1,10 @@ |
||||
uniform mat4 g_WorldViewProjectionMatrix; |
||||
|
||||
in vec4 inPosition; |
||||
in vec2 inTexCoord; |
||||
|
||||
out vec2 texCoord; |
||||
|
||||
void main() { |
||||
vec2 pos = (g_WorldViewProjectionMatrix * inPosition).xy; |
||||
gl_Position = vec4(pos, 0.0, 1.0); |
||||
vec2 pos = inPosition.xy * 2.0 - 1.0; |
||||
gl_Position = vec4(pos, 0.0, 1.0); |
||||
texCoord = inTexCoord; |
||||
} |
Loading…
Reference in new issue