source: trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h @ 51

Revision 51, 3.2 KB checked in by mattausch, 19 years ago (diff)
Line 
1/**
2    \file
3        TestCullingApplication.h
4*/
5#include "CEGUIForwardRefs.h"
6#include "ExampleApplication.h"
7#include "OgreOcclusionCullingSceneTraverser.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[OcclusionCullingSceneTraverser::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, CEGUI::Renderer *renderer);
31
32
33    ~MouseQueryListener( );
34
35        bool frameStarted(const FrameEvent& evt);
36        bool frameEnded(const FrameEvent& evt);
37
38    /* MouseListener callbacks. */
39    virtual void mouseClicked(MouseEvent* e) { }
40    virtual void mouseEntered(MouseEvent* e) { }
41    virtual void mouseExited(MouseEvent* e)  { }
42
43    // This is when the mouse button goes DOWN.
44    virtual void mousePressed(MouseEvent* e);
45
46    // This is when the mouse button is let UP.
47    virtual void mouseReleased(MouseEvent* e);
48
49    /* MouseMotionListener callbacks */
50    virtual void mouseMoved (MouseEvent *e);
51   
52    // This is when the mouse is clicked, held and dragged.
53    virtual void mouseDragged (MouseEvent *e);
54
55    void keyPressed(KeyEvent* e);
56
57        void keyReleased(KeyEvent* e);
58        void keyClicked(KeyEvent* e);
59
60        void changeAlgorithm();
61        void changeThreshold(int incr);
62        void changeStats();
63
64protected:
65    bool mLMouseDown, mRMouseDown;     // True if the mouse buttons are down
66    SceneManager *mSceneMgr;           // A pointer to the scene manager
67   
68        CEGUI::Renderer *mGUIRenderer;     // cegui renderer
69       
70        bool mShutdownRequested;
71        int mCurrentAlgorithm;
72        int mThreshold;
73
74        OverlayElement *mAlgorithmInfo;
75        OverlayElement *mThresholdInfo;
76        OverlayElement *mFrustumCulledNodesInfo;
77        OverlayElement *mQueryCulledNodesInfo;
78    OverlayElement *mTraversedNodesInfo;
79        OverlayElement *mHierarchyNodesInfo;
80        OverlayElement *mSceneNodesInfo;
81};
82
83
84class TestCullingApplication : public ExampleApplication
85{
86public:
87        //~TestCullingApplication();
88
89protected:
90        void createScene(void);
91        void createFrameListener(void);
92        void setupGui(void);
93        /** generates a the scene hierarchy with random values
94        @param number of objects to generate
95        */
96        void generateScene(int numObjects);
97
98        /** generates a new scene object
99        @param tranlationRatio ratio between minimal and maximal possible translation
100        @param rotationRatio ratio between minimal and maximal possible rotation
101        @idx the index of the new object
102        @entName the name of the object entity
103        */
104        void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio,
105                                                         const int idx, const String &entName);
106
107        //virtual void createCamera(void);
108
109        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
110        CEGUI::System *mGUISystem;
111
112        Vector3 mMinTranslation;
113        Vector3 mMaxTranslation;
114
115        Vector3 mMinAngle;
116        Vector3 mMaxAngle;
117
118private:
119        void chooseSceneManager(void);
120};
121
Note: See TracBrowser for help on using the repository browser.