/* ----------------------------------------------------------------------------- This source file is part of the GameTools Project http://www.gametools.org Author: Martin Szydlowski ----------------------------------------------------------------------------- */ #ifndef _KdTreeSceneManager_H__ #define _KdTreeSceneManager_H__ #include #include "OgreKdTree.h" namespace Ogre { class KdTreeSceneNode; class WireBoundingBox; typedef std::list < WireBoundingBox * > WBBList; class KdTreeSceneManager : public SceneManager { public: KdTreeSceneManager(const String& name); //KdTreeSceneManager(const String& name, int maxdepth); ~KdTreeSceneManager(void); virtual const String& getTypeName(void) const; virtual SceneNode* createSceneNode(void); virtual SceneNode* createSceneNode(const String& name); void init( int maxdepth ); void walkTree(KdTree * node, Camera *cam); virtual void _findVisibleObjects(Camera *cam, bool onlyShadowCasters); virtual void setShowBoxes(bool showboxes); virtual bool getShowBoxes(void) const; virtual void _updateNode(KdTreeSceneNode *node); // TODO: virtual bool setOption(const String& strKey, const void* pValue); virtual bool getOption(const String& strKey, void* pDestValue); virtual void clearScene() { // DEBUG must happen before scene is cleared // might be a solution to detach problem //if (mKdTree) // mKdTree->dump(); OGRE_DELETE(mKdTree); SceneManager::clearScene(); } protected: int mMaxDepth; KdTree *mKdTree; bool mShowBoxes; KdTree::BuildMethod mBuildMethod; #ifdef KDTREE_DEBUG int mHighlighLevel; bool mShowAllBoxes; #endif }; /// Factory for KdTreeSceneManager class KdTreeSceneManagerFactory : public SceneManagerFactory { protected: void initMetaData(void) const; public: KdTreeSceneManagerFactory(void) {}; ~KdTreeSceneManagerFactory(void) {}; /// Factory type name static const String FACTORY_TYPE_NAME; SceneManager* createInstance(const String& instanceName); void destroyInstance(SceneManager* instance); }; } // namespace Ogre #endif // _KdTreeSceneManager_H__