TGraphicTexture Class Reference

This class represents software texture. More...

#include <Images.h>

Inheritance diagram for TGraphicTexture:

Inheritance graph
[legend]
Collaboration diagram for TGraphicTexture:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TGraphicTexture (void)
 Constructor.
 ~TGraphicTexture (void)
 Destructor.
 TGraphicTexture (const TGraphicTexture &orig)
 fake copy constructor
void operator= (const TGraphicTexture &orig)
 fake assignment operator
BOOL Create (const TSurfaceDesc &desc, DWORD mipmaps)
 Creates texture.
BOOL Create (DWORD width, DWORD height, EnumGraphicFormat format, DWORD mipmaps)
 Creates texture.
void Unload (void)
 Release all resources in this object.
void Clone (TGraphicTexture **dest) const
 Copy this texture to new one.
void Set (const TGraphicTexture &orig)
 Set(copy) texture in parameter to this texture.
const TGraphicSurfaceGetMipMap (DWORD index) const
 Returns pointer to one of texture mipmaps or NULL if this mipmap doesnt exists.
TGraphicSurfaceGetMipMap (DWORD index)
 Returns pointer to one of texture mmipmaps or NULL if this mipmap doesnt exists.
BOOL IsLoaded (void) const
 Determines whether texture is loaded.
BOOL IsCompressed (void) const
 Determines whether texture has compressed device format (e.g.
BOOL IsRGB (void) const
 Determines whether texture has RGB-type device format (e.g.
EnumGraphicFormat GetPixelFormat (void) const
 Returns pixel format of texture.
DWORD GetNumberMipMaps (void) const
 Returns number of mipmaps in texture.
DWORD GetWidth (void) const
 Returns width of main surface (first mipmap).
DWORD GetHeight (void) const
 Returns height of main surface (first mipmap).
TSurfaceDesc GetSurfDesc (void) const
 Return surface description.
BOOL LoadDDS (const TString &filename)
 Load texture from specified DDS file.

Classes

struct  DDS_FLAGS
 Struct with basic informations about DDS file.

Detailed Description

This class represents software texture.

Software texture consists at least from one TGraphicSurface surface. As well as TGraphicSurface is software equivalent for TRendererSurface as well TGraphicTexture is equivalent for TRendererTexture.

Texture must be loaded before you use it - see IsLoaded() method. You may load texture by creating it or loading from file.

Actually supports only these formats: GRAPH_FMT_X8R8G8B8 GRAPH_FMT_A8R8G8B8 GRAPH_FMT_L8 GRAPH_FMT_A8 GRAPH_FMT_R5G6B5 GRAPH_FMT_X1R5G5B5

GRAPH_FMT_DXT1 GRAPH_FMT_DXT2 GRAPH_FMT_DXT3 GRAPH_FMT_DXT4 GRAPH_FMT_DXT5

Definition at line 167 of file Images.h.


Constructor & Destructor Documentation

TGraphicTexture::TGraphicTexture void   ) 
 

Constructor.

Creates empty, uninitialized (unloaded) texture.

Before using you must create or load texture.

Definition at line 297 of file Images.cpp.

References FALSE, GRAPH_FMT_UNKNOWN, TSurfaceDesc::m_height, TSurfaceDesc::m_pixelFormat, and TSurfaceDesc::m_width.

TGraphicTexture::~TGraphicTexture void   ) 
 

Destructor.

Destroy this texture and also all surfaces stored inside!!!

Definition at line 312 of file Images.cpp.

References Unload().

Here is the call graph for this function:

TGraphicTexture::TGraphicTexture const TGraphicTexture orig  ) 
 

fake copy constructor


Member Function Documentation

void TGraphicTexture::Clone TGraphicTexture **  dest  )  const
 

Copy this texture to new one.

Warning:
This method allocates memory which must be deallocated by caller. Before calling this method memory allocated via pointer DEST should be deallocated, because this method sets to pointer new memory adress!!!
Parameters:
dest [out] pointer to store result

Definition at line 420 of file Images.cpp.

References DBGASSERT, and Set().

Here is the call graph for this function:

BOOL TGraphicTexture::Create DWORD  width,
DWORD  height,
EnumGraphicFormat  format,
DWORD  mipmaps
 

Creates texture.

This method always destroys previous texture thus if creating fails, texture become into unloaded state. Mipmaps are created from previous texture size by dividing of 2. Number of created mipmaps may be less than desired because last mipmap must have size equal to 1x1.

Parameters:
width [in]width of texture in pixels (first level)
height [in]height of texture in pixels (first level)
format [in]pixel format of this texture (for all levels is identical)
mipmaps [in]number of mipmaps in texture - must be at least 1, 0 means generating all possible mipmaps up to 1x1 surface

Definition at line 342 of file Images.cpp.

References TArrayPtrs< T, size, step >::AddItem(), TGraphicSurface::Create(), DBGTEXTF, FALSE, GRAPH_FMT_UNKNOWN, TRUE, and Unload().

Here is the call graph for this function:

BOOL TGraphicTexture::Create const TSurfaceDesc desc,
DWORD  mipmaps
[inline]
 

Creates texture.

Old texture is destroyed.

Parameters:
desc [in] new texture surface description (description for first level of texture)
mipmaps [in] number of mipmaps in new texture

Definition at line 192 of file Images.h.

References TSurfaceDesc::m_height, TSurfaceDesc::m_pixelFormat, and TSurfaceDesc::m_width.

DWORD TGraphicTexture::GetHeight void   )  const [inline]
 

Returns height of main surface (first mipmap).

Definition at line 232 of file Images.h.

References TSurfaceDesc::m_height.

TGraphicSurface * TGraphicTexture::GetMipMap DWORD  index  ) 
 

Returns pointer to one of texture mmipmaps or NULL if this mipmap doesnt exists.

Mipmaps are indexed from zero, so range is <0,GetNumberMipMaps()>.

Parameters:
index [in] index of mipmap in range <0,GetNumberMipMaps()>

Definition at line 484 of file Images.cpp.

References DBGASSERT, and TArrayPtrs< T, size, step >::GetItem().

Here is the call graph for this function:

const TGraphicSurface * TGraphicTexture::GetMipMap DWORD  index  )  const
 

Returns pointer to one of texture mipmaps or NULL if this mipmap doesnt exists.

Mipmaps are indexed from zero, so range is <0,GetNumberMipMaps()>.

Parameters:
index [in] index of mipmap in range <0,GetNumberMipMaps()>

Definition at line 465 of file Images.cpp.

References DBGASSERT, and TArrayPtrs< T, size, step >::GetItem().

Here is the call graph for this function:

DWORD TGraphicTexture::GetNumberMipMaps void   )  const [inline]
 

Returns number of mipmaps in texture.

Value 0 means there is no texture loaded!!!

Definition at line 224 of file Images.h.

EnumGraphicFormat TGraphicTexture::GetPixelFormat void   )  const [inline]
 

Returns pixel format of texture.

Definition at line 219 of file Images.h.

References TSurfaceDesc::m_pixelFormat.

TSurfaceDesc TGraphicTexture::GetSurfDesc void   )  const [inline]
 

Return surface description.

Definition at line 236 of file Images.h.

DWORD TGraphicTexture::GetWidth void   )  const [inline]
 

Returns width of main surface (first mipmap).

Definition at line 228 of file Images.h.

References TSurfaceDesc::m_width.

BOOL TGraphicTexture::IsCompressed void   )  const [inline]
 

Determines whether texture has compressed device format (e.g.

DXTn)

Definition at line 211 of file Images.h.

BOOL TGraphicTexture::IsLoaded void   )  const [inline]
 

Determines whether texture is loaded.

Definition at line 207 of file Images.h.

Referenced by Set().

BOOL TGraphicTexture::IsRGB void   )  const [inline]
 

Determines whether texture has RGB-type device format (e.g.

X8R8G8B8)

Definition at line 215 of file Images.h.

BOOL TGraphicTexture::LoadDDS const TString filename  ) 
 

Load texture from specified DDS file.

Specified file is from virtual file system!!! Thus VFS must set properly in TGlobalsSystem!!!

Parameters:
filename [in] name of file with texture in DDS format

Definition at line 504 of file Images.cpp.

References DBGTEXTF, FALSE, TString::Length(), and Unload().

Here is the call graph for this function:

void TGraphicTexture::operator= const TGraphicTexture orig  ) 
 

fake assignment operator

void TGraphicTexture::Set const TGraphicTexture orig  ) 
 

Set(copy) texture in parameter to this texture.

Parameters:
orig [in]original image

Definition at line 432 of file Images.cpp.

References IsLoaded(), and Unload().

Referenced by Clone().

Here is the call graph for this function:

void TGraphicTexture::Unload void   ) 
 

Release all resources in this object.

After calling this method texture is unloaded and therefore unusable!!!.

Definition at line 320 of file Images.cpp.

References FALSE, GRAPH_FMT_UNKNOWN, TSurfaceDesc::m_height, TSurfaceDesc::m_pixelFormat, and TSurfaceDesc::m_width.

Referenced by Create(), LoadDDS(), Set(), and ~TGraphicTexture().


The documentation for this class was generated from the following files:
Generated on Wed Nov 28 22:42:46 2007 for Joy4D by  doxygen 1.4.6-NO