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

Revision 2555, 3.5 KB checked in by mattausch, 17 years ago (diff)

added partial implementation of chc++. problem: bounding box rendering in Ogre is VERY slow

RevLine 
[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
8namespace Ogre {
9/**
10        This class implements the hierarchy interface for the Ogre octree hierarchy.
11*/
[130]12class OctreeHierarchyInterface : public SceneNodeHierarchyInterface
[59]13{
14public:
[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);
[2555]35        void TraverseNode2(GtpVisibility::HierarchyNode *node);
[158]36        /** @copydoc HierarchyInterface::RenderNode */
[59]37        void RenderNode(GtpVisibility::HierarchyNode *node);
[74]38        bool IsLeaf(GtpVisibility::HierarchyNode *node) const;
39        bool HasGeometry(GtpVisibility::HierarchyNode *node) const;
[87]40        float GetSquaredDistance(GtpVisibility::HierarchyNode *node) const;
[59]41       
[345]42        void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const;
43        void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const;
[59]44
[74]45        bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const;
46        unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const;
[59]47
[112]48        void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,
[345]49                                                         GtpVisibility::CullingType type) const;
[112]50
[155]51        void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,
[2280]52                                                         GeometryVector *geometryList,
[174]53                                                         bool includeChildren);
54       
[2258]55        void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const;
56
[2259]57        GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *node);
[2258]58
59        bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const;
60
[2259]61        void RenderNodeRecursive(GtpVisibility::HierarchyNode *node);
62
[2292]63        void CollectLeaves(GtpVisibility::HierarchyNode *root,
64                                           GtpVisibility::HierarchyNodeContainer &nodes);
[2259]65
[2306]66        void PullUpLastVisited(GtpVisibility::HierarchyNode *node, const int frameId) const;
[2455]67       
[2332]68        GtpVisibility::HierarchyNode *GetParent(GtpVisibility::HierarchyNode *node);
69
70
[2455]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
[2555]86        void AddToQueue(GtpVisibility::HierarchyNode *node);
[2455]87
[2555]88        void RenderQueue();
89
[59]90protected:
[2259]91
[59]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);
[2455]97
[59]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
Note: See TracBrowser for help on using the repository browser.