forked from bit/DotRecastNetSim
typo
This commit is contained in:
parent
b9ec4391f2
commit
056408fed2
|
@ -116,8 +116,8 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
||||||
tiles[tileIndex].detailVerts = detailVerts;
|
tiles[tileIndex].detailVerts = detailVerts;
|
||||||
tiles[tileIndex].detailTris = detailTris;
|
tiles[tileIndex].detailTris = detailTris;
|
||||||
DtMeshHeader header = new DtMeshHeader();
|
DtMeshHeader header = new DtMeshHeader();
|
||||||
header.magic = DtMeshHeader.DT_NAVMESH_MAGIC;
|
header.magic = DtNavMesh.DT_NAVMESH_MAGIC;
|
||||||
header.version = DtMeshHeader.DT_NAVMESH_VERSION;
|
header.version = DtNavMesh.DT_NAVMESH_VERSION;
|
||||||
header.x = x;
|
header.x = x;
|
||||||
header.y = z;
|
header.y = z;
|
||||||
header.polyCount = nodeCount;
|
header.polyCount = nodeCount;
|
||||||
|
@ -125,16 +125,16 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
||||||
header.detailMeshCount = nodeCount;
|
header.detailMeshCount = nodeCount;
|
||||||
header.detailTriCount = nodeCount;
|
header.detailTriCount = nodeCount;
|
||||||
header.maxLinkCount = nodeCount * 3 * 2; // XXX: Needed by Recast, not needed by recast4j
|
header.maxLinkCount = nodeCount * 3 * 2; // XXX: Needed by Recast, not needed by recast4j
|
||||||
header.bmin.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x
|
header.bmin.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x +
|
||||||
+ meta.cellSize * meta.tileSizeX * x;
|
meta.cellSize * meta.tileSizeX * x;
|
||||||
header.bmin.Y = ymin;
|
header.bmin.Y = ymin;
|
||||||
header.bmin.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z
|
header.bmin.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z +
|
||||||
+ meta.cellSize * meta.tileSizeZ * z;
|
meta.cellSize * meta.tileSizeZ * z;
|
||||||
header.bmax.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x
|
header.bmax.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x +
|
||||||
+ meta.cellSize * meta.tileSizeX * (x + 1);
|
meta.cellSize * meta.tileSizeX * (x + 1);
|
||||||
header.bmax.Y = ymax;
|
header.bmax.Y = ymax;
|
||||||
header.bmax.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z
|
header.bmax.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z +
|
||||||
+ meta.cellSize * meta.tileSizeZ * (z + 1);
|
meta.cellSize * meta.tileSizeZ * (z + 1);
|
||||||
header.bvQuantFactor = 1.0f / meta.cellSize;
|
header.bvQuantFactor = 1.0f / meta.cellSize;
|
||||||
header.offMeshBase = nodeCount;
|
header.offMeshBase = nodeCount;
|
||||||
header.walkableClimb = meta.walkableClimb;
|
header.walkableClimb = meta.walkableClimb;
|
||||||
|
|
|
@ -25,23 +25,6 @@ namespace DotRecast.Detour
|
||||||
/** Provides high level information related to a dtMeshTile object. */
|
/** Provides high level information related to a dtMeshTile object. */
|
||||||
public class DtMeshHeader
|
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.) */
|
/** Tile magic number. (Used to identify the data format.) */
|
||||||
public int magic;
|
public int magic;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,23 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
public class DtNavMesh
|
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_SALT_BITS = 16;
|
||||||
public const int DT_TILE_BITS = 28;
|
public const int DT_TILE_BITS = 28;
|
||||||
public const int DT_POLY_BITS = 20;
|
public const int DT_POLY_BITS = 20;
|
||||||
|
|
|
@ -423,8 +423,8 @@ namespace DotRecast.Detour
|
||||||
DtOffMeshConnection[] offMeshCons = new DtOffMeshConnection[storedOffMeshConCount];
|
DtOffMeshConnection[] offMeshCons = new DtOffMeshConnection[storedOffMeshConCount];
|
||||||
|
|
||||||
// Store header
|
// Store header
|
||||||
header.magic = DtMeshHeader.DT_NAVMESH_MAGIC;
|
header.magic = DtNavMesh.DT_NAVMESH_MAGIC;
|
||||||
header.version = DtMeshHeader.DT_NAVMESH_VERSION;
|
header.version = DtNavMesh.DT_NAVMESH_VERSION;
|
||||||
header.x = option.tileX;
|
header.x = option.tileX;
|
||||||
header.y = option.tileZ;
|
header.y = option.tileZ;
|
||||||
header.layer = option.tileLayer;
|
header.layer = option.tileLayer;
|
||||||
|
|
|
@ -53,10 +53,10 @@ namespace DotRecast.Detour.Io
|
||||||
DtMeshHeader header = new DtMeshHeader();
|
DtMeshHeader header = new DtMeshHeader();
|
||||||
data.header = header;
|
data.header = header;
|
||||||
header.magic = buf.GetInt();
|
header.magic = buf.GetInt();
|
||||||
if (header.magic != DtMeshHeader.DT_NAVMESH_MAGIC)
|
if (header.magic != DtNavMesh.DT_NAVMESH_MAGIC)
|
||||||
{
|
{
|
||||||
header.magic = IOUtils.SwapEndianness(header.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");
|
throw new IOException("Invalid magic");
|
||||||
}
|
}
|
||||||
|
@ -65,16 +65,16 @@ namespace DotRecast.Detour.Io
|
||||||
}
|
}
|
||||||
|
|
||||||
header.version = buf.GetInt();
|
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
|
if (header.version < DtNavMesh.DT_NAVMESH_VERSION_RECAST4J_FIRST
|
||||||
|| header.version > DtMeshHeader.DT_NAVMESH_VERSION_RECAST4J_LAST)
|
|| header.version > DtNavMesh.DT_NAVMESH_VERSION_RECAST4J_LAST)
|
||||||
{
|
{
|
||||||
throw new IOException("Invalid version " + header.version);
|
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.x = buf.GetInt();
|
||||||
header.y = buf.GetInt();
|
header.y = buf.GetInt();
|
||||||
header.layer = buf.GetInt();
|
header.layer = buf.GetInt();
|
||||||
|
@ -141,7 +141,7 @@ namespace DotRecast.Detour.Io
|
||||||
for (int i = 0; i < polys.Length; i++)
|
for (int i = 0; i < polys.Length; i++)
|
||||||
{
|
{
|
||||||
polys[i] = new DtPoly(i, maxVertPerPoly);
|
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
|
buf.GetInt(); // polys[i].firstLink
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ namespace DotRecast.Detour.Io
|
||||||
for (int i = 0; i < nodes.Length; i++)
|
for (int i = 0; i < nodes.Length; i++)
|
||||||
{
|
{
|
||||||
nodes[i] = new DtBVNode();
|
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++)
|
for (int j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace DotRecast.Detour.Io
|
||||||
{
|
{
|
||||||
DtMeshHeader header = data.header;
|
DtMeshHeader header = data.header;
|
||||||
Write(stream, header.magic, order);
|
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.x, order);
|
||||||
Write(stream, header.y, order);
|
Write(stream, header.y, order);
|
||||||
Write(stream, header.layer, order);
|
Write(stream, header.layer, order);
|
||||||
|
|
Loading…
Reference in New Issue