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 aab301b6f..4261edb27 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/RenderManager.java +++ b/jme3-core/src/main/java/com/jme3/renderer/RenderManager.java @@ -533,7 +533,9 @@ public class RenderManager { lightFilter.filterLights(g, filteredLightList); lightList = filteredLightList; } - + + // Report the number of lights we're about to render to the statistics. + renderer.getStatistics().onLights(lightList.size()); //if forcedTechnique we try to force it for render, //if it does not exists in the mat def, we check for forcedMaterial and render the geom if not null @@ -556,7 +558,7 @@ public class RenderManager { forcedRenderState = tmpRs; //Reverted this part from revision 6197 - //If forcedTechnique does not exists, and frocedMaterial is not set, the geom MUST NOT be rendered + //If forcedTechnique does not exists, and forcedMaterial is not set, the geom MUST NOT be rendered } else if (forcedMaterial != null) { // use forced material forcedMaterial.render(g, lightList, this); @@ -641,10 +643,8 @@ public class RenderManager { *

* In addition to enqueuing the visible geometries, this method * also scenes which cast or receive shadows, by putting them into the - * RenderQueue's - * {@link RenderQueue#addToShadowQueue(com.jme3.scene.Geometry, com.jme3.renderer.queue.RenderQueue.ShadowMode) - * shadow queue}. Each Spatial which has its - * {@link Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) shadow mode} + * RenderQueue's {@link RenderQueue#renderShadowQueue(GeometryList, RenderManager, Camera, boolean) shadow queue}. + * Each Spatial which has its {@link Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) shadow mode} * set to not off, will be put into the appropriate shadow queue, note that * this process does not check for frustum culling on any * {@link ShadowMode#Cast shadow casters}, as they don't have to be @@ -991,13 +991,12 @@ public class RenderManager { * (see {@link #renderTranslucentQueue(com.jme3.renderer.ViewPort) }) *

  • If any objects remained in the render queue, they are removed * from the queue. This is generally objects added to the - * {@link RenderQueue#renderShadowQueue(com.jme3.renderer.queue.RenderQueue.ShadowMode, com.jme3.renderer.RenderManager, com.jme3.renderer.Camera, boolean) - * shadow queue} + * {@link RenderQueue#renderShadowQueue(GeometryList, RenderManager, Camera, boolean) shadow queue} * which were not rendered because of a missing shadow renderer.
  • * * - * @param vp - * @param tpf + * @param vp View port to render + * @param tpf Time per frame value */ public void renderViewPort(ViewPort vp, float tpf) { if (!vp.isEnabled()) { diff --git a/jme3-core/src/main/java/com/jme3/renderer/Statistics.java b/jme3-core/src/main/java/com/jme3/renderer/Statistics.java index 9d44e6566..243dd0914 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/Statistics.java +++ b/jme3-core/src/main/java/com/jme3/renderer/Statistics.java @@ -36,7 +36,6 @@ import com.jme3.shader.Shader; import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image; import com.jme3.util.IntMap; -import java.util.HashSet; /** * The statistics class allows tracking of real-time rendering statistics. @@ -50,6 +49,7 @@ public class Statistics { protected boolean enabled = false; protected int numObjects; + protected int numLights; protected int numTriangles; protected int numVertices; protected int numShaderSwitches; @@ -80,6 +80,7 @@ public class Statistics { "Uniforms", "Objects", + "Lights", "Shaders (S)", "Shaders (F)", @@ -107,18 +108,19 @@ public class Statistics { data[1] = numTriangles; data[2] = numUniformsSet; data[3] = numObjects; + data[4] = numLights; - data[4] = numShaderSwitches; - data[5] = shadersUsed.size(); - data[6] = memoryShaders; + data[5] = numShaderSwitches; + data[6] = shadersUsed.size(); + data[7] = memoryShaders; - data[7] = numTextureBinds; - data[8] = texturesUsed.size(); - data[9] = memoryTextures; + data[8] = numTextureBinds; + data[9] = texturesUsed.size(); + data[10] = memoryTextures; - data[10] = numFboSwitches; - data[11] = fbosUsed.size(); - data[12] = memoryFrameBuffers; + data[11] = numFboSwitches; + data[12] = fbosUsed.size(); + data[13] = memoryFrameBuffers; } /** @@ -223,6 +225,7 @@ public class Statistics { fbosUsed.clear(); numObjects = 0; + numLights = 0; numTriangles = 0; numVertices = 0; numShaderSwitches = 0; @@ -287,6 +290,19 @@ public class Statistics { memoryFrameBuffers --; } + /** + * Called by the RenderManager once filtering has happened. + * + * @param lightCount the number of lights which will be passed to the materials for inclusion in rendering. + */ + public void onLights(final int lightCount) { + if (!enabled) { + return; + } + + numLights += lightCount; + } + /** * Called when video memory is cleared. */