浏览代码

J3M: allow static pass lighting to be selected

Kirill Vainer 9 年之前
父节点
当前提交
e71cf81b96

+ 11 - 0
jme3-core/src/main/java/com/jme3/material/TechniqueDef.java

@@ -94,6 +94,17 @@ public class TechniqueDef implements Savable {
          */
         @Deprecated
         FixedPipeline,
+        /**
+         * Similar to {@link #SinglePass} except the type of each light is known
+         * at shader compile time.
+         * <p>
+         * The advantage is that the shader can be much more efficient, i.e. not
+         * do operations required for spot and point lights if it knows the
+         * light is a directional light. The disadvantage is that the number of
+         * shaders used balloons because of the variations in the number of
+         * lights used by objects.
+         */
+        StaticPass
     }
 
     public enum ShadowMode {

+ 4 - 0
jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java

@@ -41,6 +41,7 @@ import com.jme3.material.RenderState.BlendMode;
 import com.jme3.material.RenderState.FaceCullMode;
 import com.jme3.material.TechniqueDef.LightMode;
 import com.jme3.material.TechniqueDef.ShadowMode;
+import com.jme3.material.logic.StaticPassLightingLogic;
 import com.jme3.math.ColorRGBA;
 import com.jme3.math.Vector2f;
 import com.jme3.math.Vector3f;
@@ -646,6 +647,9 @@ public class J3MLoader implements AssetLoader {
             case SinglePass:
                 technique.setLogic(new SinglePassLightingLogic(technique));
                 break;
+            case StaticPass:
+                technique.setLogic(new StaticPassLightingLogic(technique));
+                break;
             default:
                 throw new UnsupportedOperationException();
         }