Back to index

nux  3.0.0
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
nux::NAnimatedTextureData Class Reference

#include <ImageSurface.h>

Inheritance diagram for nux::NAnimatedTextureData:
Inheritance graph
[legend]
Collaboration diagram for nux::NAnimatedTextureData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 NAnimatedTextureData (BitmapFormat f=BITFMT_R8G8B8A8, int width=16, int height=16, int slice=1)
virtual ~NAnimatedTextureData ()
 NAnimatedTextureData (const NAnimatedTextureData &)
 Copy constructor.
NAnimatedTextureDataoperator= (const NAnimatedTextureData &)
 Assignment constructor.
virtual void Allocate (BitmapFormat f, int width, int height, int slice, int NumMipmap=1)
virtual void AllocateCheckBoardTexture (int width, int height, int slice, int NumMipmap, Color color0, Color color1, int TileWidth=4, int TileHeight=4)
virtual void AllocateColorTexture (int width, int height, int slice, int NumMipmap, Color color0=Color(0xFFFFFFF))
virtual const ImageSurfaceGetSurface (int MipLevel, int slice) const
virtual ImageSurfaceGetSurface (int MipLevel, int slice)
virtual const ImageSurfaceGetSurface (int Frame) const
virtual ImageSurfaceGetSurface (int Frame)
bool SetSurface (int face, int MipLevel, const ImageSurface &object)
virtual bool IsAnimatedTextureData () const
int GetFrameTime (int Frame) const
void AddFrameTime (unsigned int FrameTime)
int GetNumMipmap () const
virtual int GetWidth () const
virtual int GetHeight () const
virtual int GetDepth () const
virtual BitmapFormat GetFormat () const
virtual bool IsNull () const
virtual bool IsTextureData () const
virtual bool IsCubemapTextureData () const
virtual bool IsVolumeTextureData () const
virtual int GetMemorySize () const

Protected Attributes

unsigned int m_TotalMemorySize

Private Member Functions

void ClearData ()

Private Attributes

int m_NumMipmap
int m_Depth
std::vector< ImageSurface * > * m_MipSurfaceArray
std::vector< unsigned int > m_FrameTimeArray

Detailed Description

Definition at line 421 of file ImageSurface.h.


Constructor & Destructor Documentation

nux::NAnimatedTextureData::NAnimatedTextureData ( BitmapFormat  f = BITFMT_R8G8B8A8,
int  width = 16,
int  height = 16,
int  slice = 1 
)

Definition at line 1303 of file ImageSurface.cpp.

    :   m_NumMipmap(0)
    ,   m_Depth(0)
    ,   m_MipSurfaceArray(0)
  {
    Allocate(format, width, height, depth, 1);
  }

Here is the call graph for this function:

Definition at line 1311 of file ImageSurface.cpp.

  {
    ClearData();
  }

Here is the call graph for this function:

Copy constructor.

Definition at line 1333 of file ImageSurface.cpp.

  {
    for (int mip = 0; mip < object.GetNumMipmap(); mip++)
    {
      for (int s = 0; s < ImageSurface::GetLevelDim(object.GetFormat(), object.GetDepth(), mip); s++)
      {
        m_MipSurfaceArray[mip].push_back(new ImageSurface(object.GetSurface(mip, s)));
      }
    }

    for (int frame = 0; frame < object.GetDepth(); frame++)
    {
      m_FrameTimeArray.push_back(object.GetFrameTime(frame));
    }
  }

Here is the call graph for this function:


Member Function Documentation

void nux::NAnimatedTextureData::AddFrameTime ( unsigned int  FrameTime) [inline]

Definition at line 472 of file ImageSurface.h.

    {
      m_FrameTimeArray.push_back(FrameTime);
    }
void nux::NAnimatedTextureData::Allocate ( BitmapFormat  f,
int  width,
int  height,
int  slice,
int  NumMipmap = 1 
) [virtual]

Definition at line 1375 of file ImageSurface.cpp.

  {
    nuxAssertMsg(depth >= 0, "[NAnimatedTextureData::Allocate] Error: Negative number of slice.");
    nuxAssertMsg(width >= 0, "[NAnimatedTextureData::Allocate] Error: Negative texture width.");
    nuxAssertMsg(height >= 0, "[NAnimatedTextureData::Allocate] Error: Negative texture height.");
    nuxAssert(NumMipmapRequested >= 0);

    ClearData();

    int NumTotalMipLevel    = 1 + (int) Floor(Log2(Max(width, height)));
    m_NumMipmap = NumMipmapRequested;

    if (NumMipmapRequested == 0)
      m_NumMipmap = NumTotalMipLevel ? NumTotalMipLevel : 1;

    if (NumMipmapRequested > NumTotalMipLevel)
      m_NumMipmap = NumTotalMipLevel ? NumTotalMipLevel : 1;

    m_Depth = depth;

    m_MipSurfaceArray = new std::vector<ImageSurface *>[m_NumMipmap];
    m_TotalMemorySize = 0;

    for (int mip = 0; mip < m_NumMipmap; mip++)
    {
      for (int s = 0; s < ImageSurface::GetLevelDim(format, depth, mip); s++)
      {
        int w = ImageSurface::GetLevelDim(format, width, mip);
        int h = ImageSurface::GetLevelDim(format, height, mip);
        m_MipSurfaceArray[mip].push_back(new ImageSurface(format, w, h));
        m_TotalMemorySize += m_MipSurfaceArray[mip][s]->GetSize();
      }
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::NAnimatedTextureData::AllocateCheckBoardTexture ( int  width,
int  height,
int  slice,
int  NumMipmap,
Color  color0,
Color  color1,
int  TileWidth = 4,
int  TileHeight = 4 
) [virtual]

Definition at line 1410 of file ImageSurface.cpp.

  {
    Allocate(BITFMT_R8G8B8A8, width, height, slice, NumMipmap);

    for (int mip = 0; mip < m_NumMipmap; mip++)
    {
      for (int s = 0; s < ImageSurface::GetLevelDim(BITFMT_R8G8B8A8, GetDepth(), mip); s++)
      {
        int w = ImageSurface::GetLevelDim(BITFMT_R8G8B8A8, GetWidth(), mip);
        int h = ImageSurface::GetLevelDim(BITFMT_R8G8B8A8, GetHeight(), mip);
        MakeCheckBoardImage(* (m_MipSurfaceArray[mip][s]), w, h, color0, color1, TileWidth, TileHeight);
      }
    }
  }

Here is the call graph for this function:

void nux::NAnimatedTextureData::AllocateColorTexture ( int  width,
int  height,
int  slice,
int  NumMipmap,
Color  color0 = Color(0xFFFFFFF) 
) [virtual]

Definition at line 1425 of file ImageSurface.cpp.

  {
    Allocate(BITFMT_R8G8B8A8, width, height, slice, NumMipmap);

    for (int mip = 0; mip < m_NumMipmap; mip++)
    {
      for (int s = 0; s < ImageSurface::GetLevelDim(BITFMT_R8G8B8A8, GetDepth(), mip); s++)
      {
        int w = ImageSurface::GetLevelDim(BITFMT_R8G8B8A8, GetWidth(), mip);
        int h = ImageSurface::GetLevelDim(BITFMT_R8G8B8A8, GetHeight(), mip);
        MakeCheckBoardImage(* (m_MipSurfaceArray[mip][s]), w, h, color0, color0);
      }
    }
  }

Here is the call graph for this function:

Definition at line 1316 of file ImageSurface.cpp.

  {
    for (int mip = 0; mip < GetNumMipmap(); mip++)
    {
      for (int s = 0; s < ImageSurface::GetLevelDim(GetFormat(), GetDepth(), mip); s++)
      {
        delete m_MipSurfaceArray[mip][s];
      }

      m_MipSurfaceArray[mip].clear();
    }

    m_FrameTimeArray.clear();
    delete [] m_MipSurfaceArray;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int nux::NAnimatedTextureData::GetDepth ( ) const [inline, virtual]

Reimplemented from nux::NBitmapData.

Definition at line 486 of file ImageSurface.h.

    {
      return m_Depth;
    }

Here is the caller graph for this function:

virtual BitmapFormat nux::NAnimatedTextureData::GetFormat ( ) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 490 of file ImageSurface.h.

    {
      return m_MipSurfaceArray[0][0]->GetFormat();
    }

Here is the caller graph for this function:

int nux::NAnimatedTextureData::GetFrameTime ( int  Frame) const [inline]

Definition at line 465 of file ImageSurface.h.

    {
      nuxAssert(Frame >= 0);
      nuxAssert(Frame < m_Depth);
      return m_FrameTimeArray[Frame];
    }

Here is the caller graph for this function:

virtual int nux::NAnimatedTextureData::GetHeight ( ) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 482 of file ImageSurface.h.

    {
      return m_MipSurfaceArray[0][0]->GetHeight();
    }

Here is the caller graph for this function:

virtual int nux::NBitmapData::GetMemorySize ( ) const [inline, virtual, inherited]

Definition at line 210 of file ImageSurface.h.

    {
      return m_TotalMemorySize;
    }
int nux::NAnimatedTextureData::GetNumMipmap ( ) const [virtual]

Implements nux::NBitmapData.

Definition at line 1440 of file ImageSurface.cpp.

  {
    return m_NumMipmap;
  }

Here is the caller graph for this function:

virtual const ImageSurface& nux::NAnimatedTextureData::GetSurface ( int  MipLevel,
int  slice 
) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 435 of file ImageSurface.h.

    {
      nuxAssertMsg(0, "[NAnimatedTextureData::GetSurface] Use GetSurface(unsigned int Frame) for NAnimatedTextureData.");
      return GetSurface(0);
    }

Here is the caller graph for this function:

virtual ImageSurface& nux::NAnimatedTextureData::GetSurface ( int  MipLevel,
int  slice 
) [inline, virtual]

Implements nux::NBitmapData.

Definition at line 440 of file ImageSurface.h.

    {
      nuxAssertMsg(0, "[NAnimatedTextureData::GetSurface] Use GetSurface(unsigned int Frame) for NAnimatedTextureData.");
      return GetSurface(0);
    }

Here is the call graph for this function:

virtual const ImageSurface& nux::NAnimatedTextureData::GetSurface ( int  Frame) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 445 of file ImageSurface.h.

    {
      nuxAssert(Frame >= 0);
      nuxAssert(Frame < m_Depth);
      return *m_MipSurfaceArray[0][Frame];
    }
virtual ImageSurface& nux::NAnimatedTextureData::GetSurface ( int  Frame) [inline, virtual]

Implements nux::NBitmapData.

Definition at line 451 of file ImageSurface.h.

    {
      nuxAssert(Frame >= 0);
      nuxAssert(Frame < m_Depth);
      return const_cast<ImageSurface &> ((const_cast< const NAnimatedTextureData * > (this))->GetSurface(Frame));
    }
virtual int nux::NAnimatedTextureData::GetWidth ( ) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 478 of file ImageSurface.h.

    {
      return m_MipSurfaceArray[0][0]->GetWidth();
    }

Here is the caller graph for this function:

virtual bool nux::NAnimatedTextureData::IsAnimatedTextureData ( ) const [inline, virtual]

Reimplemented from nux::NBitmapData.

Definition at line 460 of file ImageSurface.h.

    {
      return true;
    }
virtual bool nux::NBitmapData::IsCubemapTextureData ( ) const [inline, virtual, inherited]

Reimplemented in nux::NCubemapData.

Definition at line 188 of file ImageSurface.h.

    {
      return false;
    }

Here is the caller graph for this function:

virtual bool nux::NAnimatedTextureData::IsNull ( ) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 494 of file ImageSurface.h.

    {
      return m_MipSurfaceArray[0][0]->IsNull();
    }

Here is the caller graph for this function:

virtual bool nux::NBitmapData::IsTextureData ( ) const [inline, virtual, inherited]

Reimplemented in nux::NTextureData.

Definition at line 184 of file ImageSurface.h.

    {
      return false;
    };

Here is the caller graph for this function:

virtual bool nux::NBitmapData::IsVolumeTextureData ( ) const [inline, virtual, inherited]

Reimplemented in nux::NVolumeData.

Definition at line 192 of file ImageSurface.h.

    {
      return false;
    }

Here is the caller graph for this function:

NAnimatedTextureData & nux::NAnimatedTextureData::operator= ( const NAnimatedTextureData copy)

Assignment constructor.

Definition at line 1350 of file ImageSurface.cpp.

  {
    ClearData();
    m_Depth = copy.GetDepth();
    m_NumMipmap = copy.m_NumMipmap;
    m_TotalMemorySize = copy.m_TotalMemorySize;

    m_MipSurfaceArray = new std::vector<ImageSurface *>[m_NumMipmap];

    for (int mip = 0; mip < copy.GetNumMipmap(); mip++)
    {
      for (int s = 0; s < ImageSurface::GetLevelDim(copy.GetFormat(), copy.GetDepth(), mip); s++)
      {
        m_MipSurfaceArray[mip].push_back(new ImageSurface(copy.GetSurface(s)));
      }
    }

    for (int frame = 0; frame < copy.GetDepth(); frame++)
    {
      m_FrameTimeArray.push_back(copy.GetFrameTime(frame));
    }

    return *this;
  }

Here is the call graph for this function:

bool nux::NAnimatedTextureData::SetSurface ( int  face,
int  MipLevel,
const ImageSurface object 
)

Definition at line 1445 of file ImageSurface.cpp.

  {
    nuxAssert(Slice >= 0);
    nuxAssert(Slice < m_Depth);
    nuxAssert(MipLevel >= 0);
    nuxAssert(MipLevel < m_NumMipmap);

    ImageSurface &surface = GetSurface(Slice, MipLevel);

    if (surface.GetFormat() != targetsurface.GetFormat())
      return false;

    if (surface.GetWidth() != targetsurface.GetWidth())
      return false;

    if (surface.GetHeight() != targetsurface.GetHeight())
      return false;

    surface = targetsurface;
    return true;
  }

Here is the call graph for this function:


Member Data Documentation

Definition at line 502 of file ImageSurface.h.

std::vector<unsigned int> nux::NAnimatedTextureData::m_FrameTimeArray [private]

Definition at line 504 of file ImageSurface.h.

Definition at line 503 of file ImageSurface.h.

Definition at line 501 of file ImageSurface.h.

unsigned int nux::NBitmapData::m_TotalMemorySize [protected, inherited]

Definition at line 216 of file ImageSurface.h.


The documentation for this class was generated from the following files: