OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
texture.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef TEXTURE_H
19 #define TEXTURE_H
20 
21 #include "index.h"
22 
23 namespace Engine
24 {
25 
37  class Texture
38  {
39 
40  public:
41 
42  enum //state
43  {
44  MIPMAPPING = 0x1 ,
45  RENDERBUFFER = 0x2 ,
46  LOADED = 0x4
47  };
48 
49  explicit Texture();
50  ~Texture()=default;
51 
57  void setName( const std::string & texture_name );
58 
64  void setTarget( uint target );
70  void setId( uint id );
71 
77  void setWidth ( int width );
78 
84  void setHeight( int height );
85 
91  void setDepth ( int depth );
92 
102  void setPixelData( uchar * data );
103 
109  void setFloatPixelData( float * data );
110 
116  GLenum getTarget(void) const;
117 
123  bool hasState( uint state ) const;
124 
125  void addState( uint state );
126 
132  const std::string & getName(void) const;
133 
139  const uint & getID(void) const;
140 
146  int getWidth(void) const;
147 
153  int getHeight(void) const;
154 
160  int getDepth(void) const;
161 
170  uchar * getPixelData(void) const;
171  float * getFloatPixelData(void) const;
172 
173  private:
174 
175  uchar * mData;
176  float * mFloatData;
177 
178  std::string mName;
179  uint mTextureId;
180  uint mState;
181  GLenum mTarget;
182 
183  int mWidth;
184  int mHeight;
185  int mDepth;
186  };
187 
188 }
189 
190 #endif // TEXTURE_H
void setPixelData(uchar *data)
setPixelData
Definition: Texture.cpp:70
The Texture class.
Definition: texture.h:37
void setTarget(uint target)
setTarget
Definition: Texture.cpp:40
void setId(uint id)
setId
Definition: Texture.cpp:50
int getWidth(void) const
getWidth
Definition: Texture.cpp:103
void setFloatPixelData(float *data)
setFloatPixelData
Definition: Texture.cpp:75
void setHeight(int height)
setHeight
Definition: Texture.cpp:60
Definition: element.h:23
GLenum getTarget(void) const
getTarget
Definition: Texture.cpp:80
int getHeight(void) const
getHeight
Definition: Texture.cpp:108
void setName(const std::string &texture_name)
setName
Definition: Texture.cpp:45
const std::string & getName(void) const
getName
Definition: Texture.cpp:93
void setDepth(int depth)
setDepth
Definition: Texture.cpp:65
int getDepth(void) const
getDepth
Definition: Texture.cpp:113
uchar * getPixelData(void) const
getPixelData
Definition: Texture.cpp:118
void setWidth(int width)
setWidth
Definition: Texture.cpp:55
const uint & getID(void) const
getID
Definition: Texture.cpp:98
bool hasState(uint state) const
hasState
Definition: Texture.cpp:85