| | | 1 | | //======================================================================= |
| | | 2 | | // NavigationCellOverlayOperation.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 GridForge.Spatial; |
| | | 9 | | |
| | | 10 | | namespace Trailblazer.Pathing; |
| | | 11 | | |
| | | 12 | | /// <summary>Identifies the final-state action for a semantic cell overlay entry.</summary> |
| | | 13 | | public enum NavigationCellOverlayOperationKind |
| | | 14 | | { |
| | | 15 | | /// <summary>Write a complete effective cell payload.</summary> |
| | | 16 | | Set = 0, |
| | | 17 | | |
| | | 18 | | /// <summary>Tombstone effective traversal at the address.</summary> |
| | | 19 | | Suppress = 1, |
| | | 20 | | |
| | | 21 | | /// <summary>Remove the override or tombstone and restore explicit, then default, authoring.</summary> |
| | | 22 | | RevertToBake = 2 |
| | | 23 | | } |
| | | 24 | | |
| | | 25 | | /// <summary>Describes one immutable addressed semantic-cell overlay operation.</summary> |
| | | 26 | | public readonly struct NavigationCellOverlayOperation |
| | | 27 | | { |
| | | 28 | | private NavigationCellOverlayOperation( |
| | | 29 | | VoxelIndex index, |
| | | 30 | | NavigationCellOverlayOperationKind kind, |
| | | 31 | | NavigationCell cell) |
| | | 32 | | { |
| | 17359 | 33 | | Index = index; |
| | 17359 | 34 | | Kind = kind; |
| | 17359 | 35 | | Cell = cell; |
| | 17359 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary>Gets the topology-local address changed by this operation.</summary> |
| | | 39 | | public VoxelIndex Index { get; } |
| | | 40 | | |
| | | 41 | | /// <summary>Gets the final-state operation kind.</summary> |
| | | 42 | | public NavigationCellOverlayOperationKind Kind { get; } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Gets the complete payload for <see cref="NavigationCellOverlayOperationKind.Set"/>. |
| | | 46 | | /// The value is ignored for suppression and reversion. |
| | | 47 | | /// </summary> |
| | | 48 | | public NavigationCell Cell { get; } |
| | | 49 | | |
| | | 50 | | /// <summary>Creates a complete-payload Set operation.</summary> |
| | | 51 | | public static NavigationCellOverlayOperation Set(VoxelIndex index, NavigationCell cell) => |
| | 17199 | 52 | | new(index, NavigationCellOverlayOperationKind.Set, cell); |
| | | 53 | | |
| | | 54 | | /// <summary>Creates a tombstone operation.</summary> |
| | | 55 | | public static NavigationCellOverlayOperation Suppress(VoxelIndex index) => |
| | 101 | 56 | | new(index, NavigationCellOverlayOperationKind.Suppress, default); |
| | | 57 | | |
| | | 58 | | /// <summary>Creates an operation that restores explicit, then default, authoring.</summary> |
| | | 59 | | public static NavigationCellOverlayOperation RevertToBake(VoxelIndex index) => |
| | 59 | 60 | | new(index, NavigationCellOverlayOperationKind.RevertToBake, default); |
| | | 61 | | |
| | | 62 | | } |