| | | 1 | | //======================================================================= |
| | | 2 | | // GridCoveredAddress.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.Configuration; |
| | | 9 | | using GridForge.Spatial; |
| | | 10 | | |
| | | 11 | | namespace GridForge.Grids.Topology; |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Identifies one topology-local address covered by a query and its exact grid generation. |
| | | 15 | | /// </summary> |
| | | 16 | | public readonly struct GridCoveredAddress |
| | | 17 | | { |
| | | 18 | | /// <summary>The durable normalized grid identity.</summary> |
| | | 19 | | public GridConfigurationKey ConfigurationKey { get; } |
| | | 20 | | |
| | | 21 | | /// <summary>The recyclable world-local grid slot.</summary> |
| | | 22 | | public ushort GridIndex { get; } |
| | | 23 | | |
| | | 24 | | /// <summary>The exact process-unique grid allocation identity.</summary> |
| | | 25 | | public long GridSpawnToken { get; } |
| | | 26 | | |
| | | 27 | | /// <summary>The grid's last committed change sequence captured for this result.</summary> |
| | | 28 | | public ulong GridLastChangeSequence { get; } |
| | | 29 | | |
| | | 30 | | /// <summary>The topology-local address, whether or not a physical voxel currently exists.</summary> |
| | | 31 | | public VoxelIndex VoxelIndex { get; } |
| | | 32 | | |
| | | 33 | | internal GridCoveredAddress(GridCoveredAddressGeneration generation, VoxelIndex voxelIndex) |
| | | 34 | | { |
| | 26 | 35 | | ConfigurationKey = generation.ConfigurationKey; |
| | 26 | 36 | | GridIndex = generation.GridIndex; |
| | 26 | 37 | | GridSpawnToken = generation.GridSpawnToken; |
| | 26 | 38 | | GridLastChangeSequence = generation.GridLastChangeSequence; |
| | 26 | 39 | | VoxelIndex = voxelIndex; |
| | 26 | 40 | | } |
| | | 41 | | } |