From 056408fed268143c3c274fb6c76e1470d3eede8f Mon Sep 17 00:00:00 2001 From: ikpil Date: Thu, 9 Nov 2023 22:36:00 +0900 Subject: [PATCH] typo --- .../Unity/Astar/GraphMeshDataReader.cs | 20 +++++++++---------- src/DotRecast.Detour/DtMeshHeader.cs | 17 ---------------- src/DotRecast.Detour/DtNavMesh.cs | 17 ++++++++++++++++ src/DotRecast.Detour/DtNavMeshBuilder.cs | 4 ++-- src/DotRecast.Detour/Io/DtMeshDataReader.cs | 16 +++++++-------- src/DotRecast.Detour/Io/DtMeshDataWriter.cs | 2 +- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs index e08b984..7678aed 100644 --- a/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs +++ b/src/DotRecast.Detour.Extras/Unity/Astar/GraphMeshDataReader.cs @@ -116,8 +116,8 @@ namespace DotRecast.Detour.Extras.Unity.Astar tiles[tileIndex].detailVerts = detailVerts; tiles[tileIndex].detailTris = detailTris; DtMeshHeader header = new DtMeshHeader(); - header.magic = DtMeshHeader.DT_NAVMESH_MAGIC; - header.version = DtMeshHeader.DT_NAVMESH_VERSION; + header.magic = DtNavMesh.DT_NAVMESH_MAGIC; + header.version = DtNavMesh.DT_NAVMESH_VERSION; header.x = x; header.y = z; header.polyCount = nodeCount; @@ -125,16 +125,16 @@ namespace DotRecast.Detour.Extras.Unity.Astar header.detailMeshCount = nodeCount; header.detailTriCount = nodeCount; header.maxLinkCount = nodeCount * 3 * 2; // XXX: Needed by Recast, not needed by recast4j - header.bmin.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x - + meta.cellSize * meta.tileSizeX * x; + header.bmin.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x + + meta.cellSize * meta.tileSizeX * x; header.bmin.Y = ymin; - header.bmin.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z - + meta.cellSize * meta.tileSizeZ * z; - header.bmax.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x - + meta.cellSize * meta.tileSizeX * (x + 1); + header.bmin.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z + + meta.cellSize * meta.tileSizeZ * z; + header.bmax.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x + + meta.cellSize * meta.tileSizeX * (x + 1); header.bmax.Y = ymax; - header.bmax.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z - + meta.cellSize * meta.tileSizeZ * (z + 1); + header.bmax.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z + + meta.cellSize * meta.tileSizeZ * (z + 1); header.bvQuantFactor = 1.0f / meta.cellSize; header.offMeshBase = nodeCount; header.walkableClimb = meta.walkableClimb; diff --git a/src/DotRecast.Detour/DtMeshHeader.cs b/src/DotRecast.Detour/DtMeshHeader.cs index 99e8586..de3d6a5 100644 --- a/src/DotRecast.Detour/DtMeshHeader.cs +++ b/src/DotRecast.Detour/DtMeshHeader.cs @@ -25,23 +25,6 @@ namespace DotRecast.Detour /** Provides high level information related to a dtMeshTile object. */ public class DtMeshHeader { - /** A magic number used to detect compatibility of navigation tile data. */ - public const int DT_NAVMESH_MAGIC = 'D' << 24 | 'N' << 16 | 'A' << 8 | 'V'; - - /** A version number used to detect compatibility of navigation tile data. */ - public const int DT_NAVMESH_VERSION = 7; - - public const int DT_NAVMESH_VERSION_RECAST4J_FIRST = 0x8807; - public const int DT_NAVMESH_VERSION_RECAST4J_NO_POLY_FIRSTLINK = 0x8808; - public const int DT_NAVMESH_VERSION_RECAST4J_32BIT_BVTREE = 0x8809; - public const int DT_NAVMESH_VERSION_RECAST4J_LAST = 0x8809; - - /** A magic number used to detect the compatibility of navigation tile states. */ - public const int DT_NAVMESH_STATE_MAGIC = 'D' << 24 | 'N' << 16 | 'M' << 8 | 'S'; - - /** A version number used to detect compatibility of navigation tile states. */ - public const int DT_NAVMESH_STATE_VERSION = 1; - /** Tile magic number. (Used to identify the data format.) */ public int magic; diff --git a/src/DotRecast.Detour/DtNavMesh.cs b/src/DotRecast.Detour/DtNavMesh.cs index a521ead..e601e42 100644 --- a/src/DotRecast.Detour/DtNavMesh.cs +++ b/src/DotRecast.Detour/DtNavMesh.cs @@ -27,6 +27,23 @@ namespace DotRecast.Detour { public class DtNavMesh { + /** A magic number used to detect compatibility of navigation tile data. */ + public const int DT_NAVMESH_MAGIC = 'D' << 24 | 'N' << 16 | 'A' << 8 | 'V'; + + /** A version number used to detect compatibility of navigation tile data. */ + public const int DT_NAVMESH_VERSION = 7; + + public const int DT_NAVMESH_VERSION_RECAST4J_FIRST = 0x8807; + public const int DT_NAVMESH_VERSION_RECAST4J_NO_POLY_FIRSTLINK = 0x8808; + public const int DT_NAVMESH_VERSION_RECAST4J_32BIT_BVTREE = 0x8809; + public const int DT_NAVMESH_VERSION_RECAST4J_LAST = 0x8809; + + /** A magic number used to detect the compatibility of navigation tile states. */ + public const int DT_NAVMESH_STATE_MAGIC = 'D' << 24 | 'N' << 16 | 'M' << 8 | 'S'; + + /** A version number used to detect compatibility of navigation tile states. */ + public const int DT_NAVMESH_STATE_VERSION = 1; + public const int DT_SALT_BITS = 16; public const int DT_TILE_BITS = 28; public const int DT_POLY_BITS = 20; diff --git a/src/DotRecast.Detour/DtNavMeshBuilder.cs b/src/DotRecast.Detour/DtNavMeshBuilder.cs index eb37a5e..8a2df27 100644 --- a/src/DotRecast.Detour/DtNavMeshBuilder.cs +++ b/src/DotRecast.Detour/DtNavMeshBuilder.cs @@ -423,8 +423,8 @@ namespace DotRecast.Detour DtOffMeshConnection[] offMeshCons = new DtOffMeshConnection[storedOffMeshConCount]; // Store header - header.magic = DtMeshHeader.DT_NAVMESH_MAGIC; - header.version = DtMeshHeader.DT_NAVMESH_VERSION; + header.magic = DtNavMesh.DT_NAVMESH_MAGIC; + header.version = DtNavMesh.DT_NAVMESH_VERSION; header.x = option.tileX; header.y = option.tileZ; header.layer = option.tileLayer; diff --git a/src/DotRecast.Detour/Io/DtMeshDataReader.cs b/src/DotRecast.Detour/Io/DtMeshDataReader.cs index 32a98c0..7823681 100644 --- a/src/DotRecast.Detour/Io/DtMeshDataReader.cs +++ b/src/DotRecast.Detour/Io/DtMeshDataReader.cs @@ -53,10 +53,10 @@ namespace DotRecast.Detour.Io DtMeshHeader header = new DtMeshHeader(); data.header = header; header.magic = buf.GetInt(); - if (header.magic != DtMeshHeader.DT_NAVMESH_MAGIC) + if (header.magic != DtNavMesh.DT_NAVMESH_MAGIC) { header.magic = IOUtils.SwapEndianness(header.magic); - if (header.magic != DtMeshHeader.DT_NAVMESH_MAGIC) + if (header.magic != DtNavMesh.DT_NAVMESH_MAGIC) { throw new IOException("Invalid magic"); } @@ -65,16 +65,16 @@ namespace DotRecast.Detour.Io } header.version = buf.GetInt(); - if (header.version != DtMeshHeader.DT_NAVMESH_VERSION) + if (header.version != DtNavMesh.DT_NAVMESH_VERSION) { - if (header.version < DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_FIRST - || header.version > DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_LAST) + if (header.version < DtNavMesh.DT_NAVMESH_VERSION_RECAST4J_FIRST + || header.version > DtNavMesh.DT_NAVMESH_VERSION_RECAST4J_LAST) { throw new IOException("Invalid version " + header.version); } } - bool cCompatibility = header.version == DtMeshHeader.DT_NAVMESH_VERSION; + bool cCompatibility = header.version == DtNavMesh.DT_NAVMESH_VERSION; header.x = buf.GetInt(); header.y = buf.GetInt(); header.layer = buf.GetInt(); @@ -141,7 +141,7 @@ namespace DotRecast.Detour.Io for (int i = 0; i < polys.Length; i++) { polys[i] = new DtPoly(i, maxVertPerPoly); - if (header.version < DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_NO_POLY_FIRSTLINK) + if (header.version < DtNavMesh.DT_NAVMESH_VERSION_RECAST4J_NO_POLY_FIRSTLINK) { buf.GetInt(); // polys[i].firstLink } @@ -200,7 +200,7 @@ namespace DotRecast.Detour.Io for (int i = 0; i < nodes.Length; i++) { nodes[i] = new DtBVNode(); - if (header.version < DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_32BIT_BVTREE) + if (header.version < DtNavMesh.DT_NAVMESH_VERSION_RECAST4J_32BIT_BVTREE) { for (int j = 0; j < 3; j++) { diff --git a/src/DotRecast.Detour/Io/DtMeshDataWriter.cs b/src/DotRecast.Detour/Io/DtMeshDataWriter.cs index ac99b52..676ff44 100644 --- a/src/DotRecast.Detour/Io/DtMeshDataWriter.cs +++ b/src/DotRecast.Detour/Io/DtMeshDataWriter.cs @@ -27,7 +27,7 @@ namespace DotRecast.Detour.Io { DtMeshHeader header = data.header; Write(stream, header.magic, order); - Write(stream, cCompatibility ? DtMeshHeader.DT_NAVMESH_VERSION : DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_LAST, order); + Write(stream, cCompatibility ? DtNavMesh.DT_NAVMESH_VERSION : DtNavMesh.DT_NAVMESH_VERSION_RECAST4J_LAST, order); Write(stream, header.x, order); Write(stream, header.y, order); Write(stream, header.layer, order);