1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of the GameTools Project
|
---|
4 | http://www.gametools.org
|
---|
5 |
|
---|
6 | Author: Martin Szydlowski
|
---|
7 | -----------------------------------------------------------------------------
|
---|
8 | */
|
---|
9 |
|
---|
10 | #ifndef _KdTreeSceneManager_H__
|
---|
11 | #define _KdTreeSceneManager_H__
|
---|
12 |
|
---|
13 | #include <OgreSceneManager.h>
|
---|
14 | #include "OgreKdTree.h"
|
---|
15 |
|
---|
16 | namespace Ogre
|
---|
17 | {
|
---|
18 | class KdTreeSceneNode;
|
---|
19 | class WireBoundingBox;
|
---|
20 | typedef std::list < WireBoundingBox * > WBBList;
|
---|
21 |
|
---|
22 | class KdTreeSceneManager : public SceneManager
|
---|
23 | {
|
---|
24 | public:
|
---|
25 | KdTreeSceneManager(const String& name);
|
---|
26 | //KdTreeSceneManager(const String& name, int maxdepth);
|
---|
27 | ~KdTreeSceneManager(void);
|
---|
28 |
|
---|
29 | virtual const String& getTypeName(void) const;
|
---|
30 | virtual SceneNode* createSceneNode(void);
|
---|
31 | virtual SceneNode* createSceneNode(const String& name);
|
---|
32 | void init( int maxdepth );
|
---|
33 | void walkTree(KdTree * node, Camera *cam);
|
---|
34 |
|
---|
35 | virtual void _findVisibleObjects(Camera *cam, bool onlyShadowCasters);
|
---|
36 |
|
---|
37 | virtual void setShowBoxes(bool showboxes);
|
---|
38 | virtual bool getShowBoxes(void) const;
|
---|
39 |
|
---|
40 | virtual void _updateNode(KdTreeSceneNode *node); // TODO:
|
---|
41 |
|
---|
42 | virtual bool setOption(const String& strKey, const void* pValue);
|
---|
43 | virtual bool getOption(const String& strKey, void* pDestValue);
|
---|
44 |
|
---|
45 | virtual void clearScene()
|
---|
46 | {
|
---|
47 | // DEBUG must happen before scene is cleared
|
---|
48 | // might be a solution to detach problem
|
---|
49 | //if (mKdTree)
|
---|
50 | // mKdTree->dump();
|
---|
51 |
|
---|
52 | OGRE_DELETE(mKdTree);
|
---|
53 |
|
---|
54 | SceneManager::clearScene();
|
---|
55 | }
|
---|
56 | protected:
|
---|
57 |
|
---|
58 | int mMaxDepth;
|
---|
59 |
|
---|
60 | KdTree *mKdTree;
|
---|
61 |
|
---|
62 | bool mShowBoxes;
|
---|
63 |
|
---|
64 | KdTree::BuildMethod mBuildMethod;
|
---|
65 | #ifdef KDTREE_DEBUG
|
---|
66 | int mHighlighLevel;
|
---|
67 | bool mShowAllBoxes;
|
---|
68 | #endif
|
---|
69 | };
|
---|
70 |
|
---|
71 |
|
---|
72 |
|
---|
73 | /// Factory for KdTreeSceneManager
|
---|
74 | class KdTreeSceneManagerFactory : public SceneManagerFactory
|
---|
75 | {
|
---|
76 | protected:
|
---|
77 | void initMetaData(void) const;
|
---|
78 | public:
|
---|
79 | KdTreeSceneManagerFactory(void) {};
|
---|
80 | ~KdTreeSceneManagerFactory(void) {};
|
---|
81 | /// Factory type name
|
---|
82 | static const String FACTORY_TYPE_NAME;
|
---|
83 | SceneManager* createInstance(const String& instanceName);
|
---|
84 | void destroyInstance(SceneManager* instance);
|
---|
85 | };
|
---|
86 |
|
---|
87 | } // namespace Ogre
|
---|
88 |
|
---|
89 | #endif // _KdTreeSceneManager_H__ |
---|