- Timestamp:
- 08/01/06 16:55:06 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeSceneManager.h
r1173 r1175 13 13 #include <OgreKdTreeHierarchyInterface.h> 14 14 #include <OgreSceneManager.h> 15 #include <VisibilityManager.h> 15 16 #include "OgreKdTree.h" 16 #include "VisibilityManager.h"17 17 18 18 #define KDTREE_MAX_DEPTH 20 … … 22 22 class KdTreeSceneNode; 23 23 class WireBoundingBox; 24 typedef std::list < WireBoundingBox * > WBBList;24 //typedef std::list < WireBoundingBox * > WBBList; 25 25 26 26 class KdTreeSceneManager : public SceneManager … … 31 31 32 32 virtual const String& getTypeName(void) const; 33 33 34 virtual SceneNode* createSceneNode(void); 34 35 virtual SceneNode* createSceneNode(const String& name); 36 /** Override from SceneManager so that sub entities can be assigned an id for item buffer. 37 */ 38 Entity* createEntity(const String& entityName, const String& meshName); 35 39 40 /** Update the KdTree with the node (more or less disabled now) 41 */ 42 virtual void _updateNode(KdTreeSceneNode *node); // TODO: 43 44 //virtual void _updateSceneGraph(Camera* cam); 36 45 virtual void _findVisibleObjects(Camera *cam, bool onlyShadowCasters); 46 //virtual void _renderVisibleObjects(); 37 47 38 48 virtual void _renderNodes(const KdRenderableList& nodelist, Camera * cam, … … 42 52 virtual bool getShowBoxes(void) const; 43 53 44 virtual void _updateNode(KdTreeSceneNode *node); // TODO:45 46 54 virtual bool setOption(const String& strKey, const void* pValue); 47 55 virtual bool getOption(const String& strKey, void* pDestValue); 56 57 bool getOptionValues(const String & key, StringVector &refValueList); 58 bool getOptionKeys(StringVector &refKeys); 59 60 /** Sets the visibility manager. 61 @param visManager the visibility manager 62 */ 63 void setVisibilityManager(GtpVisibility::VisibilityManager *visManager); 64 /** See set. 65 */ 66 GtpVisibility::VisibilityManager *getVisibilityManager(); 67 68 /** Returns pointer to visibility manager. 69 */ 70 GtpVisibility::VisibilityManager *GetVisibilityManager(); 71 72 /** Returns hierarchy interface. 73 */ 74 KdTreeHierarchyInterface *GetHierarchyInterface(); 75 76 77 ///** Render a queue group. 78 //Override so we can handle delayed rendering of transparent objects 79 //*/ 80 //void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup, 81 // QueuedRenderableCollection::OrganisationMode om); 82 83 ///** Writes out stats into the Ogre log file. 84 //*/ 85 //void WriteLog(); 86 87 ///** Override pass so we can do the z-fail pass. 88 //*/ 89 //const Pass* _setPass(Pass* pass); 90 91 ///** Override from SceneManager so we can skip all but first pass for depth pass. 92 //*/ 93 //bool validatePassForRendering(Pass* pass); 48 94 49 95 virtual void clearScene() … … 64 110 KdTreeHierarchyInterface *mHierarchyInterface; 65 111 112 /// consecutive number for sub-entities 113 int mCurrentEntityId; 114 115 /// flag for passes which should not be deleted from queue during first traversal 116 int mLeavePassesInQueue; 117 66 118 int mMaxDepth; 67 119 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
r1173 r1175 9 9 10 10 #include <OgreCamera.h> 11 #include <OgreSubEntity.h> 11 12 #include "OgreKdTreeSceneManager.h" 12 13 #include "OgreKdTreeSceneNode.h" 13 14 #include "OgreKdTree.h" 15 #include "OgreVisibilityOptionsManager.h" 14 16 15 17 #include <OgreLogManager.h> … … 19 21 { 20 22 KdTreeSceneManager::KdTreeSceneManager(const String& name, GtpVisibility::VisibilityManager *vm): 21 SceneManager(name), mKdTree(0), mVisibilityManager(vm) 23 SceneManager(name), 24 mVisibilityManager(vm), 25 mKdTree(0), 26 mMaxDepth(KDTREE_MAX_DEPTH), 27 mShowBoxes(false), 28 #ifdef KDTREE_DEBUG 29 mHighlighLevel(0), 30 mShowAllBoxes(false), 31 #endif 32 mBuildMethod(KdTree::KDBM_PRIORITYQUEUE), 33 mRenderMethod(KdTree::KDRM_RECURSE), 34 mLeavePassesInQueue(0), 35 mCurrentEntityId(1) 22 36 { 23 37 // Replace root node with my node … … 26 40 mSceneRoot = new KdTreeSceneNode(this, "root node"); 27 41 mSceneRoot->_notifyRootNode(); 28 29 mMaxDepth = KDTREE_MAX_DEPTH;30 mShowBoxes = false;31 32 // kill the old kd-tree if exists33 OGRE_DELETE(mKdTree);34 35 mRenderMethod = KdTree::KDRM_RECURSE;36 37 //mBuildMethod = KdTree::KDBM_RECURSIVE;38 mBuildMethod = KdTree::KDBM_PRIORITYQUEUE;39 #ifdef KDTREE_DEBUG40 mHighlighLevel = 0;41 mShowAllBoxes = false;42 #endif43 42 44 43 mHierarchyInterface = new KdTreeHierarchyInterface(this, mDestRenderSystem); … … 197 196 } 198 197 199 return SceneManager::setOption(strKey, pValue); 198 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 199 .setOption(strKey, pValue) || SceneManager::setOption(strKey, pValue); 200 200 } 201 201 … … 269 269 } 270 270 271 return SceneManager::getOption(strKey, pDestValue); 271 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 272 .getOption(strKey, pDestValue) || SceneManager::getOption(strKey, pDestValue); 273 } 274 275 bool KdTreeSceneManager::getOptionKeys(StringVector &refKeys) 276 { 277 refKeys.push_back("BuildMethod"); 278 refKeys.push_back("KI"); 279 refKeys.push_back("KT"); 280 refKeys.push_back("KdTreeMaxDepth"); 281 refKeys.push_back("RebuildKdTree"); 282 refKeys.push_back("RenderMethod"); 283 refKeys.push_back("ShowKdTree"); 284 refKeys.push_back("TreeBox"); 285 #ifdef KDTREE_DEBUG 286 refKeys.push_back("HighlightLevel"); 287 refKeys.push_back("ShowAllBoxes"); 288 #endif 289 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface) 290 .getOptionKeys(refKeys); 291 } 292 293 bool KdTreeSceneManager::getOptionValues(const String & key, StringVector &refValueList) 294 { 295 return SceneManager::getOptionValues(key, refValueList); 296 } 297 298 void KdTreeSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager) 299 { 300 mVisibilityManager = visManager; 301 } 302 303 GtpVisibility::VisibilityManager * KdTreeSceneManager::getVisibilityManager() 304 { 305 return mVisibilityManager; 306 } 307 308 GtpVisibility::VisibilityManager * KdTreeSceneManager::GetVisibilityManager() 309 { 310 return mVisibilityManager; 311 } 312 313 KdTreeHierarchyInterface * KdTreeSceneManager::GetHierarchyInterface() 314 { 315 return mHierarchyInterface; 272 316 } 273 317 … … 294 338 mSceneNodes[sn->getName()] = sn; 295 339 return sn; 340 } 341 342 Entity * KdTreeSceneManager::createEntity(const String& entityName, const String& meshName) 343 { 344 Entity *ent = SceneManager::createEntity(entityName, meshName); 345 346 for (int i = 0; i < (int)ent->getNumSubEntities(); ++i) 347 { 348 ent->getSubEntity(i)->setId(mCurrentEntityId); 349 } 350 351 // increase counter of entity id values 352 ++ mCurrentEntityId; 353 354 return ent; 296 355 } 297 356 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreVisibilityOptionsManager.cpp
r903 r1175 82 82 refKeys.push_back("NumQueryCulledNodes"); 83 83 refKeys.push_back("NumFrustumCulledNodes"); 84 refKeys.push_back("NumQueriesIssued"); 84 85 85 86 return true;
Note: See TracChangeset
for help on using the changeset viewer.