source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgrePlatformHierarchyInterface.h @ 938

Revision 938, 5.1 KB checked in by mattausch, 18 years ago (diff)
RevLine 
[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"
[130]12#include "VisibilityInfo.h"
[59]13#include "OgrePlatformOcclusionQuery.h"
14
[71]15/** This namespace contains the Ogre dependent classes.
16*/
[59]17namespace Ogre {
18
19/**     Class which implements a hierarchy interface for a specific type of hierarchy.
20        @remark also provides methods for using occlusion queries on the hierarchy nodes
21*/
[938]22typedef std::vector<PlatformOcclusionQuery *> OcclusionQueryContainer;
23
[59]24class PlatformHierarchyInterface: public GtpVisibility::HierarchyInterface
25{
26public:
27        /** Construction taking the current scene manager and the current rendersystem as argument
28                @param sm current scene manager
29                @param rsys current render system
30        */
31        PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys);
32        ~PlatformHierarchyInterface();
33               
34        /** Returns next available occlusion query or creates new one.
35                @return the next occlusion query
36        */
37        GtpVisibility::OcclusionQuery *GetNextOcclusionQuery();
38               
[94]39        /** Sets the current camera used for the rendering.
[59]40                @param cam the current camera
41        */
42        void SetCamera(Camera *cam);
[94]43        /** Sets the current camera used for culling.
44                @param cam the current camera
45                @remark the default is the camera used for rendering
46        */
47        void SetCullCamera(Camera *cullCam);
[59]48        /** Initialises this scene traverser for the current frame.
[103]49                @remark This is a convenience method which resets the stats,
50                                sets the current camera, and initialises the distance queue.
51                @param cam the actual camera definding the view frustum
52                @param cullCam the camera used for culling.
[155]53                @remark If cullCam is null, the actual camera is used for both viewing and culling             
[59]54        */
[155]55        void InitTraversal(Camera *cam, Camera *cullCam = NULL, int leavePassesInQueue = 0);
[59]56        /** Checks if the node is visible from the current view frustum.
57                @param node the current node
58                @param intersects returns true if the current node intersects the near plane
59        */
60        bool CheckFrustumVisible(GtpVisibility::HierarchyNode *node, bool &intersects);
61        /** Sets pointer to the current scene manager.
62                @param sm the scene manager
63        */
64        void SetSceneManager(SceneManager *sm);
[103]65        /** Sets pointer to the current render system .
[59]66                @param rsys the rendersystem
67        */
68        void SetRenderSystem(RenderSystem *rsys);
69        /** Returns pointer to bounding box of node.
70                @param node current hierarchy node
71                @returns bounding box of current node
72        */
73        virtual AxisAlignedBox *GetBoundingBox(GtpVisibility::HierarchyNode *node) = 0;
74        /** Issue a occlusion query for this node.
75                @param node the current hierarchy node
[86]76                @param wasVisible if the node was visible in the last frame
[59]77                @returns occlusion query for this node
78        */
[175]79        GtpVisibility::OcclusionQuery *IssueNodeOcclusionQuery(
[86]80                GtpVisibility::HierarchyNode *node, const bool wasVisible);
[59]81
[130]82        /** Issue a occlusion query for this mesh.
[175]83                @param mesh the mesh for which an occlusion query is issued.
84                @returns occlusion query for this mesh.
[130]85        */
[175]86        GtpVisibility::OcclusionQuery *IssueMeshOcclusionQuery(GtpVisibility::Mesh *mesh);
[130]87
[103]88        /** If true, the interface finds and renders only objects which are marked as shadow casters.
89                @remark This is important for the shadow texture pass
90        */
91        void SetOnlyShadowCasters(bool onlyShadowCasters);
[130]92        /** see set
93        */
[111]94        bool GetOnlyShadowCasters();
[130]95        /** see set
96        */
[155]97        bool GetTestGeometryForVisibleLeaves();
[130]98        /** see set
99        */
100        SceneManager *GetSceneManager();
[103]101
[130]102        /** see set
103        */
104        RenderSystem *GetRenderSystem();
105       
106        /** true if bounding box query is currently active.
107        */
[121]108    bool IsBoundingBoxQuery();
109
[175]110        GtpVisibility::OcclusionQuery *IssuePatchOcclusionQuery(GtpVisibility::Patch *patch);
[156]111
[187]112        /** Deletes all occlusion queries.
113        */
[897]114        void ResetQueries();
[187]115
[59]116protected:
[175]117        /** Renders the given geometry
[130]118        */
119        void RenderGeometry(GtpVisibility::Mesh *geom);
[175]120       
121        /** Renders the given patch
[174]122        */
123        void RenderPatch(GtpVisibility::Patch *patch);
124
[130]125        /** Materials for visualizing frustum and query culled nodes.
[103]126        */
[130]127        void CreateNodeVizMaterials();
[103]128
[130]129        /** Returns pointer to current renderable bounding box geometry.
[92]130        */
131        SolidBoundingBox *GetSolidBoundingBox();
[59]132
[130]133        /** A pass that prepares an occlusion query.
134                @remark disables depth write, colour write, lighting,
[156]135                vertex and fragment program.*/
[130]136        //void SetOcclusionPass();
137
[156]138        /** Renders given bounding box.
139                @param box the bounding box of the scene node to be rendered
140        */
141        void RenderBoundingBox(AxisAlignedBox *box);
[103]142
[130]143        /** Renderable of an aabb.
[103]144        */
[92]145        SolidBoundingBox *mSolidBoundingBox;
[59]146
147        SceneManager *mSceneManager;
148        RenderSystem *mRenderSystem;
149
150        Camera *mCamera;
[94]151        Camera *mCullCamera;
152
[59]153        AxisAlignedBox mBox;
[85]154       
[938]155        OcclusionQueryContainer mOcclusionQueries;
[103]156
[726]157        Vector3 mCameraPosition;
[103]158        bool mOnlyShadowCasters;
[139]159        int mLeavePassesInQueue;
[121]160        bool mIsBoundingBoxQuery;
[59]161};
162
163} // namespace Ogre
164
165#endif // PlatformHierarchyInterface_H
Note: See TracBrowser for help on using the repository browser.