Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

Texture Class Reference

#include <texture.h>

Inheritance diagram for Texture:

Inheritance graph
[legend]
Collaboration diagram for Texture:

Collaboration graph
[legend]
List of all members.

Detailed Description

Texture class.

Texture abstraction class. Device-independant texture, device-dependant operations/data in derived classes

Author:
Mattias Jansson (mattias@realityrift.com)


Public Types

enum  TEXTUREDEF
 Texture class defines.

enum  TEXTUREINTERNALFORMAT
 Internal texture format identifiers.

enum  TEXTUREFORMAT { DEFAULT = -1 }
 Texture format specifiers during loading. More...

enum  TEXTURETYPE { TEX2D = 0, CUBEMAP = 1 }
 Type of texture (normal, cubemap, spheremap). More...

enum  TEXTURELOADFLAG { NOFLAGS = 0, NOMIPMAPS = 1 }
 Texture loading flags. More...

enum  TEXTURECUBEMAPFACE {
  CUBEFACE_RIGHT = 0, CUBEFACE_LEFT = 1, CUBEFACE_UP = 2, CUBEFACE_DOWN = 3,
  CUBEFACE_BACK = 4, CUBEFACE_FRONT = 5
}
 Cube map face identifiers. More...

enum  TEXTUREFILTERMODE {
  NEAREST = 1, LINEAR = 2, ANISO = 3, NOFILTERING = ( NEAREST | ( NEAREST << 8 ) | ( NEAREST << 16 ) ),
  BILINEAR = ( LINEAR | ( LINEAR << 8 ) | ( NEAREST << 16 ) ), TRILINEAR = ( LINEAR | ( LINEAR << 8 ) | ( LINEAR << 16 ) ), ANISOTROPIC = ( ANISO | ( ANISO << 8 ) | ( ANISO << 16 ) )
}
 Texture filtering modes, primitive and combined. More...


Public Member Functions

 Texture (const std::string &rstrName, TexturePool *pkTexturePool)
virtual ~Texture ()
int GetID () const
TEXTURETYPE GetType () const
bool IsValid () const
bool HasAlpha () const
float GetWidth () const
float GetHeight () const
void SetName (const std::string &rstrName)
const HashStringGetName () const
TEXTUREFORMAT GetFormat () const
unsigned int GetFiltering () const
unsigned int GetMaxAnisotropy () const
virtual bool UploadImage (ImageData *pkImageData, TEXTURETYPE eType=TEX2D, TEXTUREFORMAT eFormat=DEFAULT, unsigned int uiFlags=0, unsigned int uiFiltering=0, unsigned int uiMaxAnisotropy=1)=0
bool GenerateNormalizationCubeMap (int iSize=256)
void SetMaxAnisotropy (unsigned int uiMaxAnisotropy)
bool operator< (const Texture &rkTexture) const
bool operator== (const Texture &rkTexture) const
void IncRef ()
void DecRef ()
int GetRefCount () const

Static Public Member Functions

unsigned int BuildFilter (TEXTUREFILTERMODE eMinFilter, TEXTUREFILTERMODE eMagFilter, TEXTUREFILTERMODE eMipFilter)

Protected Attributes

HashString m_strName
int m_iID
int m_iWidth
int m_iHeight
float m_fWidth
float m_fHeight
float m_fRatio
TEXTURETYPE m_eType
TEXTUREFORMAT m_eFormat
int m_iInternalFormat
TexturePoolm_pkPool
unsigned int m_uiFiltering
unsigned int m_uiMaxAnisotropy


Member Enumeration Documentation

enum TEXTUREFORMAT
 

Texture format specifiers during loading.

Enumeration values:
DEFAULT  Use file format

enum TEXTURETYPE
 

Type of texture (normal, cubemap, spheremap).

Enumeration values:
TEX2D  2D texture
CUBEMAP  Cubemap (of six 2D textures, UploadImage expects image data object that is six images aligned in vertical order, i.e height = width * 6)

enum TEXTURELOADFLAG
 

Texture loading flags.

Enumeration values:
NOFLAGS  No explicit flags set
NOMIPMAPS  Prevent generating mipmaps

enum TEXTURECUBEMAPFACE
 

Cube map face identifiers.

Enumeration values:
CUBEFACE_RIGHT  Right face (+X)
CUBEFACE_LEFT  Left face (-X)
CUBEFACE_UP  Up face (+Y)
CUBEFACE_DOWN  Down face (-Y)
CUBEFACE_BACK  Back face (-Z)
CUBEFACE_FRONT  Front face (+Z)

enum TEXTUREFILTERMODE
 

Texture filtering modes, primitive and combined.

Enumeration values:
NEAREST  Nearest
LINEAR  Linear
ANISO  Anisotropic
NOFILTERING  No filtering (min:nearest, max:nearest, mip:nearest)
BILINEAR  Bilinear filtering (min:linear, max:linear, mip:nearest)
TRILINEAR  Trilinear filtering (min:linear, max:linear, mip:linear)
ANISOTROPIC  Anisotropic filtering (min:aniso, mag:aniso, mip:aniso)


Constructor & Destructor Documentation

Texture const std::string &  rstrName,
TexturePool pkTexturePool
 

Create an empty texture object

virtual ~Texture  )  [virtual]
 

Delete texture object, deallocate associated memory


Member Function Documentation

int GetID  )  const [inline]
 

Returns:
Texture ID

TEXTURETYPE GetType  )  const [inline]
 

Returns:
Texture type

bool IsValid  )  const [inline]
 

Query if texture is valid

Returns:
true if valid, false if not

bool HasAlpha  )  const [inline]
 

Check if texture has alpha channel

Returns:
true if texture has alpha channel, false if not

float GetWidth  )  const [inline]
 

Returns:
Width of texture (float)

float GetHeight  )  const [inline]
 

Returns:
Height of texture (float)

void SetName const std::string &  rstrName  ) 
 

Parameters:
rstrName New texture name

const HashString& GetName  )  const [inline]
 

Returns:
Texture name

TEXTUREFORMAT GetFormat  )  const [inline]
 

Returns:
Texture format

unsigned int GetFiltering  )  const [inline]
 

Returns:
Filtering mode

unsigned int GetMaxAnisotropy  )  const [inline]
 

Returns:
Max anisotropy

virtual bool UploadImage ImageData pkImageData,
TEXTURETYPE  eType = TEX2D,
TEXTUREFORMAT  eFormat = DEFAULT,
unsigned int  uiFlags = 0,
unsigned int  uiFiltering = 0,
unsigned int  uiMaxAnisotropy = 1
[pure virtual]
 

Upload image data

Parameters:
pkImageData Image data
iType Texture type (2D, cubemap, ...)
iFormat Requested format, -1 for default
uiFlags Texture load flags
uiFiltering Filtering modes, 0 for default
Returns:
true if successful, false otherwise

bool GenerateNormalizationCubeMap int  iSize = 256  ) 
 

Generate a normalization cubemap

Parameters:
iSize Side length in cube (texture resolution)
Returns:
true if successful, false otherwise

unsigned int BuildFilter TEXTUREFILTERMODE  eMinFilter,
TEXTUREFILTERMODE  eMagFilter,
TEXTUREFILTERMODE  eMipFilter
[inline, static]
 

Build filtering mode from primitives

Parameters:
eMinFilter Minification filter mode
eMagFilter Magnification filter mode
eMipFilter Mipmap filter mode

void SetMaxAnisotropy unsigned int  uiMaxAnisotropy  )  [inline]
 

Set max anisotropy when anisotropic filtering is enabled

Parameters:
uiMaxAnisotropy Max anisotropy

bool operator< const Texture rkTexture  )  const [inline]
 

Compare texture IDs

Parameters:
rkTexture Texture to compare with
Returns:
true if our id is less than pkTexture

bool operator== const Texture rkTexture  )  const [inline]
 

Compare two textures

Parameters:
rkTexture Texture
Returns:
true if equal (name and format), false if not

void IncRef  )  [inline, inherited]
 

Increase reference count

void DecRef  )  [inline, inherited]
 

Decrease reference count and garbage collect if 0

int GetRefCount  )  const [inline, inherited]
 

Returns:
Current reference count


Member Data Documentation

HashString m_strName [protected]
 

Name

int m_iID [protected]
 

ID

int m_iWidth [protected]
 

Dimensions of texture as integers

int m_iHeight [protected]
 

Dimensions of texture as integers

float m_fWidth [protected]
 

Dimensions of texture as floats

float m_fHeight [protected]
 

Dimensions of texture as floats

float m_fRatio [protected]
 

Ratio

TEXTURETYPE m_eType [protected]
 

Texture type

TEXTUREFORMAT m_eFormat [protected]
 

Texture format

int m_iInternalFormat [protected]
 

Internal texture format

TexturePool* m_pkPool [protected]
 

Texture pool

unsigned int m_uiFiltering [protected]
 

Filtering modes

unsigned int m_uiMaxAnisotropy [protected]
 

Max anisotropy


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:15 2004 for NeoEngine by doxygen 1.3.5