Pyrogenesis  trunk
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CTerritoryTexture Class Reference

Maintains the territory boundary texture, used for rendering and for the minimap. More...

#include <TerritoryTexture.h>

Collaboration diagram for CTerritoryTexture:
Collaboration graph
[legend]

Public Member Functions

 CTerritoryTexture (CSimulation2 &simulation)
 
 ~CTerritoryTexture ()
 
void BindTexture (int unit)
 Recomputes the territory texture if necessary, and binds it to the requested texture unit. More...
 
GLuint GetTexture ()
 Recomputes the territory texture if necessary, and returns the texture handle. More...
 
const float * GetTextureMatrix ()
 Returns a matrix to map (x,y,z) world coordinates onto (u,v) texture coordinates, in the form expected by glLoadMatrixf. More...
 
const CMatrix3DGetMinimapTextureMatrix ()
 Returns a matrix to map (0,0)-(1,1) texture coordinates onto texture coordinates, in the form expected by glLoadMatrixf. More...
 

Private Member Functions

 NONCOPYABLE (CTerritoryTexture)
 
bool UpdateDirty ()
 Returns true if the territory state has changed since the last call to this function. More...
 
void DeleteTexture ()
 
void ConstructTexture (int unit)
 
void RecomputeTexture (int unit)
 
void GenerateBitmap (const Grid< u8 > &territories, u8 *bitmap, ssize_t w, ssize_t h)
 

Private Attributes

CSimulation2m_Simulation
 
size_t m_DirtyID
 
GLuint m_Texture
 
ssize_t m_MapSize
 
GLsizei m_TextureSize
 
CMatrix3D m_TextureMatrix
 
CMatrix3D m_MinimapTextureMatrix
 

Detailed Description

Maintains the territory boundary texture, used for rendering and for the minimap.

Constructor & Destructor Documentation

CTerritoryTexture::CTerritoryTexture ( CSimulation2 simulation)
CTerritoryTexture::~CTerritoryTexture ( )

Member Function Documentation

void CTerritoryTexture::BindTexture ( int  unit)

Recomputes the territory texture if necessary, and binds it to the requested texture unit.

Also switches the current active texture unit, and enables texturing on it. The texture is in 32-bit BGRA format.

void CTerritoryTexture::ConstructTexture ( int  unit)
private
void CTerritoryTexture::DeleteTexture ( )
private
void CTerritoryTexture::GenerateBitmap ( const Grid< u8 > &  territories,
u8 bitmap,
ssize_t  w,
ssize_t  h 
)
private
const CMatrix3D * CTerritoryTexture::GetMinimapTextureMatrix ( )

Returns a matrix to map (0,0)-(1,1) texture coordinates onto texture coordinates, in the form expected by glLoadMatrixf.

This must only be called after BindTexture.

GLuint CTerritoryTexture::GetTexture ( )

Recomputes the territory texture if necessary, and returns the texture handle.

Also potentially switches the current active texture unit, and enables texturing on it. The texture is in 32-bit BGRA format.

const float * CTerritoryTexture::GetTextureMatrix ( )

Returns a matrix to map (x,y,z) world coordinates onto (u,v) texture coordinates, in the form expected by glLoadMatrixf.

This must only be called after BindTexture.

CTerritoryTexture::NONCOPYABLE ( CTerritoryTexture  )
private
void CTerritoryTexture::RecomputeTexture ( int  unit)
private
bool CTerritoryTexture::UpdateDirty ( )
private

Returns true if the territory state has changed since the last call to this function.

Member Data Documentation

size_t CTerritoryTexture::m_DirtyID
private
ssize_t CTerritoryTexture::m_MapSize
private
CMatrix3D CTerritoryTexture::m_MinimapTextureMatrix
private
CSimulation2& CTerritoryTexture::m_Simulation
private
GLuint CTerritoryTexture::m_Texture
private
CMatrix3D CTerritoryTexture::m_TextureMatrix
private
GLsizei CTerritoryTexture::m_TextureSize
private

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