Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

renderer
Class TerrainOverlay

   in TerrainOverlay.h
   in TerrainOverlay.cpp

class TerrainOverlay

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. See the end of TerrainOverlay.h for an example.

A TerrainOverlay object will be rendered for as long as it exists.


Field Summary
private int m_i
          
private int m_j
          
private CTerrain* m_Terrain
          
 
Constructor Summary
private  TerrainOverlay( const TerrainOverlay& )
          
protected  TerrainOverlay( int priority = 100 )
          Construct the object and register it with the global list of terrain overlays.
  virtual ~TerrainOverlay()
          
 
Method Summary
protected virtual void GetTileExtents( int& min_i_inclusive, int& min_j_inclusive, int& max_i_inclusive, int& max_j_inclusive )
          Override to limit the range over which ProcessTile will be called.
protected virtual void ProcessTile( int i, int j )= 0
          Override to perform processing of each tile.
private void Render()
          
 static void RenderOverlays()
          Copying not allowed.
protected void RenderTile( const CColor& colour, bool draw_hidden )
          Draw a filled quad on top of the current tile.
protected void RenderTileOutline( const CColor& colour, int line_width, bool draw_hidden )
          Draw all TerrainOverlay objects that exist.
 

Field Detail

m_i

private int m_i;

m_j

private int m_j;

m_Terrain

private CTerrain* m_Terrain;


Constructor Detail

TerrainOverlay

private TerrainOverlay( const TerrainOverlay& );

TerrainOverlay

protected TerrainOverlay( int priority = 100 );
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:
priority - controls the order of drawing

~TerrainOverlay

public virtual ~TerrainOverlay();


Method Detail

GetTileExtents

protected virtual void GetTileExtents( int& min_i_inclusive, int& min_j_inclusive, int& max_i_inclusive, int& max_j_inclusive );
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

protected virtual void ProcessTile( int i, int j )= 0;
Override to perform processing of each tile. Typically calls RenderTile and/or RenderTileOutline.
Parameters:
i - i coordinate of tile being processed
j - j coordinate of tile being processed

Render

private void Render();

RenderOverlays

public static void RenderOverlays();
Copying not allowed.

RenderTile

protected void RenderTile( const CColor& colour, bool draw_hidden );
Draw a filled quad on top of the current tile.
Parameters:
colour - colour to draw. May be transparent (alpha < 1)
draw_hidden - true if hidden tiles (i.e. those behind other tiles) should be drawn

RenderTileOutline

protected void RenderTileOutline( const CColor& colour, int line_width, bool draw_hidden );
Draw all TerrainOverlay objects that exist.

 Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
Generated on September 04, 2007 at 18:14
CppDoc v2.4.0
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD