nux-1.14.0
nux::TextureFrameAnimation Class Reference
Inheritance diagram for nux::TextureFrameAnimation:
nux::BaseTexture nux::ResourceData nux::Object nux::Trackable nux::Introspectable

List of all members.

Public Member Functions

 TextureFrameAnimation (NUX_FILE_LINE_PROTO)
 TextureFrameAnimation (const TextureFrameAnimation &texture)
TextureFrameAnimationoperator= (const TextureFrameAnimation &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 slice=0)
int GetFrameTime (int Frame)
int GetNumMipLevel () const
int GetWidth () const
int GetHeight () const
int GetDepth () const
BitmapFormat GetFormat () const
bool IsPowerOfTwo () const
virtual BaseTextureClone () const

Detailed Description

Definition at line 490 of file GLTextureResourceManager.h.


Member Function Documentation

BaseTexture * nux::TextureFrameAnimation::Clone ( ) const [virtual]

Clone the texture.

Returns:
A cloned version of this texture.

Implements nux::BaseTexture.

Definition at line 1026 of file GLTextureResourceManager.cpp.

  {
    TextureFrameAnimation* texture = new TextureFrameAnimation(*this);
    return texture;
  }
int nux::TextureFrameAnimation::GetDepth ( ) const [inline, virtual]
Returns:
The number of animation frames in the texture.

Reimplemented from nux::BaseTexture.

Definition at line 540 of file GLTextureResourceManager.h.

    {
      return _image.GetDepth ();
    }
BitmapFormat nux::TextureFrameAnimation::GetFormat ( ) const [inline, virtual]
Returns:
The texture data format.

Implements nux::BaseTexture.

Definition at line 548 of file GLTextureResourceManager.h.

    {
      return _image.GetFormat ();
    }
int nux::TextureFrameAnimation::GetHeight ( ) const [inline, virtual]
Returns:
The texture height.

Implements nux::BaseTexture.

Definition at line 532 of file GLTextureResourceManager.h.

    {
      return _image.GetHeight ();
    }
int nux::TextureFrameAnimation::GetNumMipLevel ( ) const [inline, virtual]
Returns:
The number of mip maps in the texture.

Implements nux::BaseTexture.

Definition at line 516 of file GLTextureResourceManager.h.

    {
      return _image.GetNumMipmap ();
    }
int nux::TextureFrameAnimation::GetWidth ( ) const [inline, virtual]
Returns:
The texture width.

Implements nux::BaseTexture.

Definition at line 524 of file GLTextureResourceManager.h.

    {
      return _image.GetWidth ();
    }
virtual bool nux::TextureFrameAnimation::IsNull ( ) const [inline, virtual]
Returns:
True if the texture storage contains valid bitmap data.

Implements nux::BaseTexture.

Definition at line 506 of file GLTextureResourceManager.h.

    {
      return _image.IsNull ();
    }
bool nux::TextureFrameAnimation::IsPowerOfTwo ( ) const [inline, virtual]
Returns:
true if the width and heigth of the texture are powers of two.

Implements nux::BaseTexture.

Definition at line 556 of file GLTextureResourceManager.h.

    {
      return IsPowerOf2 (_image.GetWidth () ) && IsPowerOf2 (_image.GetHeight () );
    }
bool nux::TextureFrameAnimation::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.

Returns:
True if there was no error during the update.

Implements nux::BaseTexture.

Definition at line 969 of file GLTextureResourceManager.cpp.

References nux::GraphicsEngine::UpdateResource().

Referenced by Update().

  {
    nuxAssertMsg (BitmapData, TEXT ("[TextureFrameAnimation::Update] Argument BitmapData is NULL.") );
    NUX_RETURN_VALUE_IF_NULL (BitmapData, false);

    if (!BitmapData->IsAnimatedTextureData() )
    {
      nuxAssertMsg (0, TEXT ("[TextureFrameAnimation::Update] Argument BitmapData is not a Animated texture") );
      return false;
    }

    _image = *static_cast<const NAnimatedTextureData *> (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::TextureFrameAnimation::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.

Returns:
True if there was no error during the update.

Implements nux::BaseTexture.

Definition at line 991 of file GLTextureResourceManager.cpp.

References nux::LoadImageFile(), and Update().

  {
    NBitmapData *BitmapData = LoadImageFile (filename);
    nuxAssertMsg (BitmapData, TEXT ("[TextureFrameAnimation::Update] Bitmap for file (%s) is NULL."), filename);
    NUX_RETURN_VALUE_IF_NULL (BitmapData, false);
    bool ret = Update (BitmapData);
    NUX_SAFE_DELETE (BitmapData);
    return ret;
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends