source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Texture.h @ 2846

Revision 2846, 1.4 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef NO_PRAGMA_ONCE
2#pragma once
3#endif
4
5#ifndef __TEXTURE_H
6#define __TEXTURE_H
7
8#include <string>
9
10namespace CHCDemoEngine
11{
12
13///
14class Texture
15{
16public:
17        /** Constructor loading texture from file
18        */
19        Texture(const std::string &filename);
20        /** Destroys data.
21        */
22        ~Texture();
23        /** Returns image data.
24        */
25        void *GetImage() const;
26       
27        enum { FORMAT_INVALID, FORMAT_RGB, FORMAT_RGBA };
28       
29        enum { CLAMP, REPEAT };
30
31        /** Returns width of texture.
32        */
33        int GetWidth() const;
34        /** Returns width of texture.
35        */
36        int GetHeight() const;
37        /** Returns texture format. Currently only RGBA supported.
38        */
39        int GetFormat() const;
40        /** Returns name of the texture
41        */
42        std::string GetName() const;
43
44        int GetRowLength() const;
45
46        int GetPixelSize() const;
47       
48        inline int GetByteSize() const;
49        /** Bind the texture.
50        */
51        void Bind() const;
52
53        void SetBoundaryModeS(int mode) { mBoundaryModeS = mode; }
54        void SetBoundaryModeT(int mode) { mBoundaryModeT = mode; }
55
56        int GetBoundaryModeS() const { return mBoundaryModeS; }
57        int GetBoundaryModeT() const { return mBoundaryModeT; }
58
59        /** Creates the texture from the image
60        */
61        void Create();
62
63
64protected:
65
66        int mFormat;
67        int mWidth;
68        int mHeight;
69
70        unsigned int mTexId;
71
72        int mBoundaryModeS;
73        int mBoundaryModeT;
74
75        std::string mName;
76
77        int mByteSize;
78        void *mImage;
79};
80
81
82inline int Texture::GetByteSize() const
83{
84        return mByteSize;
85}
86
87}
88
89#endif // __TEXTURE_H
Note: See TracBrowser for help on using the repository browser.