#include <texture_mem.h>
Inherits NL3D::ITexture.
Public Member Functions | |
| CTextureMem () | |
| Default constructor. | |
| virtual | ~CTextureMem () |
| Destructor. | |
| CTextureMem (uint8 *data, uint32 length, bool _delete, bool isFile=true, uint width=0, uint height=0, CBitmap::TType texType=CBitmap::RGBA) | |
| constructor | |
| void | setPointer (uint8 *data, uint32 length, bool _delete, bool isFile=true, uint width=0, uint height=0, CBitmap::TType texType=CBitmap::RGBA) |
| Set the pointer of the mem file containing the texture. | |
| uint8 * | getPointer () const |
| Get the Pointer of the memory file containing the texture. | |
| uint32 | getLength () const |
| Get length of the memory file containing the texture. | |
| bool | isDeletable () const |
| Return true if the class handle the delete of the pointer. | |
| void | doGenerate (bool async=false) |
| Generate the texture. | |
| virtual bool | supportSharing () const |
| inherited from ITexture. | |
| virtual std::string | getShareName () const |
| inherited from ITexture. | |
| void | setShareName (const std::string &shareName) |
| Make this texture sharable by assigning it a share name. An empty share name means it is not sharable, which is the default. | |
| virtual bool | allowDegradation () const |
| texture file may allow the driver to degrade (default is true). | |
| void | setAllowDegradation (bool allow) |
| Change the degradation mode. NB: this does not touch() the ITexture... | |
| virtual void | serial (NLMISC::IStream &) throw (NLMISC::EStream) |
| Todo: serialize a mem texture. | |
| NLMISC_DECLARE_CLASS (CTextureMem) | |
| uint32 | getImageWidth () const |
| =========================================================================== | |
| uint32 | getImageHeight () const |
| =========================================================================== | |
Static Public Member Functions | |
| static ITexture * | Create1x1WhiteTex () |
| This create a white square texture of 1x1 It can be used to force the activation of a texture stage with no texture. | |
Private Attributes | |
| uint8 * | _Data |
| uint32 | _Length |
| bool | _Delete |
| bool | _IsFile |
| bool | _AllowDegradation |
| std::string | _ShareName |
| NLMISC::CBitmap::TType | _TexType |
| uint | _TexWidth |
| keep size for textures that aren't from a file | |
| uint | _TexHeight |
Definition at line 40 of file texture_mem.h.
| NL3D::CTextureMem::CTextureMem | ( | ) | [inline] |
Default constructor.
Definition at line 57 of file texture_mem.h.
Referenced by Create1x1WhiteTex().
| virtual NL3D::CTextureMem::~CTextureMem | ( | ) | [inline, virtual] |
| NL3D::CTextureMem::CTextureMem | ( | uint8 * | data, | |
| uint32 | length, | |||
| bool | _delete, | |||
| bool | isFile = true, |
|||
| uint | width = 0, |
|||
| uint | height = 0, |
|||
| CBitmap::TType | texType = CBitmap::RGBA | |||
| ) | [inline] |
constructor
| data | Pointer of the file. | |
| length | length, in bytes, of the datas. | |
| _delete | Is true if the class must delete the pointer. | |
| isFile | is true if the data must be interpreted as a texture file. Otherwise, it is interpreted as the raw datas of the texture, so the format and size of the texture must also have been set to match the raw datas | |
| width | used only if isFile is set to false | |
| height | used only if isFile is set to false | |
| texType | relevant only when isFile is set to false. Gives the format to expand the texture to when it is generated. |
Definition at line 87 of file texture_mem.h.
References _AllowDegradation, _Data, _Delete, and setPointer().
| virtual bool NL3D::CTextureMem::allowDegradation | ( | ) | const [inline, virtual] |
texture file may allow the driver to degrade (default is true).
Reimplemented from NL3D::ITexture.
Definition at line 165 of file texture_mem.h.
References _AllowDegradation.
| ITexture * NL3D::CTextureMem::Create1x1WhiteTex | ( | ) | [static] |
This create a white square texture of 1x1 It can be used to force the activation of a texture stage with no texture.
===========================================================================
Definition at line 70 of file texture_mem.cpp.
References CTextureMem(), and NL3D::WhitePix.
Referenced by NL3D::CPSMaterial::forceTexturedMaterialStages().
| void NL3D::CTextureMem::doGenerate | ( | bool | async = false |
) | [virtual] |
Generate the texture.
Implements NL3D::ITexture.
Definition at line 43 of file texture_mem.cpp.
References _Data, _IsFile, _Length, _TexHeight, _TexType, _TexWidth, NLMISC::CBitmap::buildMipMaps(), NLMISC::CMemStream::fill(), NLMISC::CBitmap::getPixels(), NLMISC::CBitmap::load(), NLMISC::CBitmap::makeDummy(), and NLMISC::CBitmap::resize().
| uint32 NL3D::CTextureMem::getImageHeight | ( | ) | const |
===========================================================================
Definition at line 98 of file texture_mem.cpp.
References _TexHeight.
| uint32 NL3D::CTextureMem::getImageWidth | ( | ) | const |
===========================================================================
Definition at line 92 of file texture_mem.cpp.
References _TexWidth.
| uint32 NL3D::CTextureMem::getLength | ( | ) | const [inline] |
Get length of the memory file containing the texture.
Definition at line 131 of file texture_mem.h.
References _Length.
| uint8* NL3D::CTextureMem::getPointer | ( | ) | const [inline] |
Get the Pointer of the memory file containing the texture.
Definition at line 125 of file texture_mem.h.
References _Data.
| virtual std::string NL3D::CTextureMem::getShareName | ( | ) | const [inline, virtual] |
inherited from ITexture.
Reimplemented from NL3D::ITexture.
Definition at line 152 of file texture_mem.h.
References _ShareName, and nlassert.
| bool NL3D::CTextureMem::isDeletable | ( | ) | const [inline] |
Return true if the class handle the delete of the pointer.
Definition at line 137 of file texture_mem.h.
References _Delete.
| NL3D::CTextureMem::NLMISC_DECLARE_CLASS | ( | CTextureMem | ) |
| virtual void NL3D::CTextureMem::serial | ( | NLMISC::IStream & | ) | throw (NLMISC::EStream) [inline, virtual] |
Todo: serialize a mem texture.
Reimplemented from NL3D::ITexture.
Definition at line 170 of file texture_mem.h.
References nlstop.
| void NL3D::CTextureMem::setAllowDegradation | ( | bool | allow | ) |
Change the degradation mode. NB: this does not touch() the ITexture...
===========================================================================
Definition at line 86 of file texture_mem.cpp.
References _AllowDegradation.
| void NL3D::CTextureMem::setPointer | ( | uint8 * | data, | |
| uint32 | length, | |||
| bool | _delete, | |||
| bool | isFile = true, |
|||
| uint | width = 0, |
|||
| uint | height = 0, |
|||
| CBitmap::TType | texType = CBitmap::RGBA | |||
| ) | [inline] |
Set the pointer of the mem file containing the texture.
| data | Pointer of the file. | |
| length | length, in bytes, of the datas. | |
| isFile | is true if the data must be interpreted as a texture file. Otherwise, it is interpreted as the raw datas of the texture, so the format and size of the texture must also have been set to match the raw datas | |
| _delete | Is true if the class must delete the pointer. | |
| texType | relevant only when isFile is set to false. Gives the format to expand the texture to when it is generated. |
Definition at line 106 of file texture_mem.h.
References _Data, _Delete, _IsFile, _Length, _TexHeight, _TexType, _TexWidth, and NL3D::ITexture::_Touched.
Referenced by CTextureMem().
| void NL3D::CTextureMem::setShareName | ( | const std::string & | shareName | ) | [inline] |
Make this texture sharable by assigning it a share name. An empty share name means it is not sharable, which is the default.
Definition at line 159 of file texture_mem.h.
References _ShareName.
| virtual bool NL3D::CTextureMem::supportSharing | ( | ) | const [inline, virtual] |
inherited from ITexture.
Reimplemented from NL3D::ITexture.
Definition at line 146 of file texture_mem.h.
References _ShareName.
bool NL3D::CTextureMem::_AllowDegradation [private] |
Definition at line 46 of file texture_mem.h.
Referenced by allowDegradation(), CTextureMem(), and setAllowDegradation().
uint8* NL3D::CTextureMem::_Data [private] |
Reimplemented from NLMISC::CBitmap.
Definition at line 42 of file texture_mem.h.
Referenced by CTextureMem(), doGenerate(), getPointer(), setPointer(), and ~CTextureMem().
bool NL3D::CTextureMem::_Delete [private] |
Definition at line 44 of file texture_mem.h.
Referenced by CTextureMem(), isDeletable(), setPointer(), and ~CTextureMem().
bool NL3D::CTextureMem::_IsFile [private] |
Definition at line 45 of file texture_mem.h.
Referenced by doGenerate(), and setPointer().
uint32 NL3D::CTextureMem::_Length [private] |
Definition at line 43 of file texture_mem.h.
Referenced by doGenerate(), getLength(), and setPointer().
std::string NL3D::CTextureMem::_ShareName [private] |
Definition at line 47 of file texture_mem.h.
Referenced by getShareName(), setShareName(), and supportSharing().
uint NL3D::CTextureMem::_TexHeight [private] |
Definition at line 51 of file texture_mem.h.
Referenced by doGenerate(), getImageHeight(), and setPointer().
Definition at line 48 of file texture_mem.h.
Referenced by doGenerate(), and setPointer().
uint NL3D::CTextureMem::_TexWidth [private] |
keep size for textures that aren't from a file
Definition at line 51 of file texture_mem.h.
Referenced by doGenerate(), getImageWidth(), and setPointer().
1.6.1