Loading...
Searching...
No Matches
ITexture.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_TEXTURE_H_INCLUDED__
#define __I_TEXTURE_H_INCLUDED__
#include "IReferenceCounted.h"
#include "IImage.h"
#include "dimension2d.h"
#include "EDriverTypes.h"
#include "path.h"
#include "matrix4.h"
namespace irr
{
namespace video
{
enum E_TEXTURE_CREATION_FLAG
{
ETCF_ALWAYS_16_BIT = 0x00000001,
ETCF_ALWAYS_32_BIT = 0x00000002,
ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004,
ETCF_OPTIMIZED_FOR_SPEED = 0x00000008,
ETCF_CREATE_MIP_MAPS = 0x00000010,
ETCF_NO_ALPHA_CHANNEL = 0x00000020,
ETCF_ALLOW_NON_POWER_2 = 0x00000040,
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
};
enum E_TEXTURE_LOCK_MODE
{
ETLM_READ_WRITE = 0,
ETLM_READ_ONLY,
ETLM_WRITE_ONLY
};
class ITexture : public virtual IReferenceCounted
{
public:
ITexture(const io::path& name) : NamedPath(name)
{
}
virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) = 0;
virtual void unlock() = 0;
virtual const core::dimension2d<u32>& getOriginalSize() const = 0;
virtual const core::dimension2d<u32>& getSize() const = 0;
virtual E_DRIVER_TYPE getDriverType() const = 0;
virtual ECOLOR_FORMAT getColorFormat() const = 0;
virtual u32 getPitch() const = 0;
virtual bool hasMipMaps() const { return false; }
virtual bool hasAlpha() const {
return getColorFormat () == video::ECF_A8R8G8B8 || getColorFormat () == video::ECF_A1R5G5B5;
}
virtual void regenerateMipMapLevels(void* mipmapData=0) = 0;
virtual bool isRenderTarget() const { return false; }
const io::SNamedPath& getName() const { return NamedPath; }
protected:
inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
{
if (flags & ETCF_OPTIMIZED_FOR_SPEED)
return ETCF_OPTIMIZED_FOR_SPEED;
if (flags & ETCF_ALWAYS_16_BIT)
return ETCF_ALWAYS_16_BIT;
if (flags & ETCF_ALWAYS_32_BIT)
return ETCF_ALWAYS_32_BIT;
if (flags & ETCF_OPTIMIZED_FOR_QUALITY)
return ETCF_OPTIMIZED_FOR_QUALITY;
return ETCF_OPTIMIZED_FOR_SPEED;
}
io::SNamedPath NamedPath;
};
} // end namespace video
} // end namespace irr
#endif
EDriverTypes.h
IImage.h
IReferenceCounted.h
irr::IReferenceCounted::IReferenceCounted
IReferenceCounted()
Constructor.
Definition IReferenceCounted.h:46
irr::core::dimension2d
Specifies a 2 dimensional size.
Definition dimension2d.h:21
irr::video::ITexture::getPitch
virtual u32 getPitch() const =0
Get pitch of the main texture (in bytes).
irr::video::ITexture::unlock
virtual void unlock()=0
Unlock function. Must be called after a lock() to the texture.
irr::video::ITexture::getOriginalSize
virtual const core::dimension2d< u32 > & getOriginalSize() const =0
Get original size of the texture.
irr::video::ITexture::ITexture
ITexture(const io::path &name)
constructor
Definition ITexture.h:103
irr::video::ITexture::getSize
virtual const core::dimension2d< u32 > & getSize() const =0
Get dimension (=size) of the texture.
irr::video::ITexture::getColorFormat
virtual ECOLOR_FORMAT getColorFormat() const =0
Get the color format of texture.
irr::video::ITexture::getDriverType
virtual E_DRIVER_TYPE getDriverType() const =0
Get driver type of texture.
irr::video::ITexture::lock
virtual void * lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0)=0
Lock function.
irr::video::ITexture::hasAlpha
virtual bool hasAlpha() const
Returns if the texture has an alpha channel.
Definition ITexture.h:170
irr::video::ITexture::regenerateMipMapLevels
virtual void regenerateMipMapLevels(void *mipmapData=0)=0
Regenerates the mip map levels of the texture.
irr::video::ITexture::hasMipMaps
virtual bool hasMipMaps() const
Check whether the texture has MipMaps.
Definition ITexture.h:167
irr::video::ITexture::isRenderTarget
virtual bool isRenderTarget() const
Check whether the texture is a render target.
Definition ITexture.h:188
irr::video::ITexture::NamedPath
io::SNamedPath NamedPath
Definition ITexture.h:211
irr::video::ITexture::getName
const io::SNamedPath & getName() const
Get name of texture (in most cases this is the filename).
Definition ITexture.h:191
irr::video::ITexture::getTextureFormatFromFlags
E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
Helper function, helps to get the desired texture creation format from the flags.
Definition ITexture.h:198
dimension2d.h
matrix4.h
irr::io::path
core::string< fschar_t > path
Type used for all file system related strings.
Definition path.h:17
irr::video
The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done ...
Definition EDriverFeatures.h:11
irr::video::ECOLOR_FORMAT
ECOLOR_FORMAT
An enum for the color format of textures used by the Irrlicht Engine.
Definition SColor.h:18
irr::video::ECF_A1R5G5B5
@ ECF_A1R5G5B5
16 bit color format used by the software driver.
Definition SColor.h:23
irr::video::ECF_A8R8G8B8
@ ECF_A8R8G8B8
Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
Definition SColor.h:32
irr::video::E_TEXTURE_LOCK_MODE
E_TEXTURE_LOCK_MODE
Enum for the mode for texture locking. Read-Only, write-only or read/write.
Definition ITexture.h:75
irr::video::ETLM_READ_ONLY
@ ETLM_READ_ONLY
Read only. The texture is downloaded, but not uploaded again.
Definition ITexture.h:81
irr::video::ETLM_READ_WRITE
@ ETLM_READ_WRITE
The default mode. Texture can be read and written to.
Definition ITexture.h:77
irr::video::ETLM_WRITE_ONLY
@ ETLM_WRITE_ONLY
Write only. The texture is not downloaded and might be uninitialised.
Definition ITexture.h:86
irr::video::E_TEXTURE_CREATION_FLAG
E_TEXTURE_CREATION_FLAG
Enumeration flags telling the video driver in which format textures should be created.
Definition ITexture.h:23
irr::video::ETCF_FORCE_32_BIT_DO_NOT_USE
@ ETCF_FORCE_32_BIT_DO_NOT_USE
Definition ITexture.h:70
irr::video::ETCF_OPTIMIZED_FOR_SPEED
@ ETCF_OPTIMIZED_FOR_SPEED
Definition ITexture.h:56
irr::video::ETCF_ALWAYS_32_BIT
@ ETCF_ALWAYS_32_BIT
Definition ITexture.h:41
irr::video::ETCF_CREATE_MIP_MAPS
@ ETCF_CREATE_MIP_MAPS
Definition ITexture.h:59
irr::video::ETCF_ALWAYS_16_BIT
@ ETCF_ALWAYS_16_BIT
Definition ITexture.h:32
irr::video::ETCF_ALLOW_NON_POWER_2
@ ETCF_ALLOW_NON_POWER_2
Allow the Driver to use Non-Power-2-Textures.
Definition ITexture.h:66
irr::video::ETCF_NO_ALPHA_CHANNEL
@ ETCF_NO_ALPHA_CHANNEL
Definition ITexture.h:62
irr::video::ETCF_OPTIMIZED_FOR_QUALITY
@ ETCF_OPTIMIZED_FOR_QUALITY
Definition ITexture.h:49
irr::video::E_DRIVER_TYPE
E_DRIVER_TYPE
An enum for all types of drivers the Irrlicht Engine supports.
Definition EDriverTypes.h:15
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::u32
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
path.h
irr::io::SNamedPath
Used in places where we identify objects by a filename, but don't actually work with the real filenam...
Definition path.h:24
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0