source: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/IMG/IMGTexture.h @ 751

Revision 751, 2.6 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef _IMGTEXTURE_H
2#define _IMGTEXTURE_H
3
4#include <IMGPrerequisites.h>
5
6namespace IMG
7{
8
9// Forward declarations
10class _IMGExport Texture;
11
12
13namespace boost
14{
15    void intrusive_ptr_add_ref(Texture * p);
16    void intrusive_ptr_release(Texture * p);
17};
18
19class _IMGExport Texture
20{
21
22private:
23    long references;
24    friend void boost::intrusive_ptr_add_ref(Texture * p);
25    friend void boost::intrusive_ptr_release(Texture * p);
26
27  protected:
28         Ogre::Texture *mTexture;
29
30         Ogre::Material *mMaterial;
31
32     Ogre::Rectangle2D *mRectangle2D;
33
34         unsigned int mWidth;
35
36         unsigned int mHeight;
37
38         Ogre::String mTextureName;
39
40         Ogre::ColourValue mAvgColour;
41
42         Ogre::ColourValue mBackgroundColour;
43
44         bool mCalculatedAvgColour;
45
46         Ogre::Camera *mCamera;
47
48         Ogre::PixelFormat mPixelFormat;
49
50  public:
51     Texture();
52
53     virtual ~Texture();
54
55         void setRenderTargetListener(Ogre::RenderTargetListener *renderTargetListener);
56
57         virtual void debug();
58
59         virtual void create(Ogre::String fileName, unsigned int width, unsigned int height, Ogre::PixelFormat pixelFormat, Ogre::Camera *camera, Ogre::ColourValue backgroundColour);
60
61         Ogre::ColourValue getAvgColour();
62
63         void calculateAvgColour();
64
65         void setBackgroundColour(Ogre::ColourValue colour);
66
67         Ogre::ColourValue getBackgroundColour();
68
69         virtual void load(Ogre::String folderName, Ogre::String filename);
70
71         virtual void save(Ogre::String folderName, Ogre::String filename);
72
73         virtual void update();
74
75         void setCorners(Ogre::Real left, Ogre::Real top, Ogre::Real right, Ogre::Real bottom);
76
77         Ogre::Rectangle2D* getRectangle2D();
78
79         Ogre::Vector2 getMinTexCoord();
80
81         Ogre::Vector2 getMaxTexCoord();
82
83     void setWidth(unsigned int width);
84
85     unsigned int getWidth();
86
87     void setHeight(unsigned int height);
88
89     unsigned int getHeight();
90
91     void setTextureName(Ogre::String textureName);
92
93     Ogre::String getTextureName();
94
95         void setMaterial(Ogre::Material *material);
96
97         Ogre::Material* getMaterial();
98
99         void bind(Ogre::String textureName);
100
101         void setCamera(Ogre::Camera *camera);
102
103         void setFormat(Ogre::PixelFormat pixelFormat);
104
105};
106
107// class specific addref/release implementation
108// the two function overloads must be in the boost namespace on most compilers:
109namespace boost
110{
111 inline void intrusive_ptr_add_ref(Texture * p)
112  {
113    // increment reference count of object *p
114    ++(p->references);
115  }
116
117
118
119 inline void intrusive_ptr_release(Texture * p)
120  {
121   // decrement reference count, and delete object when reference count reaches 0
122   if (--(p->references) == 0)
123     delete p;
124  }
125} // namespace boost
126
127typedef ::boost::intrusive_ptr<Texture> TexturePtr;
128
129}
130#endif
Note: See TracBrowser for help on using the repository browser.