diff --git a/include/osg/Statistics b/include/osg/Statistics index 252ea2ac1..fe0b20276 100644 --- a/include/osg/Statistics +++ b/include/osg/Statistics @@ -59,6 +59,7 @@ class SG_EXPORT Statistics : public osg::Referenced, public osg::Drawable::Attri { STAT_NONE, // default STAT_FRAMERATE, STAT_GRAPHS, + STAT_VIEWPARMS, // descrbe the view parameters (FOV, near/far...) STAT_PRIMS, STAT_PRIMSPERVIEW, STAT_PRIMSPERBIN, STAT_DC, STAT_RESTART // hint to restart the stats diff --git a/src/osg/GeoSet.cpp b/src/osg/GeoSet.cpp index 2ed403a43..9f3a24b5a 100644 --- a/src/osg/GeoSet.cpp +++ b/src/osg/GeoSet.cpp @@ -1,5 +1,5 @@ #if defined(_MSC_VER) - #pragma warning( disable : 4786 ) + #pragma warning( disable : 4786 ) #endif #include @@ -875,8 +875,9 @@ Drawable::AttributeBitMask GeoSet::applyAttributeOperation(AttributeFunctor& auf bool GeoSet::getStats(Statistics &stat) { // analyse the drawable GeoSet const int np=getNumPrims(); // number of primitives in this geoset - stat.nprims += np; + stat.addNumPrims(np); const int type=getPrimType(); + int nprimlens=0, numprimtypes=0, primverts=0; switch (type) { case osg::GeoSet::POINTS: case osg::GeoSet::LINES: @@ -889,26 +890,16 @@ bool GeoSet::getStats(Statistics &stat) case osg::GeoSet::FLAT_TRIANGLE_FAN: case osg::GeoSet::QUAD_STRIP: case osg::GeoSet::POLYGON: - stat.primtypes[type]++; - stat.primtypes[0]++; break; case osg::GeoSet::TRIANGLES: // should not have any lengths for tris & quads - stat.primtypes[type]++; - stat.primtypes[0]++; - stat.primlens[0]+=np; - stat.primlens[type]+=np; - stat.numprimtypes[type]+=np; - stat.primverts[type]+=3*np; - stat.primverts[0]+=3*np; + nprimlens=np; + numprimtypes=np; + primverts=3*np; break; case osg::GeoSet::QUADS: - stat.primtypes[type]++; - stat.primtypes[0]++; - stat.primlens[0]+=np*2; - stat.primlens[type]+=np*2; // quad is equiv to 2 triangles - stat.numprimtypes[type]+=np; - stat.primverts[type]+=4*np; - stat.primverts[0]+=4*np; + nprimlens=np*2; + primverts=4*np; + numprimtypes=np; break; case osg::GeoSet::NO_TYPE: default: @@ -916,7 +907,7 @@ bool GeoSet::getStats(Statistics &stat) } // now count the lengths, ie efficiency of triangulation const int *lens=getPrimLengths(); // primitive lengths - if (lens) { + if (lens) { // then count for each length for (int i=0; i