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