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

Revision 130, 5.4 KB checked in by mattausch, 19 years ago (diff)

added visibility queries

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 root root of the hierarchy
50                @param cam the actual camera definding the view frustum
51                @param cullCam the camera used for culling.
52                @remark If null, the actual camera is used for both viewing and culling         
[59]53        */
[130]54        void InitFrame(GtpVisibility::HierarchyNode *root, Camera *cam, Camera *cullCam = NULL,
55                bool leaveTransparentsInQueue = false);
[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        */
[86]79        GtpVisibility::OcclusionQuery *IssueOcclusionQuery(
80                GtpVisibility::HierarchyNode *node, const bool wasVisible);
[59]81
[130]82        /** Issue a occlusion query for this mesh.
83                @param node the current mesh
84                @returns occlusion query for this node
85        */
86        GtpVisibility::OcclusionQuery *IssueOcclusionQuery(GtpVisibility::Mesh *mesh);
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        */
[120]97        bool GetUseOptimization();
[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
[130]110        /** Finds visible objects of hierarchy node using occlusion queries
111        @param node the current scene node
112        @param objs the visible objects
113        @param includeChildren if the children of current scene nodes should also be traversed
114        */
115        /*virtual bool FindVisibleObjects(GtpVisibility::HierarchyNode *node,   
116                                                                        InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
117                                                                        bool includeChildren = false) = 0;*/
[59]118protected:
[130]119        /** Renders geometry
120        */
121        void RenderGeometry(GtpVisibility::Mesh *geom);
[112]122
[130]123        /** Materials for visualizing frustum and query culled nodes.
[103]124        */
[130]125        void CreateNodeVizMaterials();
[103]126
[59]127        /** Deletes all occlusion queries.
128        */
129        void DeleteQueries();
[130]130       
[59]131        /** Renders bounding box of specified node.
132                @param box the bounding box of the scene node to be rendered
133        */
134        void RenderBoundingBox(AxisAlignedBox *box);
[103]135
[130]136        /** Returns pointer to current renderable bounding box geometry.
[92]137        */
138        SolidBoundingBox *GetSolidBoundingBox();
[59]139
[130]140        /** A pass that prepares an occlusion query.
141                @remark disables depth write, colour write, lighting,
142                vertex and fragment program.
[59]143        */
[130]144        //void SetOcclusionPass();
145
146        /** Returns pointer to current renderable half bounding box geometry.*/
[103]147        //SolidHalfBoundingBox *GetSolidHalfBoundingBox();
148
[130]149        /** Renderable of an aabb.
[103]150        */
[92]151        SolidBoundingBox *mSolidBoundingBox;
[59]152
153        SceneManager *mSceneManager;
154        RenderSystem *mRenderSystem;
155
156        Camera *mCamera;
[94]157        Camera *mCullCamera;
158
[59]159        AxisAlignedBox mBox;
[85]160       
[59]161        std::vector<PlatformOcclusionQuery *> mOcclusionQueries;
[103]162
163        bool mOnlyShadowCasters;
[115]164        bool mLeaveTransparentsInQueue;
[121]165        bool mIsBoundingBoxQuery;
[59]166};
167
168} // namespace Ogre
169
170#endif // PlatformHierarchyInterface_H
Note: See TracBrowser for help on using the repository browser.