Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>

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 float * GetMinimapTextureMatrix ()
 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.

Definition at line 29 of file TerritoryTexture.h.

Constructor & Destructor Documentation

CTerritoryTexture::CTerritoryTexture ( CSimulation2 simulation)

Definition at line 35 of file TerritoryTexture.cpp.

CTerritoryTexture::~CTerritoryTexture ( )

Definition at line 40 of file TerritoryTexture.cpp.

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.

Definition at line 61 of file TerritoryTexture.cpp.

void CTerritoryTexture::ConstructTexture ( int  unit)
private

Definition at line 89 of file TerritoryTexture.cpp.

void CTerritoryTexture::DeleteTexture ( )
private

Definition at line 46 of file TerritoryTexture.cpp.

void CTerritoryTexture::GenerateBitmap ( const Grid< u8 > &  territories,
u8 bitmap,
ssize_t  w,
ssize_t  h 
)
private

Definition at line 172 of file TerritoryTexture.cpp.

const float * 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.

Definition at line 83 of file TerritoryTexture.cpp.

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.

Definition at line 69 of file TerritoryTexture.cpp.

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.

Definition at line 77 of file TerritoryTexture.cpp.

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

Definition at line 142 of file TerritoryTexture.cpp.

bool CTerritoryTexture::UpdateDirty ( )
private

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

Definition at line 52 of file TerritoryTexture.cpp.

Member Data Documentation

size_t CTerritoryTexture::m_DirtyID
private

Definition at line 80 of file TerritoryTexture.h.

ssize_t CTerritoryTexture::m_MapSize
private

Definition at line 84 of file TerritoryTexture.h.

CMatrix3D CTerritoryTexture::m_MinimapTextureMatrix
private

Definition at line 88 of file TerritoryTexture.h.

CSimulation2& CTerritoryTexture::m_Simulation
private

Definition at line 78 of file TerritoryTexture.h.

GLuint CTerritoryTexture::m_Texture
private

Definition at line 82 of file TerritoryTexture.h.

CMatrix3D CTerritoryTexture::m_TextureMatrix
private

Definition at line 87 of file TerritoryTexture.h.

GLsizei CTerritoryTexture::m_TextureSize
private

Definition at line 85 of file TerritoryTexture.h.


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