Changeset 9886 for OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp
- Timestamp:
- 03/10/09 15:15:59 (4 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgUtil/Optimizer.cpp
r9703 r9886 22 22 #include <osg/LOD> 23 23 #include <osg/Billboard> 24 #include <osg/CameraView> 24 25 #include <osg/Geometry> 25 26 #include <osg/Notify> … … 110 111 if(str.find("~CHECK_GEOMETRY")!=std::string::npos) options ^= CHECK_GEOMETRY; 111 112 else if(str.find("CHECK_GEOMETRY")!=std::string::npos) options |= CHECK_GEOMETRY; 113 114 if(str.find("~MAKE_FAST_GEOMETRY")!=std::string::npos) options ^= MAKE_FAST_GEOMETRY; 115 else if(str.find("MAKE_FAST_GEOMETRY")!=std::string::npos) options |= MAKE_FAST_GEOMETRY; 112 116 113 117 if(str.find("~FLATTEN_BILLBOARDS")!=std::string::npos) options ^= FLATTEN_BILLBOARDS; … … 277 281 278 282 CheckGeometryVisitor mgv(this); 283 node->accept(mgv); 284 } 285 286 if (options & MAKE_FAST_GEOMETRY) 287 { 288 osg::notify(osg::INFO)<<"Optimizer::optimize() doing MAKE_FAST_GEOMETRY"<<std::endl; 289 290 MakeFastGeometryVisitor mgv(this); 279 291 node->accept(mgv); 280 292 } … … 1309 1321 // only remove empty groups, but not empty occluders. 1310 1322 if (group.getNumChildren()==0 && isOperationPermissibleForObject(&group) && 1311 (typeid(group)==typeid(osg::Group) || dynamic_cast<osg::Transform*>(&group)))1323 (typeid(group)==typeid(osg::Group) || (dynamic_cast<osg::Transform*>(&group) && !dynamic_cast<osg::CameraView*>(&group)))) 1312 1324 { 1313 1325 _redundantNodeList.insert(&group); … … 1781 1793 { 1782 1794 geom->computeCorrectBindingsAndArraySizes(); 1795 } 1796 } 1797 } 1798 } 1799 1800 void Optimizer::MakeFastGeometryVisitor::checkGeode(osg::Geode& geode) 1801 { 1802 if (isOperationPermissibleForObject(&geode)) 1803 { 1804 for(unsigned int i=0;i<geode.getNumDrawables();++i) 1805 { 1806 osg::Geometry* geom = geode.getDrawable(i)->asGeometry(); 1807 if (geom && isOperationPermissibleForObject(geom)) 1808 { 1809 if (!geom->areFastPathsUsed() && !geom->getInternalOptimizedGeometry()) 1810 { 1811 geom->computeInternalOptimizedGeometry(); 1812 } 1783 1813 } 1784 1814 }
