- Timestamp:
- 01/23/06 18:34:47 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r569 r570 88 88 89 89 90 int ViewCellsManager::Construct(VssRayContainer &rays) 91 { 92 /* VssPreprocessor preprocessor; 93 94 VssRayContainer vssRays; 95 preprocessor->GenerateVssRays(mConstructionSamples, vssRays); 96 Construct(preprocessor->mObjects, vssRays); 97 98 // add rays to output rays 99 while (!vssRays.empty) 100 { 101 rays.push_back(vssRays.back()); 102 vssRays.pop_back(); 103 } 104 105 const int importanceRays = 1000000; 106 preprocessor->GenerateVssRays(max(importanceRays, mPostProcessSamples); 107 108 PostProcess(preprocesor->mObjects, importanceRays); 90 int ViewCellsManager::Construct(Preprocessor *preprocessor, VssRayContainer *outRays) 91 { 92 SimpleRayContainer simpleRays; 93 VssRayContainer constructionRays; 94 95 preprocessor->GenerateRays(mConstructionSamples, 96 Preprocessor::SPATIAL_BOX_BASED_DISTRIBUTION, 97 simpleRays); 98 99 Construct(preprocessor->mObjects, constructionRays); 100 101 int numRays = (int)simpleRays.size(); 102 103 static Ray traversalRay; 104 105 // shoot simple ray and add it to construction rays 106 while (!simpleRays.empty()) 107 { 108 SimpleRay sray = simpleRays.back(); 109 110 // TODO: shoot into kdtree 111 constructionRays.push_back(new VssRay(traversalRay)); 112 113 if (outRays) 114 outRays->push_back(constructionRays.back()); 115 116 simpleRays.pop_back(); 117 } 118 119 if (!outRays) 120 CLEAR_CONTAINER(constructionRays); 121 122 // guided rays 123 VssRayContainer importanceRays; 124 const int desiredImportanceRays = max(1000000, mPostProcessSamples); 125 preprocessor->GenerateRays(desiredImportanceRays, 126 Preprocessor::RSS_BASED_DISTRIBUTION, 127 simpleRays); 128 129 numRays += (int)simpleRays.size(); 130 131 // shoot simple ray and add it to construction rays 132 while (!simpleRays.empty()) 133 { 134 SimpleRay sray = simpleRays.back(); 135 136 // TODO: shoot into kdtree 137 importanceRays.push_back(new VssRay(traversalRay)); 138 139 if (outRays) 140 outRays->push_back(importanceRays.back()); 141 142 simpleRays.pop_back(); 143 } 144 145 if (!outRays) 146 CLEAR_CONTAINER(importanceRays); 147 148 // merge the view cells 149 PostProcess(preprocessor->mObjects, importanceRays); 150 109 151 Visualize(preprocessor->mObjects, importanceRays); 110 152 111 // add rays to output rays 112 while (!importanceRays.empty) 113 { 114 rays.push_back(importanceRays.back()); 115 importanceRays.pop_back(); 116 } 117 */ 118 return (int)rays.size(); 153 154 return numRays; 119 155 } 120 156 … … 130 166 return false; 131 167 } 132 168 133 169 return true; 134 170 } … … 144 180 void 145 181 ViewCellsManager::SetValidity( 146 int minPvsSize, 182 int minPvsSize, 147 183 int maxPvsSize) const 148 184 { 149 185 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 150 186 151 187 for (it = mViewCells.begin(); it != it_end; ++ it) { 152 188 SetValidity(*it, minPvsSize, maxPvsSize); … … 161 197 { 162 198 sort(mViewCells.begin(), mViewCells.end(), ViewCell::SmallerPvs); 163 199 164 200 int start = mViewCells.size()*minValid; 165 201 int end = mViewCells.size()*maxValid; 166 202 167 203 for (int i=0; i < mViewCells.size(); i++) 168 204 mViewCells[i]->SetValid(i >= start && i <= end); … … 542 578 } 543 579 544 float 545 ViewCellsManager::ComputeSampleContributions(VssRay &ray, 546 const bool addRays 547 ) 548 { 549 ViewCellContainer viewcells; 550 551 ray.mPvsContribution = 0; 552 ray.mRelativePvsContribution = 0.0f; 553 554 static Ray hray; 580 float ViewCellsManager::ComputeSampleContributions(VssRay &ray, 581 const bool addRays) 582 { 583 ViewCellContainer viewcells; 584 585 ray.mPvsContribution = 0; 586 ray.mRelativePvsContribution = 0.0f; 587 588 static Ray hray; 555 589 hray.Init(ray); 556 590 //hray.mFlags |= Ray::CULL_BACKFACES; … … 567 601 CastLineSegment(origin, termination, viewcells); 568 602 //Debug << "constribution: " << (int)viewcells.size() << endl; 569 CastLineSegment(origin, termination, viewcells); 570 571 //Debug << "constribution: " << (int)viewcells.size() << endl; 572 573 // copy viewcells memory efficiently 574 const bool storeViewcells = !addRays; 575 576 if (storeViewcells) 577 { 578 ray.mViewCells.reserve(viewcells.size()); 579 ray.mViewCells = viewcells; 580 } 581 582 ViewCellContainer::const_iterator it = viewcells.begin(); 603 604 // copy viewcells memory efficiently 605 const bool storeViewcells = !addRays; 606 607 if (storeViewcells) 608 { 609 ray.mViewCells.reserve(viewcells.size()); 610 ray.mViewCells = viewcells; 611 } 612 613 ViewCellContainer::const_iterator it = viewcells.begin(); 583 614 584 615 … … 605 636 } 606 637 } 607 608 638 639 return ray.mRelativePvsContribution; 609 640 } 610 641 … … 1568 1599 } 1569 1600 1601 1570 1602 int VspKdViewCellsManager::Construct(const ObjectContainer &objects, 1571 1603 const VssRayContainer &rays) … … 1934 1966 } 1935 1967 1936 1937 1968 <<<<<<< .mine 1969 1970 ======= 1971 1972 1973 >>>>>>> .r569 1938 1974 int VspBspViewCellsManager::Construct(const ObjectContainer &objects, 1939 1975 const VssRayContainer &rays) … … 2268 2304 // validy update in preprocessor for all managers) 2269 2305 return ViewCellsManager::ViewPointValid(viewPoint); 2270 2306 2271 2307 // return mViewSpaceBox.IsInside(viewPoint) && 2272 2308 // mVspBspTree->ViewPointValid(viewPoint); … … 2508 2544 importance = (float)vc->GetPvs().GetSize() / 2509 2545 (float)mViewCellsStats.maxPvs; 2546 2510 2547 } 2511 2548 break;
Note: See TracChangeset
for help on using the changeset viewer.