33static std::map<std::string, int> normal_map_blending_method_as_string = {
36 {
"Unreal Developer Network",
NMAP_UDN},
48static std::map<std::string, int> transform_mode_as_string = {
58 bool use_sqrt_avg =
true);
60 bool use_sqrt_avg =
true);
326 void remap(
float vmin = 0.f,
float vmax = 1.f);
328 void remap(
float vmin,
398 std::vector<Heightmap>
rgb;
437 bool reverse =
false);
451 std::vector<std::vector<float>> colormap_colors,
452 bool reverse =
false);
470 void to_png(
const std::string &fname,
int depth = CV_8U);
571 void to_png(
const std::string &fname,
int depth = CV_8U);
589 bool reverse =
false,
606 std::vector<std::vector<float>> colormap_colors,
608 bool reverse =
false,
646 std::vector<HeightmapRGBA *> rgba_plist,
693 HeightmapRGBA &nmap_detail,
694 float detail_scaling = 1.f,
753[[deprecated]]
void fill(
762 std::function<
void(
Array &)> unary_op);
786 std::function<
void(
Array &,
Array *)> unary_op);
814 std::function<
void(
Array &,
Array &)> binary_op);
872void transform(std::vector<Heightmap *> p_hmaps,
873 std::function<
void(
const std::vector<Array *>,
878void transform(std::vector<Heightmap *> p_hmaps,
879 std::function<
void(
const std::vector<Array *>)> op,
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
Array class, helper to manipulate 2D float array with "(i, j)" indexing.
Definition array.hpp:32
Vec2< int > shape
The shape of the array {ni, nj}.
Definition array.hpp:38
HeightMap class, to manipulate heightmap (with contextual informations).
Definition heightmap.hpp:150
Vec2< int > tiling
Tiling setup (number of tiles in each direction).
Definition heightmap.hpp:160
Array to_array()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition heightmap_base.cpp:365
std::vector< uint8_t > to_grayscale_image_8bit()
Definition heightmap_base.cpp:406
void set_sto(Vec2< int > new_shape, Vec2< int > new_tiling, float new_overlap)
Set the shape / tiling / overlap in one pass.
Definition heightmap_base.cpp:84
std::vector< Tile > tiles
Tile storage.
Definition heightmap.hpp:170
float max()
Return the value of the greatest element in the heightmap data.
Definition heightmap_base.cpp:240
float mean()
Return the mean of the heightmap data.
Definition heightmap_base.cpp:310
float get_value_bilinear(float x, float y) const
Definition heightmap_base.cpp:148
size_t get_ntiles() const
Get the number of tiles.
Definition heightmap_base.cpp:62
void set_shape(Vec2< int > new_shape)
Set the heightmap shape.
Definition heightmap_base.cpp:78
float sum()
Return the sum of the heightmap data.
Definition heightmap_base.cpp:347
void update_tile_parameters()
Update tile parameters.
Definition heightmap_base.cpp:527
float overlap
Tile overlapping, in [0, 1[.
Definition heightmap.hpp:165
void set_overlap(float new_overlap)
Set the tile overlapping.
Definition heightmap_base.cpp:72
void inverse()
Inverse the heightmap values (max - values).
Definition heightmap_base.cpp:223
Vec2< int > shape
Heightmap global shape.
Definition heightmap.hpp:155
void from_array_interp(Array &array)
Fill tile values by interpolating (bilinear) values from another array.
Definition heightmap_base.cpp:104
int get_tile_index(int i, int j) const
Get the tile linear index.
Definition heightmap_base.cpp:67
void infos()
Print some informations about the object.
Definition heightmap_base.cpp:208
Heightmap()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition heightmap_base.cpp:57
std::vector< float > unique_values()
Returns the unique elements of the heightmap.
Definition heightmap_base.cpp:574
void from_array_interp_bicubic(Array &array)
Fill tile values by interpolating (bicubic) values from another array.
Definition heightmap_base.cpp:109
std::vector< uint16_t > to_grayscale_image_16bit()
Converts the heightmap to a 16-bit grayscale representation.
Definition heightmap_base.cpp:443
void from_array_interp_bilinear(Array &array)
Fill tile values by interpolating (bilinear) values from another array.
Definition heightmap_base.cpp:122
float get_value_nearest(float x, float y) const
Definition heightmap_base.cpp:186
void smooth_overlap_buffers()
Smooth the transitions between each tiles (when overlap > 0).
Definition heightmap_base.cpp:254
void set_tiling(Vec2< int > new_tiling)
Set the tiling setup.
Definition heightmap_base.cpp:98
void remap(float vmin=0.f, float vmax=1.f)
Remap heightmap elements from a starting range to a target range.
Definition heightmap_base.cpp:316
std::vector< uint16_t > to_grayscale_image_16bit_multithread()
Definition heightmap_base.cpp:480
float min()
Return the value of the smallest element in the heightmap data.
Definition heightmap_base.cpp:296
void from_array_interp_nearest(Array &array)
Fill tile values by interpolating (nearest neighbor) values from another array.
Definition heightmap_base.cpp:135
Tile class, to manipulate a restricted region of an heightmap (with contextual informations).
Definition heightmap.hpp:69
Tile()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition tile_base.cpp:13
Vec2< float > shift
Tile shift in each direction, assuming the global domain is a unit square. For example,...
Definition heightmap.hpp:76
void from_array_interp_bicubic(Array &array)
Fill tile values by interpolating (bicubic) values from another array.
Definition tile_base.cpp:34
void infos() const
Print some informations about the object.
Definition tile_base.cpp:67
void from_array_interp(Array &array)
Fill tile values by interpolating (bilinear) values from another array.
Definition tile_base.cpp:29
Vec4< float > bbox
Tile bounding box {xmin, xmax, ymin, ymax}.
Definition heightmap.hpp:88
Vec2< float > scale
Scale of the tile in each direction, assuming the global domain is a unit square. For example,...
Definition heightmap.hpp:83
void from_array_interp_nearest(Array &array)
Fill tile values by interpolating (nearest) values from another array.
Definition tile_base.cpp:56
void operator=(const Array &array)
Assignment overloading (array).
Definition tile_base.cpp:24
void from_array_interp_bilinear(Array &array)
Fill tile values by interpolating (bilinear) values from another array.
Definition tile_base.cpp:45
Header file for asset export functionalities.
Definition algebra.hpp:28
HeightmapRGBA mix_heightmap_rgba(HeightmapRGBA &rgba1, HeightmapRGBA &rgba2, bool use_sqrt_avg=true)
Definition heightmap_rgba.cpp:205
void fill(Heightmap &h, Heightmap *p_noise_x, Heightmap *p_noise_y, std::function< Array(Vec2< int >, Vec4< float >, Array *p_noise_x, Array *p_noise_y)> nullary_op)
Fills the heightmap using the provided noise maps and operation.
HeightmapRGBA mix_normal_map_rgba(HeightmapRGBA &nmap_base, HeightmapRGBA &nmap_detail, float detail_scaling=1.f, NormalMapBlendingMethod blending_method=NormalMapBlendingMethod::NMAP_DERIVATIVE)
Mixes two normal maps in RGBA format to create a blended normal map.
Definition heightmap_rgba.cpp:302
void transform(Heightmap &h, std::function< void(Array &)> unary_op)
Definition heightmap_transform.cpp:177
TransformMode
Definition heightmap.hpp:42
@ SEQUENTIAL
Performed sequentially in a single thread.
Definition heightmap.hpp:44
@ DISTRIBUTED
Distributed across multiple processors or threads.
Definition heightmap.hpp:43
@ SINGLE_ARRAY
Transformation is applied to a single array of data.
Definition heightmap.hpp:45
NormalMapBlendingMethod
Definition heightmap.hpp:25
@ NMAP_UDN
Definition heightmap.hpp:28
@ NMAP_UNITY
Definition heightmap.hpp:29
@ NMAP_WHITEOUT
Definition heightmap.hpp:30
@ NMAP_DERIVATIVE
Definition heightmap.hpp:27
@ NMAP_LINEAR
Definition heightmap.hpp:26
HeightMap class, to manipulate a set of RGBA heightmap for heightmap texturing.
Definition heightmap.hpp:518
std::vector< Heightmap > rgba
RGBA component heightmap storage.
Definition heightmap.hpp:522
void normalize()
Normalize RGBA heightmaps amplitude.
Definition heightmap_rgba.cpp:431
void set_sto(Vec2< int > new_shape, Vec2< int > new_tiling, float new_overlap)
Set the shape / tiling / overlap in one pass.
Definition heightmap_rgba.cpp:89
friend HeightmapRGBA mix_heightmap_rgba(HeightmapRGBA &rgba1, HeightmapRGBA &rgba2, bool use_sqrt_avg)
Mix two RGBA heightmap using alpha compositing ("over").
Definition heightmap_rgba.cpp:205
Vec2< int > shape
Shape.
Definition heightmap.hpp:527
std::vector< uint8_t > to_img_8bit(Vec2< int > shape_img={0, 0})
Convert the RGB heightmap to a 8bit RGB image.
Definition heightmap_rgba.cpp:453
void to_png(const std::string &fname, int depth=CV_8U)
Export the RGB heightmap to a 8bit png file.
Definition heightmap_rgba.cpp:445
void set_alpha(Heightmap new_alpha)
Set the alpha channel.
Definition heightmap_rgba.cpp:76
void colorize(Heightmap &color_level, float vmin, float vmax, int cmap, Heightmap *p_alpha=nullptr, bool reverse=false, Heightmap *p_noise=nullptr)
Fill RGB heightmap components based on a colormap and an input reference heightmap.
Definition heightmap_rgba.cpp:193
HeightmapRGBA()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition heightmap_rgba.cpp:21
Heightmap luminance()
Computes the luminance of an RGBA height map.
Definition heightmap_rgba.cpp:51
HeightMap class, to manipulate a set of RGB heightmap for heightmap texturing.
Definition heightmap.hpp:385
Vec2< int > shape
Shape.
Definition heightmap.hpp:403
void normalize()
Normalize RGB heightmaps amplitude.
Definition heightmap_rgb.cpp:99
void to_png(const std::string &fname, int depth=CV_8U)
Export the RGB heightmap to a 16bit png file.
Definition heightmap_rgb.cpp:132
void colorize(Heightmap &h, float vmin, float vmax, int cmap, bool reverse=false)
Fill RGB heightmap components based on a colormap and an input reference heightmap.
Definition heightmap_rgb.cpp:89
HeightmapRGB()
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition heightmap_rgb.cpp:20
std::vector< Heightmap > rgb
RGB component heightmap storage.
Definition heightmap.hpp:398
void set_sto(Vec2< int > new_shape, Vec2< int > new_tiling, float new_overlap)
Set the shape / tiling / overlap in one pass.
Definition heightmap_rgb.cpp:30
std::vector< uint8_t > to_img_8bit(Vec2< int > shape_img={0, 0})
Convert the RGB heightmap to a 8bit RGB image.
Definition heightmap_rgb.cpp:110
friend HeightmapRGB mix_heightmap_rgb_sqrt(HeightmapRGB &rgb1, HeightmapRGB &rgb2, Heightmap &t)
Mix two RGB heightmap using weighted quadratic averaging.
Definition heightmap_rgb.cpp:201
friend HeightmapRGB mix_heightmap_rgb(HeightmapRGB &rgb1, HeightmapRGB &rgb2, Heightmap &t)
Mix two RGB heightmap using linear interpolation.
Definition heightmap_rgb.cpp:142
Vec2 class for basic manipulation of 2D vectors.
Definition algebra.hpp:40
Vec4 class for basic manipulation of 4D vectors.
Definition algebra.hpp:564