فهرست منبع

MaterialDebugAppState now properly applies renderStates
Added a set method in RenderState

Nehon 11 سال پیش
والد
کامیت
d33853d393

+ 38 - 0
jme3-core/src/main/java/com/jme3/material/RenderState.java

@@ -1312,6 +1312,44 @@ public class RenderState implements Cloneable, Savable {
         state.cachedHashCode = -1;
         return state;
     }
+     public void set(RenderState state) {
+        pointSprite = state.pointSprite;
+        wireframe = state.wireframe;
+        cullMode = state.cullMode;
+        depthWrite = state.depthWrite;
+        depthTest = state.depthTest;
+        colorWrite = state.colorWrite;
+        blendMode = state.blendMode;
+        alphaTest = state.alphaTest;
+        alphaFallOff = state.alphaFallOff;
+        offsetEnabled = state.offsetEnabled;
+        offsetFactor = state.offsetFactor;
+        offsetUnits = state.offsetUnits;
+        stencilTest = state.stencilTest;
+        frontStencilStencilFailOperation = state.frontStencilStencilFailOperation;
+        frontStencilDepthFailOperation = state.frontStencilDepthFailOperation;
+        frontStencilDepthPassOperation = state.frontStencilDepthPassOperation;
+        backStencilStencilFailOperation = state.backStencilStencilFailOperation;
+        backStencilDepthFailOperation = state.backStencilDepthFailOperation;
+        backStencilDepthPassOperation = state.backStencilDepthPassOperation;
+        frontStencilFunction = state.frontStencilFunction;
+        backStencilFunction = state.backStencilFunction;
+        depthFunc = state.depthFunc;
+        alphaFunc = state.alphaFunc;
+
+        applyPointSprite = true;
+        applyWireFrame =  true;
+        applyCullMode =  true;
+        applyDepthWrite =  true;
+        applyDepthTest =  true;
+        applyColorWrite = true;
+        applyBlendMode =  true;
+        applyAlphaTest =  true;
+        applyAlphaFallOff =  true;
+        applyPolyOffset =  true;
+        applyDepthFunc =  true;
+        applyAlphaFunc =  false;
+    }
 
     @Override
     public String toString() {

+ 4 - 1
jme3-core/src/main/java/com/jme3/util/MaterialDebugAppState.java

@@ -43,6 +43,7 @@ import com.jme3.input.controls.ActionListener;
 import com.jme3.input.controls.Trigger;
 import com.jme3.material.MatParam;
 import com.jme3.material.Material;
+import com.jme3.material.RenderState;
 import com.jme3.post.Filter;
 import com.jme3.post.Filter.Pass;
 import com.jme3.renderer.RenderManager;
@@ -205,6 +206,8 @@ public class MaterialDebugAppState extends AbstractAppState {
         for (MatParam matParam : mat.getParams()) {
             dummy.setParam(matParam.getName(), matParam.getVarType(), matParam.getValue());
         }
+        
+        dummy.getAdditionalRenderState().set(mat.getAdditionalRenderState());        
 
         //creating a dummy geom and assigning the dummy material to it
         Geometry dummyGeom = new Geometry("dummyGeom", new Box(1f, 1f, 1f));
@@ -225,7 +228,7 @@ public class MaterialDebugAppState extends AbstractAppState {
         //System.out.println("Material succesfully reloaded");
         return dummy;
     }
-
+   
     @Override
     public void update(float tpf) {
         super.update(tpf); //To change body of generated methods, choose Tools | Templates.