HighMap library (C++)
Loading...
Searching...
No Matches
hmap::HeightmapRGB Struct Reference

HeightMap class, to manipulate a set of RGB heightmap for heightmap texturing. More...

#include <heightmap.hpp>

Collaboration diagram for hmap::HeightmapRGB:

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< Heightmaprgb
 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)
 

Detailed Description

HeightMap class, to manipulate a set of RGB heightmap for heightmap texturing.

Constructor & Destructor Documentation

◆ HeightmapRGB() [1/2]

hmap::HeightmapRGB::HeightmapRGB ( Heightmap  r,
Heightmap  g,
Heightmap  b 
)

Constructor.

Parameters
rHeightmap for R (red) component.
gHeightmap for G (green) component.
bHeightmap for B (blue) component.

◆ HeightmapRGB() [2/2]

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.

Member Function Documentation

◆ set_sto()

void hmap::HeightmapRGB::set_sto ( Vec2< int >  new_shape,
Vec2< int >  new_tiling,
float  new_overlap 
)

Set the shape / tiling / overlap in one pass.

Parameters
new_shapeNew shape.
new_tilingNew tiling.
new_overlapNew overlap.

◆ colorize() [1/2]

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.

Parameters
hInput heightmap.
vminLower bound for scaling to array [0, 1].
vmaxUpper bound for scaling to array [0, 1]
cmapColormap (see cmap).
reverseReverse colormap.

◆ colorize() [2/2]

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.

Parameters
hInput heightmap.
vminLower bound for scaling to array [0, 1].
vmaxUpper bound for scaling to array [0, 1]
colormap_colorsColormap RGB colors as a vector of RGB colors.
reverseReverse colormap.

◆ normalize()

void hmap::HeightmapRGB::normalize ( )

Normalize RGB heightmaps amplitude.

◆ to_img_8bit()

std::vector< uint8_t > hmap::HeightmapRGB::to_img_8bit ( Vec2< int >  shape_img = {0, 0})

Convert the RGB heightmap to a 8bit RGB image.

Parameters
shape_imgResulting image shape.
Returns
Image data.

◆ to_png()

void hmap::HeightmapRGB::to_png ( const std::string &  fname,
int  depth = CV_8U 
)

Export the RGB heightmap to a 16bit png file.

Parameters
fnameFile name.

Friends And Related Symbol Documentation

◆ mix_heightmap_rgb [1/2]

HeightmapRGB mix_heightmap_rgb ( HeightmapRGB rgb1,
HeightmapRGB rgb2,
Heightmap t 
)
friend

Mix two RGB heightmap using linear interpolation.

Parameters
rgb11st RGB heightmap.
rgb22st RGB heightmap.
tMixing parameter, in [0, 1].
Returns
RGB heightmap.

◆ mix_heightmap_rgb [2/2]

HeightmapRGB mix_heightmap_rgb ( HeightmapRGB rgb1,
HeightmapRGB rgb2,
float  t 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ mix_heightmap_rgb_sqrt [1/2]

HeightmapRGB mix_heightmap_rgb_sqrt ( HeightmapRGB rgb1,
HeightmapRGB rgb2,
Heightmap t 
)
friend

Mix two RGB heightmap using weighted quadratic averaging.

Parameters
rgb11st RGB heightmap.
rgb22st RGB heightmap.
tMixing parameter, in [0, 1].
Returns
RGB heightmap.

◆ mix_heightmap_rgb_sqrt [2/2]

HeightmapRGB mix_heightmap_rgb_sqrt ( HeightmapRGB rgb1,
HeightmapRGB rgb2,
float  t 
)
friend

Member Data Documentation

◆ rgb

std::vector<Heightmap> hmap::HeightmapRGB::rgb

RGB component heightmap storage.

Example

Result

◆ shape

Vec2<int> hmap::HeightmapRGB::shape = {0, 0}

Shape.


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