Back to index

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

#include <ImageSurface.h>

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

List of all members.

Public Member Functions

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

Protected Attributes

unsigned int m_TotalMemorySize

Private Member Functions

void ClearData ()

Private Attributes

int m_NumMipmap
std::vector< ImageSurface * > m_MipSurfaceArray [6]

Detailed Description

Definition at line 290 of file ImageSurface.h.


Constructor & Destructor Documentation

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

Definition at line 1005 of file ImageSurface.cpp.

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

Here is the call graph for this function:

Definition at line 1011 of file ImageSurface.cpp.

  {
    ClearData();
  }

Here is the call graph for this function:

Copy constructor.

Definition at line 1039 of file ImageSurface.cpp.

  {
    for (int face = 0; face < 6; face++)
      for (int i = 0; i < object.GetNumMipmap(); i++)
        m_MipSurfaceArray[face].push_back(new ImageSurface(object.GetSurface(face, i)));
  }

Here is the call graph for this function:


Member Function Documentation

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

Definition at line 1060 of file ImageSurface.cpp.

  {
    nuxAssertMsg(width >= 0, "[NCubemapData::Allocate] Error: Negative texture width.");
    nuxAssertMsg(height >= 0, "[NCubemapData::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_TotalMemorySize = 0;

    for (int face = 0; face < 6; face++)
    {
      for (int i = 0; i < m_NumMipmap; i++)
      {
        int w = width >> i;
        int h = height >> i;
        m_MipSurfaceArray[face].push_back(new ImageSurface(format, w, h));
        m_TotalMemorySize += m_MipSurfaceArray[face][i]->GetSize();
      }
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 1091 of file ImageSurface.cpp.

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

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

Here is the call graph for this function:

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

Definition at line 1106 of file ImageSurface.cpp.

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

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

Here is the call graph for this function:

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

Definition at line 1016 of file ImageSurface.cpp.

  {
    int n = (int) m_MipSurfaceArray[0].size();

    for (int i = 0; i < n; i++)
    {
      delete m_MipSurfaceArray[0][i];
      delete m_MipSurfaceArray[1][i];
      delete m_MipSurfaceArray[2][i];
      delete m_MipSurfaceArray[3][i];
      delete m_MipSurfaceArray[4][i];
      delete m_MipSurfaceArray[5][i];
    }

    m_MipSurfaceArray[0].clear();
    m_MipSurfaceArray[1].clear();
    m_MipSurfaceArray[2].clear();
    m_MipSurfaceArray[3].clear();
    m_MipSurfaceArray[4].clear();
    m_MipSurfaceArray[5].clear();
  }

Here is the caller graph for this function:

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

Reimplemented in nux::NAnimatedTextureData, and nux::NVolumeData.

Definition at line 204 of file ImageSurface.h.

    {
      return 0;
    }
virtual BitmapFormat nux::NCubemapData::GetFormat ( ) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 338 of file ImageSurface.h.

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

Here is the caller graph for this function:

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

Implements nux::NBitmapData.

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

Implements nux::NBitmapData.

Definition at line 1121 of file ImageSurface.cpp.

  {
    return m_MipSurfaceArray[0].size();
  }

Here is the caller graph for this function:

virtual const ImageSurface& nux::NCubemapData::GetSurface ( int  face,
int  MipLevel 
) const [inline, virtual]

Implements nux::NBitmapData.

Definition at line 304 of file ImageSurface.h.

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

Here is the caller graph for this function:

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

Implements nux::NBitmapData.

Definition at line 308 of file ImageSurface.h.

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

Implements nux::NBitmapData.

Definition at line 312 of file ImageSurface.h.

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

Here is the call graph for this function:

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

Implements nux::NBitmapData.

Definition at line 317 of file ImageSurface.h.

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

Here is the call graph for this function:

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

Implements nux::NBitmapData.

Definition at line 330 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::NCubemapData::IsCubemapTextureData ( ) const [inline, virtual]

Reimplemented from nux::NBitmapData.

Definition at line 324 of file ImageSurface.h.

    {
      return true;
    }
virtual bool nux::NCubemapData::IsNull ( ) const [inline, virtual]

Implements nux::NBitmapData.

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

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

Assignment constructor.

Definition at line 1047 of file ImageSurface.cpp.

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

    for (int face = 0; face < 6; face++)
      for (int i = 0; i < copy.GetNumMipmap(); i++)
        m_MipSurfaceArray[face].push_back(new ImageSurface(copy.GetSurface(face, i)));

    return *this;
  }

Here is the call graph for this function:

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

Definition at line 1126 of file ImageSurface.cpp.

  {
    nuxAssert(face >= 0);
    nuxAssert(face < 6);
    nuxAssert(MipLevel >= 0);
    nuxAssert(MipLevel < m_NumMipmap);

    ImageSurface &surface = GetSurface(face, 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 350 of file ImageSurface.h.

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