HighMap library (C++)
Loading...
Searching...
No Matches
authoring.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4#pragma once
5#include "highmap/array.hpp"
7
8namespace hmap
9{
10
11class Cloud; // from highmap/geometry.hpp
12
26
68void alter_elevation(Array &array,
69 const Cloud &cloud,
70 int ir,
71 float footprint_ratio = 1.f,
72 glm::vec2 shift = {0.f, 0.f},
73 glm::vec2 scale = {1.f, 1.f});
74
119Array base_elevation(glm::ivec2 shape,
120 const std::vector<std::vector<float>> &values,
121 float width_factor = 1.f,
122 const Array *p_noise_x = nullptr,
123 const Array *p_noise_y = nullptr,
124 const Array *p_stretching = nullptr,
125 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
126
156Array flatbed_carve(glm::ivec2 shape,
157 const Path &path,
158 float bottom_extent = 32.f, // pixels
159 float vmin = 0.1f,
160 float depth = 0.05f,
161 float falloff_distance = 128.f,
162 float outer_slope = 0.1f,
163 bool preserve_bedshape = true,
164 RadialProfile radial_profile = RadialProfile::RP_GAIN,
165 float radial_profile_parameter = 2.f,
166 Array *p_falloff_mask = nullptr,
167 const Array *p_noise_r = nullptr,
168 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
169
197void flatbed_carve(Array &z,
198 const Path &path,
199 float bottom_extent = 32.f, // pixels
200 float vmin = 0.1f,
201 float depth = 0.05f,
202 float falloff_distance = 128.f,
203 float outer_slope = 0.1f,
204 bool preserve_bedshape = true,
205 RadialProfile radial_profile = RadialProfile::RP_GAIN,
206 float radial_profile_parameter = 2.f,
207 Array *p_falloff_mask = nullptr,
208 const Array *p_noise_r = nullptr,
209 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f});
210
243Array reverse_midpoint(const Array &array,
244 uint seed,
245 float noise_scale = 1.f,
246 float threshold = 0.f);
247
290Array ridgelines(glm::ivec2 shape,
291 const std::vector<float> &xr,
292 const std::vector<float> &yr,
293 const std::vector<float> &zr,
294 float slope,
295 float k_smoothing = 1.f,
296 float width = 0.1f,
297 float vmin = 0.f,
298 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f},
299 const Array *p_noise_x = nullptr,
300 const Array *p_noise_y = nullptr,
301 const Array *p_stretching = nullptr,
302 glm::vec4 bbox_array = {0.f, 1.f, 0.f, 1.f});
303
354Array ridgelines_bezier(glm::ivec2 shape,
355 const std::vector<float> &xr,
356 const std::vector<float> &yr,
357 const std::vector<float> &zr,
358 float slope,
359 float k_smoothing = 1.f,
360 float width = 0.1f,
361 float vmin = 0.f,
362 glm::vec4 bbox = {0.f, 1.f, 0.f, 1.f},
363 const Array *p_noise_x = nullptr,
364 const Array *p_noise_y = nullptr,
365 const Array *p_stretching = nullptr,
366 glm::vec4 bbox_array = {0.f, 1.f, 0.f, 1.f});
367
421Array stamping(glm::ivec2 shape,
422 const std::vector<float> &xr,
423 const std::vector<float> &yr,
424 const std::vector<float> &zr,
425 Array kernel,
426 int kernel_ir,
427 bool kernel_scale_radius,
428 bool kernel_scale_amplitude,
429 StampingBlendMethod blend_method,
430 uint seed,
431 float k_smoothing = 0.1f,
432 bool kernel_flip = true,
433 bool kernel_rotate = false,
434 glm::vec4 bbox_array = {0.f, 1.f, 0.f, 1.f});
435
436} // namespace hmap
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
unsigned int uint
Definition array.hpp:14
Definition algebra.hpp:22
Array reverse_midpoint(const Array &array, uint seed, float noise_scale=1.f, float threshold=0.f)
Apply the reverse midpoint displacement algorithm to the input array.
Definition reverse_midpoint.cpp:231
RadialProfile
Radial profile type.
Definition math.hpp:66
@ RP_GAIN
Definition math.hpp:67
Array 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, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox_array={0.f, 1.f, 0.f, 1.f})
Generate a heightmap based on a set of ridgelines with quadratic Bezier interpolation.
Definition ridgelines.cpp:100
Array 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, uint seed, float k_smoothing=0.1f, bool kernel_flip=true, bool kernel_rotate=false, glm::vec4 bbox_array={0.f, 1.f, 0.f, 1.f})
Generate a heightmap by stamping a kernel at predefined locations.
Definition stamping.cpp:17
StampingBlendMethod
Blending method for the stamping operator.
Definition authoring.hpp:17
@ SUBSTRACT
substract
Definition authoring.hpp:24
@ MINIMUM
minimum
Definition authoring.hpp:21
@ ADD
add
Definition authoring.hpp:18
@ MAXIMUM_SMOOTH
maximum smooth
Definition authoring.hpp:20
@ MINIMUM_SMOOTH
minimum smooth
Definition authoring.hpp:22
@ MULTIPLY
multiply
Definition authoring.hpp:23
@ MAXIMUM
maximum
Definition authoring.hpp:19
void 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 hei...
Definition alter_elevation.cpp:13
Array 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, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f}, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec4 bbox_array={0.f, 1.f, 0.f, 1.f})
Generate a heightmap based on a set of ridgelines and a specified slope.
Definition ridgelines.cpp:16
Array slope(glm::ivec2 shape, float angle, float slope, const Array *p_ctrl_param=nullptr, const Array *p_noise_x=nullptr, const Array *p_noise_y=nullptr, const Array *p_stretching=nullptr, glm::vec2 center={0.5f, 0.5f}, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Return an array corresponding to a slope with a given overall.
Definition primitives.cpp:279
Array flatbed_carve(glm::ivec2 shape, const Path &path, float bottom_extent=32.f, float vmin=0.1f, float depth=0.05f, float falloff_distance=128.f, float outer_slope=0.1f, bool preserve_bedshape=true, RadialProfile radial_profile=RadialProfile::RP_GAIN, float radial_profile_parameter=2.f, Array *p_falloff_mask=nullptr, const Array *p_noise_r=nullptr, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Carves a flatbed shape along a path.
Definition flatbed_carve.cpp:13
Array 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, glm::vec4 bbox={0.f, 1.f, 0.f, 1.f})
Generate a heightmap from a coarse grid of control points with defined elevation values.
Definition base_elevation.cpp:12
Path class for manipulating and analyzing paths in 2D space.