| 1 | /* |
|---|
| 2 | ----------------------------------------------------------------------------- |
|---|
| 3 | This source file is part of OGRE |
|---|
| 4 | (Object-oriented Graphics Rendering Engine) |
|---|
| 5 | For the latest info, see http://www.ogre3d.org/ |
|---|
| 6 | |
|---|
| 7 | Copyright (c) 2000-2006 The OGRE Team |
|---|
| 8 | Also see acknowledgements in Readme.html |
|---|
| 9 | |
|---|
| 10 | You may use this sample code for anything you like, it is not covered by the |
|---|
| 11 | LGPL like the rest of the engine. |
|---|
| 12 | ----------------------------------------------------------------------------- |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | #ifndef _ColladaDemo_H_ |
|---|
| 16 | #define _ColladaDemo_H_ |
|---|
| 17 | |
|---|
| 18 | #include "Ogre.h" |
|---|
| 19 | #include "CEGUI/CEGUI.h" |
|---|
| 20 | #include "CEGUI/CEGUIRenderer.h" |
|---|
| 21 | |
|---|
| 22 | //--------------------------------------------------------------------------- |
|---|
| 23 | class UIHandler; |
|---|
| 24 | |
|---|
| 25 | class ColladaDemo |
|---|
| 26 | { |
|---|
| 27 | protected: |
|---|
| 28 | Ogre::Root* mRoot; |
|---|
| 29 | Ogre::SceneManager* mSceneMgr; |
|---|
| 30 | UIHandler* mFrameListener; |
|---|
| 31 | Ogre::RenderWindow* mWindow; |
|---|
| 32 | Ogre::Camera* mActiveCamera; |
|---|
| 33 | |
|---|
| 34 | CEGUI::Renderer* mGUIRenderer; |
|---|
| 35 | CEGUI::System* mGUISystem; |
|---|
| 36 | CEGUI::Window* mLoadingWindow; |
|---|
| 37 | Ogre::String mActiveDaeFileName; |
|---|
| 38 | unsigned int mLastUpdateTime; |
|---|
| 39 | float mElapsedTime; |
|---|
| 40 | bool mAutoReload; |
|---|
| 41 | bool mLoadQued; |
|---|
| 42 | unsigned long mLastFrameNumber; |
|---|
| 43 | |
|---|
| 44 | // These internal methods package up the stages in the startup process |
|---|
| 45 | /** Sets up the application - returns false if the user chooses to abandon configuration. */ |
|---|
| 46 | bool setup(); |
|---|
| 47 | |
|---|
| 48 | /** Configures the application - returns false if the user chooses to abandon configuration. */ |
|---|
| 49 | bool configure(); |
|---|
| 50 | void createDefaultCamera(); |
|---|
| 51 | void createViewports(); |
|---|
| 52 | void updateAvailableCameras(); |
|---|
| 53 | void updateDaeFileList(); |
|---|
| 54 | |
|---|
| 55 | /// Method which will define the source of resources (other than current folder) |
|---|
| 56 | void setupResources(); |
|---|
| 57 | bool setupGUI(); |
|---|
| 58 | void createFrameListener(); |
|---|
| 59 | |
|---|
| 60 | void initDemoEventWiring(); |
|---|
| 61 | |
|---|
| 62 | void doErrorBox(const char* text); |
|---|
| 63 | void viewColladaDocument(const Ogre::String& daeFileName); |
|---|
| 64 | |
|---|
| 65 | bool handleQuit(const CEGUI::EventArgs& e); |
|---|
| 66 | bool handleDaeComboChanged(const CEGUI::EventArgs& e); |
|---|
| 67 | bool handleCameraComboChanged(const CEGUI::EventArgs& e); |
|---|
| 68 | bool handleAutoReloadChanged(const CEGUI::EventArgs& e); |
|---|
| 69 | bool handleErrorBox(const CEGUI::EventArgs& e); |
|---|
| 70 | bool handleUpdateList(const CEGUI::EventArgs& e); |
|---|
| 71 | |
|---|
| 72 | public: |
|---|
| 73 | ColladaDemo() |
|---|
| 74 | : mRoot(0) |
|---|
| 75 | , mFrameListener(0) |
|---|
| 76 | , mGUIRenderer(0) |
|---|
| 77 | , mGUISystem(0) |
|---|
| 78 | , mLoadingWindow(0) |
|---|
| 79 | , mLastUpdateTime(0) |
|---|
| 80 | , mElapsedTime(0.0) |
|---|
| 81 | , mAutoReload(false) |
|---|
| 82 | , mLoadQued(false) |
|---|
| 83 | , mLastFrameNumber(0) |
|---|
| 84 | { |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | ~ColladaDemo(); |
|---|
| 88 | |
|---|
| 89 | void go(); |
|---|
| 90 | |
|---|
| 91 | void ColladaDemo::setActiveCamera(const Ogre::String& cameraName); |
|---|
| 92 | Ogre::Camera* getActiveCamera() const { return mActiveCamera; } |
|---|
| 93 | Ogre::SceneManager* getSceneManager() const { return mSceneMgr; } |
|---|
| 94 | Ogre::RenderWindow* getRenderWindow() const { return mWindow; } |
|---|
| 95 | |
|---|
| 96 | void clearScene(); |
|---|
| 97 | void loadActiveDae(); |
|---|
| 98 | void updateAutoReload(float time); |
|---|
| 99 | bool checkActiveFileUpdated(); |
|---|
| 100 | void showLoadingWindow(const bool show); |
|---|
| 101 | |
|---|
| 102 | }; |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | #endif // end _ColladaDemo_H_ |
|---|