1 | #include "OgreOcclusionCullingSceneManager.h"
|
---|
2 | #include "OgreMath.h"
|
---|
3 | #include "OgreIteratorWrappers.h"
|
---|
4 | #include "OgreRenderSystem.h"
|
---|
5 | #include "OgreCamera.h"
|
---|
6 | #include "OgreHardwareOcclusionQuery.h"
|
---|
7 | //#include "OgreWireBoundingBox.h"
|
---|
8 | #include "OgreSolidHalfBoundingBox.h"
|
---|
9 |
|
---|
10 | #include <windows.h>
|
---|
11 |
|
---|
12 | namespace Ogre {
|
---|
13 |
|
---|
14 | //-----------------------------------------------------------------------
|
---|
15 | OcclusionCullingSceneManager::OcclusionCullingSceneManager()
|
---|
16 | {
|
---|
17 | mOcclusionCullingSceneTraverser = new OcclusionCullingSceneTraverser(this, mDestRenderSystem);
|
---|
18 | }
|
---|
19 | //-----------------------------------------------------------------------
|
---|
20 | OcclusionCullingSceneManager::~OcclusionCullingSceneManager()
|
---|
21 | {
|
---|
22 | delete mOcclusionCullingSceneTraverser;
|
---|
23 | }
|
---|
24 | //-----------------------------------------------------------------------
|
---|
25 | void OcclusionCullingSceneManager::_findVisibleObjects( Camera* cam, bool onlyShadowCasters )
|
---|
26 | {
|
---|
27 | // empty because we have to find objects in _renderVisibleObjects
|
---|
28 | }
|
---|
29 | //-----------------------------------------------------------------------
|
---|
30 | void OcclusionCullingSceneManager::_renderVisibleObjects( void )
|
---|
31 | {
|
---|
32 | //-- render background
|
---|
33 | clearSpecialCaseRenderQueues();
|
---|
34 | addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
|
---|
35 | addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
|
---|
36 |
|
---|
37 | setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
|
---|
38 | SceneManager::_renderVisibleObjects( );
|
---|
39 | _deleteRenderedQueueGroups();
|
---|
40 |
|
---|
41 | //-- render visible objects (i.e., all but overlay)
|
---|
42 | clearSpecialCaseRenderQueues();
|
---|
43 | addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
|
---|
44 | setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
|
---|
45 |
|
---|
46 | mOcclusionCullingSceneTraverser->setSceneRoot(mSceneRoot);
|
---|
47 | mOcclusionCullingSceneTraverser->renderScene(mCameraInProgress);
|
---|
48 |
|
---|
49 | _deleteRenderedQueueGroups();
|
---|
50 |
|
---|
51 | //-- render overlay
|
---|
52 | clearSpecialCaseRenderQueues();
|
---|
53 | SceneManager::_renderVisibleObjects( );
|
---|
54 |
|
---|
55 | clearSpecialCaseRenderQueues();
|
---|
56 | }
|
---|
57 | //-----------------------------------------------------------------------
|
---|
58 | /*void OcclusionCullingSceneManager::renderZPass()
|
---|
59 | {
|
---|
60 | traverseNode(mSceneRoot);
|
---|
61 | }*/
|
---|
62 | //-----------------------------------------------------------------------
|
---|
63 | void OcclusionCullingSceneManager::_updateSceneGraph( Camera* cam )
|
---|
64 | {
|
---|
65 | mOcclusionCullingSceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
|
---|
66 | mOcclusionCullingSceneTraverser->setRenderSystem(mDestRenderSystem);
|
---|
67 |
|
---|
68 | //mOcclusionCullingSceneTraverser->setNumQueries((int)mSceneNodes.size());
|
---|
69 | //mOcclusionCullingSceneTraverser->preprocess();
|
---|
70 |
|
---|
71 | SceneManager::_updateSceneGraph(cam);
|
---|
72 | }
|
---|
73 | //-----------------------------------------------------------------------
|
---|
74 | bool OcclusionCullingSceneManager::setOption( const String & key, const void * val )
|
---|
75 | {
|
---|
76 | mOcclusionCullingSceneTraverser->setOption(key, val);
|
---|
77 |
|
---|
78 | return SceneManager::setOption( key, val );
|
---|
79 | }
|
---|
80 | //-----------------------------------------------------------------------
|
---|
81 | bool OcclusionCullingSceneManager::getOption( const String & key, void *val )
|
---|
82 | {
|
---|
83 | mOcclusionCullingSceneTraverser->getOption(key, val);
|
---|
84 |
|
---|
85 | return SceneManager::getOption( key, val );
|
---|
86 | }
|
---|
87 | //-----------------------------------------------------------------------
|
---|
88 | bool OcclusionCullingSceneManager::getOptionValues( const String & key, StringVector &refValueList )
|
---|
89 | {
|
---|
90 | return SceneManager::getOptionValues( key, refValueList );
|
---|
91 | }
|
---|
92 | //-----------------------------------------------------------------------
|
---|
93 | bool OcclusionCullingSceneManager::getOptionKeys( StringVector & refKeys )
|
---|
94 | {
|
---|
95 | SceneManager::getOptionKeys( refKeys );
|
---|
96 |
|
---|
97 | mOcclusionCullingSceneTraverser->getOptionKeys( refKeys );
|
---|
98 |
|
---|
99 | return true;
|
---|
100 | }
|
---|
101 | }
|
---|