Changeset 10055
- Timestamp:
- 04/21/09 12:20:56 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/branches/OpenSceneGraph-2.8/src/osgDB/DatabasePager.cpp
- Property svn:mergeinfo set to /OpenSceneGraph/trunk/src/osgDB/DatabasePager.cpp:10054
r9735 r10055 112 112 { 113 113 public: 114 FindCompileableGLObjectsVisitor(DatabasePager::DataToCompile & dataToCompile,114 FindCompileableGLObjectsVisitor(DatabasePager::DataToCompile* dataToCompile, 115 115 bool changeAutoUnRef, bool valueAutoUnRef, 116 116 bool changeAnisotropy, float valueAnisotropy, … … 128 128 _kdTreeBuilder = osgDB::Registry::instance()->getKdTreeBuilder()->clone(); 129 129 } 130 131 } 132 130 } 131 133 132 META_NodeVisitor("osgDB","FindCompileableGLObjectsVisitor") 134 133 135 134 virtual void apply(osg::Node& node) 136 135 { … … 139 138 traverse(node); 140 139 } 141 140 142 141 virtual void apply(osg::Geode& geode) 143 142 { 144 143 apply(geode.getStateSet()); 145 144 146 145 for(unsigned int i=0;i<geode.getNumDrawables();++i) 147 146 { … … 150 149 151 150 traverse(geode); 152 151 153 152 if (_kdTreeBuilder.valid()) 154 153 { 155 154 geode.accept(*_kdTreeBuilder); 156 155 } 157 158 } 159 156 } 157 160 158 inline void apply(osg::StateSet* stateset) 161 159 { … … 182 180 texture->setMaxAnisotropy(_valueAnisotropy); 183 181 } 184 182 185 183 if (!_pager->isCompiled(texture)) 186 184 { … … 198 196 } 199 197 } 200 if (compileStateSet )201 { 202 _dataToCompile .first.insert(stateset);203 } 204 205 } 206 } 207 198 if (compileStateSet && _dataToCompile) 199 { 200 _dataToCompile->first.insert(stateset); 201 } 202 203 } 204 } 205 208 206 inline void apply(osg::Drawable* drawable) 209 207 { … … 212 210 213 211 _drawableSet.insert(drawable); 214 212 215 213 apply(drawable->getStateSet()); 216 214 217 215 switch(_drawablePolicy) 218 216 { … … 241 239 // XXX This "compiles" VBOs too, but compilation doesn't do 242 240 // anything for VBOs, does it? 243 if ( drawable->getUseDisplayList() && !_pager->isCompiled(drawable))241 if (_dataToCompile && drawable->getUseDisplayList() && !_pager->isCompiled(drawable)) 244 242 { 245 243 // osg::notify(osg::NOTICE)<<" Found compilable drawable"<<std::endl; 246 _dataToCompile .second.push_back(drawable);247 } 248 } 249 250 DatabasePager::DataToCompile &_dataToCompile;244 _dataToCompile->second.push_back(drawable); 245 } 246 } 247 248 DatabasePager::DataToCompile* _dataToCompile; 251 249 bool _changeAutoUnRef; 252 250 bool _valueAutoUnRef; … … 596 594 ActiveGraphicsContexts::iterator itr = _pager->_activeGraphicsContexts.begin(); 597 595 598 DataToCompile& dtc = databaseRequest->_dataToCompileMap[*itr]; 599 ++itr; 596 DataToCompile* dtc = 0; 597 if (itr != _pager->_activeGraphicsContexts.end()) 598 { 599 dtc = &(databaseRequest->_dataToCompileMap[*itr]); 600 ++itr; 601 } 600 602 601 603 // find all the compileable rendering objects … … 620 622 !_pager->_activeGraphicsContexts.empty()) 621 623 { 622 if (!dtc .first.empty() || !dtc.second.empty())624 if (!dtc->first.empty() || !dtc->second.empty()) 623 625 { 624 626 loadedObjectsNeedToBeCompiled = true; … … 629 631 ++itr) 630 632 { 631 databaseRequest->_dataToCompileMap[*itr] = dtc;633 databaseRequest->_dataToCompileMap[*itr] = *dtc; 632 634 } 633 635 } … … 645 647 646 648 // find all the compileable rendering objects 647 DatabasePager::FindCompileableGLObjectsVisitor frov( dtc,649 DatabasePager::FindCompileableGLObjectsVisitor frov(&dtc, 648 650 _pager->_changeAutoUnRef, _pager->_valueAutoUnRef, 649 651 _pager->_changeAnisotropy, _pager->_valueAnisotropy, … … 1494 1496 } 1495 1497 1496 META_NodeVisitor("osgDB"," FindCompileableGLObjectsVisitor")1498 META_NodeVisitor("osgDB","MarkPagedLODsVisitor") 1497 1499 1498 1500 virtual void apply(osg::PagedLOD& plod)
