[36] | 1 | /**
|
---|
| 2 | \file
|
---|
| 3 | TestCullingApplication.h
|
---|
| 4 | */
|
---|
| 5 | #include "CEGUIForwardRefs.h"
|
---|
| 6 | #include "ExampleApplication.h"
|
---|
[37] | 7 | #include "OgreLight.h"
|
---|
[36] | 8 | #include "OgreOcclusionCullingSceneTraverser.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[OcclusionCullingSceneTraverser::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 |
|
---|
[37] | 38 | // bool frameStarted(const FrameEvent& evt);
|
---|
[36] | 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 | };
|
---|
| 83 |
|
---|
| 84 |
|
---|
[37] | 85 | class TestCullingDotSceneApplication : public ExampleApplication
|
---|
[36] | 86 | {
|
---|
| 87 | public:
|
---|
[37] | 88 | //~TestCullingDotSceneApplication();
|
---|
[36] | 89 |
|
---|
| 90 | protected:
|
---|
| 91 | void createScene(void);
|
---|
| 92 | void createFrameListener(void);
|
---|
| 93 | void setupGui(void);
|
---|
[37] | 94 | void ParseDotScene( const String &SceneName, const String& groupName );
|
---|
| 95 | Light* LoadLight( TiXmlElement *XMLLight );
|
---|
[36] | 96 |
|
---|
[37] | 97 | virtual void createViewports(void);
|
---|
[36] | 98 |
|
---|
| 99 | CEGUI::OgreCEGUIRenderer *mGUIRenderer;
|
---|
| 100 | CEGUI::System *mGUISystem;
|
---|
| 101 |
|
---|
| 102 | private:
|
---|
| 103 | void chooseSceneManager(void);
|
---|
| 104 |
|
---|
[37] | 105 | //SceneManager* mSceneMgr;
|
---|
[36] | 106 | //Entity* mShip;
|
---|
| 107 | //SceneNode* mShipNode;
|
---|
| 108 | };
|
---|
| 109 |
|
---|