Show
Ignore:
Timestamp:
03/10/09 15:15:59 (5 years ago)
Author:
robert
Message:

From Roland Smeenk, "While working on the Collada plugin I noticed that all geometry created by the dae reader result in slow path geometry.
Because there already exists the option to convert slow path geometry to the fast path by computing an internal fast path alternative, I added a new optimizer option that automatically does this. To check the results I also made some changes to the statistics gathering and rendering.

Somewhat unrelated, but also part of the optimizer I disabled removal of CameraView? nodes during RemoveRedundantNodes? optimization.
As discussed on the ML, CameraViews? were removed from the scenegraph. This solves that issue.

Summary:
-Geometry::areFastPathsUsed now also looks at internalOptimizedGeometry
-Added Optimize option to make all slow path geometry compute their internal fast path alternative
-Added fast geometry counter to the statistics
-Disabled removel of CameraViews? in optimizer
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgUtil/Statistics.cpp

    r6461 r9886  
    2626#include <set> 
    2727#include <ostream> 
     28#include <iomanip> 
    2829 
    2930using namespace osgUtil; 
     
    144145    _numInstancedDrawable(0), 
    145146    _numInstancedGeometry(0), 
     147    _numInstancedFastGeometry(0), 
    146148    _numInstancedStateSet(0) 
    147149{} 
     
    156158    _numInstancedDrawable = 0; 
    157159    _numInstancedGeometry = 0; 
     160    _numInstancedFastGeometry = 0; 
    158161    _numInstancedStateSet = 0; 
    159162 
     
    165168    _drawableSet.clear(); 
    166169    _geometrySet.clear(); 
     170    _fastGeometrySet.clear(); 
    167171    _statesetSet.clear(); 
    168172 
     
    265269 
    266270    _drawableSet.insert(&drawable); 
    267  
    268     osg::Geometry* geometry = dynamic_cast<osg::Geometry*>(&drawable); 
     271     
     272    osg::Geometry* geometry = drawable.asGeometry(); 
    269273    if (geometry) 
    270274    { 
    271275        ++_numInstancedGeometry; 
    272276        _geometrySet.insert(geometry); 
     277 
     278        if (geometry->areFastPathsUsed()) 
     279        { 
     280            ++_numInstancedFastGeometry; 
     281            _fastGeometrySet.insert(geometry); 
     282        } 
    273283    } 
    274284} 
     
    306316    } 
    307317 
    308     out<<"Object Type\t#Unique\t#Instanced"<<std::endl; 
    309     out<<"StateSet      \t"<<_statesetSet.size()<<"\t"<<_numInstancedStateSet<<std::endl; 
    310     out<<"Group      \t"<<_groupSet.size()<<"\t"<<_numInstancedGroup<<std::endl; 
    311     out<<"Transform  \t"<<_transformSet.size()<<"\t"<<_numInstancedTransform<<std::endl; 
    312     out<<"LOD        \t"<<_lodSet.size()<<"\t"<<_numInstancedLOD<<std::endl; 
    313     out<<"Switch     \t"<<_switchSet.size()<<"\t"<<_numInstancedSwitch<<std::endl; 
    314     out<<"Geode      \t"<<_geodeSet.size()<<"\t"<<_numInstancedGeode<<std::endl; 
    315     out<<"Drawable   \t"<<_drawableSet.size()<<"\t"<<_numInstancedDrawable<<std::endl; 
    316     out<<"Geometry   \t"<<_geometrySet.size()<<"\t"<<_numInstancedGeometry<<std::endl; 
    317     out<<"Vertices   \t"<<_uniqueStats._vertexCount<<"\t"<<_instancedStats._vertexCount<<std::endl; 
    318     out<<"Primitives \t"<<unique_primitives<<"\t"<<instanced_primitives<<std::endl; 
     318 
     319    out << std::setw(12) << "Object Type" << std::setw(10) << "Unique"                  << std::setw(10) << "Instanced" << std::endl; 
     320    out << std::setw(12) << "-----------" << std::setw(10) << "------"                  << std::setw(10) << "---------" << std::endl; 
     321    out << std::setw(12) << "StateSet   " << std::setw(10) << _statesetSet.size()       << std::setw(10) << _numInstancedStateSet << std::endl; 
     322    out << std::setw(12) << "Group      " << std::setw(10) << _groupSet.size()          << std::setw(10) << _numInstancedGroup << std::endl; 
     323    out << std::setw(12) << "Transform  " << std::setw(10) << _transformSet.size()      << std::setw(10) << _numInstancedTransform << std::endl; 
     324    out << std::setw(12) << "LOD        " << std::setw(10) << _lodSet.size()            << std::setw(10) << _numInstancedLOD << std::endl; 
     325    out << std::setw(12) << "Switch     " << std::setw(10) << _switchSet.size()         << std::setw(10) << _numInstancedSwitch << std::endl; 
     326    out << std::setw(12) << "Geode      " << std::setw(10) << _geodeSet.size()          << std::setw(10) << _numInstancedGeode << std::endl; 
     327    out << std::setw(12) << "Drawable   " << std::setw(10) << _drawableSet.size()       << std::setw(10) << _numInstancedDrawable << std::endl; 
     328    out << std::setw(12) << "Geometry   " << std::setw(10) << _geometrySet.size()       << std::setw(10) << _numInstancedGeometry << std::endl; 
     329    out << std::setw(12) << "Fast geom. " << std::setw(10) << _fastGeometrySet.size()   << std::setw(10) << _numInstancedFastGeometry << std::endl; 
     330    out << std::setw(12) << "Vertices   " << std::setw(10) << _uniqueStats._vertexCount << std::setw(10) << _instancedStats._vertexCount << std::endl; 
     331    out << std::setw(12) << "Primitives " << std::setw(10) << unique_primitives         << std::setw(10) << instanced_primitives << std::endl; 
    319332} 
    320333