[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 |
|
---|
| 14 | namespace Ogre {
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | This class extends the terrain scene manager,
|
---|
| 18 | using occlusion queries for visibility culling.
|
---|
| 19 | */
|
---|
[130] | 20 | class __declspec(dllexport) VisibilityTerrainSceneManager: public TerrainSceneManager
|
---|
[59] | 21 | {
|
---|
| 22 | public:
|
---|
| 23 | VisibilityTerrainSceneManager(GtpVisibility::VisibilityManager *visManager);
|
---|
| 24 | ~VisibilityTerrainSceneManager();
|
---|
| 25 |
|
---|
[118] | 26 | void _renderVisibleObjects();
|
---|
[59] | 27 | void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
|
---|
| 28 | void _updateSceneGraph(Camera* cam);
|
---|
| 29 |
|
---|
| 30 | /** Sets the given option for the SceneManager
|
---|
[103] | 31 | @remarks Options are: "Algorithm", int *;
|
---|
[59] | 32 | */
|
---|
| 33 |
|
---|
| 34 | virtual bool setOption( const String &, const void * );
|
---|
| 35 | /** Gets the given option for the Scene VisibilityManager.
|
---|
| 36 | @remarks
|
---|
| 37 | See setOption
|
---|
| 38 | */
|
---|
| 39 | virtual bool getOption( const String &, void * );
|
---|
| 40 |
|
---|
| 41 | bool getOptionValues( const String & key, StringVector &refValueList );
|
---|
| 42 | bool getOptionKeys( StringVector &refKeys );
|
---|
| 43 |
|
---|
[118] | 44 | /** Sets the visibility manager.
|
---|
[59] | 45 | @param visManager the visibility manager
|
---|
| 46 | */
|
---|
| 47 | void setVisibilityManager(GtpVisibility::VisibilityManager *visManager);
|
---|
[118] | 48 | /** See set.
|
---|
[59] | 49 | */
|
---|
| 50 | GtpVisibility::VisibilityManager *getVisibilityManager();
|
---|
[113] | 51 |
|
---|
[114] | 52 | /** Render a set of objects, see renderSingleObject for param definitions
|
---|
| 53 | Override so we can handle delayed rendering of transparent objects
|
---|
| 54 | */
|
---|
| 55 | virtual void renderObjects(const RenderPriorityGroup::TransparentRenderablePassList& objs,
|
---|
| 56 | bool doLightIteration, const LightList* manualLightList = 0);
|
---|
[115] | 57 |
|
---|
| 58 | /** Writes out stats into the Ogre log file.
|
---|
[103] | 59 | */
|
---|
| 60 | void WriteLog();
|
---|
| 61 |
|
---|
[121] | 62 | /** Override pass so we can do the z-fail pass.
|
---|
| 63 | */
|
---|
[115] | 64 | Pass* setPass(Pass* pass);
|
---|
| 65 |
|
---|
[121] | 66 | /** Override from SceneManager so we can skip all but first pass for depth pass.
|
---|
| 67 | */
|
---|
| 68 | bool validatePassForRendering(Pass* pass);
|
---|
| 69 |
|
---|
[122] | 70 | void RenderItemBuffer(RenderPriorityGroup* pGroup);
|
---|
[129] | 71 | void RenderSingleObjectForItemBuffer(Renderable *rend, Pass *pass);
|
---|
[122] | 72 | void renderQueueGroupObjects(RenderQueueGroup* pGroup);
|
---|
| 73 |
|
---|
[133] | 74 | /** Override from SceneManager so that sub entities can be assigned an id for item buffer.
|
---|
| 75 | */
|
---|
[122] | 76 | Entity* createEntity(const String& entityName, const String& meshName);
|
---|
| 77 |
|
---|
[133] | 78 | /** Returns pointer to visibility manager.
|
---|
| 79 | */
|
---|
[130] | 80 | GtpVisibility::VisibilityManager *GetVisibilityManager();
|
---|
| 81 |
|
---|
[115] | 82 | protected:
|
---|
[122] | 83 |
|
---|
[133] | 84 | /** Creates material for depth pass, e.g., a pass that only fills the depth buffer.
|
---|
| 85 | */
|
---|
[119] | 86 | void InitDepthPass();
|
---|
[133] | 87 | /** Creates material for item buffer.
|
---|
| 88 | */
|
---|
[122] | 89 | void InitItemBufferPass();
|
---|
[133] | 90 | /** Fills render queue so that a visualization can be rendered.
|
---|
| 91 | */
|
---|
[139] | 92 | void PrepareVisualization(Camera *cam);
|
---|
| 93 |
|
---|
| 94 | void InitVisibilityCulling(Camera *cam);
|
---|
[122] | 95 |
|
---|
[139] | 96 |
|
---|
[59] | 97 | OctreeHierarchyInterface *mHierarchyInterface;
|
---|
| 98 | GtpVisibility::VisibilityManager *mVisibilityManager;
|
---|
[99] | 99 |
|
---|
| 100 | bool mShowVisualization;
|
---|
[114] | 101 | bool mVisualizeCulledNodes;
|
---|
| 102 |
|
---|
[103] | 103 | bool mRenderNodesForViz;
|
---|
[113] | 104 | bool mRenderNodesContentForViz;
|
---|
[115] | 105 | bool mDelayRenderTransparents;
|
---|
| 106 | bool mUseDepthPass;
|
---|
[122] | 107 | bool mRenderDepthPass;
|
---|
| 108 | bool mRenderItemBuffer;
|
---|
[133] | 109 | bool mEnableDepthWrite;
|
---|
[139] | 110 | bool mSkipTransparents;
|
---|
[115] | 111 |
|
---|
| 112 | Pass *mDepthPass;
|
---|
[122] | 113 | Pass *mItemBufferPass;
|
---|
| 114 |
|
---|
| 115 | int mCurrentEntityId;
|
---|
[130] | 116 |
|
---|
| 117 | PlatformQueryManager *mQueryManager;
|
---|
[139] | 118 |
|
---|
| 119 | int mLeavePassesInQueue;
|
---|
| 120 | ShadowTechnique mSavedShadowTechnique;
|
---|
[59] | 121 | };
|
---|
| 122 |
|
---|
| 123 | } // namespace Ogre
|
---|
| 124 |
|
---|
| 125 | #endif // CullingTerrainSceneManager_H |
---|