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

Revision 87, 3.4 KB checked in by mattausch, 19 years ago (diff)
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"
[61]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
[74]20String mCurrentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =
[61]21{
[74]22    "View Frustum Culling",
23        "Stop and Wait Culling",
24        "Coherent Hierarchical Culling"
[61]25};
26
27class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
28{
29public:
30
31    MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager,
[80]32                CEGUI::Renderer *renderer, TerrainContentGenerator *contentGenerator);
[61]33
[80]34    ~MouseQueryListener();
[61]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
[85]61        void nextAlgorithm();
62        void setAlgorithm(int algorithm);
[61]63        void changeThreshold(int incr);
[87]64        void updateStats();
[86]65        void toggleUseOptimization();
66        void toggleShowOctree();
[87]67        void toggleUseCulling();
[61]68
69protected:
70    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
71    SceneManager *mSceneMgr;           // A pointer to the scene manager
72   
73        CEGUI::Renderer *mGUIRenderer;     // cegui renderer
74       
75        bool mShutdownRequested;
76        int mCurrentAlgorithm;
[85]77        int mVisibilityThreshold;
[61]78
79        OverlayElement *mAlgorithmInfo;
80        OverlayElement *mThresholdInfo;
81        OverlayElement *mFrustumCulledNodesInfo;
82        OverlayElement *mQueryCulledNodesInfo;
83    OverlayElement *mTraversedNodesInfo;
84        OverlayElement *mHierarchyNodesInfo;
[86]85        OverlayElement *mUseOptimizationInfo;
[61]86        OverlayElement *mRenderedNodesInfo;
[87]87        OverlayElement *mObjectsInfo;
88        OverlayElement *mQueriesIssuedInfo;
[61]89
90        SceneNode *mCurrentObject;         // The newly created object
91        int mCount;                        // The number of robots on the screen
92
93        RayQueryExecutor *mRayQueryExecutor;
[82]94        TerrainContentGenerator *mTerrainContentGenerator;
[86]95
96        bool mUseOptimization;
97        bool mShowOctree;
[87]98        bool mUseCulling;
[61]99};
100
101
102class TestCullingTerrainApplication : public ExampleApplication
103{
104public:
105        ~TestCullingTerrainApplication();
106
107protected:
[85]108        void createScene();
109        void createFrameListener();
110        void setupGui();
111        virtual void createCamera();
[61]112
113        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
114        CEGUI::System *mGUISystem;
[75]115//      RayQueryExecutor *mRayQueryExecutor;
[61]116
[87]117        Vector3 mMinTranslation;
118        Vector3 mMaxTranslation;
119
120        Vector3 mMinAngle;
[61]121        Vector3 mMaxAngle;
122
[82]123        TerrainContentGenerator *mTerrainContentGenerator;
[75]124
[61]125private:
126        void chooseSceneManager(void);
127};
128
Note: See TracBrowser for help on using the repository browser.