HighMap library (C++)
Loading...
Searching...
No Matches
authoring.hpp File Reference

Go to the source code of this file.

Classes

struct  hmap::DeformationConstraint
 Per-vertex penalty term used by sls_deformation. More...
struct  hmap::GaussianPush
 Truncated-Gaussian push operation, the elementary deformation used by sls_deformation. More...

Namespaces

namespace  hmap

Enumerations

enum  hmap::StampingBlendMethod : int {
  hmap::ADD , hmap::MAXIMUM , hmap::MAXIMUM_SMOOTH , hmap::MINIMUM ,
  hmap::MINIMUM_SMOOTH , hmap::MULTIPLY , hmap::SUBSTRACT
}
 Blending method for the stamping operator. More...
enum  hmap::DeformationConstraintType : int { hmap::MATCH , hmap::ABOVE , hmap::BELOW }
 Penalty type of a deformation constraint (see DeformationConstraint). More...

Functions

void hmap::alter_elevation (Array &array, const Cloud &cloud, int ir, float footprint_ratio=1.f, glm::vec2 shift={0.f, 0.f}, glm::vec2 scale={1.f, 1.f})
 Point-wise alteration: locally enforce a new elevation value while maintaining the 'shape' of the heightmap.
void hmap::apply_gaussian_pushes (Array &array, const std::vector< GaussianPush > &pushes)
 Apply a sequence of truncated-Gaussian pushes to a heightmap.
Array hmap::base_elevation (glm::ivec2 shape, const std::vector< std::vector< float > > &values, float width_factor=1.f, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, const UvRect &uv_rect=UvRect::unit())
 Generate a heightmap from a coarse grid of control points with defined elevation values.
Array hmap::elevation_from_contours (glm::ivec2 shape, const std::vector< Path > &contours, const std::vector< float > &elevations, const Array *p_probability=nullptr, float randomness=1.f, std::uint32_t seed=0, float peak_ratio=0.5f, float outside_ratio=1.f, bool smoothstep=false, const UvRect &uv_rect=UvRect::unit())
 Synthesize a heightmap from sparse closed iso-contours with known elevations using stochastic front propagation (proof of concept).
Array hmap::elevation_from_contours (const Array &contours, const Array *p_probability=nullptr, float randomness=1.f, std::uint32_t seed=0, float peak_ratio=0.5f, float outside_ratio=1.f, bool smoothstep=false)
 Synthesize a heightmap from a raster of sparse iso-contours with known elevations using stochastic front propagation.
Array hmap::elevation_from_sparse_constraints (const Array &mountains, const Array *p_coastline=nullptr, const Array *p_boundary=nullptr, float mountain_elevation=1.0f, float coastline_elevation=0.0f, float boundary_elevation=-1.0f, int iterations_max=500, float tolerance=1e-5f, const Array *p_noise=nullptr, float noise_amplitude=0.0f)
 Synthesize a smooth heightmap from sparse elevation constraints using GPU harmonic interpolation (Laplacian PDE).
Array hmap::reverse_midpoint (const Array &array, std::uint32_t seed, float noise_scale=1.f, float threshold=0.f)
 Apply the reverse midpoint displacement algorithm to the input array.
Array hmap::ridgelines (glm::ivec2 shape, const std::vector< float > &xr, const std::vector< float > &yr, const std::vector< float > &zr, float slope, float k_smoothing=1.f, float width=0.1f, float vmin=0.f, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, const UvRect &uv_rect_array=UvRect::unit())
 Generate a heightmap based on a set of ridgelines and a specified slope.
Array hmap::ridgelines_bezier (glm::ivec2 shape, const std::vector< float > &xr, const std::vector< float > &yr, const std::vector< float > &zr, float slope, float k_smoothing=1.f, float width=0.1f, float vmin=0.f, const UvRect &uv_rect=UvRect::unit(), const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, const UvRect &uv_rect_array=UvRect::unit())
 Generate a heightmap based on a set of ridgelines with quadratic Bezier interpolation.
Array hmap::sls_deformation (const Array &z, const std::vector< DeformationConstraint > &constraints, std::uint32_t seed, int iterations=200, int ir_min=4, int ir_max=64, int n_radii=7, float talus_max=0.f, int n_candidates=512, float p_best=0.65f, float top_fraction=0.1f, float tolerance=1e-3f, std::vector< GaussianPush > *p_pushes=nullptr)
 Deform a heightmap to satisfy a set of constraints using stochastic local search over truncated-Gaussian push operations.
Array hmap::stamping (glm::ivec2 shape, const std::vector< float > &xr, const std::vector< float > &yr, const std::vector< float > &zr, Array kernel, int kernel_ir, bool kernel_scale_radius, bool kernel_scale_amplitude, StampingBlendMethod blend_method, std::uint32_t seed, float k_smoothing=0.1f, bool kernel_flip=true, bool kernel_rotate=false, const UvRect &uv_rect_array=UvRect::unit())
 Generate a heightmap by stamping a kernel at predefined locations.