source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityTerrainSceneManager.h @ 925

Revision 925, 6.4 KB checked in by mattausch, 18 years ago (diff)

update for ogre 1.2
OcclusionCullingSceneManager? is the only scenemanager in the solution now

RevLine 
[59]1#ifndef _VisibilityTerrainSceneManager_H__
2#define _VisibilityTerrainSceneManager_H__
3
4#include <OgreSceneNode.h>
5#include <OgreTerrainSceneManager.h>
6#include <OgreOctreeNode.h>
7#include <OgreOctreeCamera.h>
8#include <OgrePrerequisites.h>
9
10#include "OgreOctreeHierarchyInterface.h"
[130]11#include "OgrePlatformQueryManager.h"
[59]12#include "VisibilityManager.h"
13
[865]14
[59]15namespace Ogre {
16
17/**
18        This class extends the terrain scene manager,
19        using occlusion queries for visibility culling.
20*/
[130]21class __declspec(dllexport) VisibilityTerrainSceneManager: public TerrainSceneManager
[59]22{
23public:
[897]24        VisibilityTerrainSceneManager(const String& name, GtpVisibility::VisibilityManager *visManager);
[59]25        ~VisibilityTerrainSceneManager();
26
[118]27        void _renderVisibleObjects();
[59]28        void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
29        void _updateSceneGraph(Camera* cam);
30
31        /** Sets the given option for the SceneManager
[103]32                @remarks Options are: "Algorithm", int *;                       
[59]33        */
34       
[164]35        virtual bool setOption(const String &, const void *);
[59]36        /** Gets the given option for the Scene VisibilityManager.
37            @remarks
38                See setOption
39        */
[164]40        virtual bool getOption(const String &, void *);
[59]41
[164]42        bool getOptionValues(const String & key, StringVector &refValueList);
43        bool getOptionKeys(StringVector &refKeys);
[59]44
[118]45        /** Sets the visibility manager.
[59]46                @param visManager the visibility manager
47        */
48        void setVisibilityManager(GtpVisibility::VisibilityManager *visManager);
[118]49        /** See set.
[59]50        */
51        GtpVisibility::VisibilityManager *getVisibilityManager();
[113]52
[925]53        /** Render a queue group.
[114]54                Override so we can handle delayed rendering of transparent objects
55        */
[925]56        void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup,
57                                                                 QueuedRenderableCollection::OrganisationMode om);
[865]58
[115]59        /** Writes out stats into the Ogre log file.
[103]60        */
61        void WriteLog();
62
[897]63        /** We override this because we want to include the z-fail pass.
[121]64        */
[897]65        const Pass* _setPass(Pass* pass);
[121]66        /** Override from SceneManager so we can skip all but first pass for depth pass.
67        */
68        bool validatePassForRendering(Pass* pass);
[726]69        /** This function renders renderables using false color ids.
70        */
[897]71#ifdef ITEM_BUFFER
[122]72        void RenderItemBuffer(RenderPriorityGroup* pGroup);
[726]73        /** Renders a single object using false color id.
74        */
[129]75        void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass);
[726]76        /** Overritten from scene manager to include the false color id rendering of the
77                scene objects.
78        */
[897]79#endif // ITEM_BUFFER
80        void _renderQueueGroupObjects(RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om);
[122]81
[133]82        /** Override from SceneManager so that sub entities can be assigned an id for item buffer.
83        */
[164]84        Entity* createEntity(const String& entityName, const String& meshName);
[122]85
[133]86        /** Returns pointer to visibility manager.
87        */
[130]88        GtpVisibility::VisibilityManager *GetVisibilityManager();
89
[153]90        /** Returns hierarchy interface.
91        */
92        OctreeHierarchyInterface *GetHierarchyInterface();
93
[164]94        /** Inherited from scene manager. Neccesary to draw terrain properly.
95        */
[159]96        void endFrame();
97
[726]98        /** Override this because we must handle shadows differently.
99        */
[897]100        void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup,
101                QueuedRenderableCollection::OrganisationMode om);
[726]102        /** Override this because we must handle shadows differently.
103        */
[897]104        void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup,
105                QueuedRenderableCollection::OrganisationMode om);
106/// @copydoc SceneManager::getTypeName
107        const String& getTypeName(void) const;
108        static const String FACTORY_TYPE_NAME;
[159]109
[897]110        void setWorldGeometry( DataStreamPtr& stream, const String& typeName );
[868]111
[115]112protected:
[122]113       
[133]114        /** Creates material for depth pass, e.g., a pass that only fills the depth buffer.
115        */
[119]116        void InitDepthPass();
[133]117        /** Creates material for item buffer.
118        */
[122]119        void InitItemBufferPass();
[133]120        /** Fills render queue so that a visualization can be rendered.
121        */
[139]122        void PrepareVisualization(Camera *cam);
[158]123        /** Initialises necessary parameters for hierarchical visibility culling.
124        */
[139]125        void InitVisibilityCulling(Camera *cam);
[122]126
[865]127
128
[158]129        /// the interface to the scene hierarchy.
[59]130        OctreeHierarchyInterface *mHierarchyInterface;
[158]131        /// manages all visibility options
[59]132        GtpVisibility::VisibilityManager *mVisibilityManager;
[99]133
[158]134        /// if a visualization of the hierarchical culling is shown
[99]135        bool mShowVisualization;
[158]136
137        /// if the culled nodes are indicated in the visualization
[114]138        bool mVisualizeCulledNodes;
139
[158]140        /// if symbols for the nodes are shown in the visualization
[103]141        bool mRenderNodesForViz;
[158]142        /// if content of the nodes is shown in the visualization
[113]143        bool mRenderNodesContentForViz;
[158]144
145        /// if we render transparents after the hierarchical traversal
[115]146        bool mDelayRenderTransparents;
[158]147
148        /// if we use a depth pass (i.e., fill only the depth buffer in the first pass)
[115]149        bool mUseDepthPass;
[254]150        /// if we currently rendering the depth pass
151        bool mIsDepthPassPhase;
[158]152       
153        /// if we use an item buffer for rendering (i.e., object ids as color codes
154        bool mUseItemBuffer;
155        /// if we currently render the item buffer
[254]156        bool mIsItemBufferPhase;
[158]157
158        /// if depth write should be enabled
[133]159        bool mEnableDepthWrite;
[158]160        /// if transparents are skipped during rendering
[139]161        bool mSkipTransparents;
[115]162
[158]163        /// the depth pass (no lighting, just filling the depth buffer)
[115]164        Pass *mDepthPass;
[122]165        Pass *mItemBufferPass;
166
167        int mCurrentEntityId;
[158]168        /// flag for passes which should not be deleted from queue during first traversal
[139]169        int mLeavePassesInQueue;
[159]170
[865]171
[159]172        /// if transparent object are considered for item buffer visibility
173        bool mRenderTransparentsForItemBuffer;
174        /// Always execute the vertex program of a pass, e.g., for the depth pass or item buffer
175        bool mExecuteVertexProgramForAllPasses;
[202]176
177        bool mIsHierarchicalCulling;
[726]178
179        std::ofstream mDummyLog;
[59]180};
181
[897]182/// Factory for VisibilityTerrainSceneManager
183class VisibilityTerrainSceneManagerFactory : public SceneManagerFactory
184{
185protected:
186        typedef std::vector<TerrainPageSource*> TerrainPageSources;
187        TerrainPageSources mTerrainPageSources;
188        void initMetaData(void) const;
189        GtpVisibility::VisibilityManager *visManager;
190public:
191        VisibilityTerrainSceneManagerFactory(GtpVisibility::VisibilityManager *vm);
192        ~VisibilityTerrainSceneManagerFactory();
193        /// Factory type name
194        static const String FACTORY_TYPE_NAME;
195        SceneManager* createInstance(const String& instanceName);
196        void destroyInstance(SceneManager* instance);
197};
198
[59]199} // namespace Ogre
200
201#endif // CullingTerrainSceneManager_H
Note: See TracBrowser for help on using the repository browser.