1 | #ifndef _OctreeHierarchyInterface_H__
|
---|
2 | #define _OctreeHierarchyInterface_H__
|
---|
3 |
|
---|
4 | #include <OgreOctree.h>
|
---|
5 | #include "OgrePlatformHierarchyInterface.h"
|
---|
6 |
|
---|
7 | namespace Ogre {
|
---|
8 | /**
|
---|
9 | This class implements the hierarchy interface for the Ogre octree hierarchy.
|
---|
10 | */
|
---|
11 | class OctreeHierarchyInterface : public PlatformHierarchyInterface
|
---|
12 | {
|
---|
13 | public:
|
---|
14 | OctreeHierarchyInterface(SceneManager *sm, RenderSystem *rsys);
|
---|
15 |
|
---|
16 | /** Sets the number of nodes in this octree
|
---|
17 | @remark do not confuse this with the OctreeNode class which is derived from SceneNode
|
---|
18 | @param num number of nodes in the octree
|
---|
19 | */
|
---|
20 | void SetNumOctreeNodes(unsigned int num);
|
---|
21 |
|
---|
22 | /** Gets the given option for the scene traverser.
|
---|
23 | @remarks
|
---|
24 | See setOption
|
---|
25 | */
|
---|
26 | //bool getOption( const String &, void * );
|
---|
27 | //bool getOptionKeys( StringVector &refKeys );
|
---|
28 | void PullUpVisibility(GtpVisibility::HierarchyNode *node);
|
---|
29 | /** Traverses given node.
|
---|
30 | @param node current node
|
---|
31 | @remark pushes children on distance queue
|
---|
32 | */
|
---|
33 | void TraverseNode(GtpVisibility::HierarchyNode *node);
|
---|
34 | void RenderNode(GtpVisibility::HierarchyNode *node);
|
---|
35 | bool IsLeaf(GtpVisibility::HierarchyNode *node) const;
|
---|
36 | bool HasGeometry(GtpVisibility::HierarchyNode *node) const;
|
---|
37 | float GetSquaredDistance(GtpVisibility::HierarchyNode *node) const;
|
---|
38 |
|
---|
39 | void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible);
|
---|
40 | void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId);
|
---|
41 |
|
---|
42 | bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
43 | unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const;
|
---|
44 |
|
---|
45 | protected:
|
---|
46 | /** Returns pointer to the bounding box of the node.
|
---|
47 | @param node current hierarchy node
|
---|
48 | @returns bounding box of current node
|
---|
49 | */
|
---|
50 | AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
|
---|
51 | /** Returns squared distance of center of box with respect to the camera .
|
---|
52 | @param cam current camera
|
---|
53 | @param box axis aligned box
|
---|
54 | */
|
---|
55 | Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
|
---|
56 | unsigned int mNumOctreeNodes;
|
---|
57 | };
|
---|
58 | } // namespace Ogre
|
---|
59 |
|
---|
60 | #endif // OctreeHierarchyInterface_H |
---|