HighMap library (C++)
|
HeightMap class, to manipulate a set of RGB heightmap for heightmap texturing. More...
#include <heightmap.hpp>
Public Member Functions | |
HeightmapRGB (Heightmap r, Heightmap g, Heightmap b) | |
Constructor. | |
HeightmapRGB () | |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | set_sto (Vec2< int > new_shape, Vec2< int > new_tiling, float new_overlap) |
Set the shape / tiling / overlap in one pass. | |
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. | |
void | colorize (Heightmap &h, float vmin, float vmax, std::vector< std::vector< float > > colormap_colors, bool reverse=false) |
Fill RGB heightmap components based on a colormap and an input reference heightmap. | |
void | normalize () |
Normalize RGB heightmaps amplitude. | |
std::vector< uint8_t > | to_img_8bit (Vec2< int > shape_img={0, 0}) |
Convert the RGB heightmap to a 8bit RGB image. | |
void | to_png (const std::string &fname, int depth=CV_8U) |
Export the RGB heightmap to a 16bit png file. | |
Public Attributes | |
std::vector< Heightmap > | rgb |
RGB component heightmap storage. | |
Vec2< int > | shape = {0, 0} |
Shape. | |
Friends | |
HeightmapRGB | mix_heightmap_rgb (HeightmapRGB &rgb1, HeightmapRGB &rgb2, Heightmap &t) |
Mix two RGB heightmap using linear interpolation. | |
HeightmapRGB | mix_heightmap_rgb (HeightmapRGB &rgb1, HeightmapRGB &rgb2, float t) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
HeightmapRGB | mix_heightmap_rgb_sqrt (HeightmapRGB &rgb1, HeightmapRGB &rgb2, Heightmap &t) |
Mix two RGB heightmap using weighted quadratic averaging. | |
HeightmapRGB | mix_heightmap_rgb_sqrt (HeightmapRGB &rgb1, HeightmapRGB &rgb2, float t) |
HeightMap class, to manipulate a set of RGB heightmap for heightmap texturing.
hmap::HeightmapRGB::HeightmapRGB | ( | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void hmap::HeightmapRGB::set_sto | ( | Vec2< int > | new_shape, |
Vec2< int > | new_tiling, | ||
float | new_overlap | ||
) |
Set the shape / tiling / overlap in one pass.
new_shape | New shape. |
new_tiling | New tiling. |
new_overlap | New overlap. |
void hmap::HeightmapRGB::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.
h | Input heightmap. |
vmin | Lower bound for scaling to array [0, 1]. |
vmax | Upper bound for scaling to array [0, 1] |
cmap | Colormap (see cmap ). |
reverse | Reverse colormap. |
void hmap::HeightmapRGB::colorize | ( | Heightmap & | h, |
float | vmin, | ||
float | vmax, | ||
std::vector< std::vector< float > > | colormap_colors, | ||
bool | reverse = false |
||
) |
Fill RGB heightmap components based on a colormap and an input reference heightmap.
h | Input heightmap. |
vmin | Lower bound for scaling to array [0, 1]. |
vmax | Upper bound for scaling to array [0, 1] |
colormap_colors | Colormap RGB colors as a vector of RGB colors. |
reverse | Reverse colormap. |
void hmap::HeightmapRGB::normalize | ( | ) |
Normalize RGB heightmaps amplitude.
std::vector< uint8_t > hmap::HeightmapRGB::to_img_8bit | ( | Vec2< int > | shape_img = {0, 0} | ) |
Convert the RGB heightmap to a 8bit RGB image.
shape_img | Resulting image shape. |
void hmap::HeightmapRGB::to_png | ( | const std::string & | fname, |
int | depth = CV_8U |
||
) |
Export the RGB heightmap to a 16bit png file.
fname | File name. |
|
friend |
Mix two RGB heightmap using linear interpolation.
rgb1 | 1st RGB heightmap. |
rgb2 | 2st RGB heightmap. |
t | Mixing parameter, in [0, 1]. |
|
friend |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
friend |
Mix two RGB heightmap using weighted quadratic averaging.
rgb1 | 1st RGB heightmap. |
rgb2 | 2st RGB heightmap. |
t | Mixing parameter, in [0, 1]. |
|
friend |
std::vector<Heightmap> hmap::HeightmapRGB::rgb |
RGB component heightmap storage.
Example
Result
Vec2<int> hmap::HeightmapRGB::shape = {0, 0} |
Shape.