Changeset 1902 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 12/16/06 14:51:13 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1900 r1902 1549 1549 "false"); 1550 1550 1551 RegisterOption("ViewCells.useKdPvs", 1552 optBool, 1553 "view_cells_use_kd_pvs=", 1554 "false"); 1555 1556 1551 1557 1552 1558 /****************************************************************************/ … … 1999 2005 2000 2006 RegisterOption("VspBspTree.useSplitCostQueue", 2001 optBool,2002 "vsp_bsp_use_split_cost_queue=",2003 "true");2007 optBool, 2008 "vsp_bsp_use_split_cost_queue=", 2009 "true"); 2004 2010 2005 2011 RegisterOption("VspBspTree.Termination.globalCostMissTolerance", -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1900 r1902 27 27 28 28 // $$JB HACK 29 #define USE_KD_PVS 130 31 29 #define KD_PVS_AREA (1e-5f) 32 30 … … 111 109 Environment::GetSingleton()->GetBoolValue("ViewCells.exportBboxesForPvs", mExportBboxesForPvs); 112 110 Environment::GetSingleton()->GetBoolValue("ViewCells.exportPvs", mExportPvs); 113 111 112 Environment::GetSingleton()->GetBoolValue("ViewCells.useKdPvs", mUseKdPvs); 113 114 114 char buf[100]; 115 115 Environment::GetSingleton()->GetStringValue("ViewCells.samplingType", buf); … … 260 260 Debug << "export bounding boxes: " << mExportBboxesForPvs << endl; 261 261 Debug << "export pvs for view cells: " << mExportPvs << endl; 262 Debug << "use kd pvs " << mUseKdPvs << endl; 262 263 Debug << endl; 263 264 } … … 282 283 ViewCellsManager::GetIntersectable(const VssRay &ray, const bool isTermination) const 283 284 { 284 #if USE_KD_PVS 285 float area = GetPreprocessor()->mKdTree->GetBox().SurfaceArea()*KD_PVS_AREA; 286 KdNode *node = GetPreprocessor()->mKdTree->GetNode(isTermination ? 287 ray.mTermination : ray.mOrigin, 288 area); 289 return 290 GetPreprocessor()->mKdTree-> 291 GetOrCreateKdIntersectable(node); 292 #else 293 return isTermination ? ray.mTerminationObject : ray.mOriginObject; 294 #endif 295 } 285 if (mUseKdPvs) 286 { 287 float area = GetPreprocessor()->mKdTree->GetBox().SurfaceArea()*KD_PVS_AREA; 288 KdNode *node = GetPreprocessor()->mKdTree->GetNode(isTermination ? 289 ray.mTermination : ray.mOrigin, 290 area); 291 return GetPreprocessor()->mKdTree->GetOrCreateKdIntersectable(node); 292 } 293 else 294 { 295 return isTermination ? ray.mTerminationObject : ray.mOriginObject; 296 } 297 } 298 296 299 297 300 void … … 785 788 //-- export bounding boxes 786 789 stream << "<BoundingBoxes>" << endl; 787 #if USE_KD_PVS 788 vector<KdIntersectable *>::iterator kit, kit_end = GetPreprocessor()->mKdTree->mKdIntersectables.end(); 789 790 int id = 0; 791 for (kit = GetPreprocessor()->mKdTree->mKdIntersectables.begin(); kit != kit_end; ++ kit, ++ id) 792 { 793 Intersectable *obj = *kit; 794 const AxisAlignedBox3 box = obj->GetBox(); 790 791 if (mUseKdPvs) 792 { 793 vector<KdIntersectable *>::iterator kit, kit_end = GetPreprocessor()->mKdTree->mKdIntersectables.end(); 794 795 int id = 0; 796 for (kit = GetPreprocessor()->mKdTree->mKdIntersectables.begin(); kit != kit_end; ++ kit, ++ id) 797 { 798 Intersectable *obj = *kit; 799 const AxisAlignedBox3 box = obj->GetBox(); 795 800 796 obj->SetId(id); 797 798 stream << "<BoundingBox" << " id=\"" << id << "\"" 799 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 800 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 801 } 802 #else 803 ObjectContainer::const_iterator oit, oit_end = objects.end(); 801 obj->SetId(id); 802 803 stream << "<BoundingBox" << " id=\"" << id << "\"" 804 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 805 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 806 } 807 } 808 else 809 { 810 ObjectContainer::const_iterator oit, oit_end = objects.end(); 804 811 805 for (oit = objects.begin(); oit != oit_end; ++ oit) 806 { 807 const AxisAlignedBox3 box = (*oit)->GetBox(); 808 809 //////////// 810 //-- the bounding boxes 811 stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 812 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 813 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 814 } 815 #endif 812 for (oit = objects.begin(); oit != oit_end; ++ oit) 813 { 814 const AxisAlignedBox3 box = (*oit)->GetBox(); 815 816 //////////// 817 //-- the bounding boxes 818 819 stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 820 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 821 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 822 } 823 } 824 816 825 stream << "</BoundingBoxes>" << endl; 817 826 } … … 2637 2646 pvs.Reserve(viewCell->GetFilteredPvsSize()); 2638 2647 2639 #if !USE_KD_PVS 2640 // first mark all objects from this pvs 2641 while (pit.HasMoreEntries()) { 2642 ObjectPvsEntry entry = pit.Next(); 2643 2644 Intersectable *object = entry.mObject; 2645 object->Mail(); 2648 if (!mUseKdPvs) 2649 { 2650 // first mark all objects from this pvs 2651 while (pit.HasMoreEntries()) 2652 { 2653 ObjectPvsEntry entry = pit.Next(); 2654 Intersectable *object = entry.mObject; 2655 object->Mail(); 2656 } 2646 2657 } 2647 #endif2648 2658 2649 2659 int pvsSize = 0; … … 2770 2780 Debug<<" nPvs size = "<<pvs.GetSize()<<endl; 2771 2781 2772 #if !USE_KD_PVS 2773 // copy the base pvs to the new pvs 2774 pit = basePvs.GetIterator(); 2775 while (pit.HasMoreEntries()) { 2776 ObjectPvsEntry entry = pit.Next(); 2777 pvs.AddSampleDirty(entry.mObject, entry.mData.mSumPdf); 2782 if (!mUseKdPvs) 2783 { 2784 // copy the base pvs to the new pvs 2785 pit = basePvs.GetIterator(); 2786 while (pit.HasMoreEntries()) 2787 { 2788 ObjectPvsEntry entry = pit.Next(); 2789 pvs.AddSampleDirty(entry.mObject, entry.mData.mSumPdf); 2790 } 2778 2791 } 2779 #endif2780 2792 2781 2793 pvs.SimpleSort(); … … 5150 5162 VspOspViewCellsManager::GetIntersectable(const VssRay &ray, const bool isTermination) const 5151 5163 { 5152 #if USE_KD_PVS 5153 return ViewCellsManager::GetIntersectable(ray, isTermination); 5154 #else 5155 return mHierarchyManager->GetIntersectable(ray, isTermination); 5156 #endif 5164 if (mUseKdPvs) 5165 { 5166 return ViewCellsManager::GetIntersectable(ray, isTermination); 5167 } 5168 else 5169 { 5170 return mHierarchyManager->GetIntersectable(ray, isTermination); 5171 } 5157 5172 } 5158 5173 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1887 r1902 684 684 685 685 Preprocessor *mPreprocessor; 686 686 687 /// if bounding boxes should be exported together with the view cells 687 688 bool mExportBboxesForPvs; 689 688 690 /// the clip plane for visualization 689 691 AxisAlignedPlane mClipPlaneForViz; 692 690 693 /// if the visualization is using the clip plane 691 694 bool mUseClipPlaneForViz; 695 692 696 /// Renders the view cells. 693 697 Renderer *mRenderer; 698 694 699 /// Loaded view cells 695 700 ViewCellContainer mViewCells; 701 696 702 /// the view cell hierarchy (i.e., the logical description of view cells) 697 703 ViewCellsTree *mViewCellsTree; … … 748 754 // only for debugging 749 755 VssRayContainer storedRays; 756 757 bool mUseKdPvs; 750 758 751 759 //////////////////
Note: See TracChangeset
for help on using the changeset viewer.