source: obsolete/trunk/VUT/Ogre/include/OgreVisibilityOctreeSceneManager.h @ 254

Revision 254, 5.0 KB checked in by mattausch, 19 years ago (diff)

added some hack for video recording

Line 
1#ifndef _VisibilityOctreeSceneManager_H__
2#define _VisibilityOctreeSceneManager_H__
3
4#include <OgreSceneNode.h>
5#include <OgreOctreeSceneManager.h>
6#include <OgreOctreeNode.h>
7#include <OgreOctreeCamera.h>
8#include <OgrePrerequisites.h>
9
10#include "OgreOctreeHierarchyInterface.h"
11#include "VisibilityManager.h"
12
13namespace Ogre {
14
15/**
16        This class extends the octree scene manager, using
17        occlusion queries for visibility culling.
18*/
19class __declspec(dllexport) VisibilityOctreeSceneManager: public OctreeSceneManager
20{
21public:
22        VisibilityOctreeSceneManager(GtpVisibility::VisibilityManager *visManager);
23        ~VisibilityOctreeSceneManager();
24
25        void _renderVisibleObjects();
26        void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
27        void _updateSceneGraph(Camera* cam );
28
29        /** Sets the given option for the SceneManager
30                @remarks Options are: "Algorithm", int *;                       
31        */
32       
33        virtual bool setOption(const String &, const void *);
34        /** Gets the given option for the Scene VisibilityManager.
35            @remarks
36                See setOption
37        */
38        virtual bool getOption(const String &, void *);
39
40        bool getOptionValues(const String & key, StringVector &refValueList);
41        bool getOptionKeys(StringVector &refKeys);
42
43        /** Sets the visibility manager.
44                @param visManager the visibility manager
45        */
46        void setVisibilityManager(GtpVisibility::VisibilityManager *visManager);
47        /** See set.
48        */
49        GtpVisibility::VisibilityManager *getVisibilityManager();
50       
51        /** Render a set of objects, see renderSingleObject for param definitions
52                Override so we can handle delayed rendering of transparent objects
53        */
54        virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,
55            bool doLightIteration, const LightList* manualLightList = 0);
56
57        /** Writes out stats into the Ogre log file.
58        */
59        void WriteLog();
60
61        /** Override pass so we can do the z-fail pass.
62        */
63        Pass* setPass(Pass* pass);
64
65        /** Override from SceneManager so we can skip all but first pass for depth pass.
66        */
67        bool validatePassForRendering(Pass* pass);
68
69        void RenderItemBuffer(RenderPriorityGroup* pGroup);
70        void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass);
71        void renderQueueGroupObjects(RenderQueueGroup* pGroup);
72
73        /** Override from SceneManager so that sub entities can be assigned an id for item buffer.
74        */
75        //Entity* createEntity(const String& entityName, const String& meshName);
76
77        /** Returns pointer to visibility manager.
78        */
79        GtpVisibility::VisibilityManager *GetVisibilityManager();
80
81        /** Returns hierarchy interface.
82        */
83        OctreeHierarchyInterface *GetHierarchyInterface();
84
85        void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup);
86        void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup);
87
88        void loadVisibilityConfig(const String& filename);
89
90protected:
91       
92        /** Creates material for depth pass, e.g., a pass that only fills the depth buffer.
93        */
94        void InitDepthPass();
95        /** Creates material for item buffer.
96        */
97        void InitItemBufferPass();
98        /** Fills render queue so that a visualization can be rendered.
99        */
100        void PrepareVisualization(Camera *cam);
101        /** Initialises necessary parameters for hierarchical visibility culling.
102        */
103        void InitVisibilityCulling(Camera *cam);
104       
105        /// the interface to the scene hierarchy.
106        OctreeHierarchyInterface *mHierarchyInterface;
107        /// manages all visibility options
108        GtpVisibility::VisibilityManager *mVisibilityManager;
109       
110        /// if a visualization of the hierarchical culling is shown
111        bool mShowVisualization;
112
113        /// if the culled nodes are indicated in the visualization
114        bool mVisualizeCulledNodes;
115
116        /// if symbols for the nodes are shown in the visualization
117        bool mRenderNodesForViz;
118        /// if content of the nodes is shown in the visualization
119        bool mRenderNodesContentForViz;
120
121        /// render transparents after the hierarchical traversal
122        bool mDelayRenderTransparents;
123
124        /// use a depth pass (i.e., fill only the depth buffer in the first pass)
125        bool mUseDepthPass;
126        /// flag indicating if we currently render the depth pass
127        bool mIsDepthPassPhase;
128
129        /// if we use an item buffer for rendering (i.e., object ids as color codes
130        bool mUseItemBuffer;
131        /// if we currently render the item buffer
132        bool mIsItemBufferPhase;
133
134        /// if depth write should be enabled
135        bool mEnableDepthWrite;
136        /// if transparents are skipped during rendering
137        bool mSkipTransparents;
138
139        /// the depth pass (no lighting, just filling the depth buffer)
140        Pass *mDepthPass;
141        Pass *mItemBufferPass;
142
143        int mCurrentEntityId;
144        /// flag for passes which should not be deleted from queue during first traversal
145        int mLeavePassesInQueue;
146       
147
148        /// if transparent object are considered for item buffer visibility
149        bool mRenderTransparentsForItemBuffer;
150        /// Always execute the vertex program of a pass, e.g., for the depth pass or item buffer
151        bool mExecuteVertexProgramForAllPasses;
152
153        bool mIsHierarchicalCulling;
154};
155
156} // namespace Ogre
157
158#endif // VisibilityOctreeSceneManager_H
Note: See TracBrowser for help on using the repository browser.