#include <TerrainAlgorithm.h>
TerrainAlgorithm::TerrainAlgorithm |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
Initializes the attributes and allocates the memory for the terrain data.
- Parameters
-
[in] | width | Size of the terrain surface to generate in X-axis. |
[in] | height | Size of the terrain surface to generate in Y-axis. |
TerrainAlgorithm::~TerrainAlgorithm |
( |
| ) |
|
float * TerrainAlgorithm::Allocate |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
|
protected |
Allocates the memory needed to store the terrain height values, if possible. In case there is not enough memory available, std::bac_alloc is thrown.
- Parameters
-
[in] | width | Size of the array in X-axis. |
[in] | height | Size of the array in Y-axis. |
- Returns
- Pointer to the first byte of the allocated array if the allocation succeeded, NULL otherwise.
void TerrainAlgorithm::Flatten |
( |
float |
height | ) |
|
|
protected |
Sets the same height for all of the terrain points.
- Parameters
-
[in] | height | Height which is set to every point. |
float TerrainAlgorithm::GetHighestValue |
( |
| ) |
const |
Returns the value of the point with the highest value in the whole array.
- Returns
- The highest value from from the whole array.
float TerrainAlgorithm::GetLowestValue |
( |
| ) |
const |
Returns the value of the point with the lowest value in the whole array.
- Returns
- The lowest value from from the whole array.
float APNature::TerrainAlgorithm::GetPointHeight |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
inlineprotected |
Returns the height value of the point at the given coordinates.
- Parameters
-
[in] | x | Location of the point on the X-axis. |
[in] | y | Location of the point on the Y-axis. |
- Returns
- Height value of the point at the given coordinates
unsigned int APNature::TerrainAlgorithm::PointIndex |
( |
int |
x, |
|
|
int |
y |
|
) |
| const |
|
inline |
Returns the mapped index in the one-dimensional data array. [in] X-coordinate [in] Y-coordinate
- Returns
- Mapped index in the one-dimensional data array.
void TerrainAlgorithm::Release |
( |
| ) |
|
|
protected |
Releases all memory previously used by the object instance which was not deallocated yet.
void APNature::TerrainAlgorithm::SetPointHeight |
( |
int |
x, |
|
|
int |
y, |
|
|
float |
height |
|
) |
| |
|
inlineprotected |
Sets the height value of the point at the given coordinates.
- Parameters
-
[in] | x | Location of the point on the X-axis. |
[in] | y | Location of the point on the Y-axis. |
[in] | height | Height value of the point at the given coordinates |
void TerrainAlgorithm::Zero |
( |
| ) |
|
|
protected |
Fills all of the terrain values with zeroes.
int APNature::TerrainAlgorithm::_height |
|
protected |
float* APNature::TerrainAlgorithm::_terrain |
|
protected |
int APNature::TerrainAlgorithm::_width |
|
protected |
The documentation for this class was generated from the following files: