#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIRENDERMANAGER_H #define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUIRENDERMANAGER_H #include #include namespace Resource { class TextureManager; } namespace osgViewer { class Viewer; } namespace osg { class Group; class Camera; class RenderInfo; } namespace osgMyGUI { class RenderManager : public MyGUI::RenderManager, public MyGUI::IRenderTarget { osg::ref_ptr mViewer; osg::ref_ptr mSceneRoot; Resource::TextureManager* mTextureManager; MyGUI::IntSize mViewSize; bool mUpdate; MyGUI::VertexColourType mVertexFormat; MyGUI::RenderTargetInfo mInfo; typedef std::map MapTexture; MapTexture mTextures; bool mIsInitialise; osg::ref_ptr mGuiRoot; // Only valid during drawFrame()! osg::RenderInfo *mRenderInfo; void destroyAllResources(); public: RenderManager(osgViewer::Viewer *viewer, osg::Group *sceneroot, Resource::TextureManager* textureManager); virtual ~RenderManager(); void initialise(); void shutdown(); static RenderManager& getInstance() { return *getInstancePtr(); } static RenderManager* getInstancePtr() { return static_cast(MyGUI::RenderManager::getInstancePtr()); } /** @see RenderManager::getViewSize */ virtual const MyGUI::IntSize& getViewSize() const { return mViewSize; } /** @see RenderManager::getVertexFormat */ virtual MyGUI::VertexColourType getVertexFormat() { return mVertexFormat; } /** @see RenderManager::isFormatSupported */ virtual bool isFormatSupported(MyGUI::PixelFormat format, MyGUI::TextureUsage usage); /** @see RenderManager::createVertexBuffer */ virtual MyGUI::IVertexBuffer* createVertexBuffer(); /** @see RenderManager::destroyVertexBuffer */ virtual void destroyVertexBuffer(MyGUI::IVertexBuffer *buffer); /** @see RenderManager::createTexture */ virtual MyGUI::ITexture* createTexture(const std::string &name); /** @see RenderManager::destroyTexture */ virtual void destroyTexture(MyGUI::ITexture* _texture); /** @see RenderManager::getTexture */ virtual MyGUI::ITexture* getTexture(const std::string &name); /** @see IRenderTarget::begin */ virtual void begin(); /** @see IRenderTarget::end */ virtual void end(); /** @see IRenderTarget::doRender */ virtual void doRender(MyGUI::IVertexBuffer *buffer, MyGUI::ITexture *texture, size_t count); /** @see IRenderTarget::getInfo */ virtual const MyGUI::RenderTargetInfo& getInfo() { return mInfo; } bool checkTexture(MyGUI::ITexture* _texture); /*internal:*/ void drawFrame(osg::RenderInfo &renderInfo); void setViewSize(int width, int height); }; } #endif