layers/craters/shaping/prepared.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "terraingen/layers/craters/shaping/prepared.h" | ||
| 2 | |||
| 3 | #include <utility> | ||
| 4 | |||
| 5 | namespace terraingen { | ||
| 6 | |||
| 7 | std::vector<PreparedCrater> | ||
| 8 | 129837 | PrepareCraters(const CraterList& craters, const CraterApplyOptions& options, double spacing, | |
| 9 | const DegradationModel& degradation, | ||
| 10 | const std::function<void(const Crater&, CraterOutline&)>& reshape) { | ||
| 11 | 129837 | std::vector<PreparedCrater> prepared; | |
| 12 | 6822934 | for (const std::size_t index : CraterApplyOrder(craters, options.order)) { | |
| 13 | 6693097 | const Crater crater = craters.At(index); | |
| 14 | 6693097 | const double resolution = ResolutionWeight(crater.diameter, spacing, options.fade); | |
| 15 | 6693097 | if (resolution == 0.0) { | |
| 16 | 950286 | continue; | |
| 17 | } | ||
| 18 | 5742811 | CraterOutline outline = OutlineOf(crater, options.irregularity); | |
| 19 | 5742811 | if (reshape) { | |
| 20 | 1480 | reshape(crater, outline); | |
| 21 | } | ||
| 22 | 11485622 | prepared.push_back({crater, resolution, degradation.State(crater), std::move(outline)}); | |
| 23 | 5872648 | } | |
| 24 | 129837 | return prepared; | |
| 25 | 11485622 | } | |
| 26 | |||
| 27 | } // namespace terraingen | ||
| 28 |