| | | 1 | | //======================================================================= |
| | | 2 | | // HeightmapSample.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using FixedMathSharp; |
| | | 9 | | |
| | | 10 | | namespace Trailblazer.Heightmaps; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Result of a deterministic heightmap ground sample. |
| | | 14 | | /// </summary> |
| | | 15 | | public readonly struct HeightmapSample |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Name of the registered layer that supplied the sample. |
| | | 19 | | /// </summary> |
| | | 20 | | public string LayerName { get; } |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// World position used for the sample query. |
| | | 24 | | /// </summary> |
| | | 25 | | public Vector3d QueryPosition { get; } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Environment ground/contact Y resolved from the layer. |
| | | 29 | | /// </summary> |
| | | 30 | | public Fixed64 GroundY { get; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Absolute distance between query contact Y and the sampled ground Y used for layer selection. |
| | | 34 | | /// </summary> |
| | | 35 | | public Fixed64 DistanceFromSelectionY { get; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Creates a new heightmap sample result. |
| | | 39 | | /// </summary> |
| | | 40 | | public HeightmapSample( |
| | | 41 | | string layerName, |
| | | 42 | | Vector3d queryPosition, |
| | | 43 | | Fixed64 groundY, |
| | | 44 | | Fixed64 distanceFromSelectionY) |
| | | 45 | | { |
| | 26 | 46 | | LayerName = layerName; |
| | 26 | 47 | | QueryPosition = queryPosition; |
| | 26 | 48 | | GroundY = groundY; |
| | 26 | 49 | | DistanceFromSelectionY = distanceFromSelectionY; |
| | 26 | 50 | | } |
| | | 51 | | } |