Add render filter

accellbaker
Riccardo Balbo 5 years ago
parent b14bb34176
commit c91b2dd3f0
  1. 10
      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<Geometry,Boolean> renderFilter;
public void setRenderFilter(Function<Geometry,Boolean> filter){
renderFilter=filter;
}
public Function<Geometry,Boolean> 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 {

Loading…
Cancel
Save