1 | #ifndef _PlatformHierarchyInterface_H__
|
---|
2 | #define _PlatformHierarchyInterface_H__
|
---|
3 |
|
---|
4 | #include <OgreSceneManager.h>
|
---|
5 | #include <OgrePrerequisites.h>
|
---|
6 | #include <OgreCamera.h>
|
---|
7 | #include <OgreRenderSystem.h>
|
---|
8 |
|
---|
9 | //#include "OgreSolidHalfBoundingBox.h"
|
---|
10 | #include "OgreSolidBoundingBox.h"
|
---|
11 | #include "HierarchyInterface.h"
|
---|
12 | #include "OgrePlatformOcclusionQuery.h"
|
---|
13 |
|
---|
14 | /** This namespace contains the Ogre dependent classes.
|
---|
15 | */
|
---|
16 | namespace Ogre {
|
---|
17 |
|
---|
18 | /** Class which implements a hierarchy interface for a specific type of hierarchy.
|
---|
19 | @remark also provides methods for using occlusion queries on the hierarchy nodes
|
---|
20 | */
|
---|
21 | class PlatformHierarchyInterface: public GtpVisibility::HierarchyInterface
|
---|
22 | {
|
---|
23 | public:
|
---|
24 | /** Construction taking the current scene manager and the current rendersystem as argument
|
---|
25 | @param sm current scene manager
|
---|
26 | @param rsys current render system
|
---|
27 | */
|
---|
28 | PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys);
|
---|
29 | ~PlatformHierarchyInterface();
|
---|
30 |
|
---|
31 | /** Returns next available occlusion query or creates new one.
|
---|
32 | @return the next occlusion query
|
---|
33 | */
|
---|
34 | GtpVisibility::OcclusionQuery *GetNextOcclusionQuery();
|
---|
35 |
|
---|
36 | /** Sets the current camera used for the rendering.
|
---|
37 | @param cam the current camera
|
---|
38 | */
|
---|
39 | void SetCamera(Camera *cam);
|
---|
40 | /** Sets the current camera used for culling.
|
---|
41 | @param cam the current camera
|
---|
42 | @remark the default is the camera used for rendering
|
---|
43 | */
|
---|
44 | void SetCullCamera(Camera *cullCam);
|
---|
45 | /** Initialises this scene traverser for the current frame.
|
---|
46 | @param root root of the hierarchy
|
---|
47 | @param cam current camera
|
---|
48 | @param cullCam the camera used for culling. If null, the current camera is used
|
---|
49 | @remark convenience method wich calls VisibilitySceneTraverser::initFrame,
|
---|
50 | sets the current camera, and initialises the distance queue.
|
---|
51 | */
|
---|
52 | void InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam, Camera *cullCam = NULL);
|
---|
53 | /** Checks if the node is visible from the current view frustum.
|
---|
54 | @param node the current node
|
---|
55 | @param intersects returns true if the current node intersects the near plane
|
---|
56 | */
|
---|
57 | bool CheckFrustumVisible(GtpVisibility::HierarchyNode *node, bool &intersects);
|
---|
58 | /** Sets pointer to the current scene manager.
|
---|
59 | @param sm the scene manager
|
---|
60 | */
|
---|
61 | void SetSceneManager(SceneManager *sm);
|
---|
62 | /** Sets pointer to the current render system
|
---|
63 | @param rsys the rendersystem
|
---|
64 | */
|
---|
65 | void SetRenderSystem(RenderSystem *rsys);
|
---|
66 | /** Returns pointer to bounding box of node.
|
---|
67 | @param node current hierarchy node
|
---|
68 | @returns bounding box of current node
|
---|
69 | */
|
---|
70 | virtual AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node) = 0;
|
---|
71 | /** Issue a occlusion query for this node.
|
---|
72 | @param node the current hierarchy node
|
---|
73 | @param wasVisible if the node was visible in the last frame
|
---|
74 | @returns occlusion query for this node
|
---|
75 | */
|
---|
76 | GtpVisibility::OcclusionQuery *IssueOcclusionQuery(
|
---|
77 | GtpVisibility::HierarchyNode *node, const bool wasVisible);
|
---|
78 |
|
---|
79 | protected:
|
---|
80 | /** Deletes all occlusion queries.
|
---|
81 | */
|
---|
82 | void DeleteQueries();
|
---|
83 | /** Renders bounding box of specified node.
|
---|
84 | @param box the bounding box of the scene node to be rendered
|
---|
85 | */
|
---|
86 | void RenderBoundingBox(AxisAlignedBox *box);
|
---|
87 | /** Returns pointer to current renderable half bounding box geometry
|
---|
88 | */
|
---|
89 | //SolidHalfBoundingBox *GetSolidHalfBoundingBox();
|
---|
90 | /** Returns pointer to current renderable bounding box geometry
|
---|
91 | */
|
---|
92 | SolidBoundingBox *GetSolidBoundingBox();
|
---|
93 |
|
---|
94 | /** one renderable half of an aabb.
|
---|
95 | */
|
---|
96 | SolidBoundingBox *mSolidBoundingBox;
|
---|
97 |
|
---|
98 | SceneManager *mSceneManager;
|
---|
99 | RenderSystem *mRenderSystem;
|
---|
100 |
|
---|
101 | Camera *mCamera;
|
---|
102 | Camera *mCullCamera;
|
---|
103 |
|
---|
104 | AxisAlignedBox mBox;
|
---|
105 |
|
---|
106 | std::vector<PlatformOcclusionQuery *> mOcclusionQueries;
|
---|
107 | };
|
---|
108 |
|
---|
109 | } // namespace Ogre
|
---|
110 |
|
---|
111 | #endif // PlatformHierarchyInterface_H |
---|