source: obsolete/tags/DummyModules/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h @ 61

Revision 61, 3.4 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
9Real timeDelay = 0;
10#define KEY_PRESSED(_key,_timeDelay, _macro) \
11{ \
12    if (mInputDevice->isKeyDown(_key) && timeDelay <= 0) \
13{ \
14    timeDelay = _timeDelay; \
15    _macro ; \
16} \
17}
18
19String mCurrentAlgorithmCaptions[3/*VisibilitySceneTraverser::NUM_RENDERMODES*/] =
20{
21    "Cull Frustum",
22        "Stop and Wait",
23        "Coherent Occlusion Culling"
24};
25
26class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
27{
28public:
29
30    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager,
31                CEGUI::Renderer *renderer, RayQueryExecutor *rqe);
32
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 changeAlgorithm();
62        void changeThreshold(int incr);
63        void changeStats();
64
65protected:
66    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
67    SceneManager *mSceneMgr;           // A pointer to the scene manager
68   
69        CEGUI::Renderer *mGUIRenderer;     // cegui renderer
70       
71        bool mShutdownRequested;
72        int mCurrentAlgorithm;
73        int mThreshold;
74
75        OverlayElement *mAlgorithmInfo;
76        OverlayElement *mThresholdInfo;
77        OverlayElement *mFrustumCulledNodesInfo;
78        OverlayElement *mQueryCulledNodesInfo;
79    OverlayElement *mTraversedNodesInfo;
80        OverlayElement *mHierarchyNodesInfo;
81        OverlayElement *mSceneNodesInfo;
82        OverlayElement *mRenderedNodesInfo;
83
84        SceneNode *mCurrentObject;         // The newly created object
85        RaySceneQuery *mRaySceneQuery;     // The ray scene query pointer
86        int mCount;                        // The number of robots on the screen
87
88        RayQueryExecutor *mRayQueryExecutor;
89};
90
91
92class TestCullingTerrainApplication : public ExampleApplication
93{
94public:
95        ~TestCullingTerrainApplication();
96
97protected:
98        void createScene(void);
99        void createFrameListener(void);
100        void setupGui(void);
101        virtual void createCamera(void);
102
103        /**
104                generates a new scene object
105                @param tranlationRatio ratio between minimal and maximal possible translation
106                @param rotationRatio ratio between minimal and maximal possible rotation
107                @idx the index of the new object
108                @entName the name of the object entity
109        */
110        void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio,
111                                                         const int idx, const String &entName);
112
113        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
114        CEGUI::System *mGUISystem;
115        RayQueryExecutor *mRayQueryExecutor;
116        TerrainContentGenerator *mTerrainContentGenerator;
117
118        Vector3 mMinTranslation;
119        Vector3 mMaxTranslation;
120
121        Vector3 mMinAngle;
122        Vector3 mMaxAngle;
123
124private:
125        void chooseSceneManager(void);
126};
127
Note: See TracBrowser for help on using the repository browser.