source: trunk/VUT/Ogre/include/OgrePlatformHierarchyInterface.h @ 71

Revision 71, 3.2 KB checked in by mattausch, 19 years ago (diff)
Line 
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 "HierarchyInterface.h"
11#include "OgrePlatformOcclusionQuery.h"
12
13/** This namespace contains the Ogre dependent classes.
14*/
15namespace Ogre {
16
17/**     Class which implements a hierarchy interface for a specific type of hierarchy.
18        @remark also provides methods for using occlusion queries on the hierarchy nodes
19*/
20class PlatformHierarchyInterface: public GtpVisibility::HierarchyInterface
21{
22public:
23        /** Construction taking the current scene manager and the current rendersystem as argument
24                @param sm current scene manager
25                @param rsys current render system
26        */
27        PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys);
28        ~PlatformHierarchyInterface();
29               
30        /** Returns next available occlusion query or creates new one.
31                @return the next occlusion query
32        */
33        GtpVisibility::OcclusionQuery *GetNextOcclusionQuery();
34               
35        /** Sets the current camera.
36                @param cam the current camera
37        */
38        void SetCamera(Camera *cam);
39               
40        /** Initialises this scene traverser for the current frame.
41        @param root root of the hierarchy
42                @param cam current camera
43                @remark convenience method wich calls VisibilitySceneTraverser::initFrame,
44                sets the current camera, and initialises the distance queue.
45        */
46        void InitFrame(GtpVisibility::HierarchyNode *root, Ogre::Camera *cam);
47        /** Checks if the node is visible from the current view frustum.
48                @param node the current node
49                @param intersects returns true if the current node intersects the near plane
50        */
51        bool CheckFrustumVisible(GtpVisibility::HierarchyNode *node, bool &intersects);
52        /** Sets pointer to the current scene manager.
53                @param sm the scene manager
54        */
55        void SetSceneManager(SceneManager *sm);
56        /** Sets pointer to the current render system
57                @param rsys the rendersystem
58        */
59        void SetRenderSystem(RenderSystem *rsys);
60        /** Returns pointer to bounding box of node.
61                @param node current hierarchy node
62                @returns bounding box of current node
63        */
64        virtual AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node) = 0;
65        /** Issue a occlusion query for this node.
66                @param node the current hierarchy node
67                @returns occlusion query for this node
68        */
69        GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::HierarchyNode *node);
70
71protected:
72        /** Deletes all occlusion queries.
73        */
74        void DeleteQueries();
75        /** Renders bounding box of specified node.
76                @param box the bounding box of the scene node to be rendered
77        */
78        void RenderBoundingBox(AxisAlignedBox *box);
79        /** Returns one half of the bounding box.
80                @param half the half index of the bouding box (0 or 1)
81        */
82        SolidHalfBoundingBox *GetSolidHalfBoundingBox(int half);
83
84        /** two halfes of an aabb.
85        */
86        SolidHalfBoundingBox *mHalfBoundingBox[2];     
87
88        SceneManager *mSceneManager;
89        RenderSystem *mRenderSystem;
90
91        Camera *mCamera;
92        AxisAlignedBox mBox;
93
94        std::vector<PlatformOcclusionQuery *> mOcclusionQueries;
95};
96
97} // namespace Ogre
98
99#endif // PlatformHierarchyInterface_H
Note: See TracBrowser for help on using the repository browser.