1 | /**
|
---|
2 | \file
|
---|
3 | TestCullingApplication.h
|
---|
4 | */
|
---|
5 | #include "CEGUIForwardRefs.h"
|
---|
6 | #include "ExampleApplication.h"
|
---|
7 | #include "OgreLight.h"
|
---|
8 | //#include "OgreVisibilitySceneTraverser.h"
|
---|
9 |
|
---|
10 | Real 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 |
|
---|
20 | String mCurrentAlgorithmCaptions[3/*VisibilitySceneTraverser::NUM_RENDERMODES*/] =
|
---|
21 | {
|
---|
22 | "Cull Frustum",
|
---|
23 | "Stop and Wait",
|
---|
24 | "Coherent Occlusion Culling"
|
---|
25 | };
|
---|
26 |
|
---|
27 | class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
|
---|
28 | {
|
---|
29 | public:
|
---|
30 |
|
---|
31 | MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer);
|
---|
32 |
|
---|
33 |
|
---|
34 | ~MouseQueryListener( )
|
---|
35 | {
|
---|
36 | }
|
---|
37 |
|
---|
38 | // bool frameStarted(const FrameEvent& evt);
|
---|
39 | bool frameEnded(const FrameEvent& evt);
|
---|
40 |
|
---|
41 | /* MouseListener callbacks. */
|
---|
42 | virtual void mouseClicked(MouseEvent* e) { }
|
---|
43 | virtual void mouseEntered(MouseEvent* e) { }
|
---|
44 | virtual void mouseExited(MouseEvent* e) { }
|
---|
45 |
|
---|
46 | // This is when the mouse button goes DOWN.
|
---|
47 | virtual void mousePressed(MouseEvent* e);
|
---|
48 |
|
---|
49 | // This is when the mouse button is let UP.
|
---|
50 | virtual void mouseReleased(MouseEvent* e);
|
---|
51 |
|
---|
52 | /* MouseMotionListener callbacks */
|
---|
53 | virtual void mouseMoved (MouseEvent *e);
|
---|
54 |
|
---|
55 | // This is when the mouse is clicked, held and dragged.
|
---|
56 | virtual void mouseDragged (MouseEvent *e);
|
---|
57 |
|
---|
58 | void keyPressed(KeyEvent* e);
|
---|
59 |
|
---|
60 | void keyReleased(KeyEvent* e);
|
---|
61 | void keyClicked(KeyEvent* e);
|
---|
62 |
|
---|
63 | void changeAlgorithm();
|
---|
64 | void changeThreshold(int incr);
|
---|
65 | void changeStats();
|
---|
66 |
|
---|
67 | protected:
|
---|
68 | bool mLMouseDown, mRMouseDown; // True if the mouse buttons are down
|
---|
69 | SceneManager *mSceneMgr; // A pointer to the scene manager
|
---|
70 |
|
---|
71 | CEGUI::Renderer *mGUIRenderer; // cegui renderer
|
---|
72 |
|
---|
73 | bool mShutdownRequested;
|
---|
74 | int mCurrentAlgorithm;
|
---|
75 | int mThreshold;
|
---|
76 |
|
---|
77 | OverlayElement *mAlgorithmInfo;
|
---|
78 | OverlayElement *mThresholdInfo;
|
---|
79 | OverlayElement *mFrustumCulledNodesInfo;
|
---|
80 | OverlayElement *mQueryCulledNodesInfo;
|
---|
81 | OverlayElement *mTraversedNodesInfo;
|
---|
82 | OverlayElement *mSceneNodesInfo;
|
---|
83 | };
|
---|
84 |
|
---|
85 |
|
---|
86 | class TestCullingDotSceneApplication : public ExampleApplication
|
---|
87 | {
|
---|
88 | public:
|
---|
89 | //~TestCullingDotSceneApplication();
|
---|
90 |
|
---|
91 | protected:
|
---|
92 | void createScene(void);
|
---|
93 | void createFrameListener(void);
|
---|
94 | void setupGui(void);
|
---|
95 | void ParseDotScene( const String &SceneName, const String& groupName );
|
---|
96 | Light* LoadLight( TiXmlElement *XMLLight );
|
---|
97 |
|
---|
98 | virtual void createViewports(void);
|
---|
99 |
|
---|
100 | CEGUI::OgreCEGUIRenderer *mGUIRenderer;
|
---|
101 | CEGUI::System *mGUISystem;
|
---|
102 |
|
---|
103 | private:
|
---|
104 | void chooseSceneManager(void);
|
---|
105 |
|
---|
106 | //SceneManager* mSceneMgr;
|
---|
107 | //Entity* mShip;
|
---|
108 | //SceneNode* mShipNode;
|
---|
109 | };
|
---|
110 |
|
---|