Fixed an issue in SinglePAssAndLightBasedLogic where texture units were not properly assigned

define_list_fix
Nehon 9 years ago
parent 664ea53cc6
commit 67fb8fc812
  1. 12
      jme3-core/src/main/java/com/jme3/material/logic/SinglePassAndImageBasedLightingLogic.java

@ -51,9 +51,6 @@ public final class SinglePassAndImageBasedLightingLogic extends DefaultTechnique
private static final RenderState ADDITIVE_LIGHT = new RenderState(); private static final RenderState ADDITIVE_LIGHT = new RenderState();
private final ColorRGBA ambientLightColor = new ColorRGBA(0, 0, 0, 1); private final ColorRGBA ambientLightColor = new ColorRGBA(0, 0, 0, 1);
//Env textures units
int irrUnit = -1;
int pemUnit = -1;
static { static {
ADDITIVE_LIGHT.setBlendMode(BlendMode.AlphaAdditive); ADDITIVE_LIGHT.setBlendMode(BlendMode.AlphaAdditive);
@ -117,11 +114,10 @@ public final class SinglePassAndImageBasedLightingLogic extends DefaultTechnique
if(lightProbe != null){ if(lightProbe != null){
BoundingSphere s = (BoundingSphere)lightProbe.getBounds(); BoundingSphere s = (BoundingSphere)lightProbe.getBounds();
lightProbeData.setVector4InArray(lightProbe.getPosition().x, lightProbe.getPosition().y, lightProbe.getPosition().z, 1f/s.getRadius(), 0); lightProbeData.setVector4InArray(lightProbe.getPosition().x, lightProbe.getPosition().y, lightProbe.getPosition().z, 1f/s.getRadius(), 0);
//assigning new texture indexes if they have never been assigned. //assigning new texture indexes
if( irrUnit == -1 ){ int irrUnit = lastTexUnit++;
irrUnit = lastTexUnit++; int pemUnit = lastTexUnit++;
pemUnit = lastTexUnit++;
}
rm.getRenderer().setTexture(irrUnit, lightProbe.getIrradianceMap()); rm.getRenderer().setTexture(irrUnit, lightProbe.getIrradianceMap());
lightProbeIrrMap.setValue(VarType.Int, irrUnit); lightProbeIrrMap.setValue(VarType.Int, irrUnit);
rm.getRenderer().setTexture(pemUnit, lightProbe.getPrefilteredEnvMap()); rm.getRenderer().setTexture(pemUnit, lightProbe.getPrefilteredEnvMap());

Loading…
Cancel
Save