1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of the GameTools Project
|
---|
4 | http://www.gametools.org
|
---|
5 |
|
---|
6 | Author: Martin Szydlowski
|
---|
7 | -----------------------------------------------------------------------------
|
---|
8 | */
|
---|
9 |
|
---|
10 | #ifndef _OgreKdTreeHierarchyInterface_H_
|
---|
11 | #define _OgreKdTreeHierarchyInterface_H_
|
---|
12 |
|
---|
13 | #include "OgrePlatformHierarchyInterface.h"
|
---|
14 |
|
---|
15 | namespace Ogre
|
---|
16 | {
|
---|
17 |
|
---|
18 | class KdTreeSceneManager;
|
---|
19 |
|
---|
20 | class KdTreeHierarchyInterface : public PlatformHierarchyInterface
|
---|
21 | {
|
---|
22 | public:
|
---|
23 | KdTreeHierarchyInterface(KdTreeSceneManager *sm, RenderSystem *rsys);
|
---|
24 |
|
---|
25 | virtual ~KdTreeHierarchyInterface() {};
|
---|
26 |
|
---|
27 | /** Returns true if current node is leaf of the hierarchy.
|
---|
28 | @param node hierarchy node
|
---|
29 | @returns true if node is leaf
|
---|
30 | */
|
---|
31 | virtual bool IsLeaf(GtpVisibility::HierarchyNode *node) const;
|
---|
32 | /** Traverses and renders the hierarchy from the given node.
|
---|
33 | @param node the hierarchy node
|
---|
34 | */
|
---|
35 | virtual void TraverseNode(GtpVisibility::HierarchyNode *node);
|
---|
36 | /** Renders the given hierarchy node.
|
---|
37 | @param node current hierarchy node to be rendered
|
---|
38 | */
|
---|
39 | virtual void RenderNode(GtpVisibility::HierarchyNode *node);
|
---|
40 | /** Pulls up the visibility from the current node recursively to the parent nodes.
|
---|
41 | @param node the current node
|
---|
42 | */
|
---|
43 | virtual void PullUpVisibility(GtpVisibility::HierarchyNode *node) const;
|
---|
44 |
|
---|
45 | /** Returns distance of the node to the view plane.
|
---|
46 | @param node the hierarchy node
|
---|
47 | */
|
---|
48 | virtual float GetSquaredDistance(GtpVisibility::HierarchyNode *node) const;
|
---|
49 | /** Returns pointer to bounding box of node.
|
---|
50 | @param node current hierarchy node
|
---|
51 | @returns bounding box of current node
|
---|
52 | */
|
---|
53 | virtual AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node);
|
---|
54 | /** Returns true if there is renderable geometry attached to this node
|
---|
55 | @param node the current node
|
---|
56 | @returns if the node has renderable geometry
|
---|
57 | */
|
---|
58 | virtual bool HasGeometry(GtpVisibility::HierarchyNode *node) const;
|
---|
59 | /** Sets the visible flag for this node.
|
---|
60 | @param node the current node
|
---|
61 | @param visible the visible flag
|
---|
62 | */
|
---|
63 | virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node,
|
---|
64 | const bool visible) const;
|
---|
65 | /** Returns true if node has the visible flag set. See set
|
---|
66 | */
|
---|
67 | virtual bool IsNodeVisible(GtpVisibility::HierarchyNode *node) const;
|
---|
68 | /** Sets the last visited frame id for this node.
|
---|
69 | @param node the current node
|
---|
70 | @param frameId the current frame id
|
---|
71 | */
|
---|
72 | virtual void SetLastVisited(GtpVisibility::HierarchyNode *node,
|
---|
73 | const unsigned int frameId) const;
|
---|
74 | /** Returns frame id when this node was last visited by the traverser. See set
|
---|
75 | */
|
---|
76 | virtual unsigned int LastVisited(GtpVisibility::HierarchyNode *node) const;
|
---|
77 |
|
---|
78 |
|
---|
79 | /** Visualization of a culled node, dependent on the culling type.
|
---|
80 | @param node the hierarchy node to be visualized
|
---|
81 | @param type can be one of FRUSTUM_CULLED, QUERY_CULLED
|
---|
82 | */
|
---|
83 | virtual void VisualizeCulledNode(GtpVisibility::HierarchyNode *node,
|
---|
84 | GtpVisibility::CullingType type) const;
|
---|
85 |
|
---|
86 |
|
---|
87 | /** Returns the geometry of a given hierarchy node.
|
---|
88 | @param node the hierarchy node containing the geometry
|
---|
89 | @param geometryList geometry is returned in this list
|
---|
90 | @param includeChildren if the geometry of the children should be taken into account
|
---|
91 | */
|
---|
92 | virtual void GetNodeGeometryList(GtpVisibility::HierarchyNode *node,
|
---|
93 | GeometryVector *geometryList,
|
---|
94 | bool includeChildren);
|
---|
95 |
|
---|
96 | void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {}
|
---|
97 |
|
---|
98 | GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *root) { return NULL;}
|
---|
99 |
|
---|
100 | bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;}
|
---|
101 |
|
---|
102 | void CollectLeaves(GtpVisibility::HierarchyNode *root,
|
---|
103 | GtpVisibility::HierarchyNodeContainer &nodes) {};
|
---|
104 |
|
---|
105 | void RenderNodeRecursive(GtpVisibility::HierarchyNode *node) {};
|
---|
106 | };
|
---|
107 |
|
---|
108 | } // namespace Ogre
|
---|
109 |
|
---|
110 | #endif // _OgreKdTreeHierarchyInterface_H_ |
---|