Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
Maintains the territory boundary texture, used for rendering and for the minimap. More...
#include <TerritoryTexture.h>
Public Member Functions | |
CTerritoryTexture (CSimulation2 &simulation) | |
~CTerritoryTexture () | |
Renderer::Backend::ITexture * | GetTexture () |
Recomputes the territory texture if necessary, and returns the texture handle. More... | |
const CMatrix3D & | GetTextureMatrix () |
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 CMatrix3D & | GetMinimapTextureMatrix () |
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 | |
CSimulation2 & | m_Simulation |
size_t | m_DirtyID |
std::unique_ptr< Renderer::Backend::ITexture > | m_Texture |
ssize_t | m_MapSize |
CMatrix3D | m_TextureMatrix |
CMatrix3D | m_MinimapTextureMatrix |
Maintains the territory boundary texture, used for rendering and for the minimap.
CTerritoryTexture::CTerritoryTexture | ( | CSimulation2 & | simulation | ) |
CTerritoryTexture::~CTerritoryTexture | ( | ) |
|
private |
|
private |
|
private |
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.
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.
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.
|
private |
|
private |
|
private |
Returns true if the territory state has changed since the last call to this function.
void CTerritoryTexture::UpdateIfNeeded | ( | Renderer::Backend::IDeviceCommandContext * | deviceCommandContext | ) |
Updates the texture if needed (territory was changed or the texture wasn't created).
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |