[59] | 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 |
|
---|
[92] | 9 | //#include "OgreSolidHalfBoundingBox.h"
|
---|
| 10 | #include "OgreSolidBoundingBox.h"
|
---|
[59] | 11 | #include "HierarchyInterface.h"
|
---|
| 12 | #include "OgrePlatformOcclusionQuery.h"
|
---|
| 13 |
|
---|
[71] | 14 | /** This namespace contains the Ogre dependent classes.
|
---|
| 15 | */
|
---|
[59] | 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.
|
---|
| 37 | @param cam the current camera
|
---|
| 38 | */
|
---|
| 39 | void SetCamera(Camera *cam);
|
---|
| 40 |
|
---|
| 41 | /** Initialises this scene traverser for the current frame.
|
---|
| 42 | @param root root of the hierarchy
|
---|
| 43 | @param cam current camera
|
---|
| 44 | @remark convenience method wich calls VisibilitySceneTraverser::initFrame,
|
---|
| 45 | sets the current camera, and initialises the distance queue.
|
---|
| 46 | */
|
---|
| 47 | void InitFrame(GtpVisibility::HierarchyNode *root, Ogre::Camera *cam);
|
---|
| 48 | /** Checks if the node is visible from the current view frustum.
|
---|
| 49 | @param node the current node
|
---|
| 50 | @param intersects returns true if the current node intersects the near plane
|
---|
| 51 | */
|
---|
| 52 | bool CheckFrustumVisible(GtpVisibility::HierarchyNode *node, bool &intersects);
|
---|
| 53 | /** Sets pointer to the current scene manager.
|
---|
| 54 | @param sm the scene manager
|
---|
| 55 | */
|
---|
| 56 | void SetSceneManager(SceneManager *sm);
|
---|
| 57 | /** Sets pointer to the current render system
|
---|
| 58 | @param rsys the rendersystem
|
---|
| 59 | */
|
---|
| 60 | void SetRenderSystem(RenderSystem *rsys);
|
---|
| 61 | /** Returns pointer to bounding box of node.
|
---|
| 62 | @param node current hierarchy node
|
---|
| 63 | @returns bounding box of current node
|
---|
| 64 | */
|
---|
| 65 | virtual AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node) = 0;
|
---|
| 66 | /** Issue a occlusion query for this node.
|
---|
| 67 | @param node the current hierarchy node
|
---|
[86] | 68 | @param wasVisible if the node was visible in the last frame
|
---|
[59] | 69 | @returns occlusion query for this node
|
---|
| 70 | */
|
---|
[86] | 71 | GtpVisibility::OcclusionQuery *IssueOcclusionQuery(
|
---|
| 72 | GtpVisibility::HierarchyNode *node, const bool wasVisible);
|
---|
[59] | 73 |
|
---|
| 74 | protected:
|
---|
| 75 | /** Deletes all occlusion queries.
|
---|
| 76 | */
|
---|
| 77 | void DeleteQueries();
|
---|
| 78 | /** Renders bounding box of specified node.
|
---|
| 79 | @param box the bounding box of the scene node to be rendered
|
---|
| 80 | */
|
---|
| 81 | void RenderBoundingBox(AxisAlignedBox *box);
|
---|
[85] | 82 | /** Returns pointer to current renderable half bounding box geometry
|
---|
[59] | 83 | */
|
---|
[92] | 84 | //SolidHalfBoundingBox *GetSolidHalfBoundingBox();
|
---|
| 85 | /** Returns pointer to current renderable bounding box geometry
|
---|
| 86 | */
|
---|
| 87 | SolidBoundingBox *GetSolidBoundingBox();
|
---|
[59] | 88 |
|
---|
[85] | 89 | /** one renderable half of an aabb.
|
---|
[59] | 90 | */
|
---|
[92] | 91 | SolidBoundingBox *mSolidBoundingBox;
|
---|
[59] | 92 |
|
---|
| 93 | SceneManager *mSceneManager;
|
---|
| 94 | RenderSystem *mRenderSystem;
|
---|
| 95 |
|
---|
| 96 | Camera *mCamera;
|
---|
| 97 | AxisAlignedBox mBox;
|
---|
[85] | 98 |
|
---|
[59] | 99 | std::vector<PlatformOcclusionQuery *> mOcclusionQueries;
|
---|
| 100 | };
|
---|
| 101 |
|
---|
| 102 | } // namespace Ogre
|
---|
| 103 |
|
---|
| 104 | #endif // PlatformHierarchyInterface_H |
---|