[12] | 1 | /**
|
---|
| 2 | \file
|
---|
| 3 | TestCullingApplication.h
|
---|
| 4 | */
|
---|
[18] | 5 | #include "CEGUIForwardRefs.h"
|
---|
[12] | 6 | #include "ExampleApplication.h"
|
---|
[26] | 7 | #include "OgreOcclusionCullingSceneManager.h"
|
---|
[32] | 8 | #include "OgreOcclusionCullingSceneTraverser.h"
|
---|
[12] | 9 |
|
---|
[28] | 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 |
|
---|
[32] | 20 | String mCurrentAlgorithmCaptions[OcclusionCullingSceneTraverser::NUM_RENDERMODES] =
|
---|
[28] | 21 | {
|
---|
| 22 | "Cull Frustum",
|
---|
| 23 | "Stop and Wait",
|
---|
| 24 | "Coherent Occlusion Culling"
|
---|
| 25 | };
|
---|
| 26 |
|
---|
[18] | 27 | class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener
|
---|
| 28 | {
|
---|
| 29 | public:
|
---|
| 30 |
|
---|
| 31 | MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer,
|
---|
[29] | 32 | SceneNode* shipNode);
|
---|
[27] | 33 |
|
---|
[18] | 34 |
|
---|
| 35 | ~MouseQueryListener( )
|
---|
| 36 | {
|
---|
| 37 | }
|
---|
| 38 |
|
---|
[29] | 39 | bool frameEnded(const FrameEvent& evt);
|
---|
[27] | 40 | /* MouseListener callbacks. */
|
---|
| 41 | virtual void mouseClicked(MouseEvent* e) { }
|
---|
| 42 | virtual void mouseEntered(MouseEvent* e) { }
|
---|
| 43 | virtual void mouseExited(MouseEvent* e) { }
|
---|
[18] | 44 |
|
---|
[27] | 45 | // This is when the mouse button goes DOWN.
|
---|
| 46 | virtual void mousePressed(MouseEvent* e);
|
---|
[18] | 47 |
|
---|
[27] | 48 | // This is when the mouse button is let UP.
|
---|
| 49 | virtual void mouseReleased(MouseEvent* e);
|
---|
[18] | 50 |
|
---|
[27] | 51 | /* MouseMotionListener callbacks */
|
---|
| 52 | virtual void mouseMoved (MouseEvent *e);
|
---|
[18] | 53 |
|
---|
[27] | 54 | // This is when the mouse is clicked, held and dragged.
|
---|
| 55 | virtual void mouseDragged (MouseEvent *e);
|
---|
[26] | 56 |
|
---|
[32] | 57 | void keyPressed(KeyEvent* e);
|
---|
[26] | 58 |
|
---|
[32] | 59 | void keyReleased(KeyEvent* e);
|
---|
| 60 | void keyClicked(KeyEvent* e);
|
---|
[26] | 61 |
|
---|
[29] | 62 | void changeAlgorithm();
|
---|
[32] | 63 | void changeThreshold(int incr);
|
---|
[30] | 64 | void changeStats();
|
---|
[26] | 65 |
|
---|
[18] | 66 | protected:
|
---|
| 67 | bool mLMouseDown, mRMouseDown; // True if the mouse buttons are down
|
---|
| 68 | SceneManager *mSceneMgr; // A pointer to the scene manager
|
---|
| 69 | SceneNode *mCurrentObject; // The newly created object
|
---|
| 70 | CEGUI::Renderer *mGUIRenderer; // cegui renderer
|
---|
| 71 | SceneNode* mShipNode;
|
---|
[32] | 72 | bool mShutdownRequested;
|
---|
[29] | 73 | int mCurrentAlgorithm;
|
---|
[32] | 74 | int mThreshold;
|
---|
| 75 |
|
---|
[28] | 76 | OverlayElement *mAlgorithmInfo;
|
---|
[30] | 77 | OverlayElement *mThresholdInfo;
|
---|
| 78 | OverlayElement *mFrustumCulledNodesInfo;
|
---|
| 79 | OverlayElement *mQueryCulledNodesInfo;
|
---|
| 80 | OverlayElement *mTraversedNodesInfo;
|
---|
| 81 |
|
---|
[18] | 82 | };
|
---|
| 83 |
|
---|
| 84 |
|
---|
[12] | 85 | class TestCullingApplication : public ExampleApplication
|
---|
| 86 | {
|
---|
| 87 | public:
|
---|
| 88 | /*TestCullingApplication()
|
---|
| 89 | {
|
---|
| 90 | }*/
|
---|
| 91 |
|
---|
| 92 | protected:
|
---|
| 93 | void createScene(void);
|
---|
[29] | 94 | void createFrameListener(void);
|
---|
[12] | 95 |
|
---|
[18] | 96 | CEGUI::OgreCEGUIRenderer *mGUIRenderer;
|
---|
| 97 | CEGUI::System *mGUISystem;
|
---|
| 98 |
|
---|
[12] | 99 | private:
|
---|
[29] | 100 | void chooseSceneManager(void);
|
---|
| 101 |
|
---|
[12] | 102 | Entity* mShip;
|
---|
| 103 | SceneNode* mShipNode;
|
---|
| 104 |
|
---|
| 105 | /* String mQuakePk3;
|
---|
| 106 | String mQuakeLevel;
|
---|
| 107 |
|
---|
| 108 | // Override resource sources (include Quake3 archives)
|
---|
| 109 | void setupResources(void)
|
---|
| 110 | {
|
---|
| 111 |
|
---|
| 112 | // Load Quake3 locations from a file
|
---|
| 113 | ConfigFile cf;
|
---|
| 114 |
|
---|
| 115 | cf.load("quake3settings.cfg");
|
---|
| 116 |
|
---|
| 117 | mQuakePk3 = cf.getSetting("Pak0Location");
|
---|
| 118 | mQuakeLevel = cf.getSetting("Map");
|
---|
| 119 |
|
---|
| 120 | ExampleApplication::setupResources();
|
---|
| 121 | ResourceManager::addCommonArchiveEx(mQuakePk3, "Zip");
|
---|
| 122 |
|
---|
| 123 | }*/
|
---|
| 124 | };
|
---|
| 125 |
|
---|