source: trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h @ 103

Revision 103, 4.3 KB checked in by mattausch, 19 years ago (diff)

fixed bug with shadow maps

RevLine 
[61]1/**
2    \file
3        TestCullingTerrainApplication.h
4*/
5#include "CEGUIForwardRefs.h"
6#include "ExampleApplication.h"
7#include "TerrainContentGenerator.h"
[74]8#include "VisibilityEnvironment.h"
[99]9#include <OgreRenderTargetListener.h>
[61]10
[100]11
[61]12Real timeDelay = 0;
13#define KEY_PRESSED(_key,_timeDelay, _macro) \
14{ \
15    if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \
16{ \
17    timeDelay = _timeDelay; \
18    _macro ; \
19} \
20}
21
[74]22String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =
[61]23{
[74]24    "View Frustum Culling",
25        "Stop and Wait Culling",
26        "Coherent Hierarchical Culling"
[61]27};
28
[99]29class VisualizationRenderTargetListener: public RenderTargetListener
30{
31public:
32        VisualizationRenderTargetListener(SceneManager *sceneMgr);
33
34protected:
35        void preViewportUpdate (const RenderTargetViewportEvent &evt);
36        void postRenderTargetUpdate (const RenderTargetEvent &evt);
37
38        SceneManager *mSceneMgr;
39};
40
[61]41class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
42{
43public:
44
45    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager,
[100]46                CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *vizCamera,
47                SceneNode *camNode);
[61]48
[80]49    ~MouseQueryListener();
[61]50
51        bool frameStarted(const FrameEvent& evt);
52        bool frameEnded(const FrameEvent& evt);
[100]53        bool processUnbufferedKeyInput(const FrameEvent& evt);
54   
[61]55
56    /* MouseListener callbacks. */
57    virtual void mouseClicked(MouseEvent* e) { }
58    virtual void mouseEntered(MouseEvent* e) { }
59    virtual void mouseExited(MouseEvent* e)  { }
60
61    // This is when the mouse button goes DOWN.
62    virtual void mousePressed(MouseEvent* e);
63
64    // This is when the mouse button is let UP.
65    virtual void mouseReleased(MouseEvent* e);
66
67    /* MouseMotionListener callbacks */
68    virtual void mouseMoved (MouseEvent *e);
69   
70    // This is when the mouse is clicked, held and dragged.
71    virtual void mouseDragged (MouseEvent *e);
72
73    void keyPressed(KeyEvent* e);
74
75        void keyReleased(KeyEvent* e);
76        void keyClicked(KeyEvent* e);
77
[85]78        void nextAlgorithm();
79        void setAlgorithm(int algorithm);
[61]80        void changeThreshold(int incr);
[87]81        void updateStats();
[86]82        void toggleUseOptimization();
83        void toggleShowOctree();
[99]84        void toggleUseVisibilityCulling();
85        void toggleShowViz();
[103]86        void toggleRenderNodesForViz();
[100]87        void zoomVizCamera(int zoom);
88        void moveCamera();
[61]89
90protected:
[100]91        void clamp2Terrain();
[94]92
[61]93    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
94    SceneManager *mSceneMgr;           // A pointer to the scene manager
95   
96        CEGUI::Renderer *mGUIRenderer;     // cegui renderer
97       
98        bool mShutdownRequested;
99        int mCurrentAlgorithm;
[85]100        int mVisibilityThreshold;
[61]101
102        OverlayElement *mAlgorithmInfo;
103        OverlayElement *mThresholdInfo;
104        OverlayElement *mFrustumCulledNodesInfo;
105        OverlayElement *mQueryCulledNodesInfo;
106    OverlayElement *mTraversedNodesInfo;
107        OverlayElement *mHierarchyNodesInfo;
[86]108        OverlayElement *mUseOptimizationInfo;
[61]109        OverlayElement *mRenderedNodesInfo;
[87]110        OverlayElement *mObjectsInfo;
111        OverlayElement *mQueriesIssuedInfo;
[61]112
113        SceneNode *mCurrentObject;         // The newly created object
114        int mCount;                        // The number of robots on the screen
115
116        RayQueryExecutor *mRayQueryExecutor;
[82]117        TerrainContentGenerator *mTerrainContentGenerator;
[86]118
119        bool mUseOptimization;
120        bool mShowOctree;
[99]121        bool mUseVisibilityCulling;
122        bool mShowVisualization;
[103]123        bool mRenderNodesForViz;
[100]124        bool mCullCamera;
[93]125
[100]126        Real mVizCameraHeight;
127
128        Camera *mVizCamera;
129        SceneNode *mCamNode;
130
[61]131};
132
133
134class TestCullingTerrainApplication : public ExampleApplication
135{
136public:
137        ~TestCullingTerrainApplication();
138
139protected:
[99]140        //-- inherited from ExampleApplication
141        bool setup();
[85]142        void createScene();
143        void createFrameListener();
[99]144        void createCamera();
145        //void createViewports();
146       
147        virtual void createRenderTargetListener();
148
149        /** cegui setup */
[85]150        void setupGui();
[61]151
152        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
153        CEGUI::System *mGUISystem;
154
[87]155        Vector3 mMinTranslation;
156        Vector3 mMaxTranslation;
157
158        Vector3 mMinAngle;
[61]159        Vector3 mMaxAngle;
160
[82]161        TerrainContentGenerator *mTerrainContentGenerator;
[99]162       
[100]163        Camera *mVizCamera;
164        SceneNode *mCamNode;
[99]165        VisualizationRenderTargetListener *mRenderTargetListener;
[75]166
[61]167private:
168        void chooseSceneManager(void);
[99]169};
Note: See TracBrowser for help on using the repository browser.