source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOctreeHierarchyInterface.h @ 2455

Revision 2455, 3.4 KB checked in by mattausch, 18 years ago (diff)
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
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        GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *node);
57
58        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const;
59
60        void RenderNodeRecursive(GtpVisibility::HierarchyNode *node);
61
62        void CollectLeaves(GtpVisibility::HierarchyNode *root,
63                                           GtpVisibility::HierarchyNodeContainer &nodes);
64
65        void PullUpLastVisited(GtpVisibility::HierarchyNode *node, const int frameId) const;
66       
67        GtpVisibility::HierarchyNode *GetParent(GtpVisibility::HierarchyNode *node);
68
69
70       
71        /** Returns #frames this node is assumed to be visible.
72        */
73        int GetNodeAssumedVisible(GtpVisibility::HierarchyNode *node);
74
75        /** Sets #frames this node is assumed to be visible.
76        */
77        void SetNodeAssumedVisible(GtpVisibility::HierarchyNode *node, int assumedVisible);
78       
79        /** Decreases #frames this node is assumed to be visible.
80        */
81        void DecNodeAssumedVisible(GtpVisibility::HierarchyNode *node);
82
83        void RenderGeometryBounds(GtpVisibility::HierarchyNode *node);
84
85
86protected:
87
88        /** Returns pointer to the bounding box of the node.
89                @param node current hierarchy node
90                @returns bounding box of current node
91        */
92        AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
93
94        /** Returns squared distance of center of box with respect to the camera .
95                @param cam current camera
96                @param box axis aligned box
97        */
98        Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
99};
100} // namespace Ogre
101
102#endif // OctreeHierarchyInterface_H
Note: See TracBrowser for help on using the repository browser.