| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// SPDX-License-Identifier: BSD-3-Clause |
| 2 |
|
|
|
| 3 |
|
|
/// @file |
| 4 |
|
|
/// @brief `Terrain`, a surface, optional starting heights and layers, evaluated over grids or at |
| 5 |
|
|
/// points, updated in place and reseeded. |
| 6 |
|
|
#pragma once |
| 7 |
|
|
|
| 8 |
|
|
#include "terraingen/geometry/surface.h" |
| 9 |
|
|
#include "terraingen/gpu/backend.h" |
| 10 |
|
|
#include "terraingen/layers/boulders/boulder_placer.h" |
| 11 |
|
|
#include "terraingen/layers/craters/crater_placer.h" |
| 12 |
|
|
#include "terraingen/layers/ground.h" |
| 13 |
|
|
#include "terraingen/layers/layer.h" |
| 14 |
|
|
#include "terraingen/raster/geotiff/geotiff.h" |
| 15 |
|
|
#include "terraingen/raster/grid.h" |
| 16 |
|
|
#include "terraingen/raster/raster.h" |
| 17 |
|
|
#include "terraingen/sources/source.h" |
| 18 |
|
|
#include "terraingen/util/span.h" |
| 19 |
|
|
|
| 20 |
|
|
#include <cstddef> |
| 21 |
|
|
#include <cstdint> |
| 22 |
|
|
#include <functional> |
| 23 |
|
|
#include <memory> |
| 24 |
|
|
#include <optional> |
| 25 |
|
|
#include <vector> |
| 26 |
|
|
|
| 27 |
|
|
namespace terraingen { |
| 28 |
|
|
|
| 29 |
|
|
class EvaluationCache; |
| 30 |
|
|
|
| 31 |
|
|
/// How to evaluate a terrain over a grid. |
| 32 |
60/63
✗ Branch 1 not taken.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 5 times.
✓ Branch 2 taken 16 times.
✓ Branch 4 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1 time.
✓ Branch 6 taken 1 time.
✓ Branch 6 taken 1 time.
✓ Branch 9 taken 1 time.
✓ Branch 12 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 20 taken 1 time.
✓ Branch 21 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 26 taken 1 time.
✗ Branch 27 not taken.
✓ Branch 27 taken 2 times.
✓ Branch 28 taken 1 time.
✓ Branch 30 taken 1 time.
✓ Branch 30 taken 1 time.
✓ Branch 34 taken 1 time.
✓ Branch 36 taken 1 time.
✓ Branch 42 taken 1 time.
✓ Branch 44 taken 1 time.
✓ Branch 48 taken 1 time.
✓ Branch 52 taken 1 time.
✓ Branch 52 taken 3 times.
✓ Branch 60 taken 1 time.
✓ Branch 64 taken 1 time.
✓ Branch 71 taken 1 time.
✓ Branch 75 taken 1 time.
✓ Branch 79 taken 1 time.
✓ Branch 83 taken 1 time.
✓ Branch 105 taken 1 time.
✓ Branch 109 taken 1 time.
✓ Branch 118 taken 1 time.
✓ Branch 133 taken 1 time.
✓ Branch 137 taken 1 time.
✓ Branch 141 taken 1 time.
✓ Branch 151 taken 1 time.
✓ Branch 155 taken 1 time.
✓ Branch 159 taken 1 time.
✗ Branch 167 not taken.
✓ Branch 168 taken 1 time.
✓ Branch 176 taken 3 times.
✓ Branch 182 taken 1 time.
✓ Branch 193 taken 1 time.
✓ Branch 205 taken 1 time.
✓ Branch 213 taken 1 time.
✓ Branch 217 taken 1 time.
✓ Branch 221 taken 1 time.
✓ Branch 230 taken 1 time.
✓ Branch 245 taken 1 time.
✓ Branch 253 taken 1 time.
✓ Branch 260 taken 1 time.
✓ Branch 266 taken 1 time.
✓ Branch 270 taken 1 time.
✓ Branch 274 taken 1 time.
✓ Branch 278 taken 1 time.
✓ Branch 303 taken 1 time.
|
538 |
struct EvaluationOptions { |
| 33 |
|
|
/// Sample spacing in meters; 0 means the grid's spacing on the terrain's surface, and a |
| 34 |
|
|
/// smaller value is raised to it. |
| 35 |
|
|
double spacing = 0.0; |
| 36 |
|
|
/// Threads to split each layer over; 0 for every hardware thread. The result does not |
| 37 |
|
|
/// depend on it. |
| 38 |
|
|
unsigned threads = 0; |
| 39 |
|
|
/// Where the grid is evaluated; empty for `DefaultBackend()`. GPU results match the CPU to |
| 40 |
|
|
/// float rounding; point queries always run on the CPU. |
| 41 |
|
|
std::optional<Backend> backend = std::nullopt; |
| 42 |
|
|
/// Called after each layer is applied with its index and the milliseconds it took, reads of |
| 43 |
|
|
/// the ground beneath it included; may be empty. |
| 44 |
|
|
std::function<void(std::size_t layer, double milliseconds)> onLayer{}; |
| 45 |
|
|
|
| 46 |
|
|
/// Sets the sample spacing in meters, for chaining: `EvaluationOptions{}.Spacing(0.5)`. |
| 47 |
|
21 |
EvaluationOptions& Spacing(double meters) { |
| 48 |
|
21 |
spacing = meters; |
| 49 |
8/8
✓ Branch 1 taken 3 times.
✓ Branch 1 taken 1 time.
✓ Branch 1 taken 1 time.
✓ Branch 1 taken 1 time.
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 10 times.
✓ Branch 4 taken 1 time.
✓ Branch 4 taken 1 time.
|
19 |
return *this; |
| 50 |
|
|
} |
| 51 |
|
|
/// Sets the threads to split each layer over; 0 for every hardware thread. |
| 52 |
|
133 |
EvaluationOptions& Threads(unsigned count) { |
| 53 |
|
133 |
threads = count; |
| 54 |
15/15
✓ Branch 1 taken 2 times.
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 3 times.
✓ Branch 16 taken 3 times.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
✓ Branch 25 taken 1 time.
|
127 |
return *this; |
| 55 |
|
|
} |
| 56 |
|
|
/// Sets where the grid is evaluated. |
| 57 |
|
113 |
EvaluationOptions& On(Backend where) { |
| 58 |
7/8
✓ Branch 1 taken 107 times.
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
|
113 |
backend = where; |
| 59 |
7/8
✓ Branch 1 taken 107 times.
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 4 taken 1 time.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
|
113 |
return *this; |
| 60 |
|
|
} |
| 61 |
|
|
}; |
| 62 |
|
|
|
| 63 |
|
|
/// A surface, a source (0 m without one) and layers applied in order. |
| 64 |
|
|
/// |
| 65 |
|
|
/// Grids, tiles and points give the same bits. On a body, grids are in longitude and latitude |
| 66 |
|
|
/// and spacings in meters. Copies share their immutable parts; evaluation is thread-safe, updates |
| 67 |
|
|
/// are not. |
| 68 |
|
|
class Terrain final : public Ground { |
| 69 |
|
|
public: |
| 70 |
|
|
/// A terrain on a plane without a source or layers. |
| 71 |
|
|
Terrain(); |
| 72 |
|
|
|
| 73 |
|
|
/// A terrain on `surface` with `source` as its starting heights, if any, and `layers`. |
| 74 |
|
|
/// @throws std::invalid_argument for a source in longitude and latitude on a plane or a |
| 75 |
|
|
/// projected source on a body (`Source::Keys`), a null layer, a layer built on another surface |
| 76 |
|
|
/// or on a source other than the terrain's (`Layer::LayerBase`; one built on none applies no |
| 77 |
|
|
/// source limits), or a layer whose `Layer::Dependencies` do not all come before it. |
| 78 |
|
|
Terrain(terraingen::Surface surface, std::shared_ptr<const terraingen::Source> source, |
| 79 |
|
|
std::vector<LayerPtr> layers); |
| 80 |
|
|
|
| 81 |
|
|
/// What the terrain lies on. |
| 82 |
|
13762 |
const terraingen::Surface& Surface() const { |
| 83 |
13/14
<unknown function 32>:
✓ Branch 1 taken 8 times.
✓ Branch 1 taken 11 times.
✓ Branch 1 taken 1 time.
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 4 taken 7 times.
✓ Branch 4 taken 1 time.
✓ Branch 5 taken 1 time.
<unknown function 82>:
✓ Branch 1 taken 1 time.
✓ Branch 1 taken 10 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 36 times.
<unknown function 83>:
✓ Branch 0 taken 3549 times.
✓ Branch 1 taken 2026207 times.
|
2043571 |
return m_surface; |
| 84 |
|
|
} |
| 85 |
|
|
|
| 86 |
|
|
/// The starting heights; null for none. |
| 87 |
|
39 |
const std::shared_ptr<const terraingen::Source>& Source() const { |
| 88 |
12/12
<unknown function 32>:
✓ Branch 1 taken 2 times.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 10 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 1 time.
✓ Branch 10 taken 1 time.
✓ Branch 13 taken 1 time.
✓ Branch 16 taken 1 time.
✓ Branch 19 taken 1 time.
✓ Branch 22 taken 1 time.
<unknown function 83>:
✓ Branch 0 taken 3549 times.
✓ Branch 1 taken 2026207 times.
|
2029826 |
return m_source; |
| 89 |
|
|
} |
| 90 |
|
|
|
| 91 |
|
|
/// The layers, applied in order. |
| 92 |
|
70 |
const std::vector<LayerPtr>& Layers() const { |
| 93 |
10/11
<unknown function 32>:
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 3 times.
✓ Branch 4 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8 times.
<unknown function 82>:
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 time.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 1 time.
<unknown function 93>:
✓ Branch 0 taken 1 time.
✓ Branch 1 taken 3 times.
|
2516900 |
return m_layers; |
| 94 |
|
|
} |
| 95 |
|
|
|
| 96 |
|
|
/// How far (m) around a tile evaluated at `spacing` the terrain beneath its layers is read: the |
| 97 |
|
|
/// sum of the layers' `Layer::GroundReach`, since each layer's ground needs the reach of the |
| 98 |
|
|
/// layers below around it. |
| 99 |
|
|
double GroundReach(double spacing) const; |
| 100 |
|
|
|
| 101 |
|
|
/// The grid of the source; none without a source or for one without bounds (`BoundedGrid`). |
| 102 |
|
|
std::optional<RasterGrid> Grid() const; |
| 103 |
|
|
|
| 104 |
|
|
/// The projection a raster of the terrain's heights is written with: its source's, or |
| 105 |
|
|
/// geographic keys on its body (`GeographicSphereKeys`) without one. |
| 106 |
|
|
GeoKeys Keys() const; |
| 107 |
|
|
|
| 108 |
|
|
/// The context a layer reads the terrain in: its surface and source, on this terrain. |
| 109 |
|
|
LayerContext Context(double spacing, unsigned threads) const override; |
| 110 |
|
|
|
| 111 |
|
|
/// The heights over `grid`, evaluated on several threads to the same bits as one. |
| 112 |
|
|
/// @throws std::invalid_argument for a negative or non-finite spacing; and whatever the parts |
| 113 |
|
|
/// throw. |
| 114 |
|
|
/// @throws std::runtime_error when a GPU backend is requested but unavailable |
| 115 |
|
|
/// (`ResolveBackend`). |
| 116 |
|
|
Raster<float> Evaluate(const RasterGrid& grid, const EvaluationOptions& options = {}) const; |
| 117 |
|
|
|
| 118 |
|
|
/// The heights over the source's grid (`Grid`). |
| 119 |
|
|
/// @throws std::invalid_argument as `Evaluate` over a grid, or for a terrain without a |
| 120 |
|
|
/// bounded source. |
| 121 |
|
|
/// @throws std::runtime_error as `Evaluate` over a grid. |
| 122 |
|
|
Raster<float> Evaluate(const EvaluationOptions& options = {}) const; |
| 123 |
|
|
|
| 124 |
|
|
/// `Evaluate` over `grid` straight into a caller buffer, to the same bits. |
| 125 |
|
|
/// @param heights grid.width * grid.height heights in meters, row-major with row 0 first |
| 126 |
|
|
/// (north up), as `Raster` stores them. |
| 127 |
|
|
/// @throws std::invalid_argument as `Evaluate`, or for a buffer of another size. |
| 128 |
|
|
/// @throws std::runtime_error as `Evaluate`. |
| 129 |
|
|
void Fill(const RasterGrid& grid, Span<float> heights, |
| 130 |
|
|
const EvaluationOptions& options = {}) const; |
| 131 |
|
|
|
| 132 |
|
|
/// Applies the layers from `first` on to `heights`, which hold the heights of |
| 133 |
|
|
/// `Beneath(first)` over their grid evaluated with `options`, to the bits of `Evaluate`. |
| 134 |
|
|
/// @throws std::invalid_argument for a `first` past the layer count, or as `Evaluate`. |
| 135 |
|
|
/// @throws std::runtime_error as `Evaluate`. |
| 136 |
|
|
void ApplyFrom(std::size_t first, Raster<float>& heights, |
| 137 |
|
|
const EvaluationOptions& options = {}) const; |
| 138 |
|
|
|
| 139 |
|
|
/// The craters the layers apply over `grid` (`CraterPlacer::CratersOver`). |
| 140 |
|
|
/// @param spacing The sample spacing in meters, finer than the grid's or not; 0 for the |
| 141 |
|
|
/// grid's. |
| 142 |
|
|
CraterFeatures Craters(const RasterGrid& grid, double spacing = 0.0) const; |
| 143 |
|
|
|
| 144 |
|
|
/// The craters the layers apply over the source's grid (`Grid`). |
| 145 |
|
|
/// @param spacing As for `Craters` over a grid. |
| 146 |
|
|
/// @throws std::invalid_argument for a terrain without a bounded source. |
| 147 |
|
|
CraterFeatures Craters(double spacing = 0.0) const; |
| 148 |
|
|
|
| 149 |
|
|
/// The boulders the layers place over `grid`, each read on the ground beneath its layer |
| 150 |
|
|
/// (`BoulderPlacer::BouldersOver`), and the boulder models among them. |
| 151 |
|
|
/// @param spacing The sample spacing in meters, finer than the grid's or not; 0 for the |
| 152 |
|
|
/// grid's. |
| 153 |
|
|
BoulderFeatures Boulders(const RasterGrid& grid, double spacing = 0.0) const; |
| 154 |
|
|
|
| 155 |
|
|
/// The boulders the layers place over the source's grid (`Grid`). |
| 156 |
|
|
/// @param spacing As for `Boulders` over a grid. |
| 157 |
|
|
/// @throws std::invalid_argument for a terrain without a bounded source. |
| 158 |
|
|
BoulderFeatures Boulders(double spacing = 0.0) const; |
| 159 |
|
|
|
| 160 |
|
|
/// The terrain beneath layer `layers`: the source and the first `layers` layers, sharing |
| 161 |
|
|
/// their point-query values with this terrain. |
| 162 |
|
|
/// @throws std::invalid_argument for more layers than the terrain has. |
| 163 |
|
|
Terrain Beneath(std::size_t layers) const; |
| 164 |
|
|
|
| 165 |
|
|
/// Replaces layer `index` with `layer`; later layers that read the old one are rebound to |
| 166 |
|
|
/// it (`Layer::Rebound`). |
| 167 |
|
|
/// @throws std::invalid_argument for an index past the last layer, or as the constructor; |
| 168 |
|
|
/// the terrain is then unchanged. |
| 169 |
|
|
void SetLayer(std::size_t index, LayerPtr layer); |
| 170 |
|
|
|
| 171 |
|
|
/// Replaces the source, null for none; layers built on the old one are rebuilt on the new |
| 172 |
|
|
/// (`Layer::Rebased`) and later layers reading them rebound to them. |
| 173 |
|
|
/// @throws std::invalid_argument as the constructor; the terrain is then unchanged. |
| 174 |
|
|
void SetSource(std::shared_ptr<const terraingen::Source> source); |
| 175 |
|
|
|
| 176 |
|
|
/// A copy whose seeded layers (`Layer::Reseeded`) and source (`Source::Reseeded`) draw from |
| 177 |
|
|
/// `seed`, each part from its own seed derived from it, for domain randomization without |
| 178 |
|
|
/// reading any data again; layers are rebased on a reseeded source and rebound to reseeded |
| 179 |
|
|
/// layers they read. |
| 180 |
|
|
/// @throws std::invalid_argument as the constructor. |
| 181 |
|
|
Terrain Reseed(std::uint64_t seed) const; |
| 182 |
|
|
|
| 183 |
|
|
protected: |
| 184 |
|
|
/// The heights at `samples`, as `HeightsAt`: points in batches of nearby points, which share |
| 185 |
|
|
/// values such as crater datums with every point query of this terrain. |
| 186 |
|
|
void FillSamples(SampleBlock& samples, double spacing, unsigned threads) const override; |
| 187 |
|
|
|
| 188 |
|
|
private: |
| 189 |
|
|
/// The replacement of layer `index` of the terrain, `layer`; null keeps it. |
| 190 |
|
|
using LayerReplacer = std::function<LayerPtr(std::size_t index, const LayerPtr& layer)>; |
| 191 |
|
|
|
| 192 |
|
|
/// Replaces each layer `replace` gives a replacement of and the source with `source`, |
| 193 |
|
|
/// rebases the layers built on the old source (`Layer::Rebased`) and rebinds those reading a |
| 194 |
|
|
/// replaced layer, then checks the terrain, which is unchanged when that throws. |
| 195 |
|
|
void Replace(std::shared_ptr<const terraingen::Source> source, const LayerReplacer& replace); |
| 196 |
|
|
|
| 197 |
|
|
/// The grid of the source. |
| 198 |
|
|
/// @throws std::invalid_argument for a terrain without a bounded source. |
| 199 |
|
|
RasterGrid SourceGrid() const; |
| 200 |
|
|
|
| 201 |
|
|
terraingen::Surface m_surface{}; |
| 202 |
|
|
std::shared_ptr<const terraingen::Source> m_source; |
| 203 |
|
|
std::vector<LayerPtr> m_layers; |
| 204 |
|
|
std::shared_ptr<EvaluationCache> m_cache; |
| 205 |
|
|
}; |
| 206 |
|
|
|
| 207 |
|
|
/// Calls `visit(layer, index)` for each layer of `terrain` that is a `T`, in order, with `index` |
| 208 |
|
|
/// its position in `terrain.Layers()`. |
| 209 |
|
|
template <typename T, typename Visit> |
| 210 |
|
13706 |
void ForEachLayer(const Terrain& terrain, const Visit& visit) { |
| 211 |
|
13706 |
const std::vector<LayerPtr>& layers = terrain.Layers(); |
| 212 |
14/14
void terraingen::ForEachLayer<terraingen::BoulderPlacer, terraingen::Terrain::Boulders(terraingen::RasterGrid const&, double) const::{lambda(terraingen::BoulderPlacer const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::Terrain::Boulders(terraingen::RasterGrid const&, double) const::{lambda(terraingen::BoulderPlacer const&, unsigned long)#1} const&):
✓ Branch 0 taken 135 times.
✓ Branch 1 taken 58 times.
void terraingen::ForEachLayer<terraingen::CraterPlacer, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::CraterPlacer const&, unsigned long)#1}>(terraingen::Terrain const&, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::CraterPlacer const&, unsigned long)#1} const&):
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
void terraingen::ForEachLayer<terraingen::CraterPlacer, terraingen::Terrain::Craters(terraingen::RasterGrid const&, double) const::{lambda(terraingen::CraterPlacer const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::Terrain::Craters(terraingen::RasterGrid const&, double) const::{lambda(terraingen::CraterPlacer const&, unsigned long)#1} const&):
✓ Branch 0 taken 250 times.
✓ Branch 1 taken 116 times.
void terraingen::ForEachLayer<terraingen::MaterialSource, terraingen::EvaluateMaterials(terraingen::Terrain const&, terraingen::MaterialOptions const&, terraingen::RasterGrid const&, terraingen::EvaluationOptions const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::EvaluateMaterials(terraingen::Terrain const&, terraingen::MaterialOptions const&, terraingen::RasterGrid const&, terraingen::EvaluationOptions const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1} const&):
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 10 times.
void terraingen::ForEachLayer<terraingen::MaterialSource, terraingen::MaterialsAt(terraingen::Terrain const&, terraingen::MaterialOptions const&, double, double, double)::{lambda(terraingen::MaterialSource const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::MaterialsAt(terraingen::Terrain const&, terraingen::MaterialOptions const&, double, double, double)::{lambda(terraingen::MaterialSource const&, unsigned long)#1} const&):
✓ Branch 0 taken 20093 times.
✓ Branch 1 taken 13511 times.
void terraingen::ForEachLayer<terraingen::MaterialSource, terraingen::config::(anonymous namespace)::PresentMaterials(terraingen::MaterialOptions const&, terraingen::Terrain const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::config::(anonymous namespace)::PresentMaterials(terraingen::MaterialOptions const&, terraingen::Terrain const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1} const&):
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 9 times.
void terraingen::ForEachLayer<terraingen::NoiseLayer, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::NoiseLayer const&, unsigned long)#1}>(terraingen::Terrain const&, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::NoiseLayer const&, unsigned long)#1} const&):
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
|
34239 |
for (std::size_t n = 0; n < layers.size(); ++n) { |
| 213 |
21/28
void terraingen::ForEachLayer<terraingen::BoulderPlacer, terraingen::Terrain::Boulders(terraingen::RasterGrid const&, double) const::{lambda(terraingen::BoulderPlacer const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::Terrain::Boulders(terraingen::RasterGrid const&, double) const::{lambda(terraingen::BoulderPlacer const&, unsigned long)#1} const&):
✓ Branch 0 taken 135 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 57 times.
✓ Branch 3 taken 78 times.
void terraingen::ForEachLayer<terraingen::CraterPlacer, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::CraterPlacer const&, unsigned long)#1}>(terraingen::Terrain const&, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::CraterPlacer const&, unsigned long)#1} const&):
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✓ Branch 3 taken 2 times.
void terraingen::ForEachLayer<terraingen::CraterPlacer, terraingen::Terrain::Craters(terraingen::RasterGrid const&, double) const::{lambda(terraingen::CraterPlacer const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::Terrain::Craters(terraingen::RasterGrid const&, double) const::{lambda(terraingen::CraterPlacer const&, unsigned long)#1} const&):
✓ Branch 0 taken 250 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
✓ Branch 3 taken 127 times.
void terraingen::ForEachLayer<terraingen::MaterialSource, terraingen::EvaluateMaterials(terraingen::Terrain const&, terraingen::MaterialOptions const&, terraingen::RasterGrid const&, terraingen::EvaluationOptions const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::EvaluateMaterials(terraingen::Terrain const&, terraingen::MaterialOptions const&, terraingen::RasterGrid const&, terraingen::EvaluationOptions const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1} const&):
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 13 times.
void terraingen::ForEachLayer<terraingen::MaterialSource, terraingen::MaterialsAt(terraingen::Terrain const&, terraingen::MaterialOptions const&, double, double, double)::{lambda(terraingen::MaterialSource const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::MaterialsAt(terraingen::Terrain const&, terraingen::MaterialOptions const&, double, double, double)::{lambda(terraingen::MaterialSource const&, unsigned long)#1} const&):
✓ Branch 0 taken 20093 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6581 times.
✓ Branch 3 taken 13512 times.
void terraingen::ForEachLayer<terraingen::MaterialSource, terraingen::config::(anonymous namespace)::PresentMaterials(terraingen::MaterialOptions const&, terraingen::Terrain const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1}>(terraingen::Terrain const&, terraingen::config::(anonymous namespace)::PresentMaterials(terraingen::MaterialOptions const&, terraingen::Terrain const&)::{lambda(terraingen::MaterialSource const&, unsigned long)#1} const&):
✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 18 times.
void terraingen::ForEachLayer<terraingen::NoiseLayer, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::NoiseLayer const&, unsigned long)#1}>(terraingen::Terrain const&, ForEachLayer_VisitsTheLayersOfOneTypeInOrderWithTheirIndices_Test::TestBody()::{lambda(terraingen::NoiseLayer const&, unsigned long)#1} const&):
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 1 time.
|
27315 |
if (const auto* layer = dynamic_cast<const T*>(layers[n].get())) { |
| 214 |
|
6782 |
visit(*layer, n); |
| 215 |
|
|
} |
| 216 |
|
|
} |
| 217 |
|
13706 |
} |
| 218 |
|
|
|
| 219 |
|
|
} // namespace terraingen |
| 220 |
|
|
|