TextureTileArray Class Reference

TextureTileArray Class Reference

#include <material.h>

Class Description

This class describes a 2D array of texture tiles.

It is very fast to access a tile given a U and V coordinate in that tile (each tile covers exactly a 1.0 x 1.0 area in UV coordinates, and starts on a whole number) This is used by both the TexturePool class and the CGMaterial class.

Definition at line 354 of file material.h.

Public Member Functions

 TextureTileArray ()
 
 ~TextureTileArray ()
 
float getMinU () const
 returns the minimum U coordinate. More...
 
float getMinV () const
 returns the minimum V coordinate. More...
 
float getMaxU () const
 returns the maximum U coordinate. More...
 
float getMaxV () const
 returns the maximum V coordinate. More...
 
void getTotalUVBounds (float &minU, float &minV, float &maxU, float &maxV) const
 get the bounds of this texture tile array More...
 
bool contains (float U, float V) const
 returns true if the array is big enough to contain the specified UV coordinates More...
 
int getTileStateIndex (float U, float V) const
 
void setTileStateIndex (float U, float V, int indx)
 
void dropAll ()
 deallocate all textures and clears their states. More...
 
void clearTileStateIndices ()
 

Constructor & Destructor Documentation

TextureTileArray ( )
inline

Definition at line 395 of file material.h.

395 { init(); }
~TextureTileArray ( )
inline

Definition at line 396 of file material.h.

396 { dropAll(); }
void dropAll()
deallocate all textures and clears their states.

Member Function Documentation

float getMinU ( ) const
inline

returns the minimum U coordinate.

Will have all 0 to the right of the decimal

Definition at line 400 of file material.h.

400 { return m_UOrigin; }
float getMinV ( ) const
inline

returns the minimum V coordinate.

Will have all 0 to the right of the decimal

Definition at line 403 of file material.h.

403 { return m_VOrigin; }
float getMaxU ( ) const
inline

returns the maximum U coordinate.

Will have all 0 to the right of the decimal

Definition at line 406 of file material.h.

406 { return m_UOrigin + (float)m_USize; }
float getMaxV ( ) const
inline

returns the maximum V coordinate.

Will have all 0 to the right of the decimal

Definition at line 409 of file material.h.

409 { return m_VOrigin + (float)m_VSize; }
void getTotalUVBounds ( float &  minU,
float &  minV,
float &  maxU,
float &  maxV 
) const
inline

get the bounds of this texture tile array

Definition at line 412 of file material.h.

413  {
414  minU = m_UOrigin;
415  minV = m_VOrigin;
416  maxU = minU + (float)m_USize;
417  maxV = minV + (float)m_VSize;
418  }
bool contains ( float  U,
float  V 
) const
inline

returns true if the array is big enough to contain the specified UV coordinates

Definition at line 422 of file material.h.

423  {
424  return m_Tiles && U >= getMinU() && U < getMaxU() && V >= getMinV() && V < getMaxV();
425  }
float getMinU() const
returns the minimum U coordinate.
Definition: material.h:400
float getMinV() const
returns the minimum V coordinate.
Definition: material.h:403
float getMaxV() const
returns the maximum V coordinate.
Definition: material.h:409
int getTileStateIndex ( float  U,
float  V 
) const
inline

Definition at line 428 of file material.h.

429  {
430  if (!contains(U, V)) return -1; else
431  return tileFromUV(U, V)->m_TileStateIndex;
432  }
bool contains(float U, float V) const
returns true if the array is big enough to contain the specified UV coordinates
Definition: material.h:422
void setTileStateIndex ( float  U,
float  V,
int  indx 
)
inline

Definition at line 434 of file material.h.

435  {
436  if (!contains(U, V)) resizeArrayToInclude(U, V);
437  tileFromUV(U, V)->m_TileStateIndex = indx;
438  }
bool contains(float U, float V) const
returns true if the array is big enough to contain the specified UV coordinates
Definition: material.h:422
void dropAll ( )

deallocate all textures and clears their states.

Also deallocates the entire TextureTile array and sets the bounds to 0. (which means don't call getLive, getInactiveColor, or getProxyLevel after calling this without first allocating those textures first.

void clearTileStateIndices ( )

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