Changeset 28
- Timestamp:
- 03/24/05 08:18:59 (20 years ago)
- Location:
- trunk/VUT/OcclusionCullingSceneManager
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.cpp
r18 r28 6 6 */ 7 7 8 #pragma warning (push) 9 #pragma warning( disable : 4267 ) 10 11 #include <OgreNoMemoryMacros.h> 12 #include <CEGUI/CEGUI.h> 13 #include <../CEGUIRenderer/include/OgreCEGUIRenderer.h> 14 #include <../CEGUIRenderer/include/OgreCEGUIResourceProvider.h> 15 #include <../CEGUIRenderer/include/OgreCEGUITexture.h> 16 #include <OgreMemoryMacros.h> 17 #pragma warning (pop) 18 /* 8 19 #include <CEGUI/CEGUIImageset.h> 9 20 #include <CEGUI/CEGUISystem.h> … … 21 32 #include "OgreCEGUIRenderer.h" 22 33 #include "OgreCEGUIResourceProvider.h" 23 34 */ 24 35 #include "Ogre.h" 25 36 #include "TestCullingApplication.h" -
trunk/VUT/OcclusionCullingSceneManager/TestCulling/TestCullingApplication.h
r27 r28 7 7 #include "OgreOcclusionCullingSceneManager.h" 8 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 mAlgorithmTypeCaptions[OcclusionCullingSceneManager::NUM_RENDERMODES] = 20 { 21 "Cull Frustum", 22 "Stop and Wait", 23 "Coherent Occlusion Culling" 24 }; 25 9 26 class MouseQueryListener : public ExampleFrameListener, public MouseListener, public MouseMotionListener 10 27 { … … 13 30 MouseQueryListener(RenderWindow* win, Camera* cam, SceneManager *sceneManager, CEGUI::Renderer *renderer, 14 31 SceneNode* shipNode) 15 : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), mShipNode(shipNode) , mShutdownRequested(false)32 : ExampleFrameListener(win, cam, false, true), mGUIRenderer(renderer), mShipNode(shipNode)//, mShutdownRequested(false) 16 33 { 17 34 … … 28 45 mAlgorithmType = OcclusionCullingSceneManager::RENDER_COHERENT; 29 46 30 //mMyOverlay = OverlayManager::getSingleton().getByName("scripts/MyPanel");31 mMyOverlay = OverlayManager::getSingleton().getByName("Core/MyPanel");32 33 //mDebugOverlay->hide();34 //mMyOverlay->show();35 47 // Register this so that we get mouse events. 36 48 mEventProcessor->addMouseListener(this); 37 49 mEventProcessor->addMouseMotionListener(this); 38 50 mEventProcessor->addKeyListener(this); 51 52 // show overlay 53 Overlay* pOver = OverlayManager::getSingleton().getByName("Example/ShadowsOverlay"); 54 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Shadows/ShadowTechniqueInfo"); 55 //mMaterialInfo = OverlayManager::getSingleton().getOverlayElement("Example/Shadows/MaterialInfo"); 56 //mInfo = OverlayManager::getSingleton().getOverlayElement("Example/Shadows/Info"); 57 58 mAlgorithmInfo->setCaption("Algorithm: " + mAlgorithmTypeCaptions[mAlgorithmType]); 59 //mMaterialInfo->setCaption("Current: " + mAtheneMaterials[mCurrentAtheneMaterial]); 60 pOver->show(); 39 61 } // MouseQueryListener 40 62 … … 43 65 } 44 66 45 void myShowOverlay(bool show) 46 { 47 if (mDebugOverlay) 48 { 49 if (show) 50 { 51 mDebugOverlay->show(); 52 } 53 else 54 { 55 mDebugOverlay->hide(); 56 } 57 } 58 if(mMyOverlay) 59 { 60 mMyOverlay->show(); 61 } 67 bool frameEnded(const FrameEvent& evt) 68 { 69 if (timeDelay >= 0) 70 timeDelay -= evt.timeSinceLastFrame; 62 71 63 } 64 bool frameStarted(const FrameEvent &evt) 65 { 66 /* Real MoveFactor = 80.0 * evt.timeSinceLastFrame; 67 68 mInputDevice->capture(); 69 70 if(mInputDevice->isKeyDown(Ogre::KC_UP)) 71 { 72 mAlgorithmType = (mAlgorithmType + 1) % OcclusionCullingSceneManager::NUM_RENDERMODES; 73 //mShipNode->translate(0.0, MoveFactor, 0.0); 74 } 75 76 if(mInputDevice->isKeyDown(Ogre::KC_DOWN)) 77 mShipNode->translate(0.0, -MoveFactor, 0.0); 78 79 if(mInputDevice->isKeyDown(Ogre::KC_LEFT)) 80 mShipNode->translate(-MoveFactor, 0.0, 0.0); 81 82 if(mInputDevice->isKeyDown(Ogre::KC_RIGHT)) 83 mShipNode->translate(MoveFactor, 0.0, 0.0); 84 85 if(mInputDevice->isKeyDown(Ogre::KC_ESCAPE)) 86 return false;*/ 87 88 if(mInputDevice->isKeyDown(Ogre::KC_L)) 89 myShowOverlay(false); 90 91 return ExampleFrameListener::frameStarted(evt); 72 KEY_PRESSED(KC_O, 1, changeAlgorithm()); 73 74 return ExampleFrameListener::frameStarted(evt) && ExampleFrameListener::frameEnded(evt); 92 75 } 93 76 … … 108 91 // This is when the mouse is clicked, held and dragged. 109 92 virtual void mouseDragged (MouseEvent *e); 110 93 /* 111 94 void keyPressed(KeyEvent* e) 112 95 { … … 134 117 } 135 118 136 119 bool frameEnded(const FrameEvent& evt) 137 120 { 138 121 if (mShutdownRequested) … … 141 124 return ExampleFrameListener::frameEnded(evt); 142 125 } 126 */ 127 void changeAlgorithm() 128 { 129 mAlgorithmType = ++mAlgorithmType % OcclusionCullingSceneManager::NUM_RENDERMODES; 130 mAlgorithmInfo->setCaption("Algorithm: " + mAlgorithmTypeCaptions[mAlgorithmType]); 131 } 143 132 144 void setAlgorithmType(int type) { mAlgorithmType = type; }145 int getAlgorithmType() { return mAlgorithmType; }146 133 147 134 protected: … … 151 138 CEGUI::Renderer *mGUIRenderer; // cegui renderer 152 139 SceneNode* mShipNode; 153 bool mShutdownRequested;140 // bool mShutdownRequested; 154 141 int mAlgorithmType; 155 Overlay *mMyOverlay;142 OverlayElement *mAlgorithmInfo; 156 143 }; 157 144 -
trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h
r26 r28 40 40 ~OcclusionCullingSceneManager(); 41 41 42 43 42 enum {RENDER_CULL_FRUSTUM, RENDER_STOP_AND_WAIT, RENDER_COHERENT, NUM_RENDERMODES}; 44 43 -
trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp
r26 r28 27 27 OcclusionCullingSceneManager::~OcclusionCullingSceneManager() 28 28 { 29 delete mHalfBoundingBox[0];30 delete mHalfBoundingBox[1];29 if(mHalfBoundingBox[0]) delete mHalfBoundingBox[0]; 30 if(mHalfBoundingBox[1]) delete mHalfBoundingBox[1]; 31 31 32 32 deleteQueries();
Note: See TracChangeset
for help on using the changeset viewer.