fix wrong counts

in-pass-shadows
Kirill Vainer 7 years ago
parent 3889cb47b7
commit b52d0e3743
  1. 11
      jme3-core/src/main/java/com/jme3/material/logic/ShadowStaticPassLightingLogic.java
  2. 2
      jme3-core/src/main/java/com/jme3/material/logic/StaticPassLightingLogic.java
  3. 9
      jme3-core/src/main/resources/Common/MatDefs/Light/StaticLighting.frag

@ -126,9 +126,9 @@ public class ShadowStaticPassLightingLogic extends StaticPassLightingLogic {
}
ambientLightColor.a = 1.0f;
defines.set(numDirLightsDefineId, tempDirLights.size());
defines.set(numPointLightsDefineId, tempPointLights.size());
defines.set(numSpotLightsDefineId, tempSpotLights.size());
defines.set(numDirLightsDefineId, tempDirLights.size() - numShadowDirLights);
defines.set(numPointLightsDefineId, tempPointLights.size() - numShadowPointLights);
defines.set(numSpotLightsDefineId, tempSpotLights.size() - numShadowSpotLights);
defines.set(numShadowDirLightsDefineId, numShadowDirLights);
defines.set(numShadowPointLightsDefineId, numShadowPointLights);
@ -153,7 +153,10 @@ public class ShadowStaticPassLightingLogic extends StaticPassLightingLogic {
Uniform shadowMatricesUniform = shader.getUniform("g_ShadowMatrices");
shadowMatricesUniform.setMatrix4Length(numShadowDirLights * 4 + numShadowSpotLights);
shadowMatricesUniform.setMatrix4Length(
numShadowDirLights * 4 +
numShadowPointLights * 6 +
numShadowSpotLights);
int shadowMatrixIndex = 0;
for (int i = 0; i < numShadowDirLights; i++) {

@ -127,7 +127,7 @@ public class StaticPassLightingLogic extends DefaultTechniqueDefLogic {
}
protected float getShadowMapIndex(Light light) {
return 1.0f;
return -1.0f;
}
protected void updateLightListUniforms(Matrix4f viewMatrix, Shader shader) {

@ -19,9 +19,12 @@
#define DIR_SHADOW_LIGHT_END (NUM_SHADOW_DIR_LIGHTS * 2)
#define DIR_LIGHT_START (DIR_SHADOW_LIGHT_END)
#define DIR_LIGHT_END (NUM_DIR_LIGHTS * 2)
#define DIR_LIGHT_END (DIR_LIGHT_START + NUM_DIR_LIGHTS * 2)
#define POINT_LIGHT_START (DIR_LIGHT_END)
#define POINT_SHADOW_LIGHT_START (DIR_LIGHT_END)
#define POINT_SHADOW_LIGHT_END (POINT_SHADOW_LIGHT_START + NUM_SHADOW_POINT_LIGHTS * 2)
#define POINT_LIGHT_START (POINT_SHADOW_LIGHT_END)
#define POINT_LIGHT_END (POINT_LIGHT_START + NUM_POINT_LIGHTS * 2)
#define SPOT_SHADOW_LIGHT_START (POINT_LIGHT_END)
@ -32,6 +35,8 @@
#define LIGHT_DATA_SIZE (SPOT_LIGHT_END)
uniform vec3 g_CameraPosition;
uniform sampler2D m_AmbientMap;
uniform float m_AlphaDiscardThreshold;
uniform float m_Shininess;

Loading…
Cancel
Save