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

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:
[3147]17       
18        enum {FORMAT_INVALID, FORMAT_RGB, FORMAT_RGBA};
19       
20        enum {CLAMP, REPEAT};
21
22
[2757]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;
[3147]44        /** Returns byte size of a row of the image.
45        */
[2757]46        int GetRowLength() const;
[3147]47        /** Returns byte size of one pixel
48        */
[2757]49        int GetPixelSize() const;
[3147]50        /** Returns byte size of the image
51        */
[2768]52        inline int GetByteSize() const;
[2757]53        /** Bind the texture.
54        */
55        void Bind() const;
[3147]56        /** Sets the boundary mode for the s texture coordinate parameter.
57        */
[2846]58        void SetBoundaryModeS(int mode) { mBoundaryModeS = mode; }
[3147]59        /** Sets the boundary mode for the T texture coordinate parameter.
60        */
[2846]61        void SetBoundaryModeT(int mode) { mBoundaryModeT = mode; }
[2768]62
[2846]63        int GetBoundaryModeS() const { return mBoundaryModeS; }
64        int GetBoundaryModeT() const { return mBoundaryModeT; }
[2768]65
[2846]66        /** Creates the texture from the image
67        */
68        void Create();
[2964]69        /** Returns id of this texture.
70        */
71        int GetId() const { return mTexId; }
[2846]72
73
[2757]74protected:
75
76        int mFormat;
77        int mWidth;
78        int mHeight;
79
80        unsigned int mTexId;
81
[2846]82        int mBoundaryModeS;
83        int mBoundaryModeT;
84
[2757]85        std::string mName;
86
[2768]87        int mByteSize;
[2757]88        void *mImage;
[2850]89
90        bool mUseMipMap;
[2757]91};
92
[2768]93
94inline int Texture::GetByteSize() const
95{
96        return mByteSize;
[2757]97}
98
[2768]99}
100
[2757]101#endif // __TEXTURE_H
Note: See TracBrowser for help on using the repository browser.