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

Revision 2964, 1.6 KB checked in by mattausch, 16 years ago (diff)
RevLine 
[2757]1#ifndef NO_PRAGMA_ONCE
2#pragma once
3#endif
4
5#ifndef __TEXTURE_H
6#define __TEXTURE_H
7
8#include <string>
9
[2776]10namespace CHCDemoEngine
[2757]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       
[2846]29        enum { CLAMP, REPEAT };
30
[2757]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       
[2768]48        inline int GetByteSize() const;
[2757]49        /** Bind the texture.
50        */
51        void Bind() const;
52
[2846]53        void SetBoundaryModeS(int mode) { mBoundaryModeS = mode; }
54        void SetBoundaryModeT(int mode) { mBoundaryModeT = mode; }
[2768]55
[2850]56        //void SetUseMipMap(bool useMipMap) { mUseMipMap = useMipMap; }
57
[2846]58        int GetBoundaryModeS() const { return mBoundaryModeS; }
59        int GetBoundaryModeT() const { return mBoundaryModeT; }
[2768]60
[2846]61        /** Creates the texture from the image
62        */
63        void Create();
[2964]64        /** Returns id of this texture.
65        */
66        int GetId() const { return mTexId; }
[2846]67
68
[2757]69protected:
70
71        int mFormat;
72        int mWidth;
73        int mHeight;
74
75        unsigned int mTexId;
76
[2846]77        int mBoundaryModeS;
78        int mBoundaryModeT;
79
[2757]80        std::string mName;
81
[2768]82        int mByteSize;
[2757]83        void *mImage;
[2850]84
85        bool mUseMipMap;
[2757]86};
87
[2768]88
89inline int Texture::GetByteSize() const
90{
91        return mByteSize;
[2757]92}
93
[2768]94}
95
[2757]96#endif // __TEXTURE_H
Note: See TracBrowser for help on using the repository browser.