Changeset 285
- Timestamp:
- 10/12/06 17:57:02 (2 years ago)
- Files:
-
- branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGOcclusionCullingTreeBuilder.cpp (modified) (6 diffs)
- branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGOcclusionCullingTreeBuilder.h (modified) (2 diffs)
- branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGRenderPartition.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGOcclusionCullingTreeBuilder.cpp
r282 r285 76 76 UInt32 OcclusionCullingTreeBuilder::_funcEndQueryARB= Window::invalidFunctionID; 77 77 78 StatElemDesc<StatIntElem> OcclusionCullingTreeBuilder::statNOccNodes( 79 "OC-Nodes", 80 "total number of nodes tested for occlusion"); 81 78 82 StatElemDesc<StatIntElem> OcclusionCullingTreeBuilder::statNOccTests( 79 83 "OC-Tests", … … 82 86 "OC-Invisible", 83 87 "number of nodes found invisible through occlusion"); 88 89 StatElemDesc<StatRealElem> OcclusionCullingTreeBuilder::statNOccSuccessTestPer( 90 "OC-Sucess", 91 "percentage of successful tests for occlusion"); 84 92 85 93 // Some typedefs to clean up OpenGL extension handling … … 215 223 testNode(_pRoot, denv, part, screen_covered_percentage); 216 224 225 StatCollector *sc = _rt->getStatistics(); 226 sc->getElem(statNOccNodes )->add(uNumNodes); 217 227 uNumNodes=0; 218 228 _uiActiveMatrix = 0; … … 220 230 leaveTesting(denv, part); 221 231 232 //RESULTS / RE-DRAW 222 233 drawTestResults(_pRoot, denv, part); 223 //RESULTS / RE-DRAW224 234 225 235 //std::cout << "Calc Pixels" << std::endl; … … 227 237 228 238 229 StatCollector *sc = _rt->getStatistics(); 230 sc->getElem(statNOccTests )->set(_currSample); 231 sc->getElem(statNOccInvisible)->set(uNumNodes); 232 233 //std::cout << std::endl; 239 sc->getElem(statNOccTests )->add(_currSample); 240 sc->getElem(statNOccInvisible)->add(uNumNodes); 241 Real32 percentage = (Real32)sc->getElem(statNOccInvisible)->get() / (Real32)sc->getElem(statNOccTests)->get(); 242 sc->getElem(statNOccSuccessTestPer)->set(percentage); 243 244 234 245 //std::cout << "Real pixels " << std::endl; 235 246 //std::cout << " Next" << std::endl; 247 //std::cout << std::endl; 236 248 237 249 // screen_covered_percentage = 1.0; … … 324 336 { 325 337 //renderNode 326 drawNode(pNode, denv, part);338 //drawNode(pNode, denv, part); 327 339 } 328 340 else branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGOcclusionCullingTreeBuilder.h
r280 r285 188 188 static UInt32 _funcEndQueryARB; 189 189 190 static StatElemDesc<StatIntElem> statNOccNodes; 190 191 static StatElemDesc<StatIntElem> statNOccTests; 191 192 static StatElemDesc<StatIntElem> statNOccInvisible; 193 static StatElemDesc<StatRealElem> statNOccSuccessTestPer; 192 194 193 195 GLuint* _testSamples; … … 196 198 bool _inTesting; //!< Whether in testing mode or not 197 199 198 static const int _nBuckets = 1000; //!< number of buckets for approximate sorting200 static const int _nBuckets = 2000; //!< number of buckets for approximate sorting 199 201 std::vector<RenderTreeNode*> _buckets; //!< buckets for approximate sorting 200 202 branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGRenderPartition.cpp
r280 r285 447 447 if(_eMode == SimpleCallback) 448 448 return; 449 450 449 RenderTraversalAction *rt = dynamic_cast<RenderTraversalAction *>(_oDrawEnv.getRTAction()); 451 450 … … 532 531 Pnt3r min,max; 533 532 objVol.getBounds(min,max); 534 _currMatrix.second.mult(min); 535 _currMatrix.second.mult(max); 536 objPos = min; 537 if(min[2] < max[2]) 538 { 539 objPos[2] = max[2]; 533 Pnt3r p[8]; 534 p[0].setValues(min[0],min[1],min[2]); 535 p[1].setValues(max[0],min[1],min[2]); 536 p[2].setValues(min[0],max[1],min[2]); 537 p[3].setValues(min[0],min[1],max[2]); 538 p[4].setValues(max[0],max[1],min[2]); 539 p[5].setValues(max[0],min[1],max[2]); 540 p[6].setValues(min[0],max[1],max[2]); 541 p[7].setValues(max[0],max[1],max[2]); 542 for(UInt32 i = 0; i<8;i++) 543 { 544 _currMatrix.second.mult(p[i]); 545 } 546 objPos = p[0]; 547 for(UInt32 i = 1; i<8; i++) 548 { 549 if(p[0][2] < objPos[2]) 550 objPos[2] = p[0][2]; 540 551 } 541 552 … … 556 567 pNewElem->setStateOverride(_sStateOverrides.top()); 557 568 } 558 559 569 mapIt->second->add(_oDrawEnv, 560 570 this,
