Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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:
ITerrainOverlay PathfinderOverlay TerritoryOverlay

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

Definition at line 76 of file TerrainOverlay.h.

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

Definition at line 110 of file TerrainOverlay.cpp.

Member Function Documentation

void TerrainOverlay::EndRender ( )
protectedvirtual

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

Reimplemented in PathfinderOverlay.

Definition at line 119 of file TerrainOverlay.cpp.

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

Definition at line 123 of file TerrainOverlay.cpp.

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

Implemented in PathfinderOverlay, and TerritoryOverlay.

void TerrainOverlay::RenderBeforeWater ( )
privatevirtual

Reimplemented from ITerrainOverlay.

Definition at line 132 of file TerrainOverlay.cpp.

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

Draw a filled quad on top of the current tile.

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

Definition at line 183 of file TerrainOverlay.cpp.

void TerrainOverlay::RenderTile ( const CColor colour,
bool  draw_hidden,
ssize_t  i,
ssize_t  j 
)
protected

Draw a filled quad on top of the given tile.

Definition at line 188 of file TerrainOverlay.cpp.

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

Draw an outlined quad on top of the current tile.

Parameters
colourcolour 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

Definition at line 239 of file TerrainOverlay.cpp.

void TerrainOverlay::RenderTileOutline ( const CColor colour,
int  line_width,
bool  draw_hidden,
ssize_t  i,
ssize_t  j 
)
protected

Draw an outlined quad on top of the given tile.

Definition at line 244 of file TerrainOverlay.cpp.

void TerrainOverlay::StartRender ( )
protectedvirtual

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

Reimplemented in PathfinderOverlay, and TerritoryOverlay.

Definition at line 115 of file TerrainOverlay.cpp.

Member Data Documentation

ssize_t TerrainOverlay::m_i
private

Definition at line 163 of file TerrainOverlay.h.

ssize_t TerrainOverlay::m_j
private

Definition at line 163 of file TerrainOverlay.h.

CTerrain* TerrainOverlay::m_Terrain
private

Definition at line 165 of file TerrainOverlay.h.


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