| 1 | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
|---|
| 2 | // Zen Game Engine Framework |
|---|
| 3 | // |
|---|
| 4 | // Copyright (C) 2001 - 2008 Tony Richards |
|---|
| 5 | // |
|---|
| 6 | // This software is provided 'as-is', without any express or implied |
|---|
| 7 | // warranty. In no event will the authors be held liable for any damages |
|---|
| 8 | // arising from the use of this software. |
|---|
| 9 | // |
|---|
| 10 | // Permission is granted to anyone to use this software for any purpose, |
|---|
| 11 | // including commercial applications, and to alter it and redistribute it |
|---|
| 12 | // freely, subject to the following restrictions: |
|---|
| 13 | // |
|---|
| 14 | // 1. The origin of this software must not be misrepresented; you must not |
|---|
| 15 | // claim that you wrote the original software. If you use this software |
|---|
| 16 | // in a product, an acknowledgment in the product documentation would be |
|---|
| 17 | // appreciated but is not required. |
|---|
| 18 | // 2. Altered source versions must be plainly marked as such, and must not be |
|---|
| 19 | // misrepresented as being the original software. |
|---|
| 20 | // 3. This notice may not be removed or altered from any source distribution. |
|---|
| 21 | // |
|---|
| 22 | // Tony Richards trichards@indiezen.com |
|---|
| 23 | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
|---|
| 24 | #ifndef ZEN_ZOGRE_RENDERING_CANVAS_HPP_INCLUDED |
|---|
| 25 | #define ZEN_ZOGRE_RENDERING_CANVAS_HPP_INCLUDED |
|---|
| 26 | |
|---|
| 27 | #include "../I_OgreRenderingCanvas.hpp" |
|---|
| 28 | |
|---|
| 29 | #include "Ogre.hpp" |
|---|
| 30 | |
|---|
| 31 | #if 0 // deprecated |
|---|
| 32 | #include <OIS/OISEvents.h> |
|---|
| 33 | #include <OIS/OISInputManager.h> |
|---|
| 34 | #include <OIS/OISKeyboard.h> |
|---|
| 35 | #endif // deprecated |
|---|
| 36 | |
|---|
| 37 | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
|---|
| 38 | namespace Zen { |
|---|
| 39 | namespace ZOgre { |
|---|
| 40 | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
|---|
| 41 | class RenderingView; |
|---|
| 42 | class Camera; |
|---|
| 43 | |
|---|
| 44 | /// A RenderingCanvas is the same as an Ogre::ViewPort |
|---|
| 45 | class RenderingCanvas |
|---|
| 46 | : public I_OgreRenderingCanvas |
|---|
| 47 | { |
|---|
| 48 | /// @name I_Canvas implementation |
|---|
| 49 | /// @{ |
|---|
| 50 | public: |
|---|
| 51 | //virtual void setCamera(pCamera_type _camera); |
|---|
| 52 | //virtual void setCameraType(const std::string& _cameraType); |
|---|
| 53 | virtual void setSceneGraph(const Engine::Rendering::I_SceneGraph& _sceneGraph); |
|---|
| 54 | /// @} |
|---|
| 55 | |
|---|
| 56 | /// @name I_RenderingCanvas implementation |
|---|
| 57 | /// @{ |
|---|
| 58 | public: |
|---|
| 59 | virtual void resize(int _x, int _y, int _width, int _height); |
|---|
| 60 | virtual void renderScene(); |
|---|
| 61 | virtual void swapBuffers(); |
|---|
| 62 | virtual void clearBackBuffer(); |
|---|
| 63 | virtual void setInputDevice(const std::string& _deviceName); |
|---|
| 64 | |
|---|
| 65 | virtual void focusLost(); |
|---|
| 66 | virtual void focusGained(); |
|---|
| 67 | |
|---|
| 68 | virtual unsigned getWidth() const; |
|---|
| 69 | virtual unsigned getHeight() const; |
|---|
| 70 | |
|---|
| 71 | virtual Engine::Rendering::I_Camera& createCamera(const std::string& _name); |
|---|
| 72 | virtual Engine::Rendering::I_Camera& getCurrentCamera(); |
|---|
| 73 | virtual Engine::Rendering::I_Camera& selectCamera(const std::string& _name); |
|---|
| 74 | |
|---|
| 75 | virtual void querySceneNodes(Math::Real _x, Math::Real _y, I_SceneNodeVisitor& _visitor); |
|---|
| 76 | /// @} |
|---|
| 77 | |
|---|
| 78 | /// @name I_OgreRenderingCanvas implementation |
|---|
| 79 | /// @{ |
|---|
| 80 | public: |
|---|
| 81 | virtual void initializeCompositor(const std::string& _name); |
|---|
| 82 | virtual void enableCompositor(const std::string& _name); |
|---|
| 83 | virtual void disableCompositor(const std::string& _name); |
|---|
| 84 | /// @} |
|---|
| 85 | |
|---|
| 86 | /// @name RenderingCanvas implementation |
|---|
| 87 | /// @{ |
|---|
| 88 | public: |
|---|
| 89 | Ogre::SceneManager* getOgreSceneManager() const; |
|---|
| 90 | Ogre::Viewport* getOgreViewport() const; |
|---|
| 91 | /// @} |
|---|
| 92 | |
|---|
| 93 | /// @name 'Structors |
|---|
| 94 | /// @{ |
|---|
| 95 | public: |
|---|
| 96 | RenderingCanvas(RenderingView* _pView); |
|---|
| 97 | virtual ~RenderingCanvas(); |
|---|
| 98 | |
|---|
| 99 | /// @name Member Variables |
|---|
| 100 | /// @{ |
|---|
| 101 | private: |
|---|
| 102 | Ogre::Root& m_root; |
|---|
| 103 | |
|---|
| 104 | /// Parent view |
|---|
| 105 | RenderingView* m_pRenderingView; |
|---|
| 106 | |
|---|
| 107 | Ogre::SceneManager* m_pSceneManager; |
|---|
| 108 | |
|---|
| 109 | Ogre::Viewport* m_pViewPort; |
|---|
| 110 | |
|---|
| 111 | typedef std::map<std::string, Camera*> Cameras_type; |
|---|
| 112 | Cameras_type m_cameras; |
|---|
| 113 | Camera* m_pCurrentCamera; |
|---|
| 114 | |
|---|
| 115 | //pCamera_type m_pCameraController; |
|---|
| 116 | //std::string m_strCameraType; |
|---|
| 117 | |
|---|
| 118 | #if 0 // deprecated |
|---|
| 119 | // TODO This should be abstracted into an I_InputManager |
|---|
| 120 | OIS::InputManager* m_pInputManager; |
|---|
| 121 | |
|---|
| 122 | // TODO This should be abstracted into an I_InputService |
|---|
| 123 | OIS::Keyboard* m_pKeyboard; |
|---|
| 124 | #endif // deprecated |
|---|
| 125 | |
|---|
| 126 | std::map< std::string, bool > m_compositors; |
|---|
| 127 | bool m_isCompositorManagerInitialized; |
|---|
| 128 | /// @} |
|---|
| 129 | |
|---|
| 130 | }; // class RenderingCanvas |
|---|
| 131 | |
|---|
| 132 | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
|---|
| 133 | } // namespace ZOgre |
|---|
| 134 | } // namespace Zen |
|---|
| 135 | //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ |
|---|
| 136 | |
|---|
| 137 | #endif // ZEN_ZOGRE_RENDERING_CANVAS_HPP_INCLUDED |
|---|