Changeset 1302 for GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
- Timestamp:
- 08/30/06 21:54:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
r1297 r1302 23 23 24 24 25 25 26 namespace GtpVisibilityPreprocessor { 26 27 … … 32 33 33 34 VspTree *VspTree::VspSubdivisionCandidate::sVspTree = NULL; 34 35 int VspNode::sMailId = 1; 35 36 36 37 // variable for debugging volume contribution for heuristics 37 38 static float debugVol; 38 39 39 int VspNode::sMailId = 1;40 40 41 41 // pvs penalty can be different from pvs size … … 53 53 return (float)upper; 54 54 } 55 56 55 return (float)pvs; 57 56 } … … 299 298 300 299 301 VspLeaf::VspLeaf(): mViewCell(NULL), mPvs(NULL) 300 VspLeaf::VspLeaf(): mViewCell(NULL), mPvs(NULL), mSubdivisionCandidate(NULL) 302 301 { 303 302 } … … 554 553 // || mOutOfMemory 555 554 || (mVspStats.Leaves() >= mMaxViewCells) 556 || (mGlobalCostMisses >= mTermGlobalCostMissTolerance)555 //|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 557 556 ); 558 557 … … 630 629 VspSubdivisionCandidate *sc = 631 630 dynamic_cast<VspSubdivisionCandidate *>(splitCandidate); 631 632 632 VspTraversalData &tData = sc->mParentData; 633 634 633 VspNode *newNode = tData.mNode; 635 634 … … 735 734 736 735 // max cost threshold violated? 737 splitCandidate.mMaxCostMisses = 738 maxCostRatioViolated ? 736 splitCandidate.mMaxCostMisses = maxCostRatioViolated ? 739 737 splitCandidate.mParentData.mMaxCostMisses + 1: 740 738 splitCandidate.mParentData.mMaxCostMisses; … … 749 747 splitCandidate.SetRenderCostDecrease(renderCostDecr); 750 748 751 #if 0749 #if 1 752 750 const float priority = (float)-splitCandidate.mParentData.mDepth; 753 #else 754 751 #else 755 752 // take render cost of node into account 756 753 // otherwise danger of being stuck in a local minimum!! … … 785 782 786 783 //-- compute pvs 784 787 785 frontData.mPvs = EvalPvsSize(*frontData.mRays); 788 786 backData.mPvs = EvalPvsSize(*backData.mRays); … … 815 813 816 814 VspInterior *interior = new VspInterior(splitPlane); 817 818 #ifdef _DEBUG819 Debug << interior << endl;820 #endif+821 815 822 816 … … 1196 1190 float minSum = 1e20f; 1197 1191 1198 1199 1192 // if no good split can be found, take mid split 1200 1193 position = minBox + 0.5f * sizeBox; … … 1209 1202 1210 1203 //-- traverse through visibility events 1211 1212 1204 vector<SortableEntry>::const_iterator ci, ci_end = mLocalSubdivisionCandidates->end(); 1213 1205 … … 1373 1365 Intersectable::NewMail(3); 1374 1366 KdLeaf::NewMail(3); 1375 //for (int i=0;i<25;++i) BvhLeaf::NewMail();1376 1367 BvhLeaf::NewMail(3); 1377 1368 … … 1392 1383 // evaluate contribution of ray endpoint to front and back pvs 1393 1384 // with respect to the classification 1394 //Debug << "mail1: " << BvhLeaf::sMailId << endl;1395 1385 UpdateContributionsToPvs(*ray, true, cf, pvsFront, pvsBack, totalPvs); 1396 //Debug << "mail2: " << BvhLeaf::sMailId << endl;1397 1386 UpdateContributionsToPvs(*ray, false, cf, pvsFront, pvsBack, totalPvs); 1398 //Debug << "mail3: " << BvhLeaf::sMailId << endl; 1399 } 1400 1387 } 1401 1388 1402 1389 AxisAlignedBox3 frontBox; … … 1412 1399 1413 1400 //-- pvs rendering heuristics 1401 1414 1402 const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); 1415 1403 const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize(); 1416 1404 1417 //-- only render cost heuristics or combined with standard deviation 1418 1405 // only render cost heuristics or combined with standard deviation 1419 1406 const float penaltyOld = EvalPvsPenalty((int)totalPvs, lowerPvsLimit, upperPvsLimit); 1420 1407 const float penaltyFront = EvalPvsPenalty((int)pvsFront, lowerPvsLimit, upperPvsLimit); … … 1484 1471 1485 1472 #ifdef _DEBUG 1486 Debug << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl;1487 Debug << pFront << " " << pBack << " " << pOverall << endl;1473 Debug << "axis: " << axis << " " << pvsSize << " " << pvsBack << " " << pvsFront << endl; 1474 Debug << "p: " << pFront << " " << pBack << " " << pOverall << endl; 1488 1475 #endif 1489 1476 … … 2662 2649 VspSubdivisionCandidate *splitCandidate = new VspSubdivisionCandidate(vData); 2663 2650 EvalSubdivisionCandidate(*splitCandidate); 2651 leaf->SetSubdivisionCandidate(splitCandidate); 2664 2652 2665 2653 mTotalCost = (float)pvsSize; … … 2674 2662 vector<SubdivisionCandidate *> &dirtyList) const 2675 2663 { 2664 2676 2665 Intersectable *obj; 2677 2666 Vector3 pt; … … 2679 2668 2680 2669 ray.GetSampleData(isTermination, pt, &obj, &node); 2681 2670 2682 2671 if (!obj) return; 2683 2672 … … 2693 2682 dirtyList.push_back(leaf->mSubdivisionCandidate); 2694 2683 } 2695 2696 2684 break; 2697 2685 } 2698 2686 case HierarchyManager::BV_BASED_OBJ_SUBDIV: 2699 2687 { 2688 BvhLeaf *leaf = mHierarchyManager->mBvHierarchy->GetLeaf(obj); 2689 2690 if (!leaf->Mailed()) 2691 { 2692 leaf->Mail(); 2693 dirtyList.push_back(leaf->GetSubdivisionCandidate()); 2694 Debug << "here120 candidate: " << leaf->GetSubdivisionCandidate() << " type: " << leaf->GetSubdivisionCandidate()->Type() << endl; 2695 } 2696 break; 2700 2697 } 2701 2698 break; … … 2714 2711 KdLeaf::NewMail(); 2715 2712 BvhLeaf::NewMail(); 2716 2713 2717 2714 RayInfoContainer::const_iterator rit, rit_end = tData.mRays->end(); 2718 2715 … … 2721 2718 { 2722 2719 VssRay *ray = (*rit).mRay; 2723 2720 2724 2721 CollectDirtyCandidate(*ray, true, dirtyList); 2725 2722 CollectDirtyCandidate(*ray, false, dirtyList);
Note: See TracChangeset
for help on using the changeset viewer.