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 |
|
---|
10 | namespace CHCDemoEngine
|
---|
11 | {
|
---|
12 |
|
---|
13 | ///
|
---|
14 | class Texture
|
---|
15 | {
|
---|
16 | public:
|
---|
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 | //void SetUseMipMap(bool useMipMap) { mUseMipMap = useMipMap; }
|
---|
57 |
|
---|
58 | int GetBoundaryModeS() const { return mBoundaryModeS; }
|
---|
59 | int GetBoundaryModeT() const { return mBoundaryModeT; }
|
---|
60 |
|
---|
61 | /** Creates the texture from the image
|
---|
62 | */
|
---|
63 | void Create();
|
---|
64 | /** Returns id of this texture.
|
---|
65 | */
|
---|
66 | int GetId() const { return mTexId; }
|
---|
67 |
|
---|
68 |
|
---|
69 | protected:
|
---|
70 |
|
---|
71 | int mFormat;
|
---|
72 | int mWidth;
|
---|
73 | int mHeight;
|
---|
74 |
|
---|
75 | unsigned int mTexId;
|
---|
76 |
|
---|
77 | int mBoundaryModeS;
|
---|
78 | int mBoundaryModeT;
|
---|
79 |
|
---|
80 | std::string mName;
|
---|
81 |
|
---|
82 | int mByteSize;
|
---|
83 | void *mImage;
|
---|
84 |
|
---|
85 | bool mUseMipMap;
|
---|
86 | };
|
---|
87 |
|
---|
88 |
|
---|
89 | inline int Texture::GetByteSize() const
|
---|
90 | {
|
---|
91 | return mByteSize;
|
---|
92 | }
|
---|
93 |
|
---|
94 | }
|
---|
95 |
|
---|
96 | #endif // __TEXTURE_H
|
---|
Note: See
TracBrowser
for help on using the repository browser.