Changeset 1203 for GTP/trunk/Lib
- Timestamp:
- 08/13/06 21:40:58 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
r1195 r1203 17 17 #define KDBRANCHPTR_CAST(a) (static_cast<KdTree::Branch *>(a)) 18 18 #define KDLEAFPTR_CAST(a) (static_cast<KdTree::Leaf *>(a)) 19 20 #define KDTREE_LOGNAME "KdTreeBuild.log" 19 21 20 22 #include <OgreAxisAlignedBox.h> -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h
r1192 r1203 22 22 23 23 class KdTreeSceneNode; 24 //class WireBoundingBox;25 24 26 25 class KdTreeSceneManager : public SceneManager -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneNode.h
r1187 r1203 28 28 ~KdTreeSceneNode() {}; 29 29 30 // calculate all-enclosing AABB, similar to _updateBounds()31 void forceComputeAABB(AxisAlignedBox& aabb); // OBSOLETE !!32 33 30 // gather info for kd-tree creation 34 31 virtual void computeScene(PlaneEventList& events, AxisAlignedBox& aabb, int& nObjects, bool includeChildren = true); … … 41 38 42 39 // return a bounding box enclosing all objects 43 virtual AxisAlignedBox getBoundingBox() const; 44 45 // custom render op, show bounding box instead of axes 46 //virtual void getRenderOperation(RenderOperation& op); 47 48 //virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue, 49 // bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false); 40 virtual AxisAlignedBox getBoundingBox(void) const; 50 41 51 42 // DEBUG 52 String dumpToString( );43 String dumpToString(void); 53 44 protected: 54 45 virtual void _updateBounds(void); 55 46 56 //AxisAlignedBox mLocalAABB; 47 typedef std::set<String> StringSet; 48 49 static StringSet& getExcludedMovables(void); 57 50 }; 58 51 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp
r1195 r1203 21 21 #include <OgreMaterialManager.h> 22 22 23 #define KDTREE_LOGNAME "KdTreeBuild.log"24 23 #define PLT_SIZE 101 25 24 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneNode.cpp
r1195 r1203 43 43 /* TODO: find a generic solution where MOVABLE nodes are NOT INSERTED into the KDTREE */ 44 44 /**************************************************************************************/ 45 if (mName == "PlayerCamNode")46 return;45 //if (mName == "PlayerCamNode") 46 // return; 47 47 48 48 // first compute nodes AABB … … 52 52 for (i = mObjectsByName.begin(); i != mObjectsByName.end(); ++i) 53 53 { 54 // Merge world bounds of each object 55 mWorldAABB.merge(i->second->getWorldBoundingBox(true)); 54 // ignore objects with no actual geometry like frustums & lights 55 if (getExcludedMovables().find(i->second->getMovableType()) == getExcludedMovables().end()) 56 { 57 //LogManager::getSingleton().getLog(KDTREE_LOGNAME)->logMessage("Adding movable type " + i->second->getMovableType() + " to KdTree"); 58 // Merge world bounds of each object 59 mWorldAABB.merge(i->second->getWorldBoundingBox(true)); 60 } 56 61 } 57 62 63 // create information for KdTree/SAH 58 64 if (!mWorldAABB.isNull()) 59 65 { 60 66 // merge aabb with global AABB 61 67 aabb.merge(mWorldAABB); 68 62 69 // increase object count 63 70 nObjects++; … … 68 75 Vector3 min = mWorldAABB.getMinimum(); 69 76 Vector3 max = mWorldAABB.getMaximum(); 70 //PlaneEvent * e;71 77 for (int i = 0; i < 3; i++) 72 78 { … … 148 154 149 155 // recalculate the world aabb 150 AxisAlignedBox KdTreeSceneNode::getBoundingBox( ) const156 AxisAlignedBox KdTreeSceneNode::getBoundingBox(void) const 151 157 { 152 #if 0 153 AxisAlignedBox box;158 return mWorldAABB; 159 } 154 160 155 // Update bounds from own attached objects 156 ObjectMap::const_iterator it = mObjectsByName.begin(); 157 ObjectMap::const_iterator end = mObjectsByName.end(); 158 for ( ; it != end ; ++it) 161 KdTreeSceneNode::StringSet& KdTreeSceneNode::getExcludedMovables(void) 162 { 163 static StringSet sExluded; 164 165 // initialise once 166 if (sExluded.empty()) 159 167 { 160 // Merge world bounds of each object 161 box.merge(it->second->getWorldBoundingBox(true)); 168 sExluded.insert("Camera"); 169 sExluded.insert("Frustum"); 170 sExluded.insert("Light"); 162 171 } 163 172 164 if (box.getMinimum() != mWorldAABB.getMinimum() ||box.getMaximum() != mWorldAABB.getMaximum()) 165 { 166 try 167 { 168 Log * log = LogManager::getSingleton().getLog("KdTreeBuild.log"); 169 log->logMessage("mWorldAABB was not up to date"); 170 } 171 catch (Exception) 172 { 173 // F.U. 174 } 175 } 176 177 return box; 178 #else 179 return mWorldAABB; 180 #endif 173 return sExluded; 181 174 } 182 175 183 //void KdTreeSceneNode::getRenderOperation(RenderOperation& op)184 //{185 // if (mWireBoundingBox == NULL)186 // {187 // mWireBoundingBox = new WireBoundingBox();188 // }189 190 // mWireBoundingBox->setupBoundingBox(mWorldAABB);191 // mWireBoundingBox->getRenderOperation(op);192 //}193 194 176 // DEBUG 195 String KdTreeSceneNode::dumpToString( )177 String KdTreeSceneNode::dumpToString(void) 196 178 { 197 179 String objects;
Note: See TracChangeset
for help on using the changeset viewer.