Changeset 1302 for GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
- Timestamp:
- 08/30/06 21:54:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1298 r1302 29 29 int BvhNode::sReservedMailboxes = 1; 30 30 31 32 31 BvHierarchy *BvHierarchy::BvhSubdivisionCandidate::sBvHierarchy = NULL; 33 34 32 35 33 … … 85 83 86 84 BvhLeaf::BvhLeaf(const AxisAlignedBox3 &bbox): 87 BvhNode(bbox) 85 BvhNode(bbox), mSubdivisionCandidate(NULL) 88 86 { 89 87 } … … 430 428 431 429 const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 432 const float oldRenderCost = 433 splitCandidate.mParentData.mProbability * (float)leaf->mObjects.size() / viewSpaceVol; 430 const float oldProp = EvalViewCellsVolume(leaf->mObjects); 431 const float oldProp2 = splitCandidate.mParentData.mProbability; //Debug << "here8 " << (oldProp - oldProp2) / viewSpaceVol << " " << oldProp / viewSpaceVol << " " << oldProp2 / viewSpaceVol << endl; 432 433 const float oldRenderCost = oldProp * (float)leaf->mObjects.size() / viewSpaceVol; 434 434 435 435 // compute global decrease in render cost 436 436 float newRenderCost = EvalRenderCost(splitCandidate.mParentData, 437 splitCandidate.mFrontObjects, 437 splitCandidate.mFrontObjects, 438 438 splitCandidate.mBackObjects); 439 439 … … 445 445 splitCandidate.SetRenderCostDecrease(renderCostDecr); 446 446 447 #if 0447 #if 1 448 448 const float priority = (float)-splitCandidate.mParentData.mDepth; 449 449 #else … … 452 452 const float factor = mRenderCostDecreaseWeight; 453 453 const float priority = factor * renderCostDecr + (1.0f - factor) * oldRenderCost; 454 455 454 #endif 456 455 … … 476 475 return (0 477 476 || (mBvhStats.Leaves() >= mTermMaxLeaves) 478 || (mGlobalCostMisses >= mTermGlobalCostMissTolerance)477 //|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 479 478 //|| mOutOfMemory 480 479 ); … … 574 573 } 575 574 576 const float oldRenderCost = tData.mProbability * (float)tData.mNode->mObjects.size(); 577 const float newRenderCost = 578 EvalRenderCost(tData, objectsFront, objectsBack); 575 const float oldProp = EvalViewCellsVolume(tData.mNode->mObjects); 576 //const float oldProp2 = tData.mProbability; Debug << "here65 " << oldProp - oldProp2 << endl; 577 578 const float oldRenderCost = oldProp * (float)tData.mNode->mObjects.size(); 579 const float newRenderCost = EvalRenderCost(tData, objectsFront, objectsBack); 579 580 580 581 const float ratio = newRenderCost / oldRenderCost; … … 960 961 961 962 //-- pvs rendering heuristics 962 const float newRenderCost = nObjectsFront * pFront + 963 nObjectsBack * pBack; 964 963 const float newRenderCost = nObjectsFront * pFront + nObjectsBack * pBack; 964 /* 965 965 const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 966 /*Debug << "\nbvh render cost\n"966 Debug << "\nbvh render cost\n" 967 967 << "back p: " << pBack / viewSpaceVol << " front p " << pFront / viewSpaceVol << endl 968 968 << "new rc: " << newRenderCost / viewSpaceVol << endl;*/ 969 970 969 971 970 return newRenderCost; … … 1100 1099 1101 1100 Debug << "collecting " << (int)viewCells.size() << " dirty candidates" << endl; 1101 1102 1102 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 1103 1103 { … … 1105 1105 VspLeaf *leaf = vc->mLeaf; 1106 1106 SubdivisionCandidate *candidate = leaf->GetSubdivisionCandidate(); 1107 Debug << "here100 candidate: " << candidate << " type: " << candidate->Type() << endl; 1107 1108 1108 1109 dirtyList.push_back(leaf->GetSubdivisionCandidate()); … … 1301 1302 1302 1303 // compute bounding box from objects 1303 // we assume that root was already created1304 // note: we assume that root was already created 1304 1305 mBoundingBox = mRoot->GetBoundingBox(); 1305 1306 BvhLeaf *bvhleaf = dynamic_cast<BvhLeaf *>(mRoot); … … 1311 1312 AssociateObjectsWithRays(sampleRays); 1312 1313 1313 1314 1314 // probabilty is voume of all "seen" view cells 1315 1315 #if 1 … … 1326 1326 new BvhSubdivisionCandidate(oData); 1327 1327 1328 //UpdateViewCellsPvs(kdleaf, rays);1329 1330 1328 EvalSubdivisionCandidate(*oSubdivisionCandidate); 1329 bvhleaf->SetSubdivisionCandidate(oSubdivisionCandidate); 1331 1330 1332 1331 const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume();
Note: See TracChangeset
for help on using the changeset viewer.