Added number of primitive sets to on screen stats
This commit is contained in:
@@ -110,8 +110,8 @@ public:
|
||||
OSG_NOTICE<<"Running simplifier with simplification ratio="<<simplificatioRatio<<std::endl;
|
||||
float maxError = 4.0f;
|
||||
osgUtil::Simplifier simplifier(simplificatioRatio, maxError);
|
||||
simplifier.setDoTriStrip(false);
|
||||
simplifier.setSmoothing(false);
|
||||
//simplifier.setDoTriStrip(false);
|
||||
//simplifier.setSmoothing(false);
|
||||
node->accept(simplifier);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,10 @@ class OSGUTIL_EXPORT Statistics : public osg::PrimitiveFunctor
|
||||
PrimitiveCountMap& getPrimitiveCountMap() { return _primitives_count; }
|
||||
const PrimitiveCountMap& getPrimitiveCountMap() const { return _primitives_count; }
|
||||
|
||||
PrimitiveValueMap& getPrimitiveValueMap() { return _primitiveCount; }
|
||||
const PrimitiveValueMap& getPrimitiveValueMap() const { return _primitiveCount; }
|
||||
|
||||
|
||||
/// deprecated
|
||||
PrimitiveCountMap::iterator GetPrimitivesBegin() { return _primitives_count.begin(); }
|
||||
/// deprecated
|
||||
|
||||
@@ -212,6 +212,8 @@ void CompileOperator::runTimingTests(osg::RenderInfo& renderInfo)
|
||||
OSG_NOTICE<<"runTimingTests()"<<std::endl;
|
||||
_timingTestsCompleted = true;
|
||||
|
||||
return;
|
||||
|
||||
unsigned int mx = 18;
|
||||
double Mbsec = 1.0/(1024.0*1024.0);
|
||||
for(unsigned int j=0; j<4; ++j)
|
||||
@@ -273,22 +275,25 @@ bool CompileOperator::compile(osg::RenderInfo& renderInfo, CompileData& cd, unsi
|
||||
const osg::Drawable* drawable = itr->get();
|
||||
unsigned int size = drawable->getGLObjectSizeHint();
|
||||
const std::string& nameOfDrawableType = drawable->getUseVertexBufferObjects() ? vboDrawablesName : dlDawablesName;
|
||||
|
||||
#if 0
|
||||
double estimatedTime = _compileStats->estimateTime(nameOfDrawableType, double(size));
|
||||
double estimatedTime2 = _compileStats->estimateTime2(nameOfDrawableType, double(size));
|
||||
double estimatedTime3 = _compileStats->estimateTime3(nameOfDrawableType, double(size));
|
||||
double estimatedTime4 = _compileStats->estimateTime4(nameOfDrawableType, double(size));
|
||||
|
||||
#endif
|
||||
drawable->compileGLObjects(renderInfo);
|
||||
osg::Timer_t currTick = osg::Timer::instance()->tick();
|
||||
double timeForCompile = osg::Timer::instance()->delta_s(previousTick, currTick);
|
||||
previousTick = currTick;
|
||||
|
||||
#if 0
|
||||
OSG_NOTICE<<"Drawable size = "<<size<<std::endl;
|
||||
OSG_NOTICE<<" Estimated time ="<<estimatedTime<<", actual time="<<timeForCompile<<" ratio = "<<timeForCompile/estimatedTime<<std::endl;
|
||||
OSG_NOTICE<<" Estimated time2="<<estimatedTime2<<", actual time="<<timeForCompile<<" ratio = "<<timeForCompile/estimatedTime2<<std::endl;
|
||||
OSG_NOTICE<<" Estimated time3="<<estimatedTime3<<", actual time="<<timeForCompile<<" ratio = "<<timeForCompile/estimatedTime3<<std::endl;
|
||||
OSG_NOTICE<<" Estimated time4="<<estimatedTime4<<", actual time="<<timeForCompile<<" ratio = "<<timeForCompile/estimatedTime4<<std::endl;
|
||||
|
||||
#endif
|
||||
_compileStats->add(nameOfDrawableType, double(size), timeForCompile);
|
||||
|
||||
|
||||
|
||||
@@ -385,6 +385,16 @@ void Renderer::cull()
|
||||
stats->setAttribute(frameNumber, "Visible number of impostors", static_cast<double>(sceneStats.nimpostor));
|
||||
stats->setAttribute(frameNumber, "Number of ordered leaves", static_cast<double>(sceneStats.numOrderedLeaves));
|
||||
|
||||
unsigned int totalNumPrimitiveSets = 0;
|
||||
const osgUtil::Statistics::PrimitiveValueMap& pvm = sceneStats.getPrimitiveValueMap();
|
||||
for(osgUtil::Statistics::PrimitiveValueMap::const_iterator pvm_itr = pvm.begin();
|
||||
pvm_itr != pvm.end();
|
||||
++pvm_itr)
|
||||
{
|
||||
totalNumPrimitiveSets += pvm_itr->second.first;
|
||||
}
|
||||
stats->setAttribute(frameNumber, "Visible number of PrimitiveSets", static_cast<double>(totalNumPrimitiveSets));
|
||||
|
||||
osgUtil::Statistics::PrimitiveCountMap& pcm = sceneStats.getPrimitiveCountMap();
|
||||
stats->setAttribute(frameNumber, "Visible number of GL_POINTS", static_cast<double>(pcm[GL_POINTS]));
|
||||
stats->setAttribute(frameNumber, "Visible number of GL_LINES", static_cast<double>(pcm[GL_LINES]));
|
||||
|
||||
@@ -419,6 +419,7 @@ struct CameraSceneStatsTextDrawCallback : public virtual osg::Drawable::DrawCall
|
||||
STATS_ATTRIBUTE("Visible number of fast drawables")
|
||||
STATS_ATTRIBUTE("Visible vertex count")
|
||||
|
||||
STATS_ATTRIBUTE("Visible number of PrimitiveSets")
|
||||
STATS_ATTRIBUTE("Visible number of GL_POINTS")
|
||||
STATS_ATTRIBUTE("Visible number of GL_LINES")
|
||||
STATS_ATTRIBUTE("Visible number of GL_LINE_STRIP")
|
||||
@@ -1410,7 +1411,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
|
||||
group->addChild(geode);
|
||||
geode->addDrawable(createBackgroundRectangle(pos + osg::Vec3(-backgroundMargin, characterSize + backgroundMargin, 0),
|
||||
10 * characterSize + 2 * backgroundMargin,
|
||||
21 * characterSize + 2 * backgroundMargin,
|
||||
22 * characterSize + 2 * backgroundMargin,
|
||||
backgroundColor));
|
||||
|
||||
// Camera scene & primitive stats static text
|
||||
@@ -1436,6 +1437,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
|
||||
viewStr << "Sorted Drawables" << std::endl;
|
||||
viewStr << "Fast Drawables" << std::endl;
|
||||
viewStr << "Vertices" << std::endl;
|
||||
viewStr << "PrimitiveSets" << std::endl;
|
||||
viewStr << "Points" << std::endl;
|
||||
viewStr << "Lines" << std::endl;
|
||||
viewStr << "Line strips" << std::endl;
|
||||
@@ -1458,7 +1460,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
|
||||
{
|
||||
geode->addDrawable(createBackgroundRectangle(pos + osg::Vec3(-backgroundMargin, characterSize + backgroundMargin, 0),
|
||||
5 * characterSize + 2 * backgroundMargin,
|
||||
21 * characterSize + 2 * backgroundMargin,
|
||||
22 * characterSize + 2 * backgroundMargin,
|
||||
backgroundColor));
|
||||
|
||||
// Camera scene stats
|
||||
|
||||
Reference in New Issue
Block a user