| | | 1 | | using FixedMathSharp; |
| | | 2 | | using System; |
| | | 3 | | |
| | | 4 | | namespace Trailblazer.Heightmaps; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Context-local registration metadata for one heightmap layer. |
| | | 8 | | /// </summary> |
| | | 9 | | public sealed class HeightmapLayerRegistration |
| | | 10 | | { |
| | 34 | 11 | | internal HeightmapLayerRegistration( |
| | 34 | 12 | | HeightmapSurface surface, |
| | 34 | 13 | | Fixed64 minSelectionY, |
| | 34 | 14 | | Fixed64 maxSelectionY, |
| | 34 | 15 | | int priority, |
| | 34 | 16 | | int registrationOrder) |
| | | 17 | | { |
| | 34 | 18 | | Surface = surface ?? throw new ArgumentNullException(nameof(surface)); |
| | 34 | 19 | | LayerName = surface.Name; |
| | 34 | 20 | | MinSelectionY = minSelectionY; |
| | 34 | 21 | | MaxSelectionY = maxSelectionY; |
| | 34 | 22 | | Priority = priority; |
| | 34 | 23 | | RegistrationOrder = registrationOrder; |
| | 34 | 24 | | } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Stable registered layer name. |
| | | 28 | | /// </summary> |
| | | 29 | | public string LayerName { get; } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Compressed surface data used by this layer. |
| | | 33 | | /// </summary> |
| | | 34 | | public HeightmapSurface Surface { get; } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Inclusive lower contact-Y bound for selecting this layer. |
| | | 38 | | /// </summary> |
| | | 39 | | public Fixed64 MinSelectionY { get; } |
| | | 40 | | |
| | | 41 | | /// <summary> |
| | | 42 | | /// Exclusive upper contact-Y bound for selecting this layer. |
| | | 43 | | /// </summary> |
| | | 44 | | public Fixed64 MaxSelectionY { get; } |
| | | 45 | | |
| | | 46 | | /// <summary> |
| | | 47 | | /// Deterministic tie-break priority for overlapping layers. |
| | | 48 | | /// </summary> |
| | | 49 | | public int Priority { get; } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Deterministic context-local registration order. |
| | | 53 | | /// </summary> |
| | | 54 | | public int RegistrationOrder { get; } |
| | | 55 | | |
| | | 56 | | internal bool ContainsSelectionY(Fixed64 contactY) |
| | | 57 | | { |
| | 30 | 58 | | return contactY >= MinSelectionY && contactY < MaxSelectionY; |
| | | 59 | | } |
| | | 60 | | } |