Pyrogenesis  trunk
Protected Member Functions | Private Member Functions | Private Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for TerrainOverlay:
Collaboration graph
[legend]

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 (ssize_t i, ssize_t j)=0
 Override to perform processing of each tile. More...
 
void RenderTile (const CColor &color, bool draw_hidden)
 Draw a filled quad on top of the current tile. More...
 
void RenderTile (const CColor &color, bool draw_hidden, ssize_t i, ssize_t j)
 Draw a filled quad on top of the given tile. More...
 
void RenderTileOutline (const CColor &color, int line_width, bool draw_hidden)
 Draw an outlined quad on top of the current tile. More...
 
void RenderTileOutline (const CColor &color, int line_width, bool draw_hidden, 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

virtual void RenderBeforeWater ()
 

Private Attributes

ssize_t m_i
 
ssize_t m_j
 
CTerrainm_Terrain
 

Additional Inherited Members

- Public Member Functions inherited from ITerrainOverlay
virtual ~ITerrainOverlay ()
 
virtual void RenderAfterWater (int cullGroup)
 
- Static Public Member Functions inherited from ITerrainOverlay
static void RenderOverlaysBeforeWater ()
 Draw all ITerrainOverlay objects that exist and that should be drawn before water. More...
 
static void RenderOverlaysAfterWater (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 ( 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

void TerrainOverlay::EndRender ( )
protectedvirtual

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

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
virtual void TerrainOverlay::ProcessTile ( 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
void TerrainOverlay::RenderBeforeWater ( )
privatevirtual

Reimplemented from ITerrainOverlay.

void TerrainOverlay::RenderTile ( const CColor color,
bool  draw_hidden 
)
protected

Draw a filled quad on top of the current tile.

Parameters
colorcolor to draw. May be transparent (alpha < 1)
draw_hiddentrue if hidden tiles (i.e. those behind other tiles) should be drawn
void TerrainOverlay::RenderTile ( const CColor color,
bool  draw_hidden,
ssize_t  i,
ssize_t  j 
)
protected

Draw a filled quad on top of the given tile.

void TerrainOverlay::RenderTileOutline ( const CColor color,
int  line_width,
bool  draw_hidden 
)
protected

Draw an outlined quad on top of the current tile.

Parameters
colorcolor to draw. May be transparent (alpha < 1)
line_widthwidth of lines in pixels. 1 is a sensible value
draw_hiddentrue if hidden tiles (i.e. those behind other tiles) should be drawn
void TerrainOverlay::RenderTileOutline ( const CColor color,
int  line_width,
bool  draw_hidden,
ssize_t  i,
ssize_t  j 
)
protected

Draw an outlined quad on top of the given tile.

void TerrainOverlay::StartRender ( )
protectedvirtual

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

Member Data Documentation

ssize_t TerrainOverlay::m_i
private
ssize_t TerrainOverlay::m_j
private
CTerrain* TerrainOverlay::m_Terrain
private

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