source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreVisibilityOctreeSceneManager.h @ 880

Revision 880, 6.6 KB checked in by mattausch, 18 years ago (diff)

added filter to online stuff (not fully working, too slow
)

RevLine 
[59]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"
[865]11#include "OgrePlatformQueryManager.h"
[59]12#include "VisibilityManager.h"
[868]13#include "ViewCellsManager.h"
[59]14
[868]15//class GtpVisibilityPreprocessor::ViewCellsManager;
[828]16
[868]17
[59]18namespace Ogre {
19
20/**
21        This class extends the octree scene manager, using
22        occlusion queries for visibility culling.
23*/
[159]24class __declspec(dllexport) VisibilityOctreeSceneManager: public OctreeSceneManager
[59]25{
26public:
27        VisibilityOctreeSceneManager(GtpVisibility::VisibilityManager *visManager);
28        ~VisibilityOctreeSceneManager();
29
30        void _renderVisibleObjects();
31        void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
32        void _updateSceneGraph(Camera* cam );
33
34        /** Sets the given option for the SceneManager
[118]35                @remarks Options are: "Algorithm", int *;                       
[59]36        */
[118]37       
[59]38        virtual bool setOption(const String &, const void *);
39        /** Gets the given option for the Scene VisibilityManager.
40            @remarks
41                See setOption
42        */
43        virtual bool getOption(const String &, void *);
44
45        bool getOptionValues(const String & key, StringVector &refValueList);
46        bool getOptionKeys(StringVector &refKeys);
47
48        /** Sets the visibility manager.
49                @param visManager the visibility manager
50        */
51        void setVisibilityManager(GtpVisibility::VisibilityManager *visManager);
52        /** See set.
53        */
[118]54        GtpVisibility::VisibilityManager *getVisibilityManager();
[115]55       
[114]56        /** Render a set of objects, see renderSingleObject for param definitions
57                Override so we can handle delayed rendering of transparent objects
58        */
59        virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,
60            bool doLightIteration, const LightList* manualLightList = 0);
[118]61
62        /** Writes out stats into the Ogre log file.
63        */
64        void WriteLog();
65
[159]66        /** Override pass so we can do the z-fail pass.
67        */
[118]68        Pass* setPass(Pass* pass);
69
[159]70        /** Override from SceneManager so we can skip all but first pass for depth pass.
71        */
72        bool validatePassForRendering(Pass* pass);
[865]73        /** This function renders renderables using false color ids.
74        */
[159]75        void RenderItemBuffer(RenderPriorityGroup* pGroup);
[865]76        /** Renders a single object using false color id.
77        */
[159]78        void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass);
[865]79        /** Overritten from scene manager to include the false color id rendering of the
80                scene objects.
81        */
[159]82        void renderQueueGroupObjects(RenderQueueGroup* pGroup);
83
84        /** Override from SceneManager so that sub entities can be assigned an id for item buffer.
85        */
[865]86        Entity* createEntity(const String& entityName, const String& meshName);
[159]87
88        /** Returns pointer to visibility manager.
89        */
90        GtpVisibility::VisibilityManager *GetVisibilityManager();
91
92        /** Returns hierarchy interface.
93        */
94        OctreeHierarchyInterface *GetHierarchyInterface();
95
[187]96        void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup);
[865]97        /** Override this because we must handle shadows differently.
98        */
[187]99        void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup);
[159]100
[254]101        void loadVisibilityConfig(const String& filename);
102
[868]103
104        /** Loads view cells for this particular scene.
105        */
106        void LoadViewCells(std::string filename);
107
[59]108protected:
[159]109       
110        /** Creates material for depth pass, e.g., a pass that only fills the depth buffer.
111        */
[119]112        void InitDepthPass();
[159]113        /** Creates material for item buffer.
114        */
115        void InitItemBufferPass();
116        /** Fills render queue so that a visualization can be rendered.
117        */
118        void PrepareVisualization(Camera *cam);
119        /** Initialises necessary parameters for hierarchical visibility culling.
120        */
121        void InitVisibilityCulling(Camera *cam);
[130]122       
[868]123        /** Finds object corresponding to this bounding box in the scene.
124        */
[870]125        Entity *FindCorrespondingObject(const AxisAlignedBox &box);
[863]126
[868]127        /** Identifies objects in the scene and gives them unique ids that
128                correspond to preprocessor ids.
129        */
130        void IdentifyObjects(GtpVisibilityPreprocessor::ObjectContainer &objects);
[863]131
[870]132        /** Loads / unloads pvs of the view cell to set the visibility in the scene.
133        */
134        void applyViewCellPvs(GtpVisibilityPreprocessor::ViewCell *vc, const bool load);
135
136        /** updates pvs in current frame.
137        */
138        void updatePvs(Camera *cam);
139
140        /** Sets all objects invisible.
141        */
142        void SetObjectsVisible(const bool visible);
143
[159]144        /// the interface to the scene hierarchy.
[59]145        OctreeHierarchyInterface *mHierarchyInterface;
[159]146        /// manages all visibility options
[59]147        GtpVisibility::VisibilityManager *mVisibilityManager;
[100]148       
[159]149        /// if a visualization of the hierarchical culling is shown
[100]150        bool mShowVisualization;
[159]151
152        /// if the culled nodes are indicated in the visualization
[112]153        bool mVisualizeCulledNodes;
[113]154
[159]155        /// if symbols for the nodes are shown in the visualization
[114]156        bool mRenderNodesForViz;
[159]157        /// if content of the nodes is shown in the visualization
[114]158        bool mRenderNodesContentForViz;
[159]159
[865]160        /// if we render transparents after the hierarchical traversal
[115]161        bool mDelayRenderTransparents;
[159]162
[865]163        /// if we use a depth pass (i.e., fill only the depth buffer in the first pass)
[115]164        bool mUseDepthPass;
[865]165        /// if we currently rendering the depth pass
[254]166        bool mIsDepthPassPhase;
[115]167
[159]168        /// if we use an item buffer for rendering (i.e., object ids as color codes
169        bool mUseItemBuffer;
170        /// if we currently render the item buffer
[254]171        bool mIsItemBufferPhase;
[159]172
173        /// if depth write should be enabled
174        bool mEnableDepthWrite;
175        /// if transparents are skipped during rendering
176        bool mSkipTransparents;
177
178        /// the depth pass (no lighting, just filling the depth buffer)
[115]179        Pass *mDepthPass;
[159]180        Pass *mItemBufferPass;
181
182        int mCurrentEntityId;
183        /// flag for passes which should not be deleted from queue during first traversal
184        int mLeavePassesInQueue;
[202]185       
[159]186
187        /// if transparent object are considered for item buffer visibility
188        bool mRenderTransparentsForItemBuffer;
189        /// Always execute the vertex program of a pass, e.g., for the depth pass or item buffer
190        bool mExecuteVertexProgramForAllPasses;
[187]191
[868]192        /// if hierarchical culling is currently in use
[187]193        bool mIsHierarchicalCulling;
[865]194
[868]195        bool mViewCellsLoaded;
196        GtpVisibilityPreprocessor::ViewCellsManager *mViewCellsManager;
[870]197
[880]198        /// Used to assign Ogre meshes to view cell entries.
[870]199        GtpVisibilityPreprocessor::ObjectContainer mObjects;
200
[880]201        GtpVisibilityPreprocessor::ViewCell *mElementaryViewCell;
[870]202        GtpVisibilityPreprocessor::ViewCell *mCurrentViewCell;
203
[880]204        /// If view cells are used.
[870]205        bool mUseViewCells;
[880]206
207        /// if the view cells are filtered
208        bool mUseVisibilityFilter;
[59]209};
210
211} // namespace Ogre
212
213#endif // VisibilityOctreeSceneManager_H
Note: See TracBrowser for help on using the repository browser.