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

Revision 52, 3.2 KB checked in by mattausch, 20 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        OverlayElement *mRenderedNodesInfo;
82};
83
84
85class TestCullingApplication : public ExampleApplication
86{
87public:
88        //~TestCullingApplication();
89
90protected:
91        void createScene(void);
92        void createFrameListener(void);
93        void setupGui(void);
94        /** generates a the scene hierarchy with random values
95        @param number of objects to generate
96        */
97        void generateScene(int numObjects);
98
99        /** generates a new scene object
100        @param tranlationRatio ratio between minimal and maximal possible translation
101        @param rotationRatio ratio between minimal and maximal possible rotation
102        @idx the index of the new object
103        @entName the name of the object entity
104        */
105        void generateSceneObject(const Vector3 &translationRatio, const Vector3 &rotationRatio,
106                                                         const int idx, const String &entName);
107
108        //virtual void createCamera(void);
109
110        CEGUI::OgreCEGUIRenderer *mGUIRenderer;
111        CEGUI::System *mGUISystem;
112
113        Vector3 mMinTranslation;
114        Vector3 mMaxTranslation;
115
116        Vector3 mMinAngle;
117        Vector3 mMaxAngle;
118
119private:
120        void chooseSceneManager(void);
121};
122
Note: See TracBrowser for help on using the repository browser.