nux-1.16.0
|
General Texture. More...
#include <NuxGraphics/GLTextureResourceManager.h>
Public Member Functions | |
Texture2D (NUX_FILE_LINE_PROTO) | |
Texture2D (const Texture2D &texture, NUX_FILE_LINE_PROTO) | |
Texture2D (const NTextureData &BaseTexture, NUX_FILE_LINE_PROTO) | |
Texture2D & | operator= (const Texture2D &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 |
General Texture.
The class of texture that cover power-of-two and non-power-of-two dimensions.
Definition at line 171 of file GLTextureResourceManager.h.
BaseTexture * nux::Texture2D::Clone | ( | ) | const [virtual] |
Clone the texture.
Implements nux::BaseTexture.
Definition at line 349 of file GLTextureResourceManager.cpp.
{ Texture2D* texture = new Texture2D(*this); return texture; }
BitmapFormat nux::Texture2D::GetFormat | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 238 of file GLTextureResourceManager.h.
{
return _image.GetFormat ();
}
int nux::Texture2D::GetHeight | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 230 of file GLTextureResourceManager.h.
{
return _image.GetHeight ();
}
int nux::Texture2D::GetNumMipLevel | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 215 of file GLTextureResourceManager.h.
{
return _image.GetNumMipmap ();
}
int nux::Texture2D::GetWidth | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 222 of file GLTextureResourceManager.h.
{
return _image.GetWidth ();
}
virtual bool nux::Texture2D::IsNull | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 205 of file GLTextureResourceManager.h.
{
return _image.IsNull();
}
bool nux::Texture2D::IsPowerOfTwo | ( | ) | const [inline, virtual] |
Implements nux::BaseTexture.
Definition at line 246 of file GLTextureResourceManager.h.
{
return IsPowerOf2 (_image.GetWidth () ) && IsPowerOf2 (_image.GetHeight () );
}
bool nux::Texture2D::Update | ( | const NBitmapData * | BitmapData, |
bool | UpdateAndCacheResource = true |
||
) | [virtual] |
Update the hardware resources associated to this with the provided texture data.
BitmapData | The texture data to update into the hardware resource. |
UpdateAndCacheResource | if True, then the texture data is loaded into this object, and the caching into hardware data is done right away. If false, the caching is done latter by calling GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource(this); |
Implements nux::BaseTexture.
Definition at line 302 of file GLTextureResourceManager.cpp.
References nux::GraphicsEngine::UpdateResource().
{ nuxAssertMsg (BitmapData, TEXT ("[Texture2D::Update] Argument BitmapData is NULL.")); NUX_RETURN_VALUE_IF_NULL (BitmapData, false); if (!BitmapData->IsTextureData()) { nuxAssertMsg (0, TEXT ("[Texture2D::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::Texture2D::Update | ( | const TCHAR * | Filename, |
bool | UpdateAndCacheResource = true |
||
) | [virtual] |
Update the hardware resources associated to this object with the data associated to the file name.
Filename | File name of texture data to update into the hardware resource. |
UpdateAndCacheResource | if True, then the texture data is loaded into this object, and the caching into hardware data is done right away. If false, the caching is done latter by calling GetGraphicsDisplay()->GetGraphicsEngine()->CacheResource(this); |
Implements nux::BaseTexture.
Definition at line 324 of file GLTextureResourceManager.cpp.
References nux::LoadImageFile().
{ NBitmapData *BitmapData = LoadImageFile (filename); nuxAssertMsg (BitmapData, TEXT ("[Texture2D::Update] Bitmap for file (%s) is NULL."), filename); NUX_RETURN_VALUE_IF_NULL (BitmapData, false); bool ret = Update (BitmapData, UpdateAndCacheResource); NUX_SAFE_DELETE (BitmapData); return ret; }