OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
myguitexture.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUITEXTURE_H
2 #define OPENMW_COMPONENTS_MYGUIPLATFORM_MYGUITEXTURE_H
3 
4 #include <MyGUI_ITexture.h>
5 
6 #include <osg/ref_ptr>
7 
8 namespace osg
9 {
10  class Image;
11  class Texture2D;
12 }
13 
14 namespace Resource
15 {
16  class ImageManager;
17 }
18 
19 namespace osgMyGUI
20 {
21 
22  class OSGTexture : public MyGUI::ITexture {
23  std::string mName;
25 
26  osg::ref_ptr<osg::Image> mLockedImage;
27  osg::ref_ptr<osg::Texture2D> mTexture;
28  MyGUI::PixelFormat mFormat;
29  MyGUI::TextureUsage mUsage;
30  size_t mNumElemBytes;
31 
32  public:
33  OSGTexture(const std::string &name, Resource::ImageManager* imageManager);
34  OSGTexture(osg::Texture2D* texture);
35  virtual ~OSGTexture();
36 
37  virtual const std::string& getName() const { return mName; }
38 
39  virtual void createManual(int width, int height, MyGUI::TextureUsage usage, MyGUI::PixelFormat format);
40  virtual void loadFromFile(const std::string &fname);
41  virtual void saveToFile(const std::string &fname);
42 
43  virtual void destroy();
44 
45  virtual void* lock(MyGUI::TextureUsage access);
46  virtual void unlock();
47  virtual bool isLocked();
48 
49  virtual int getWidth();
50  virtual int getHeight();
51 
52  virtual MyGUI::PixelFormat getFormat() { return mFormat; }
53  virtual MyGUI::TextureUsage getUsage() { return mUsage; }
54  virtual size_t getNumElemBytes() { return mNumElemBytes; }
55 
56  virtual MyGUI::IRenderTarget *getRenderTarget();
57 
58  /*internal:*/
59  osg::Texture2D *getTexture() const { return mTexture.get(); }
60  };
61 
62 }
63 
64 #endif
MyGUI::TextureUsage mUsage
Definition: myguitexture.hpp:29
virtual ~OSGTexture()
Definition: myguitexture.cpp:31
Resource::ImageManager * mImageManager
Definition: myguitexture.hpp:24
virtual int getHeight()
Definition: myguitexture.cpp:116
osg::ref_ptr< osg::Texture2D > mTexture
Definition: myguitexture.hpp:27
Handles loading/caching of Images.
Definition: imagemanager.hpp:23
MyGUI::PixelFormat mFormat
Definition: myguitexture.hpp:28
virtual void saveToFile(const std::string &fname)
Definition: myguitexture.cpp:104
virtual MyGUI::TextureUsage getUsage()
Definition: myguitexture.hpp:53
virtual void destroy()
Definition: myguitexture.cpp:76
osg::ref_ptr< osg::Image > mLockedImage
Definition: myguitexture.hpp:26
Definition: myguitexture.hpp:22
virtual MyGUI::IRenderTarget * getRenderTarget()
Definition: myguitexture.cpp:171
virtual void loadFromFile(const std::string &fname)
Definition: myguitexture.cpp:84
virtual void unlock()
Definition: myguitexture.cpp:139
std::string mName
Definition: myguitexture.hpp:23
virtual void createManual(int width, int height, MyGUI::TextureUsage usage, MyGUI::PixelFormat format)
Definition: myguitexture.cpp:35
virtual MyGUI::PixelFormat getFormat()
Definition: myguitexture.hpp:52
virtual size_t getNumElemBytes()
Definition: myguitexture.hpp:54
virtual int getWidth()
Definition: myguitexture.cpp:109
virtual void * lock(MyGUI::TextureUsage access)
Definition: myguitexture.cpp:123
virtual const std::string & getName() const
Definition: myguitexture.hpp:37
size_t mNumElemBytes
Definition: myguitexture.hpp:30
virtual bool isLocked()
Definition: myguitexture.cpp:165
OSGTexture(const std::string &name, Resource::ImageManager *imageManager)
Definition: myguitexture.cpp:13
osg::Texture2D * getTexture() const
Definition: myguitexture.hpp:59
const char * name
Definition: crashcatcher.cpp:59