Changeset 569
- Timestamp:
- 01/23/06 15:58:00 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/GlRenderer.cpp
r563 r569 202 202 0.0f); 203 203 204 // viewcells->GetViewPoint(mViewPoint);205 206 mViewPoint = mSceneGraph->GetBox().GetPoint(pVector);204 mViewCellsManager->GetViewPoint(mViewPoint); 205 206 // mViewPoint = mSceneGraph->GetBox().GetPoint(pVector); 207 207 208 208 mViewDirection = Normalize(Vector3(sin(dVector.x), -
trunk/VUT/GtpVisibilityPreprocessor/src/Makefile
r563 r569 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.0) on: ?t 19. I 16:46:4120063 # Generated by qmake (2.00a) (Qt 4.1.0) on: po 23. I 11:09:15 2006 4 4 # Project: preprocessor.pro 5 5 # Template: app -
trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp
r567 r569 489 489 "#TotalSamples\n" <<totalSamples<<endl<< 490 490 "#RssSamples\n" <<rssSamples<<endl; 491 492 491 492 { 493 VssRayContainer contributingRays; 494 mVssRays.GetContributingRays(contributingRays, mPass); 495 mStats<<"#NUM_CONTRIBUTING_RAYS\n"<<(int)contributingRays.size()<<endl; 496 } 497 493 498 mVssRays.PrintStatistics(mStats); 494 499 mViewCellsManager->PrintPvsStatistics(mStats); … … 543 548 544 549 // viewcells->UpdatePVS(newVssRays); 545 546 550 Debug<<"Valid viewcells before set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 551 // cull viewcells with PVS > median (0.5f) 552 mViewCellsManager->SetValidityPercentage(0, 0.5f); 553 Debug<<"Valid viewcells after set validity: "<<mViewCellsManager->CountValidViewcells()<<endl; 554 547 555 while (1) { 548 556 SimpleRayContainer rays; -
trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
r567 r569 336 336 GetRoot(objects[i])->bbox = objects[i]->GetBox(); 337 337 } 338 339 338 stat.nodes = i; 339 stat.leaves = i; 340 340 } else { 341 341 mRoots.resize(1); … … 347 347 mRoots[0] = leaf; 348 348 stat.nodes = 1; 349 stat.leaves = 1; 349 350 } 350 351 … … 356 357 357 358 // first construct a leaf that will get subdivide 358 RssTreeLeaf *leaf = (RssTreeLeaf *) GetRoot(info.Get Object());359 RssTreeLeaf *leaf = (RssTreeLeaf *) GetRoot(info.GetSourceObject()); 359 360 360 361 leaf->AddRay(info); … … 1094 1095 1095 1096 stat.nodes+=2; 1097 stat.leaves += 1; 1096 1098 stat.splits[axis]++; 1097 1099 … … 1410 1412 stack<RayTraversalData> tstack; 1411 1413 1412 RssTreeNode *root = GetRoot(info.Get Object());1414 RssTreeNode *root = GetRoot(info.GetSourceObject()); 1413 1415 tstack.push(RayTraversalData(root, info)); 1414 1416 … … 1550 1552 1551 1553 stat.nodes -= collapsedNodes - 1; 1554 stat.leaves -= collapsedNodes/2 - 1; 1552 1555 stat.rayRefs -= totalRayCount - rayCount; 1553 1556 … … 2771 2774 { 2772 2775 if (mPerObjectTree && object) { 2773 int id = object->GetId(); 2774 if (id >= mRoots.size()) 2776 int id = object->GetId()-1; 2777 if (id < 0 || id >= mRoots.size()) { 2778 Debug<<"Error: object Id out of range, Id="<<id<<" roots.size()="<<mRoots.size()<< 2779 endl<<flush; 2775 2780 id = mRoots.size()-1; // $$ last tree is used by all unsigned objects 2781 } 2776 2782 return mRoots[id]; 2777 2783 } else -
trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.h
r516 r569 42 42 // total number of nodes 43 43 int nodes; 44 // number of leaves 45 int leaves; 44 46 // number of splits along each of the axes 45 47 int splits[7]; … … 90 92 int Nodes() const {return nodes;} 91 93 int Interior() const { return nodes/2; } 92 int Leaves() const { return (nodes/2) + 1; }94 int Leaves() const { return Nodes() - Interior(); } 93 95 94 96 void Reset() { -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h
r564 r569 137 137 bool GetValid() const; 138 138 139 static bool SmallerPvs(const ViewCell *a, 140 const ViewCell *b) { 141 return a->GetPvs().GetSize() < b->GetPvs().GetSize(); 142 } 143 139 144 protected: 140 145 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp
r568 r569 124 124 int maxPvsSize) const 125 125 { 126 if ((vc->GetPvs().GetSize() > mMaxPvsSize) || 127 (vc->GetPvs().GetSize() < mMinPvsSize)) 128 { 129 return false; 130 } 131 132 return true; 126 127 if ((vc->GetPvs().GetSize() > maxPvsSize) || 128 (vc->GetPvs().GetSize() < minPvsSize)) 129 { 130 return false; 131 } 132 133 return true; 133 134 } 134 135 … … 141 142 } 142 143 144 void 145 ViewCellsManager::SetValidity( 146 int minPvsSize, 147 int maxPvsSize) const 148 { 149 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 150 151 for (it = mViewCells.begin(); it != it_end; ++ it) { 152 SetValidity(*it, minPvsSize, maxPvsSize); 153 } 154 } 155 156 void 157 ViewCellsManager::SetValidityPercentage( 158 const float minValid, 159 const float maxValid 160 ) 161 { 162 sort(mViewCells.begin(), mViewCells.end(), ViewCell::SmallerPvs); 163 164 int start = mViewCells.size()*minValid; 165 int end = mViewCells.size()*maxValid; 166 167 for (int i=0; i < mViewCells.size(); i++) 168 mViewCells[i]->SetValid(i >= start && i <= end); 169 } 170 171 int 172 ViewCellsManager::CountValidViewcells() const 173 { 174 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); 175 int valid = 0; 176 for (it = mViewCells.begin(); it != it_end; ++ it) { 177 if ((*it)->GetValid()) 178 valid++; 179 } 180 return valid; 181 } 143 182 144 183 bool ViewCellsManager::LoadViewCells(const string filename, ObjectContainer *objects) … … 171 210 bool ViewCellsManager::ViewPointValid(const Vector3 &viewPoint) const 172 211 { 212 if (!ViewCellsConstructed()) 173 213 return mViewSpaceBox.IsInside(viewPoint); 214 else { 215 if (!mViewSpaceBox.IsInside(viewPoint)) 216 return false; 217 ViewCell *viewcell = GetViewCell(viewPoint); 218 if (!viewcell || !viewcell->GetValid()) 219 return false; 220 } 221 return true; 174 222 } 175 223 … … 487 535 for (it = viewcells->begin(); it != viewcells->end(); ++it) { 488 536 ViewCell *viewcell = *it; 489 // if ray not outside of view space 490 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 537 if (viewcell->GetValid()) { 538 // if ray not outside of view space 539 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 540 } 491 541 } 492 542 } … … 526 576 if (storeViewcells) 527 577 { 528 529 530 578 ray.mViewCells.reserve(viewcells.size()); 579 ray.mViewCells = viewcells; 580 } 531 581 532 582 ViewCellContainer::const_iterator it = viewcells.begin(); … … 535 585 for (; it != viewcells.end(); ++it) { 536 586 ViewCell *viewcell = *it; 537 // if ray not outside of view space 538 float contribution; 539 if (viewcell->GetPvs().GetSampleContribution(ray.mTerminationObject, 540 ray.mPdf, 541 contribution 542 )) 543 ray.mPvsContribution++; 544 ray.mRelativePvsContribution += contribution; 587 if (viewcell->GetValid()) { 588 // if ray not outside of view space 589 float contribution; 590 if (viewcell->GetPvs().GetSampleContribution(ray.mTerminationObject, 591 ray.mPdf, 592 contribution 593 )) 594 ray.mPvsContribution++; 595 ray.mRelativePvsContribution += contribution; 596 } 545 597 } 546 598 … … 548 600 for (it = viewcells.begin(); it != viewcells.end(); ++it) { 549 601 ViewCell *viewcell = *it; 550 // if ray not outside of view space 551 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 552 } 553 602 if (viewcell->GetValid()) { 603 // if ray not outside of view space 604 viewcell->GetPvs().AddSample(ray.mTerminationObject, ray.mPdf); 605 } 606 } 607 554 608 return ray.mRelativePvsContribution; 555 609 } … … 1179 1233 1180 1234 1181 ViewCell *BspViewCellsManager::GetViewCell(const Vector3 &point) 1235 ViewCell *BspViewCellsManager::GetViewCell(const Vector3 &point) const 1182 1236 { 1183 1237 if (!mBspTree) … … 1880 1934 } 1881 1935 1936 1937 1882 1938 int VspBspViewCellsManager::Construct(const ObjectContainer &objects, 1883 1939 const VssRayContainer &rays) … … 2209 2265 bool VspBspViewCellsManager::ViewPointValid(const Vector3 &viewPoint) const 2210 2266 { 2211 return mViewSpaceBox.IsInside(viewPoint) && 2212 mVspBspTree->ViewPointValid(viewPoint); 2267 // $$JB -> implemented in viewcellsmanager (slower, but allows dynamic 2268 // validy update in preprocessor for all managers) 2269 return ViewCellsManager::ViewPointValid(viewPoint); 2270 2271 // return mViewSpaceBox.IsInside(viewPoint) && 2272 // mVspBspTree->ViewPointValid(viewPoint); 2213 2273 } 2214 2274 … … 2518 2578 2519 2579 2520 ViewCell *VspBspViewCellsManager::GetViewCell(const Vector3 &point) 2580 ViewCell *VspBspViewCellsManager::GetViewCell(const Vector3 &point) const 2521 2581 { 2522 2582 if (!mVspBspTree) -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h
r564 r569 182 182 183 183 /** Get a viewcell containing the specified point */ 184 virtual ViewCell *GetViewCell(const Vector3 &point) = 0;184 virtual ViewCell *GetViewCell(const Vector3 &point) const = 0; 185 185 186 186 virtual void PrintPvsStatistics(ostream &s); … … 267 267 int maxPvsSize) const; 268 268 269 /** sets validy of all viewcells */ 270 virtual void SetValidity( 271 int minPvsSize, 272 int maxPvsSize) const; 273 274 /** set valid viewcells in the range of pvs. sorts the viewcells 275 according to the pvs and then pickups those in the ranges */ 276 277 void 278 SetValidityPercentage( 279 const float minValid, 280 const float maxValid 281 ); 282 283 int 284 CountValidViewcells() const; 285 269 286 /** Returns maximal allowed pvs size. 270 287 */ … … 417 434 418 435 /** Get a viewcell containing the specified point */ 419 ViewCell *GetViewCell(const Vector3 &point) ;436 ViewCell *GetViewCell(const Vector3 &point) const; 420 437 421 438 void CreateMesh(ViewCell *vc); … … 482 499 */ 483 500 // virtual void PrintStatistics(ostream &s) const; 484 ViewCell *GetViewCell(const Vector3 &point) { return NULL; }501 ViewCell *GetViewCell(const Vector3 &point) const { return NULL; } 485 502 486 503 float GetProbability(ViewCell *viewCell); … … 540 557 ViewCellContainer &viewcells); 541 558 542 ViewCell *GetViewCell(const Vector3 &point) { return NULL; }559 ViewCell *GetViewCell(const Vector3 &point) const { return NULL; } 543 560 544 561 float GetProbability(ViewCell *viewCell); … … 600 617 float GetRendercost(ViewCell *viewCell, float objRendercost) const; 601 618 602 ViewCell *GetViewCell(const Vector3 &point) ;619 ViewCell *GetViewCell(const Vector3 &point) const; 603 620 604 621 bool GetViewPoint(Vector3 &viewPoint) const; -
trunk/VUT/GtpVisibilityPreprocessor/src/default.env
r567 r569 13 13 #;../data/vienna/vienna-plane.x3d 14 14 # filename ../data/vienna/viewcells-25-sel.x3d 15 #filename ../data/atlanta/atlanta2.x3d15 filename ../data/atlanta/atlanta2.x3d 16 16 #filename ../data/soda/soda.dat 17 filename ../data/soda/soda5.dat17 # filename ../data/soda/soda5.dat 18 18 } 19 19 … … 25 25 # type vss 26 26 type rss 27 detectEmptyViewSpace true27 detectEmptyViewSpace false 28 28 pvsRenderErrorSamples 10000 29 29 … … 97 97 RssTree { 98 98 epsilon 1e-6 99 perObjectTree true99 perObjectTree false 100 100 101 101 maxDepth 40 … … 200 200 } 201 201 202 filename ../data/soda/viewcells_soda5-2.xml203 #filename ../data/atlanta/viewcells_atlanta2.xml202 # filename ../data/soda/viewcells_soda5-2.xml 203 filename ../data/atlanta/viewcells_atlanta2.xml 204 204 # filename ../data/atlanta/atlanta_viewcells_large.x3d 205 205 # filename ../data/vienna/viewcells-25-sel.x3d
Note: See TracChangeset
for help on using the changeset viewer.