浏览代码

Fixes an issue where light probes were used in phong lighting

Nehon 7 年之前
父节点
当前提交
db48b98a2e

+ 1 - 3
jme3-core/src/main/java/com/jme3/material/logic/MultiPassLightingLogic.java

@@ -86,7 +86,7 @@ public final class MultiPassLightingLogic extends DefaultTechniqueDefLogic {
 
 
         for (int i = 0; i < lights.size(); i++) {
         for (int i = 0; i < lights.size(); i++) {
             Light l = lights.get(i);
             Light l = lights.get(i);
-            if (l instanceof AmbientLight) {
+            if (l.getType() == Light.Type.Ambient  || l.getType() == Light.Type.Probe) {
                 continue;
                 continue;
             }
             }
 
 
@@ -156,8 +156,6 @@ public final class MultiPassLightingLogic extends DefaultTechniqueDefLogic {
 
 
                     lightDir.setValue(VarType.Vector4, tmpLightDirection);
                     lightDir.setValue(VarType.Vector4, tmpLightDirection);
 
 
-                    break;
-                case Probe:
                     break;
                     break;
                 default:
                 default:
                     throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
                     throw new UnsupportedOperationException("Unknown type of light: " + l.getType());

+ 1 - 4
jme3-core/src/main/java/com/jme3/material/logic/SinglePassLightingLogic.java

@@ -106,7 +106,6 @@ public final class SinglePassLightingLogic extends DefaultTechniqueDefLogic {
         lightData.setVector4Length(numLights * 3);//8 lights * max 3
         lightData.setVector4Length(numLights * 3);//8 lights * max 3
         Uniform ambientColor = shader.getUniform("g_AmbientLightColor");
         Uniform ambientColor = shader.getUniform("g_AmbientLightColor");
 
 
-
         if (startIndex != 0) {
         if (startIndex != 0) {
             // apply additive blending for 2nd and future passes
             // apply additive blending for 2nd and future passes
             rm.getRenderer().applyRenderState(ADDITIVE_LIGHT);
             rm.getRenderer().applyRenderState(ADDITIVE_LIGHT);
@@ -123,7 +122,7 @@ public final class SinglePassLightingLogic extends DefaultTechniqueDefLogic {
         for (curIndex = startIndex; curIndex < endIndex && curIndex < lightList.size(); curIndex++) {
         for (curIndex = startIndex; curIndex < endIndex && curIndex < lightList.size(); curIndex++) {
 
 
             Light l = lightList.get(curIndex);
             Light l = lightList.get(curIndex);
-            if (l.getType() == Light.Type.Ambient) {
+            if (l.getType() == Light.Type.Ambient || l.getType() == Light.Type.Probe) {
                 endIndex++;
                 endIndex++;
                 continue;
                 continue;
             }
             }
@@ -185,8 +184,6 @@ public final class SinglePassLightingLogic extends DefaultTechniqueDefLogic {
                     lightData.setVector4InArray(tmpVec.getX(), tmpVec.getY(), tmpVec.getZ(), spotAngleCos, lightDataIndex);
                     lightData.setVector4InArray(tmpVec.getX(), tmpVec.getY(), tmpVec.getZ(), spotAngleCos, lightDataIndex);
                     lightDataIndex++;
                     lightDataIndex++;
                     break;
                     break;
-                case Probe:
-                    break;
                 default:
                 default:
                     throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
                     throw new UnsupportedOperationException("Unknown type of light: " + l.getType());
             }
             }