From 838064f3b6baef03f144c95c263453479f1e5b9b Mon Sep 17 00:00:00 2001 From: wrenge Date: Tue, 27 Feb 2024 17:21:32 +0300 Subject: [PATCH] Serialization patch --- src/DotRecast.Detour/DtBVNode.cs | 3 +++ src/DotRecast.Detour/DtMeshData.cs | 3 +++ src/DotRecast.Detour/DtMeshHeader.cs | 2 ++ src/DotRecast.Detour/DtNavMeshParams.cs | 1 + src/DotRecast.Detour/DtOffMeshConnection.cs | 2 ++ src/DotRecast.Detour/DtPoly.cs | 9 ++++++--- src/DotRecast.Detour/DtPolyDetail.cs | 10 +++++----- src/DotRecast.Recast.Toolset/RcNavMeshBuildSettings.cs | 5 ++++- 8 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/DotRecast.Detour/DtBVNode.cs b/src/DotRecast.Detour/DtBVNode.cs index 2de5e75..8170277 100644 --- a/src/DotRecast.Detour/DtBVNode.cs +++ b/src/DotRecast.Detour/DtBVNode.cs @@ -18,6 +18,8 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; + namespace DotRecast.Detour { /** @@ -26,6 +28,7 @@ namespace DotRecast.Detour * @note This structure is rarely if ever used by the end user. * @see MeshTile */ + [Serializable] public class DtBVNode { /** Minimum bounds of the node's AABB. [(x, y, z)] */ diff --git a/src/DotRecast.Detour/DtMeshData.cs b/src/DotRecast.Detour/DtMeshData.cs index c2ad019..73c71f4 100644 --- a/src/DotRecast.Detour/DtMeshData.cs +++ b/src/DotRecast.Detour/DtMeshData.cs @@ -18,8 +18,11 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; + namespace DotRecast.Detour { + [Serializable] public class DtMeshData { /** The tile header. */ diff --git a/src/DotRecast.Detour/DtMeshHeader.cs b/src/DotRecast.Detour/DtMeshHeader.cs index de3d6a5..a79b9e4 100644 --- a/src/DotRecast.Detour/DtMeshHeader.cs +++ b/src/DotRecast.Detour/DtMeshHeader.cs @@ -18,11 +18,13 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; using DotRecast.Core.Numerics; namespace DotRecast.Detour { /** Provides high level information related to a dtMeshTile object. */ + [Serializable] public class DtMeshHeader { /** Tile magic number. (Used to identify the data format.) */ diff --git a/src/DotRecast.Detour/DtNavMeshParams.cs b/src/DotRecast.Detour/DtNavMeshParams.cs index 81cf963..5f0168d 100644 --- a/src/DotRecast.Detour/DtNavMeshParams.cs +++ b/src/DotRecast.Detour/DtNavMeshParams.cs @@ -18,6 +18,7 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; using DotRecast.Core.Numerics; namespace DotRecast.Detour diff --git a/src/DotRecast.Detour/DtOffMeshConnection.cs b/src/DotRecast.Detour/DtOffMeshConnection.cs index 244f005..5d6cf63 100644 --- a/src/DotRecast.Detour/DtOffMeshConnection.cs +++ b/src/DotRecast.Detour/DtOffMeshConnection.cs @@ -18,12 +18,14 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; using DotRecast.Core.Numerics; namespace DotRecast.Detour { /// Defines an navigation mesh off-mesh connection within a dtMeshTile object. /// An off-mesh connection is a user defined traversable connection made up to two vertices. + [Serializable] public class DtOffMeshConnection { /// The endpoints of the connection. [(ax, ay, az, bx, by, bz)] diff --git a/src/DotRecast.Detour/DtPoly.cs b/src/DotRecast.Detour/DtPoly.cs index 0ef2a77..37f0c6a 100644 --- a/src/DotRecast.Detour/DtPoly.cs +++ b/src/DotRecast.Detour/DtPoly.cs @@ -18,18 +18,21 @@ freely, subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ +using System; + namespace DotRecast.Detour { /** Defines a polygon within a MeshTile object. */ + [Serializable] public class DtPoly { - public readonly int index; + public int index; /** The indices of the polygon's vertices. The actual vertices are located in MeshTile::verts. */ - public readonly int[] verts; + public int[] verts; /** Packed data representing neighbor polygons references and flags for each edge. */ - public readonly int[] neis; + public int[] neis; /** The user defined polygon flags. */ public int flags; diff --git a/src/DotRecast.Detour/DtPolyDetail.cs b/src/DotRecast.Detour/DtPolyDetail.cs index cd813a4..365eb31 100644 --- a/src/DotRecast.Detour/DtPolyDetail.cs +++ b/src/DotRecast.Detour/DtPolyDetail.cs @@ -21,19 +21,19 @@ freely, subject to the following restrictions: namespace DotRecast.Detour { /** Defines the location of detail sub-mesh data within a dtMeshTile. */ - public readonly struct DtPolyDetail + public struct DtPolyDetail { /** The offset of the vertices in the MeshTile::detailVerts array. */ - public readonly int vertBase; + public int vertBase; /** The offset of the triangles in the MeshTile::detailTris array. */ - public readonly int triBase; + public int triBase; /** The number of vertices in the sub-mesh. */ - public readonly int vertCount; + public int vertCount; /** The number of triangles in the sub-mesh. */ - public readonly int triCount; + public int triCount; public DtPolyDetail(int vertBase, int triBase, int vertCount, int triCount) { diff --git a/src/DotRecast.Recast.Toolset/RcNavMeshBuildSettings.cs b/src/DotRecast.Recast.Toolset/RcNavMeshBuildSettings.cs index e0b6906..052c11f 100644 --- a/src/DotRecast.Recast.Toolset/RcNavMeshBuildSettings.cs +++ b/src/DotRecast.Recast.Toolset/RcNavMeshBuildSettings.cs @@ -1,5 +1,8 @@ -namespace DotRecast.Recast.Toolset +using System; + +namespace DotRecast.Recast.Toolset { + [Serializable] public class RcNavMeshBuildSettings { public float cellSize = 0.3f;