Changeset 13041 for OpenSceneGraph/trunk/src/osgUtil/RenderBin.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgUtil/RenderBin.cpp (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgUtil/RenderBin.cpp
r12298 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 74 74 if (prototype) return dynamic_cast<RenderBin*>(prototype->clone(osg::CopyOp::DEEP_COPY_ALL)); 75 75 } 76 76 77 77 OSG_WARN <<"Warning: RenderBin \""<<binName<<"\" implementation not found, using default RenderBin as a fallback."<<std::endl; 78 78 return new RenderBin; … … 124 124 { 125 125 s_defaultBinSortModeInitialized = true; 126 126 127 127 const char* str = getenv("OSG_DEFAULT_BIN_SORT_MODE"); 128 128 if (str) … … 135 135 } 136 136 } 137 137 138 138 return s_defaultBinSortMode; 139 139 } … … 161 161 _stateset = new osg::StateSet; 162 162 _stateset->setThreadSafeRefUnref(true); 163 163 164 164 // set up an alphafunc by default to speed up blending operations. 165 165 #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE … … 167 167 alphafunc->setFunction(osg::AlphaFunc::GREATER,0.0f); 168 168 alphafunc->setThreadSafeRefUnref(true); 169 169 170 170 _stateset->setAttributeAndModes(alphafunc, osg::StateAttribute::ON); 171 171 #endif 172 172 } 173 #endif 173 #endif 174 174 } 175 175 … … 213 213 itr->second->sort(); 214 214 } 215 216 if (_sortCallback.valid()) 215 216 if (_sortCallback.valid()) 217 217 { 218 218 _sortCallback->sortImplementation(this); 219 219 } 220 220 else sortImplementation(); 221 221 222 222 _sorted = true; 223 223 } … … 297 297 }; 298 298 299 299 300 300 void RenderBin::sortFrontToBack() 301 301 { … … 304 304 // now sort the list into acending depth order. 305 305 std::sort(_renderLeafList.begin(),_renderLeafList.end(),FrontToBackSortFunctor()); 306 306 307 307 // cout << "sort front to back"<<endl; 308 308 } … … 357 357 358 358 _renderLeafList.reserve(totalsize); 359 359 360 360 bool detectedNaN = false; 361 361 362 362 // first copy all the leaves from the render graphs into the leaf list. 363 363 for(itr=_stateGraphList.begin(); … … 379 379 } 380 380 } 381 381 382 382 if (detectedNaN) OSG_NOTICE<<"Warning: RenderBin::copyLeavesFromStateGraphListToRenderLeafList() detected NaN depth values, database may be corrupted."<<std::endl; 383 383 384 384 // empty the render graph list to prevent it being drawn along side the render leaf list (see drawImplementation.) 385 385 _stateGraphList.clear(); … … 418 418 void RenderBin::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous) 419 419 { 420 if (_drawCallback.valid()) 420 if (_drawCallback.valid()) 421 421 { 422 422 _drawCallback->drawImplementation(this,renderInfo,previous); … … 536 536 const Drawable* dw= rl->getDrawable(); 537 537 stats.addDrawable(); // number of geosets 538 538 539 539 const Geometry* geom = dw->asGeometry(); 540 540 if (geom) … … 548 548 stats.addMatrix(); // number of matrices 549 549 } 550 550 551 551 if (dw) 552 552 { … … 561 561 ++oitr) 562 562 { 563 563 564 564 for(StateGraph::LeafList::const_iterator dw_itr = (*oitr)->_leaves.begin(); 565 565 dw_itr != (*oitr)->_leaves.end(); … … 646 646 count += rbitr->second->computeNumberOfDynamicRenderLeaves(); 647 647 } 648 648 649 649 return count; 650 650 }
