Changeset 371 for branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGOcclusionCullingTreeBuilder.cpp
- Timestamp:
- 10/31/06 15:07:34 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGOcclusionCullingTreeBuilder.cpp
r363 r371 259 259 if(_rt->getOcclusionCullingQueryBufferSize() != _numTestSamples || !_isOccSetup) 260 260 { 261 #if 0262 if( _testSamples )263 {264 std::cout << "deleting" << std::endl;265 delete [] _testSamples;266 // Should probably delete queries too....267 }268 #endif269 261 _numTestSamples = _rt->getOcclusionCullingQueryBufferSize(); 270 262 //std::cout << "Buf size: " << _numTestSamples << std::endl; … … 317 309 _visPixelThreshold = _rt->getOcclusionCullingVisibilityThreshold(); 318 310 _coveredProbThreshold = _rt->getOcclusionCullingCoveredThreshold(); 311 _minTriangleCount = _rt->getOcclusionCullingMinimumTriangleCount(); 319 312 _inTesting = false; 320 313 … … 421 414 min[0] = osgClamp(-1.f, min[0], 1.f); 422 415 min[1] = osgClamp(-1.f, min[1], 1.f); 423 //std::cout << min << std::endl;424 //std::cout << max << std::endl;425 //v.transform(worldToCam);426 427 //Real32 pix = (max[0] - min[0]) * (max[1] - min[1]) * ((pix_width/2.0f)*(pix_height/2.0f));428 //Real32 cbb = pix / (pix_width * pix_height);429 416 430 417 // cbb is the percent of the screen real estate this would cover … … 435 422 436 423 //Make decision 437 438 424 439 425 if(pNode->hasFunctor() == false) //Nothing to do … … 461 447 if(pcov > _coveredProbThreshold || cbb < 0.001) // If within threshold or reall small 462 448 { 449 //Get triangles 450 GeoStatsAttachmentPtr st = 451 GeoStatsAttachment::get(pNode->getNode()); 452 st->validate(); 453 UInt32 triangles = st->getTriangles(); 454 463 455 if(cbb * _vpWidth * _vpHeight < _minFeatureSize) //small feature culling 464 456 { 465 457 StatCollector *sc = _rt->getStatistics(); 466 GeoStatsAttachmentPtr st =467 GeoStatsAttachment::get(pNode->getNode());468 st->validate();469 458 _rt->getStatistics()->getElem(statNOccTriangles)-> 470 add( st->getTriangles());459 add(triangles); 471 460 if(_rt->getOcclusionCullingDebug() && pNode->getNode()) 472 461 { … … 478 467 pNode->setIsRendered(true); 479 468 } 480 else if(_testPendingNodes.size() == _numTestSamples - 1) // Make sure we have room to draw a test 469 else if( triangles <= _minTriangleCount ) 470 { 471 drawNode(pNode, denv, part); 472 } 473 else if((_testPendingNodes.size() == _numTestSamples - 1)) // Make sure we have room to draw a test 481 474 { 482 475 drawTestResults(denv, part);
