layers/craters/shaping/crater_kernel.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /// @file | ||
| 2 | /// @brief Prepared craters turned into the records the crater kernel shapes. | ||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include "terraingen/layers/craters/profiles/profile.h" | ||
| 6 | #include "terraingen/layers/craters/shaping/apply_options.h" | ||
| 7 | #include "terraingen/layers/craters/shaping/prepared.h" | ||
| 8 | #include "terraingen/layers/kernels/craters.h" | ||
| 9 | |||
| 10 | #include <memory> | ||
| 11 | #include <optional> | ||
| 12 | #include <vector> | ||
| 13 | |||
| 14 | namespace terraingen { | ||
| 15 | |||
| 16 | /// The kernel form of `profile` shaped as `options` say, or nothing when the kernel cannot shape | ||
| 17 | /// it: a profile of your own, or craters on a body. | ||
| 18 | std::optional<CraterShapeKernel> MakeCraterShapeKernel(const CraterProfile& profile, | ||
| 19 | const CraterApplyOptions& options); | ||
| 20 | |||
| 21 | /// Craters ready for the kernel: one record per crater, and the values that vary in length. | ||
| 22 | struct CraterKernelBatch { | ||
| 23 | std::vector<CraterRecord> records; | ||
| 24 | std::vector<float> data; | ||
| 25 | |||
| 26 | /// Where the kernel reads `data`. | ||
| 27 | 1778684 | CraterData Data() const { | |
| 28 | 1778684 | CraterData view; | |
| 29 | 1778684 | view.values = data.data(); | |
| 30 | 1778684 | return view; | |
| 31 | } | ||
| 32 | }; | ||
| 33 | |||
| 34 | /// The records of `craters` of `prepared`, in order, with their datums as fitted. | ||
| 35 | /// @throws std::invalid_argument for a crater state the profile rejects. | ||
| 36 | CraterKernelBatch MakeCraterKernelBatch(const CraterShapeKernel& kernel, | ||
| 37 | const CraterProfile& profile, | ||
| 38 | const std::vector<PreparedCrater>& prepared, | ||
| 39 | const std::vector<std::size_t>& craters, | ||
| 40 | const CraterApplyOptions& options); | ||
| 41 | |||
| 42 | } // namespace terraingen | ||
| 43 |