From c91b2dd3f0d6feec4d81ad17e30b43890ea653cd Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Wed, 11 Sep 2019 11:03:51 +0200 Subject: [PATCH] Add render filter --- .../src/main/java/com/jme3/renderer/RenderManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 {