Changeset 1920
- Timestamp:
- 12/22/06 20:08:48 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h
r1913 r1920 308 308 */ 309 309 BvhLeaf(const AxisAlignedBox3 &bbox); 310 310 BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent); 311 311 BvhLeaf(const AxisAlignedBox3 &bbox, BvhInterior *parent, const int numObjects); 312 312 … … 349 349 /// objects 350 350 ObjectContainer mObjects; 351 351 352 352 353 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r1843 r1920 105 105 106 106 bool Exporter::ExportBvHierarchy(const BvHierarchy &bvHierarchy, 107 const int maxPvs,107 const float maxPvs, 108 108 AxisAlignedBox3 *box, 109 109 const bool exportBoundingBoxes) … … 135 135 } 136 136 137 if (maxPvs ) // color code pvs137 if (maxPvs > 0) // color code pvs 138 138 { 139 139 mForcedMaterial.mDiffuseColor.b = 1.0f; 140 const float importance = (float)leaf->m Objects.size()/ (float)maxPvs;140 const float importance = (float)leaf->mRenderCost / (float)maxPvs; 141 141 142 142 mForcedMaterial.mDiffuseColor.r = importance; -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h
r1867 r1920 154 154 bool ExportBvHierarchy( 155 155 const BvHierarchy &bvHierarchy, 156 const int maxPvs,156 const float maxPvs, 157 157 AxisAlignedBox3 *box = NULL, 158 158 const bool exportBoundingBoxes = true); -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
r1919 r1920 1499 1499 const ObjectContainer &objects, 1500 1500 AxisAlignedBox3 *bbox, 1501 const float maxRenderCost, 1501 1502 const bool exportBounds) const 1502 1503 { … … 1510 1511 case BV_BASED_OBJ_SUBDIV: 1511 1512 { 1512 exporter->ExportBvHierarchy(*mBvHierarchy, 0, bbox, exportBounds);1513 exporter->ExportBvHierarchy(*mBvHierarchy, maxRenderCost, bbox, exportBounds); 1513 1514 break; 1514 1515 } -
GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
r1919 r1920 247 247 VspTree *GetVspTree(); 248 248 249 /** Returns view space bounding box.250 */251 //AxisAlignedBox3 GetViewSpaceBox() const;252 253 249 /** Returns object space bounding box. 254 250 */ … … 260 256 const ObjectContainer &objects, 261 257 AxisAlignedBox3 *bbox, 258 const float maxRenderCost, 262 259 const bool exportBounds = true) const; 263 260 -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r1919 r1920 206 206 Name="VCLinkerTool" 207 207 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib" 208 OutputFile="../bin/release/Preprocessor .exe"208 OutputFile="../bin/release/Preprocessor2.exe" 209 209 LinkIncremental="1" 210 210 AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;"$(QTDIR)\lib";.\QtGlRenderer\Release" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1919 r1920 2991 2991 // special color code for invalid view cells 2992 2992 m.mDiffuseColor.r = importance; 2993 m.mDiffuseColor. g =vcValid ? 0.0f : 1.0f;2994 m.mDiffuseColor. b= 1.0f - importance;2993 m.mDiffuseColor.b = 1.0f;//vcValid ? 0.0f : 1.0f; 2994 m.mDiffuseColor.g = 1.0f - importance; 2995 2995 2996 2996 //Debug << "importance: " << importance << endl; … … 5650 5650 5651 5651 5652 float VspOspViewCellsManager::UpdateObjectCosts() 5653 { 5654 float maxRenderCost = 0; 5655 5656 cout << "updating object pvs cost ... "; 5657 const long startTime = GetTime(); 5658 5659 ViewCellContainer::const_iterator vit, vit_end = mViewCells.end(); 5660 5661 Intersectable::NewMail(); 5662 5663 const float invViewSpaceVol = 1.0f / GetViewSpaceBox().GetVolume(); 5664 5665 for (vit = mViewCells.begin(); vit != vit_end; ++ vit) 5666 { 5667 ViewCell *vc = *vit; 5668 5669 ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 5670 5671 // output PVS of view cell 5672 while (pit.HasMoreEntries()) 5673 { 5674 ObjectPvsEntry entry = pit.Next(); 5675 5676 BvhNode *node = dynamic_cast<BvhNode *>(entry.mObject); 5677 5678 // hack!! 5679 if (!node->IsLeaf()) 5680 { 5681 cout << "error, can only do leaves" << endl; 5682 return 0; 5683 } 5684 5685 if (!node->Mailed()) 5686 { 5687 node->Mail(); 5688 node->mRenderCost = 0; 5689 } 5690 5691 const float rc = (float)((BvhLeaf *)node)->mObjects.size(); 5692 5693 node->mRenderCost += rc * vc->GetVolume() * invViewSpaceVol; 5694 5695 if (node->mRenderCost > maxRenderCost) 5696 maxRenderCost = node->mRenderCost; 5697 } 5698 } 5699 5700 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3f << " secs" << endl; 5701 5702 return maxRenderCost; 5703 } 5704 5705 5652 5706 void VspOspViewCellsManager::Visualize(const ObjectContainer &objects, 5653 5707 const VssRayContainer &sampleRays) … … 5664 5718 Exporter *exporter = Exporter::GetExporter("final_view_cells.wrl"); 5665 5719 5666 Vector3 scale(0.9f, 0.9f, 0.9f);5667 //Vector3 scale(1.0f, 1.0f, 1.0f);5720 //Vector3 scale(0.9f, 0.9f, 0.9f); 5721 Vector3 scale(1.0f, 1.0f, 1.0f); 5668 5722 5669 5723 if (exporter) … … 5683 5737 bbox.Scale(scale); 5684 5738 5685 if ( 1&& mExportRays)5739 if (0 && mExportRays) 5686 5740 { 5687 5741 exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 5688 5742 } 5689 5743 5690 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects,5691 CLAMP_TO_BOX ? &bbox : NULL, false);5692 5693 5744 // hack color code (show pvs size) 5694 5745 const int savedColorCode = mColorCode; 5695 mColorCode = 1; // export pvs 5746 5747 const float maxRenderCost = UpdateObjectCosts(); 5748 cout << "maxRenderCost: " << maxRenderCost << endl; 5749 mColorCode = 0; // 0 = random, 1 = export pvs 5750 5751 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, 5752 CLAMP_TO_BOX ? &bbox : NULL, maxRenderCost, false); 5753 5696 5754 5697 5755 //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); … … 5704 5762 } 5705 5763 5706 // export final object partition5707 5764 exporter = Exporter::GetExporter("final_object_partition.wrl"); 5708 5765 … … 5714 5771 } 5715 5772 5773 EvaluateViewCellsStats(); 5774 5775 const long starttime = GetTime(); 5776 cout << "exporting final objects (after initial construction + post process) ... "; 5777 5778 // matt: hack for clamping scene 5779 AxisAlignedBox3 bbox = mViewSpaceBox; 5780 bbox.Scale(scale); 5781 5782 // hack color code (show pvs size) 5783 const int savedColorCode = mColorCode; 5784 5785 mColorCode = 1; // 0 = random, 1 = export pvs 5786 const float maxRenderCost = -1; 5787 5788 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, 5789 CLAMP_TO_BOX ? &bbox : NULL, maxRenderCost, false); 5790 5791 5792 //ExportViewCellsForViz(exporter, CLAMP_TO_BOX ? &bbox : NULL, mColorCode, GetClipPlane()); 5793 ExportViewCellsForViz(exporter, NULL, mColorCode, GetClipPlane()); 5794 5795 delete exporter; 5796 5797 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 5798 mColorCode = savedColorCode; 5799 } 5800 5801 #if 0 5802 // export final object partition 5803 exporter = Exporter::GetExporter("final_object_partition.wrl"); 5804 5805 if (exporter) 5806 { 5807 if (CLAMP_TO_BOX) 5808 { 5809 exporter->mClampToBox = true; 5810 } 5811 5716 5812 const long starttime = GetTime(); 5717 5813 … … 5721 5817 5722 5818 cout << "exporting object space hierarchy ... "; 5723 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, CLAMP_TO_BOX ? &bbox : NULL );5819 mHierarchyManager->ExportObjectSpaceHierarchy(exporter, objects, CLAMP_TO_BOX ? &bbox : NULL, -1); 5724 5820 5725 5821 delete exporter; 5726 5822 cout << "finished in " << TimeDiff(starttime, GetTime()) * 1e-3f << " secs" << endl; 5727 5823 } 5728 5824 #endif 5825 5729 5826 // visualization of the view cells 5730 5827 if (0) -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1919 r1920 1029 1029 VssRayContainer *visRays = NULL); 1030 1030 1031 1031 1032 1032 protected: 1033 1033 … … 1162 1162 const string prefix, 1163 1163 VssRayContainer *visRays = NULL); 1164 1165 float UpdateObjectCosts(); 1164 1166 1165 1167 protected:
Note: See TracChangeset
for help on using the changeset viewer.