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

Maintains the LOS (fog-of-war / shroud-of-darkness) texture, used for rendering and for the minimap. More...

#include <LOSTexture.h>

Collaboration diagram for CLOSTexture:
Collaboration graph
[legend]

Public Member Functions

 CLOSTexture (CSimulation2 &simulation)
 
 ~CLOSTexture ()
 
void MakeDirty ()
 Marks the LOS texture as needing recomputation. More...
 
void BindTexture (int unit)
 Recomputes the LOS texture if necessary, and binds it to the requested texture unit. More...
 
GLuint GetTexture ()
 Recomputes the LOS texture if necessary, and returns the texture handle. More...
 
void InterpolateLOS ()
 
GLuint GetTextureSmooth ()
 
const CMatrix3DGetTextureMatrix ()
 Returns a matrix to map (x,y,z) world coordinates onto (u,v) LOS texture coordinates, in the form expected by glLoadMatrixf. More...
 
const CMatrix3DGetMinimapTextureMatrix ()
 Returns a matrix to map (0,0)-(1,1) texture coordinates onto LOS texture coordinates, in the form expected by glLoadMatrixf. More...
 

Private Member Functions

 NONCOPYABLE (CLOSTexture)
 
void DeleteTexture ()
 
bool CreateShader ()
 
void ConstructTexture (int unit)
 
void RecomputeTexture (int unit)
 
size_t GetBitmapSize (size_t w, size_t h, size_t *pitch)
 
void GenerateBitmap (ICmpRangeManager::CLosQuerier los, u8 *losData, size_t w, size_t h, size_t pitch)
 

Private Attributes

CSimulation2m_Simulation
 
bool m_Dirty
 
bool m_ShaderInitialized
 
GLuint m_Texture
 
GLuint m_TextureSmooth1
 
GLuint m_TextureSmooth2
 
bool whichTex
 
GLuint m_smoothFbo
 
CShaderTechniquePtr m_smoothShader
 
ssize_t m_MapSize
 
GLsizei m_TextureSize
 
CMatrix3D m_TextureMatrix
 
CMatrix3D m_MinimapTextureMatrix
 

Friends

class TestLOSTexture
 

Detailed Description

Maintains the LOS (fog-of-war / shroud-of-darkness) texture, used for rendering and for the minimap.

Constructor & Destructor Documentation

CLOSTexture::CLOSTexture ( CSimulation2 simulation)
CLOSTexture::~CLOSTexture ( )

Member Function Documentation

void CLOSTexture::BindTexture ( int  unit)

Recomputes the LOS 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 8-bit ALPHA format.

void CLOSTexture::ConstructTexture ( int  unit)
private
bool CLOSTexture::CreateShader ( )
private
void CLOSTexture::DeleteTexture ( )
private
void CLOSTexture::GenerateBitmap ( ICmpRangeManager::CLosQuerier  los,
u8 losData,
size_t  w,
size_t  h,
size_t  pitch 
)
private
size_t CLOSTexture::GetBitmapSize ( size_t  w,
size_t  h,
size_t *  pitch 
)
private
const CMatrix3D * CLOSTexture::GetMinimapTextureMatrix ( )

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

This must only be called after BindTexture.

GLuint CLOSTexture::GetTexture ( )

Recomputes the LOS 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 8-bit ALPHA format.

const CMatrix3D & CLOSTexture::GetTextureMatrix ( )

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

This must only be called after BindTexture.

GLuint CLOSTexture::GetTextureSmooth ( )
void CLOSTexture::InterpolateLOS ( )
void CLOSTexture::MakeDirty ( )

Marks the LOS texture as needing recomputation.

Call this after each simulation update, to ensure responsive updates.

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

Friends And Related Function Documentation

friend class TestLOSTexture
friend

Member Data Documentation

bool CLOSTexture::m_Dirty
private
ssize_t CLOSTexture::m_MapSize
private
CMatrix3D CLOSTexture::m_MinimapTextureMatrix
private
bool CLOSTexture::m_ShaderInitialized
private
CSimulation2& CLOSTexture::m_Simulation
private
GLuint CLOSTexture::m_smoothFbo
private
CShaderTechniquePtr CLOSTexture::m_smoothShader
private
GLuint CLOSTexture::m_Texture
private
CMatrix3D CLOSTexture::m_TextureMatrix
private
GLsizei CLOSTexture::m_TextureSize
private
GLuint CLOSTexture::m_TextureSmooth1
private
GLuint CLOSTexture::m_TextureSmooth2
private
bool CLOSTexture::whichTex
private

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