Changeset 863 for GTP/trunk/Lib/Vis/OnlineCullingCHC
- Timestamp:
- 04/29/06 19:11:23 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h
r828 r863 12 12 #include "VisibilityManager.h" 13 13 #include "ViewCellsManager.h" 14 15 //class GtpVisibilityPreprocessor::ViewCellsManager; 14 16 15 17 … … 118 120 void InitVisibilityCulling(Camera *cam); 119 121 122 /** Finds object corresponding to this bounding box in the scene. 123 */ 124 MovableObject *FindCorrespondingObject(const AxisAlignedBox &box); 125 126 /** Identifies objects in the scene and gives them unique ids that 127 correspond to preprocessor ids. 128 */ 129 void IdentifyObjects(GtpVisibilityPreprocessor::ObjectContainer &objects); 130 120 131 /// the interface to the scene hierarchy. 121 132 OctreeHierarchyInterface *mHierarchyInterface; … … 164 175 /// Always execute the vertex program of a pass, e.g., for the depth pass or item buffer 165 176 bool mExecuteVertexProgramForAllPasses; 166 177 /// if hierarchical culling is currently in use 167 178 bool mIsHierarchicalCulling; 168 179 169 ViewCellsManager *mViewCellsManager;180 GtpVisibilityPreprocessor::ViewCellsManager *mViewCellsManager; 170 181 }; 171 182 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreTypeConverter.h
r860 r863 1 1 #ifndef _OgreTypeConverter_H__ 2 2 #define _OgreTypeConverter_H__ 3 3 4 #include "OgreAxisAlignedBox.h" 4 5 #include "AxisAlignedBox3.h" 5 #include "OgreAxisAlignedBox.h"6 6 #include "Vector3.h" 7 #include "OgreVector3.h"8 7 9 8 10 9 namespace Ogre { 11 10 12 11 /** 13 Class which converts our types to OGRE types12 Class which converts preprocessor types to OGRE types 14 13 */ 15 14 class __declspec(dllexport) OgreTypeConverter 16 15 { 17 16 public: 18 17 /** Converts Ogre AABB to preprocessor AABB. 18 */ 19 19 static GtpVisibilityPreprocessor::AxisAlignedBox3 ConvertFromOgre(const AxisAlignedBox &box); 20 /** Converts Ogre vector to preprocessor vector. 21 */ 20 22 static GtpVisibilityPreprocessor::Vector3 ConvertFromOgre(const Vector3 &v); 21 23 /** Converts preprocessor AABB to Ogre AABB. 24 */ 22 25 static AxisAlignedBox ConvertToOgre(const GtpVisibilityPreprocessor::AxisAlignedBox3 &box); 26 /** Converts preprocessor vector to Ogre vector. 27 */ 23 28 static Vector3 ConvertToOgre(const GtpVisibilityPreprocessor::Vector3 &v); 24 29 }; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityOctreeSceneManager.h
r828 r863 104 104 void InitVisibilityCulling(Camera *cam); 105 105 106 107 106 108 /// the interface to the scene hierarchy. 107 109 OctreeHierarchyInterface *mHierarchyInterface; -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/scripts/Plugin_VisibilitySceneManager.vcproj
r860 r863 88 88 EnableFiberSafeOptimizations="TRUE" 89 89 OptimizeForProcessor="2" 90 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\ include"90 AdditionalIncludeDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Dependencies\include";..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src" 91 91 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GTP_VISIBILITY_MODIFIED_OGRE" 92 92 StringPooling="TRUE" … … 198 198 </File> 199 199 <File 200 RelativePath="..\include\OgreMeshInstance.h"> 201 </File> 202 <File 200 203 RelativePath="..\include\OgreOcclusionQueriesQueryManager.h"> 201 204 </File> … … 234 237 Name="Source Files" 235 238 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 239 <File 240 RelativePath="..\src\OgreMeshInstance.cpp"> 241 </File> 236 242 <File 237 243 RelativePath="..\src\OgreOcclusionQueriesQueryManager.cpp"> -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r860 r863 1 1 #include "OgreOcclusionCullingSceneManager.h" 2 2 #include "OgreVisibilityOptionsManager.h" 3 #include "OgreTypeConverter.h" 3 4 #include <OgreMath.h> 4 5 #include <OgreIteratorWrappers.h> … … 9 10 #include <OgreEntity.h> 10 11 #include <OgreSubEntity.h> 12 #include <OgreIteratorWrappers.h> 11 13 #include "VspBspTree.h" 12 #include <OgreIteratorWrappers.h> 14 #include "Containers.h" 15 #include "ViewCellsManager.h" 13 16 14 17 namespace Ogre { … … 38 41 mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 39 42 40 //mDisplayNodes = true; 41 //mShowBoundingBoxes = true; 42 //mShowBoxes = true; 43 //std::stringstream d; d << "here555"; 44 //mDummyLog.open(""); 45 43 #if 0 44 mDisplayNodes = true; 45 mShowBoundingBoxes = true; 46 mShowBoxes = true; 47 #endif 46 48 // TODO: set maxdepth to reasonable value 47 49 mMaxDepth = 50; … … 836 838 } 837 839 838 /*bool OcclusionCullingSceneManager::CompareBoundingBoxes(const AxisAlignedBox &boxa, 839 const AxisAlignedBox &boxb) 840 { 841 } 842 */ 843 void OcclusionCullingSceneManager::LoadViewCells(string filename) 844 { 845 ObjectContainer objects; 846 mViewCellsManager->LoadViewCells(filename, &objects); 847 848 AxisAlignedBox box; 840 841 MovableObject *OcclusionCullingSceneManager::FindCorrespondingObject(const AxisAlignedBox &box) 842 { 849 843 list<SceneNode *> sceneNodeList; 850 844 … … 853 847 list<SceneNode *>::const_iterator sit, sit_end = sceneNodeList.end(); 854 848 855 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(); ++ sit) 849 bool overlap = false; 850 851 MovableObject *bestFittingObj = NULL; 852 float bestFit = 0.0; 853 854 // find the bbox which is closest to the current bbox 855 for (sit = sceneNodeList.begin(); sit != sceneNodeList.end(), !overlap; ++ sit) 856 856 { 857 857 SceneNode *sn = *sit; 858 858 SceneNode::ObjectIterator oit = sn->getAttachedObjectIterator(); 859 859 860 861 860 while (oit.hasMoreElements()) 861 { 862 862 MovableObject *mo = oit.getNext(); 863 AxisAlignedBox bbox = mo->getWorldBoundingBox(); 864 // CompareBoundingBoxes(*oit, box); 865 } 863 const AxisAlignedBox bbox = mo->getWorldBoundingBox(); 864 865 const float overlap = GtpVisibilityPreprocessor::FactorOfOverlap( 866 OgreTypeConverter::ConvertFromOgre(bbox), 867 OgreTypeConverter::ConvertFromOgre(box)); 868 869 if (overlap > bestFit) 870 { 871 bestFit = overlap; 872 bestFittingObj = mo; 873 874 // perfect fit => object found 875 if (overlap > (1.0 - GtpVisibilityPreprocessor::Limits::Small)) 876 break; 877 } 878 } 879 } 880 881 return bestFittingObj; 882 } 883 884 885 void OcclusionCullingSceneManager::LoadViewCells(string filename) 886 { 887 GtpVisibilityPreprocessor::ObjectContainer objects; 888 // identify the corresponding Ogre meshes using the bounding boxes 889 IdentifyObjects(objects); 890 891 // load the view cells assigning the found objects to the pvss 892 mViewCellsManager->LoadViewCells(filename, &objects); 893 } 894 895 896 void OcclusionCullingSceneManager::IdentifyObjects(GtpVisibilityPreprocessor::ObjectContainer &objects) 897 { 898 const string bboxesFilename = "boxes.out"; 899 900 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer iboxes; 901 mViewCellsManager->LoadBoundingBoxes(bboxesFilename, iboxes); 902 903 GtpVisibilityPreprocessor::IndexedBoundingBoxContainer:: 904 const_iterator iit, iit_end = iboxes.end(); 905 906 for (iit = iboxes.begin(); iit != iit_end; ++ iit) 907 { 908 const GtpVisibilityPreprocessor::AxisAlignedBox3 box = (*iit).second; 909 const AxisAlignedBox currentBox = OgreTypeConverter::ConvertToOgre(box); 910 911 MovableObject *mo = FindCorrespondingObject(currentBox); 912 913 //objects.push_back(mi); 866 914 } 867 915 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp
r860 r863 2 2 3 3 4 GtpVisibilityPreprocessor::AxisAlignedBox3 Ogre::OgreTypeConverter::ConvertFromOgre(const Ogre::AxisAlignedBox &box) 4 namespace Ogre 5 5 { 6 7 GtpVisibilityPreprocessor::AxisAlignedBox3 OgreTypeConverter::ConvertFromOgre(const AxisAlignedBox &box) 8 { 9 const GtpVisibilityPreprocessor::Vector3 bmin = ConvertFromOgre(box.getMinimum()); 10 const GtpVisibilityPreprocessor::Vector3 bmax = ConvertFromOgre(box.getMaximum()); 11 12 return GtpVisibilityPreprocessor::AxisAlignedBox3(bmin, bmax); 6 13 } 7 14 8 GtpVisibilityPreprocessor::Vector3 Ogre ::OgreTypeConverter::ConvertFromOgre(const Ogre::Vector3 &v)15 GtpVisibilityPreprocessor::Vector3 OgreTypeConverter::ConvertFromOgre(const Vector3 &v) 9 16 { 17 return GtpVisibilityPreprocessor::Vector3(v.x, v.y, v.z); 10 18 } 11 19 12 Ogre::AxisAlignedBox Ogre::OgreTypeConverter::ConvertToOgre(const GtpVibilityPreprocessor::AxisAlignedBox3 &box)20 AxisAlignedBox OgreTypeConverter::ConvertToOgre(const GtpVisibilityPreprocessor::AxisAlignedBox3 &box) 13 21 { 22 const Vector3 bmin = ConvertToOgre(box.Min()); 23 const Vector3 bmax = ConvertToOgre(box.Max()); 24 25 return AxisAlignedBox(bmin, bmax); 14 26 } 15 27 16 Ogre::Vector3 Ogre::OgreTypeConverter::ConvertToOgre(const GtpVibilityPreprocessor::Vector3 &v)28 Vector3 OgreTypeConverter::ConvertToOgre(const GtpVisibilityPreprocessor::Vector3 &v) 17 29 { 30 return Vector3(v.getX(), v.getY(), v.getZ()); 18 31 } 32 }
Note: See TracChangeset
for help on using the changeset viewer.