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.

This commit is contained in:
Daniel Johansson 2015-12-22 10:55:43 +00:00
parent e0c24cd73a
commit 67eb998ef4
2 changed files with 35 additions and 20 deletions

View File

@ -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 {
* <p>
* 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) })</li>
* <li>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.</li>
* </ul>
*
* @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()) {

View File

@ -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.
*/