diff --git a/include/osgUtil/Statistics b/include/osgUtil/Statistics index 96a84f4e4..f2ad6d337 100644 --- a/include/osgUtil/Statistics +++ b/include/osgUtil/Statistics @@ -110,6 +110,8 @@ class OSGUTIL_EXPORT Statistics : public osg::PrimitiveFunctor void addBins(int np) { nbins+= np; } void setBinNo(int n) { _binNo=n;} + void addStateGraphs(int n) { numStateGraphs += n; } + void addOrderedLeaves(int n) { numOrderedLeaves += n; } void add(const Statistics& stats); @@ -123,12 +125,13 @@ class OSGUTIL_EXPORT Statistics : public osg::PrimitiveFunctor /// deprecated PrimitiveCountMap::iterator GetPrimitivesEnd() { return _primitives_count.end(); } - int numDrawables, nummat, nbins; + int numDrawables, nummat, nbins, numStateGraphs; int nlights; int depth; // depth into bins - eg 1.1,1.2,1.3 etc int _binNo; StatsType stattype; int nimpostor; // number of impostors rendered + int numOrderedLeaves; // leaves from RenderBin fine grain ordering unsigned int _vertexCount; PrimitiveValueMap _primitiveCount; diff --git a/src/osgUtil/RenderBin.cpp b/src/osgUtil/RenderBin.cpp index 803b97c58..39d84b0c9 100644 --- a/src/osgUtil/RenderBin.cpp +++ b/src/osgUtil/RenderBin.cpp @@ -522,7 +522,7 @@ bool RenderBin::getStats(Statistics& stats) const // different by return type - collects the stats in this renderrBin bool statsCollected = false; - + stats.addOrderedLeaves(_renderLeafList.size()); // draw fine grained ordering. for(RenderLeafList::const_iterator dw_itr = _renderLeafList.begin(); dw_itr != _renderLeafList.end(); @@ -543,7 +543,7 @@ bool RenderBin::getStats(Statistics& stats) const } statsCollected = true; } - + stats.addStateGraphs(_stateGraphList.size()); for(StateGraphList::const_iterator oitr=_stateGraphList.begin(); oitr!=_stateGraphList.end(); ++oitr) diff --git a/src/osgUtil/Statistics.cpp b/src/osgUtil/Statistics.cpp index 51d47836d..719402111 100644 --- a/src/osgUtil/Statistics.cpp +++ b/src/osgUtil/Statistics.cpp @@ -43,6 +43,8 @@ void Statistics::reset() nlights=0; nbins=0; nimpostor=0; + numStateGraphs=0; + numOrderedLeaves=0; _vertexCount=0; _primitiveCount.clear(); @@ -111,6 +113,8 @@ void Statistics::add(const Statistics& stats) nlights += stats.nlights; nbins += stats.nbins; nimpostor += stats.nimpostor; + numStateGraphs += stats.numStateGraphs; + numOrderedLeaves += stats.numOrderedLeaves; _vertexCount += stats._vertexCount; // _primitiveCount += stats._primitiveCount; diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp index f26c9d7f0..20dad3625 100644 --- a/src/osgViewer/Renderer.cpp +++ b/src/osgViewer/Renderer.cpp @@ -380,8 +380,9 @@ void Renderer::cull() stats->setAttribute(frameNumber, "Visible number of lights", static_cast(sceneStats.nlights)); stats->setAttribute(frameNumber, "Visible number of render bins", static_cast(sceneStats.nbins)); stats->setAttribute(frameNumber, "Visible depth", static_cast(sceneStats.depth)); - stats->setAttribute(frameNumber, "Visible number of materials", static_cast(sceneStats.nummat)); + stats->setAttribute(frameNumber, "Number of StateGraphs", static_cast(sceneStats.numStateGraphs)); stats->setAttribute(frameNumber, "Visible number of impostors", static_cast(sceneStats.nimpostor)); + stats->setAttribute(frameNumber, "Number of ordered leaves", static_cast(sceneStats.numOrderedLeaves)); osgUtil::Statistics::PrimitiveCountMap& pcm = sceneStats.getPrimitiveCountMap(); stats->setAttribute(frameNumber, "Visible number of GL_POINTS", static_cast(pcm[GL_POINTS])); @@ -598,8 +599,9 @@ void Renderer::cull_draw() stats->setAttribute(frameNumber, "Visible number of lights", static_cast(sceneStats.nlights)); stats->setAttribute(frameNumber, "Visible number of render bins", static_cast(sceneStats.nbins)); stats->setAttribute(frameNumber, "Visible depth", static_cast(sceneStats.depth)); - stats->setAttribute(frameNumber, "Visible number of materials", static_cast(sceneStats.nummat)); + stats->setAttribute(frameNumber, "Number of StateGraphs", static_cast(sceneStats.numStateGraphs)); stats->setAttribute(frameNumber, "Visible number of impostors", static_cast(sceneStats.nimpostor)); + stats->setAttribute(frameNumber, "Number of ordered leaves", static_cast(sceneStats.numOrderedLeaves)); } #if 0 diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index 93e3bd20c..e74ea67a1 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -412,9 +412,10 @@ struct CameraSceneStatsTextDrawCallback : public virtual osg::Drawable::DrawCall STATS_ATTRIBUTE("Visible number of lights") STATS_ATTRIBUTE("Visible number of render bins") STATS_ATTRIBUTE("Visible depth") - STATS_ATTRIBUTE("Visible number of materials") + STATS_ATTRIBUTE("Number of StateGraphs") STATS_ATTRIBUTE("Visible number of impostors") STATS_ATTRIBUTE("Visible number of drawables") + STATS_ATTRIBUTE("Number of ordered leaves") STATS_ATTRIBUTE("Visible vertex count") STATS_ATTRIBUTE("Visible number of GL_POINTS") @@ -1417,9 +1418,10 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) viewStr << "Lights" << std::endl; viewStr << "Bins" << std::endl; viewStr << "Depth" << std::endl; - viewStr << "Materials" << std::endl; + viewStr << "State graphs" << std::endl; viewStr << "Imposters" << std::endl; viewStr << "Drawables" << std::endl; + viewStr << "Sorted" << std::endl; viewStr << "Vertices" << std::endl; viewStr << "Points" << std::endl; viewStr << "Lines" << std::endl;