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

Revision 3261, 1.9 KB checked in by mattausch, 16 years ago (diff)

worked on powerplant loading

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       
18        // available texture formats
19        enum {FORMAT_INVALID, FORMAT_RGB, FORMAT_RGBA};
20        // texture uv modes
21        enum {CLAMP, REPEAT, BORDER};
22
23
24        /** Constructor loading a texture from a file
25        */
26        Texture(const std::string &filename);
27        /** Destroys data.
28        */
29        ~Texture();
30        /** Returns image data.
31        */
32        void *GetImage() const;
33        /** Returns width of texture.
34        */
35        int GetWidth() const;
36        /** Returns width of texture.
37        */
38        int GetHeight() const;
39        /** Returns texture format. Currently only RGBA supported.
40        */
41        int GetFormat() const;
42        /** Returns name of the texture
43        */
44        std::string GetName() const;
45        /** Returns byte size of a row of the image.
46        */
47        int GetRowLength() const;
48        /** Returns byte size of one pixel
49        */
50        int GetPixelSize() const;
51        /** Returns byte size of the image
52        */
53        inline int GetByteSize() const;
54        /** Bind the texture.
55        */
56        void Bind() const;
57        /** Sets the boundary mode for the s texture coordinate parameter.
58        */
59        void SetBoundaryModeS(int mode) { mBoundaryModeS = mode; }
60        /** Sets the boundary mode for the T texture coordinate parameter.
61        */
62        void SetBoundaryModeT(int mode) { mBoundaryModeT = mode; }
63
64        int GetBoundaryModeS() const { return mBoundaryModeS; }
65        int GetBoundaryModeT() const { return mBoundaryModeT; }
66
67        /** Creates the texture from the image
68        */
69        void Create();
70        /** Returns id of this texture.
71        */
72        int GetId() const { return mTexId; }
73
74
75protected:
76
77        int mFormat;
78        int mWidth;
79        int mHeight;
80
81        unsigned int mTexId;
82
83        int mBoundaryModeS;
84        int mBoundaryModeT;
85
86        std::string mName;
87
88        int mByteSize;
89        void *mImage;
90
91        bool mUseMipMap;
92};
93
94
95inline int Texture::GetByteSize() const
96{
97        return mByteSize;
98}
99
100}
101
102#endif // __TEXTURE_H
Note: See TracBrowser for help on using the repository browser.