[59] | 1 | #ifndef _OctreeHierarchyInterface_H__
|
---|
| 2 | #define _OctreeHierarchyInterface_H__
|
---|
| 3 |
|
---|
| 4 | #include <OgreOctree.h>
|
---|
[130] | 5 | #include <OgreOctreeSceneManager.h>
|
---|
| 6 | #include "OgreSceneNodeHierarchyInterface.h"
|
---|
[59] | 7 |
|
---|
| 8 | namespace Ogre {
|
---|
| 9 | /**
|
---|
| 10 | This class implements the hierarchy interface for the Ogre octree hierarchy.
|
---|
| 11 | */
|
---|
[130] | 12 | class OctreeHierarchyInterface : public SceneNodeHierarchyInterface
|
---|
[59] | 13 | {
|
---|
| 14 | public:
|
---|
[130] | 15 | OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys);
|
---|
[59] | 16 |
|
---|
| 17 | /** Sets the number of nodes in this octree
|
---|
[2278] | 18 | @remark do not confuse this with the OctreeNode class
|
---|
| 19 | which is derived from SceneNode.
|
---|
[59] | 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 | */
|
---|
[345] | 28 | void PullUpVisibility(GtpVisibility::HierarchyNode *node) const;
|
---|
[154] | 29 |
|
---|
[158] | 30 | /** Traverses and renders the given node.
|
---|
[59] | 31 | @param node current node
|
---|
[155] | 32 | @remark pushes children on a distance queue.
|
---|
[59] | 33 | */
|
---|
[158] | 34 | void TraverseNode(GtpVisibility::HierarchyNode *node);
|
---|
| 35 | /** @copydoc HierarchyInterface::RenderNode */
|
---|
[59] | 36 | void RenderNode(GtpVisibility::HierarchyNode *node);
|
---|
[74] | 37 | bool IsLeaf(GtpVisibility::HierarchyNode *node) const;
|
---|
| 38 | bool HasGeometry(GtpVisibility::HierarchyNode *node) const;
|
---|
[87] | 39 | float GetSquaredDistance(GtpVisibility::HierarchyNode *node) const;
|
---|
[59] | 40 |
|
---|
[345] | 41 | void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const;
|
---|
| 42 | void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const;
|
---|
[59] | 43 |
|
---|
[74] | 44 | bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
| 45 | unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const;
|
---|
[59] | 46 |
|
---|
[112] | 47 | void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,
|
---|
[345] | 48 | GtpVisibility::CullingType type) const;
|
---|
[112] | 49 |
|
---|
[155] | 50 | void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,
|
---|
[2280] | 51 | GeometryVector *geometryList,
|
---|
[174] | 52 | bool includeChildren);
|
---|
| 53 |
|
---|
[2258] | 54 | void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const;
|
---|
| 55 |
|
---|
| 56 | void TraverseNode2(GtpVisibility::HierarchyNode *node);
|
---|
| 57 |
|
---|
[2259] | 58 | GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *node);
|
---|
[2258] | 59 |
|
---|
| 60 | bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
| 61 |
|
---|
[2259] | 62 | void RenderNodeRecursive(GtpVisibility::HierarchyNode *node);
|
---|
| 63 |
|
---|
| 64 |
|
---|
[59] | 65 | protected:
|
---|
[2259] | 66 |
|
---|
[59] | 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 |
---|