From 67fb8fc81241720b831094ac1533c3c2bd647d89 Mon Sep 17 00:00:00 2001 From: Nehon Date: Thu, 7 Jul 2016 19:53:59 +0200 Subject: [PATCH] Fixed an issue in SinglePAssAndLightBasedLogic where texture units were not properly assigned --- .../logic/SinglePassAndImageBasedLightingLogic.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/material/logic/SinglePassAndImageBasedLightingLogic.java b/jme3-core/src/main/java/com/jme3/material/logic/SinglePassAndImageBasedLightingLogic.java index d276e82a9..7edf2cba9 100644 --- a/jme3-core/src/main/java/com/jme3/material/logic/SinglePassAndImageBasedLightingLogic.java +++ b/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());