nux-1.14.0
|
Public Member Functions | |
TextureRectangle (NUX_FILE_LINE_PROTO) | |
TextureRectangle (const TextureRectangle &texture) | |
TextureRectangle (const NTextureData &Image) | |
TextureRectangle & | operator= (const TextureRectangle &texture) |
virtual bool | Update (const NBitmapData *BitmapData, bool UpdateAndCacheResource=true) |
virtual bool | Update (const TCHAR *filename, bool UpdateAndCacheResource=true) |
virtual bool | IsNull () const |
void | GetData (void *Buffer, int MipIndex, int StrideY, int face=0) |
int | GetNumMipLevel () const |
int | GetWidth () const |
int | GetHeight () const |
BitmapFormat | GetFormat () const |
bool | IsPowerOfTwo () const |
virtual BaseTexture * | Clone () const |
Definition at line 261 of file GLTextureResourceManager.h.
BaseTexture * nux::TextureRectangle::Clone | ( | ) | const [virtual] |
Clone the texture.
Implements nux::BaseTexture.
Definition at line 540 of file GLTextureResourceManager.cpp.
{ TextureRectangle* texture = new TextureRectangle(*this); return texture; }
BitmapFormat nux::TextureRectangle::GetFormat | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 312 of file GLTextureResourceManager.h.
{
return _image.GetFormat();
}
int nux::TextureRectangle::GetHeight | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 304 of file GLTextureResourceManager.h.
{
return _image.GetHeight();
}
int nux::TextureRectangle::GetNumMipLevel | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 288 of file GLTextureResourceManager.h.
{
return _image.GetNumMipmap ();
}
int nux::TextureRectangle::GetWidth | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 296 of file GLTextureResourceManager.h.
{
return _image.GetWidth ();
}
virtual bool nux::TextureRectangle::IsNull | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 278 of file GLTextureResourceManager.h.
{
return _image.IsNull ();
}
bool nux::TextureRectangle::IsPowerOfTwo | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 320 of file GLTextureResourceManager.h.
{
return IsPowerOf2 (_image.GetWidth() ) && IsPowerOf2 (_image.GetHeight() );
}
bool nux::TextureRectangle::Update | ( | const NBitmapData * | BitmapData, |
bool | UpdateAndCacheResource = true |
||
) | [virtual] |
Update the texture with the provided Bitmap data. In doing so, if the texture as been cached in the resource manager, then the the DeviceTexture inside the CachedTexture will no longer be returned by GetDeviceTexture (). Instead a new device texture will be returned.
Pointer to the bitmap data. If true, then the texture is cached immediately. If false, the texture will be cached the first time GetDeviceTexture () or GetCachedTexture () is called.
Implements nux::BaseTexture.
Definition at line 493 of file GLTextureResourceManager.cpp.
References nux::GraphicsEngine::UpdateResource().
Referenced by Update().
{ nuxAssertMsg (BitmapData, TEXT ("[TextureRectangle::Update] Argument BitmapData is NULL.") ); NUX_RETURN_VALUE_IF_NULL (BitmapData, false); if (!BitmapData->IsTextureData() ) { nuxAssertMsg (0, TEXT ("[TextureRectangle::Update] Argument BitmapData is not a 2D texture") ); return false; } _image = *static_cast<const NTextureData *> (BitmapData); if (UpdateAndCacheResource) { // call the texture manager and recreate the texture (CachedTexture2D) associated with this object if any. GetGraphicsDisplay()->GetGraphicsEngine()->UpdateResource (this); } return true; }
bool nux::TextureRectangle::Update | ( | const TCHAR * | filename, |
bool | UpdateAndCacheResource = true |
||
) | [virtual] |
Update the texture with the provided filename. In doing so, if the texture as been cached in the resource manager, then the the DeviceTexture inside the CachedTexture will no longer be returned by GetDeviceTexture (). Instead a new device texture will be returned.
Pointer to the bitmap data. If true, then the texture is cached immediately. If false, the texture will be cached the first time GetDeviceTexture () or GetCachedTexture () is called.
Implements nux::BaseTexture.
Definition at line 514 of file GLTextureResourceManager.cpp.
References nux::LoadImageFile(), and Update().
{ bool b = false; NBitmapData *BitmapData = LoadImageFile (filename); nuxAssertMsg (BitmapData, TEXT ("[TextureRectangle::Update] Bitmap for file (%s) is NULL."), filename); NUX_RETURN_VALUE_IF_NULL (BitmapData, false); b = Update (BitmapData); NUX_SAFE_DELETE (BitmapData); return b; }