Added numLights to statistics. This tells us how many lights are left to render after filtering has occurred. Also did some tidy up of javadoc in RenderManager.

cleanup_build_scripts
Daniel Johansson 9 years ago
parent e0c24cd73a
commit 67eb998ef4
  1. 19
      jme3-core/src/main/java/com/jme3/renderer/RenderManager.java
  2. 36
      jme3-core/src/main/java/com/jme3/renderer/Statistics.java

@ -533,7 +533,9 @@ public class RenderManager {
lightFilter.filterLights(g, filteredLightList); lightFilter.filterLights(g, filteredLightList);
lightList = 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 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 //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; forcedRenderState = tmpRs;
//Reverted this part from revision 6197 //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) { } else if (forcedMaterial != null) {
// use forced material // use forced material
forcedMaterial.render(g, lightList, this); forcedMaterial.render(g, lightList, this);
@ -641,10 +643,8 @@ public class RenderManager {
* <p> * <p>
* In addition to enqueuing the visible geometries, this method * In addition to enqueuing the visible geometries, this method
* also scenes which cast or receive shadows, by putting them into the * also scenes which cast or receive shadows, by putting them into the
* RenderQueue's * RenderQueue's {@link RenderQueue#renderShadowQueue(GeometryList, RenderManager, Camera, boolean) shadow queue}.
* {@link RenderQueue#addToShadowQueue(com.jme3.scene.Geometry, com.jme3.renderer.queue.RenderQueue.ShadowMode) * Each Spatial which has its {@link Spatial#setShadowMode(com.jme3.renderer.queue.RenderQueue.ShadowMode) shadow mode}
* 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 * set to not off, will be put into the appropriate shadow queue, note that
* this process does not check for frustum culling on any * this process does not check for frustum culling on any
* {@link ShadowMode#Cast shadow casters}, as they don't have to be * {@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) })</li> * (see {@link #renderTranslucentQueue(com.jme3.renderer.ViewPort) })</li>
* <li>If any objects remained in the render queue, they are removed * <li>If any objects remained in the render queue, they are removed
* from the queue. This is generally objects added to the * 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) * {@link RenderQueue#renderShadowQueue(GeometryList, RenderManager, Camera, boolean) shadow queue}
* shadow queue}
* which were not rendered because of a missing shadow renderer.</li> * which were not rendered because of a missing shadow renderer.</li>
* </ul> * </ul>
* *
* @param vp * @param vp View port to render
* @param tpf * @param tpf Time per frame value
*/ */
public void renderViewPort(ViewPort vp, float tpf) { public void renderViewPort(ViewPort vp, float tpf) {
if (!vp.isEnabled()) { if (!vp.isEnabled()) {

@ -36,7 +36,6 @@ import com.jme3.shader.Shader;
import com.jme3.texture.FrameBuffer; import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image; import com.jme3.texture.Image;
import com.jme3.util.IntMap; import com.jme3.util.IntMap;
import java.util.HashSet;
/** /**
* The statistics class allows tracking of real-time rendering statistics. * The statistics class allows tracking of real-time rendering statistics.
@ -50,6 +49,7 @@ public class Statistics {
protected boolean enabled = false; protected boolean enabled = false;
protected int numObjects; protected int numObjects;
protected int numLights;
protected int numTriangles; protected int numTriangles;
protected int numVertices; protected int numVertices;
protected int numShaderSwitches; protected int numShaderSwitches;
@ -80,6 +80,7 @@ public class Statistics {
"Uniforms", "Uniforms",
"Objects", "Objects",
"Lights",
"Shaders (S)", "Shaders (S)",
"Shaders (F)", "Shaders (F)",
@ -107,18 +108,19 @@ public class Statistics {
data[1] = numTriangles; data[1] = numTriangles;
data[2] = numUniformsSet; data[2] = numUniformsSet;
data[3] = numObjects; data[3] = numObjects;
data[4] = numLights;
data[4] = numShaderSwitches; data[5] = numShaderSwitches;
data[5] = shadersUsed.size(); data[6] = shadersUsed.size();
data[6] = memoryShaders; data[7] = memoryShaders;
data[7] = numTextureBinds; data[8] = numTextureBinds;
data[8] = texturesUsed.size(); data[9] = texturesUsed.size();
data[9] = memoryTextures; data[10] = memoryTextures;
data[10] = numFboSwitches; data[11] = numFboSwitches;
data[11] = fbosUsed.size(); data[12] = fbosUsed.size();
data[12] = memoryFrameBuffers; data[13] = memoryFrameBuffers;
} }
/** /**
@ -223,6 +225,7 @@ public class Statistics {
fbosUsed.clear(); fbosUsed.clear();
numObjects = 0; numObjects = 0;
numLights = 0;
numTriangles = 0; numTriangles = 0;
numVertices = 0; numVertices = 0;
numShaderSwitches = 0; numShaderSwitches = 0;
@ -287,6 +290,19 @@ public class Statistics {
memoryFrameBuffers --; 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. * Called when video memory is cleared.
*/ */

Loading…
Cancel
Save