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 final ColorRGBA ambientLightColor = new ColorRGBA(0, 0, 0, 1);
//Env textures units
int irrUnit = -1;
int pemUnit = -1;
static {
ADDITIVE_LIGHT.setBlendMode(BlendMode.AlphaAdditive);
@ -117,11 +114,10 @@ public final class SinglePassAndImageBasedLightingLogic extends DefaultTechnique
if(lightProbe != null){
BoundingSphere s = (BoundingSphere)lightProbe.getBounds();
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.
if( irrUnit == -1 ){
irrUnit = lastTexUnit++;
pemUnit = lastTexUnit++;
}
//assigning new texture indexes
int irrUnit = lastTexUnit++;
int pemUnit = lastTexUnit++;
rm.getRenderer().setTexture(irrUnit, lightProbe.getIrradianceMap());
lightProbeIrrMap.setValue(VarType.Int, irrUnit);
rm.getRenderer().setTexture(pemUnit, lightProbe.getPrefilteredEnvMap());

Loading…
Cancel
Save