Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CTerritoryTexture Class Reference

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

#include <TerritoryTexture.h>

Collaboration diagram for CTerritoryTexture:

Public Member Functions

 CTerritoryTexture (CSimulation2 &simulation)
 
 ~CTerritoryTexture ()
 
Renderer::Backend::ITextureGetTexture ()
 Recomputes the territory texture if necessary, and returns the texture handle. More...
 
const CMatrix3DGetTextureMatrix ()
 Returns a matrix to map (x,y,z) world coordinates onto (u,v) texture coordinates, in the form expected by a matrix uniform. More...
 
const CMatrix3DGetMinimapTextureMatrix ()
 Returns a matrix to map (0,0)-(1,1) texture coordinates onto texture coordinates, in the form expected by a matrix uniform. More...
 
void UpdateIfNeeded (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Updates the texture if needed (territory was changed or the texture wasn't created). 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 (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 
void RecomputeTexture (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 
void GenerateBitmap (const Grid< u8 > &territories, u8 *bitmap, ssize_t w, ssize_t h)
 

Private Attributes

CSimulation2m_Simulation
 
size_t m_DirtyID
 
std::unique_ptr< Renderer::Backend::ITexturem_Texture
 
ssize_t m_MapSize
 
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::CTerritoryTexture ( CSimulation2 simulation)

◆ ~CTerritoryTexture()

CTerritoryTexture::~CTerritoryTexture ( )

Member Function Documentation

◆ ConstructTexture()

void CTerritoryTexture::ConstructTexture ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)
private

◆ DeleteTexture()

void CTerritoryTexture::DeleteTexture ( )
private

◆ GenerateBitmap()

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

◆ GetMinimapTextureMatrix()

const CMatrix3D & CTerritoryTexture::GetMinimapTextureMatrix ( )

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

This must only be called after UpdateIfNeeded.

◆ GetTexture()

Renderer::Backend::ITexture * 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.

◆ GetTextureMatrix()

const CMatrix3D & CTerritoryTexture::GetTextureMatrix ( )

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

This must only be called after UpdateIfNeeded.

◆ NONCOPYABLE()

CTerritoryTexture::NONCOPYABLE ( CTerritoryTexture  )
private

◆ RecomputeTexture()

void CTerritoryTexture::RecomputeTexture ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)
private

◆ UpdateDirty()

bool CTerritoryTexture::UpdateDirty ( )
private

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

◆ UpdateIfNeeded()

void CTerritoryTexture::UpdateIfNeeded ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)

Updates the texture if needed (territory was changed or the texture wasn't created).

Member Data Documentation

◆ m_DirtyID

size_t CTerritoryTexture::m_DirtyID
private

◆ m_MapSize

ssize_t CTerritoryTexture::m_MapSize
private

◆ m_MinimapTextureMatrix

CMatrix3D CTerritoryTexture::m_MinimapTextureMatrix
private

◆ m_Simulation

CSimulation2& CTerritoryTexture::m_Simulation
private

◆ m_Texture

std::unique_ptr<Renderer::Backend::ITexture> CTerritoryTexture::m_Texture
private

◆ m_TextureMatrix

CMatrix3D CTerritoryTexture::m_TextureMatrix
private

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