From c925104f5e2933a59c1c586234cd2cc7a093267a Mon Sep 17 00:00:00 2001 From: shadowislord Date: Thu, 5 Jun 2014 22:37:00 -0400 Subject: [PATCH] * Ensure the statistics properly represent number of objects / triangles / vertices rendered when using instancing --- .../main/java/com/jme3/renderer/Statistics.java | 16 +++++++++++----- .../com/jme3/renderer/lwjgl/LwjglRenderer.java | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) 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 db75d0b74..5928e9879 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/Statistics.java +++ b/jme3-core/src/main/java/com/jme3/renderer/Statistics.java @@ -120,15 +120,21 @@ public class Statistics { /** * Called by the Renderer when a mesh has been drawn. - * */ - public void onMeshDrawn(Mesh mesh, int lod){ + public void onMeshDrawn(Mesh mesh, int lod, int count){ if( !enabled ) return; - numObjects ++; - numTriangles += mesh.getTriangleCount(lod); - numVertices += mesh.getVertexCount(); + numObjects += count; + numTriangles += mesh.getTriangleCount(lod) * count; + numVertices += mesh.getVertexCount() * count; + } + + /** + * Called by the Renderer when a mesh has been drawn. + */ + public void onMeshDrawn(Mesh mesh, int lod){ + onMeshDrawn(mesh, lod, 1); } /** diff --git a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java index b43cea719..277a442bb 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java +++ b/jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java @@ -2545,7 +2545,7 @@ public class LwjglRenderer implements Renderer { context.lineWidth = mesh.getLineWidth(); } - statistics.onMeshDrawn(mesh, lod); + statistics.onMeshDrawn(mesh, lod, count); // if (GLContext.getCapabilities().GL_ARB_vertex_array_object){ // renderMeshVertexArray(mesh, lod, count); // }else{