Changed bmin/bmax from int[] to RcVec3i for improved memory efficiency

This commit is contained in:
ikpil 2024-10-13 16:27:24 +09:00 committed by Ikpil
parent ecc02f12e4
commit ea437ef020
16 changed files with 126 additions and 135 deletions

View File

@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Changed new RcVec3f[3] to stackalloc RcVec3f[3] in DtNavMesh.GetPolyHeight() to reduce heap allocation - Changed new RcVec3f[3] to stackalloc RcVec3f[3] in DtNavMesh.GetPolyHeight() to reduce heap allocation
- Changed memory handling to use stackalloc in DtNavMeshQuery.GetPolyWallSegments for reducing SOH - Changed memory handling to use stackalloc in DtNavMeshQuery.GetPolyWallSegments for reducing SOH
- Changed DtNavMeshQuery.GetPolyWallSegments() to use Span<T> for enhanced performance, memory efficiency. - Changed DtNavMeshQuery.GetPolyWallSegments() to use Span<T> for enhanced performance, memory efficiency.
- Changed bmin/bmax from int[] to RcVec3i for improved memory efficiency
### Removed ### Removed
- Nothing - Nothing

View File

@ -0,0 +1,9 @@
namespace DotRecast.Core.Numerics
{
public struct RcVec3i
{
public int X;
public int Y;
public int Z;
}
}

View File

@ -48,12 +48,12 @@ namespace DotRecast.Detour.Extras
bmax = RcVec3f.Max(bmax, RcVec.Create(data.verts, data.polys[i].verts[j] * 3)); bmax = RcVec3f.Max(bmax, RcVec.Create(data.verts, data.polys[i].verts[j] * 3));
} }
it.bmin[0] = Math.Clamp((int)((bmin.X - data.header.bmin.X) * quantFactor), 0, 0x7fffffff); it.bmin.X = Math.Clamp((int)((bmin.X - data.header.bmin.X) * quantFactor), 0, 0x7fffffff);
it.bmin[1] = Math.Clamp((int)((bmin.Y - data.header.bmin.Y) * quantFactor), 0, 0x7fffffff); it.bmin.Y = Math.Clamp((int)((bmin.Y - data.header.bmin.Y) * quantFactor), 0, 0x7fffffff);
it.bmin[2] = Math.Clamp((int)((bmin.Z - data.header.bmin.Z) * quantFactor), 0, 0x7fffffff); it.bmin.Z = Math.Clamp((int)((bmin.Z - data.header.bmin.Z) * quantFactor), 0, 0x7fffffff);
it.bmax[0] = Math.Clamp((int)((bmax.X - data.header.bmin.X) * quantFactor), 0, 0x7fffffff); it.bmax.X = Math.Clamp((int)((bmax.X - data.header.bmin.X) * quantFactor), 0, 0x7fffffff);
it.bmax[1] = Math.Clamp((int)((bmax.Y - data.header.bmin.Y) * quantFactor), 0, 0x7fffffff); it.bmax.Y = Math.Clamp((int)((bmax.Y - data.header.bmin.Y) * quantFactor), 0, 0x7fffffff);
it.bmax[2] = Math.Clamp((int)((bmax.Z - data.header.bmin.Z) * quantFactor), 0, 0x7fffffff); it.bmax.Z = Math.Clamp((int)((bmax.Z - data.header.bmin.Z) * quantFactor), 0, 0x7fffffff);
} }
return DtNavMeshBuilder.Subdivide(items, data.header.polyCount, 0, data.header.polyCount, 0, nodes); return DtNavMeshBuilder.Subdivide(items, data.header.polyCount, 0, data.header.polyCount, 0, nodes);

View File

@ -1,9 +1,11 @@
using DotRecast.Core.Numerics;
namespace DotRecast.Detour namespace DotRecast.Detour
{ {
public class BVItem public class BVItem
{ {
public readonly int[] bmin = new int[3]; public RcVec3i bmin;
public readonly int[] bmax = new int[3]; public RcVec3i bmax;
public int i; public int i;
}; };
} }

View File

@ -12,7 +12,7 @@ namespace DotRecast.Detour
public int Compare(BVItem a, BVItem b) public int Compare(BVItem a, BVItem b)
{ {
return a.bmin[0].CompareTo(b.bmin[0]); return a.bmin.X.CompareTo(b.bmin.X);
} }
} }
} }

View File

@ -12,7 +12,7 @@ namespace DotRecast.Detour
public int Compare(BVItem a, BVItem b) public int Compare(BVItem a, BVItem b)
{ {
return a.bmin[1].CompareTo(b.bmin[1]); return a.bmin.Y.CompareTo(b.bmin.Y);
} }
} }
} }

View File

@ -12,7 +12,7 @@ namespace DotRecast.Detour
public int Compare(BVItem a, BVItem b) public int Compare(BVItem a, BVItem b)
{ {
return a.bmin[2].CompareTo(b.bmin[2]); return a.bmin.Z.CompareTo(b.bmin.Z);
} }
} }
} }

View File

@ -18,6 +18,8 @@ freely, subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
using DotRecast.Core.Numerics;
namespace DotRecast.Detour namespace DotRecast.Detour
{ {
/// Bounding volume node. /// Bounding volume node.
@ -25,8 +27,8 @@ namespace DotRecast.Detour
/// @see dtMeshTile /// @see dtMeshTile
public class DtBVNode public class DtBVNode
{ {
public int[] bmin = new int[3]; //< Minimum bounds of the node's AABB. [(x, y, z)] public RcVec3i bmin; //< Minimum bounds of the node's AABB. [(x, y, z)]
public int[] bmax = new int[3]; //< Maximum bounds of the node's AABB. [(x, y, z)] public RcVec3i bmax; //< Maximum bounds of the node's AABB. [(x, y, z)]
public int i; //< The node's index. (Negative for escape sequence.) public int i; //< The node's index. (Negative for escape sequence.)
} }
} }

View File

@ -259,8 +259,8 @@ namespace DotRecast.Detour
var tbmax = tile.data.header.bmax; var tbmax = tile.data.header.bmax;
float qfac = tile.data.header.bvQuantFactor; float qfac = tile.data.header.bvQuantFactor;
// Calculate quantized box // Calculate quantized box
Span<int> bmin = stackalloc int[3]; RcVec3i bmin;
Span<int> bmax = stackalloc int[3]; RcVec3i bmax;
// dtClamp query box to world box. // dtClamp query box to world box.
float minx = Math.Clamp(qmin.X, tbmin.X, tbmax.X) - tbmin.X; float minx = Math.Clamp(qmin.X, tbmin.X, tbmax.X) - tbmin.X;
float miny = Math.Clamp(qmin.Y, tbmin.Y, tbmax.Y) - tbmin.Y; float miny = Math.Clamp(qmin.Y, tbmin.Y, tbmax.Y) - tbmin.Y;
@ -269,12 +269,12 @@ namespace DotRecast.Detour
float maxy = Math.Clamp(qmax.Y, tbmin.Y, tbmax.Y) - tbmin.Y; float maxy = Math.Clamp(qmax.Y, tbmin.Y, tbmax.Y) - tbmin.Y;
float maxz = Math.Clamp(qmax.Z, tbmin.Z, tbmax.Z) - tbmin.Z; float maxz = Math.Clamp(qmax.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
// Quantize // Quantize
bmin[0] = (int)(qfac * minx) & 0x7ffffffe; bmin.X = (int)(qfac * minx) & 0x7ffffffe;
bmin[1] = (int)(qfac * miny) & 0x7ffffffe; bmin.Y = (int)(qfac * miny) & 0x7ffffffe;
bmin[2] = (int)(qfac * minz) & 0x7ffffffe; bmin.Z = (int)(qfac * minz) & 0x7ffffffe;
bmax[0] = (int)(qfac * maxx + 1) | 1; bmax.X = (int)(qfac * maxx + 1) | 1;
bmax[1] = (int)(qfac * maxy + 1) | 1; bmax.Y = (int)(qfac * maxy + 1) | 1;
bmax[2] = (int)(qfac * maxz + 1) | 1; bmax.Z = (int)(qfac * maxz + 1) | 1;
// Traverse tree // Traverse tree
long @base = GetPolyRefBase(tile); long @base = GetPolyRefBase(tile);
@ -282,7 +282,7 @@ namespace DotRecast.Detour
while (nodeIndex < end) while (nodeIndex < end)
{ {
DtBVNode node = tile.data.bvTree[nodeIndex]; DtBVNode node = tile.data.bvTree[nodeIndex];
bool overlap = DtUtils.OverlapQuantBounds(bmin, bmax, node.bmin, node.bmax); bool overlap = DtUtils.OverlapQuantBounds(ref bmin, ref bmax, ref node.bmin, ref node.bmax);
bool isLeafNode = node.i >= 0; bool isLeafNode = node.i >= 0;
if (isLeafNode && overlap) if (isLeafNode && overlap)

View File

@ -31,37 +31,28 @@ namespace DotRecast.Detour
const int MESH_NULL_IDX = 0xffff; const int MESH_NULL_IDX = 0xffff;
private static int[][] CalcExtends(BVItem[] items, int nitems, int imin, int imax) private static void CalcExtends(BVItem[] items, int nitems, int imin, int imax, ref RcVec3i bmin, ref RcVec3i bmax)
{ {
int[] bmin = new int[3]; bmin = items[imin].bmin;
int[] bmax = new int[3]; bmax = items[imin].bmax;
bmin[0] = items[imin].bmin[0];
bmin[1] = items[imin].bmin[1];
bmin[2] = items[imin].bmin[2];
bmax[0] = items[imin].bmax[0];
bmax[1] = items[imin].bmax[1];
bmax[2] = items[imin].bmax[2];
for (int i = imin + 1; i < imax; ++i) for (int i = imin + 1; i < imax; ++i)
{ {
BVItem it = items[i]; BVItem it = items[i];
if (it.bmin[0] < bmin[0]) if (it.bmin.X < bmin.X)
bmin[0] = it.bmin[0]; bmin.X = it.bmin.X;
if (it.bmin[1] < bmin[1]) if (it.bmin.Y < bmin.Y)
bmin[1] = it.bmin[1]; bmin.Y = it.bmin.Y;
if (it.bmin[2] < bmin[2]) if (it.bmin.Z < bmin.Z)
bmin[2] = it.bmin[2]; bmin.Z = it.bmin.Z;
if (it.bmax[0] > bmax[0]) if (it.bmax.X > bmax.X)
bmax[0] = it.bmax[0]; bmax.X = it.bmax.X;
if (it.bmax[1] > bmax[1]) if (it.bmax.Y > bmax.Y)
bmax[1] = it.bmax[1]; bmax.Y = it.bmax.Y;
if (it.bmax[2] > bmax[2]) if (it.bmax.Z > bmax.Z)
bmax[2] = it.bmax[2]; bmax.Z = it.bmax.Z;
} }
return new int[][] { bmin, bmax };
} }
private static int LongestAxis(int x, int y, int z) private static int LongestAxis(int x, int y, int z)
@ -94,27 +85,20 @@ namespace DotRecast.Detour
if (inum == 1) if (inum == 1)
{ {
// Leaf // Leaf
node.bmin[0] = items[imin].bmin[0]; node.bmin = items[imin].bmin;
node.bmin[1] = items[imin].bmin[1]; node.bmax = items[imin].bmax;
node.bmin[2] = items[imin].bmin[2];
node.bmax[0] = items[imin].bmax[0];
node.bmax[1] = items[imin].bmax[1];
node.bmax[2] = items[imin].bmax[2];
node.i = items[imin].i; node.i = items[imin].i;
} }
else else
{ {
// Split // Split
int[][] minmax = CalcExtends(items, nitems, imin, imax); CalcExtends(items, nitems, imin, imax, ref node.bmin, ref node.bmax);
node.bmin = minmax[0];
node.bmax = minmax[1];
int axis = LongestAxis( int axis = LongestAxis(
node.bmax[0] - node.bmin[0], node.bmax.X - node.bmin.X,
node.bmax[1] - node.bmin[1], node.bmax.Y - node.bmin.Y,
node.bmax[2] - node.bmin[2] node.bmax.Z - node.bmin.Z
); );
if (axis == 0) if (axis == 0)
@ -173,20 +157,20 @@ namespace DotRecast.Detour
} }
// BV-tree uses cs for all dimensions // BV-tree uses cs for all dimensions
it.bmin[0] = Math.Clamp((int)((bmin.X - option.bmin.X) * quantFactor), 0, int.MaxValue); it.bmin.X = Math.Clamp((int)((bmin.X - option.bmin.X) * quantFactor), 0, int.MaxValue);
it.bmin[1] = Math.Clamp((int)((bmin.Y - option.bmin.Y) * quantFactor), 0, int.MaxValue); it.bmin.Y = Math.Clamp((int)((bmin.Y - option.bmin.Y) * quantFactor), 0, int.MaxValue);
it.bmin[2] = Math.Clamp((int)((bmin.Z - option.bmin.Z) * quantFactor), 0, int.MaxValue); it.bmin.Z = Math.Clamp((int)((bmin.Z - option.bmin.Z) * quantFactor), 0, int.MaxValue);
it.bmax[0] = Math.Clamp((int)((bmax.X - option.bmin.X) * quantFactor), 0, int.MaxValue); it.bmax.X = Math.Clamp((int)((bmax.X - option.bmin.X) * quantFactor), 0, int.MaxValue);
it.bmax[1] = Math.Clamp((int)((bmax.Y - option.bmin.Y) * quantFactor), 0, int.MaxValue); it.bmax.Y = Math.Clamp((int)((bmax.Y - option.bmin.Y) * quantFactor), 0, int.MaxValue);
it.bmax[2] = Math.Clamp((int)((bmax.Z - option.bmin.Z) * quantFactor), 0, int.MaxValue); it.bmax.Z = Math.Clamp((int)((bmax.Z - option.bmin.Z) * quantFactor), 0, int.MaxValue);
} }
else else
{ {
int p = i * option.nvp * 2; int p = i * option.nvp * 2;
it.bmin[0] = it.bmax[0] = option.verts[option.polys[p] * 3 + 0]; it.bmin.X = it.bmax.X = option.verts[option.polys[p] * 3 + 0];
it.bmin[1] = it.bmax[1] = option.verts[option.polys[p] * 3 + 1]; it.bmin.Y = it.bmax.Y = option.verts[option.polys[p] * 3 + 1];
it.bmin[2] = it.bmax[2] = option.verts[option.polys[p] * 3 + 2]; it.bmin.Z = it.bmax.Z = option.verts[option.polys[p] * 3 + 2];
for (int j = 1; j < option.nvp; ++j) for (int j = 1; j < option.nvp; ++j)
{ {
@ -196,24 +180,24 @@ namespace DotRecast.Detour
int y = option.verts[option.polys[p + j] * 3 + 1]; int y = option.verts[option.polys[p + j] * 3 + 1];
int z = option.verts[option.polys[p + j] * 3 + 2]; int z = option.verts[option.polys[p + j] * 3 + 2];
if (x < it.bmin[0]) if (x < it.bmin.X)
it.bmin[0] = x; it.bmin.X = x;
if (y < it.bmin[1]) if (y < it.bmin.Y)
it.bmin[1] = y; it.bmin.Y = y;
if (z < it.bmin[2]) if (z < it.bmin.Z)
it.bmin[2] = z; it.bmin.Z = z;
if (x > it.bmax[0]) if (x > it.bmax.X)
it.bmax[0] = x; it.bmax.X = x;
if (y > it.bmax[1]) if (y > it.bmax.Y)
it.bmax[1] = y; it.bmax.Y = y;
if (z > it.bmax[2]) if (z > it.bmax.Z)
it.bmax[2] = z; it.bmax.Z = z;
} }
// Remap y // Remap y
it.bmin[1] = (int)MathF.Floor(it.bmin[1] * option.ch * quantFactor); it.bmin.Y = (int)MathF.Floor(it.bmin.Y * option.ch * quantFactor);
it.bmax[1] = (int)MathF.Ceiling(it.bmax[1] * option.ch * quantFactor); it.bmax.Y = (int)MathF.Ceiling(it.bmax.Y * option.ch * quantFactor);
} }
} }

View File

@ -609,8 +609,8 @@ namespace DotRecast.Detour
float qfac = tile.data.header.bvQuantFactor; float qfac = tile.data.header.bvQuantFactor;
// Calculate quantized box // Calculate quantized box
Span<int> bmin = stackalloc int[3]; RcVec3i bmin;
Span<int> bmax = stackalloc int[3]; RcVec3i bmax;
// dtClamp query box to world box. // dtClamp query box to world box.
float minx = Math.Clamp(qmin.X, tbmin.X, tbmax.X) - tbmin.X; float minx = Math.Clamp(qmin.X, tbmin.X, tbmax.X) - tbmin.X;
float miny = Math.Clamp(qmin.Y, tbmin.Y, tbmax.Y) - tbmin.Y; float miny = Math.Clamp(qmin.Y, tbmin.Y, tbmax.Y) - tbmin.Y;
@ -619,19 +619,19 @@ namespace DotRecast.Detour
float maxy = Math.Clamp(qmax.Y, tbmin.Y, tbmax.Y) - tbmin.Y; float maxy = Math.Clamp(qmax.Y, tbmin.Y, tbmax.Y) - tbmin.Y;
float maxz = Math.Clamp(qmax.Z, tbmin.Z, tbmax.Z) - tbmin.Z; float maxz = Math.Clamp(qmax.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
// Quantize // Quantize
bmin[0] = (int)(qfac * minx) & 0x7ffffffe; bmin.X = (int)(qfac * minx) & 0x7ffffffe;
bmin[1] = (int)(qfac * miny) & 0x7ffffffe; bmin.Y = (int)(qfac * miny) & 0x7ffffffe;
bmin[2] = (int)(qfac * minz) & 0x7ffffffe; bmin.Z = (int)(qfac * minz) & 0x7ffffffe;
bmax[0] = (int)(qfac * maxx + 1) | 1; bmax.X = (int)(qfac * maxx + 1) | 1;
bmax[1] = (int)(qfac * maxy + 1) | 1; bmax.Y = (int)(qfac * maxy + 1) | 1;
bmax[2] = (int)(qfac * maxz + 1) | 1; bmax.Z = (int)(qfac * maxz + 1) | 1;
// Traverse tree // Traverse tree
long @base = m_nav.GetPolyRefBase(tile); long @base = m_nav.GetPolyRefBase(tile);
while (nodeIndex < end) while (nodeIndex < end)
{ {
DtBVNode node = tile.data.bvTree[nodeIndex]; DtBVNode node = tile.data.bvTree[nodeIndex];
bool overlap = DtUtils.OverlapQuantBounds(bmin, bmax, node.bmin, node.bmax); bool overlap = DtUtils.OverlapQuantBounds(ref bmin, ref bmax, ref node.bmin, ref node.bmax);
bool isLeafNode = node.i >= 0; bool isLeafNode = node.i >= 0;
if (isLeafNode && overlap) if (isLeafNode && overlap)

View File

@ -43,12 +43,12 @@ namespace DotRecast.Detour
/// @param[in] bmax Maximum bounds of box B. [(x, y, z)] /// @param[in] bmax Maximum bounds of box B. [(x, y, z)]
/// @return True if the two AABB's overlap. /// @return True if the two AABB's overlap.
/// @see dtOverlapBounds /// @see dtOverlapBounds
public static bool OverlapQuantBounds(Span<int> amin, Span<int> amax, Span<int> bmin, Span<int> bmax) public static bool OverlapQuantBounds(ref RcVec3i amin, ref RcVec3i amax, ref RcVec3i bmin, ref RcVec3i bmax)
{ {
bool overlap = true; bool overlap = true;
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap; overlap = (amin.X > bmax.X || amax.X < bmin.X) ? false : overlap;
overlap = (amin[1] > bmax[1] || amax[1] < bmin[1]) ? false : overlap; overlap = (amin.Y > bmax.Y || amax.Y < bmin.Y) ? false : overlap;
overlap = (amin[2] > bmax[2] || amax[2] < bmin[2]) ? false : overlap; overlap = (amin.Z > bmax.Z || amax.Z < bmin.Z) ? false : overlap;
return overlap; return overlap;
} }

View File

@ -204,27 +204,23 @@ namespace DotRecast.Detour.Io
nodes[i] = new DtBVNode(); nodes[i] = new DtBVNode();
if (header.version < DT_NAVMESH_VERSION_RECAST4J_32BIT_BVTREE) if (header.version < DT_NAVMESH_VERSION_RECAST4J_32BIT_BVTREE)
{ {
for (int j = 0; j < 3; j++) nodes[i].bmin.X = buf.GetShort() & 0xFFFF;
{ nodes[i].bmin.Y = buf.GetShort() & 0xFFFF;
nodes[i].bmin[j] = buf.GetShort() & 0xFFFF; nodes[i].bmin.Z = buf.GetShort() & 0xFFFF;
}
for (int j = 0; j < 3; j++) nodes[i].bmax.X = buf.GetShort() & 0xFFFF;
{ nodes[i].bmax.Y = buf.GetShort() & 0xFFFF;
nodes[i].bmax[j] = buf.GetShort() & 0xFFFF; nodes[i].bmax.Z = buf.GetShort() & 0xFFFF;
}
} }
else else
{ {
for (int j = 0; j < 3; j++) nodes[i].bmin.X = buf.GetInt();
{ nodes[i].bmin.Y = buf.GetInt();
nodes[i].bmin[j] = buf.GetInt(); nodes[i].bmin.Z = buf.GetInt();
}
for (int j = 0; j < 3; j++) nodes[i].bmax.X = buf.GetInt();
{ nodes[i].bmax.Y = buf.GetInt();
nodes[i].bmax[j] = buf.GetInt(); nodes[i].bmax.Z = buf.GetInt();
}
} }
nodes[i].i = buf.GetInt(); nodes[i].i = buf.GetInt();

View File

@ -130,27 +130,23 @@ namespace DotRecast.Detour.Io
{ {
if (cCompatibility) if (cCompatibility)
{ {
for (int j = 0; j < 3; j++) RcIO.Write(stream, (short)data.bvTree[i].bmin.X, order);
{ RcIO.Write(stream, (short)data.bvTree[i].bmin.Y, order);
RcIO.Write(stream, (short)data.bvTree[i].bmin[j], order); RcIO.Write(stream, (short)data.bvTree[i].bmin.Z, order);
}
for (int j = 0; j < 3; j++) RcIO.Write(stream, (short)data.bvTree[i].bmax.X, order);
{ RcIO.Write(stream, (short)data.bvTree[i].bmax.Y, order);
RcIO.Write(stream, (short)data.bvTree[i].bmax[j], order); RcIO.Write(stream, (short)data.bvTree[i].bmax.Z, order);
}
} }
else else
{ {
for (int j = 0; j < 3; j++) RcIO.Write(stream, data.bvTree[i].bmin.X, order);
{ RcIO.Write(stream, data.bvTree[i].bmin.Y, order);
RcIO.Write(stream, data.bvTree[i].bmin[j], order); RcIO.Write(stream, data.bvTree[i].bmin.Z, order);
}
for (int j = 0; j < 3; j++) RcIO.Write(stream, data.bvTree[i].bmax.X, order);
{ RcIO.Write(stream, data.bvTree[i].bmax.Y, order);
RcIO.Write(stream, data.bvTree[i].bmax[j], order); RcIO.Write(stream, data.bvTree[i].bmax.Z, order);
}
} }
RcIO.Write(stream, data.bvTree[i].i, order); RcIO.Write(stream, data.bvTree[i].i, order);

View File

@ -465,9 +465,13 @@ public class RecastDebugDraw : DebugDraw
continue; continue;
} }
AppendBoxWire(tile.data.header.bmin.X + n.bmin[0] * cs, tile.data.header.bmin.Y + n.bmin[1] * cs, AppendBoxWire(
tile.data.header.bmin.Z + n.bmin[2] * cs, tile.data.header.bmin.X + n.bmax[0] * cs, tile.data.header.bmin.X + n.bmin.X * cs,
tile.data.header.bmin.Y + n.bmax[1] * cs, tile.data.header.bmin.Z + n.bmax[2] * cs, tile.data.header.bmin.Y + n.bmin.Y * cs,
tile.data.header.bmin.Z + n.bmin.Z * cs,
tile.data.header.bmin.X + n.bmax.X * cs,
tile.data.header.bmin.Y + n.bmax.Y * cs,
tile.data.header.bmin.Z + n.bmax.Z * cs,
DuRGBA(255, 255, 255, 128)); DuRGBA(255, 255, 255, 128));
} }

View File

@ -117,11 +117,8 @@ public class MeshDataReaderWriterTest
for (int i = 0; i < meshData.header.bvNodeCount; i++) for (int i = 0; i < meshData.header.bvNodeCount; i++)
{ {
Assert.That(readData.bvTree[i].i, Is.EqualTo(meshData.bvTree[i].i)); Assert.That(readData.bvTree[i].i, Is.EqualTo(meshData.bvTree[i].i));
for (int j = 0; j < 3; j++) Assert.That(readData.bvTree[i].bmin, Is.EqualTo(meshData.bvTree[i].bmin));
{ Assert.That(readData.bvTree[i].bmax, Is.EqualTo(meshData.bvTree[i].bmax));
Assert.That(readData.bvTree[i].bmin[j], Is.EqualTo(meshData.bvTree[i].bmin[j]));
Assert.That(readData.bvTree[i].bmax[j], Is.EqualTo(meshData.bvTree[i].bmax[j]));
}
} }
for (int i = 0; i < meshData.header.offMeshConCount; i++) for (int i = 0; i < meshData.header.offMeshConCount; i++)