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...
 
Renderer::Backend::ITextureGetTexture ()
 Recomputes the LOS texture if necessary, and returns the texture handle. More...
 
Renderer::Backend::ITextureGetTextureSmooth ()
 
void InterpolateLOS (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 
const CMatrix3DGetTextureMatrix ()
 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 CMatrix3DGetMinimapTextureMatrix ()
 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

CSimulation2m_Simulation
 
bool m_Dirty = true
 
bool m_ShaderInitialized = false
 
Renderer::Backend::Format m_TextureFormat
 
size_t m_TextureFormatStride = 0
 
std::unique_ptr< Renderer::Backend::ITexturem_Texture
 
std::unique_ptr< Renderer::Backend::ITexturem_SmoothTextures [2]
 
Renderer::Backend::IVertexInputLayoutm_VertexInputLayout = nullptr
 
uint32_t m_WhichTexture = 0
 
double m_LastTextureRecomputeTime = 0.0
 
std::unique_ptr< Renderer::Backend::IFramebufferm_SmoothFramebuffers [2]
 
CShaderTechniquePtr m_SmoothTech
 
size_t m_MapSize = 0
 
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::CLOSTexture ( CSimulation2 simulation)

◆ ~CLOSTexture()

CLOSTexture::~CLOSTexture ( )

Member Function Documentation

◆ ConstructTexture()

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

◆ CreateShader()

bool CLOSTexture::CreateShader ( )
private

◆ DeleteTexture()

void CLOSTexture::DeleteTexture ( )
private

◆ GenerateBitmap()

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

◆ GetBitmapSize()

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

◆ GetMinimapTextureMatrix()

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.

◆ GetTexture()

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.

◆ GetTextureMatrix()

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.

◆ GetTextureSmooth()

Renderer::Backend::ITexture * CLOSTexture::GetTextureSmooth ( )

◆ InterpolateLOS()

void CLOSTexture::InterpolateLOS ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)

◆ MakeDirty()

void CLOSTexture::MakeDirty ( )

Marks the LOS texture as needing recomputation.

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

◆ NONCOPYABLE()

CLOSTexture::NONCOPYABLE ( CLOSTexture  )
private

◆ RecomputeTexture()

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

Friends And Related Function Documentation

◆ TestLOSTexture

friend class TestLOSTexture
friend

Member Data Documentation

◆ m_Dirty

bool CLOSTexture::m_Dirty = true
private

◆ m_LastTextureRecomputeTime

double CLOSTexture::m_LastTextureRecomputeTime = 0.0
private

◆ m_MapSize

size_t CLOSTexture::m_MapSize = 0
private

◆ m_MinimapTextureMatrix

CMatrix3D CLOSTexture::m_MinimapTextureMatrix
private

◆ m_ShaderInitialized

bool CLOSTexture::m_ShaderInitialized = false
private

◆ m_Simulation

CSimulation2& CLOSTexture::m_Simulation
private

◆ m_SmoothFramebuffers

std::unique_ptr<Renderer::Backend::IFramebuffer> CLOSTexture::m_SmoothFramebuffers[2]
private

◆ m_SmoothTech

CShaderTechniquePtr CLOSTexture::m_SmoothTech
private

◆ m_SmoothTextures

std::unique_ptr<Renderer::Backend::ITexture> CLOSTexture::m_SmoothTextures[2]
private

◆ m_Texture

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

◆ m_TextureFormat

Renderer::Backend::Format CLOSTexture::m_TextureFormat
private

◆ m_TextureFormatStride

size_t CLOSTexture::m_TextureFormatStride = 0
private

◆ m_TextureMatrix

CMatrix3D CLOSTexture::m_TextureMatrix
private

◆ m_VertexInputLayout

Renderer::Backend::IVertexInputLayout* CLOSTexture::m_VertexInputLayout = nullptr
private

◆ m_WhichTexture

uint32_t CLOSTexture::m_WhichTexture = 0
private

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