Changeset 537 for trunk/VUT/GtpVisibilityPreprocessor/src
- Timestamp:
- 01/13/06 19:20:27 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Ray.h
r534 r537 307 307 308 308 SimpleRay() {} 309 SimpleRay(const Vector3 &o, const Vector3 &d):mOrigin(o), mDirection(d) {} 309 SimpleRay(const Vector3 &o, const Vector3 &d, const float p=1.0f): 310 mOrigin(o), mDirection(d), mProbability(p) {} 310 311 }; 311 312 312 typedef vector<SimpleRay> SimpleRayContainer; 313 class SimpleRayContainer : public vector<SimpleRay> 314 { 315 public: 316 317 float mSumProbabilities; 318 319 SimpleRayContainer():vector<SimpleRay>(), mSumProbabilities(0.0f) {} 320 321 void NormalizeProbabilities() { 322 iterator it = begin(); 323 float c = 1.0f/mSumProbabilities; 324 for (; it != end(); it++) 325 (*it).mProbability*=c; 326 } 327 328 }; 313 329 314 330 #endif -
trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
r534 r537 68 68 Vector3 &viewPoint, 69 69 Vector3 &direction, 70 const float probability, 70 71 VssRayContainer &vssRays 71 72 ) … … 148 149 objectB, 149 150 objectA, 150 mPass 151 mPass, 152 probability 151 153 ); 152 154 vssRays.push_back(vssRay); … … 159 161 objectA, 160 162 objectB, 161 mPass 163 mPass, 164 probability 162 165 ); 163 166 vssRays.push_back(vssRay); … … 551 554 //int s = Min(mSamplesPerPass, mInitialSamples); 552 555 int s = mInitialSamples; 553 556 557 float probability = 1.0f/mInitialSamples; 554 558 for (int k=0; k < s; k++) { 555 559 … … 561 565 Vector3 direction = InitialGetDirection(viewpoint, mViewSpaceBox); 562 566 563 sampleContributions = CastRay(viewpoint, direction, mVssRays);567 sampleContributions = CastRay(viewpoint, direction, probability, mVssRays); 564 568 565 569 … … 694 698 mViewCellsManager->GetViewPoint(viewpoint); 695 699 Vector3 direction = GetDirection(viewpoint, mViewSpaceBox); 696 rays.push_back(SimpleRay(viewpoint, direction)); 700 rays.push_back(SimpleRay(viewpoint, direction, 1.0f)); 701 rays.mSumProbabilities+=1.0f; 697 702 } 698 703 } else { 699 704 num = GenerateImportanceRays(rssTree, num, rays); 700 705 } 701 702 706 707 rays.NormalizeProbabilities(); 708 703 709 for (int i=0; i < rays.size(); i++) 704 CastRay(rays[i].mOrigin, rays[i].mDirection, vssRays);710 CastRay(rays[i].mOrigin, rays[i].mDirection, rays[i].mProbability, vssRays); 705 711 706 712 -
trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.h
r492 r537 78 78 Vector3 &viewPoint, 79 79 Vector3 &direction, 80 const float probability, 80 81 VssRayContainer &vssRays 81 82 -
trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
r534 r537 2195 2195 // cout<<"desired="<<numberOfRays<<" tries="<<i<<endl; 2196 2196 // assign probabilitites to the generated rays 2197 for (i=startIndex; i < rays.size(); i++) 2198 rays[i].mProbability = 1.0f; 2199 2197 float p = (box.GetVolume()*dirBox.GetVolume())/generated; 2198 for (i=startIndex; i < rays.size(); i++) { 2199 rays[i].mProbability = p; 2200 rays.mSumProbabilities += p; 2201 } 2202 2203 2200 2204 if (exporter) { 2201 2205 exporter->ExportRays(selectedRays, RgbColor(1, 0, 0)); -
trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h
r534 r537 73 73 Intersectable *originObject, 74 74 Intersectable *terminationObject, 75 const int pass = 0 75 const int pass = 0, 76 const float probability = 1.0f 76 77 ): 77 78 mMailbox(-1), … … 85 86 mViewCells(0), 86 87 mWeightedPvsContribution(0), 87 mProbability( 1.0f)88 mProbability(probability) 88 89 { 89 90 Precompute();
Note: See TracChangeset
for help on using the changeset viewer.