- Timestamp:
- 11/15/05 01:32:10 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r410 r411 9 9 #include "RenderSimulator.h" 10 10 11 SamplingPreprocessor::SamplingPreprocessor(): mPass(0) , mSampleRays(NULL)11 SamplingPreprocessor::SamplingPreprocessor(): mPass(0) 12 12 { 13 13 // this should increase coherence of the samples … … 15 15 environment->GetIntValue("Sampling.totalSamples", mTotalSamples); 16 16 environment->GetIntValue("BspTree.Construction.samples", mBspConstructionSamples); 17 environment->GetIntValue("VspTree.Construction.samples", mVspConstructionSamples); 18 17 19 environment->GetIntValue("ViewCells.PostProcessing.samples", mPostProcessSamples); 18 20 environment->GetIntValue("BspTree.Visualization.samples", mVisualizationSamples); … … 25 27 { 26 28 CLEAR_CONTAINER(mSampleRays); 29 CLEAR_CONTAINER(mVspSampleRays); 27 30 } 28 31 … … 198 201 } 199 202 } 200 else 201 { 202 if (ray.kdLeaves.size()) { 203 Intersectable *terminator = 204 ray.intersections.size() ? ray.intersections[0].mObject: NULL; 205 206 sampleContributions += AddNodeSamples(ray, 207 object, 208 terminator); 209 } 210 } 203 else { 204 if (ray.kdLeaves.size()) { 205 Intersectable *terminator = 206 ray.intersections.size() ? ray.intersections[0].mObject: NULL; 207 208 sampleContributions += AddNodeSamples(ray, 209 object, 210 terminator); 211 } 212 } 211 213 212 214 return sampleContributions; … … 482 484 //mVspKdTree->Construct(mSampleRays, mBoundingBox); 483 485 } 484 /*else if (ViewCell::sHierarchy == ViewCell::VSPKD)486 else if (ViewCell::sHierarchy == ViewCell::VSP) 485 487 { 486 ProcessVsp KdViewCells(ray,487 488 489 490 491 } */488 ProcessVspViewCells(ray, 489 reverseSample ? NULL : object, 490 faceIndex, 491 passContributingSamples, 492 passSampleContributions); 493 } 492 494 } 493 495 } else { … … 709 711 } 710 712 713 714 void SamplingPreprocessor::ProcessVspViewCells(const Ray &ray, 715 Intersectable *object, 716 const int faceIndex, 717 int &contributingSamples, 718 int &sampleContributions) 719 { 720 // save rays for bsp tree construction 721 if (!mVspKdTree) 722 { 723 if ((int)mVspSampleRays.size() < mVspConstructionSamples) 724 { 725 MeshInstance *mi = dynamic_cast<MeshInstance *>(object); 726 727 VssRay *sRay = new VssRay(ray); 728 mVspSampleRays.push_back(sRay); 729 730 // also add origin to sample 731 sRay->mOriginObject = object; 732 } 733 else 734 { 735 // construct VSP tree using the collected samples 736 cout << "building VSP tree from " << (int)mVspSampleRays.size() << " samples " << endl; 737 mVspKdTree->Construct(mVspSampleRays); 738 739 // add contributions of saved samples to PVS 740 //contributingSamples += mBspTree->GetStat().contributingSamples; 741 //sampleContributions += mBspTree->GetStat().sampleContributions; 742 743 // throw away samples because BSP leaves not stored in order 744 // Need ordered rays for post processing => collect new rays 745 //CLEAR_CONTAINER(mVspSampleRays); 746 } 747 } 748 // save rays for post processing 749 /*else if (((int)mVspSampleRays.size() < mPostProcessSamples) || 750 ((int)mVspSampleRays.size() < mVisualizationSamples)) 751 { 752 mVspSampleRays.push_back(new Ray(ray)); 753 }*/ 754 } 755 711 756 void SamplingPreprocessor::ProcessBspViewCells(const Ray &ray, 712 757 Intersectable *object,
Note: See TracChangeset
for help on using the changeset viewer.