source: trunk/VUT/Ogre/include/OgreOctreeHierarchyInterface.h @ 155

Revision 155, 2.5 KB checked in by mattausch, 19 years ago (diff)

added node traversal interface

Line 
1#ifndef _OctreeHierarchyInterface_H__
2#define _OctreeHierarchyInterface_H__
3
4#include <OgreOctree.h>
5#include <OgreOctreeSceneManager.h>
6#include "OgreSceneNodeHierarchyInterface.h"
7
8namespace Ogre {
9/**
10        This class implements the hierarchy interface for the Ogre octree hierarchy.
11*/
12class OctreeHierarchyInterface : public SceneNodeHierarchyInterface
13{
14public:
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 which is derived from SceneNode
19                @param num number of nodes in the octree
20        */
21        void SetNumOctreeNodes(unsigned int num);
22
23        /** Gets the given option for the scene traverser.
24            @remarks
25                See setOption
26        */
27        void PullUpVisibility(GtpVisibility::HierarchyNode *node);
28       
29        /** Traverses given node.
30                @param node current node
31                @remark pushes children on a distance queue.
32        */
33        void TraverseAndRenderNode(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        void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,
49                                         GtpVisibility::GeometryList *geometryList,
50                                         bool includeChildren);
51
52        void SetNodeId(GtpVisibility::HierarchyNode *node, int id);
53       
54        int GetNodeId(GtpVisibility::HierarchyNode *node);
55
56        GtpVisibility::HierarchyNode *GetNextNode();
57
58protected:
59        /** Returns pointer to the bounding box of the node.
60                @param node current hierarchy node
61                @returns bounding box of current node
62        */
63        AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
64        /** Returns squared distance of center of box with respect to the camera .
65                @param cam current camera
66                @param box axis aligned box
67        */
68        Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
69
70        int mCurrentOctreePosition;
71};
72} // namespace Ogre
73
74#endif // OctreeHierarchyInterface_H
Note: See TracBrowser for help on using the repository browser.