[59] | 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);
|
---|
| 36 | bool HasGeometry(GtpVisibility::HierarchyNode *node);
|
---|
| 37 | bool HasGreaterDistance(GtpVisibility::HierarchyNode *node1,
|
---|
| 38 | GtpVisibility::HierarchyNode *node2);
|
---|
| 39 |
|
---|
| 40 | void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible);
|
---|
| 41 | void SetLastVisited(GtpVisibility::HierarchyNode *node, const int frameId);
|
---|
| 42 |
|
---|
| 43 | bool IsNodeVisible(GtpVisibility::HierarchyNode *node);
|
---|
| 44 | int LastVisited(GtpVisibility::HierarchyNode *node);
|
---|
| 45 |
|
---|
| 46 | protected:
|
---|
| 47 | /** Returns pointer to the bounding box of the node.
|
---|
| 48 | @param node current hierarchy node
|
---|
| 49 | @returns bounding box of current node
|
---|
| 50 | */
|
---|
| 51 | AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
|
---|
| 52 | /** Returns squared distance of center of box with respect to the camera .
|
---|
| 53 | @param cam current camera
|
---|
| 54 | @param box axis aligned box
|
---|
| 55 | */
|
---|
| 56 | Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
|
---|
| 57 | unsigned int mNumOctreeNodes;
|
---|
| 58 | };
|
---|
| 59 | } // namespace Ogre
|
---|
| 60 |
|
---|
| 61 | #endif // OctreeHierarchyInterface_H |
---|