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"
|
---|
11 | #include "VisibilityManager.h"
|
---|
12 |
|
---|
13 | namespace Ogre {
|
---|
14 |
|
---|
15 | /**
|
---|
16 | This class extends the terrain scene manager,
|
---|
17 | using occlusion queries for visibility culling.
|
---|
18 | */
|
---|
19 | class VisibilityTerrainSceneManager: public TerrainSceneManager
|
---|
20 | {
|
---|
21 | public:
|
---|
22 | VisibilityTerrainSceneManager(GtpVisibility::VisibilityManager *visManager);
|
---|
23 | ~VisibilityTerrainSceneManager();
|
---|
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 | Entity* createEntity(const String& entityName, const String& meshName);
|
---|
75 |
|
---|
76 | protected:
|
---|
77 |
|
---|
78 | /** Creates material for depth pass, e.g., a pass that only fills the depth buffer. */
|
---|
79 | void InitDepthPass();
|
---|
80 | /** Creates material for item buffer. */
|
---|
81 | void InitItemBufferPass();
|
---|
82 | /** Fills render queue so that a visualization can be rendered. */
|
---|
83 | void ShowVisualization(Camera *cam);
|
---|
84 |
|
---|
85 | OctreeHierarchyInterface *mHierarchyInterface;
|
---|
86 | GtpVisibility::VisibilityManager *mVisibilityManager;
|
---|
87 |
|
---|
88 | bool mShowVisualization;
|
---|
89 | bool mSkipTransparents;
|
---|
90 | bool mVisualizeCulledNodes;
|
---|
91 |
|
---|
92 | bool mRenderNodesForViz;
|
---|
93 | bool mRenderNodesContentForViz;
|
---|
94 | bool mDelayRenderTransparents;
|
---|
95 | bool mUseDepthPass;
|
---|
96 | bool mRenderDepthPass;
|
---|
97 | bool mRenderItemBuffer;
|
---|
98 |
|
---|
99 | Pass *mDepthPass;
|
---|
100 | Pass *mItemBufferPass;
|
---|
101 |
|
---|
102 | int mCurrentEntityId;
|
---|
103 | };
|
---|
104 |
|
---|
105 | } // namespace Ogre
|
---|
106 |
|
---|
107 | #endif // CullingTerrainSceneManager_H |
---|