Combine forced render state with the one in the technique

in-pass-shadows
Kirill Vainer 7 years ago
parent 8a747276d7
commit d159e1746c
  1. 9
      jme3-core/src/main/java/com/jme3/material/Material.java
  2. 10
      jme3-core/src/main/java/com/jme3/renderer/RenderManager.java

@ -819,7 +819,14 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
private void updateRenderState(RenderManager renderManager, Renderer renderer, TechniqueDef techniqueDef) {
if (renderManager.getForcedRenderState() != null) {
renderer.applyRenderState(renderManager.getForcedRenderState());
if (techniqueDef.getForcedRenderState() != null) {
renderer.applyRenderState(
techniqueDef.getForcedRenderState().copyMergedTo(
renderManager.getForcedRenderState(),
mergedRenderState));
} else {
renderer.applyRenderState(renderManager.getForcedRenderState());
}
} else {
if (techniqueDef.getRenderState() != null) {
renderer.applyRenderState(techniqueDef.getRenderState().copyMergedTo(additionalState, mergedRenderState));

@ -578,19 +578,11 @@ public class RenderManager {
: TechniqueDef.DEFAULT_TECHNIQUE_NAME;
geom.getMaterial().selectTechnique(forcedTechnique, this);
//saving forcedRenderState for future calls
RenderState tmpRs = forcedRenderState;
if (geom.getMaterial().getActiveTechnique().getDef().getForcedRenderState() != null) {
//forcing forced technique renderState
forcedRenderState = geom.getMaterial().getActiveTechnique().getDef().getForcedRenderState();
}
// use geometry's material
material.render(geom, this);
material.selectTechnique(previousTechniqueName, this);
//restoring forcedRenderState
forcedRenderState = tmpRs;
//Reverted this part from revision 6197
//If forcedTechnique does not exists, and forcedMaterial is not set, the geom MUST NOT be rendered
} else if (forcedMaterial != null) {

Loading…
Cancel
Save