Changeset 1843 for GTP/trunk/Lib/Vis
- Timestamp:
- 12/04/06 22:34:15 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1842 r1843 45 45 return obj1->GetBox().SurfaceArea() < obj2->GetBox().SurfaceArea(); 46 46 } 47 48 47 49 48 50 /***************************************************************/ … … 2026 2028 2027 2029 //-- export objects 2028 ExportObjects(leaf, stream); 2030 // tmp matt 2031 if (0) ExportObjects(leaf, stream); 2029 2032 2030 2033 stream << "\" />" << endl; … … 2538 2541 2539 2542 2543 void BvHierarchy::CreateUniqueObjectIds() 2544 { 2545 stack<BvhNode *> nodeStack; 2546 nodeStack.push(mRoot); 2547 2548 int currentId = 0; 2549 while (!nodeStack.empty()) 2550 { 2551 BvhNode *node = nodeStack.top(); 2552 nodeStack.pop(); 2553 2554 node->SetId(currentId ++); 2555 2556 if (!node->IsLeaf()) 2557 { 2558 BvhInterior *interior = (BvhInterior *)node; 2559 2560 nodeStack.push(interior->GetFront()); 2561 nodeStack.push(interior->GetBack()); 2562 } 2563 } 2564 } 2565 2566 2540 2567 void BvHierarchy::ApplyInitialSubdivision(SubdivisionCandidate *firstCandidate, 2541 2568 vector<SubdivisionCandidate *> &candidateContainer) … … 2619 2646 const float areaLarge = largeObj->GetBox().SurfaceArea(); 2620 2647 2621 return area Large/ (areaLarge - areaSmall + Limits::Small);2648 return areaSmall / (areaLarge - areaSmall + Limits::Small); 2622 2649 } 2623 2650 -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1789 r1843 627 627 float GetRenderCostIncrementially(BvhNode *node) const; 628 628 629 void CreateUniqueObjectIds(); 629 630 630 631 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1825 r1843 2617 2617 RegisterOption("Hierarchy.Construction.maxRepairs", 2618 2618 optInt, 2619 "hierarchy_construction_max Repairs=",2619 "hierarchy_construction_max_repairs=", 2620 2620 "1000"); 2621 2621 -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r1764 r1843 149 149 150 150 SetFilled(); 151 // hack 152 if (1 || (leaf->mObjects.size() < 50000)) 151 153 ExportGeometry(leaf->mObjects, true, box); 152 154 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1842 r1843 2352 2352 } 2353 2353 2354 } 2354 2355 void HierarchyManager::CreateUniqueObjectIds() 2356 { 2357 mBvHierarchy->CreateUniqueObjectIds(); 2358 } 2359 2360 2361 2362 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1830 r1843 292 292 void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 293 293 294 void CreateUniqueObjectIds(); 295 296 294 297 float mInitialRenderCost; 295 298 … … 530 533 float EvalFullMem() const; 531 534 535 536 532 537 protected: 533 538 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1842 r1843 2392 2392 2393 2393 // hack: just output full pvs 2394 if ( obj->Type() == Intersectable::BVH_INTERSECTABLE)2394 if (0 && (obj->Type() == Intersectable::BVH_INTERSECTABLE)) 2395 2395 { 2396 2396 ObjectContainer objects; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1842 r1843 562 562 disposeRays(postProcessSamples, outRays); 563 563 564 565 // write view cells to disc566 if (mExportViewCells)567 {568 char filename[100];569 Environment::GetSingleton()->GetStringValue("ViewCells.filename", filename);570 ExportViewCells(filename, mExportPvs, mPreprocessor->mObjects);571 }572 564 573 565 //////////////// … … 610 602 // recalculate view cells 611 603 EvaluateViewCellsStats(); 604 605 if (1) CompressViewCells(); 606 607 // write view cells to disc 608 if (mExportViewCells) 609 { 610 char filename[100]; 611 Environment::GetSingleton()->GetStringValue("ViewCells.filename", filename); 612 ExportViewCells(filename, mExportPvs, mPreprocessor->mObjects); 613 } 612 614 613 615 return numSamples; … … 1626 1628 { 1627 1629 return viewCell->GetVolume(); 1630 } 1631 1632 1633 void ViewCellsManager::CompressViewCells() 1634 { 1635 //////////// 1636 //-- compression 1637 1638 if (ViewCellsTreeConstructed() && mCompressViewCells) 1639 { 1640 int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 1641 1642 cout << "number of entries before compress: " << pvsEntries << endl; 1643 Debug << "number of entries before compress: " << pvsEntries << endl; 1644 1645 mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 1646 1647 pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 1648 1649 Debug << "number of entries after compress: " << pvsEntries << endl; 1650 cout << "number of entries after compress: " << pvsEntries << endl; 1651 } 1628 1652 } 1629 1653 … … 4582 4606 4583 4607 4584 //////////// 4585 //-- compression 4586 4587 if (ViewCellsTreeConstructed() && mCompressViewCells) 4588 { 4589 int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 4590 4591 cout << "number of entries before compress: " << pvsEntries << endl; 4592 Debug << "number of entries before compress: " << pvsEntries << endl; 4593 4594 mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 4595 4596 pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 4597 4598 Debug << "number of entries after compress: " << pvsEntries << endl; 4599 cout << "number of entries after compress: " << pvsEntries << endl; 4600 } 4601 4608 if (0) CompressViewCells(); 4609 4602 4610 // collapse sibling leaves that share the same view cell 4603 4611 if (0) mVspBspTree->CollapseTree(); … … 5500 5508 5501 5509 5510 mHierarchyManager->CreateUniqueObjectIds(); 5511 5502 5512 /////////// 5503 5513 //-- compression 5504 5514 5505 if (ViewCellsTreeConstructed() && mCompressViewCells) 5506 { 5507 int pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 5508 5509 cout << "number of entries before compress: " << pvsEntries << endl; 5510 Debug << "number of entries before compress: " << pvsEntries << endl; 5511 5512 mViewCellsTree->SetViewCellsStorage(ViewCellsTree::COMPRESSED); 5513 5514 pvsEntries = mViewCellsTree->CountStoredPvsEntries(mViewCellsTree->GetRoot()); 5515 5516 Debug << "number of entries after compress: " << pvsEntries << endl; 5517 cout << "number of entries after compress: " << pvsEntries << endl; 5518 } 5515 if (0) CompressViewCells(); 5519 5516 5520 5517 ///////////// … … 5924 5921 stream << "<VisibilitySolution>" << endl; 5925 5922 5926 if (exportPvs) 5923 // §§ tmp matt: for storage cost 5924 if (0 && exportPvs) 5927 5925 { 5928 5926 /////////////// … … 6227 6225 evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 6228 6226 evalStrats.push_back(SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION); 6229 6230 Debug << "casting volume strategies" << endl;6231 cout << "casting volume strategies" << endl;6232 6227 } 6233 6228 else … … 6238 6233 //evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 6239 6234 //evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 6240 6241 Debug << "casting surface strategies" << endl;6242 cout << "casting surface strategies" << endl;6243 6235 } 6244 6236 … … 6247 6239 Debug << evalStrats[i] << " "; 6248 6240 Debug << endl; 6241 6242 cout << "casting eval strategies: "; 6243 for (int i = 0; i < (int)evalStrats.size(); ++ i) 6244 cout << evalStrats[i] << " "; 6245 cout << endl; 6249 6246 6250 6247 while (castSamples < numSamples) -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1824 r1843 467 467 const ViewCellContainer &viewCells) const; 468 468 469 469 void CompressViewCells(); 470 470 ///////////////////////////// 471 471 // static members
Note: See TracChangeset
for help on using the changeset viewer.