Changeset 1416 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 09/19/06 09:41:23 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1415 r1416 25 25 26 26 27 28 //Environment *environment = NULL;29 27 Environment *Environment::sEnvironment = NULL; 30 28 … … 39 37 return sEnvironment; 40 38 } 39 41 40 42 41 void Environment::DelSingleton() -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r1415 r1416 106 106 bool Exporter::ExportBvHierarchy(const BvHierarchy &bvHierarchy, 107 107 const int maxPvs, 108 AxisAlignedBox3 *box)108 const AxisAlignedBox3 *box) 109 109 { 110 110 vector<BvhLeaf *> leaves; -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h
r1415 r1416 49 49 mUseForcedMaterial(false), 50 50 mExportRayDensity(false) 51 { 52 } 51 {} 52 53 53 virtual ~Exporter() {} 54 54 … … 117 117 118 118 virtual void 119 ExportGeometry(const ObjectContainer &objects, const bool exportSingleMesh = false, AxisAlignedBox3 *bbox = NULL); 119 ExportGeometry( 120 const ObjectContainer &objects, 121 const bool exportSingleMesh = false, 122 AxisAlignedBox3 *bbox = NULL); 120 123 121 124 virtual void … … 147 150 148 151 void ExportKdIntersectable(const KdIntersectable &kdObj); 149 bool ExportBvHierarchy(const BvHierarchy &bvHierarchy, const int maxPvs, AxisAlignedBox3 *box = NULL); 152 153 bool ExportBvHierarchy( 154 const BvHierarchy &bvHierarchy, 155 const int maxPvs, 156 const AxisAlignedBox3 *box = NULL); 150 157 151 158 virtual void ExportMeshInstance(MeshInstance *mi); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1415 r1416 143 143 if (mOspTree) 144 144 mOspTree->SetViewCellsManager(vcm); 145 if (mBvHierarchy)145 else if (mBvHierarchy) 146 146 mBvHierarchy->SetViewCellsManager(vcm); 147 147 } … … 163 163 { 164 164 return mVspTree->mBoundingBox; 165 } 166 167 168 AxisAlignedBox3 HierarchyManager::GetObjectSpaceBox() const 169 { 170 switch (mObjectSpaceSubdivisionType) 171 { 172 case KD_BASED_OBJ_SUBDIV: 173 return mOspTree->mBoundingBox; 174 case BV_BASED_OBJ_SUBDIV: 175 return mBvHierarchy->mBoundingBox; 176 default: 177 // empty box 178 return AxisAlignedBox3(); 179 } 165 180 } 166 181 … … 360 375 { 361 376 KdNode *n = mOspTree->Subdivide(mTQueue, sc, globalTerminationCriteriaMet); 362 363 if (n->IsLeaf()) // local or global termination criteria failed377 // local or global termination criteria failed 378 if (n->IsLeaf()) 364 379 return false; 365 380 } … … 367 382 { 368 383 BvhNode *n = mBvHierarchy->Subdivide(mTQueue, sc, globalTerminationCriteriaMet); 369 370 if (n->IsLeaf()) // local or global termination criteria failed384 // local or global termination criteria failed 385 if (n->IsLeaf()) 371 386 return false; 372 387 } 373 388 } 374 389 375 return true; //!globalTerminationCriteriaMet;390 return true; 376 391 } 377 392 … … 746 761 747 762 void HierarchyManager::ExportObjectSpaceHierarchy(Exporter *exporter, 748 const ObjectContainer &objects) const 763 const ObjectContainer &objects, 764 const AxisAlignedBox3 *bbox) const 749 765 { 750 766 switch (mObjectSpaceSubdivisionType) … … 757 773 case BV_BASED_OBJ_SUBDIV: 758 774 { 759 AxisAlignedBox3 bbox = mBvHierarchy->GetBoundingBox(); 760 bbox.Scale(Vector3(0.5, 1, 0.5)); 761 762 ExportBvHierarchy(exporter, objects, &bbox); 775 ExportBvHierarchy(exporter, objects, bbox); 763 776 break; 764 777 } … … 771 784 void HierarchyManager::ExportBvHierarchy(Exporter *exporter, 772 785 const ObjectContainer &objects, 773 AxisAlignedBox3 *bbox) const786 const AxisAlignedBox3 *bbox) const 774 787 { 775 788 exporter->SetWireframe(); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1415 r1416 201 201 202 202 AxisAlignedBox3 GetViewSpaceBox() const; 203 AxisAlignedBox3 GetObjectSpaceBox() const; 203 204 204 205 void ExportObjectSpaceHierarchy( 205 206 Exporter *exporter, 206 const ObjectContainer &objects) const; 207 const ObjectContainer &objects, 208 const AxisAlignedBox3 *bbox) const; 207 209 208 210 … … 255 257 Exporter *exporter, 256 258 const ObjectContainer &objects, 257 AxisAlignedBox3 *box) const;259 const AxisAlignedBox3 *box) const; 258 260 259 261 void PrepareBvHierarchy( -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1415 r1416 800 800 801 801 if (!loadKdTree) 802 { 803 ///////////////// 802 { ////// 804 803 //-- build new kd tree from scene geometry 805 806 804 BuildKdTree(); 807 805 KdTreeStatistics(cout); … … 817 815 return false; 818 816 } 817 819 818 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 820 819 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1311 r1416 974 974 975 975 exporter->SetForcedMaterial(m); 976 mViewCellsManager->ExportViewCellGeometry(exporter, *it); 977 } 976 mViewCellsManager->ExportViewCellGeometry(exporter, *it, NULL, NULL); 977 } 978 978 979 delete exporter; 979 980 cout << "finished" << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1415 r1416 356 356 357 357 ResetViewCells(); 358 if (0) Debug << "\nView cells after initial sampling:\n" << mCurrentViewCellsStats << endl;359 360 //-- optionally export initial view cell partition361 if (0) 362 { 358 359 if (0) //-- optionally export initial view cell partition 360 { 361 Debug << "\nView cells after initial sampling:\n" << mCurrentViewCellsStats << endl; 362 363 363 const string filename("viewcells.wrl"); 364 364 Exporter *exporter = Exporter::GetExporter(filename.c_str()); … … 374 374 375 375 exporter->SetWireframe(); 376 ExportViewCellsForViz(exporter );376 ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 377 377 378 378 delete exporter; … … 429 429 430 430 #if 0 431 /////////////// /////////////////////////////////432 //-- get stats after the additional sampling step431 /////////////// 432 //-- Get stats after the additional sampling step 433 433 //-- and before the bottom-up merge step 434 434 … … 445 445 446 446 447 //////////////////// ///////////////////////////447 //////////////////// 448 448 // 449 449 //-- post processing of the initial construction … … 476 476 477 477 478 //////////////// //////////////////////////////////////////////478 //////////////// 479 479 //-- Evaluation of the resulting view cell partition. 480 480 //-- We cast a number of new samples and measure the render cost … … 486 486 487 487 488 ///////////////// //////////////////488 ///////////////// 489 489 //-- Finally, we do some visualization 490 490 … … 508 508 509 509 return numSamples; 510 } 511 512 513 AxisAlignedPlane * ViewCellsManager::GetClipPlane() 514 { 515 return mUseClipPlaneForViz ? &mClipPlaneForViz : NULL; 510 516 } 511 517 … … 1692 1698 1693 1699 Environment::GetSingleton()->GetFloatValue("ViewCells.Visualization.clipPlanePos", pos); 1694 1695 Vector3 point = mViewSpaceBox.Min() + mViewSpaceBox.Size() * pos; 1696 1697 if (mUseClipPlaneForViz) 1698 Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 1699 1700 mClipPlane = AxisAlignedPlane(axis, point[axis]); 1700 Vector3 absPos = mViewSpaceBox.Min() + mViewSpaceBox.Size() * pos; 1701 1702 Environment::GetSingleton()->GetIntValue("ViewCells.Visualization.clipPlaneAxis", axis); 1703 1704 mClipPlaneForViz = AxisAlignedPlane(axis, absPos[axis]); 1701 1705 } 1702 1706 … … 1946 1950 } 1947 1951 1948 // matt: todo 1949 void ViewCellsManager::ExportViewCellsForViz(Exporter *exporter) const 1952 1953 void ViewCellsManager::ExportViewCellsForViz(Exporter *exporter, 1954 const AxisAlignedBox3 *sceneBox, 1955 const AxisAlignedPlane *clipPlane 1956 ) const 1950 1957 { 1951 1958 ViewCellContainer::const_iterator it, it_end = mViewCells.end(); … … 1956 1963 { 1957 1964 ExportColor(exporter, *it); 1958 1959 ExportViewCellGeometry(exporter, *it, 1960 mUseClipPlaneForViz ? &mClipPlane : NULL); 1965 ExportViewCellGeometry(exporter, *it, sceneBox, clipPlane); 1961 1966 } 1962 1967 } … … 2670 2675 const int savedColorCode = mColorCode; 2671 2676 2672 //BspLeaf::NewMail();2673 2677 if (1) // export merged view cells 2674 2678 { 2675 mColorCode = 0; 2676 2679 mColorCode = 0; // hack color code 2677 2680 Exporter *exporter = Exporter::GetExporter("merged_view_cells.wrl"); 2678 2681 … … 2683 2686 { 2684 2687 if (mExportGeometry) 2688 { 2685 2689 exporter->ExportGeometry(objects); 2686 2687 //exporter->SetWireframe(); 2690 } 2691 2688 2692 exporter->SetFilled(); 2689 ExportViewCellsForViz(exporter); 2690 2693 ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 2691 2694 2692 2695 delete exporter; … … 2695 2698 } 2696 2699 2697 if (1) // export merged view cells using pvs color coding 2698 { 2700 if (1) 2701 { 2702 // export merged view cells using pvs color coding 2699 2703 mColorCode = 1; 2700 2704 2701 2705 Exporter *exporter = Exporter::GetExporter("merged_view_cells_pvs.wrl"); 2702 2703 2706 cout << "exporting view cells after merge (pvs size) ... "; 2704 2707 2705 2708 if (exporter) 2706 2709 { 2707 //exporter->SetWireframe();2708 //exporter->SetForcedMaterial(RandomMaterial());2709 2710 2710 if (mExportGeometry) 2711 { 2711 2712 exporter->ExportGeometry(objects); 2712 2713 //exporter->SetWireframe();2713 } 2714 2714 2715 exporter->SetFilled(); 2715 ExportViewCellsForViz(exporter );2716 ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 2716 2717 2717 2718 delete exporter; … … 2769 2770 if (exporter) 2770 2771 { 2771 //exporter->SetWireframe();2772 2773 2772 if (mExportGeometry) 2773 { 2774 2774 exporter->ExportGeometry(objects); 2775 2776 //exporter->SetFilled(); 2777 const bool b = mUseClipPlaneForViz; 2778 mUseClipPlaneForViz = false; 2779 2780 ExportViewCellsForViz(exporter); 2781 2782 mUseClipPlaneForViz = b; 2775 } 2776 2777 ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 2783 2778 delete exporter; 2784 2779 } … … 2788 2783 mColorCode = savedColorCode; 2789 2784 2785 2786 ////////////////// 2790 2787 //-- visualization of the BSP splits 2788 2791 2789 bool exportSplits = false; 2792 2790 Environment::GetSingleton()->GetBoolValue("BspTree.Visualization.exportSplits", exportSplits); … … 2890 2888 exporter->SetForcedMaterial(m); 2891 2889 2892 ExportViewCellGeometry(exporter, vc );2890 ExportViewCellGeometry(exporter, vc, NULL, NULL); 2893 2891 2894 2892 // export rays piercing this view cell … … 2962 2960 void BspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 2963 2961 ViewCell *vc, 2964 const AxisAlignedPlane *clipPlane) const 2962 const AxisAlignedBox3 *sceneBox, 2963 const AxisAlignedPlane *clipPlane 2964 ) const 2965 2965 { 2966 2966 // export mesh if available … … 3437 3437 void KdViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 3438 3438 ViewCell *vc, 3439 const AxisAlignedPlane *clipPlane) const 3439 const AxisAlignedBox3 *sceneBox, 3440 const AxisAlignedPlane *clipPlane 3441 ) const 3440 3442 { 3441 3443 ViewCellContainer leaves; 3442 3443 3444 mViewCellsTree->CollectLeaves(vc, leaves); 3444 3445 ViewCellContainer::const_iterator it, it_end = leaves.end(); … … 3447 3448 { 3448 3449 KdViewCell *kdVc = dynamic_cast<KdViewCell *>(*it); 3449 3450 3450 exporter->ExportBox(mKdTree->GetBox(kdVc->mLeaf)); 3451 3451 } … … 3718 3718 exporter->SetFilled(); 3719 3719 3720 ExportViewCellsForViz(exporter );3720 ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 3721 3721 3722 3722 if (mExportGeometry) … … 3737 3737 if (1) 3738 3738 { 3739 mColorCode = 1; // export merged view cells using pvs coding 3739 // use pvs size for color coding 3740 mColorCode = 1; 3740 3741 Exporter *exporter = Exporter::GetExporter("merged_view_cells_pvs.wrl"); 3741 3742 … … 3744 3745 if (exporter) 3745 3746 { 3746 if (0) 3747 exporter->SetWireframe(); 3748 else 3749 exporter->SetFilled(); 3750 3751 ExportViewCellsForViz(exporter); 3747 exporter->SetFilled(); 3748 3749 ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 3752 3750 3753 3751 if (mExportGeometry) … … 4033 4031 GetRaySets(sampleRays, mVisualizationSamples, visRays); 4034 4032 4035 //-- export final view cell partition 4036 4033 4037 4034 if (0) 4038 4035 { 4039 // hack pvs 4040 //const int savedColorCode = mColorCode; 4041 //mColorCode = 1; 4042 4036 ////////////////// 4037 //-- export final view cell partition 4038 4043 4039 Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 4044 4040 … … 4074 4070 } 4075 4071 4076 //exporter->SetFilled(); 4077 4078 // HACK: export without clip plane 4079 const bool b = mUseClipPlaneForViz; 4080 //mUseClipPlaneForViz = false; 4081 4082 ExportViewCellsForViz(exporter); 4083 4084 mUseClipPlaneForViz = b; 4072 ExportViewCellsForViz(exporter, NULL, GetClipPlane()); 4073 4085 4074 delete exporter; 4086 4087 4075 cout << "finished" << endl; 4088 4076 } 4089 4090 //mColorCode = savedColorCode; 4091 } 4092 4077 } 4093 4078 4094 4079 if (0) … … 4316 4301 } 4317 4302 4318 4303 //////////////// 4319 4304 //-- export view cell geometry 4305 4320 4306 exporter->SetWireframe(); 4321 4307 … … 4324 4310 exporter->SetForcedMaterial(m); 4325 4311 4326 ExportViewCellGeometry(exporter, vc); 4327 4312 ExportViewCellGeometry(exporter, vc, NULL, NULL); 4328 4313 exporter->SetFilled(); 4329 4314 4330 4331 //-- export pvs4332 4315 if (1) 4333 4316 { 4317 //////// 4318 //-- export pvs 4334 4319 ObjectPvsMap::const_iterator oit, 4335 4320 oit_end = pvs.mEntries.end(); … … 4396 4381 4397 4382 exporter->SetForcedMaterial(RgbColor(0,1,0)); 4398 ExportViewCellGeometry(exporter, GetViewCell(viewPoint) );4383 ExportViewCellGeometry(exporter, GetViewCell(viewPoint), NULL, NULL); 4399 4384 4400 4385 //exporter->ResetForcedMaterial(); 4401 4386 exporter->SetForcedMaterial(RgbColor(0,0,1)); 4402 ExportViewCellGeometry(exporter, testPrVs.mViewCell );4387 ExportViewCellGeometry(exporter, testPrVs.mViewCell, NULL, NULL); 4403 4388 4404 4389 exporter->SetForcedMaterial(RgbColor(1,0,0)); … … 4491 4476 m.mDiffuseColor.b = 1.0f; 4492 4477 //exporter->SetForcedMaterial(m); 4493 //ExportViewCellGeometry(exporter, vc, mClipPlane );4478 //ExportViewCellGeometry(exporter, vc, mClipPlaneForViz); 4494 4479 4495 4480 /* // counting the pvss … … 4510 4495 4511 4496 void VspBspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 4512 ViewCell *vc, 4513 const AxisAlignedPlane *clipPlane) const 4497 ViewCell *vc, 4498 const AxisAlignedBox3 *sceneBox, 4499 const AxisAlignedPlane *clipPlane 4500 ) const 4514 4501 { 4515 4502 if (clipPlane) … … 5013 5000 void VspOspViewCellsManager::ExportViewCellGeometry(Exporter *exporter, 5014 5001 ViewCell *vc, 5015 const AxisAlignedPlane *clipPlane) const 5002 const AxisAlignedBox3 *sceneBox, 5003 const AxisAlignedPlane *clipPlane 5004 ) const 5016 5005 { 5017 5006 ViewCellContainer leaves; … … 5021 5010 5022 5011 Plane3 plane; 5023 5012 5024 5013 if (clipPlane) 5025 {5026 5014 plane = clipPlane->GetPlane(); 5027 }5028 5029 AxisAlignedBox3 bbox = GetViewSpaceBox();5030 bbox.Scale(Vector3(0.5, 1, 0.5));5031 5015 5032 5016 for (it = leaves.begin(); it != it_end; ++ it) … … 5035 5019 VspLeaf *l = vspVc->mLeaf; 5036 5020 5037 const AxisAlignedBox3 box = mHierarchyManager->GetVspTree()->GetBoundingBox(vspVc->mLeaf); 5021 const AxisAlignedBox3 box = 5022 mHierarchyManager->GetVspTree()->GetBoundingBox(vspVc->mLeaf); 5038 5023 5039 if (!Overlap( box, bbox))5024 if (!Overlap(*sceneBox, box)) 5040 5025 continue; 5041 5026 … … 5049 5034 { 5050 5035 AxisAlignedBox3 fbox, bbox; 5051 b ox.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox);5036 bbox.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox); 5052 5037 5053 5038 exporter->ExportBox(bbox); … … 5084 5069 if (1) 5085 5070 { 5086 //////////// /////////////////5071 //////////// 5087 5072 //-- export final view cells 5088 5073 … … 5098 5083 cout << "exporting final view cells (after initial construction + post process) ... "; 5099 5084 5085 // matt: hack 5086 AxisAlignedBox3 bbox = mHierarchyManager->GetViewSpaceBox(); 5087 bbox.Scale(Vector3(0.5, 1, 0.5)); 5088 5100 5089 if (mExportGeometry) 5101 5090 { 5102 exporter->ExportGeometry(objects, true );5091 exporter->ExportGeometry(objects, true, &bbox); 5103 5092 } 5104 5093 … … 5109 5098 } 5110 5099 5111 // HACK: export without clip plane 5112 const bool b = mUseClipPlaneForViz; 5113 if (0) mUseClipPlaneForViz = false; 5114 5115 ExportViewCellsForViz(exporter); 5116 5117 mUseClipPlaneForViz = b; 5100 ExportViewCellsForViz(exporter, &bbox, GetClipPlane()); 5101 5118 5102 delete exporter; 5119 5120 5103 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 5121 5104 } … … 5132 5115 { 5133 5116 const long starttime = GetTime(); 5117 5118 // matt: hack 5119 AxisAlignedBox3 bbox = mHierarchyManager->GetObjectSpaceBox(); 5120 bbox.Scale(Vector3(0.5, 1, 0.5)); 5134 5121 5135 5122 cout << "exporting object space hierarchy ... "; 5136 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects );5123 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, &bbox); 5137 5124 5138 5125 delete exporter; … … 5187 5174 mViewCellsTree->GetPvs(vc, pvs); 5188 5175 5189 //bspLeaves[j]->Mail();5190 5176 char s[64]; sprintf(s, "bsp-pvs%04d.wrl", i); 5191 5177 Exporter *exporter = Exporter::GetExporter(s); … … 5266 5252 exporter->SetWireframe(); 5267 5253 5268 Material m; //= RandomMaterial();5254 Material m; 5269 5255 m.mDiffuseColor = RgbColor(0, 1, 0); 5270 5256 exporter->SetForcedMaterial(m); 5271 5257 5272 ExportViewCellGeometry(exporter, vc); 5273 5258 ExportViewCellGeometry(exporter, vc, NULL, NULL); 5274 5259 exporter->SetFilled(); 5275 5260 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1414 r1416 151 151 */ 152 152 virtual bool LoadViewCellsGeometry(const string filename); 153 154 155 /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector.153 154 /** Constructs view cell from base triangle. 155 The view cell is extruded along the normal vector. 156 156 @param the base triangle 157 157 @param the height of the newly created view cell … … 347 347 */ 348 348 int GetMinPvsSize() const; 349 350 349 /** Returns maximal ratio. i.e., currentPVs / maxPvs, 351 350 where pvs is still considered valid. 352 351 */ 353 352 float GetMaxPvsRatio() const; 354 355 353 /** Exports view cell geometry. 356 354 */ 357 virtual void ExportViewCellGeometry(Exporter *exporter, 358 ViewCell *vc, 359 const AxisAlignedPlane *clipPlane = NULL) const = 0; 355 virtual void ExportViewCellGeometry( 356 Exporter *exporter, 357 ViewCell *vc, 358 const AxisAlignedBox3 *box, 359 const AxisAlignedPlane *clipPlane = NULL 360 ) const = 0; 360 361 361 362 /** Brings the view cells into their final state, computes meshes and volume. … … 483 484 ////////////////////////////////////////////////////////////////// 484 485 486 485 487 /** Returns true if the view cell is equivalent to a 486 488 node of the spatial hierarchy. This function can be used for merged … … 553 555 void EvaluateViewCellsStats(); 554 556 557 558 /////////////////////// 555 559 //-- helper functions for view cell visualization 556 560 557 561 /** Exports the view cell partition. 558 562 */ 559 void ExportViewCellsForViz(Exporter *exporter) const; 563 void ExportViewCellsForViz( 564 Exporter *exporter, 565 const AxisAlignedBox3 *box, 566 const AxisAlignedPlane *clipPlane = NULL) const; 560 567 561 568 /** Sets exporter color. 562 569 */ 563 570 virtual void ExportColor(Exporter *exporter, ViewCell *vc) const; 571 /** Creates meshes from the view cells. 572 */ 573 void CreateViewCellMeshes(); 574 /** Creates clip plane for visualization. 575 */ 576 void CreateClipPlane(); 577 578 AxisAlignedPlane *GetClipPlane(); 579 /////////////////////// 564 580 565 581 /** Returns volume of the view space. 566 582 */ 567 583 virtual float GetViewSpaceVolume(); 568 569 /** Creates meshes from the view cells. 570 */ 571 void CreateViewCellMeshes(); 572 573 /** Takes different measures to prepares the view cells after loading them from disc. 584 /** Prepares the view cells for sampling after loading them from disc. 574 585 */ 575 586 virtual void PrepareLoadedViewCells() {}; 576 577 587 /** Constructs local view cell merge hierarchy. 578 588 */ … … 586 596 const ViewCellContainer &viewCells); 587 597 588 /** Creates clip plane for visualization.589 */590 void CreateClipPlane();591 592 598 /** Updates pvs of all view cells for statistical evaluation after some more sampling 593 599 */ … … 600 606 /// if bounding boxes should be exported together with the view cells 601 607 bool mExportBboxesForPvs; 602 603 //Environment *environment; 604 AxisAlignedPlane mClipPlane; 605 608 /// the clip plane for visualization 609 AxisAlignedPlane mClipPlaneForViz; 610 /// if the visualization is using the clip plane 606 611 bool mUseClipPlaneForViz; 607 608 609 612 /// Renders the view cells. 610 613 Renderer *mRenderer; 611 612 614 /// Loaded view cells 613 615 ViewCellContainer mViewCells; 614 /// the corresponding view cell tree holding the logical description of view cells616 /// the view cell hierarchy (i.e., the logical description of view cells) 615 617 ViewCellsTree *mViewCellsTree; 616 618 617 /// if the values in the view cell leaves and the interiors are up to date 618 /// this is meant for lazy storing of the pvs, where only a scalar indicating 619 /// pvs size is stored in interiors and not the pvs itself. 619 /** if the values in the view cell leaves and the interiors are up to date 620 this is meant for lazy storing of the pvs, where only a scalar indicating 621 pvs size is stored in interiors and not the pvs itself. 622 */ 620 623 bool mViewCellPvsIsUpdated; 621 624 622 /// maximum number of samples taken for construction of the view cells625 /// maximum number of samples for the view cell construction 623 626 int mConstructionSamples; 624 627 int mSamplesPerPass; … … 732 735 void CreateMesh(ViewCell *vc); 733 736 734 void ExportViewCellGeometry(Exporter *exporter, 735 ViewCell *vc, 736 const AxisAlignedPlane *clipPlane = NULL) const; 737 void ExportViewCellGeometry(Exporter *exporter, 738 ViewCell *vc, 739 const AxisAlignedBox3 *box, 740 const AxisAlignedPlane *clipPlane = NULL 741 ) const; 737 742 738 743 void CollectMergeCandidates(const VssRayContainer &rays, … … 741 746 void Finalize(ViewCell *viewCell, const bool createMesh); 742 747 743 bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects); 748 bool ExportViewCells(const string filename, 749 const bool exportPvs, 750 const ObjectContainer &objects); 744 751 745 752 /** Constructs merge hierarchy which corresponds to the spatial hierarchy. … … 805 812 */ 806 813 // virtual void PrintStatistics(ostream &s) const; 807 ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const { return NULL; } 814 ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const 815 { return NULL; } 808 816 809 817 float GetProbability(ViewCell *viewCell); 810 818 811 812 819 void CreateMesh(ViewCell *vc); 813 820 814 void ExportViewCellGeometry(Exporter *exporter, 815 ViewCell *vc, 816 const AxisAlignedPlane *clipPlane = NULL) const; 821 void ExportViewCellGeometry( 822 Exporter *exporter, 823 ViewCell *vc, 824 const AxisAlignedBox3 *box, 825 const AxisAlignedPlane *clipPlane = NULL 826 ) const; 827 817 828 818 829 void CollectMergeCandidates(const VssRayContainer &rays, … … 879 890 void CreateMesh(ViewCell *vc); 880 891 881 bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects); 892 bool ExportViewCells( 893 const string filename, 894 const bool exportPvs, 895 const ObjectContainer &objects); 882 896 883 897 int CastBeam(Beam &beam); 884 885 void ExportViewCellGeometry(Exporter *exporter, 886 ViewCell *vc, 887 const AxisAlignedPlane *clipPlane = NULL) const; 888 889 //float GetVolume(ViewCell *viewCell) const; 898 899 void ExportViewCellGeometry( 900 Exporter *exporter, 901 ViewCell *vc, 902 const AxisAlignedBox3 *box, 903 const AxisAlignedPlane *clipPlane = NULL 904 ) const; 905 890 906 891 907 void Finalize(ViewCell *viewCell, const bool createMesh); … … 920 936 */ 921 937 int GetMaxTreeDiff(ViewCell *vc) const; 922 923 938 924 939 /** Prepare view cells for use after loading them from disc. … … 1039 1054 virtual void EvalViewCellPartition(); 1040 1055 #endif 1056 1041 1057 /** Exports view cell geometry. 1042 1058 */ 1043 void ExportViewCellGeometry(Exporter *exporter, 1059 void ExportViewCellGeometry( 1060 Exporter *exporter, 1044 1061 ViewCell *vc, 1045 const AxisAlignedPlane *clipPlane = NULL) const; 1046 1047 int ComputeBoxIntersections(const AxisAlignedBox3 &box, 1062 const AxisAlignedBox3 *box, 1063 const AxisAlignedPlane *clipPlane = NULL 1064 ) const; 1065 1066 int ComputeBoxIntersections( 1067 const AxisAlignedBox3 &box, 1048 1068 ViewCellContainer &viewCells) const; 1049 1069 1050 1070 void CollectViewCells(); 1051 1052 1071 1053 1072 /** Prepare view cells for use after loading them from disc. … … 1067 1086 1068 1087 ///////////////////////////////////////// 1069 1070 /// the view space / object partition hierarchies1071 //VspTree *mVspTree;1072 //OspTree *mOspTree;1073 //BvHierarchy *mBvHierarchy;1074 1088 1075 1089 HierarchyManager *mHierarchyManager;
Note: See TracChangeset
for help on using the changeset viewer.