~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/components/ogre/SceneManagers/EmberPagingSceneManager/src/OgrePagingLandScapeOcclusionDebugTraversal.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-07-23 07:46:40 UTC
  • Revision ID: james.westby@ubuntu.com-20090723074640-wh0ukzis0kda36qv
Tags: upstream-0.5.6
ImportĀ upstreamĀ versionĀ 0.5.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "OgrePagingLandScapePrecompiledHeaders.h"
 
3
 
 
4
#include "OgrePagingLandScapePrerequisites.h"
 
5
 
 
6
#include "OgrePagingLandScapeOctreeCamera.h"
 
7
#include "OgrePagingLandScapeOctree.h"
 
8
#include "OgrePagingLandScapeOctreeNode.h"
 
9
#include "OgrePagingLandScapeOcclusionElement.h"
 
10
#include "OgrePagingLandScapeOcclusion.h"
 
11
 
 
12
#include "OgrePagingLandScapeOcclusionVisibilityData.h"
 
13
#include "OgrePagingLandScapeOcclusionTraversal.h"
 
14
#include "OgrePagingLandScapeOcclusionDebugTraversal.h"
 
15
 
 
16
#include "OgreDebugRectangle2D.h"
 
17
 
 
18
#ifdef _VISIBILITYDEBUG
 
19
namespace Ogre
 
20
{
 
21
    // Debug Info 
 
22
    //
 
23
        //-----------------------------------------------------------------------
 
24
        TreeOverlayDebug::TreeOverlayDebug(Occlusion& o, PagingLandScapeOctreeSceneManager *scnMgr):
 
25
                occlusion(o),
 
26
                mScnMrg (scnMgr)
 
27
        {
 
28
        }
 
29
        //-----------------------------------------------------------------------
 
30
        void TreeOverlayDebug::onTree(PagingLandScapeOctree& n, VisibleObjectsBoundsInfo * const visibleBounds) const 
 
31
                {    
 
32
                        SimpleRenderable * const s = n.getRectangle2d(mScnMrg);
 
33
            if (n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible)
 
34
            {
 
35
                            if (n.getNodeData (occlusion.mCurrentCam)->queryVisible) 
 
36
                {
 
37
                    s->setMaterial ("BaseWhiteNoLightNoDepthCheck");
 
38
                    occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ());
 
39
 
 
40
                    traverseChildren (n, visibleBounds);
 
41
                            }
 
42
                            else 
 
43
                {
 
44
                    s->setMaterial ("BaseRedNoLightNoDepthCheck");
 
45
                    occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ());
 
46
                            }
 
47
                    }
 
48
                    else 
 
49
                        {
 
50
                s->setMaterial ("BaseGreenNoLightNoDepthCheck");
 
51
                occlusion.mCurrentRenderQueue->addRenderable (s, s->getRenderQueueGroup ());
 
52
                    }       
 
53
        }
 
54
        //-----------------------------------------------------------------------
 
55
            void TreeOverlayDebug::onLeaf(PagingLandScapeOctreeNode& n, VisibleObjectsBoundsInfo * const visibleBounds) const 
 
56
                {
 
57
                        SimpleRenderable * const s = n.getRectangle2d(mScnMrg);
 
58
                    if(n.getNodeData (occlusion.mCurrentCam)->viewFrustumVisible)
 
59
            {
 
60
                            if(n.getNodeData (occlusion.mCurrentCam)->queryVisible) 
 
61
                {
 
62
                    s->setMaterial ("BaseWhiteNoLightNoDepthCheck");
 
63
                    occlusion.mCurrentRenderQueue->addRenderable(s, s->getRenderQueueGroup ());          
 
64
                            }
 
65
                            else 
 
66
                {
 
67
                    s->setMaterial ("BaseRedNoLightNoDepthCheck");
 
68
                    occlusion.mCurrentRenderQueue->addRenderable(s, s->getRenderQueueGroup ());
 
69
                            }
 
70
                    }
 
71
            else 
 
72
            { 
 
73
                s->setMaterial ("BaseGreenNoLightNoDepthCheck");
 
74
                occlusion.mCurrentRenderQueue->addRenderable(s, s->getRenderQueueGroup ());
 
75
                    }
 
76
            }
 
77
}
 
78
#endif //_VISIBILITYDEBUG