include/terraingen/layers/craters/crater_placer.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | |||
| 3 | /// @file | ||
| 4 | /// @brief `CraterPlacer`, a layer that lists the craters it applies. | ||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "terraingen/layers/craters/crater.h" | ||
| 8 | #include "terraingen/layers/craters/shaping/apply.h" | ||
| 9 | #include "terraingen/layers/craters/shaping/attributes.h" | ||
| 10 | #include "terraingen/layers/layer.h" | ||
| 11 | #include "terraingen/raster/grid.h" | ||
| 12 | #include "terraingen/util/span.h" | ||
| 13 | |||
| 14 | #include <memory> | ||
| 15 | #include <vector> | ||
| 16 | |||
| 17 | namespace terraingen { | ||
| 18 | |||
| 19 | /// Craters and their attributes, in step. | ||
| 20 | 427 | struct CraterFeatures { | |
| 21 | CraterList craters; ///< The craters, in the order applied. | ||
| 22 | std::vector<CraterAttributes> attributes; ///< Each crater's attributes, in step. | ||
| 23 | |||
| 24 | /// Appends `other`'s craters and attributes. | ||
| 25 | void Append(const CraterFeatures& other); | ||
| 26 | }; | ||
| 27 | |||
| 28 | /// `craters` with their attributes under `models` (`CraterShapeModels::Attributes`). | ||
| 29 | /// @throws std::domain_error as `DegradationModel::State`. | ||
| 30 | CraterFeatures DescribeCraters(CraterList craters, const CraterShapeModels& models); | ||
| 31 | |||
| 32 | /// A layer that places craters. Craters are a pure function of position, so the layer lists them | ||
| 33 | /// on request rather than recording them while it is applied. | ||
| 34 | 1083 | class CraterPlacer { | |
| 35 | public: | ||
| 36 | virtual ~CraterPlacer() = default; | ||
| 37 | |||
| 38 | /// The craters the layer applies over `grid`, as its `Apply` there sees them. | ||
| 39 | /// @param spacing The sample spacing in meters the craters are listed at, as a heightmap of | ||
| 40 | /// that spacing applies them, finer than the grid's or not (`ListedSpacing`); 0 for the grid's. | ||
| 41 | virtual CraterFeatures CratersOver(const RasterGrid& grid, double spacing) const = 0; | ||
| 42 | }; | ||
| 43 | |||
| 44 | } // namespace terraingen | ||
| 45 |