using Pathfinding.Util; namespace Pathfinding.Graphs.Navmesh { /// /// A tile in a navmesh graph. /// /// This is an intermediate representation used when building the navmesh, and also in some cases for serializing the navmesh to a portable format. /// /// See: for the representation used for pathfinding. /// public struct TileMesh { public int[] triangles; public Int3[] verticesInTileSpace; /// One tag per triangle public uint[] tags; /// Unsafe version of public struct TileMeshUnsafe { /// Three indices per triangle, of type int public Unity.Collections.LowLevel.Unsafe.UnsafeAppendBuffer triangles; /// One vertex per triangle, of type Int3 public Unity.Collections.LowLevel.Unsafe.UnsafeAppendBuffer verticesInTileSpace; /// One tag per triangle, of type uint public Unity.Collections.LowLevel.Unsafe.UnsafeAppendBuffer tags; public void Dispose () { triangles.Dispose(); verticesInTileSpace.Dispose(); tags.Dispose(); } public TileMesh ToManaged () { return new TileMesh { triangles = Memory.UnsafeAppendBufferToArray(triangles), verticesInTileSpace = Memory.UnsafeAppendBufferToArray(verticesInTileSpace), tags = Memory.UnsafeAppendBufferToArray(tags), }; } } } }