Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
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... | |
Renderer::Backend::ITexture * | GetTexture () |
Recomputes the LOS texture if necessary, and returns the texture handle. More... | |
Renderer::Backend::ITexture * | GetTextureSmooth () |
void | InterpolateLOS (Renderer::Backend::IDeviceCommandContext *deviceCommandContext) |
const CMatrix3D & | GetTextureMatrix () |
Returns a matrix to map (x,y,z) world coordinates onto (u,v) LOS 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 LOS texture coordinates, in the form expected by a matrix uniform. More... | |
Private Member Functions | |
NONCOPYABLE (CLOSTexture) | |
void | DeleteTexture () |
bool | CreateShader () |
void | ConstructTexture (Renderer::Backend::IDeviceCommandContext *deviceCommandContext) |
void | RecomputeTexture (Renderer::Backend::IDeviceCommandContext *deviceCommandContext) |
size_t | GetBitmapSize (size_t w, size_t h, size_t *pitch) |
void | GenerateBitmap (const CLosQuerier &los, u8 *losData, size_t w, size_t h, size_t pitch) |
Private Attributes | |
CSimulation2 & | m_Simulation |
bool | m_Dirty = true |
bool | m_ShaderInitialized = false |
Renderer::Backend::Format | m_TextureFormat |
size_t | m_TextureFormatStride = 0 |
std::unique_ptr< Renderer::Backend::ITexture > | m_Texture |
std::unique_ptr< Renderer::Backend::ITexture > | m_SmoothTextures [2] |
Renderer::Backend::IVertexInputLayout * | m_VertexInputLayout = nullptr |
uint32_t | m_WhichTexture = 0 |
double | m_LastTextureRecomputeTime = 0.0 |
std::unique_ptr< Renderer::Backend::IFramebuffer > | m_SmoothFramebuffers [2] |
CShaderTechniquePtr | m_SmoothTech |
size_t | m_MapSize = 0 |
CMatrix3D | m_TextureMatrix |
CMatrix3D | m_MinimapTextureMatrix |
Friends | |
class | TestLOSTexture |
Maintains the LOS (fog-of-war / shroud-of-darkness) texture, used for rendering and for the minimap.
CLOSTexture::CLOSTexture | ( | CSimulation2 & | simulation | ) |
CLOSTexture::~CLOSTexture | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
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 a matrix uniform.
This must only be called after InterpolateLOS.
Renderer::Backend::ITexture * 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 a matrix uniform.
This must only be called after InterpolateLOS.
Renderer::Backend::ITexture * CLOSTexture::GetTextureSmooth | ( | ) |
void CLOSTexture::InterpolateLOS | ( | Renderer::Backend::IDeviceCommandContext * | deviceCommandContext | ) |
void CLOSTexture::MakeDirty | ( | ) |
Marks the LOS texture as needing recomputation.
Call this after each simulation update, to ensure responsive updates.
|
private |
|
private |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |