diff --git a/jme3-core/src/main/java/com/jme3/renderer/RenderManager.java b/jme3-core/src/main/java/com/jme3/renderer/RenderManager.java index 54e661e66..9d8782fcf 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/RenderManager.java +++ b/jme3-core/src/main/java/com/jme3/renderer/RenderManager.java @@ -57,6 +57,7 @@ import com.jme3.util.SafeArrayList; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.function.Function; import java.util.logging.Logger; /** @@ -90,7 +91,15 @@ public class RenderManager { private LightFilter lightFilter = new DefaultLightFilter(); private TechniqueDef.LightMode preferredLightMode = TechniqueDef.LightMode.MultiPass; private int singlePassLightBatchSize = 1; + private Function renderFilter; + public void setRenderFilter(Function filter){ + renderFilter=filter; + } + + public Function getRenderFilter(){ + return renderFilter; + } /** * Create a high-level rendering interface over the @@ -557,6 +566,7 @@ public class RenderManager { * @see com.jme3.material.Material#render(com.jme3.scene.Geometry, com.jme3.renderer.RenderManager) */ public void renderGeometry(Geometry geom) { + if(renderFilter!=null&&!renderFilter.apply(geom))return; if (geom.isIgnoreTransform()) { setWorldMatrix(Matrix4f.IDENTITY); } else {