1 | #ifndef _OctreeHierarchyInterface_H__
|
---|
2 | #define _OctreeHierarchyInterface_H__
|
---|
3 |
|
---|
4 | #include <OgreOctree.h>
|
---|
5 | #include <OgreOctreeSceneManager.h>
|
---|
6 | #include "OgreSceneNodeHierarchyInterface.h"
|
---|
7 |
|
---|
8 | namespace Ogre {
|
---|
9 | /**
|
---|
10 | This class implements the hierarchy interface for the Ogre octree hierarchy.
|
---|
11 | */
|
---|
12 | class OctreeHierarchyInterface : public SceneNodeHierarchyInterface
|
---|
13 | {
|
---|
14 | public:
|
---|
15 | OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys);
|
---|
16 |
|
---|
17 | /** Sets the number of nodes in this octree
|
---|
18 | @remark do not confuse this with the OctreeNode class
|
---|
19 | which is derived from SceneNode.
|
---|
20 | @param num number of nodes in the octree
|
---|
21 | */
|
---|
22 | void SetNumOctreeNodes(unsigned int num);
|
---|
23 |
|
---|
24 | /** Gets the given option for the scene traverser.
|
---|
25 | @remarks
|
---|
26 | See setOption
|
---|
27 | */
|
---|
28 | void PullUpVisibility(GtpVisibility::HierarchyNode *node) const;
|
---|
29 |
|
---|
30 | /** Traverses and renders the given node.
|
---|
31 | @param node current node
|
---|
32 | @remark pushes children on a distance queue.
|
---|
33 | */
|
---|
34 | void TraverseNode(GtpVisibility::HierarchyNode *node);
|
---|
35 | /** @copydoc HierarchyInterface::RenderNode */
|
---|
36 | void RenderNode(GtpVisibility::HierarchyNode *node);
|
---|
37 | bool IsLeaf(GtpVisibility::HierarchyNode *node) const;
|
---|
38 | bool HasGeometry(GtpVisibility::HierarchyNode *node) const;
|
---|
39 | float GetSquaredDistance(GtpVisibility::HierarchyNode *node) const;
|
---|
40 |
|
---|
41 | void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const;
|
---|
42 | void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const;
|
---|
43 |
|
---|
44 | bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
45 | unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const;
|
---|
46 |
|
---|
47 | void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,
|
---|
48 | GtpVisibility::CullingType type) const;
|
---|
49 |
|
---|
50 | void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,
|
---|
51 | GeometryVector *geometryList,
|
---|
52 | bool includeChildren);
|
---|
53 |
|
---|
54 | void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const;
|
---|
55 |
|
---|
56 | void TraverseNode2(GtpVisibility::HierarchyNode *node);
|
---|
57 |
|
---|
58 | GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *node);
|
---|
59 |
|
---|
60 | bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
61 |
|
---|
62 | void RenderNodeRecursive(GtpVisibility::HierarchyNode *node);
|
---|
63 |
|
---|
64 |
|
---|
65 | protected:
|
---|
66 |
|
---|
67 | /** Returns pointer to the bounding box of the node.
|
---|
68 | @param node current hierarchy node
|
---|
69 | @returns bounding box of current node
|
---|
70 | */
|
---|
71 | AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
|
---|
72 | /** Returns squared distance of center of box with respect to the camera .
|
---|
73 | @param cam current camera
|
---|
74 | @param box axis aligned box
|
---|
75 | */
|
---|
76 | Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
|
---|
77 | };
|
---|
78 | } // namespace Ogre
|
---|
79 |
|
---|
80 | #endif // OctreeHierarchyInterface_H |
---|