Changeset 2224 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 03/09/07 18:30:24 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r2210 r2224 393 393 mNodeTimer.Entry(); 394 394 395 /*396 #if STORE_VIEWCELLS_WITH_BVH397 AssociateViewCellsWithObjects(sc.mSampledFrontObjects);398 AssociateViewCellsWithObjects(sc.mSampledBackObjects);399 #endif400 */401 395 const BvhTraversalData &tData = sc.mParentData; 402 396 BvhLeaf *leaf = tData.mNode; … … 500 494 AssignSortedObjects(sc, frontData, backData); 501 495 } 502 /* 503 #if STORE_VIEWCELLS_WITH_BVH 504 ReleaseViewCells(sc.mSampledFrontObjects); 505 ReleaseViewCells(sc.mSampledBackObjects); 506 #endif 507 */ 496 508 497 mNodeTimer.Exit(); 509 498 … … 515 504 BvhNode *BvHierarchy::Subdivide(SplitQueue &tQueue, 516 505 SubdivisionCandidate *splitCandidate, 517 const bool globalCriteriaMet) 506 const bool globalCriteriaMet 507 ,vector<SubdivisionCandidate *> &dirtyList 508 ) 518 509 { 519 510 mSubdivTimer.Entry(); … … 552 543 new BvhSubdivisionCandidate(tBackData); 553 544 554 EvalSubdivisionCandidate(*frontCandidate); 555 EvalSubdivisionCandidate(*backCandidate); 556 545 // preprocess view cells 546 AssociateViewCellsWithObjects(*tData.mSampledObjects); 547 548 EvalSubdivisionCandidate(*frontCandidate, true, false); 549 EvalSubdivisionCandidate(*backCandidate, true, false); 550 551 CollectDirtyCandidates(sc, dirtyList, true); 552 ReleaseViewCells(*tData.mSampledObjects); 553 557 554 // cross reference 558 555 tFrontData.mNode->SetSubdivisionCandidate(frontCandidate); … … 638 635 639 636 void BvHierarchy::EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitCandidate, 640 bool computeSplitPlane) 637 const bool computeSplitPlane, 638 const bool preprocessViewCells) 641 639 { 642 640 mPlaneTimer.Entry(); 643 641 644 642 #if STORE_VIEWCELLS_WITH_BVH 645 // fill view cells cache646 AssociateViewCellsWithObjects(*splitCandidate.mParentData.mSampledObjects);643 if (preprocessViewCells) // fill view cells cache 644 AssociateViewCellsWithObjects(*splitCandidate.mParentData.mSampledObjects); 647 645 #endif 648 646 … … 656 654 const bool sufficientSamples = 657 655 splitCandidate.mParentData.mNumRays > mMinRaysForVisibility; 656 657 //if (!sufficientSamples) cout << splitCandidate.mParentData.mNumRays << " "; 658 658 659 659 const bool useVisibiliyBasedHeuristics = … … 757 757 758 758 #if STORE_VIEWCELLS_WITH_BVH 759 ReleaseViewCells(*splitCandidate.mParentData.mSampledObjects); 759 if (preprocessViewCells) 760 ReleaseViewCells(*splitCandidate.mParentData.mSampledObjects); 760 761 #endif 761 762 … … 1672 1673 VssRay::NewMail(); 1673 1674 1674 if ((mMaxTests < tData.mNumRays) &&mUseCostHeuristics && useVisibilityBasedHeuristics)1675 /*if ((mMaxTests < tData.mNumRays) && mUseCostHeuristics && useVisibilityBasedHeuristics) 1675 1676 { 1676 1677 VssRayContainer rays; … … 1692 1693 } 1693 1694 } 1694 } 1695 }*/ 1695 1696 1696 1697 //////////////////////////////////// … … 1733 1734 } 1734 1735 1735 // no good results for degenerate axis split1736 // avoid splits in degenerate axis with high penalty 1736 1737 if (1 && 1737 1738 (tData.mNode->GetBoundingBox().Size(axis) < 0.0001))//Limits::Small)) … … 2405 2406 /////////////////////////////////////// 2406 2407 // start from root of tree 2407 /* 2408 2408 2409 if (node == NULL) 2409 2410 node = mRoot; … … 2449 2450 2450 2451 return leaf; 2451 */2452 2452 } 2453 2453 #endif … … 2632 2632 2633 2633 // evaluate priority 2634 EvalSubdivisionCandidate(*oSubdivisionCandidate );2634 EvalSubdivisionCandidate(*oSubdivisionCandidate, true, true); 2635 2635 PrintSubdivisionStats(*oSubdivisionCandidate); 2636 2636 … … 2646 2646 2647 2647 // reevaluate priority 2648 EvalSubdivisionCandidate(*sCandidate );2648 EvalSubdivisionCandidate(*sCandidate, true, true); 2649 2649 tQueue.Push(sCandidate); 2650 2650 } … … 2655 2655 { 2656 2656 // evaluate priority 2657 EvalSubdivisionCandidate(*oSubdivisionCandidate );2657 EvalSubdivisionCandidate(*oSubdivisionCandidate, true, true); 2658 2658 PrintSubdivisionStats(*oSubdivisionCandidate); 2659 2659 … … 2794 2794 new BvhSubdivisionCandidate(oData); 2795 2795 2796 EvalSubdivisionCandidate(*oSubdivisionCandidate );2796 EvalSubdivisionCandidate(*oSubdivisionCandidate, true, true); 2797 2797 bvhLeaf->SetSubdivisionCandidate(oSubdivisionCandidate); 2798 2798 … … 2929 2929 2930 2930 // evaluate the changes in render cost and pvs entries 2931 EvalSubdivisionCandidate(*sc, false );2931 EvalSubdivisionCandidate(*sc, false, true); 2932 2932 2933 2933 // create new interior node and two leaf node … … 3062 3062 const bool globalCriteriaMet = GlobalTerminationCriteriaMet(bsc->mParentData); 3063 3063 3064 BvhNode *node = Subdivide(tempQueue, bsc, globalCriteriaMet); 3064 SubdivisionCandidateContainer dirtyList; 3065 BvhNode *node = Subdivide(tempQueue, bsc, globalCriteriaMet, dirtyList); 3065 3066 3066 3067 // not needed anymore -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r2210 r2224 471 471 { 472 472 mDirty = false; 473 sBvHierarchy->EvalSubdivisionCandidate(*this, computeSplitplane );473 sBvHierarchy->EvalSubdivisionCandidate(*this, computeSplitplane, true); 474 474 } 475 475 476 bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet )476 bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet, SubdivisionCandidateContainer &dirtyList) 477 477 { 478 BvhNode *n = sBvHierarchy->Subdivide(splitQueue, this, terminationCriteriaMet );478 BvhNode *n = sBvHierarchy->Subdivide(splitQueue, this, terminationCriteriaMet, dirtyList); 479 479 480 480 // local or global termination criteria failed … … 575 575 /** Evaluates candidate for splitting. 576 576 */ 577 void EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitData, 578 bool computeSplitPlane = true); 577 void EvalSubdivisionCandidate(BvhSubdivisionCandidate &splitData, 578 const bool computeSplitPlane, 579 const bool preprocessViewCells); 579 580 580 581 /** Returns vector of leaves. … … 754 755 BvhNode *Subdivide(SplitQueue &tQueue, 755 756 SubdivisionCandidate *splitCandidate, 756 const bool globalCriteriaMet); 757 const bool globalCriteriaMet 758 ,vector<SubdivisionCandidate *> &dirtyList 759 ); 757 760 758 761 /** Subdivides leaf. -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r2210 r2224 837 837 return childPvs; 838 838 } 839 839 840 // assume pvs not sampled sufficiently => take total pvs 840 841 if (avgRayContri >= mMaxAvgRayContri) … … 852 853 const float newPvs = alpha * childPvs + (1.0f - alpha) * totalPvs; 853 854 #endif 854 855 cout<<"a"; 855 856 //cout << "alpha " << alpha << " beta: " << beta << " child: " << childPvs << " parent: " << totalPvs << endl; 856 857 … … 863 864 bool HierarchyManager::ApplySubdivisionCandidate(SubdivisionCandidate *sc, 864 865 SplitQueue &splitQueue, 865 const bool repairQueue) 866 //const bool repairQueue, 867 SubdivisionCandidateContainer &dirtyList) 866 868 { 867 869 const bool terminationCriteriaMet = GlobalTerminationCriteriaMet(sc); 868 const bool success = sc->Apply(splitQueue, terminationCriteriaMet );870 const bool success = sc->Apply(splitQueue, terminationCriteriaMet, dirtyList); 869 871 870 872 if (sc->IsDirty()) … … 934 936 // output stats 935 937 EvalSubdivisionStats(); 936 937 if (repairQueue)938 {939 // reevaluate candidates affected by the split for view space splits,940 // this would be object space splits and other way round941 vector<SubdivisionCandidate *> dirtyList;942 sc->CollectDirtyCandidates(dirtyList, false);943 944 RepairQueue(dirtyList, splitQueue, mRecomputeSplitPlaneOnRepair);945 }946 938 947 939 return true; … … 1046 1038 AxisAlignedBox3 *forcedViewSpace) 1047 1039 { 1040 SubdivisionCandidate::NewMail(); 1041 1048 1042 while (!FinishedConstruction()) 1049 1043 { … … 1053 1047 //-- subdivide leaf node 1054 1048 1055 ApplySubdivisionCandidate(sc, mTQueue, repairQueue); 1049 SubdivisionCandidateContainer dirtyList; 1050 1051 ApplySubdivisionCandidate(sc, mTQueue, dirtyList); 1056 1052 1053 if (repairQueue) 1054 { 1055 // reevaluate candidates affected by the split for view space splits, 1056 // this would be object space splits and other way round 1057 RepairQueue(dirtyList, mTQueue, mRecomputeSplitPlaneOnRepair); 1058 } 1059 1057 1060 // we use objects for evaluating vsp tree construction until 1058 1061 // a certain depth once a certain depth existiert ... … … 1103 1106 //-- subdivide leaf node of either type 1104 1107 1105 ApplySubdivisionCandidate(sc, mTQueue, repairQueue); 1108 SubdivisionCandidateContainer dirtyList; 1109 ApplySubdivisionCandidate(sc, mTQueue, dirtyList); 1106 1110 1111 if (repairQueue) 1112 { 1113 RepairQueue(dirtyList, mTQueue, mRecomputeSplitPlaneOnRepair); 1114 } 1115 1107 1116 DEL_PTR(sc); 1108 1117 } … … 1140 1149 SubdivisionCandidate *sc = NextSubdivisionCandidate(splitQueue); 1141 1150 1142 const bool repairQueue = false; 1143 const bool success = ApplySubdivisionCandidate(sc, splitQueue, repairQueue); 1151 const bool success = ApplySubdivisionCandidate(sc, splitQueue, dirtyCandidates); 1144 1152 1145 1153 if (success) 1146 1154 { 1147 sc->CollectDirtyCandidates(dirtyCandidates, true);1155 //sc->CollectDirtyCandidates(dirtyCandidates, true); 1148 1156 ++ steps; 1149 1157 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r2187 r2224 377 377 bool ApplySubdivisionCandidate(SubdivisionCandidate *sc, 378 378 SplitQueue &splitQueue, 379 const bool repairQueue); 379 //const bool repairQueue, 380 std::vector<SubdivisionCandidate *> &dirtyList 381 ); 380 382 381 383 /** Tests if hierarchy construction is finished. -
GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.h
r2176 r2224 264 264 } 265 265 266 bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet )266 bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet, SubdivisionCandidateContainer &dirtyList) 267 267 { 268 268 KdNode *n = sOspTree->Subdivide(splitQueue ,this, terminationCriteriaMet); -
GTP/trunk/Lib/Vis/Preprocessing/src/SubdivisionCandidate.h
r2176 r2224 40 40 /** Evaluate this candidate and put results into queue for further traversal. 41 41 */ 42 virtual bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet ) = 0;42 virtual bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet, SubdivisionCandidateContainer &dirtyList) = 0; 43 43 44 44 /** Returns true of the global termination criteria of this split were met, -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2206 r2224 118 118 119 119 mStats << 120 "#Pass\n" << pass ++ << endl << 121 "#Time\n" << time << endl << 122 "#TotalSamples\n" << totalRays << endl; 123 124 float last = 0.0f; 125 126 for (int k=0; k < 6; ++ k) 127 { 128 float ratio = 0.0f; 129 130 if (k < (int)mMixtureDistribution->mDistributions.size()) 131 { 132 ratio = mMixtureDistribution->mDistributions[k]->mRatio - last; 133 last = mMixtureDistribution->mDistributions[k]->mRatio; 134 } 135 136 mStats << "#Distribution"<<k<<endl<< ratio<<endl; 137 } 120 "#Pass\n" << pass ++ <<endl<< 121 "#Time\n" << time <<endl<< 122 "#TotalSamples\n" <<totalRays<<endl; 138 123 139 124 … … 187 172 else 188 173 { 189 /*mStrategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION);190 mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION);174 mStrategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 175 //mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 191 176 mStrategies.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 192 */ 193 177 194 178 mStrategies.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION); 195 179 } … … 2379 2363 void ViewCellsManager::UpdatePvs() 2380 2364 { 2381 2382 return;2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 { 2393 2365 if (mViewCellPvsIsUpdated || !ViewCellsTreeConstructed()) 2366 return; 2367 2368 mViewCellPvsIsUpdated = true; 2369 2370 ViewCellContainer leaves; 2371 mViewCellsTree->CollectLeaves(mViewCellsTree->GetRoot(), leaves); 2372 2373 ViewCellContainer::const_iterator it, it_end = leaves.end(); 2374 2375 for (it = leaves.begin(); it != it_end; ++ it) 2376 { 2377 mViewCellsTree->PropagatePvs(*it); 2394 2378 } 2395 2379 } … … 2399 2383 { 2400 2384 // update pvs of view cells tree if necessary 2401 UpdatePvs();2385 if (0) UpdatePvs(); 2402 2386 2403 2387 ViewCellContainer::const_iterator it = mViewCells.begin(); … … 2416 2400 stat.devRelPvsIncrease = 0.0f; 2417 2401 stat.renderCost = 0.0f; 2402 stat.mem = 0.0f; 2418 2403 2419 2404 if (mPerViewCellStat.size() != mViewCells.size()) { … … 2431 2416 const float vol = mViewSpaceBox.GetVolume(); 2432 2417 2433 for (i =0; it != mViewCells.end(); ++ it, i++)2434 2418 for (i = 0; it != mViewCells.end(); ++ it, ++ i) 2419 { 2435 2420 ViewCell *viewcell = *it; 2436 2421 if (viewcell->GetValid()) { 2437 const float pvsCost = mViewCellsTree->GetPvsCost(viewcell); 2438 const float renderCost = pvsCost * viewcell->GetVolume() / vol; 2439 2440 if (pvsCost < stat.minPvs) 2441 stat.minPvs = pvsCost; 2442 if (pvsCost > stat.maxPvs) 2443 stat.maxPvs = pvsCost; 2444 2445 stat.avgPvs += pvsCost; 2446 stat.renderCost += renderCost; 2447 2448 const float pvsEntries = (float)mViewCellsTree->GetPvsEntries(viewcell); 2449 stat.avgPvsEntries += pvsEntries; 2450 2451 if (mPerViewCellStat[i].pvsSize > 0.0f) 2452 mPerViewCellStat[i].relPvsIncrease = (pvsCost - mPerViewCellStat[i].pvsSize)/mPerViewCellStat[i].pvsSize; 2453 2454 stat.avgRelPvsIncrease += mPerViewCellStat[i].relPvsIncrease; 2455 2456 // update the pvs size 2457 mPerViewCellStat[i].pvsSize = pvsCost; 2458 2459 2460 2461 if (evaluateFilter) { 2462 ObjectPvs filteredPvs; 2463 2464 PvsFilterStatistics fstat = ApplyFilter2(viewcell, 2465 false, 2466 mFilterWidth, 2467 filteredPvs); 2468 2469 float filteredCost = filteredPvs.EvalPvsCost(); 2470 2471 stat.avgFilteredPvs += filteredCost; 2472 stat.avgFilteredPvsEntries += filteredPvs.GetSize(); 2473 2474 stat.avgFilterContribution += filteredCost - pvsCost; 2475 2476 stat.avgFilterRadius += fstat.mAvgFilterRadius; 2477 int sum = fstat.mGlobalFilterCount + fstat.mLocalFilterCount; 2478 if (sum) { 2479 stat.avgFilterRatio += fstat.mLocalFilterCount / 2480 (float) sum; 2422 const float pvsCost = mViewCellsTree->GetPvsCost(viewcell); 2423 const float renderCost = pvsCost * viewcell->GetVolume() / vol; 2424 2425 if (pvsCost < stat.minPvs) 2426 stat.minPvs = pvsCost; 2427 if (pvsCost > stat.maxPvs) 2428 stat.maxPvs = pvsCost; 2429 2430 stat.avgPvs += pvsCost; 2431 stat.renderCost += renderCost; 2432 2433 const float pvsEntries = (float)mViewCellsTree->GetPvsEntries(viewcell); 2434 stat.avgPvsEntries += pvsEntries; 2435 2436 if (mPerViewCellStat[i].pvsSize > 0.0f) 2437 mPerViewCellStat[i].relPvsIncrease = (pvsCost - mPerViewCellStat[i].pvsSize) / mPerViewCellStat[i].pvsSize; 2438 2439 stat.avgRelPvsIncrease += mPerViewCellStat[i].relPvsIncrease; 2440 2441 // update the pvs size 2442 mPerViewCellStat[i].pvsSize = pvsCost; 2443 2444 2445 2446 if (evaluateFilter) { 2447 ObjectPvs filteredPvs; 2448 2449 PvsFilterStatistics fstat = ApplyFilter2(viewcell, 2450 false, 2451 mFilterWidth, 2452 filteredPvs); 2453 2454 float filteredCost = filteredPvs.EvalPvsCost(); 2455 2456 stat.avgFilteredPvs += filteredCost; 2457 stat.avgFilteredPvsEntries += filteredPvs.GetSize(); 2458 2459 stat.avgFilterContribution += filteredCost - pvsCost; 2460 2461 stat.avgFilterRadius += fstat.mAvgFilterRadius; 2462 int sum = fstat.mGlobalFilterCount + fstat.mLocalFilterCount; 2463 if (sum) { 2464 stat.avgFilterRatio += fstat.mLocalFilterCount / 2465 (float) sum; 2466 } 2467 2468 } else { 2469 stat.avgFilteredPvs += pvsCost; 2470 stat.avgFilterContribution += 0; 2481 2471 } 2482 2483 } else { 2484 stat.avgFilteredPvs += pvsCost; 2485 stat.avgFilterContribution += 0; 2486 } 2487 2488 ++ stat.viewcells; 2472 2473 ++ stat.viewcells; 2489 2474 } 2490 2491 2492 2493 2475 } 2476 2477 2478 2494 2479 if (stat.viewcells) { 2495 stat.avgPvs/=stat.viewcells; 2496 stat.avgPvsEntries/=stat.viewcells; 2497 stat.avgFilteredPvsEntries/=stat.viewcells; 2498 stat.avgFilteredPvs/=stat.viewcells; 2499 stat.avgFilterContribution/=stat.viewcells; 2500 stat.avgFilterRadius/=stat.viewcells; 2501 stat.avgFilterRatio/=stat.viewcells; 2502 stat.avgRelPvsIncrease/=stat.viewcells; 2503 2504 // evaluate std deviation of relPvsIncrease 2505 float sum=0.0f; 2506 for (i=0; i < stat.viewcells; i++) { 2507 sum += sqr(mPerViewCellStat[i].relPvsIncrease - stat.avgRelPvsIncrease); 2508 } 2509 stat.devRelPvsIncrease = sqrt(sum/stat.viewcells); 2480 stat.mem = (float)(ObjectPvs::GetEntrySizeByte() * stat.avgPvsEntries + stat.viewcells * 16) / float(1024 * 1024); 2481 2482 stat.avgPvs/=stat.viewcells; 2483 stat.avgPvsEntries/=stat.viewcells; 2484 stat.avgFilteredPvsEntries/=stat.viewcells; 2485 stat.avgFilteredPvs/=stat.viewcells; 2486 stat.avgFilterContribution/=stat.viewcells; 2487 stat.avgFilterRadius/=stat.viewcells; 2488 stat.avgFilterRatio/=stat.viewcells; 2489 stat.avgRelPvsIncrease/=stat.viewcells; 2490 2491 // evaluate std deviation of relPvsIncrease 2492 float sum=0.0f; 2493 for (i=0; i < stat.viewcells; i++) { 2494 sum += sqr(mPerViewCellStat[i].relPvsIncrease - stat.avgRelPvsIncrease); 2495 } 2496 stat.devRelPvsIncrease = sqrt(sum/stat.viewcells); 2510 2497 } 2511 2498 2512 2499 } 2513 2500 … … 2520 2507 s<<"#AVG_PVS\n"<<pvsStat.avgPvs<<endl; 2521 2508 s<<"#AVG_ENTRIES_PVS\n"<<pvsStat.avgPvsEntries<<endl; 2509 s<<"#RENDERCOST\n"<<pvsStat.renderCost<<endl; 2522 2510 s<<"#AVG_FILTERED_PVS\n"<<pvsStat.avgFilteredPvs<<endl; 2523 2511 s<<"#AVG_FILTERED_ENTRIES_PVS\n"<<pvsStat.avgFilteredPvsEntries<<endl; … … 2529 2517 s<<"#AVG_REL_PVS_INCREASE\n"<<pvsStat.avgRelPvsIncrease<<endl; 2530 2518 s<<"#DEV_REL_PVS_INCREASE\n"<<pvsStat.devRelPvsIncrease<<endl; 2519 s<<"#MEMROY\n"<<pvsStat.mem<<endl; 2531 2520 2532 2521 s<<"#CONTRIBUTING_RAYS\n"<<mSamplesStat.mContributingRays<<endl; … … 6863 6852 cout << "Evaluating view cell partition ... " << endl; 6864 6853 6865 vector<int> evalStrats;6866 6867 // mix of sampling strategies6868 if (0)6869 {6870 evalStrats.push_back(SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION);6871 }6872 else6873 {6874 /*evalStrats.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION);6875 evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION);6876 evalStrats.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION);6877 */6878 evalStrats.push_back(SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION);6879 }6880 6881 Debug << "casting eval strategies: ";6882 for (int i = 0; i < (int)evalStrats.size(); ++ i)6883 Debug << evalStrats[i] << " ";6884 Debug << endl;6885 6886 cout << "casting eval strategies: ";6887 for (int i = 0; i < (int)evalStrats.size(); ++ i)6888 cout << evalStrats[i] << " ";6889 cout << endl;6890 6891 6854 int pass = 0; 6892 6855 … … 6905 6868 Debug << "casting " << samplesPerPass << " samples ... "; 6906 6869 6907 if (0) 6908 { 6909 CastPassSamples(samplesPerPass, evalStrats, evaluationSamples); 6910 6911 timeDiff = TimeDiff(startTime, GetTime()); 6912 cout << "finished in " << timeDiff * 1e-3f << " secs" << endl; 6913 Debug << "finished in " << timeDiff * 1e-3f << " secs" << endl; 6870 // use mixed distributions 6871 CastEvaluationSamples(samplesPerPass, evaluationSamples); 6872 6873 timeDiff = TimeDiff(startTime, GetTime()); 6874 cout << "finished in " << timeDiff * 1e-3f << " secs" << endl; 6875 Debug << "finished in " << timeDiff * 1e-3f << " secs" << endl; 6914 6876 6915 cout << "computing sample contributions of " << (int)evaluationSamples.size() << " samples ... "; 6916 Debug << "computing sample contributions of " << (int)evaluationSamples.size() << " samples ... "; 6917 6918 startTime = GetTime(); 6919 6920 ComputeSampleContributions(evaluationSamples, true, false); 6921 6922 timeDiff = TimeDiff(startTime, GetTime()); 6923 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 6924 Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl; 6925 } 6926 else 6927 { 6928 // use mixed distributions 6929 CastEvaluationSamples(samplesPerPass, evaluationSamples); 6930 6931 timeDiff = TimeDiff(startTime, GetTime()); 6932 cout << "finished in " << timeDiff * 1e-3f << " secs" << endl; 6933 Debug << "finished in " << timeDiff * 1e-3f << " secs" << endl; 6877 // don't use sample contributions because already accounted for inside the mixture distribution! 6934 6878 6935 // don't use sample contributions because already accounted for inside the mixture distribution!6936 }6937 6938 6879 castSamples += samplesPerPass; 6939 6880 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r2205 r2224 125 125 float devRelPvsIncrease; 126 126 int viewcells; 127 128 float mem; 127 129 }; 128 130 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h
r2210 r2224 516 516 } 517 517 518 bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet )518 bool Apply(SplitQueue &splitQueue, bool terminationCriteriaMet, SubdivisionCandidateContainer &dirtyList) 519 519 { 520 520 VspNode *n = sVspTree->Subdivide(splitQueue, this, terminationCriteriaMet); 521 521 522 522 // local or global termination criteria failed 523 return !n->IsLeaf(); 523 const bool success = !n->IsLeaf(); 524 525 if (success) 526 CollectDirtyCandidates(dirtyList, true); 527 528 return success; 524 529 } 525 530 … … 556 561 float mCorrectedFrontRenderCost; 557 562 float mCorrectedBackRenderCost; 558 //float mCorrectedFrontVolume; 559 //float mCorrectedBackVolume; 560 563 561 564 float mFrontRenderCost; 562 565 float mBackRenderCost; … … 907 910 /** Evaluates contribution of min event to pvs 908 911 */ 909 inline int EvalMinEventContribution( 910 const VssRay &ray, const bool isTermination) const; 912 inline int EvalMinEventContribution(const VssRay &ray, const bool isTermination) const; 911 913 912 914 /** Evaluates contribution of max event to pvs … … 955 957 RayInfoContainer &backRays) const; 956 958 957 void UpdatePvsEntriesContribution(959 inline void UpdatePvsEntriesContribution( 958 960 const VssRay &ray, 959 961 const bool isTermination, … … 973 975 974 976 */ 975 void UpdateContributionsToPvs(977 inline void UpdateContributionsToPvs( 976 978 const VssRay &ray, 977 979 const bool isTermination, … … 983 985 /** Evaluates the contribution for objects. 984 986 */ 985 void UpdateContributionsToPvs(987 inline void UpdateContributionsToPvs( 986 988 Intersectable *obj, 987 989 const int cf, … … 992 994 /** Evaluates the contribution for bounding volume leaves. 993 995 */ 994 void UpdateContributionsToPvs(996 inline void UpdateContributionsToPvs( 995 997 BvhLeaf *leaf, 996 998 const int cf, 997 999 float &frontPvs, 998 1000 float &backPvs, 999 float &totalPvs m,1001 float &totalPvs, 1000 1002 const bool countEntries) const; 1001 1003 1002 1004 /** Evaluates the contribution for kd leaves. 1003 1005 */ 1004 void UpdateContributionsToPvs(1006 inline void UpdateContributionsToPvs( 1005 1007 KdLeaf *leaf, 1006 1008 const int cf, … … 1011 1013 /** Returns true if tree can be terminated. 1012 1014 */ 1013 bool LocalTerminationCriteriaMet(const VspTraversalData &data) const;1015 inline bool LocalTerminationCriteriaMet(const VspTraversalData &data) const; 1014 1016 1015 1017 /** Returns true if global tree can be terminated. 1016 1018 */ 1017 bool GlobalTerminationCriteriaMet(const VspTraversalData &data) const;1019 inline bool GlobalTerminationCriteriaMet(const VspTraversalData &data) const; 1018 1020 1019 1021 /** Adds ray sample contributions to the PVS.
Note: See TracChangeset
for help on using the changeset viewer.