35#ifndef TCOD_HEIGHTMAP_H_
36#define TCOD_HEIGHTMAP_H_
62 return heightmap && heightmap->
values && heightmap->
w >= 0 && heightmap->
h >= 0;
79 return heightmap->
values[y * heightmap->
w + x];
93TCODLIB_API
float TCOD_heightmap_get_interpolated_value(
const TCOD_heightmap_t* hm,
float x,
float y);
94TCODLIB_API
float TCOD_heightmap_get_slope(
const TCOD_heightmap_t* hm,
int x,
int y);
95TCODLIB_API
void TCOD_heightmap_get_normal(
96 const TCOD_heightmap_t* __restrict hm,
float x,
float y,
float n[3],
float waterLevel);
97TCODLIB_API
int TCOD_heightmap_count_cells(
const TCOD_heightmap_t* hm,
float min,
float max);
98TCODLIB_API
bool TCOD_heightmap_has_land_on_border(
const TCOD_heightmap_t* hm,
float waterLevel);
107 const TCOD_heightmap_t* __restrict heightmap,
float* __restrict min_out,
float* __restrict max_out);
109TCODLIB_API
void TCOD_heightmap_copy(
113TCODLIB_API
void TCOD_heightmap_clamp(
TCOD_heightmap_t* hm,
float min,
float max);
114TCODLIB_API
void TCOD_heightmap_normalize(
TCOD_heightmap_t* hm,
float min,
float max);
116TCODLIB_API
void TCOD_heightmap_lerp_hm(
121TCODLIB_API
void TCOD_heightmap_add_hm(
123TCODLIB_API
void TCOD_heightmap_multiply_hm(
126TCODLIB_API
void TCOD_heightmap_add_hill(
TCOD_heightmap_t* hm,
float hx,
float hy,
float h_radius,
float h_height);
127TCODLIB_API
void TCOD_heightmap_dig_hill(
TCOD_heightmap_t* hm,
float hx,
float hy,
float h_radius,
float h_height);
128TCODLIB_API
void TCOD_heightmap_dig_bezier(
136TCODLIB_API
void TCOD_heightmap_rain_erosion(
140 float sedimentationCoef,
144TCODLIB_API
void TCOD_heightmap_kernel_transform(
147 const int* __restrict dx,
148 const int* __restrict dy,
149 const float* __restrict weight,
167 const TCOD_heightmap_t* __restrict hm, uint8_t* __restrict mask,
float minLevel,
float maxLevel);
197 const int* __restrict dx,
198 const int* __restrict dy,
199 const float* __restrict weight,
200 const uint8_t* __restrict mask);
201TCODLIB_API
void TCOD_heightmap_add_voronoi(
205 const float* __restrict coef,
207TCODLIB_API
void TCOD_heightmap_mid_point_displacement(
209TCODLIB_API
void TCOD_heightmap_add_fbm(
219TCODLIB_API
void TCOD_heightmap_scale_fbm(
229TCOD_DEPRECATED(
"This function does nothing and will be removed.")
static void TCOD_heightmap_set_value(TCOD_heightmap_t *heightmap, int x, int y, float value)
Set x,y on heightmap to value, out-of-bounds coordinates are silently ignored.
Definition heightmap.h:86
void TCOD_heightmap_kernel_transform_out(const TCOD_heightmap_t *hm_src, TCOD_heightmap_t *hm_dst, int kernel_size, const int *dx, const int *dy, const float *weight, const uint8_t *mask)
Apply a sparse kernel convolution from source to destination heightmap.
static bool TCOD_heightmap_is_valid(const TCOD_heightmap_t *heightmap)
Return true if heightmap is valid.
Definition heightmap.h:61
static float TCOD_heightmap_get_value(const TCOD_heightmap_t *heightmap, int x, int y)
Return the value at x,y from heightmap, or 0.0 for out-of-bounds coordinates.
Definition heightmap.h:77
void TCOD_heightmap_get_minmax(const TCOD_heightmap_t *heightmap, float *min_out, float *max_out)
Output the highest and lowest values in heightmap to min and max
static bool TCOD_heightmap_in_bounds(const TCOD_heightmap_t *heightmap, int x, int y)
Return true if x,y are valid and accessible coordinates for this heightmap
Definition heightmap.h:69
void TCOD_heightmap_threshold_mask(const TCOD_heightmap_t *hm, uint8_t *mask, float minLevel, float maxLevel)
Generate a mask from heightmap values within a threshold range.
Random number generator types.
Texture noise generator module.
Miscellaneous tools needed across platforms.
A contigious 2D array of float values.
Definition heightmap.h:50
float * values
Contigious 2D array of float values.
Definition heightmap.h:55
int w
Width of this heightmap.
Definition heightmap.h:51
int h
Height of this heightmap.
Definition heightmap.h:52
Pseudorandom number generator toolkit, all attributes are private.
Definition mersenne_types.h:87