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

Revision 94, 3.5 KB checked in by mattausch, 19 years ago (diff)
Line 
1/**
2    \file
3        TestCullingTerrainApplication.h
4*/
5#include "CEGUIForwardRefs.h"
6#include "ExampleApplication.h"
7#include "TerrainContentGenerator.h"
8#include "VisibilityEnvironment.h"
9
10Real timeDelay = 0;
11#define KEY_PRESSED(_key,_timeDelay, _macro) \
12{ \
13    if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \
14{ \
15    timeDelay = _timeDelay; \
16    _macro ; \
17} \
18}
19
20String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =
21{
22    "View Frustum Culling",
23        "Stop and Wait Culling",
24        "Coherent Hierarchical Culling"
25};
26
27class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
28{
29public:
30
31    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager,
32                CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator, Camera *vizCamera);
33
34    ~MouseQueryListener();
35
36        bool frameStarted(const FrameEvent& evt);
37        bool frameEnded(const FrameEvent& evt);
38
39    /* MouseListener callbacks. */
40    virtual void mouseClicked(MouseEvent* e) { }
41    virtual void mouseEntered(MouseEvent* e) { }
42    virtual void mouseExited(MouseEvent* e)  { }
43
44    // This is when the mouse button goes DOWN.
45    virtual void mousePressed(MouseEvent* e);
46
47    // This is when the mouse button is let UP.
48    virtual void mouseReleased(MouseEvent* e);
49
50    /* MouseMotionListener callbacks */
51    virtual void mouseMoved (MouseEvent *e);
52   
53    // This is when the mouse is clicked, held and dragged.
54    virtual void mouseDragged (MouseEvent *e);
55
56    void keyPressed(KeyEvent* e);
57
58        void keyReleased(KeyEvent* e);
59        void keyClicked(KeyEvent* e);
60
61        void nextAlgorithm();
62        void setAlgorithm(int algorithm);
63        void changeThreshold(int incr);
64        void updateStats();
65        void toggleUseOptimization();
66        void toggleShowOctree();
67        void toggleUseCulling();
68        void toggleCullCamera();
69        void FixVizCamera();
70
71protected:
72        void clamp2Terrain(Camera *cam);
73
74    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
75    SceneManager *mSceneMgr;           // A pointer to the scene manager
76   
77        CEGUI::Renderer *mGUIRenderer;     // cegui renderer
78       
79        bool mShutdownRequested;
80        int mCurrentAlgorithm;
81        int mVisibilityThreshold;
82
83        OverlayElement *mAlgorithmInfo;
84        OverlayElement *mThresholdInfo;
85        OverlayElement *mFrustumCulledNodesInfo;
86        OverlayElement *mQueryCulledNodesInfo;
87    OverlayElement *mTraversedNodesInfo;
88        OverlayElement *mHierarchyNodesInfo;
89        OverlayElement *mUseOptimizationInfo;
90        OverlayElement *mRenderedNodesInfo;
91        OverlayElement *mObjectsInfo;
92        OverlayElement *mQueriesIssuedInfo;
93
94        SceneNode *mCurrentObject;         // The newly created object
95        int mCount;                        // The number of robots on the screen
96
97        RayQueryExecutor *mRayQueryExecutor;
98        TerrainContentGenerator *mTerrainContentGenerator;
99
100        bool mUseOptimization;
101        bool mShowOctree;
102        bool mUseCulling;
103        bool mUseCullCamera;
104
105        Camera *mVisualizationCamera;
106};
107
108
109class TestCullingTerrainApplication : public ExampleApplication
110{
111public:
112        ~TestCullingTerrainApplication();
113
114protected:
115        void createScene();
116        void createFrameListener();
117        void setupGui();
118        virtual void createCamera();
119
120        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
121        CEGUI::System *mGUISystem;
122
123        Vector3 mMinTranslation;
124        Vector3 mMaxTranslation;
125
126        Vector3 mMinAngle;
127        Vector3 mMaxAngle;
128
129        TerrainContentGenerator *mTerrainContentGenerator;
130
131        Camera *mVisualizationCamera;
132       
133private:
134        void chooseSceneManager(void);
135};
136
Note: See TracBrowser for help on using the repository browser.