[47] | 1 | /**
|
---|
| 2 | \file
|
---|
[48] | 3 | TestCullingTerrainApplication.h
|
---|
[47] | 4 | */
|
---|
| 5 | #include "CEGUIForwardRefs.h"
|
---|
| 6 | #include "ExampleApplication.h"
|
---|
| 7 | #include "OgreOcclusionCullingSceneTraverser.h"
|
---|
| 8 |
|
---|
| 9 | Real 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 |
|
---|
| 19 | String mCurrentAlgorithmCaptions[OcclusionCullingSceneTraverser::NUM_RENDERMODES] =
|
---|
| 20 | {
|
---|
| 21 | "Cull Frustum",
|
---|
| 22 | "Stop and Wait",
|
---|
| 23 | "Coherent Occlusion Culling"
|
---|
| 24 | };
|
---|
| 25 |
|
---|
| 26 | class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
|
---|
| 27 | {
|
---|
| 28 | public:
|
---|
| 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 |
|
---|
| 64 | protected:
|
---|
| 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;
|
---|
[52] | 81 | OverlayElement *mRenderedNodesInfo;
|
---|
[47] | 82 |
|
---|
| 83 | SceneNode *mCurrentObject; // The newly created object
|
---|
| 84 | int mCount; // The number of robots on the screen
|
---|
| 85 | RaySceneQuery *mRaySceneQuery; // The ray scene query pointer
|
---|
| 86 | };
|
---|
| 87 |
|
---|
| 88 |
|
---|
[48] | 89 | class TestCullingTerrainApplication : public ExampleApplication
|
---|
[47] | 90 | {
|
---|
| 91 | public:
|
---|
[48] | 92 | //~TestCullingTerrainApplication();
|
---|
[47] | 93 |
|
---|
| 94 | protected:
|
---|
| 95 | void createScene(void);
|
---|
| 96 | void createFrameListener(void);
|
---|
| 97 | void setupGui(void);
|
---|
| 98 | virtual void createCamera(void);
|
---|
| 99 |
|
---|
| 100 | CEGUI::OgreCEGUIRenderer *mGUIRenderer;
|
---|
| 101 | CEGUI::System *mGUISystem;
|
---|
| 102 |
|
---|
| 103 | private:
|
---|
| 104 | void chooseSceneManager(void);
|
---|
| 105 | };
|
---|
| 106 |
|
---|