#include <ctilesurface.h>
Public Types | |
enum | eTextureType { eColor, eHeight, eTextureTypeMax } |
Public Member Functions | |
CTileSurface (const CPlanet *planet, const CGridPosition &pos, CTileSurface **parents) | |
virtual | ~CTileSurface () |
Destructor. | |
CTexture * | getTexture (eTextureType type) |
Returns the texture of a certain type. | |
const CGridPosition & | getPosition () const |
Returns the grid position of the tile of this surface, as given to the constructor. | |
CVector | getTexCoords (CGridPosition pos) const |
Returns the texture coordinates at a grid position inside this tile. | |
double | getAltAndSlope (const CGridPosition &pos, double &dzdx, double &dzdy) const |
virtual CTileSurface * | createChildSurface (const CGridPosition &pos, CTileSurface **parents) const |
virtual bool | load ()=0 |
virtual std::string | getClassName () const =0 |
virtual const CMapBase * | getInternalMap (const std::string &name) const |
const CMapBase * | getInternalMap (eTextureType type) const |
Protected Member Functions | |
void | updateTextures () |
double | getTileSize () const |
Returns the physical size of the tile (in meters). | |
const CPlanet * | getPlanet () const |
Returns a pointer to the planet object. | |
const CTileSurface *const * | getParents () const |
Returns an array of four pointers to the parent surfaces. | |
void | checkHeightmapValues () const |
Debugging function, to check whether the values in m_HeightMap make sense. | |
Protected Attributes | |
CMap< int > | m_HeightMap |
The height map data. The height is a signed integer, given in millimeters. | |
CMap< SColor > | m_ColorMap |
The color map data. |
Identifiers for some common map and texture types. eTextureTypeMax is not an identifier, but instead is used in code that needs to iterate through all possible types.
libProcTer::CTileSurface::CTileSurface | ( | const CPlanet * | planet, | |
const CGridPosition & | pos, | |||
CTileSurface ** | parents | |||
) |
Constructor.
planet | The planet object for which this tile is created | |
pos | The grid position of the tile of this surface. This is the position of the lower left corner of the tile. | |
parents | The four parent surfaces of this surface |
virtual libProcTer::CTileSurface::~CTileSurface | ( | ) | [virtual] |
Destructor.
void libProcTer::CTileSurface::checkHeightmapValues | ( | ) | const [protected] |
Debugging function, to check whether the values in m_HeightMap make sense.
virtual CTileSurface* libProcTer::CTileSurface::createChildSurface | ( | const CGridPosition & | pos, | |
CTileSurface ** | parents | |||
) | const [virtual] |
libProcTer calls this function to create new child surface of this tile surface.
The default implementation calls CPlanet::createSurface.
pos | The grid position of the surface tile. This is the position of the lower left corner of the tile. This can usually be passed directly to the CTileSurface constructor. | |
parents | The four parent surfaces of this surface. This can usually be passed directly to the CTileSurface constructor. |
double libProcTer::CTileSurface::getAltAndSlope | ( | const CGridPosition & | pos, | |
double & | dzdx, | |||
double & | dzdy | |||
) | const |
Returns the altitude and the slope of the surface at a grid position inside this tile.
pos | The grid position | |
dzdx | The partial derivative of altitude with x-position (longitudinal direction) is placed in this parameter | |
dzdy | The partial derivative of altitude with y-position (latitudinal direction) is placed in this parameter |
virtual std::string libProcTer::CTileSurface::getClassName | ( | ) | const [pure virtual] |
Returns the name of the class. The main purpose is for child surfaces to be able to determine the type of parent surfaces.
Please try to use unique names to avoid confusion with other classes.
const CMapBase* libProcTer::CTileSurface::getInternalMap | ( | eTextureType | type | ) | const |
Returns internal map data based on a map identifier. Used primarily for passing standard map data (like color or height) from parent to child, for which there is an identifier in eTextureType.
virtual const CMapBase* libProcTer::CTileSurface::getInternalMap | ( | const std::string & | name | ) | const [virtual] |
Returns internal map data based on a map name. Used primarily for passing custom map data from parent to child, for which there is no identifier in eTextureType.
Please try to use an unique name for each map type, and remain consistent in the type that is used for a certain map type, to avoid bugs.
const CTileSurface* const* libProcTer::CTileSurface::getParents | ( | ) | const [inline, protected] |
Returns an array of four pointers to the parent surfaces.
const CPlanet* libProcTer::CTileSurface::getPlanet | ( | ) | const [inline, protected] |
Returns a pointer to the planet object.
const CGridPosition& libProcTer::CTileSurface::getPosition | ( | ) | const [inline] |
Returns the grid position of the tile of this surface, as given to the constructor.
CVector libProcTer::CTileSurface::getTexCoords | ( | CGridPosition | pos | ) | const |
Returns the texture coordinates at a grid position inside this tile.
CTexture* libProcTer::CTileSurface::getTexture | ( | eTextureType | type | ) |
Returns the texture of a certain type.
double libProcTer::CTileSurface::getTileSize | ( | ) | const [inline, protected] |
Returns the physical size of the tile (in meters).
virtual bool libProcTer::CTileSurface::load | ( | ) | [pure virtual] |
The terrain loading function. To be overloaded by derived classes. The overloaded function should do the following:
void libProcTer::CTileSurface::updateTextures | ( | ) | [protected] |
CMap<SColor> libProcTer::CTileSurface::m_ColorMap [protected] |
The color map data.
CMap<int> libProcTer::CTileSurface::m_HeightMap [protected] |
The height map data. The height is a signed integer, given in millimeters.