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

Revision 2782, 1.1 KB checked in by mattausch, 17 years ago (diff)
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        /** 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        /** Returns width of texture.
30        */
31        int GetWidth() const;
32        /** Returns width of texture.
33        */
34        int GetHeight() const;
35        /** Returns texture format. Currently only RGBA supported.
36        */
37        int GetFormat() const;
38        /** Returns name of the texture
39        */
40        std::string GetName() const;
41
42        int GetRowLength() const;
43
44        int GetPixelSize() const;
45       
46        inline int GetByteSize() const;
47        /** Bind the texture.
48        */
49        void Bind() const;
50
51
52
53protected:
54
55        void Create();
56
57        int mFormat;
58        int mWidth;
59        int mHeight;
60
61        unsigned int mTexId;
62
63        std::string mName;
64
65        int mByteSize;
66        void *mImage;
67};
68
69
70inline int Texture::GetByteSize() const
71{
72        return mByteSize;
73}
74
75}
76
77#endif // __TEXTURE_H
Note: See TracBrowser for help on using the repository browser.