Back to index

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

#include <ImageSurface.h>

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

List of all members.

Public Member Functions

 NVolumeData (BitmapFormat f=BITFMT_R8G8B8A8, int width=16, int height=16, int slice=1, int NumMipmap=1)
virtual ~NVolumeData ()
 NVolumeData (const NVolumeData &)
 Copy constructor.
NVolumeDataoperator= (const NVolumeData &)
 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 MipLevel) const
virtual ImageSurfaceGetSurface (int MipLevel)
bool SetSurface (int face, int MipLevel, const ImageSurface &object)
virtual bool IsVolumeTextureData () const
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 IsAnimatedTextureData () 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

Detailed Description

Definition at line 353 of file ImageSurface.h.


Constructor & Destructor Documentation

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

Definition at line 1149 of file ImageSurface.cpp.

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

Here is the call graph for this function:

Definition at line 1157 of file ImageSurface.cpp.

  {
    ClearData();
  }

Here is the call graph for this function:

Copy constructor.

Definition at line 1178 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)));
      }
    }
  }

Here is the call graph for this function:


Member Function Documentation

void nux::NVolumeData::Allocate ( BitmapFormat  f,
int  width,
int  height,
int  slice,
int  NumMipmap = 1 
) [virtual]

Definition at line 1210 of file ImageSurface.cpp.

  {
    nuxAssertMsg(depth >= 0, "[NVolumeData::Allocate] Error: Negative number of slice.");
    nuxAssertMsg(width >= 0, "[NVolumeData::Allocate] Error: Negative texture width.");
    nuxAssertMsg(height >= 0, "[NVolumeData::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::NVolumeData::AllocateCheckBoardTexture ( int  width,
int  height,
int  slice,
int  NumMipmap,
Color  color0,
Color  color1,
int  TileWidth = 4,
int  TileHeight = 4 
) [virtual]

Definition at line 1245 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::NVolumeData::AllocateColorTexture ( int  width,
int  height,
int  slice,
int  NumMipmap,
Color  color0 = Color(0xFFFFFFF) 
) [virtual]

Definition at line 1260 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:

void nux::NVolumeData::ClearData ( ) [private]

Definition at line 1162 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();
    }

    delete [] m_MipSurfaceArray;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from nux::NBitmapData.

Definition at line 401 of file ImageSurface.h.

    {
      return m_Depth;
    }

Here is the caller graph for this function:

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

Implements nux::NBitmapData.

Definition at line 405 of file ImageSurface.h.

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

Here is the caller graph for this function:

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

Implements nux::NBitmapData.

Definition at line 397 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::NVolumeData::GetNumMipmap ( ) const [virtual]

Implements nux::NBitmapData.

Definition at line 1275 of file ImageSurface.cpp.

  {
    return m_NumMipmap;
  }

Here is the caller graph for this function:

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

Implements nux::NBitmapData.

Definition at line 367 of file ImageSurface.h.

    {
      return *m_MipSurfaceArray[MipLevel][slice];
    };

Here is the caller graph for this function:

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

Implements nux::NBitmapData.

Definition at line 371 of file ImageSurface.h.

    {
      return const_cast<ImageSurface &> ((const_cast< const NVolumeData * > (this))->GetSurface(MipLevel, slice));
    }
virtual const ImageSurface& nux::NVolumeData::GetSurface ( int  MipLevel) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 375 of file ImageSurface.h.

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

Here is the call graph for this function:

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

Implements nux::NBitmapData.

Definition at line 380 of file ImageSurface.h.

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

Here is the call graph for this function:

virtual int nux::NVolumeData::GetWidth ( ) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 393 of file ImageSurface.h.

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

Here is the caller graph for this function:

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

Reimplemented in nux::NAnimatedTextureData.

Definition at line 196 of file ImageSurface.h.

    {
      return false;
    }

Here is the caller graph for this function:

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::NVolumeData::IsNull ( ) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 409 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::NVolumeData::IsVolumeTextureData ( ) const [inline, virtual]

Reimplemented from nux::NBitmapData.

Definition at line 387 of file ImageSurface.h.

    {
      return true;
    }
NVolumeData & nux::NVolumeData::operator= ( const NVolumeData copy)

Assignment constructor.

Definition at line 1190 of file ImageSurface.cpp.

  {
    ClearData();
    m_Depth = copy.m_Depth;
    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(mip, s)));
      }
    }

    return *this;
  }

Here is the call graph for this function:

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

Definition at line 1280 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 417 of file ImageSurface.h.

Definition at line 418 of file ImageSurface.h.

Definition at line 416 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: