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

Revision 2280, 5.5 KB checked in by mattausch, 17 years ago (diff)

removed dependency on ogre in gtpvisibility

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