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 | void TraverseNode2(GtpVisibility::HierarchyNode *node);
|
---|
36 | /** @copydoc HierarchyInterface::RenderNode */
|
---|
37 | void RenderNode(GtpVisibility::HierarchyNode *node);
|
---|
38 | bool IsLeaf(GtpVisibility::HierarchyNode *node) const;
|
---|
39 | bool HasGeometry(GtpVisibility::HierarchyNode *node) const;
|
---|
40 | float GetSquaredDistance(GtpVisibility::HierarchyNode *node) const;
|
---|
41 |
|
---|
42 | void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const;
|
---|
43 | void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const;
|
---|
44 |
|
---|
45 | bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
46 | unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const;
|
---|
47 |
|
---|
48 | void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,
|
---|
49 | GtpVisibility::CullingType type) const;
|
---|
50 |
|
---|
51 | void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,
|
---|
52 | GeometryVector *geometryList,
|
---|
53 | bool includeChildren);
|
---|
54 |
|
---|
55 | void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const;
|
---|
56 |
|
---|
57 | GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *node);
|
---|
58 |
|
---|
59 | bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
60 |
|
---|
61 | void RenderNodeRecursive(GtpVisibility::HierarchyNode *node);
|
---|
62 |
|
---|
63 | void CollectLeaves(GtpVisibility::HierarchyNode *root,
|
---|
64 | GtpVisibility::HierarchyNodeContainer &nodes);
|
---|
65 |
|
---|
66 | void PullUpLastVisited(GtpVisibility::HierarchyNode *node, const int frameId) const;
|
---|
67 |
|
---|
68 | GtpVisibility::HierarchyNode *GetParent(GtpVisibility::HierarchyNode *node);
|
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 | /** Returns #frames this node is assumed to be visible.
|
---|
73 | */
|
---|
74 | int GetNodeAssumedVisible(GtpVisibility::HierarchyNode *node);
|
---|
75 |
|
---|
76 | /** Sets #frames this node is assumed to be visible.
|
---|
77 | */
|
---|
78 | void SetNodeAssumedVisible(GtpVisibility::HierarchyNode *node, int assumedVisible);
|
---|
79 |
|
---|
80 | /** Decreases #frames this node is assumed to be visible.
|
---|
81 | */
|
---|
82 | void DecNodeAssumedVisible(GtpVisibility::HierarchyNode *node);
|
---|
83 |
|
---|
84 | void RenderGeometryBounds(GtpVisibility::HierarchyNode *node);
|
---|
85 |
|
---|
86 | void AddToQueue(GtpVisibility::HierarchyNode *node);
|
---|
87 |
|
---|
88 | void RenderQueue();
|
---|
89 |
|
---|
90 | protected:
|
---|
91 |
|
---|
92 | /** Returns pointer to the bounding box of the node.
|
---|
93 | @param node current hierarchy node
|
---|
94 | @returns bounding box of current node
|
---|
95 | */
|
---|
96 | AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
|
---|
97 |
|
---|
98 | /** Returns squared distance of center of box with respect to the camera .
|
---|
99 | @param cam current camera
|
---|
100 | @param box axis aligned box
|
---|
101 | */
|
---|
102 | Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
|
---|
103 | };
|
---|
104 | } // namespace Ogre
|
---|
105 |
|
---|
106 | #endif // OctreeHierarchyInterface_H |
---|