OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
OutdoorTerrain Class Reference

#include <OutdoorTerrain.h>

Classes

struct  TileGeometry
 

Public Member Functions

 OutdoorTerrain ()
 
void createDebugTerrain ()
 
void changeSeason (int month)
 
int heightByGrid (Pointi gridPos) const
 
int heightByPos (const Vec3f &pos) const
 
Vec3i vertexByGridUnsafe (Pointi gridPos) const
 
int tileIdByGrid (Pointi gridPos) const
 
const TileDatatileDataByGrid (Pointi gridPos) const
 
Tileset tilesetByGrid (Pointi gridPos) const
 
Tileset tilesetByPos (const Vec3f &pos) const
 
bool isWaterByGrid (Pointi gridPos) const
 
bool isWaterByPos (const Vec3f &pos) const
 
bool isWaterOrShoreByGrid (Pointi gridPos) const
 
Vec3f normalByPos (const Vec3f &pos) const
 
const std::array< Vec3f, 2 > & normalsByGridUnsafe (Pointi gridPos) const
 
bool isSlopeTooHighByPos (const Vec3f &pos) const
 

Private Member Functions

void recalculateNormals ()
 
TileGeometry tileGeometryByGrid (Pointi gridPos) const
 

Private Attributes

std::array< Tileset, 4 > _tilesets
 
Image< uint8_t > _heightMap
 
Image< int16_t > _tileMap
 
Image< int16_t > _originalTileMap
 
Image< std::array< Vec3f, 2 > > _normalMap
 

Friends

void reconstruct (const OutdoorLocation_MM7 &src, OutdoorTerrain *dst)
 

Detailed Description

Terrain for outdoor location.

Contains geometry & tile data, and provides some convenience methods for accessing it.

All methods do bounds checking, so this class effectively presents a view into a location that's infinite in size. Methods ending with -Unsafe don't do bounds checking.

Constructor & Destructor Documentation

◆ OutdoorTerrain()

OutdoorTerrain::OutdoorTerrain ( )

Member Function Documentation

◆ changeSeason()

void OutdoorTerrain::changeSeason ( int  month)

◆ createDebugTerrain()

void OutdoorTerrain::createDebugTerrain ( )

◆ heightByGrid()

int OutdoorTerrain::heightByGrid ( Pointi  gridPos) const
Parameters
gridPosGrid coordinates.
Returns
Terrain height at gridPos.
Original binary offset:
0x00488F2E, 0x0047EE16

◆ heightByPos()

int OutdoorTerrain::heightByPos ( const Vec3f pos) const
Parameters
posWorld coordinates, only xy component is used by this function.
Returns
Terrain height at given position.
Original binary offset:
0x0048257A

◆ isSlopeTooHighByPos()

bool OutdoorTerrain::isSlopeTooHighByPos ( const Vec3f pos) const
Parameters
posWorld coordinates, only xy component is used by this function.
Returns
Whether terrain slope at given position is too high to be climbed or stood on.
Original binary offset:
0x004823F4

◆ isWaterByGrid()

bool OutdoorTerrain::isWaterByGrid ( Pointi  gridPos) const
Parameters
gridPosGrid coordinates.
Returns
Whether the tile at gridPos is a water tile. Note that shore tiles are different from water tiles.

◆ isWaterByPos()

bool OutdoorTerrain::isWaterByPos ( const Vec3f pos) const

◆ isWaterOrShoreByGrid()

bool OutdoorTerrain::isWaterOrShoreByGrid ( Pointi  gridPos) const

◆ normalByPos()

Vec3f OutdoorTerrain::normalByPos ( const Vec3f pos) const
Parameters
posWorld coordinates, only xy component is used by this function.
Returns
Terrain normal at given position. Terrain normals always point up (z > 0).
Original binary offset:
0x0046DCC8

◆ normalsByGridUnsafe()

const std::array< Vec3f, 2 > & OutdoorTerrain::normalsByGridUnsafe ( Pointi  gridPos) const
inline

◆ recalculateNormals()

void OutdoorTerrain::recalculateNormals ( )
private

◆ tileDataByGrid()

const TileData & OutdoorTerrain::tileDataByGrid ( Pointi  gridPos) const
Parameters
gridPosGrid coordinates.
Returns
Tile data from the global tile table for the tile at gridPos.
Original binary offset:
0x47ED08

◆ tileGeometryByGrid()

OutdoorTerrain::TileGeometry OutdoorTerrain::tileGeometryByGrid ( Pointi  gridPos) const
private

◆ tileIdByGrid()

int OutdoorTerrain::tileIdByGrid ( Pointi  gridPos) const
Parameters
gridPosGrid coordinates.
Returns
Tile id at gridPos that can then be used to get tile data from TileTable.

◆ tilesetByGrid()

Tileset OutdoorTerrain::tilesetByGrid ( Pointi  gridPos) const
Parameters
gridPosGrid coordinates.
Returns
Tile set for the tile at gridPos, or Tileset_NULL if the tile is invalid.

◆ tilesetByPos()

Tileset OutdoorTerrain::tilesetByPos ( const Vec3f pos) const

◆ vertexByGridUnsafe()

Vec3i OutdoorTerrain::vertexByGridUnsafe ( Pointi  gridPos) const
inline

Friends And Related Function Documentation

◆ reconstruct

void reconstruct ( const OutdoorLocation_MM7 src,
OutdoorTerrain dst 
)
friend

Member Data Documentation

◆ _heightMap

Image<uint8_t> OutdoorTerrain::_heightMap
private

◆ _normalMap

Image<std::array<Vec3f, 2> > OutdoorTerrain::_normalMap
private

◆ _originalTileMap

Image<int16_t> OutdoorTerrain::_originalTileMap
private

◆ _tileMap

Image<int16_t> OutdoorTerrain::_tileMap
private

◆ _tilesets

std::array<Tileset, 4> OutdoorTerrain::_tilesets
private

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