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

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