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

Revision 85, 3.2 KB checked in by mattausch, 19 years ago (diff)

corrected bug so chc is much faster than stop and wait

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);
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 changeStats();
65
66protected:
67    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
68    SceneManager *mSceneMgr;           // A pointer to the scene manager
69   
70        CEGUI::Renderer *mGUIRenderer;     // cegui renderer
71       
72        bool mShutdownRequested;
73        int mCurrentAlgorithm;
74        int mVisibilityThreshold;
75
76        OverlayElement *mAlgorithmInfo;
77        OverlayElement *mThresholdInfo;
78        OverlayElement *mFrustumCulledNodesInfo;
79        OverlayElement *mQueryCulledNodesInfo;
80    OverlayElement *mTraversedNodesInfo;
81        OverlayElement *mHierarchyNodesInfo;
82        //OverlayElement *mSceneNodesInfo;
83        OverlayElement *mRenderedNodesInfo;
84        OverlayElement *mNumObjectsInfo;
85
86        SceneNode *mCurrentObject;         // The newly created object
87        int mCount;                        // The number of robots on the screen
88
89        RayQueryExecutor *mRayQueryExecutor;
90        TerrainContentGenerator *mTerrainContentGenerator;
91};
92
93
94class TestCullingTerrainApplication : public ExampleApplication
95{
96public:
97        ~TestCullingTerrainApplication();
98
99protected:
100        void createScene();
101        void createFrameListener();
102        void setupGui();
103        virtual void createCamera();
104
105        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
106        CEGUI::System *mGUISystem;
107//      RayQueryExecutor *mRayQueryExecutor;
108
109        Vector3 mMinTranslation;
110        Vector3 mMaxTranslation;
111
112        Vector3 mMinAngle;
113        Vector3 mMaxAngle;
114
115        TerrainContentGenerator *mTerrainContentGenerator;
116
117private:
118        void chooseSceneManager(void);
119};
120
Note: See TracBrowser for help on using the repository browser.