source: branches/VUT/0.2/work/TestCulling/TestCullingApplication.h @ 160

Revision 160, 3.4 KB checked in by mattausch, 19 years ago (diff)

added animation

Line 
1#ifndef _TerrainFrameListener_H__
2#define _TerrainFrameListener_H__
3
4#include "CEGUIForwardRefs.h"
5#include "ExampleApplication.h"
6#include "VisibilityEnvironment.h"
7#include "OgreSceneContentGenerator.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[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =
20{
21    "View Frustum Culling",
22        "Stop and Wait Culling",
23        "Coherent Hierarchical Culling"
24};
25
26class TerrainFrameListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
27{
28public:
29
30    TerrainFrameListener(RenderWindow* win,
31                                                 Camera* cam,
32                                                 SceneManager *sceneManager,
33                                                 CEGUI::Renderer *renderer,
34                                                 SceneContentGenerator *sceneContentGenerator);
35
36
37    ~TerrainFrameListener();
38
39        bool frameStarted(const FrameEvent& evt);
40        bool frameEnded(const FrameEvent& evt);
41
42    /* MouseListener callbacks. */
43    virtual void mouseClicked(MouseEvent* e) { }
44    virtual void mouseEntered(MouseEvent* e) { }
45    virtual void mouseExited(MouseEvent* e)  { }
46
47    // This is when the mouse button goes DOWN.
48    virtual void mousePressed(MouseEvent* e);
49
50    // This is when the mouse button is let UP.
51    virtual void mouseReleased(MouseEvent* e);
52
53    /* MouseMotionListener callbacks */
54    virtual void mouseMoved (MouseEvent *e);
55   
56    // This is when the mouse is clicked, held and dragged.
57    virtual void mouseDragged (MouseEvent *e);
58
59    void keyPressed(KeyEvent* e);
60
61        void keyReleased(KeyEvent* e);
62        void keyClicked(KeyEvent* e);
63
64        void nextAlgorithm();
65        void setAlgorithm(int algorithm);
66        void changeThreshold(int incr);
67        void updateStats();
68        void toggleTestGeometryForVisibleLeaves();
69        void toggleShowOctree();
70        void toggleUseDepthPass();
71        void toggleShowViz();
72
73protected:
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 *mRenderedNodesInfo;
90        OverlayElement *mObjectsCountInfo;
91        OverlayElement *mTestGeometryForVisibleLeavesInfo;
92        OverlayElement *mQueriesIssuedInfo;
93
94        SceneContentGenerator *mSceneContentGenerator;
95
96        bool mTestGeometryForVisibleLeaves;
97        bool mShowOctree;
98        bool mUseDepthPass;
99        bool mShowVisualization;
100
101        bool mVisualizeCulledNodes;
102
103        Camera *mVizCamera;
104};
105
106
107class TestCullingApplication : public ExampleApplication
108{
109public:
110        ~TestCullingApplication();
111
112protected:
113        void createScene();
114        void createFrameListener();
115        void setupGui();
116       
117        //virtual void createCamera(void);
118
119        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
120        CEGUI::System *mGUISystem;
121
122        Vector3 mMinTranslation;
123        Vector3 mMaxTranslation;
124
125        Vector3 mMinAngle;
126        Vector3 mMaxAngle;
127
128        SceneContentGenerator *mSceneContentGenerator;
129
130private:
131        void chooseSceneManager(void);
132};
133
134#endif // _TerrainFrameListener_H__
Note: See TracBrowser for help on using the repository browser.