forked from bit/DotRecastNetSim
refactor: remove RcVec3f.Of(x,y,z)
This commit is contained in:
parent
adfded5a94
commit
228bdc9e4d
|
@ -40,20 +40,15 @@ namespace DotRecast.Core
|
|||
|
||||
public static RcVec3f Of(float[] f, int idx)
|
||||
{
|
||||
return Of(f[idx + 0], f[idx + 1], f[idx + 2]);
|
||||
}
|
||||
|
||||
public static RcVec3f Of(float x, float y, float z)
|
||||
{
|
||||
return new RcVec3f(x, y, z);
|
||||
return new RcVec3f(f[idx + 0], f[idx + 1], f[idx + 2]);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public RcVec3f(float x, float y, float z)
|
||||
{
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
this.Z = z;
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
@ -343,7 +343,7 @@ namespace DotRecast.Detour.Crowd
|
|||
{
|
||||
for (int x = 0; x < m_params.gridSize; ++x)
|
||||
{
|
||||
RcVec3f vcand = RcVec3f.Of(cvx + x * cs - half, 0f, cvz + y * cs - half);
|
||||
RcVec3f vcand = new RcVec3f(cvx + x * cs - half, 0f, cvz + y * cs - half);
|
||||
if (RcMath.Sqr(vcand.X) + RcMath.Sqr(vcand.Z) > RcMath.Sqr(vmax + cs / 2))
|
||||
continue;
|
||||
|
||||
|
@ -463,7 +463,7 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
// Start sampling.
|
||||
float cr = vmax * (1.0f - m_params.velBias);
|
||||
RcVec3f res = RcVec3f.Of(dvel.X * m_params.velBias, 0, dvel.Z * m_params.velBias);
|
||||
RcVec3f res = new RcVec3f(dvel.X * m_params.velBias, 0, dvel.Z * m_params.velBias);
|
||||
int ns = 0;
|
||||
for (int k = 0; k < depth; ++k)
|
||||
{
|
||||
|
@ -473,7 +473,7 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
for (int i = 0; i < npat; ++i)
|
||||
{
|
||||
RcVec3f vcand = RcVec3f.Of(res.X + pat[i * 2 + 0] * cr, 0f, res.Z + pat[i * 2 + 1] * cr);
|
||||
RcVec3f vcand = new RcVec3f(res.X + pat[i * 2 + 0] * cr, 0f, res.Z + pat[i * 2 + 1] * cr);
|
||||
if (RcMath.Sqr(vcand.X) + RcMath.Sqr(vcand.Z) > RcMath.Sqr(vmax + 0.001f))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace DotRecast.Detour.Dynamic.Colliders
|
|||
RcVec3f[] halfEdges =
|
||||
{
|
||||
RcVec3f.Zero,
|
||||
RcVec3f.Of(up.X, up.Y, up.Z),
|
||||
new RcVec3f(up.X, up.Y, up.Z),
|
||||
RcVec3f.Zero
|
||||
};
|
||||
RcVec3f.Normalize(ref halfEdges[1]);
|
||||
|
|
|
@ -1772,8 +1772,8 @@ namespace DotRecast.Detour
|
|||
|
||||
public void ComputeBounds(out RcVec3f bmin, out RcVec3f bmax)
|
||||
{
|
||||
bmin = RcVec3f.Of(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
|
||||
bmax = RcVec3f.Of(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity);
|
||||
bmin = new RcVec3f(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
|
||||
bmax = new RcVec3f(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity);
|
||||
for (int t = 0; t < GetMaxTiles(); ++t)
|
||||
{
|
||||
DtMeshTile tile = GetTile(t);
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace DotRecast.Detour
|
|||
int va = j * 3;
|
||||
int vb = i * 3;
|
||||
|
||||
RcVec3f n = RcVec3f.Of(polya[vb + 2] - polya[va + 2], 0, -(polya[vb + 0] - polya[va + 0]));
|
||||
RcVec3f n = new RcVec3f(polya[vb + 2] - polya[va + 2], 0, -(polya[vb + 0] - polya[va + 0]));
|
||||
|
||||
RcVec2f aminmax = ProjectPoly(n, polya, npolya);
|
||||
RcVec2f bminmax = ProjectPoly(n, polyb, npolyb);
|
||||
|
@ -120,7 +120,7 @@ namespace DotRecast.Detour
|
|||
int va = j * 3;
|
||||
int vb = i * 3;
|
||||
|
||||
RcVec3f n = RcVec3f.Of(polyb[vb + 2] - polyb[va + 2], 0, -(polyb[vb + 0] - polyb[va + 0]));
|
||||
RcVec3f n = new RcVec3f(polyb[vb + 2] - polyb[va + 2], 0, -(polyb[vb + 0] - polyb[va + 0]));
|
||||
|
||||
RcVec2f aminmax = ProjectPoly(n, polya, npolya);
|
||||
RcVec2f bminmax = ProjectPoly(n, polyb, npolyb);
|
||||
|
|
|
@ -461,8 +461,8 @@ public class DebugDraw
|
|||
Vertex(x1, y1, z1, col);
|
||||
|
||||
// End arrows
|
||||
RcVec3f p = RcVec3f.Of(x0, y0, z0);
|
||||
RcVec3f q = RcVec3f.Of(x1, y1, z1);
|
||||
RcVec3f p = new RcVec3f(x0, y0, z0);
|
||||
RcVec3f q = new RcVec3f(x1, y1, z1);
|
||||
if (as0 > 0.001f)
|
||||
AppendArrowHead(p, q, as0, col);
|
||||
if (as1 > 0.001f)
|
||||
|
@ -478,7 +478,7 @@ public class DebugDraw
|
|||
}
|
||||
|
||||
RcVec3f ax = new RcVec3f();
|
||||
RcVec3f ay = RcVec3f.Of(0, 1, 0);
|
||||
RcVec3f ay = new RcVec3f(0, 1, 0);
|
||||
RcVec3f az = new RcVec3f();
|
||||
Vsub(ref az, q, p);
|
||||
Vnormalize(ref az);
|
||||
|
|
|
@ -260,8 +260,8 @@ public class NavMeshRenderer
|
|||
int col = DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 32);
|
||||
for (int j = 0, k = vol.verts.Length - 3; j < vol.verts.Length; k = j, j += 3)
|
||||
{
|
||||
var va = RcVec3f.Of(vol.verts[k], vol.verts[k + 1], vol.verts[k + 2]);
|
||||
var vb = RcVec3f.Of(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
|
||||
var va = new RcVec3f(vol.verts[k], vol.verts[k + 1], vol.verts[k + 2]);
|
||||
var vb = new RcVec3f(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
|
||||
|
||||
_debugDraw.Vertex(vol.verts[0], vol.hmax, vol.verts[2], col);
|
||||
_debugDraw.Vertex(vb.X, vol.hmax, vb.Z, col);
|
||||
|
@ -285,8 +285,8 @@ public class NavMeshRenderer
|
|||
int col = DebugDraw.DuTransCol(DebugDraw.AreaToCol(vol.areaMod.GetMaskedValue()), 220);
|
||||
for (int j = 0, k = vol.verts.Length - 3; j < vol.verts.Length; k = j, j += 3)
|
||||
{
|
||||
var va = RcVec3f.Of(vol.verts[k], vol.verts[k + 1], vol.verts[k + 2]);
|
||||
var vb = RcVec3f.Of(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
|
||||
var va = new RcVec3f(vol.verts[k], vol.verts[k + 1], vol.verts[k + 2]);
|
||||
var vb = new RcVec3f(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
|
||||
_debugDraw.Vertex(va.X, vol.hmin, va.Z, DebugDraw.DuDarkenCol(col));
|
||||
_debugDraw.Vertex(vb.X, vol.hmin, vb.Z, DebugDraw.DuDarkenCol(col));
|
||||
_debugDraw.Vertex(va.X, vol.hmax, va.Z, col);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
Begin(DebugDrawPrimitives.TRIS);
|
||||
for (int i = 0; i < tris.Length; i += 3)
|
||||
{
|
||||
RcVec3f norm = RcVec3f.Of(normals[i], normals[i + 1], normals[i + 2]);
|
||||
RcVec3f norm = new RcVec3f(normals[i], normals[i + 1], normals[i + 2]);
|
||||
|
||||
int color;
|
||||
char a = (char)(220 * (2 + norm.X + norm.Y) / 4);
|
||||
|
@ -65,9 +65,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
color = DuRGBA(a, a, a, 255);
|
||||
}
|
||||
|
||||
RcVec3f va = RcVec3f.Of(verts[tris[i] * 3], verts[tris[i] * 3 + 1], verts[tris[i] * 3 + 2]);
|
||||
RcVec3f vb = RcVec3f.Of(verts[tris[i + 1] * 3], verts[tris[i + 1] * 3 + 1], verts[tris[i + 1] * 3 + 2]);
|
||||
RcVec3f vc = RcVec3f.Of(verts[tris[i + 2] * 3], verts[tris[i + 2] * 3 + 1], verts[tris[i + 2] * 3 + 2]);
|
||||
RcVec3f va = new RcVec3f(verts[tris[i] * 3], verts[tris[i] * 3 + 1], verts[tris[i] * 3 + 2]);
|
||||
RcVec3f vb = new RcVec3f(verts[tris[i + 1] * 3], verts[tris[i + 1] * 3 + 1], verts[tris[i + 1] * 3 + 2]);
|
||||
RcVec3f vc = new RcVec3f(verts[tris[i + 2] * 3], verts[tris[i + 2] * 3 + 1], verts[tris[i + 2] * 3 + 2]);
|
||||
|
||||
int ax = 0, ay = 0;
|
||||
if (Math.Abs(norm.Y) > Math.Abs(norm[ax]))
|
||||
|
@ -187,11 +187,11 @@ public class RecastDebugDraw : DebugDraw
|
|||
}
|
||||
|
||||
DtOffMeshConnection con = tile.data.offMeshCons[i - tile.data.header.offMeshBase];
|
||||
RcVec3f va = RcVec3f.Of(
|
||||
RcVec3f va = new RcVec3f(
|
||||
tile.data.verts[p.verts[0] * 3], tile.data.verts[p.verts[0] * 3 + 1],
|
||||
tile.data.verts[p.verts[0] * 3 + 2]
|
||||
);
|
||||
RcVec3f vb = RcVec3f.Of(
|
||||
RcVec3f vb = new RcVec3f(
|
||||
tile.data.verts[p.verts[1] * 3], tile.data.verts[p.verts[1] * 3 + 1],
|
||||
tile.data.verts[p.verts[1] * 3 + 2]
|
||||
);
|
||||
|
@ -354,11 +354,11 @@ public class RecastDebugDraw : DebugDraw
|
|||
}
|
||||
}
|
||||
|
||||
var v0 = RcVec3f.Of(
|
||||
var v0 = new RcVec3f(
|
||||
tile.data.verts[p.verts[j] * 3], tile.data.verts[p.verts[j] * 3 + 1],
|
||||
tile.data.verts[p.verts[j] * 3 + 2]
|
||||
);
|
||||
var v1 = RcVec3f.Of(
|
||||
var v1 = new RcVec3f(
|
||||
tile.data.verts[p.verts[(j + 1) % nj] * 3],
|
||||
tile.data.verts[p.verts[(j + 1) % nj] * 3 + 1],
|
||||
tile.data.verts[p.verts[(j + 1) % nj] * 3 + 2]
|
||||
|
@ -378,14 +378,14 @@ public class RecastDebugDraw : DebugDraw
|
|||
int v = tile.data.detailTris[t + m];
|
||||
if (v < p.vertCount)
|
||||
{
|
||||
tv[m] = RcVec3f.Of(
|
||||
tv[m] = new RcVec3f(
|
||||
tile.data.verts[p.verts[v] * 3], tile.data.verts[p.verts[v] * 3 + 1],
|
||||
tile.data.verts[p.verts[v] * 3 + 2]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
tv[m] = RcVec3f.Of(
|
||||
tv[m] = new RcVec3f(
|
||||
tile.data.detailVerts[(pd.vertBase + (v - p.vertCount)) * 3],
|
||||
tile.data.detailVerts[(pd.vertBase + (v - p.vertCount)) * 3 + 1],
|
||||
tile.data.detailVerts[(pd.vertBase + (v - p.vertCount)) * 3 + 2]
|
||||
|
@ -1348,11 +1348,11 @@ public class RecastDebugDraw : DebugDraw
|
|||
continue;
|
||||
|
||||
// Create new links
|
||||
var va = RcVec3f.Of(
|
||||
var va = new RcVec3f(
|
||||
tile.data.verts[poly.verts[j] * 3],
|
||||
tile.data.verts[poly.verts[j] * 3 + 1], tile.data.verts[poly.verts[j] * 3 + 2]
|
||||
);
|
||||
var vb = RcVec3f.Of(
|
||||
var vb = new RcVec3f(
|
||||
tile.data.verts[poly.verts[(j + 1) % nv] * 3],
|
||||
tile.data.verts[poly.verts[(j + 1) % nv] * 3 + 1],
|
||||
tile.data.verts[poly.verts[(j + 1) % nv] * 3 + 2]
|
||||
|
|
|
@ -91,7 +91,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
private RcVec3f origCameraPos = new RcVec3f();
|
||||
|
||||
private RcVec2f cameraEulers = new RcVec2f(45, -45);
|
||||
private RcVec3f cameraPos = RcVec3f.Of(0, 0, 0);
|
||||
private RcVec3f cameraPos = new RcVec3f(0, 0, 0);
|
||||
|
||||
|
||||
private float[] projectionMatrix = new float[16];
|
||||
|
@ -542,17 +542,17 @@ public class RecastDemo : IRecastDemoChannel
|
|||
{
|
||||
if (!hasBound)
|
||||
{
|
||||
bminN = RcVec3f.Of(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
|
||||
bmaxN = RcVec3f.Of(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity);
|
||||
bminN = new RcVec3f(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
|
||||
bmaxN = new RcVec3f(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity);
|
||||
}
|
||||
|
||||
bminN = RcVec3f.Of(
|
||||
bminN = new RcVec3f(
|
||||
Math.Min(bminN.X, result.GetSolidHeightfield().bmin.X),
|
||||
Math.Min(bminN.Y, result.GetSolidHeightfield().bmin.Y),
|
||||
Math.Min(bminN.Z, result.GetSolidHeightfield().bmin.Z)
|
||||
);
|
||||
|
||||
bmaxN = RcVec3f.Of(
|
||||
bmaxN = new RcVec3f(
|
||||
Math.Max(bmaxN.X, result.GetSolidHeightfield().bmax.X),
|
||||
Math.Max(bmaxN.Y, result.GetSolidHeightfield().bmax.Y),
|
||||
Math.Max(bmaxN.Z, result.GetSolidHeightfield().bmax.Z)
|
||||
|
@ -784,7 +784,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
hit = RcPolyMeshRaycast.Raycast(_sample.GetRecastResults(), rayStart, rayEnd, out hitTime);
|
||||
}
|
||||
|
||||
RcVec3f rayDir = RcVec3f.Of(rayEnd.X - rayStart.X, rayEnd.Y - rayStart.Y, rayEnd.Z - rayStart.Z);
|
||||
RcVec3f rayDir = new RcVec3f(rayEnd.X - rayStart.X, rayEnd.Y - rayStart.Y, rayEnd.Z - rayStart.Z);
|
||||
ISampleTool raySampleTool = toolset.GetTool();
|
||||
rayDir.Normalize();
|
||||
if (raySampleTool != null)
|
||||
|
|
|
@ -62,9 +62,9 @@ public static class GizmoRenderer
|
|||
|
||||
public static void RenderBox(RecastDebugDraw debugDraw, RcBoxGizmo box)
|
||||
{
|
||||
var trX = RcVec3f.Of(box.halfEdges[0].X, box.halfEdges[1].X, box.halfEdges[2].X);
|
||||
var trY = RcVec3f.Of(box.halfEdges[0].Y, box.halfEdges[1].Y, box.halfEdges[2].Y);
|
||||
var trZ = RcVec3f.Of(box.halfEdges[0].Z, box.halfEdges[1].Z, box.halfEdges[2].Z);
|
||||
var trX = new RcVec3f(box.halfEdges[0].X, box.halfEdges[1].X, box.halfEdges[2].X);
|
||||
var trY = new RcVec3f(box.halfEdges[0].Y, box.halfEdges[1].Y, box.halfEdges[2].Y);
|
||||
var trZ = new RcVec3f(box.halfEdges[0].Z, box.halfEdges[1].Z, box.halfEdges[2].Z);
|
||||
float[] vertices = new float[8 * 3];
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
private RcVec3f m_epos;
|
||||
|
||||
private readonly DtQueryDefaultFilter m_filter;
|
||||
private readonly RcVec3f m_polyPickExt = RcVec3f.Of(2, 4, 2);
|
||||
private readonly RcVec3f m_polyPickExt = new RcVec3f(2, 4, 2);
|
||||
|
||||
// for hit
|
||||
private RcVec3f m_hitPos;
|
||||
|
@ -508,7 +508,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
|
||||
RcVec3f delta = s3.Subtract(s.vmin);
|
||||
RcVec3f p0 = RcVec3f.Mad(s.vmin, delta, 0.5f);
|
||||
RcVec3f norm = RcVec3f.Of(delta.Z, 0, -delta.X);
|
||||
RcVec3f norm = new RcVec3f(delta.Z, 0, -delta.X);
|
||||
norm.Normalize();
|
||||
RcVec3f p1 = RcVec3f.Mad(p0, norm, agentRadius * 0.5f);
|
||||
// Skip backfacing segments.
|
||||
|
|
|
@ -168,17 +168,17 @@ namespace DotRecast.Recast.Toolset.Geom
|
|||
int[] tris = chunk.tris;
|
||||
for (int j = 0; j < chunk.tris.Length; j += 3)
|
||||
{
|
||||
RcVec3f v1 = RcVec3f.Of(
|
||||
RcVec3f v1 = new RcVec3f(
|
||||
vertices[tris[j] * 3],
|
||||
vertices[tris[j] * 3 + 1],
|
||||
vertices[tris[j] * 3 + 2]
|
||||
);
|
||||
RcVec3f v2 = RcVec3f.Of(
|
||||
RcVec3f v2 = new RcVec3f(
|
||||
vertices[tris[j + 1] * 3],
|
||||
vertices[tris[j + 1] * 3 + 1],
|
||||
vertices[tris[j + 1] * 3 + 2]
|
||||
);
|
||||
RcVec3f v3 = RcVec3f.Of(
|
||||
RcVec3f v3 = new RcVec3f(
|
||||
vertices[tris[j + 2] * 3],
|
||||
vertices[tris[j + 2] * 3 + 1],
|
||||
vertices[tris[j + 2] * 3 + 2]
|
||||
|
|
|
@ -13,14 +13,14 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
|
||||
public static readonly RcVec3f[] VERTS =
|
||||
{
|
||||
RcVec3f.Of(-1f, -1f, -1f),
|
||||
RcVec3f.Of(1f, -1f, -1f),
|
||||
RcVec3f.Of(1f, -1f, 1f),
|
||||
RcVec3f.Of(-1f, -1f, 1f),
|
||||
RcVec3f.Of(-1f, 1f, -1f),
|
||||
RcVec3f.Of(1f, 1f, -1f),
|
||||
RcVec3f.Of(1f, 1f, 1f),
|
||||
RcVec3f.Of(-1f, 1f, 1f),
|
||||
new RcVec3f(-1f, -1f, -1f),
|
||||
new RcVec3f(1f, -1f, -1f),
|
||||
new RcVec3f(1f, -1f, 1f),
|
||||
new RcVec3f(-1f, -1f, 1f),
|
||||
new RcVec3f(-1f, 1f, -1f),
|
||||
new RcVec3f(1f, 1f, -1f),
|
||||
new RcVec3f(1f, 1f, 1f),
|
||||
new RcVec3f(-1f, 1f, 1f),
|
||||
};
|
||||
|
||||
public readonly float[] vertices = new float[8 * 3];
|
||||
|
|
|
@ -19,18 +19,18 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
0.5f * (start.X + end.X), 0.5f * (start.Y + end.Y),
|
||||
0.5f * (start.Z + end.Z)
|
||||
};
|
||||
RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f axis = new RcVec3f(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f[] normals = new RcVec3f[3];
|
||||
normals[1] = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
normals[1] = new RcVec3f(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f.Normalize(ref normals[1]);
|
||||
normals[0] = GetSideVector(axis);
|
||||
normals[2] = RcVec3f.Zero;
|
||||
RcVec3f.Cross(ref normals[2], normals[0], normals[1]);
|
||||
RcVec3f.Normalize(ref normals[2]);
|
||||
triangles = GenerateSphericalTriangles();
|
||||
var trX = RcVec3f.Of(normals[0].X, normals[1].X, normals[2].X);
|
||||
var trY = RcVec3f.Of(normals[0].Y, normals[1].Y, normals[2].Y);
|
||||
var trZ = RcVec3f.Of(normals[0].Z, normals[1].Z, normals[2].Z);
|
||||
var trX = new RcVec3f(normals[0].X, normals[1].X, normals[2].X);
|
||||
var trY = new RcVec3f(normals[0].Y, normals[1].Y, normals[2].Y);
|
||||
var trZ = new RcVec3f(normals[0].Z, normals[1].Z, normals[2].Z);
|
||||
float[] spVertices = GenerateSphericalVertices();
|
||||
float halfLength = 0.5f * axis.Length();
|
||||
vertices = new float[spVertices.Length];
|
||||
|
@ -55,10 +55,10 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
|
||||
private RcVec3f GetSideVector(RcVec3f axis)
|
||||
{
|
||||
RcVec3f side = RcVec3f.Of(1, 0, 0);
|
||||
RcVec3f side = new RcVec3f(1, 0, 0);
|
||||
if (axis.X > 0.8)
|
||||
{
|
||||
side = RcVec3f.Of(0, 0, 1);
|
||||
side = new RcVec3f(0, 0, 1);
|
||||
}
|
||||
|
||||
RcVec3f forward = new RcVec3f();
|
||||
|
|
|
@ -15,22 +15,22 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
|
||||
public RcCylinderGizmo(RcVec3f start, RcVec3f end, float radius)
|
||||
{
|
||||
center = RcVec3f.Of(
|
||||
center = new RcVec3f(
|
||||
0.5f * (start.X + end.X), 0.5f * (start.Y + end.Y),
|
||||
0.5f * (start.Z + end.Z)
|
||||
);
|
||||
RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f axis = new RcVec3f(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f[] normals = new RcVec3f[3];
|
||||
normals[1] = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
normals[1] = new RcVec3f(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f.Normalize(ref normals[1]);
|
||||
normals[0] = GetSideVector(axis);
|
||||
normals[2] = RcVec3f.Zero;
|
||||
RcVec3f.Cross(ref normals[2], normals[0], normals[1]);
|
||||
RcVec3f.Normalize(ref normals[2]);
|
||||
triangles = GenerateCylindricalTriangles();
|
||||
RcVec3f trX = RcVec3f.Of(normals[0].X, normals[1].X, normals[2].X);
|
||||
RcVec3f trY = RcVec3f.Of(normals[0].Y, normals[1].Y, normals[2].Y);
|
||||
RcVec3f trZ = RcVec3f.Of(normals[0].Z, normals[1].Z, normals[2].Z);
|
||||
RcVec3f trX = new RcVec3f(normals[0].X, normals[1].X, normals[2].X);
|
||||
RcVec3f trY = new RcVec3f(normals[0].Y, normals[1].Y, normals[2].Y);
|
||||
RcVec3f trZ = new RcVec3f(normals[0].Z, normals[1].Z, normals[2].Z);
|
||||
vertices = GenerateCylindricalVertices();
|
||||
float halfLength = 0.5f * axis.Length();
|
||||
gradient = new float[vertices.Length / 3];
|
||||
|
@ -61,10 +61,10 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
|
||||
private RcVec3f GetSideVector(RcVec3f axis)
|
||||
{
|
||||
RcVec3f side = RcVec3f.Of(1, 0, 0);
|
||||
RcVec3f side = new RcVec3f(1, 0, 0);
|
||||
if (axis.X > 0.8)
|
||||
{
|
||||
side = RcVec3f.Of(0, 0, 1);
|
||||
side = new RcVec3f(0, 0, 1);
|
||||
}
|
||||
|
||||
RcVec3f forward = new RcVec3f();
|
||||
|
|
|
@ -177,7 +177,7 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
public RcGizmo CapsuleCollider(RcVec3f p, float walkableClimb)
|
||||
{
|
||||
float radius = 0.4f + (float)random.NextDouble() * 4f;
|
||||
RcVec3f a = RcVec3f.Of(
|
||||
RcVec3f a = new RcVec3f(
|
||||
(1f - 2 * (float)random.NextDouble()),
|
||||
0.01f + (float)random.NextDouble(),
|
||||
(1f - 2 * (float)random.NextDouble())
|
||||
|
@ -187,8 +187,8 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
a.X *= len;
|
||||
a.Y *= len;
|
||||
a.Z *= len;
|
||||
RcVec3f start = RcVec3f.Of(p.X, p.Y, p.Z);
|
||||
RcVec3f end = RcVec3f.Of(p.X + a.X, p.Y + a.Y, p.Z + a.Z);
|
||||
RcVec3f start = new RcVec3f(p.X, p.Y, p.Z);
|
||||
RcVec3f end = new RcVec3f(p.X + a.X, p.Y + a.Y, p.Z + a.Z);
|
||||
var collider = new DtCapsuleCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb);
|
||||
var gizmo = RcGizmoFactory.Capsule(start, end, radius);
|
||||
return new RcGizmo(collider, gizmo);
|
||||
|
@ -196,13 +196,13 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
|
||||
public RcGizmo BoxCollider(RcVec3f p, float walkableClimb)
|
||||
{
|
||||
RcVec3f extent = RcVec3f.Of(
|
||||
RcVec3f extent = new RcVec3f(
|
||||
0.5f + (float)random.NextDouble() * 6f,
|
||||
0.5f + (float)random.NextDouble() * 6f,
|
||||
0.5f + (float)random.NextDouble() * 6f
|
||||
);
|
||||
RcVec3f forward = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
|
||||
RcVec3f up = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0.01f + (float)random.NextDouble(), (1f - 2 * (float)random.NextDouble()));
|
||||
RcVec3f forward = new RcVec3f((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
|
||||
RcVec3f up = new RcVec3f((1f - 2 * (float)random.NextDouble()), 0.01f + (float)random.NextDouble(), (1f - 2 * (float)random.NextDouble()));
|
||||
RcVec3f[] halfEdges = Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(up, forward, extent);
|
||||
var collider = new DtBoxCollider(p, halfEdges, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb);
|
||||
var gizmo = RcGizmoFactory.Box(p, halfEdges);
|
||||
|
@ -212,14 +212,14 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
public RcGizmo CylinderCollider(RcVec3f p, float walkableClimb)
|
||||
{
|
||||
float radius = 0.7f + (float)random.NextDouble() * 4f;
|
||||
RcVec3f a = RcVec3f.Of(1f - 2 * (float)random.NextDouble(), 0.01f + (float)random.NextDouble(), 1f - 2 * (float)random.NextDouble());
|
||||
RcVec3f a = new RcVec3f(1f - 2 * (float)random.NextDouble(), 0.01f + (float)random.NextDouble(), 1f - 2 * (float)random.NextDouble());
|
||||
a.Normalize();
|
||||
float len = 2f + (float)random.NextDouble() * 20f;
|
||||
a[0] *= len;
|
||||
a[1] *= len;
|
||||
a[2] *= len;
|
||||
RcVec3f start = RcVec3f.Of(p.X, p.Y, p.Z);
|
||||
RcVec3f end = RcVec3f.Of(p.X + a.X, p.Y + a.Y, p.Z + a.Z);
|
||||
RcVec3f start = new RcVec3f(p.X, p.Y, p.Z);
|
||||
RcVec3f end = new RcVec3f(p.X + a.X, p.Y + a.Y, p.Z + a.Z);
|
||||
var collider = new DtCylinderCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb);
|
||||
var gizmo = RcGizmoFactory.Cylinder(start, end, radius);
|
||||
|
||||
|
@ -228,30 +228,30 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
|
||||
public RcGizmo CompositeCollider(RcVec3f p, float walkableClimb)
|
||||
{
|
||||
RcVec3f baseExtent = RcVec3f.Of(5, 3, 8);
|
||||
RcVec3f baseCenter = RcVec3f.Of(p.X, p.Y + 3, p.Z);
|
||||
RcVec3f baseUp = RcVec3f.Of(0, 1, 0);
|
||||
RcVec3f forward = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
|
||||
RcVec3f baseExtent = new RcVec3f(5, 3, 8);
|
||||
RcVec3f baseCenter = new RcVec3f(p.X, p.Y + 3, p.Z);
|
||||
RcVec3f baseUp = new RcVec3f(0, 1, 0);
|
||||
RcVec3f forward = new RcVec3f((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
|
||||
forward.Normalize();
|
||||
RcVec3f side = RcVec3f.Cross(forward, baseUp);
|
||||
DtBoxCollider @base = new DtBoxCollider(baseCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(baseUp, forward, baseExtent),
|
||||
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb);
|
||||
var roofUp = RcVec3f.Zero;
|
||||
RcVec3f roofExtent = RcVec3f.Of(4.5f, 4.5f, 8f);
|
||||
RcVec3f roofExtent = new RcVec3f(4.5f, 4.5f, 8f);
|
||||
var rx = RcMatrix4x4f.CreateFromRotate(45, forward.X, forward.Y, forward.Z);
|
||||
roofUp = MulMatrixVector(ref roofUp, rx, baseUp);
|
||||
RcVec3f roofCenter = RcVec3f.Of(p.X, p.Y + 6, p.Z);
|
||||
RcVec3f roofCenter = new RcVec3f(p.X, p.Y + 6, p.Z);
|
||||
DtBoxCollider roof = new DtBoxCollider(roofCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(roofUp, forward, roofExtent),
|
||||
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb);
|
||||
RcVec3f trunkStart = RcVec3f.Of(
|
||||
RcVec3f trunkStart = new RcVec3f(
|
||||
baseCenter.X - forward.X * 15 + side.X * 6,
|
||||
p.Y,
|
||||
baseCenter.Z - forward.Z * 15 + side.Z * 6
|
||||
);
|
||||
RcVec3f trunkEnd = RcVec3f.Of(trunkStart.X, trunkStart.Y + 10, trunkStart.Z);
|
||||
RcVec3f trunkEnd = new RcVec3f(trunkStart.X, trunkStart.Y + 10, trunkStart.Z);
|
||||
DtCapsuleCollider trunk = new DtCapsuleCollider(trunkStart, trunkEnd, 0.5f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD,
|
||||
walkableClimb);
|
||||
RcVec3f crownCenter = RcVec3f.Of(
|
||||
RcVec3f crownCenter = new RcVec3f(
|
||||
baseCenter.X - forward.X * 15 + side.X * 6, p.Y + 10,
|
||||
baseCenter.Z - forward.Z * 15 + side.Z * 6
|
||||
);
|
||||
|
@ -354,12 +354,12 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
|
||||
public bool Raycast(RcVec3f spos, RcVec3f epos, out float hitPos, out RcVec3f raycastHitPos)
|
||||
{
|
||||
RcVec3f sp = RcVec3f.Of(spos.X, spos.Y + 1.3f, spos.Z);
|
||||
RcVec3f ep = RcVec3f.Of(epos.X, epos.Y + 1.3f, epos.Z);
|
||||
RcVec3f sp = new RcVec3f(spos.X, spos.Y + 1.3f, spos.Z);
|
||||
RcVec3f ep = new RcVec3f(epos.X, epos.Y + 1.3f, epos.Z);
|
||||
|
||||
bool hasHit = dynaMesh.VoxelQuery().Raycast(sp, ep, out hitPos);
|
||||
raycastHitPos = hasHit
|
||||
? RcVec3f.Of(sp.X + hitPos * (ep.X - sp.X), sp.Y + hitPos * (ep.Y - sp.Y), sp.Z + hitPos * (ep.Z - sp.Z))
|
||||
? new RcVec3f(sp.X + hitPos * (ep.X - sp.X), sp.Y + hitPos * (ep.Y - sp.Y), sp.Z + hitPos * (ep.Z - sp.Z))
|
||||
: ep;
|
||||
|
||||
return hasHit;
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
return DtStatus.DT_FAILURE;
|
||||
|
||||
// In case of partial path, make sure the end point is clamped to the last polygon.
|
||||
var epos = RcVec3f.Of(endPt.X, endPt.Y, endPt.Z);
|
||||
var epos = new RcVec3f(endPt.X, endPt.Y, endPt.Z);
|
||||
if (polys[polys.Count - 1] != endRef)
|
||||
{
|
||||
var result = navQuery.ClosestPointOnPoly(polys[polys.Count - 1], endPt, out var closest, out var _);
|
||||
|
|
|
@ -708,8 +708,8 @@ namespace DotRecast.Recast
|
|||
bool inPoly = false;
|
||||
for (int i = 0, j = verts.Length / 3 - 1; i < verts.Length / 3; j = i++)
|
||||
{
|
||||
RcVec3f vi = RcVec3f.Of(verts[i * 3], verts[i * 3 + 1], verts[i * 3 + 2]);
|
||||
RcVec3f vj = RcVec3f.Of(verts[j * 3], verts[j * 3 + 1], verts[j * 3 + 2]);
|
||||
RcVec3f vi = new RcVec3f(verts[i * 3], verts[i * 3 + 1], verts[i * 3 + 2]);
|
||||
RcVec3f vj = new RcVec3f(verts[j * 3], verts[j * 3 + 1], verts[j * 3 + 2]);
|
||||
if (vi.Z > point.Z == vj.Z > point.Z)
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace DotRecast.Recast
|
|||
Math.Min(start.Z, end.Z) - radius, Math.Max(start.X, end.X) + radius, Math.Max(start.Y, end.Y) + radius,
|
||||
Math.Max(start.Z, end.Z) + radius
|
||||
};
|
||||
RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f axis = new RcVec3f(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RasterizationFilledShape(hf, bounds, area, flagMergeThr,
|
||||
rectangle => IntersectCapsule(rectangle, start, end, axis, radius * radius));
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace DotRecast.Recast
|
|||
Math.Min(start.Z, end.Z) - radius, Math.Max(start.X, end.X) + radius, Math.Max(start.Y, end.Y) + radius,
|
||||
Math.Max(start.Z, end.Z) + radius
|
||||
};
|
||||
RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f axis = new RcVec3f(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RasterizationFilledShape(hf, bounds, area, flagMergeThr,
|
||||
rectangle => IntersectCylinder(rectangle, start, end, axis, radius * radius));
|
||||
}
|
||||
|
@ -76,9 +76,9 @@ namespace DotRecast.Recast
|
|||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_BOX);
|
||||
RcVec3f[] normals =
|
||||
{
|
||||
RcVec3f.Of(halfEdges[0].X, halfEdges[0].Y, halfEdges[0].Z),
|
||||
RcVec3f.Of(halfEdges[1].X, halfEdges[1].Y, halfEdges[1].Z),
|
||||
RcVec3f.Of(halfEdges[2].X, halfEdges[2].Y, halfEdges[2].Z),
|
||||
new RcVec3f(halfEdges[0].X, halfEdges[0].Y, halfEdges[0].Z),
|
||||
new RcVec3f(halfEdges[1].X, halfEdges[1].Y, halfEdges[1].Z),
|
||||
new RcVec3f(halfEdges[2].X, halfEdges[2].Y, halfEdges[2].Z),
|
||||
};
|
||||
RcVec3f.Normalize(ref normals[0]);
|
||||
RcVec3f.Normalize(ref normals[1]);
|
||||
|
@ -281,11 +281,11 @@ namespace DotRecast.Recast
|
|||
private static float[] IntersectCylinder(float[] rectangle, RcVec3f start, RcVec3f end, RcVec3f axis, float radiusSqr)
|
||||
{
|
||||
float[] s = MergeIntersections(
|
||||
RayCylinderIntersection(RcVec3f.Of(
|
||||
RayCylinderIntersection(new RcVec3f(
|
||||
Math.Clamp(start.X, rectangle[0], rectangle[2]), rectangle[4],
|
||||
Math.Clamp(start.Z, rectangle[1], rectangle[3])
|
||||
), start, axis, radiusSqr),
|
||||
RayCylinderIntersection(RcVec3f.Of(
|
||||
RayCylinderIntersection(new RcVec3f(
|
||||
Math.Clamp(end.X, rectangle[0], rectangle[2]), rectangle[4],
|
||||
Math.Clamp(end.Z, rectangle[1], rectangle[3])
|
||||
), start, axis, radiusSqr));
|
||||
|
@ -305,7 +305,7 @@ namespace DotRecast.Recast
|
|||
{
|
||||
float x = rectangle[(i + 1) & 2];
|
||||
float z = rectangle[(i & 2) + 1];
|
||||
RcVec3f a = RcVec3f.Of(x, rectangle[4], z);
|
||||
RcVec3f a = new RcVec3f(x, rectangle[4], z);
|
||||
float dotAxisA = RcVec3f.Dot(axis, a);
|
||||
float t = (ds - dotAxisA) / axis.Y;
|
||||
rectangleOnStartPlane[i].X = x;
|
||||
|
@ -331,12 +331,12 @@ namespace DotRecast.Recast
|
|||
{
|
||||
int j = (i + 1) % 4;
|
||||
// Ray against sphere intersection
|
||||
var m = RcVec3f.Of(
|
||||
var m = new RcVec3f(
|
||||
rectangleOnPlane[i].X - start.X,
|
||||
rectangleOnPlane[i].Y - start.Y,
|
||||
rectangleOnPlane[i].Z - start.Z
|
||||
);
|
||||
var d = RcVec3f.Of(
|
||||
var d = new RcVec3f(
|
||||
rectangleOnPlane[j].X - rectangleOnPlane[i].X,
|
||||
rectangleOnPlane[j].Y - rectangleOnPlane[i].Y,
|
||||
rectangleOnPlane[j].Z - rectangleOnPlane[i].Z
|
||||
|
@ -399,7 +399,7 @@ namespace DotRecast.Recast
|
|||
// 2d intersection of plane and segment
|
||||
float t = (x - start.X) / direction.X;
|
||||
float z = Math.Clamp(start.Z + t * direction.Z, rectangle[1], rectangle[3]);
|
||||
return RcVec3f.Of(x, rectangle[4], z);
|
||||
return new RcVec3f(x, rectangle[4], z);
|
||||
}
|
||||
|
||||
private static float[] ZSlabCylinderIntersection(float[] rectangle, RcVec3f start, RcVec3f axis, float radiusSqr, float z)
|
||||
|
@ -412,14 +412,14 @@ namespace DotRecast.Recast
|
|||
// 2d intersection of plane and segment
|
||||
float t = (z - start.Z) / direction.Z;
|
||||
float x = Math.Clamp(start.X + t * direction.X, rectangle[0], rectangle[2]);
|
||||
return RcVec3f.Of(x, rectangle[4], z);
|
||||
return new RcVec3f(x, rectangle[4], z);
|
||||
}
|
||||
|
||||
// Based on Christer Ericsons's "Real-Time Collision Detection"
|
||||
private static float[] RayCylinderIntersection(RcVec3f point, RcVec3f start, RcVec3f axis, float radiusSqr)
|
||||
{
|
||||
RcVec3f d = axis;
|
||||
RcVec3f m = RcVec3f.Of(point.X - start.X, point.Y - start.Y, point.Z - start.Z);
|
||||
RcVec3f m = new RcVec3f(point.X - start.X, point.Y - start.Y, point.Z - start.Z);
|
||||
// float[] n = { 0, 1, 0 };
|
||||
float md = RcVec3f.Dot(m, d);
|
||||
// float nd = Dot(n, d);
|
||||
|
@ -517,7 +517,7 @@ namespace DotRecast.Recast
|
|||
}
|
||||
|
||||
// check intersection with rays starting in rectangle vertices
|
||||
var point = RcVec3f.Of(0, rectangle[1], 0);
|
||||
var point = new RcVec3f(0, rectangle[1], 0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
point.X = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
|
||||
|
@ -670,7 +670,7 @@ namespace DotRecast.Recast
|
|||
}
|
||||
|
||||
// rectangle vertex
|
||||
var point = RcVec3f.Of(0, rectangle[1], 0);
|
||||
var point = new RcVec3f(0, rectangle[1], 0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
point.X = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
|
||||
|
|
|
@ -41,20 +41,20 @@ public class AbstractCrowdTest
|
|||
|
||||
protected readonly RcVec3f[] startPoss =
|
||||
{
|
||||
RcVec3f.Of(22.60652f, 10.197294f, -45.918674f),
|
||||
RcVec3f.Of(22.331268f, 10.197294f, -1.0401875f),
|
||||
RcVec3f.Of(18.694363f, 15.803535f, -73.090416f),
|
||||
RcVec3f.Of(0.7453353f, 10.197294f, -5.94005f),
|
||||
RcVec3f.Of(-20.651257f, 5.904126f, -13.712508f),
|
||||
new RcVec3f(22.60652f, 10.197294f, -45.918674f),
|
||||
new RcVec3f(22.331268f, 10.197294f, -1.0401875f),
|
||||
new RcVec3f(18.694363f, 15.803535f, -73.090416f),
|
||||
new RcVec3f(0.7453353f, 10.197294f, -5.94005f),
|
||||
new RcVec3f(-20.651257f, 5.904126f, -13.712508f),
|
||||
};
|
||||
|
||||
protected readonly RcVec3f[] endPoss =
|
||||
{
|
||||
RcVec3f.Of(6.4576626f, 10.197294f, -18.33406f),
|
||||
RcVec3f.Of(-5.8023443f, 0.19729415f, 3.008419f),
|
||||
RcVec3f.Of(38.423977f, 10.197294f, -0.116066754f),
|
||||
RcVec3f.Of(0.8635526f, 10.197294f, -10.31032f),
|
||||
RcVec3f.Of(18.784092f, 10.197294f, 3.0543678f),
|
||||
new RcVec3f(6.4576626f, 10.197294f, -18.33406f),
|
||||
new RcVec3f(-5.8023443f, 0.19729415f, 3.008419f),
|
||||
new RcVec3f(38.423977f, 10.197294f, -0.116066754f),
|
||||
new RcVec3f(0.8635526f, 10.197294f, -10.31032f),
|
||||
new RcVec3f(18.784092f, 10.197294f, 3.0543678f),
|
||||
};
|
||||
|
||||
protected DtMeshData nmd;
|
||||
|
|
|
@ -34,17 +34,17 @@ public class PathCorridorTest
|
|||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
corridor.Reset(0, RcVec3f.Of(10, 20, 30));
|
||||
corridor.Reset(0, new RcVec3f(10, 20, 30));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldKeepOriginalPathInFindCornersWhenNothingCanBePruned()
|
||||
{
|
||||
List<DtStraightPath> straightPath = new();
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(11, 20, 30.00001f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(12, 20, 30.00002f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(11f, 21, 32f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(11f, 21, 32f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(11, 20, 30.00001f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(12, 20, 30.00002f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(11f, 21, 32f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(11f, 21, 32f), 0, 0));
|
||||
var mockQuery = new Mock<DtNavMeshQuery>(It.IsAny<DtNavMesh>());
|
||||
mockQuery.Setup(q => q.FindStraightPath(
|
||||
It.IsAny<RcVec3f>(),
|
||||
|
@ -71,11 +71,11 @@ public class PathCorridorTest
|
|||
public void ShouldPrunePathInFindCorners()
|
||||
{
|
||||
List<DtStraightPath> straightPath = new();
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(10, 20, 30.00001f), 0, 0)); // too close
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(10, 20, 30.00002f), 0, 0)); // too close
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(11f, 21, 32f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(12f, 22, 33f), DtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION, 0)); // offmesh
|
||||
straightPath.Add(new DtStraightPath(RcVec3f.Of(11f, 21, 32f), DtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION, 0)); // offmesh
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(10, 20, 30.00001f), 0, 0)); // too close
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(10, 20, 30.00002f), 0, 0)); // too close
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(11f, 21, 32f), 0, 0));
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(12f, 22, 33f), DtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION, 0)); // offmesh
|
||||
straightPath.Add(new DtStraightPath(new RcVec3f(11f, 21, 32f), DtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION, 0)); // offmesh
|
||||
|
||||
var mockQuery = new Mock<DtNavMeshQuery>(It.IsAny<DtNavMesh>());
|
||||
mockQuery.Setup(q => q.FindStraightPath(
|
||||
|
|
|
@ -12,10 +12,10 @@ namespace DotRecast.Detour.Dynamic.Test;
|
|||
[Parallelizable]
|
||||
public class DynamicNavMeshTest
|
||||
{
|
||||
private static readonly RcVec3f START_POS = RcVec3f.Of(70.87453f, 0.0010070801f, 86.69021f);
|
||||
private static readonly RcVec3f END_POS = RcVec3f.Of(-50.22061f, 0.0010070801f, -70.761444f);
|
||||
private static readonly RcVec3f EXTENT = RcVec3f.Of(0.1f, 0.1f, 0.1f);
|
||||
private static readonly RcVec3f SPHERE_POS = RcVec3f.Of(45.381645f, 0.0010070801f, 52.68981f);
|
||||
private static readonly RcVec3f START_POS = new RcVec3f(70.87453f, 0.0010070801f, 86.69021f);
|
||||
private static readonly RcVec3f END_POS = new RcVec3f(-50.22061f, 0.0010070801f, -70.761444f);
|
||||
private static readonly RcVec3f EXTENT = new RcVec3f(0.1f, 0.1f, 0.1f);
|
||||
private static readonly RcVec3f SPHERE_POS = new RcVec3f(45.381645f, 0.0010070801f, 52.68981f);
|
||||
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -49,8 +49,8 @@ public class VoxelFileReaderTest
|
|||
Assert.That(f.tiles[0].cellHeight, Is.EqualTo(0.001f));
|
||||
Assert.That(f.tiles[0].width, Is.EqualTo(810));
|
||||
Assert.That(f.tiles[0].depth, Is.EqualTo(810));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(RcVec3f.Of(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(RcVec3f.Of(101.25f, 5.0f, 101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(new RcVec3f(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(new RcVec3f(101.25f, 5.0f, 101.25f)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -76,7 +76,7 @@ public class VoxelFileReaderTest
|
|||
Assert.That(f.tiles[0].cellHeight, Is.EqualTo(0.001f));
|
||||
Assert.That(f.tiles[0].width, Is.EqualTo(90));
|
||||
Assert.That(f.tiles[0].depth, Is.EqualTo(90));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(RcVec3f.Of(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(RcVec3f.Of(-78.75f, 5.0f, -78.75f)));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(new RcVec3f(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(new RcVec3f(-78.75f, 5.0f, -78.75f)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public class VoxelFileReaderWriterTest
|
|||
Assert.That(f.tiles[0].width, Is.EqualTo(810));
|
||||
Assert.That(f.tiles[0].depth, Is.EqualTo(810));
|
||||
Assert.That(f.tiles[0].spanData.Length, Is.EqualTo(9021024));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(RcVec3f.Of(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(RcVec3f.Of(101.25f, 5.0f, 101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(new RcVec3f(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(new RcVec3f(101.25f, 5.0f, 101.25f)));
|
||||
}
|
||||
|
||||
[TestCase(false)]
|
||||
|
@ -82,8 +82,8 @@ public class VoxelFileReaderWriterTest
|
|||
Assert.That(f.tiles[0].spanData.Length, Is.EqualTo(104952));
|
||||
Assert.That(f.tiles[5].spanData.Length, Is.EqualTo(109080));
|
||||
Assert.That(f.tiles[18].spanData.Length, Is.EqualTo(113400));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(RcVec3f.Of(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(RcVec3f.Of(-78.75f, 5.0f, -78.75f)));
|
||||
Assert.That(f.tiles[0].boundsMin, Is.EqualTo(new RcVec3f(-101.25f, 0f, -101.25f)));
|
||||
Assert.That(f.tiles[0].boundsMax, Is.EqualTo(new RcVec3f(-78.75f, 5.0f, -78.75f)));
|
||||
}
|
||||
|
||||
private DtVoxelFile ReadWriteRead(BinaryReader bis, bool compression)
|
||||
|
|
|
@ -35,7 +35,7 @@ public class VoxelQueryTest
|
|||
{
|
||||
private const int TILE_WIDTH = 100;
|
||||
private const int TILE_DEPTH = 90;
|
||||
private static readonly RcVec3f ORIGIN = RcVec3f.Of(50, 10, 40);
|
||||
private static readonly RcVec3f ORIGIN = new RcVec3f(50, 10, 40);
|
||||
|
||||
|
||||
[Test]
|
||||
|
@ -57,8 +57,8 @@ public class VoxelQueryTest
|
|||
});
|
||||
|
||||
DtVoxelQuery query = new DtVoxelQuery(ORIGIN, TILE_WIDTH, TILE_DEPTH, hfProvider.Object);
|
||||
RcVec3f start = RcVec3f.Of(120, 10, 365);
|
||||
RcVec3f end = RcVec3f.Of(320, 10, 57);
|
||||
RcVec3f start = new RcVec3f(120, 10, 365);
|
||||
RcVec3f end = new RcVec3f(320, 10, 57);
|
||||
|
||||
// When
|
||||
query.Raycast(start, end, out var hit);
|
||||
|
@ -73,8 +73,8 @@ public class VoxelQueryTest
|
|||
{
|
||||
DtDynamicNavMesh mesh = CreateDynaMesh();
|
||||
DtVoxelQuery query = mesh.VoxelQuery();
|
||||
RcVec3f start = RcVec3f.Of(7.4f, 0.5f, -64.8f);
|
||||
RcVec3f end = RcVec3f.Of(31.2f, 0.5f, -75.3f);
|
||||
RcVec3f start = new RcVec3f(7.4f, 0.5f, -64.8f);
|
||||
RcVec3f end = new RcVec3f(31.2f, 0.5f, -75.3f);
|
||||
bool isHit = query.Raycast(start, end, out var hit);
|
||||
Assert.That(isHit, Is.EqualTo(false));
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ public class VoxelQueryTest
|
|||
{
|
||||
DtDynamicNavMesh mesh = CreateDynaMesh();
|
||||
DtVoxelQuery query = mesh.VoxelQuery();
|
||||
RcVec3f start = RcVec3f.Of(32.3f, 0.5f, 47.9f);
|
||||
RcVec3f end = RcVec3f.Of(-31.2f, 0.5f, -29.8f);
|
||||
RcVec3f start = new RcVec3f(32.3f, 0.5f, 47.9f);
|
||||
RcVec3f end = new RcVec3f(-31.2f, 0.5f, -29.8f);
|
||||
bool isHit = query.Raycast(start, end, out var hit);
|
||||
Assert.That(isHit, Is.EqualTo(true));
|
||||
Assert.That(hit, Is.EqualTo(0.5263836f).Within(1e-7f));
|
||||
|
|
|
@ -34,8 +34,8 @@ public class UnityAStarPathfindingImporterTest
|
|||
public void Test_v4_0_6()
|
||||
{
|
||||
DtNavMesh mesh = LoadNavMesh("graph.zip");
|
||||
RcVec3f startPos = RcVec3f.Of(8.200293f, 2.155071f, -26.176147f);
|
||||
RcVec3f endPos = RcVec3f.Of(11.971109f, 0.000000f, 8.663261f);
|
||||
RcVec3f startPos = new RcVec3f(8.200293f, 2.155071f, -26.176147f);
|
||||
RcVec3f endPos = new RcVec3f(11.971109f, 0.000000f, 8.663261f);
|
||||
var path = new List<long>();
|
||||
var status = FindPath(mesh, startPos, endPos, ref path);
|
||||
Assert.That(status, Is.EqualTo(DtStatus.DT_SUCCSESS));
|
||||
|
@ -47,8 +47,8 @@ public class UnityAStarPathfindingImporterTest
|
|||
public void Test_v4_1_16()
|
||||
{
|
||||
DtNavMesh mesh = LoadNavMesh("graph_v4_1_16.zip");
|
||||
RcVec3f startPos = RcVec3f.Of(22.93f, -2.37f, -5.11f);
|
||||
RcVec3f endPos = RcVec3f.Of(16.81f, -2.37f, 25.52f);
|
||||
RcVec3f startPos = new RcVec3f(22.93f, -2.37f, -5.11f);
|
||||
RcVec3f endPos = new RcVec3f(16.81f, -2.37f, 25.52f);
|
||||
var path = new List<long>();
|
||||
var status = FindPath(mesh, startPos, endPos, ref path);
|
||||
Assert.That(status.Succeeded(), Is.True);
|
||||
|
@ -60,7 +60,7 @@ public class UnityAStarPathfindingImporterTest
|
|||
public void TestBoundsTree()
|
||||
{
|
||||
DtNavMesh mesh = LoadNavMesh("test_boundstree.zip");
|
||||
RcVec3f position = RcVec3f.Of(387.52988f, 19.997f, 368.86282f);
|
||||
RcVec3f position = new RcVec3f(387.52988f, 19.997f, 368.86282f);
|
||||
|
||||
mesh.CalcTileLoc(position, out var tileX, out var tileY);
|
||||
long tileRef = mesh.GetTileRefAt(tileX, tileY, 0);
|
||||
|
@ -105,7 +105,7 @@ public class UnityAStarPathfindingImporterTest
|
|||
{
|
||||
DtNavMeshQuery query = new DtNavMeshQuery(mesh);
|
||||
IDtQueryFilter filter = new DtQueryDefaultFilter();
|
||||
RcVec3f extents = RcVec3f.Of(0.1f, 0.1f, 0.1f);
|
||||
RcVec3f extents = new RcVec3f(0.1f, 0.1f, 0.1f);
|
||||
|
||||
var results = new DtPolyPoint[positions.Length];
|
||||
for (int i = 0; i < results.Length; i++)
|
||||
|
|
|
@ -36,20 +36,20 @@ public abstract class AbstractDetourTest
|
|||
|
||||
protected static readonly RcVec3f[] startPoss =
|
||||
{
|
||||
RcVec3f.Of(22.60652f, 10.197294f, -45.918674f),
|
||||
RcVec3f.Of(22.331268f, 10.197294f, -1.0401875f),
|
||||
RcVec3f.Of(18.694363f, 15.803535f, -73.090416f),
|
||||
RcVec3f.Of(0.7453353f, 10.197294f, -5.94005f),
|
||||
RcVec3f.Of(-20.651257f, 5.904126f, -13.712508f)
|
||||
new RcVec3f(22.60652f, 10.197294f, -45.918674f),
|
||||
new RcVec3f(22.331268f, 10.197294f, -1.0401875f),
|
||||
new RcVec3f(18.694363f, 15.803535f, -73.090416f),
|
||||
new RcVec3f(0.7453353f, 10.197294f, -5.94005f),
|
||||
new RcVec3f(-20.651257f, 5.904126f, -13.712508f)
|
||||
};
|
||||
|
||||
protected static readonly RcVec3f[] endPoss =
|
||||
{
|
||||
RcVec3f.Of(6.4576626f, 10.197294f, -18.33406f),
|
||||
RcVec3f.Of(-5.8023443f, 0.19729415f, 3.008419f),
|
||||
RcVec3f.Of(38.423977f, 10.197294f, -0.116066754f),
|
||||
RcVec3f.Of(0.8635526f, 10.197294f, -10.31032f),
|
||||
RcVec3f.Of(18.784092f, 10.197294f, 3.0543678f),
|
||||
new RcVec3f(6.4576626f, 10.197294f, -18.33406f),
|
||||
new RcVec3f(-5.8023443f, 0.19729415f, 3.008419f),
|
||||
new RcVec3f(38.423977f, 10.197294f, -0.116066754f),
|
||||
new RcVec3f(0.8635526f, 10.197294f, -10.31032f),
|
||||
new RcVec3f(18.784092f, 10.197294f, 3.0543678f),
|
||||
};
|
||||
|
||||
protected DtNavMeshQuery query;
|
||||
|
|
|
@ -29,20 +29,20 @@ public class FindDistanceToWallTest : AbstractDetourTest
|
|||
|
||||
private static readonly RcVec3f[] HIT_POSITION =
|
||||
{
|
||||
RcVec3f.Of(23.177608f, 10.197294f, -45.742954f),
|
||||
RcVec3f.Of(22.331268f, 10.197294f, -4.241272f),
|
||||
RcVec3f.Of(18.108675f, 15.743596f, -73.236839f),
|
||||
RcVec3f.Of(1.984785f, 10.197294f, -8.441269f),
|
||||
RcVec3f.Of(-22.315216f, 4.997294f, -11.441269f),
|
||||
new RcVec3f(23.177608f, 10.197294f, -45.742954f),
|
||||
new RcVec3f(22.331268f, 10.197294f, -4.241272f),
|
||||
new RcVec3f(18.108675f, 15.743596f, -73.236839f),
|
||||
new RcVec3f(1.984785f, 10.197294f, -8.441269f),
|
||||
new RcVec3f(-22.315216f, 4.997294f, -11.441269f),
|
||||
};
|
||||
|
||||
private static readonly RcVec3f[] HIT_NORMAL =
|
||||
{
|
||||
RcVec3f.Of(-0.955779f, 0.0f, -0.29408592f),
|
||||
RcVec3f.Of(0.0f, 0.0f, 1.0f),
|
||||
RcVec3f.Of(0.97014254f, 0.0f, 0.24253564f),
|
||||
RcVec3f.Of(-1.0f, 0.0f, 0.0f),
|
||||
RcVec3f.Of(1.0f, 0.0f, 0.0f),
|
||||
new RcVec3f(-0.955779f, 0.0f, -0.29408592f),
|
||||
new RcVec3f(0.0f, 0.0f, 1.0f),
|
||||
new RcVec3f(0.97014254f, 0.0f, 0.24253564f),
|
||||
new RcVec3f(-1.0f, 0.0f, 0.0f),
|
||||
new RcVec3f(1.0f, 0.0f, 0.0f),
|
||||
};
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -38,7 +38,7 @@ public class FindNearestPolyTest : AbstractDetourTest
|
|||
public void TestFindNearestPoly()
|
||||
{
|
||||
IDtQueryFilter filter = new DtQueryDefaultFilter();
|
||||
RcVec3f extents = RcVec3f.Of(2, 4, 2);
|
||||
RcVec3f extents = new RcVec3f(2, 4, 2);
|
||||
for (int i = 0; i < startRefs.Length; i++)
|
||||
{
|
||||
RcVec3f startPos = startPoss[i];
|
||||
|
@ -56,7 +56,7 @@ public class FindNearestPolyTest : AbstractDetourTest
|
|||
[Test]
|
||||
public void ShouldReturnStartPosWhenNoPolyIsValid()
|
||||
{
|
||||
RcVec3f extents = RcVec3f.Of(2, 4, 2);
|
||||
RcVec3f extents = new RcVec3f(2, 4, 2);
|
||||
for (int i = 0; i < startRefs.Length; i++)
|
||||
{
|
||||
RcVec3f startPos = startPoss[i];
|
||||
|
|
|
@ -75,59 +75,59 @@ public class FindPathTest : AbstractDetourTest
|
|||
{
|
||||
new[]
|
||||
{
|
||||
new DtStraightPath(RcVec3f.Of(22.606520f, 10.197294f, -45.918674f), 1, 281474976710696L),
|
||||
new DtStraightPath(RcVec3f.Of(3.484785f, 10.197294f, -34.241272f), 0, 281474976710713L),
|
||||
new DtStraightPath(RcVec3f.Of(1.984785f, 10.197294f, -31.241272f), 0, 281474976710712L),
|
||||
new DtStraightPath(RcVec3f.Of(1.984785f, 10.197294f, -29.741272f), 0, 281474976710727L),
|
||||
new DtStraightPath(RcVec3f.Of(2.584784f, 10.197294f, -27.941273f), 0, 281474976710730L),
|
||||
new DtStraightPath(RcVec3f.Of(6.457663f, 10.197294f, -18.334061f), 2, 0L)
|
||||
new DtStraightPath(new RcVec3f(22.606520f, 10.197294f, -45.918674f), 1, 281474976710696L),
|
||||
new DtStraightPath(new RcVec3f(3.484785f, 10.197294f, -34.241272f), 0, 281474976710713L),
|
||||
new DtStraightPath(new RcVec3f(1.984785f, 10.197294f, -31.241272f), 0, 281474976710712L),
|
||||
new DtStraightPath(new RcVec3f(1.984785f, 10.197294f, -29.741272f), 0, 281474976710727L),
|
||||
new DtStraightPath(new RcVec3f(2.584784f, 10.197294f, -27.941273f), 0, 281474976710730L),
|
||||
new DtStraightPath(new RcVec3f(6.457663f, 10.197294f, -18.334061f), 2, 0L)
|
||||
},
|
||||
|
||||
new[]
|
||||
{
|
||||
new DtStraightPath(RcVec3f.Of(22.331268f, 10.197294f, -1.040187f), 1, 281474976710773L),
|
||||
new DtStraightPath(RcVec3f.Of(9.784786f, 10.197294f, -2.141273f), 0, 281474976710755L),
|
||||
new DtStraightPath(RcVec3f.Of(7.984783f, 10.197294f, -2.441269f), 0, 281474976710753L),
|
||||
new DtStraightPath(RcVec3f.Of(1.984785f, 10.197294f, -8.441269f), 0, 281474976710752L),
|
||||
new DtStraightPath(RcVec3f.Of(-4.315216f, 10.197294f, -15.341270f), 0, 281474976710724L),
|
||||
new DtStraightPath(RcVec3f.Of(-8.215216f, 10.197294f, -17.441269f), 0, 281474976710728L),
|
||||
new DtStraightPath(RcVec3f.Of(-10.015216f, 10.197294f, -17.741272f), 0, 281474976710738L),
|
||||
new DtStraightPath(RcVec3f.Of(-11.815216f, 9.997294f, -17.441269f), 0, 281474976710736L),
|
||||
new DtStraightPath(RcVec3f.Of(-17.815216f, 5.197294f, -11.441269f), 0, 281474976710735L),
|
||||
new DtStraightPath(RcVec3f.Of(-17.815216f, 5.197294f, -8.441269f), 0, 281474976710746L),
|
||||
new DtStraightPath(RcVec3f.Of(-11.815216f, 0.197294f, 3.008419f), 2, 0L)
|
||||
new DtStraightPath(new RcVec3f(22.331268f, 10.197294f, -1.040187f), 1, 281474976710773L),
|
||||
new DtStraightPath(new RcVec3f(9.784786f, 10.197294f, -2.141273f), 0, 281474976710755L),
|
||||
new DtStraightPath(new RcVec3f(7.984783f, 10.197294f, -2.441269f), 0, 281474976710753L),
|
||||
new DtStraightPath(new RcVec3f(1.984785f, 10.197294f, -8.441269f), 0, 281474976710752L),
|
||||
new DtStraightPath(new RcVec3f(-4.315216f, 10.197294f, -15.341270f), 0, 281474976710724L),
|
||||
new DtStraightPath(new RcVec3f(-8.215216f, 10.197294f, -17.441269f), 0, 281474976710728L),
|
||||
new DtStraightPath(new RcVec3f(-10.015216f, 10.197294f, -17.741272f), 0, 281474976710738L),
|
||||
new DtStraightPath(new RcVec3f(-11.815216f, 9.997294f, -17.441269f), 0, 281474976710736L),
|
||||
new DtStraightPath(new RcVec3f(-17.815216f, 5.197294f, -11.441269f), 0, 281474976710735L),
|
||||
new DtStraightPath(new RcVec3f(-17.815216f, 5.197294f, -8.441269f), 0, 281474976710746L),
|
||||
new DtStraightPath(new RcVec3f(-11.815216f, 0.197294f, 3.008419f), 2, 0L)
|
||||
},
|
||||
|
||||
new[]
|
||||
{
|
||||
new DtStraightPath(RcVec3f.Of(18.694363f, 15.803535f, -73.090416f), 1, 281474976710680L),
|
||||
new DtStraightPath(RcVec3f.Of(17.584785f, 10.197294f, -49.841274f), 0, 281474976710697L),
|
||||
new DtStraightPath(RcVec3f.Of(17.284786f, 10.197294f, -48.041275f), 0, 281474976710695L),
|
||||
new DtStraightPath(RcVec3f.Of(16.084785f, 10.197294f, -45.341274f), 0, 281474976710694L),
|
||||
new DtStraightPath(RcVec3f.Of(3.484785f, 10.197294f, -34.241272f), 0, 281474976710713L),
|
||||
new DtStraightPath(RcVec3f.Of(1.984785f, 10.197294f, -31.241272f), 0, 281474976710712L),
|
||||
new DtStraightPath(RcVec3f.Of(1.984785f, 10.197294f, -8.441269f), 0, 281474976710753L),
|
||||
new DtStraightPath(RcVec3f.Of(7.984783f, 10.197294f, -2.441269f), 0, 281474976710755L),
|
||||
new DtStraightPath(RcVec3f.Of(9.784786f, 10.197294f, -2.141273f), 0, 281474976710768L),
|
||||
new DtStraightPath(RcVec3f.Of(38.423977f, 10.197294f, -0.116067f), 2, 0L)
|
||||
new DtStraightPath(new RcVec3f(18.694363f, 15.803535f, -73.090416f), 1, 281474976710680L),
|
||||
new DtStraightPath(new RcVec3f(17.584785f, 10.197294f, -49.841274f), 0, 281474976710697L),
|
||||
new DtStraightPath(new RcVec3f(17.284786f, 10.197294f, -48.041275f), 0, 281474976710695L),
|
||||
new DtStraightPath(new RcVec3f(16.084785f, 10.197294f, -45.341274f), 0, 281474976710694L),
|
||||
new DtStraightPath(new RcVec3f(3.484785f, 10.197294f, -34.241272f), 0, 281474976710713L),
|
||||
new DtStraightPath(new RcVec3f(1.984785f, 10.197294f, -31.241272f), 0, 281474976710712L),
|
||||
new DtStraightPath(new RcVec3f(1.984785f, 10.197294f, -8.441269f), 0, 281474976710753L),
|
||||
new DtStraightPath(new RcVec3f(7.984783f, 10.197294f, -2.441269f), 0, 281474976710755L),
|
||||
new DtStraightPath(new RcVec3f(9.784786f, 10.197294f, -2.141273f), 0, 281474976710768L),
|
||||
new DtStraightPath(new RcVec3f(38.423977f, 10.197294f, -0.116067f), 2, 0L)
|
||||
},
|
||||
|
||||
new[]
|
||||
{
|
||||
new DtStraightPath(RcVec3f.Of(0.745335f, 10.197294f, -5.940050f), 1, 281474976710753L),
|
||||
new DtStraightPath(RcVec3f.Of(0.863553f, 10.197294f, -10.310320f), 2, 0L)
|
||||
new DtStraightPath(new RcVec3f(0.745335f, 10.197294f, -5.940050f), 1, 281474976710753L),
|
||||
new DtStraightPath(new RcVec3f(0.863553f, 10.197294f, -10.310320f), 2, 0L)
|
||||
},
|
||||
|
||||
new[]
|
||||
{
|
||||
new DtStraightPath(RcVec3f.Of(-20.651257f, 5.904126f, -13.712508f), 1, 281474976710733L),
|
||||
new DtStraightPath(RcVec3f.Of(-11.815216f, 9.997294f, -17.441269f), 0, 281474976710738L),
|
||||
new DtStraightPath(RcVec3f.Of(-10.015216f, 10.197294f, -17.741272f), 0, 281474976710728L),
|
||||
new DtStraightPath(RcVec3f.Of(-8.215216f, 10.197294f, -17.441269f), 0, 281474976710724L),
|
||||
new DtStraightPath(RcVec3f.Of(-4.315216f, 10.197294f, -15.341270f), 0, 281474976710729L),
|
||||
new DtStraightPath(RcVec3f.Of(1.984785f, 10.197294f, -8.441269f), 0, 281474976710753L),
|
||||
new DtStraightPath(RcVec3f.Of(7.984783f, 10.197294f, -2.441269f), 0, 281474976710755L),
|
||||
new DtStraightPath(RcVec3f.Of(18.784092f, 10.197294f, 3.054368f), 2, 0L)
|
||||
new DtStraightPath(new RcVec3f(-20.651257f, 5.904126f, -13.712508f), 1, 281474976710733L),
|
||||
new DtStraightPath(new RcVec3f(-11.815216f, 9.997294f, -17.441269f), 0, 281474976710738L),
|
||||
new DtStraightPath(new RcVec3f(-10.015216f, 10.197294f, -17.741272f), 0, 281474976710728L),
|
||||
new DtStraightPath(new RcVec3f(-8.215216f, 10.197294f, -17.441269f), 0, 281474976710724L),
|
||||
new DtStraightPath(new RcVec3f(-4.315216f, 10.197294f, -15.341270f), 0, 281474976710729L),
|
||||
new DtStraightPath(new RcVec3f(1.984785f, 10.197294f, -8.441269f), 0, 281474976710753L),
|
||||
new DtStraightPath(new RcVec3f(7.984783f, 10.197294f, -2.441269f), 0, 281474976710755L),
|
||||
new DtStraightPath(new RcVec3f(18.784092f, 10.197294f, 3.054368f), 2, 0L)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class PolygonByCircleConstraintTest
|
|||
public void ShouldHandlePolygonFullyInsideCircle()
|
||||
{
|
||||
float[] polygon = { -2, 0, 2, 2, 0, 2, 2, 0, -2, -2, 0, -2 };
|
||||
RcVec3f center = RcVec3f.Of(1, 0, 1);
|
||||
RcVec3f center = new RcVec3f(1, 0, 1);
|
||||
float[] constrained = _constraint.Apply(polygon, center, 6);
|
||||
|
||||
Assert.That(constrained, Is.EqualTo(polygon));
|
||||
|
@ -42,7 +42,7 @@ public class PolygonByCircleConstraintTest
|
|||
{
|
||||
int expectedSize = 21;
|
||||
float[] polygon = { -2, 0, 2, 2, 0, 2, 2, 0, -2, -2, 0, -2 };
|
||||
RcVec3f center = RcVec3f.Of(2, 0, 0);
|
||||
RcVec3f center = new RcVec3f(2, 0, 0);
|
||||
|
||||
float[] constrained = _constraint.Apply(polygon, center, 3);
|
||||
Assert.That(constrained.Length, Is.EqualTo(expectedSize));
|
||||
|
@ -54,7 +54,7 @@ public class PolygonByCircleConstraintTest
|
|||
{
|
||||
int expectedSize = 12 * 3;
|
||||
float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 };
|
||||
RcVec3f center = RcVec3f.Of(-1, 0, -1);
|
||||
RcVec3f center = new RcVec3f(-1, 0, -1);
|
||||
float[] constrained = _constraint.Apply(polygon, center, 2);
|
||||
|
||||
Assert.That(constrained.Length, Is.EqualTo(expectedSize));
|
||||
|
@ -72,7 +72,7 @@ public class PolygonByCircleConstraintTest
|
|||
{
|
||||
int expectedSize = 9 * 3;
|
||||
float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 };
|
||||
RcVec3f center = RcVec3f.Of(-2, 0, -1);
|
||||
RcVec3f center = new RcVec3f(-2, 0, -1);
|
||||
float[] constrained = _constraint.Apply(polygon, center, 3);
|
||||
|
||||
Assert.That(constrained.Length, Is.EqualTo(expectedSize));
|
||||
|
@ -84,7 +84,7 @@ public class PolygonByCircleConstraintTest
|
|||
{
|
||||
int expectedSize = 7 * 3;
|
||||
float[] polygon = { -4, 0, 0, -3, 0, 3, 2, 0, 3, 3, 0, -3, -2, 0, -4 };
|
||||
RcVec3f center = RcVec3f.Of(4, 0, 0);
|
||||
RcVec3f center = new RcVec3f(4, 0, 0);
|
||||
float[] constrained = _constraint.Apply(polygon, center, 4);
|
||||
|
||||
Assert.That(constrained.Length, Is.EqualTo(expectedSize));
|
||||
|
|
|
@ -43,8 +43,8 @@ public class TiledFindPathTest
|
|||
|
||||
protected static readonly long[] START_REFS = { 281475015507969L };
|
||||
protected static readonly long[] END_REFS = { 281474985099266L };
|
||||
protected static readonly RcVec3f[] START_POS = { RcVec3f.Of(39.447338f, 9.998177f, -0.784811f) };
|
||||
protected static readonly RcVec3f[] END_POS = { RcVec3f.Of(19.292645f, 11.611748f, -57.750366f) };
|
||||
protected static readonly RcVec3f[] START_POS = { new RcVec3f(39.447338f, 9.998177f, -0.784811f) };
|
||||
protected static readonly RcVec3f[] END_POS = { new RcVec3f(19.292645f, 11.611748f, -57.750366f) };
|
||||
|
||||
protected DtNavMeshQuery query;
|
||||
protected DtNavMesh navmesh;
|
||||
|
|
|
@ -48,7 +48,7 @@ public class TempObstaclesTest : AbstractTileCacheTest
|
|||
DtMeshTile tile = tiles[0];
|
||||
Assert.That(tile.data.header.vertCount, Is.EqualTo(16));
|
||||
Assert.That(tile.data.header.polyCount, Is.EqualTo(6));
|
||||
long o = tc.AddObstacle(RcVec3f.Of(-1.815208f, 9.998184f, -20.307983f), 1f, 2f);
|
||||
long o = tc.AddObstacle(new RcVec3f(-1.815208f, 9.998184f, -20.307983f), 1f, 2f);
|
||||
bool upToDate = tc.Update();
|
||||
Assert.That(upToDate, Is.True);
|
||||
tiles = tc.GetNavMesh().GetTilesAt(1, 4);
|
||||
|
@ -83,8 +83,8 @@ public class TempObstaclesTest : AbstractTileCacheTest
|
|||
Assert.That(tile.data.header.vertCount, Is.EqualTo(16));
|
||||
Assert.That(tile.data.header.polyCount, Is.EqualTo(6));
|
||||
long o = tc.AddBoxObstacle(
|
||||
RcVec3f.Of(-2.315208f, 9.998184f, -20.807983f),
|
||||
RcVec3f.Of(-1.315208f, 11.998184f, -19.807983f)
|
||||
new RcVec3f(-2.315208f, 9.998184f, -20.807983f),
|
||||
new RcVec3f(-1.315208f, 11.998184f, -19.807983f)
|
||||
);
|
||||
bool upToDate = tc.Update();
|
||||
Assert.That(upToDate, Is.True);
|
||||
|
|
|
@ -31,8 +31,8 @@ namespace DotRecast.Detour.TileCache.Test;
|
|||
[Parallelizable]
|
||||
public class TileCacheFindPathTest : AbstractTileCacheTest
|
||||
{
|
||||
private readonly RcVec3f start = RcVec3f.Of(39.44734f, 9.998177f, -0.784811f);
|
||||
private readonly RcVec3f end = RcVec3f.Of(19.292645f, 11.611748f, -57.750366f);
|
||||
private readonly RcVec3f start = new RcVec3f(39.44734f, 9.998177f, -0.784811f);
|
||||
private readonly RcVec3f end = new RcVec3f(19.292645f, 11.611748f, -57.750366f);
|
||||
private readonly DtNavMesh navmesh;
|
||||
private readonly DtNavMeshQuery query;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class TileCacheFindPathTest : AbstractTileCacheTest
|
|||
public void TestFindPath()
|
||||
{
|
||||
IDtQueryFilter filter = new DtQueryDefaultFilter();
|
||||
RcVec3f extents = RcVec3f.Of(2f, 4f, 2f);
|
||||
RcVec3f extents = new RcVec3f(2f, 4f, 2f);
|
||||
query.FindNearestPoly(start, extents, filter, out var startRef, out var startPos, out var _);
|
||||
query.FindNearestPoly(end, extents, filter, out var endRef, out var endPos, out var _);
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ public class TileCacheNavigationTest : AbstractTileCacheTest
|
|||
{
|
||||
protected readonly long[] startRefs = { 281475006070787L };
|
||||
protected readonly long[] endRefs = { 281474986147841L };
|
||||
protected readonly RcVec3f[] startPoss = { RcVec3f.Of(39.447338f, 9.998177f, -0.784811f) };
|
||||
protected readonly RcVec3f[] endPoss = { RcVec3f.Of(19.292645f, 11.611748f, -57.750366f) };
|
||||
protected readonly RcVec3f[] startPoss = { new RcVec3f(39.447338f, 9.998177f, -0.784811f) };
|
||||
protected readonly RcVec3f[] endPoss = { new RcVec3f(19.292645f, 11.611748f, -57.750366f) };
|
||||
private readonly DtStatus[] statuses = { DtStatus.DT_SUCCSESS };
|
||||
|
||||
private readonly long[][] results =
|
||||
|
|
Loading…
Reference in New Issue