Changeset 1686 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 10/27/06 03:05:49 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1680 r1686 61 61 mViewCellsFinished(false), 62 62 mMaxPvsSize(9999999), 63 mMinPvsSize(0), // one means only empty view cells are invalid63 mMinPvsSize(0), 64 64 mMaxPvsRatio(1.0), 65 65 mViewCellPvsIsUpdated(false), … … 907 907 908 908 while (castSamples < numSamples) 909 { 909 { 910 /////////////// 911 //-- we have to use uniform sampling strategy for construction rays 912 910 913 VssRayContainer evaluationSamples; 911 912 914 const int samplingType = mEvaluationSamplingType; 913 /* dirSamples ? 914 Preprocessor::DIRECTION_BASED_DISTRIBUTION : 915 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION; 916 */ 915 917 916 long startTime = GetTime(); 918 919 //-- construction rays => we use uniform samples for this920 917 921 918 cout << "casting " << samplesPerPass << " samples ... "; … … 943 940 startTime = GetTime(); 944 941 cout << "compute new statistics ... " << endl; 945 942 943 /////////// 944 //-- output stats 945 946 sprintf(str, "-%09d-eval.log", castSamples); 947 string fileName = string(statsPrefix) + string(str); 948 946 949 /////////////// 947 950 //-- propagate pvs or pvs size information … … 949 952 ObjectPvs pvs; 950 953 UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 951 952 ///////////953 //-- output stats954 sprintf(str, "-%09d-eval.log", castSamples);955 string fileName = string(statsPrefix) + string(str);956 954 957 955 ExportStats(fileName); … … 5535 5533 } 5536 5534 5535 //////////////// 5537 5536 //-- for directional sampling it is important to count only contributions 5538 5537 //-- made in one direction! … … 5618 5617 } 5619 5618 5620 5619 #if 1 5621 5620 #if TEST_EVALUATION 5622 5621 void VspOspViewCellsManager::EvalViewCellPartition() … … 5699 5698 } 5700 5699 5700 #else 5701 5702 void VspOspViewCellsManager::EvalViewCellPartition() 5703 { 5704 int samplesPerPass; 5705 int numSamples; 5706 int castSamples = 0; 5707 char str[64]; 5708 5709 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 5710 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samples", numSamples); 5711 5712 char statsPrefix[100]; 5713 Environment::GetSingleton()->GetStringValue("ViewCells.Evaluation.statsPrefix", statsPrefix); 5714 5715 Debug << "view cell evaluation samples per pass: " << samplesPerPass << endl; 5716 Debug << "view cell evaluation samples: " << numSamples << endl; 5717 Debug << "view cell stats prefix: " << statsPrefix << endl; 5718 5719 // should directional sampling be used? 5720 bool dirSamples = 5721 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 5722 5723 cout << "reseting pvs ... "; 5724 5725 const bool startFromZero = true; 5726 5727 // reset pvs and start over from zero 5728 if (startFromZero) 5729 { 5730 mViewCellsTree->ResetPvs(); 5731 } 5732 else // start from current sampless 5733 { 5734 // statistics before casting more samples 5735 cout << "compute new statistics ... "; 5736 sprintf(str, "-%09d-eval.log", castSamples); 5737 string fName = string(statsPrefix) + string(str); 5738 5739 mViewCellsTree->ExportStats(fName); 5740 cout << "finished" << endl; 5741 } 5742 5743 cout << "finished" << endl; 5744 cout << "Evaluating view cell partition ... " << endl; 5745 5746 while (castSamples < numSamples) 5747 { 5748 /////////////// 5749 //-- we have to use uniform sampling strategy for construction rays 5750 5751 VssRayContainer evaluationSamples; 5752 const int samplingType = mEvaluationSamplingType; 5753 5754 long startTime = GetTime(); 5755 5756 cout << "casting " << samplesPerPass << " samples ... "; 5757 Debug << "casting " << samplesPerPass << " samples ... "; 5758 5759 CastPassSamples(samplesPerPass, samplingType, evaluationSamples); 5760 5761 castSamples += samplesPerPass; 5762 5763 Real timeDiff = TimeDiff(startTime, GetTime()); 5764 Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl; 5765 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 5766 5767 cout << "computing sample contributions of " << (int)evaluationSamples.size() << " samples ... "; 5768 Debug << "computing sample contributions of " << (int)evaluationSamples.size() << " samples ... "; 5769 5770 startTime = GetTime(); 5771 5772 ComputeSampleContributions(evaluationSamples, true, false); 5773 5774 timeDiff = TimeDiff(startTime, GetTime()); 5775 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 5776 Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl; 5777 5778 startTime = GetTime(); 5779 cout << "compute new statistics ... " << endl; 5780 5781 /////////// 5782 //-- output stats 5783 5784 sprintf(str, "-%09d-eval.log", castSamples); 5785 string filename = string(statsPrefix) + string(str); 5786 5787 mHierarchyManager->EvaluateSubdivision(evaluationSamples, mPreprocessor->mObjects, filename); 5788 5789 timeDiff = TimeDiff(startTime, GetTime()); 5790 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 5791 Debug << "statistis compted in " << timeDiff * 1e-3 << " secs" << endl; 5792 5793 disposeRays(evaluationSamples, NULL); 5794 } 5795 } 5701 5796 #endif 5702 } 5797 #endif 5798 }
Note: See TracChangeset
for help on using the changeset viewer.