Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
TerrainOverlay Class Referenceabstract

Base class for (relatively) simple drawing of data onto terrain tiles, intended for debugging purposes and for the Atlas editor (hence not trying to be very efficient). More...

#include <TerrainOverlay.h>

Inheritance diagram for TerrainOverlay:
Collaboration diagram for TerrainOverlay:

Protected Member Functions

 TerrainOverlay (const CSimContext &simContext, int priority=100)
 Construct the object and register it with the global list of terrain overlays. More...
 
virtual void StartRender ()
 Override to perform processing at the start of the overlay rendering, before the ProcessTile calls. More...
 
virtual void EndRender ()
 Override to perform processing at the end of the overlay rendering, after the ProcessTile calls. More...
 
virtual void GetTileExtents (ssize_t &min_i_inclusive, ssize_t &min_j_inclusive, ssize_t &max_i_inclusive, ssize_t &max_j_inclusive)
 Override to limit the range over which ProcessTile will be called. More...
 
virtual void ProcessTile (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, ssize_t i, ssize_t j)=0
 Override to perform processing of each tile. More...
 
void RenderTile (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CColor &color, bool drawHidden)
 Draw a filled quad on top of the current tile. More...
 
void RenderTile (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CColor &color, bool drawHidden, ssize_t i, ssize_t j)
 Draw a filled quad on top of the given tile. More...
 
void RenderTileOutline (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CColor &color, bool drawHidden)
 Draw an outlined quad on top of the current tile. More...
 
void RenderTileOutline (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CColor &color, bool drawHidden, ssize_t i, ssize_t j)
 Draw an outlined quad on top of the given tile. More...
 
- Protected Member Functions inherited from ITerrainOverlay
 ITerrainOverlay (int priority)
 

Private Member Functions

void RenderBeforeWater (Renderer::Backend::IDeviceCommandContext *deviceCommandContext) override
 

Private Attributes

ssize_t m_i
 
ssize_t m_j
 
CTerrainm_Terrain
 
CShaderTechniquePtr m_OverlayTechTile
 
CShaderTechniquePtr m_OverlayTechTileHidden
 
CShaderTechniquePtr m_OverlayTechOutline
 
CShaderTechniquePtr m_OverlayTechOutlineHidden
 
Renderer::Backend::IVertexInputLayoutm_VertexInputLayout = nullptr
 

Additional Inherited Members

- Public Member Functions inherited from ITerrainOverlay
virtual ~ITerrainOverlay ()
 
virtual void RenderBeforeWater (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 
virtual void RenderAfterWater (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, int cullGroup)
 
- Static Public Member Functions inherited from ITerrainOverlay
static void RenderOverlaysBeforeWater (Renderer::Backend::IDeviceCommandContext *deviceCommandContext)
 Draw all ITerrainOverlay objects that exist and that should be drawn before water. More...
 
static void RenderOverlaysAfterWater (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, int cullGroup)
 Draw all ITerrainOverlay objects that exist and that should be drawn after water. More...
 

Detailed Description

Base class for (relatively) simple drawing of data onto terrain tiles, intended for debugging purposes and for the Atlas editor (hence not trying to be very efficient).

To start drawing a terrain overlay, first create a subclass of TerrainOverlay. Override the method GetTileExtents if you want to change the range over which it is drawn. Override ProcessTile to do your processing for each tile, which should call RenderTile and RenderTileOutline as appropriate.

Constructor & Destructor Documentation

◆ TerrainOverlay()

TerrainOverlay::TerrainOverlay ( const CSimContext simContext,
int  priority = 100 
)
protected

Construct the object and register it with the global list of terrain overlays.

The priority parameter controls the order in which overlays are drawn, if several exist - they are processed in order of increasing priority, so later ones draw on top of earlier ones. Most should use the default of 100. Numbers from 200 are used by Atlas.

Parameters
prioritycontrols the order of drawing

Member Function Documentation

◆ EndRender()

void TerrainOverlay::EndRender ( )
protectedvirtual

Override to perform processing at the end of the overlay rendering, after the ProcessTile calls.

◆ GetTileExtents()

void TerrainOverlay::GetTileExtents ( ssize_t min_i_inclusive,
ssize_t min_j_inclusive,
ssize_t max_i_inclusive,
ssize_t max_j_inclusive 
)
protectedvirtual

Override to limit the range over which ProcessTile will be called.

Defaults to the size of the map.

Parameters
min_i_inclusive[output] smallest i coordinate, in tile-space units (1 unit per tile, +i is world-space +x and game-space East)
min_j_inclusive[output] smallest j coordinate (+j is world-space +z and game-space North)
max_i_inclusive[output] largest i coordinate
max_j_inclusive[output] largest j coordinate

◆ ProcessTile()

virtual void TerrainOverlay::ProcessTile ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
ssize_t  i,
ssize_t  j 
)
protectedpure virtual

Override to perform processing of each tile.

Typically calls RenderTile and/or RenderTileOutline.

Parameters
ii coordinate of tile being processed
jj coordinate of tile being processed

◆ RenderBeforeWater()

void TerrainOverlay::RenderBeforeWater ( Renderer::Backend::IDeviceCommandContext deviceCommandContext)
overrideprivatevirtual

Reimplemented from ITerrainOverlay.

◆ RenderTile() [1/2]

void TerrainOverlay::RenderTile ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CColor color,
bool  drawHidden 
)
protected

Draw a filled quad on top of the current tile.

Parameters
colorcolor to draw. May be transparent (alpha < 1)
drawHiddentrue if hidden tiles (i.e. those behind other tiles) should be drawn

◆ RenderTile() [2/2]

void TerrainOverlay::RenderTile ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CColor color,
bool  drawHidden,
ssize_t  i,
ssize_t  j 
)
protected

Draw a filled quad on top of the given tile.

◆ RenderTileOutline() [1/2]

void TerrainOverlay::RenderTileOutline ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CColor color,
bool  drawHidden 
)
protected

Draw an outlined quad on top of the current tile.

Parameters
colorcolor to draw. May be transparent (alpha < 1)
lineWidthwidth of lines in pixels. 1 is a sensible value
drawHiddentrue if hidden tiles (i.e. those behind other tiles) should be drawn

◆ RenderTileOutline() [2/2]

void TerrainOverlay::RenderTileOutline ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CColor color,
bool  drawHidden,
ssize_t  i,
ssize_t  j 
)
protected

Draw an outlined quad on top of the given tile.

◆ StartRender()

void TerrainOverlay::StartRender ( )
protectedvirtual

Override to perform processing at the start of the overlay rendering, before the ProcessTile calls.

Member Data Documentation

◆ m_i

ssize_t TerrainOverlay::m_i
private

◆ m_j

ssize_t TerrainOverlay::m_j
private

◆ m_OverlayTechOutline

CShaderTechniquePtr TerrainOverlay::m_OverlayTechOutline
private

◆ m_OverlayTechOutlineHidden

CShaderTechniquePtr TerrainOverlay::m_OverlayTechOutlineHidden
private

◆ m_OverlayTechTile

CShaderTechniquePtr TerrainOverlay::m_OverlayTechTile
private

◆ m_OverlayTechTileHidden

CShaderTechniquePtr TerrainOverlay::m_OverlayTechTileHidden
private

◆ m_Terrain

CTerrain* TerrainOverlay::m_Terrain
private

◆ m_VertexInputLayout

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

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