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

Revision 2850, 1.5 KB checked in by mattausch, 16 years ago (diff)

debug version before siggraph

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        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       
65
66
67protected:
68
69        int mFormat;
70        int mWidth;
71        int mHeight;
72
73        unsigned int mTexId;
74
75        int mBoundaryModeS;
76        int mBoundaryModeT;
77
78        std::string mName;
79
80        int mByteSize;
81        void *mImage;
82
83        bool mUseMipMap;
84};
85
86
87inline int Texture::GetByteSize() const
88{
89        return mByteSize;
90}
91
92}
93
94#endif // __TEXTURE_H
Note: See TracBrowser for help on using the repository browser.