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-0572b91ccdca
experimental
rem..om 12 years ago
parent 1a94e65176
commit 5bc840e57a
  1. 2
      engine/src/core-data/Common/MatDefs/Light/Lighting.j3md
  2. 2
      engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md
  3. 2
      engine/src/core-data/Common/MatDefs/Shadow/PostShadow.j3md
  4. 78
      engine/src/core-data/Common/MatDefs/Shadow/PostShadow15.vert
  5. 2
      engine/src/core-data/Common/MatDefs/Shadow/PostShadowFilter.j3md
  6. 5
      engine/src/core-data/Common/MatDefs/Shadow/PostShadowFilter.vert
  7. 4
      engine/src/core-data/Common/MatDefs/Shadow/PostShadowFilter15.vert

@ -207,7 +207,7 @@ MaterialDef Phong Lighting {
Technique PostShadow15{
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow15.vert
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow15.frag
WorldParameters {

@ -115,7 +115,7 @@ MaterialDef Unshaded {
Technique PostShadow15{
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow15.vert
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow15.frag
WorldParameters {

@ -31,7 +31,7 @@ MaterialDef Post Shadow {
}
Technique {
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow15.vert
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow15.frag
WorldParameters {

@ -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
}

@ -44,7 +44,6 @@ MaterialDef Post Shadow {
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadowFilter15.frag
WorldParameters {
WorldViewProjectionMatrix
}
Defines {
@ -66,7 +65,6 @@ MaterialDef Post Shadow {
FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadowFilter.frag
WorldParameters {
WorldViewProjectionMatrix
}
Defines {

@ -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;
vec2 pos = inPosition.xy * 2.0 - 1.0;
gl_Position = vec4(pos, 0.0, 1.0);
texCoord = inTexCoord;
}
Loading…
Cancel
Save