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 | void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,
|
---|
46 | GtpVisibility::CullingType type);
|
---|
47 |
|
---|
48 | protected:
|
---|
49 | /** Returns pointer to the bounding box of the node.
|
---|
50 | @param node current hierarchy node
|
---|
51 | @returns bounding box of current node
|
---|
52 | */
|
---|
53 | AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
|
---|
54 | /** Returns squared distance of center of box with respect to the camera .
|
---|
55 | @param cam current camera
|
---|
56 | @param box axis aligned box
|
---|
57 | */
|
---|
58 | Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
|
---|
59 | unsigned int mNumOctreeNodes;
|
---|
60 | };
|
---|
61 | } // namespace Ogre
|
---|
62 |
|
---|
63 | #endif // OctreeHierarchyInterface_H |
---|