diff --git a/include/osgUtil/Statistics b/include/osgUtil/Statistics index f2ad6d337..6ab80fbfb 100644 --- a/include/osgUtil/Statistics +++ b/include/osgUtil/Statistics @@ -102,6 +102,7 @@ class OSGUTIL_EXPORT Statistics : public osg::PrimitiveFunctor virtual void end(); void addDrawable() { numDrawables++;} + void addFastDrawable() { numFastDrawables++;} void addMatrix() { nummat++;} void addLight(int np) { nlights+=np;} void addImpostor(int np) { nimpostor+= np; } @@ -126,6 +127,7 @@ class OSGUTIL_EXPORT Statistics : public osg::PrimitiveFunctor PrimitiveCountMap::iterator GetPrimitivesEnd() { return _primitives_count.end(); } int numDrawables, nummat, nbins, numStateGraphs; + int numFastDrawables; int nlights; int depth; // depth into bins - eg 1.1,1.2,1.3 etc int _binNo; diff --git a/src/osgUtil/RenderBin.cpp b/src/osgUtil/RenderBin.cpp index edceeba02..24380b2c9 100644 --- a/src/osgUtil/RenderBin.cpp +++ b/src/osgUtil/RenderBin.cpp @@ -535,6 +535,14 @@ bool RenderBin::getStats(Statistics& stats) const const RenderLeaf* rl = *dw_itr; const Drawable* dw= rl->getDrawable(); stats.addDrawable(); // number of geosets + + const Geometry* geom = dw->asGeometry(); + if (geom) + { + if (geom->areFastPathsUsed()) + stats.addFastDrawable(); + } + if (rl->_modelview.get()) { stats.addMatrix(); // number of matrices @@ -560,6 +568,14 @@ bool RenderBin::getStats(Statistics& stats) const const RenderLeaf* rl = dw_itr->get(); const Drawable* dw= rl->getDrawable(); stats.addDrawable(); // number of geosets + + const Geometry* geom = dw->asGeometry(); + if (geom) + { + if (geom->areFastPathsUsed()) + stats.addFastDrawable(); + } + if (rl->_modelview.get()) stats.addMatrix(); // number of matrices if (dw) { diff --git a/src/osgUtil/Statistics.cpp b/src/osgUtil/Statistics.cpp index 719402111..8548765a5 100644 --- a/src/osgUtil/Statistics.cpp +++ b/src/osgUtil/Statistics.cpp @@ -37,6 +37,7 @@ Statistics::Statistics() void Statistics::reset() { numDrawables=0; + numFastDrawables=0; nummat=0; depth=0; stattype=STAT_NONE; @@ -108,6 +109,7 @@ void Statistics::end() void Statistics::add(const Statistics& stats) { numDrawables += stats.numDrawables; + numFastDrawables += stats.numFastDrawables; nummat += stats.nummat; depth += stats.depth; nlights += stats.nlights; diff --git a/src/osgViewer/Renderer.cpp b/src/osgViewer/Renderer.cpp index ad4436dc8..9b44ec2e5 100644 --- a/src/osgViewer/Renderer.cpp +++ b/src/osgViewer/Renderer.cpp @@ -377,6 +377,7 @@ void Renderer::cull() stats->setAttribute(frameNumber, "Visible vertex count", static_cast(sceneStats._vertexCount)); stats->setAttribute(frameNumber, "Visible number of drawables", static_cast(sceneStats.numDrawables)); + stats->setAttribute(frameNumber, "Visible number of fast drawables", static_cast(sceneStats.numFastDrawables)); 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)); diff --git a/src/osgViewer/StatsHandler.cpp b/src/osgViewer/StatsHandler.cpp index 703b78b51..267a737fb 100644 --- a/src/osgViewer/StatsHandler.cpp +++ b/src/osgViewer/StatsHandler.cpp @@ -416,6 +416,7 @@ struct CameraSceneStatsTextDrawCallback : public virtual osg::Drawable::DrawCall STATS_ATTRIBUTE("Visible number of impostors") STATS_ATTRIBUTE("Visible number of drawables") STATS_ATTRIBUTE("Number of ordered leaves") + STATS_ATTRIBUTE("Visible number of fast drawables") STATS_ATTRIBUTE("Visible vertex count") STATS_ATTRIBUTE("Visible number of GL_POINTS") @@ -1409,7 +1410,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) group->addChild(geode); geode->addDrawable(createBackgroundRectangle(pos + osg::Vec3(-backgroundMargin, characterSize + backgroundMargin, 0), 10 * characterSize + 2 * backgroundMargin, - 20 * characterSize + 2 * backgroundMargin, + 21 * characterSize + 2 * backgroundMargin, backgroundColor)); // Camera scene & primitive stats static text @@ -1433,6 +1434,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) viewStr << "Imposters" << std::endl; viewStr << "Drawables" << std::endl; viewStr << "Sorted Drawables" << std::endl; + viewStr << "Fast Drawables" << std::endl; viewStr << "Vertices" << std::endl; viewStr << "Points" << std::endl; viewStr << "Lines" << std::endl; @@ -1456,7 +1458,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer) { geode->addDrawable(createBackgroundRectangle(pos + osg::Vec3(-backgroundMargin, characterSize + backgroundMargin, 0), 5 * characterSize + 2 * backgroundMargin, - 20 * characterSize + 2 * backgroundMargin, + 21 * characterSize + 2 * backgroundMargin, backgroundColor)); // Camera scene stats