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

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 float * GetMinimapTextureMatrix ()
 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 ()
 
void ConstructTexture (int unit)
 
void RecomputeTexture (int unit)
 
size_t GetBitmapSize (size_t w, size_t h)
 
void GenerateBitmap (ICmpRangeManager::CLosQuerier los, u8 *losData, size_t w, size_t h)
 

Private Attributes

CSimulation2m_Simulation
 
bool m_Dirty
 
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.

Definition at line 32 of file LOSTexture.h.

Constructor & Destructor Documentation

CLOSTexture::CLOSTexture ( CSimulation2 simulation)

Definition at line 53 of file LOSTexture.cpp.

CLOSTexture::~CLOSTexture ( )

Definition at line 73 of file LOSTexture.cpp.

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.

Definition at line 95 of file LOSTexture.cpp.

void CLOSTexture::ConstructTexture ( int  unit)
private

Definition at line 196 of file LOSTexture.cpp.

void CLOSTexture::DeleteTexture ( )
private

Definition at line 79 of file LOSTexture.cpp.

void CLOSTexture::GenerateBitmap ( ICmpRangeManager::CLosQuerier  los,
u8 losData,
size_t  w,
size_t  h 
)
private

Definition at line 317 of file LOSTexture.cpp.

size_t CLOSTexture::GetBitmapSize ( size_t  w,
size_t  h 
)
private

Definition at line 312 of file LOSTexture.cpp.

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

Definition at line 190 of file LOSTexture.cpp.

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.

Definition at line 173 of file LOSTexture.cpp.

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.

Definition at line 184 of file LOSTexture.cpp.

GLuint CLOSTexture::GetTextureSmooth ( )

Definition at line 106 of file LOSTexture.cpp.

void CLOSTexture::InterpolateLOS ( )

Definition at line 114 of file LOSTexture.cpp.

void CLOSTexture::MakeDirty ( )

Marks the LOS texture as needing recomputation.

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

Definition at line 90 of file LOSTexture.cpp.

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

Definition at line 270 of file LOSTexture.cpp.

Friends And Related Function Documentation

friend class TestLOSTexture
friend

Definition at line 35 of file LOSTexture.h.

Member Data Documentation

bool CLOSTexture::m_Dirty
private

Definition at line 89 of file LOSTexture.h.

ssize_t CLOSTexture::m_MapSize
private

Definition at line 99 of file LOSTexture.h.

CMatrix3D CLOSTexture::m_MinimapTextureMatrix
private

Definition at line 103 of file LOSTexture.h.

CSimulation2& CLOSTexture::m_Simulation
private

Definition at line 87 of file LOSTexture.h.

GLuint CLOSTexture::m_smoothFbo
private

Definition at line 96 of file LOSTexture.h.

CShaderTechniquePtr CLOSTexture::m_smoothShader
private

Definition at line 97 of file LOSTexture.h.

GLuint CLOSTexture::m_Texture
private

Definition at line 91 of file LOSTexture.h.

CMatrix3D CLOSTexture::m_TextureMatrix
private

Definition at line 102 of file LOSTexture.h.

GLsizei CLOSTexture::m_TextureSize
private

Definition at line 100 of file LOSTexture.h.

GLuint CLOSTexture::m_TextureSmooth1
private

Definition at line 92 of file LOSTexture.h.

GLuint CLOSTexture::m_TextureSmooth2
private

Definition at line 92 of file LOSTexture.h.

bool CLOSTexture::whichTex
private

Definition at line 94 of file LOSTexture.h.


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