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

Revision 3147, 1.8 KB checked in by mattausch, 16 years ago (diff)

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