1 | #ifndef _OctreeHierarchyInterface_H__
|
---|
2 | #define _OctreeHierarchyInterface_H__
|
---|
3 |
|
---|
4 | #include <OgreOctree.h>
|
---|
5 | #include <OgreOctreeSceneManager.h>
|
---|
6 | #include "OgreSceneNodeHierarchyInterface.h"
|
---|
7 |
|
---|
8 | namespace Ogre {
|
---|
9 | /**
|
---|
10 | This class implements the hierarchy interface for the Ogre octree hierarchy.
|
---|
11 | */
|
---|
12 | class OctreeHierarchyInterface : public SceneNodeHierarchyInterface
|
---|
13 | {
|
---|
14 | public:
|
---|
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 | //bool getOption( const String &, void * );
|
---|
28 | //bool getOptionKeys( StringVector &refKeys );
|
---|
29 | void PullUpVisibility(GtpVisibility::HierarchyNode *node);
|
---|
30 | /** Traverses given node.
|
---|
31 | @param node current node
|
---|
32 | @remark pushes children on distance queue
|
---|
33 | */
|
---|
34 | void TraverseNode(GtpVisibility::HierarchyNode *node);
|
---|
35 | void RenderNode(GtpVisibility::HierarchyNode *node);
|
---|
36 | bool IsLeaf(GtpVisibility::HierarchyNode *node) const;
|
---|
37 | bool HasGeometry(GtpVisibility::HierarchyNode *node) const;
|
---|
38 | float GetSquaredDistance(GtpVisibility::HierarchyNode *node) const;
|
---|
39 |
|
---|
40 | void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible);
|
---|
41 | void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId);
|
---|
42 |
|
---|
43 | bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
44 | unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const;
|
---|
45 |
|
---|
46 | void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,
|
---|
47 | GtpVisibility::CullingType type);
|
---|
48 |
|
---|
49 | /*bool FindVisibleObjects(GtpVisibility::HierarchyNode *node,
|
---|
50 | InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
|
---|
51 | bool includeChildren = false);*/
|
---|
52 | void GetGeometry(GtpVisibility::HierarchyNode *node,
|
---|
53 | GtpVisibility::GeometryList *geometryList,
|
---|
54 | bool includeChildren);
|
---|
55 |
|
---|
56 | protected:
|
---|
57 | /** Returns pointer to the bounding box of the node.
|
---|
58 | @param node current hierarchy node
|
---|
59 | @returns bounding box of current node
|
---|
60 | */
|
---|
61 | AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
|
---|
62 | /** Returns squared distance of center of box with respect to the camera .
|
---|
63 | @param cam current camera
|
---|
64 | @param box axis aligned box
|
---|
65 | */
|
---|
66 | Real GetSquaredViewDepth(const Camera* cam, const AxisAlignedBox* box) const;
|
---|
67 | /** number of octree hierarchy nodes */
|
---|
68 | unsigned int mNumOctreeNodes;
|
---|
69 | };
|
---|
70 | } // namespace Ogre
|
---|
71 |
|
---|
72 | #endif // OctreeHierarchyInterface_H |
---|