arsa  2.7
ITexture.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
4 
5 #ifndef __I_TEXTURE_H_INCLUDED__
6 #define __I_TEXTURE_H_INCLUDED__
7 
8 #include "IReferenceCounted.h"
9 #include "IImage.h"
10 #include "dimension2d.h"
11 #include "EDriverTypes.h"
12 #include "path.h"
13 #include "matrix4.h"
14 
15 namespace irr
16 {
17 namespace video
18 {
19 
20 
23 {
33  ETCF_ALWAYS_16_BIT = 0x00000001,
34 
44  ETCF_ALWAYS_32_BIT = 0x00000002,
45 
54 
62 
66  ETCF_CREATE_MIP_MAPS = 0x00000010,
67 
72  ETCF_NO_ALPHA_CHANNEL = 0x00000020,
73 
75 
76  ETCF_ALLOW_NON_POWER_2 = 0x00000040,
77 
79 
84  ETCF_ALLOW_MEMORY_COPY = 0x00000080,
85 
87 
99 
103 };
104 
107 {
110 
112 
114 
116 
119 };
120 
123 {
125 
127 
143 };
144 
147 {
150 
153 
156 };
157 
160 {
163 
166 };
167 
169 
177 class ITexture : public virtual IReferenceCounted
178 {
179 public:
180 
184  {
185  }
186 
188 
210  virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) = 0;
211 
213 
216  virtual void unlock() = 0;
217 
219 
227  virtual void regenerateMipMapLevels(void* data = 0, u32 layer = 0) = 0;
228 
230 
238 
240 
241  const core::dimension2d<u32>& getSize() const { return Size; };
242 
244 
249 
251 
253 
255 
259 
261 
264  u32 getPitch() const { return Pitch; };
265 
267 
268  bool hasMipMaps() const { return HasMipMaps; }
269 
271 
275  bool isRenderTarget() const { return IsRenderTarget; }
276 
278  const io::SNamedPath& getName() const { return NamedPath; }
279 
281  E_TEXTURE_SOURCE getSource() const { return Source; }
282 
285 
287  bool hasAlpha() const
288  {
289  bool status = false;
290 
291  switch (ColorFormat)
292  {
293  case ECF_A8R8G8B8:
294  case ECF_A1R5G5B5:
295  case ECF_DXT1:
296  case ECF_DXT2:
297  case ECF_DXT3:
298  case ECF_DXT4:
299  case ECF_DXT5:
300  case ECF_A16B16G16R16F:
301  case ECF_A32B32G32R32F:
302  status = true;
303  break;
304  default:
305  break;
306  }
307 
308  return status;
309  }
310 
312  E_TEXTURE_TYPE getType() const { return Type; }
313 
314 protected:
315 
317 
320  {
324  return ETCF_ALWAYS_16_BIT;
326  return ETCF_ALWAYS_32_BIT;
330  }
331 
343 };
344 
345 
346 } // end namespace video
347 } // end namespace irr
348 
349 #endif
350 
E_DRIVER_TYPE getDriverType() const
Get driver type of texture.
Definition: ITexture.h:248
io::SNamedPath NamedPath
Definition: ITexture.h:332
const core::dimension2d< u32 > & getSize() const
Get dimension (=size) of the texture.
Definition: ITexture.h:241
ECOLOR_FORMAT getColorFormat() const
Get the color format of texture.
Definition: ITexture.h:252
DXT3 color format.
Definition: SColor.h:49
DXT4 color format.
Definition: SColor.h:52
The default mode. Texture can be read and written to.
Definition: ITexture.h:109
64 bit format using 16 bits for the red, green, blue and alpha channels.
Definition: SColor.h:95
ECOLOR_FORMAT ColorFormat
Definition: ITexture.h:337
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
ECOLOR_FORMAT OriginalColorFormat
Definition: ITexture.h:336
E_TEXTURE_SOURCE
Where did the last IVideoDriver::getTexture call find this texture.
Definition: ITexture.h:146
Allow the driver to keep a copy of the texture in memory.
Definition: ITexture.h:84
bool isRenderTarget() const
Check whether the texture is a render target.
Definition: ITexture.h:275
ECOLOR_FORMAT
An enum for the color format of textures used by the Irrlicht Engine.
Definition: SColor.h:20
E_TEXTURE_TYPE
Enumeration describing the type of ITexture.
Definition: ITexture.h:159
GLuint const GLchar * name
E_TEXTURE_TYPE getType() const
Returns the type of texture.
Definition: ITexture.h:312
core::dimension2d< u32 > OriginalSize
Definition: ITexture.h:333
Everything in the Irrlicht Engine can be found in this namespace.
Definition: CARSADPad.h:6
E_TEXTURE_LOCK_MODE
Enum for the mode for texture locking. Read-Only, write-only or read/write.
Definition: ITexture.h:106
E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
Helper function, helps to get the desired texture creation format from the flags.
Definition: ITexture.h:319
void updateSource(E_TEXTURE_SOURCE source)
Used internally by the engine to update Source status on IVideoDriver::getTexture calls.
Definition: ITexture.h:284
E_TEXTURE_TYPE Type
Definition: ITexture.h:342
Texture has been found in cache.
Definition: ITexture.h:152
ECOLOR_FORMAT getOriginalColorFormat() const
Get the original color format.
Definition: ITexture.h:258
Read only. The texture is downloaded, but not uploaded again.
Definition: ITexture.h:113
Cubemap texture.
Definition: ITexture.h:165
u32 getPitch() const
Get pitch of the main texture (in bytes).
Definition: ITexture.h:264
E_DRIVER_TYPE
An enum for all types of drivers the Irrlicht Engine supports.
Definition: EDriverTypes.h:16
Null driver, useful for applications to run the engine without visualization.
Definition: EDriverTypes.h:21
Used in places where we identify objects by a filename, but don't actually work with the real filenam...
Definition: path.h:23
Unknown color format:
Definition: SColor.h:132
GLenum GLuint GLint GLint layer
Enable automatic updating mip maps when the base texture changes.
Definition: ITexture.h:98
128 bit format using 32 bits for the red, green, blue and alpha channels.
Definition: SColor.h:104
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
16 bit color format used by the software driver.
Definition: SColor.h:26
Flip left-bottom origin rendertarget textures upside-down.
Definition: ITexture.h:142
2D texture.
Definition: ITexture.h:162
E_TEXTURE_LOCK_FLAGS
Additional bitflags for ITexture::lock() call.
Definition: ITexture.h:122
virtual void * lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer=0, E_TEXTURE_LOCK_FLAGS lockFlags=ETLF_FLIP_Y_UP_RTT)=0
Lock function.
GLenum mode
GLsizei GLsizei GLchar * source
IVideoDriver::getTexture was never called (texture created otherwise)
Definition: ITexture.h:149
DXT2 color format.
Definition: SColor.h:46
bool hasMipMaps() const
Check whether the texture has MipMaps.
Definition: ITexture.h:268
ITexture(const io::path &name, E_TEXTURE_TYPE type)
constructor
Definition: ITexture.h:182
E_DRIVER_TYPE DriverType
Definition: ITexture.h:335
DXT5 color format.
Definition: SColor.h:55
E_TEXTURE_SOURCE getSource() const
Check where the last IVideoDriver::getTexture found this texture.
Definition: ITexture.h:281
const core::dimension2d< u32 > & getOriginalSize() const
Get original size of the texture.
Definition: ITexture.h:237
core::dimension2d< u32 > Size
Definition: ITexture.h:334
E_TEXTURE_SOURCE Source
Definition: ITexture.h:341
E_TEXTURE_CREATION_FLAG
Enumeration flags used to tell the video driver with setTextureCreationFlag in which format textures ...
Definition: ITexture.h:22
const io::SNamedPath & getName() const
Get name of texture (in most cases this is the filename)
Definition: ITexture.h:278
Interface of a Video Driver dependent Texture.
Definition: ITexture.h:177
Base class of most objects of the Irrlicht Engine.
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
GLbitfield flags
virtual void regenerateMipMapLevels(void *data=0, u32 layer=0)=0
Regenerates the mip map levels of the texture.
Write only. The texture is not downloaded and might be uninitialized.
Definition: ITexture.h:118
DXT1 color format.
Definition: SColor.h:43
Allow the Driver to use Non-Power-2-Textures.
Definition: ITexture.h:76
bool hasAlpha() const
Returns if the texture has an alpha channel.
Definition: ITexture.h:287
virtual void unlock()=0
Unlock function. Must be called after a lock() to the texture.
Texture had to be loaded.
Definition: ITexture.h:155