refactor: Change 'xyz' to uppercase in preparation for switching to System.Numeric.Vector3

This commit is contained in:
ikpil 2023-10-12 23:04:29 +09:00
parent 8d3a1d2d68
commit 7965af390e
108 changed files with 1452 additions and 1452 deletions

View File

@ -66,22 +66,22 @@ namespace DotRecast.Core
// Returns true if 'a' is more lower-left than 'b'. // Returns true if 'a' is more lower-left than 'b'.
private static bool Cmppt(RcVec3f a, RcVec3f b) private static bool Cmppt(RcVec3f a, RcVec3f b)
{ {
if (a.x < b.x) if (a.X < b.X)
{ {
return true; return true;
} }
if (a.x > b.x) if (a.X > b.X)
{ {
return false; return false;
} }
if (a.z < b.z) if (a.Z < b.Z)
{ {
return true; return true;
} }
if (a.z > b.z) if (a.Z > b.Z)
{ {
return false; return false;
} }
@ -92,10 +92,10 @@ namespace DotRecast.Core
// Returns true if 'c' is left of line 'a'-'b'. // Returns true if 'c' is left of line 'a'-'b'.
private static bool Left(RcVec3f a, RcVec3f b, RcVec3f c) private static bool Left(RcVec3f a, RcVec3f b, RcVec3f c)
{ {
float u1 = b.x - a.x; float u1 = b.X - a.X;
float v1 = b.z - a.z; float v1 = b.Z - a.Z;
float u2 = c.x - a.x; float u2 = c.X - a.X;
float v2 = c.z - a.z; float v2 = c.Z - a.Z;
return u1 * v2 - v1 * u2 < 0; return u1 * v2 - v1 * u2 < 0;
} }
} }

View File

@ -84,9 +84,9 @@ namespace DotRecast.Core
const float EPS = 1e-6f; const float EPS = 1e-6f;
RcVec3f d = new RcVec3f(); RcVec3f d = new RcVec3f();
d.x = sq.x - sp.x; d.X = sq.X - sp.X;
d.y = sq.y - sp.y; d.Y = sq.Y - sp.Y;
d.z = sq.z - sp.z; d.Z = sq.Z - sp.Z;
tmin = 0.0f; tmin = 0.0f;
tmax = float.MaxValue; tmax = float.MaxValue;

View File

@ -7,13 +7,13 @@
public RcSegmentVert(float v0, float v1, float v2, float v3, float v4, float v5) public RcSegmentVert(float v0, float v1, float v2, float v3, float v4, float v5)
{ {
vmin.x = v0; vmin.X = v0;
vmin.y = v1; vmin.Y = v1;
vmin.z = v2; vmin.Z = v2;
vmax.x = v3; vmax.X = v3;
vmax.y = v4; vmax.Y = v4;
vmax.z = v5; vmax.Z = v5;
} }
} }

View File

@ -5,19 +5,19 @@ namespace DotRecast.Core
{ {
public struct RcVec2f public struct RcVec2f
{ {
public float x; public float X;
public float y; public float Y;
public static RcVec2f Zero { get; } = new RcVec2f { x = 0, y = 0 }; public static RcVec2f Zero { get; } = new RcVec2f { X = 0, Y = 0 };
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public float Get(int idx) public float Get(int idx)
{ {
if (0 == idx) if (0 == idx)
return x; return X;
if (1 == idx) if (1 == idx)
return y; return Y;
throw new IndexOutOfRangeException("vector2f index out of range"); throw new IndexOutOfRangeException("vector2f index out of range");
} }
@ -33,15 +33,15 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(RcVec2f other) public bool Equals(RcVec2f other)
{ {
return x.Equals(other.x) && return X.Equals(other.X) &&
y.Equals(other.y); Y.Equals(other.Y);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() public override int GetHashCode()
{ {
int hash = x.GetHashCode(); int hash = X.GetHashCode();
hash = RcHashCodes.CombineHashCodes(hash, y.GetHashCode()); hash = RcHashCodes.CombineHashCodes(hash, Y.GetHashCode());
return hash; return hash;
} }
@ -56,11 +56,11 @@ namespace DotRecast.Core
{ {
return !left.Equals(right); return !left.Equals(right);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string ToString() public override string ToString()
{ {
return $"{x}, {y}"; return $"{X}, {Y}";
} }
} }
} }

View File

@ -23,9 +23,9 @@ namespace DotRecast.Core
{ {
public struct RcVec3f public struct RcVec3f
{ {
public float x; public float X;
public float y; public float Y;
public float z; public float Z;
public static RcVec3f Zero { get; } = new RcVec3f(0.0f, 0.0f, 0.0f); public static RcVec3f Zero { get; } = new RcVec3f(0.0f, 0.0f, 0.0f);
public static RcVec3f One { get; } = new RcVec3f(1.0f); public static RcVec3f One { get; } = new RcVec3f(1.0f);
@ -51,26 +51,26 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public RcVec3f(float x, float y, float z) public RcVec3f(float x, float y, float z)
{ {
this.x = x; this.X = x;
this.y = y; this.Y = y;
this.z = z; this.Z = z;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public RcVec3f(float f) public RcVec3f(float f)
{ {
x = f; X = f;
y = f; Y = f;
z = f; Z = f;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public RcVec3f(float[] f) public RcVec3f(float[] f)
{ {
x = f[0]; X = f[0];
y = f[1]; Y = f[1];
z = f[2]; Z = f[2];
} }
public float this[int index] public float this[int index]
@ -84,9 +84,9 @@ namespace DotRecast.Core
{ {
switch (index) switch (index)
{ {
case 0: return x; case 0: return X;
case 1: return y; case 1: return Y;
case 2: return z; case 2: return Z;
default: throw new IndexOutOfRangeException($"{index}"); default: throw new IndexOutOfRangeException($"{index}");
} }
} }
@ -97,13 +97,13 @@ namespace DotRecast.Core
switch (index) switch (index)
{ {
case 0: case 0:
x = value; X = value;
break; break;
case 1: case 1:
y = value; Y = value;
break; break;
case 2: case 2:
z = value; Z = value;
break; break;
default: throw new IndexOutOfRangeException($"{index}-{value}"); default: throw new IndexOutOfRangeException($"{index}-{value}");
@ -113,9 +113,9 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set(float a, float b, float c) public void Set(float a, float b, float c)
{ {
x = a; X = a;
y = b; Y = b;
z = c; Z = c;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -127,25 +127,25 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set(float[] @in, int i) public void Set(float[] @in, int i)
{ {
x = @in[i]; X = @in[i];
y = @in[i + 1]; Y = @in[i + 1];
z = @in[i + 2]; Z = @in[i + 2];
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Length() public readonly float Length()
{ {
return (float)Math.Sqrt(x * x + y * y + z * z); return (float)Math.Sqrt(X * X + Y * Y + Z * Z);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly RcVec3f Subtract(RcVec3f right) public readonly RcVec3f Subtract(RcVec3f right)
{ {
return new RcVec3f( return new RcVec3f(
x - right.x, X - right.X,
y - right.y, Y - right.Y,
z - right.z Z - right.Z
); );
} }
@ -153,9 +153,9 @@ namespace DotRecast.Core
public readonly RcVec3f Add(RcVec3f v2) public readonly RcVec3f Add(RcVec3f v2)
{ {
return new RcVec3f( return new RcVec3f(
x + v2.x, X + v2.X,
y + v2.y, Y + v2.Y,
z + v2.z Z + v2.Z
); );
} }
@ -163,9 +163,9 @@ namespace DotRecast.Core
public readonly RcVec3f Scale(float scale) public readonly RcVec3f Scale(float scale)
{ {
return new RcVec3f( return new RcVec3f(
x * scale, X * scale,
y * scale, Y * scale,
z * scale Z * scale
); );
} }
@ -180,13 +180,13 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Dot2D(RcVec3f v) public readonly float Dot2D(RcVec3f v)
{ {
return x * v.x + z * v.z; return X * v.X + Z * v.Z;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public readonly float Dot2D(float[] v, int vi) public readonly float Dot2D(float[] v, int vi)
{ {
return x * v[vi] + z * v[vi + 2]; return X * v[vi] + Z * v[vi + 2];
} }
@ -201,18 +201,18 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(RcVec3f other) public bool Equals(RcVec3f other)
{ {
return x.Equals(other.x) && return X.Equals(other.X) &&
y.Equals(other.y) && Y.Equals(other.Y) &&
z.Equals(other.z); Z.Equals(other.Z);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() public override int GetHashCode()
{ {
int hash = x.GetHashCode(); int hash = X.GetHashCode();
hash = RcHashCodes.CombineHashCodes(hash, y.GetHashCode()); hash = RcHashCodes.CombineHashCodes(hash, Y.GetHashCode());
hash = RcHashCodes.CombineHashCodes(hash, z.GetHashCode()); hash = RcHashCodes.CombineHashCodes(hash, Z.GetHashCode());
return hash; return hash;
} }
@ -221,12 +221,12 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Normalize() public void Normalize()
{ {
float d = (float)(1.0f / Math.Sqrt(RcMath.Sqr(x) + RcMath.Sqr(y) + RcMath.Sqr(z))); float d = (float)(1.0f / Math.Sqrt(RcMath.Sqr(X) + RcMath.Sqr(Y) + RcMath.Sqr(Z)));
if (d != 0) if (d != 0)
{ {
x *= d; X *= d;
y *= d; Y *= d;
z *= d; Z *= d;
} }
} }
@ -238,52 +238,52 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SafeNormalize() public void SafeNormalize()
{ {
float sqMag = RcMath.Sqr(x) + RcMath.Sqr(y) + RcMath.Sqr(z); float sqMag = RcMath.Sqr(X) + RcMath.Sqr(Y) + RcMath.Sqr(Z);
if (sqMag > EPSILON) if (sqMag > EPSILON)
{ {
float inverseMag = 1.0f / (float)Math.Sqrt(sqMag); float inverseMag = 1.0f / (float)Math.Sqrt(sqMag);
x *= inverseMag; X *= inverseMag;
y *= inverseMag; Y *= inverseMag;
z *= inverseMag; Z *= inverseMag;
} }
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Min(float[] @in, int i) public void Min(float[] @in, int i)
{ {
x = Math.Min(x, @in[i]); X = Math.Min(X, @in[i]);
y = Math.Min(y, @in[i + 1]); Y = Math.Min(Y, @in[i + 1]);
z = Math.Min(z, @in[i + 2]); Z = Math.Min(Z, @in[i + 2]);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Min(RcVec3f b) public void Min(RcVec3f b)
{ {
x = Math.Min(x, b.x); X = Math.Min(X, b.X);
y = Math.Min(y, b.y); Y = Math.Min(Y, b.Y);
z = Math.Min(z, b.z); Z = Math.Min(Z, b.Z);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Max(RcVec3f b) public void Max(RcVec3f b)
{ {
x = Math.Max(x, b.x); X = Math.Max(X, b.X);
y = Math.Max(y, b.y); Y = Math.Max(Y, b.Y);
z = Math.Max(z, b.z); Z = Math.Max(Z, b.Z);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Max(float[] @in, int i) public void Max(float[] @in, int i)
{ {
x = Math.Max(x, @in[i]); X = Math.Max(X, @in[i]);
y = Math.Max(y, @in[i + 1]); Y = Math.Max(Y, @in[i + 1]);
z = Math.Max(z, @in[i + 2]); Z = Math.Max(Z, @in[i + 2]);
} }
public override string ToString() public override string ToString()
{ {
return $"{x}, {y}, {z}"; return $"{X}, {Y}, {Z}";
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -314,9 +314,9 @@ namespace DotRecast.Core
public static RcVec3f operator *(RcVec3f left, RcVec3f right) public static RcVec3f operator *(RcVec3f left, RcVec3f right)
{ {
return new RcVec3f( return new RcVec3f(
left.x * right.x, left.X * right.X,
left.y * right.y, left.Y * right.Y,
left.z * right.z left.Z * right.Z
); );
} }
@ -336,9 +336,9 @@ namespace DotRecast.Core
public static RcVec3f Cross(RcVec3f v1, RcVec3f v2) public static RcVec3f Cross(RcVec3f v1, RcVec3f v2)
{ {
return new RcVec3f( return new RcVec3f(
(v1.y * v2.z) - (v1.z * v2.y), (v1.Y * v2.Z) - (v1.Z * v2.Y),
(v1.z * v2.x) - (v1.x * v2.z), (v1.Z * v2.X) - (v1.X * v2.Z),
(v1.x * v2.y) - (v1.y * v2.x) (v1.X * v2.Y) - (v1.Y * v2.X)
); );
} }
@ -346,9 +346,9 @@ namespace DotRecast.Core
public static RcVec3f Lerp(RcVec3f v1, RcVec3f v2, float t) public static RcVec3f Lerp(RcVec3f v1, RcVec3f v2, float t)
{ {
return new RcVec3f( return new RcVec3f(
v1.x + (v2.x - v1.x) * t, v1.X + (v2.X - v1.X) * t,
v1.y + (v2.y - v1.y) * t, v1.Y + (v2.Y - v1.Y) * t,
v1.z + (v2.z - v1.z) * t v1.Z + (v2.Z - v1.Z) * t
); );
} }
@ -359,17 +359,17 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Distance(RcVec3f v1, RcVec3f v2) public static float Distance(RcVec3f v1, RcVec3f v2)
{ {
float dx = v2.x - v1.x; float dx = v2.X - v1.X;
float dy = v2.y - v1.y; float dy = v2.Y - v1.Y;
float dz = v2.z - v1.z; float dz = v2.Z - v1.Z;
return (float)Math.Sqrt(dx * dx + dy * dy + dz * dz); return (float)Math.Sqrt(dx * dx + dy * dy + dz * dz);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dot(RcVec3f v1, RcVec3f v2) public static float Dot(RcVec3f v1, RcVec3f v2)
{ {
return (v1.x * v2.x) + (v1.y * v2.y) return (v1.X * v2.X) + (v1.Y * v2.Y)
+ (v1.z * v2.z); + (v1.Z * v2.Z);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -381,14 +381,14 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dot(float[] v1, RcVec3f v2) public static float Dot(float[] v1, RcVec3f v2)
{ {
return v1[0] * v2.x + v1[1] * v2.y + v1[2] * v2.z; return v1[0] * v2.X + v1[1] * v2.Y + v1[2] * v2.Z;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float PerpXZ(RcVec3f a, RcVec3f b) public static float PerpXZ(RcVec3f a, RcVec3f b)
{ {
return (a.x * b.z) - (a.z * b.x); return (a.X * b.Z) - (a.Z * b.X);
} }
/// Performs a scaled vector addition. (@p v1 + (@p v2 * @p s)) /// Performs a scaled vector addition. (@p v1 + (@p v2 * @p s))
@ -401,9 +401,9 @@ namespace DotRecast.Core
{ {
return new RcVec3f() return new RcVec3f()
{ {
x = v1.x + (v2.x * s), X = v1.X + (v2.X * s),
y = v1.y + (v2.y * s), Y = v1.Y + (v2.Y * s),
z = v1.z + (v2.z * s), Z = v1.Z + (v2.Z * s),
}; };
} }
@ -431,18 +431,18 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float DistSqr(RcVec3f v1, float[] v2, int i) public static float DistSqr(RcVec3f v1, float[] v2, int i)
{ {
float dx = v2[i] - v1.x; float dx = v2[i] - v1.X;
float dy = v2[i + 1] - v1.y; float dy = v2[i + 1] - v1.Y;
float dz = v2[i + 2] - v1.z; float dz = v2[i + 2] - v1.Z;
return dx * dx + dy * dy + dz * dz; return dx * dx + dy * dy + dz * dz;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float DistSqr(RcVec3f v1, RcVec3f v2) public static float DistSqr(RcVec3f v1, RcVec3f v2)
{ {
float dx = v2.x - v1.x; float dx = v2.X - v1.X;
float dy = v2.y - v1.y; float dy = v2.Y - v1.Y;
float dz = v2.z - v1.z; float dz = v2.Z - v1.Z;
return dx * dx + dy * dy + dz * dz; return dx * dx + dy * dy + dz * dz;
} }
@ -482,8 +482,8 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dist2D(RcVec3f v1, RcVec3f v2) public static float Dist2D(RcVec3f v1, RcVec3f v2)
{ {
float dx = v2.x - v1.x; float dx = v2.X - v1.X;
float dz = v2.z - v1.z; float dz = v2.Z - v1.Z;
return (float)Math.Sqrt(dx * dx + dz * dz); return (float)Math.Sqrt(dx * dx + dz * dz);
} }
@ -499,16 +499,16 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dist2DSqr(RcVec3f v1, RcVec3f v2) public static float Dist2DSqr(RcVec3f v1, RcVec3f v2)
{ {
float dx = v2.x - v1.x; float dx = v2.X - v1.X;
float dz = v2.z - v1.z; float dz = v2.Z - v1.Z;
return dx * dx + dz * dz; return dx * dx + dz * dz;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dist2DSqr(RcVec3f p, float[] verts, int i) public static float Dist2DSqr(RcVec3f p, float[] verts, int i)
{ {
float dx = verts[i] - p.x; float dx = verts[i] - p.X;
float dz = verts[i + 2] - p.z; float dz = verts[i + 2] - p.Z;
return dx * dx + dz * dz; return dx * dx + dz * dz;
} }
@ -522,7 +522,7 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Perp2D(RcVec3f u, RcVec3f v) public static float Perp2D(RcVec3f u, RcVec3f v)
{ {
return u.z * v.x - u.x * v.z; return u.Z * v.X - u.X * v.Z;
} }
/// Derives the square of the scalar length of the vector. (len * len) /// Derives the square of the scalar length of the vector. (len * len)
@ -531,7 +531,7 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float LenSqr(RcVec3f v) public static float LenSqr(RcVec3f v)
{ {
return v.x * v.x + v.y * v.y + v.z * v.z; return v.X * v.X + v.Y * v.Y + v.Z * v.Z;
} }
@ -542,7 +542,7 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsFinite(RcVec3f v) public static bool IsFinite(RcVec3f v)
{ {
return float.IsFinite(v.x) && float.IsFinite(v.y) && float.IsFinite(v.z); return float.IsFinite(v.X) && float.IsFinite(v.Y) && float.IsFinite(v.Z);
} }
/// Checks that the specified vector's 2D components are finite. /// Checks that the specified vector's 2D components are finite.
@ -550,7 +550,7 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsFinite2D(RcVec3f v) public static bool IsFinite2D(RcVec3f v)
{ {
return float.IsFinite(v.x) && float.IsFinite(v.z); return float.IsFinite(v.X) && float.IsFinite(v.Z);
} }
@ -587,27 +587,27 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Add(ref RcVec3f e0, RcVec3f a, float[] verts, int i) public static void Add(ref RcVec3f e0, RcVec3f a, float[] verts, int i)
{ {
e0.x = a.x + verts[i]; e0.X = a.X + verts[i];
e0.y = a.y + verts[i + 1]; e0.Y = a.Y + verts[i + 1];
e0.z = a.z + verts[i + 2]; e0.Z = a.Z + verts[i + 2];
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Sub(ref RcVec3f e0, float[] verts, int i, int j) public static void Sub(ref RcVec3f e0, float[] verts, int i, int j)
{ {
e0.x = verts[i] - verts[j]; e0.X = verts[i] - verts[j];
e0.y = verts[i + 1] - verts[j + 1]; e0.Y = verts[i + 1] - verts[j + 1];
e0.z = verts[i + 2] - verts[j + 2]; e0.Z = verts[i + 2] - verts[j + 2];
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Sub(ref RcVec3f e0, RcVec3f i, float[] verts, int j) public static void Sub(ref RcVec3f e0, RcVec3f i, float[] verts, int j)
{ {
e0.x = i.x - verts[j]; e0.X = i.X - verts[j];
e0.y = i.y - verts[j + 1]; e0.Y = i.Y - verts[j + 1];
e0.z = i.z - verts[j + 2]; e0.Z = i.Z - verts[j + 2];
} }
@ -622,27 +622,27 @@ namespace DotRecast.Core
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Cross(float[] dest, RcVec3f v1, RcVec3f v2) public static void Cross(float[] dest, RcVec3f v1, RcVec3f v2)
{ {
dest[0] = v1.y * v2.z - v1.z * v2.y; dest[0] = v1.Y * v2.Z - v1.Z * v2.Y;
dest[1] = v1.z * v2.x - v1.x * v2.z; dest[1] = v1.Z * v2.X - v1.X * v2.Z;
dest[2] = v1.x * v2.y - v1.y * v2.x; dest[2] = v1.X * v2.Y - v1.Y * v2.X;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Cross(ref RcVec3f dest, RcVec3f v1, RcVec3f v2) public static void Cross(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
{ {
dest.x = v1.y * v2.z - v1.z * v2.y; dest.X = v1.Y * v2.Z - v1.Z * v2.Y;
dest.y = v1.z * v2.x - v1.x * v2.z; dest.Y = v1.Z * v2.X - v1.X * v2.Z;
dest.z = v1.x * v2.y - v1.y * v2.x; dest.Z = v1.X * v2.Y - v1.Y * v2.X;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Normalize(ref RcVec3f v) public static void Normalize(ref RcVec3f v)
{ {
float d = (float)(1.0f / Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z)); float d = (float)(1.0f / Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z));
v.x *= d; v.X *= d;
v.y *= d; v.Y *= d;
v.z *= d; v.Z *= d;
} }
} }
} }

View File

@ -857,7 +857,7 @@ namespace DotRecast.Detour.Crowd
{ {
RcVec3f p = ag.npos; RcVec3f p = ag.npos;
float r = ag.option.radius; float r = ag.option.radius;
_grid.AddItem(ag, p.x - r, p.z - r, p.x + r, p.z + r); _grid.AddItem(ag, p.X - r, p.Z - r, p.X + r, p.Z + r);
} }
} }
@ -893,7 +893,7 @@ namespace DotRecast.Detour.Crowd
result.Clear(); result.Clear();
var proxAgents = new HashSet<DtCrowdAgent>(); var proxAgents = new HashSet<DtCrowdAgent>();
int nids = grid.QueryItems(pos.x - range, pos.z - range, pos.x + range, pos.z + range, ref proxAgents); int nids = grid.QueryItems(pos.X - range, pos.Z - range, pos.X + range, pos.Z + range, ref proxAgents);
foreach (DtCrowdAgent ag in proxAgents) foreach (DtCrowdAgent ag in proxAgents)
{ {
if (ag == skip) if (ag == skip)
@ -903,12 +903,12 @@ namespace DotRecast.Detour.Crowd
// Check for overlap. // Check for overlap.
RcVec3f diff = pos.Subtract(ag.npos); RcVec3f diff = pos.Subtract(ag.npos);
if (Math.Abs(diff.y) >= (height + ag.option.height) / 2.0f) if (Math.Abs(diff.Y) >= (height + ag.option.height) / 2.0f)
{ {
continue; continue;
} }
diff.y = 0; diff.Y = 0;
float distSqr = RcVec3f.LenSqr(diff); float distSqr = RcVec3f.LenSqr(diff);
if (distSqr > RcMath.Sqr(range)) if (distSqr > RcMath.Sqr(range))
{ {
@ -1076,7 +1076,7 @@ namespace DotRecast.Detour.Crowd
DtCrowdAgent nei = ag.neis[j].agent; DtCrowdAgent nei = ag.neis[j].agent;
RcVec3f diff = ag.npos.Subtract(nei.npos); RcVec3f diff = ag.npos.Subtract(nei.npos);
diff.y = 0; diff.Y = 0;
float distSqr = RcVec3f.LenSqr(diff); float distSqr = RcVec3f.LenSqr(diff);
if (distSqr < 0.00001f) if (distSqr < 0.00001f)
@ -1223,7 +1223,7 @@ namespace DotRecast.Detour.Crowd
DtCrowdAgent nei = ag.neis[j].agent; DtCrowdAgent nei = ag.neis[j].agent;
long idx1 = nei.idx; long idx1 = nei.idx;
RcVec3f diff = ag.npos.Subtract(nei.npos); RcVec3f diff = ag.npos.Subtract(nei.npos);
diff.y = 0; diff.Y = 0;
float dist = RcVec3f.LenSqr(diff); float dist = RcVec3f.LenSqr(diff);
if (dist > RcMath.Sqr(ag.option.radius + nei.option.radius)) if (dist > RcMath.Sqr(ag.option.radius + nei.option.radius))
@ -1238,11 +1238,11 @@ namespace DotRecast.Detour.Crowd
// Agents on top of each other, try to choose diverging separation directions. // Agents on top of each other, try to choose diverging separation directions.
if (idx0 > idx1) if (idx0 > idx1)
{ {
diff.Set(-ag.dvel.z, 0, ag.dvel.x); diff.Set(-ag.dvel.Z, 0, ag.dvel.X);
} }
else else
{ {
diff.Set(ag.dvel.z, 0, -ag.dvel.x); diff.Set(ag.dvel.Z, 0, -ag.dvel.X);
} }
pen = 0.01f; pen = 0.01f;

View File

@ -169,17 +169,17 @@ namespace DotRecast.Detour.Crowd
var dir0 = p0.Subtract(npos); var dir0 = p0.Subtract(npos);
var dir1 = p1.Subtract(npos); var dir1 = p1.Subtract(npos);
dir0.y = 0; dir0.Y = 0;
dir1.y = 0; dir1.Y = 0;
float len0 = dir0.Length(); float len0 = dir0.Length();
float len1 = dir1.Length(); float len1 = dir1.Length();
if (len1 > 0.001f) if (len1 > 0.001f)
dir1 = dir1.Scale(1.0f / len1); dir1 = dir1.Scale(1.0f / len1);
dir.x = dir0.x - dir1.x * len0 * 0.5f; dir.X = dir0.X - dir1.X * len0 * 0.5f;
dir.y = 0; dir.Y = 0;
dir.z = dir0.z - dir1.z * len0 * 0.5f; dir.Z = dir0.Z - dir1.Z * len0 * 0.5f;
dir.Normalize(); dir.Normalize();
} }
@ -192,7 +192,7 @@ namespace DotRecast.Detour.Crowd
if (0 < corners.Count) if (0 < corners.Count)
{ {
dir = corners[0].pos.Subtract(npos); dir = corners[0].pos.Subtract(npos);
dir.y = 0; dir.Y = 0;
dir.Normalize(); dir.Normalize();
} }

View File

@ -38,12 +38,12 @@ namespace DotRecast.Detour.Crowd
public DtLocalBoundary() public DtLocalBoundary()
{ {
m_center.x = m_center.y = m_center.z = float.MaxValue; m_center.X = m_center.Y = m_center.Z = float.MaxValue;
} }
public void Reset() public void Reset()
{ {
m_center.x = m_center.y = m_center.z = float.MaxValue; m_center.X = m_center.Y = m_center.Z = float.MaxValue;
m_polys.Clear(); m_polys.Clear();
m_segs.Clear(); m_segs.Clear();
} }

View File

@ -82,9 +82,9 @@ namespace DotRecast.Detour.Crowd
{ {
if (m_nsamples >= m_maxSamples) if (m_nsamples >= m_maxSamples)
return; return;
m_vel[m_nsamples * 3] = vel.x; m_vel[m_nsamples * 3] = vel.X;
m_vel[m_nsamples * 3 + 1] = vel.y; m_vel[m_nsamples * 3 + 1] = vel.Y;
m_vel[m_nsamples * 3 + 2] = vel.z; m_vel[m_nsamples * 3 + 2] = vel.Z;
m_ssize[m_nsamples] = ssize; m_ssize[m_nsamples] = ssize;
m_pen[m_nsamples] = pen; m_pen[m_nsamples] = pen;
m_vpen[m_nsamples] = vpen; m_vpen[m_nsamples] = vpen;
@ -102,9 +102,9 @@ namespace DotRecast.Detour.Crowd
public RcVec3f GetSampleVelocity(int i) public RcVec3f GetSampleVelocity(int i)
{ {
RcVec3f vel = new RcVec3f(); RcVec3f vel = new RcVec3f();
vel.x = m_vel[i * 3]; vel.X = m_vel[i * 3];
vel.y = m_vel[i * 3 + 1]; vel.Y = m_vel[i * 3 + 1];
vel.z = m_vel[i * 3 + 2]; vel.Z = m_vel[i * 3 + 2];
return vel; return vel;
} }

View File

@ -132,13 +132,13 @@ namespace DotRecast.Detour.Crowd
float a = DtUtils.TriArea2D(orig, cir.dp, dv); float a = DtUtils.TriArea2D(orig, cir.dp, dv);
if (a < 0.01f) if (a < 0.01f)
{ {
cir.np.x = -cir.dp.z; cir.np.X = -cir.dp.Z;
cir.np.z = cir.dp.x; cir.np.Z = cir.dp.X;
} }
else else
{ {
cir.np.x = cir.dp.z; cir.np.X = cir.dp.Z;
cir.np.z = -cir.dp.x; cir.np.Z = -cir.dp.X;
} }
} }
@ -276,8 +276,8 @@ namespace DotRecast.Detour.Crowd
// Special case when the agent is very close to the segment. // Special case when the agent is very close to the segment.
RcVec3f sdir = seg.q.Subtract(seg.p); RcVec3f sdir = seg.q.Subtract(seg.p);
RcVec3f snorm = new RcVec3f(); RcVec3f snorm = new RcVec3f();
snorm.x = -sdir.z; snorm.X = -sdir.Z;
snorm.z = sdir.x; snorm.Z = sdir.X;
// If the velocity is pointing towards the segment, no collision. // If the velocity is pointing towards the segment, no collision.
if (snorm.Dot2D(vcand) < 0.0f) if (snorm.Dot2D(vcand) < 0.0f)
continue; continue;
@ -331,8 +331,8 @@ namespace DotRecast.Detour.Crowd
if (debug != null) if (debug != null)
debug.Reset(); debug.Reset();
float cvx = dvel.x * m_params.velBias; float cvx = dvel.X * m_params.velBias;
float cvz = dvel.z * m_params.velBias; float cvz = dvel.Z * m_params.velBias;
float cs = vmax * 2 * (1 - m_params.velBias) / (m_params.gridSize - 1); float cs = vmax * 2 * (1 - m_params.velBias) / (m_params.gridSize - 1);
float half = (m_params.gridSize - 1) * cs * 0.5f; float half = (m_params.gridSize - 1) * cs * 0.5f;
@ -344,7 +344,7 @@ namespace DotRecast.Detour.Crowd
for (int x = 0; x < m_params.gridSize; ++x) for (int x = 0; x < m_params.gridSize; ++x)
{ {
RcVec3f vcand = RcVec3f.Of(cvx + x * cs - half, 0f, cvz + y * cs - half); RcVec3f vcand = RcVec3f.Of(cvx + x * cs - half, 0f, cvz + y * cs - half);
if (RcMath.Sqr(vcand.x) + RcMath.Sqr(vcand.z) > RcMath.Sqr(vmax + cs / 2)) if (RcMath.Sqr(vcand.X) + RcMath.Sqr(vcand.Z) > RcMath.Sqr(vmax + cs / 2))
continue; continue;
float penalty = ProcessSample(vcand, cs, pos, rad, vel, dvel, minPenalty, debug); float penalty = ProcessSample(vcand, cs, pos, rad, vel, dvel, minPenalty, debug);
@ -377,9 +377,9 @@ namespace DotRecast.Detour.Crowd
RcVec3f dest = new RcVec3f(); RcVec3f dest = new RcVec3f();
float c = (float)Math.Cos(ang); float c = (float)Math.Cos(ang);
float s = (float)Math.Sin(ang); float s = (float)Math.Sin(ang);
dest.x = v[0] * c - v[2] * s; dest.X = v[0] * c - v[2] * s;
dest.z = v[0] * s + v[2] * c; dest.Z = v[0] * s + v[2] * c;
dest.y = v[1]; dest.Y = v[1];
return dest; return dest;
} }
@ -416,14 +416,14 @@ namespace DotRecast.Detour.Crowd
// desired direction // desired direction
float[] ddir = new float[6]; float[] ddir = new float[6];
ddir[0] = dvel.x; ddir[0] = dvel.X;
ddir[1] = dvel.y; ddir[1] = dvel.Y;
ddir[2] = dvel.z; ddir[2] = dvel.Z;
DtNormalize2D(ddir); DtNormalize2D(ddir);
RcVec3f rotated = DtRotate2D(ddir, da * 0.5f); // rotated by da/2 RcVec3f rotated = DtRotate2D(ddir, da * 0.5f); // rotated by da/2
ddir[3] = rotated.x; ddir[3] = rotated.X;
ddir[4] = rotated.y; ddir[4] = rotated.Y;
ddir[5] = rotated.z; ddir[5] = rotated.Z;
// Always add sample at zero // Always add sample at zero
pat[npat * 2 + 0] = 0; pat[npat * 2 + 0] = 0;
@ -463,7 +463,7 @@ namespace DotRecast.Detour.Crowd
// Start sampling. // Start sampling.
float cr = vmax * (1.0f - m_params.velBias); 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 = RcVec3f.Of(dvel.X * m_params.velBias, 0, dvel.Z * m_params.velBias);
int ns = 0; int ns = 0;
for (int k = 0; k < depth; ++k) for (int k = 0; k < depth; ++k)
{ {
@ -473,8 +473,8 @@ namespace DotRecast.Detour.Crowd
for (int i = 0; i < npat; ++i) 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 = RcVec3f.Of(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)) if (RcMath.Sqr(vcand.X) + RcMath.Sqr(vcand.Z) > RcMath.Sqr(vmax + 0.001f))
continue; continue;
float penalty = ProcessSample(vcand, cr / 10, pos, rad, vel, dvel, minPenalty, debug); float penalty = ProcessSample(vcand, cr / 10, pos, rad, vel, dvel, minPenalty, debug);

View File

@ -314,7 +314,7 @@ namespace DotRecast.Detour.Crowd
status = navquery.GetPolyHeight(m_path[0], result, out var h); status = navquery.GetPolyHeight(m_path[0], result, out var h);
if (status.Succeeded()) if (status.Succeeded())
{ {
m_pos.y = h; m_pos.Y = h;
} }
return true; return true;

View File

@ -47,9 +47,9 @@ namespace DotRecast.Detour.Dynamic.Colliders
float s0 = (i & 1) != 0 ? 1f : -1f; float s0 = (i & 1) != 0 ? 1f : -1f;
float s1 = (i & 2) != 0 ? 1f : -1f; float s1 = (i & 2) != 0 ? 1f : -1f;
float s2 = (i & 4) != 0 ? 1f : -1f; float s2 = (i & 4) != 0 ? 1f : -1f;
float vx = center.x + s0 * halfEdges[0].x + s1 * halfEdges[1].x + s2 * halfEdges[2].x; float vx = center.X + s0 * halfEdges[0].X + s1 * halfEdges[1].X + s2 * halfEdges[2].X;
float vy = center.y + s0 * halfEdges[0].y + s1 * halfEdges[1].y + s2 * halfEdges[2].y; float vy = center.Y + s0 * halfEdges[0].Y + s1 * halfEdges[1].Y + s2 * halfEdges[2].Y;
float vz = center.z + s0 * halfEdges[0].z + s1 * halfEdges[1].z + s2 * halfEdges[2].z; float vz = center.Z + s0 * halfEdges[0].Z + s1 * halfEdges[1].Z + s2 * halfEdges[2].Z;
bounds[0] = Math.Min(bounds[0], vx); bounds[0] = Math.Min(bounds[0], vx);
bounds[1] = Math.Min(bounds[1], vy); bounds[1] = Math.Min(bounds[1], vy);
bounds[2] = Math.Min(bounds[2], vz); bounds[2] = Math.Min(bounds[2], vz);
@ -72,7 +72,7 @@ namespace DotRecast.Detour.Dynamic.Colliders
RcVec3f[] halfEdges = RcVec3f[] halfEdges =
{ {
RcVec3f.Zero, RcVec3f.Zero,
RcVec3f.Of(up.x, up.y, up.z), RcVec3f.Of(up.X, up.Y, up.Z),
RcVec3f.Zero RcVec3f.Zero
}; };
RcVec3f.Normalize(ref halfEdges[1]); RcVec3f.Normalize(ref halfEdges[1]);
@ -80,15 +80,15 @@ namespace DotRecast.Detour.Dynamic.Colliders
RcVec3f.Normalize(ref halfEdges[0]); RcVec3f.Normalize(ref halfEdges[0]);
RcVec3f.Cross(ref halfEdges[2], halfEdges[0], up); RcVec3f.Cross(ref halfEdges[2], halfEdges[0], up);
RcVec3f.Normalize(ref halfEdges[2]); RcVec3f.Normalize(ref halfEdges[2]);
halfEdges[0].x *= extent.x; halfEdges[0].X *= extent.X;
halfEdges[0].y *= extent.x; halfEdges[0].Y *= extent.X;
halfEdges[0].z *= extent.x; halfEdges[0].Z *= extent.X;
halfEdges[1].x *= extent.y; halfEdges[1].X *= extent.Y;
halfEdges[1].y *= extent.y; halfEdges[1].Y *= extent.Y;
halfEdges[1].z *= extent.y; halfEdges[1].Z *= extent.Y;
halfEdges[2].x *= extent.z; halfEdges[2].X *= extent.Z;
halfEdges[2].y *= extent.z; halfEdges[2].Y *= extent.Z;
halfEdges[2].z *= extent.z; halfEdges[2].Z *= extent.Z;
return halfEdges; return halfEdges;
} }
} }

View File

@ -46,9 +46,9 @@ namespace DotRecast.Detour.Dynamic.Colliders
{ {
return new float[] return new float[]
{ {
Math.Min(start.x, end.x) - radius, Math.Min(start.y, end.y) - radius, Math.Min(start.X, end.X) - radius, Math.Min(start.Y, end.Y) - radius,
Math.Min(start.z, end.z) - radius, Math.Max(start.x, end.x) + radius, Math.Max(start.y, end.y) + radius, 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 Math.Max(start.Z, end.Z) + radius
}; };
} }
} }

View File

@ -47,9 +47,9 @@ namespace DotRecast.Detour.Dynamic.Colliders
{ {
return new float[] return new float[]
{ {
Math.Min(start.x, end.x) - radius, Math.Min(start.y, end.y) - radius, Math.Min(start.X, end.X) - radius, Math.Min(start.Y, end.Y) - radius,
Math.Min(start.z, end.z) - radius, Math.Max(start.x, end.x) + radius, Math.Max(start.y, end.y) + radius, 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 Math.Max(start.Z, end.Z) + radius
}; };
} }
} }

View File

@ -45,12 +45,12 @@ namespace DotRecast.Detour.Dynamic.Colliders
{ {
return new float[] return new float[]
{ {
center.x - radius, center.X - radius,
center.y - radius, center.Y - radius,
center.z - radius, center.Z - radius,
center.x + radius, center.X + radius,
center.y + radius, center.Y + radius,
center.z + radius center.Z + radius
}; };
} }
} }

View File

@ -59,9 +59,9 @@ namespace DotRecast.Detour.Dynamic
config.detailSampleMaxError = voxelFile.detailSampleMaxError; config.detailSampleMaxError = voxelFile.detailSampleMaxError;
builder = new RcBuilder(); builder = new RcBuilder();
navMeshParams = new DtNavMeshParams(); navMeshParams = new DtNavMeshParams();
navMeshParams.orig.x = voxelFile.bounds[0]; navMeshParams.orig.X = voxelFile.bounds[0];
navMeshParams.orig.y = voxelFile.bounds[1]; navMeshParams.orig.Y = voxelFile.bounds[1];
navMeshParams.orig.z = voxelFile.bounds[2]; navMeshParams.orig.Z = voxelFile.bounds[2];
navMeshParams.tileWidth = voxelFile.cellSize * voxelFile.tileSizeX; navMeshParams.tileWidth = voxelFile.cellSize * voxelFile.tileSizeX;
navMeshParams.tileHeight = voxelFile.cellSize * voxelFile.tileSizeZ; navMeshParams.tileHeight = voxelFile.cellSize * voxelFile.tileSizeZ;
navMeshParams.maxTiles = voxelFile.tiles.Count; navMeshParams.maxTiles = voxelFile.tiles.Count;
@ -189,10 +189,10 @@ namespace DotRecast.Detour.Dynamic
return _tiles.Values; return _tiles.Values;
} }
int minx = (int)Math.Floor((bounds[0] - navMeshParams.orig.x) / navMeshParams.tileWidth); int minx = (int)Math.Floor((bounds[0] - navMeshParams.orig.X) / navMeshParams.tileWidth);
int minz = (int)Math.Floor((bounds[2] - navMeshParams.orig.z) / navMeshParams.tileHeight); int minz = (int)Math.Floor((bounds[2] - navMeshParams.orig.Z) / navMeshParams.tileHeight);
int maxx = (int)Math.Floor((bounds[3] - navMeshParams.orig.x) / navMeshParams.tileWidth); int maxx = (int)Math.Floor((bounds[3] - navMeshParams.orig.X) / navMeshParams.tileWidth);
int maxz = (int)Math.Floor((bounds[5] - navMeshParams.orig.z) / navMeshParams.tileHeight); int maxz = (int)Math.Floor((bounds[5] - navMeshParams.orig.Z) / navMeshParams.tileHeight);
List<DtDynamicTile> tiles = new List<DtDynamicTile>(); List<DtDynamicTile> tiles = new List<DtDynamicTile>();
for (int z = minz; z <= maxz; ++z) for (int z = minz; z <= maxz; ++z)
{ {

View File

@ -73,7 +73,7 @@ namespace DotRecast.Detour.Dynamic
{ {
if (!rasterizedColliders.Contains(cid)) if (!rasterizedColliders.Contains(cid))
{ {
heightfield.bmax.y = Math.Max(heightfield.bmax.y, c.Bounds()[4] + heightfield.ch * 2); heightfield.bmax.Y = Math.Max(heightfield.bmax.Y, c.Bounds()[4] + heightfield.ch * 2);
c.Rasterize(heightfield, telemetry); c.Rasterize(heightfield, telemetry);
} }
} }

View File

@ -55,20 +55,20 @@ namespace DotRecast.Detour.Dynamic
private bool TraverseTiles(RcVec3f start, RcVec3f end, out float hit) private bool TraverseTiles(RcVec3f start, RcVec3f end, out float hit)
{ {
float relStartX = start.x - origin.x; float relStartX = start.X - origin.X;
float relStartZ = start.z - origin.z; float relStartZ = start.Z - origin.Z;
int sx = (int)Math.Floor(relStartX / tileWidth); int sx = (int)Math.Floor(relStartX / tileWidth);
int sz = (int)Math.Floor(relStartZ / tileDepth); int sz = (int)Math.Floor(relStartZ / tileDepth);
int ex = (int)Math.Floor((end.x - origin.x) / tileWidth); int ex = (int)Math.Floor((end.X - origin.X) / tileWidth);
int ez = (int)Math.Floor((end.z - origin.z) / tileDepth); int ez = (int)Math.Floor((end.Z - origin.Z) / tileDepth);
int dx = ex - sx; int dx = ex - sx;
int dz = ez - sz; int dz = ez - sz;
int stepX = dx < 0 ? -1 : 1; int stepX = dx < 0 ? -1 : 1;
int stepZ = dz < 0 ? -1 : 1; int stepZ = dz < 0 ? -1 : 1;
float xRem = (tileWidth + (relStartX % tileWidth)) % tileWidth; float xRem = (tileWidth + (relStartX % tileWidth)) % tileWidth;
float zRem = (tileDepth + (relStartZ % tileDepth)) % tileDepth; float zRem = (tileDepth + (relStartZ % tileDepth)) % tileDepth;
float tx = end.x - start.x; float tx = end.X - start.X;
float tz = end.z - start.z; float tz = end.Z - start.Z;
float xOffest = Math.Abs(tx < 0 ? xRem : tileWidth - xRem); float xOffest = Math.Abs(tx < 0 ? xRem : tileWidth - xRem);
float zOffest = Math.Abs(tz < 0 ? zRem : tileDepth - zRem); float zOffest = Math.Abs(tz < 0 ? zRem : tileDepth - zRem);
tx = Math.Abs(tx); tx = Math.Abs(tx);
@ -113,17 +113,17 @@ namespace DotRecast.Detour.Dynamic
RcHeightfield hf = heightfieldProvider.Invoke(x, z); RcHeightfield hf = heightfieldProvider.Invoke(x, z);
if (null != hf) if (null != hf)
{ {
float tx = end.x - start.x; float tx = end.X - start.X;
float ty = end.y - start.y; float ty = end.Y - start.Y;
float tz = end.z - start.z; float tz = end.Z - start.Z;
float[] entry = { start.x + tMin * tx, start.y + tMin * ty, start.z + tMin * tz }; float[] entry = { start.X + tMin * tx, start.Y + tMin * ty, start.Z + tMin * tz };
float[] exit = { start.x + tMax * tx, start.y + tMax * ty, start.z + tMax * tz }; float[] exit = { start.X + tMax * tx, start.Y + tMax * ty, start.Z + tMax * tz };
float relStartX = entry[0] - hf.bmin.x; float relStartX = entry[0] - hf.bmin.X;
float relStartZ = entry[2] - hf.bmin.z; float relStartZ = entry[2] - hf.bmin.Z;
int sx = (int)Math.Floor(relStartX / hf.cs); int sx = (int)Math.Floor(relStartX / hf.cs);
int sz = (int)Math.Floor(relStartZ / hf.cs); int sz = (int)Math.Floor(relStartZ / hf.cs);
int ex = (int)Math.Floor((exit[0] - hf.bmin.x) / hf.cs); int ex = (int)Math.Floor((exit[0] - hf.bmin.X) / hf.cs);
int ez = (int)Math.Floor((exit[2] - hf.bmin.z) / hf.cs); int ez = (int)Math.Floor((exit[2] - hf.bmin.Z) / hf.cs);
int dx = ex - sx; int dx = ex - sx;
int dz = ez - sz; int dz = ez - sz;
int stepX = dx < 0 ? -1 : 1; int stepX = dx < 0 ? -1 : 1;
@ -143,8 +143,8 @@ namespace DotRecast.Detour.Dynamic
{ {
if (sx >= 0 && sx < hf.width && sz >= 0 && sz < hf.height) if (sx >= 0 && sx < hf.width && sz >= 0 && sz < hf.height)
{ {
float y1 = start.y + ty * (tMin + t) - hf.bmin.y; float y1 = start.Y + ty * (tMin + t) - hf.bmin.Y;
float y2 = start.y + ty * (tMin + Math.Min(tMaxX, tMaxZ)) - hf.bmin.y; float y2 = start.Y + ty * (tMin + Math.Min(tMaxX, tMaxZ)) - hf.bmin.Y;
float ymin = Math.Min(y1, y2) / hf.ch; float ymin = Math.Min(y1, y2) / hf.ch;
float ymax = Math.Max(y1, y2) / hf.ch; float ymax = Math.Max(y1, y2) / hf.ch;
RcSpan span = hf.spans[sx + sz * hf.width]; RcSpan span = hf.spans[sx + sz * hf.width];

View File

@ -109,12 +109,12 @@ namespace DotRecast.Detour.Dynamic.Io
foreach (RcBuilderResult r in results) foreach (RcBuilderResult r in results)
{ {
f.tiles.Add(new DtVoxelTile(r.tileX, r.tileZ, r.GetSolidHeightfield())); f.tiles.Add(new DtVoxelTile(r.tileX, r.tileZ, r.GetSolidHeightfield()));
f.bounds[0] = Math.Min(f.bounds[0], r.GetSolidHeightfield().bmin.x); f.bounds[0] = Math.Min(f.bounds[0], r.GetSolidHeightfield().bmin.X);
f.bounds[1] = Math.Min(f.bounds[1], r.GetSolidHeightfield().bmin.y); f.bounds[1] = Math.Min(f.bounds[1], r.GetSolidHeightfield().bmin.Y);
f.bounds[2] = Math.Min(f.bounds[2], r.GetSolidHeightfield().bmin.z); f.bounds[2] = Math.Min(f.bounds[2], r.GetSolidHeightfield().bmin.Z);
f.bounds[3] = Math.Max(f.bounds[3], r.GetSolidHeightfield().bmax.x); f.bounds[3] = Math.Max(f.bounds[3], r.GetSolidHeightfield().bmax.X);
f.bounds[4] = Math.Max(f.bounds[4], r.GetSolidHeightfield().bmax.y); f.bounds[4] = Math.Max(f.bounds[4], r.GetSolidHeightfield().bmax.Y);
f.bounds[5] = Math.Max(f.bounds[5], r.GetSolidHeightfield().bmax.z); f.bounds[5] = Math.Max(f.bounds[5], r.GetSolidHeightfield().bmax.Z);
} }
return f; return f;
@ -154,12 +154,12 @@ namespace DotRecast.Detour.Dynamic.Io
{ {
RcHeightfield heightfield = vt.Heightfield(); RcHeightfield heightfield = vt.Heightfield();
f.tiles.Add(new DtVoxelTile(vt.tileX, vt.tileZ, heightfield)); f.tiles.Add(new DtVoxelTile(vt.tileX, vt.tileZ, heightfield));
f.bounds[0] = Math.Min(f.bounds[0], vt.boundsMin.x); f.bounds[0] = Math.Min(f.bounds[0], vt.boundsMin.X);
f.bounds[1] = Math.Min(f.bounds[1], vt.boundsMin.y); f.bounds[1] = Math.Min(f.bounds[1], vt.boundsMin.Y);
f.bounds[2] = Math.Min(f.bounds[2], vt.boundsMin.z); f.bounds[2] = Math.Min(f.bounds[2], vt.boundsMin.Z);
f.bounds[3] = Math.Max(f.bounds[3], vt.boundsMax.x); f.bounds[3] = Math.Max(f.bounds[3], vt.boundsMax.X);
f.bounds[4] = Math.Max(f.bounds[4], vt.boundsMax.y); f.bounds[4] = Math.Max(f.bounds[4], vt.boundsMax.Y);
f.bounds[5] = Math.Max(f.bounds[5], vt.boundsMax.z); f.bounds[5] = Math.Max(f.bounds[5], vt.boundsMax.Z);
} }
return f; return f;

View File

@ -79,9 +79,9 @@ namespace DotRecast.Detour.Dynamic.Io
file.useTiles = buf.Get() != 0; file.useTiles = buf.Get() != 0;
file.tileSizeX = buf.GetInt(); file.tileSizeX = buf.GetInt();
file.tileSizeZ = buf.GetInt(); file.tileSizeZ = buf.GetInt();
file.rotation.x = buf.GetFloat(); file.rotation.X = buf.GetFloat();
file.rotation.y = buf.GetFloat(); file.rotation.Y = buf.GetFloat();
file.rotation.z = buf.GetFloat(); file.rotation.Z = buf.GetFloat();
file.bounds[0] = buf.GetFloat(); file.bounds[0] = buf.GetFloat();
file.bounds[1] = buf.GetFloat(); file.bounds[1] = buf.GetFloat();
file.bounds[2] = buf.GetFloat(); file.bounds[2] = buf.GetFloat();
@ -108,22 +108,22 @@ namespace DotRecast.Detour.Dynamic.Io
int depth = buf.GetInt(); int depth = buf.GetInt();
int borderSize = buf.GetInt(); int borderSize = buf.GetInt();
RcVec3f boundsMin = new RcVec3f(); RcVec3f boundsMin = new RcVec3f();
boundsMin.x = buf.GetFloat(); boundsMin.X = buf.GetFloat();
boundsMin.y = buf.GetFloat(); boundsMin.Y = buf.GetFloat();
boundsMin.z = buf.GetFloat(); boundsMin.Z = buf.GetFloat();
RcVec3f boundsMax = new RcVec3f(); RcVec3f boundsMax = new RcVec3f();
boundsMax.x = buf.GetFloat(); boundsMax.X = buf.GetFloat();
boundsMax.y = buf.GetFloat(); boundsMax.Y = buf.GetFloat();
boundsMax.z = buf.GetFloat(); boundsMax.Z = buf.GetFloat();
if (isExportedFromAstar) if (isExportedFromAstar)
{ {
// bounds are local // bounds are local
boundsMin.x += file.bounds[0]; boundsMin.X += file.bounds[0];
boundsMin.y += file.bounds[1]; boundsMin.Y += file.bounds[1];
boundsMin.z += file.bounds[2]; boundsMin.Z += file.bounds[2];
boundsMax.x += file.bounds[0]; boundsMax.X += file.bounds[0];
boundsMax.y += file.bounds[1]; boundsMax.Y += file.bounds[1];
boundsMax.z += file.bounds[2]; boundsMax.Z += file.bounds[2];
} }
float cellSize = buf.GetFloat(); float cellSize = buf.GetFloat();

View File

@ -57,9 +57,9 @@ namespace DotRecast.Detour.Dynamic.Io
Write(stream, f.useTiles); Write(stream, f.useTiles);
Write(stream, f.tileSizeX, byteOrder); Write(stream, f.tileSizeX, byteOrder);
Write(stream, f.tileSizeZ, byteOrder); Write(stream, f.tileSizeZ, byteOrder);
Write(stream, f.rotation.x, byteOrder); Write(stream, f.rotation.X, byteOrder);
Write(stream, f.rotation.y, byteOrder); Write(stream, f.rotation.Y, byteOrder);
Write(stream, f.rotation.z, byteOrder); Write(stream, f.rotation.Z, byteOrder);
Write(stream, f.bounds[0], byteOrder); Write(stream, f.bounds[0], byteOrder);
Write(stream, f.bounds[1], byteOrder); Write(stream, f.bounds[1], byteOrder);
Write(stream, f.bounds[2], byteOrder); Write(stream, f.bounds[2], byteOrder);
@ -80,12 +80,12 @@ namespace DotRecast.Detour.Dynamic.Io
Write(stream, tile.width, byteOrder); Write(stream, tile.width, byteOrder);
Write(stream, tile.depth, byteOrder); Write(stream, tile.depth, byteOrder);
Write(stream, tile.borderSize, byteOrder); Write(stream, tile.borderSize, byteOrder);
Write(stream, tile.boundsMin.x, byteOrder); Write(stream, tile.boundsMin.X, byteOrder);
Write(stream, tile.boundsMin.y, byteOrder); Write(stream, tile.boundsMin.Y, byteOrder);
Write(stream, tile.boundsMin.z, byteOrder); Write(stream, tile.boundsMin.Z, byteOrder);
Write(stream, tile.boundsMax.x, byteOrder); Write(stream, tile.boundsMax.X, byteOrder);
Write(stream, tile.boundsMax.y, byteOrder); Write(stream, tile.boundsMax.Y, byteOrder);
Write(stream, tile.boundsMax.z, byteOrder); Write(stream, tile.boundsMax.Z, byteOrder);
Write(stream, tile.cellSize, byteOrder); Write(stream, tile.cellSize, byteOrder);
Write(stream, tile.cellHeight, byteOrder); Write(stream, tile.cellHeight, byteOrder);
byte[] bytes = tile.spanData; byte[] bytes = tile.spanData;

View File

@ -51,12 +51,12 @@ namespace DotRecast.Detour.Extras
bmax.Max(data.verts, data.polys[i].verts[j] * 3); bmax.Max(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[0] = 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[1] = 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[2] = 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[0] = 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[1] = 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[2] = 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

@ -35,9 +35,9 @@ namespace DotRecast.Detour.Extras.Jumplink
seg.gsamples[i] = s; seg.gsamples[i] = s;
RcVec3f pt = RcVec3f.Lerp(seg.p, seg.q, u); RcVec3f pt = RcVec3f.Lerp(seg.p, seg.q, u);
bool success = heightFunc.Invoke(pt, seg.height, out var height); bool success = heightFunc.Invoke(pt, seg.height, out var height);
s.p.x = pt.x; s.p.X = pt.X;
s.p.y = height; s.p.Y = height;
s.p.z = pt.z; s.p.Z = pt.Z;
if (!success) if (!success)
{ {

View File

@ -9,9 +9,9 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
return new RcVec3f() return new RcVec3f()
{ {
x = Lerp(start.x, end.x, Math.Min(2f * u, 1f)), X = Lerp(start.X, end.X, Math.Min(2f * u, 1f)),
y = Lerp(start.y, end.y, Math.Max(0f, 2f * u - 1f)), Y = Lerp(start.Y, end.Y, Math.Max(0f, 2f * u - 1f)),
z = Lerp(start.z, end.z, Math.Min(2f * u, 1f)) Z = Lerp(start.Z, end.Z, Math.Min(2f * u, 1f))
}; };
} }
} }

View File

@ -58,12 +58,12 @@ namespace DotRecast.Detour.Extras.Jumplink
int va = mesh.polys[p + j] * 3; int va = mesh.polys[p + j] * 3;
int vb = mesh.polys[p + nj] * 3; int vb = mesh.polys[p + nj] * 3;
JumpEdge e = new JumpEdge(); JumpEdge e = new JumpEdge();
e.sp.x = orig.x + mesh.verts[vb] * cs; e.sp.X = orig.X + mesh.verts[vb] * cs;
e.sp.y = orig.y + mesh.verts[vb + 1] * ch; e.sp.Y = orig.Y + mesh.verts[vb + 1] * ch;
e.sp.z = orig.z + mesh.verts[vb + 2] * cs; e.sp.Z = orig.Z + mesh.verts[vb + 2] * cs;
e.sq.x = orig.x + mesh.verts[va] * cs; e.sq.X = orig.X + mesh.verts[va] * cs;
e.sq.y = orig.y + mesh.verts[va + 1] * ch; e.sq.Y = orig.Y + mesh.verts[va + 1] * ch;
e.sq.z = orig.z + mesh.verts[va + 2] * cs; e.sq.Z = orig.Z + mesh.verts[va + 2] * cs;
edges.Add(e); edges.Add(e);
} }
} }

View File

@ -18,7 +18,7 @@ namespace DotRecast.Detour.Extras.Jumplink
this.trajectory = trajectory; this.trajectory = trajectory;
ax = edge.sq.Subtract(edge.sp); ax = edge.sq.Subtract(edge.sp);
ax.Normalize(); ax.Normalize();
az.Set(ax.z, 0, -ax.x); az.Set(ax.Z, 0, -ax.X);
az.Normalize(); az.Normalize();
ay.Set(0, 1, 0); ay.Set(0, 1, 0);
} }

View File

@ -30,7 +30,7 @@ namespace DotRecast.Detour.Extras.Jumplink
EdgeSampler es = new EdgeSampler(edge, new JumpTrajectory(acfg.jumpHeight)); EdgeSampler es = new EdgeSampler(edge, new JumpTrajectory(acfg.jumpHeight));
es.start.height = acfg.agentClimb * 2; es.start.height = acfg.agentClimb * 2;
RcVec3f offset = new RcVec3f(); RcVec3f offset = new RcVec3f();
Trans2d(ref offset, es.az, es.ay, new RcVec2f { x = acfg.startDistance, y = -acfg.agentClimb, }); Trans2d(ref offset, es.az, es.ay, new RcVec2f { X = acfg.startDistance, Y = -acfg.agentClimb, });
Vadd(ref es.start.p, edge.sp, offset); Vadd(ref es.start.p, edge.sp, offset);
Vadd(ref es.start.q, edge.sq, offset); Vadd(ref es.start.q, edge.sq, offset);
@ -42,7 +42,7 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
float v = (float)j / (float)(nsamples - 1); float v = (float)j / (float)(nsamples - 1);
float ox = 2 * acfg.agentRadius + dx * v; float ox = 2 * acfg.agentRadius + dx * v;
Trans2d(ref offset, es.az, es.ay, new RcVec2f { x = ox, y = acfg.minHeight }); Trans2d(ref offset, es.az, es.ay, new RcVec2f { X = ox, Y = acfg.minHeight });
GroundSegment end = new GroundSegment(); GroundSegment end = new GroundSegment();
end.height = acfg.heightRange; end.height = acfg.heightRange;
Vadd(ref end.p, edge.sp, offset); Vadd(ref end.p, edge.sp, offset);
@ -58,11 +58,11 @@ namespace DotRecast.Detour.Extras.Jumplink
EdgeSampler es = new EdgeSampler(edge, new ClimbTrajectory()); EdgeSampler es = new EdgeSampler(edge, new ClimbTrajectory());
es.start.height = acfg.agentClimb * 2; es.start.height = acfg.agentClimb * 2;
RcVec3f offset = new RcVec3f(); RcVec3f offset = new RcVec3f();
Trans2d(ref offset, es.az, es.ay, new RcVec2f() { x = acfg.startDistance, y = -acfg.agentClimb }); Trans2d(ref offset, es.az, es.ay, new RcVec2f() { X = acfg.startDistance, Y = -acfg.agentClimb });
Vadd(ref es.start.p, edge.sp, offset); Vadd(ref es.start.p, edge.sp, offset);
Vadd(ref es.start.q, edge.sq, offset); Vadd(ref es.start.q, edge.sq, offset);
Trans2d(ref offset, es.az, es.ay, new RcVec2f() { x = acfg.endDistance, y = acfg.minHeight }); Trans2d(ref offset, es.az, es.ay, new RcVec2f() { X = acfg.endDistance, Y = acfg.minHeight });
GroundSegment end = new GroundSegment(); GroundSegment end = new GroundSegment();
end.height = acfg.heightRange; end.height = acfg.heightRange;
Vadd(ref end.p, edge.sp, offset); Vadd(ref end.p, edge.sp, offset);
@ -80,9 +80,9 @@ namespace DotRecast.Detour.Extras.Jumplink
private void Vadd(ref RcVec3f dest, RcVec3f v1, RcVec3f v2) private void Vadd(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
{ {
dest.x = v1.x + v2.x; dest.X = v1.X + v2.X;
dest.y = v1.y + v2.y; dest.Y = v1.Y + v2.Y;
dest.z = v1.z + v2.z; dest.Z = v1.Z + v2.Z;
} }
@ -95,9 +95,9 @@ namespace DotRecast.Detour.Extras.Jumplink
private void Trans2d(ref RcVec3f dst, RcVec3f ax, RcVec3f ay, RcVec2f pt) private void Trans2d(ref RcVec3f dst, RcVec3f ax, RcVec3f ay, RcVec2f pt)
{ {
dst.x = ax.x * pt.x + ay.x * pt.y; dst.X = ax.X * pt.X + ay.X * pt.Y;
dst.y = ax.y * pt.x + ay.y * pt.y; dst.Y = ax.Y * pt.X + ay.Y * pt.Y;
dst.z = ax.z * pt.x + ay.z * pt.y; dst.Z = ax.Z * pt.X + ay.Z * pt.Y;
} }
} }

View File

@ -72,14 +72,14 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
float u = ((float)j) / (link.nspine - 1); float u = ((float)j) / (link.nspine - 1);
RcVec3f p = es.trajectory.Apply(sp, ep, u); RcVec3f p = es.trajectory.Apply(sp, ep, u);
link.spine0[j * 3] = p.x; link.spine0[j * 3] = p.X;
link.spine0[j * 3 + 1] = p.y; link.spine0[j * 3 + 1] = p.Y;
link.spine0[j * 3 + 2] = p.z; link.spine0[j * 3 + 2] = p.Z;
p = es.trajectory.Apply(sq, eq, u); p = es.trajectory.Apply(sq, eq, u);
link.spine1[j * 3] = p.x; link.spine1[j * 3] = p.X;
link.spine1[j * 3 + 1] = p.y; link.spine1[j * 3 + 1] = p.Y;
link.spine1[j * 3 + 2] = p.z; link.spine1[j * 3 + 2] = p.Z;
} }
} }
} }

View File

@ -94,7 +94,7 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
GroundSample p = es.end[j].gsamples[i]; GroundSample p = es.end[j].gsamples[i];
sampleGrid[i][j] = region; sampleGrid[i][j] = region;
float h = p.p.y; float h = p.p.Y;
if (i < sampleGrid.Length - 1) if (i < sampleGrid.Length - 1)
{ {
AddNeighbour(es, queue, agentClimb, h, i + 1, j); AddNeighbour(es, queue, agentClimb, h, i + 1, j);
@ -121,7 +121,7 @@ namespace DotRecast.Detour.Extras.Jumplink
private void AddNeighbour(EdgeSampler es, Queue<int[]> queue, float agentClimb, float h, int i, int j) private void AddNeighbour(EdgeSampler es, Queue<int[]> queue, float agentClimb, float h, int i, int j)
{ {
GroundSample q = es.end[j].gsamples[i]; GroundSample q = es.end[j].gsamples[i];
if (q.validTrajectory && Math.Abs(q.p.y - h) < agentClimb) if (q.validTrajectory && Math.Abs(q.p.Y - h) < agentClimb)
{ {
queue.Enqueue(new int[] { i, j }); queue.Enqueue(new int[] { i, j });
} }

View File

@ -16,9 +16,9 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
return new RcVec3f return new RcVec3f
{ {
x = Lerp(start.x, end.x, u), X = Lerp(start.X, end.X, u),
y = InterpolateHeight(start.y, end.y, u), Y = InterpolateHeight(start.Y, end.Y, u),
z = Lerp(start.z, end.z, u) Z = Lerp(start.Z, end.Z, u)
}; };
} }

View File

@ -44,10 +44,10 @@ namespace DotRecast.Detour.Extras.Jumplink
{ {
height = default; height = default;
RcVec3f halfExtents = new RcVec3f { x = cs, y = heightRange, z = cs }; RcVec3f halfExtents = new RcVec3f { X = cs, Y = heightRange, Z = cs };
float maxHeight = pt.y + heightRange; float maxHeight = pt.Y + heightRange;
RcAtomicBoolean found = new RcAtomicBoolean(); RcAtomicBoolean found = new RcAtomicBoolean();
RcAtomicFloat minHeight = new RcAtomicFloat(pt.y); RcAtomicFloat minHeight = new RcAtomicFloat(pt.Y);
navMeshQuery.QueryPolygons(pt, halfExtents, DtQueryNoOpFilter.Shared, new PolyQueryInvoker((tile, poly, refs) => navMeshQuery.QueryPolygons(pt, halfExtents, DtQueryNoOpFilter.Shared, new PolyQueryInvoker((tile, poly, refs) =>
{ {
@ -68,7 +68,7 @@ namespace DotRecast.Detour.Extras.Jumplink
return true; return true;
} }
height = pt.y; height = pt.Y;
return false; return false;
} }
} }

View File

@ -35,13 +35,13 @@ namespace DotRecast.Detour.Extras.Jumplink
private bool SampleTrajectory(JumpLinkBuilderConfig acfg, RcHeightfield solid, RcVec3f pa, RcVec3f pb, Trajectory tra) private bool SampleTrajectory(JumpLinkBuilderConfig acfg, RcHeightfield solid, RcVec3f pa, RcVec3f pb, Trajectory tra)
{ {
float cs = Math.Min(acfg.cellSize, acfg.cellHeight); float cs = Math.Min(acfg.cellSize, acfg.cellHeight);
float d = RcVec3f.Dist2D(pa, pb) + Math.Abs(pa.y - pb.y); float d = RcVec3f.Dist2D(pa, pb) + Math.Abs(pa.Y - pb.Y);
int nsamples = Math.Max(2, (int)Math.Ceiling(d / cs)); int nsamples = Math.Max(2, (int)Math.Ceiling(d / cs));
for (int i = 0; i < nsamples; ++i) for (int i = 0; i < nsamples; ++i)
{ {
float u = (float)i / (float)(nsamples - 1); float u = (float)i / (float)(nsamples - 1);
RcVec3f p = tra.Apply(pa, pb, u); RcVec3f p = tra.Apply(pa, pb, u);
if (CheckHeightfieldCollision(solid, p.x, p.y + acfg.groundTolerance, p.y + acfg.agentHeight, p.z)) if (CheckHeightfieldCollision(solid, p.X, p.Y + acfg.groundTolerance, p.Y + acfg.agentHeight, p.Z))
{ {
return false; return false;
} }
@ -57,8 +57,8 @@ namespace DotRecast.Detour.Extras.Jumplink
float cs = solid.cs; float cs = solid.cs;
float ch = solid.ch; float ch = solid.ch;
RcVec3f orig = solid.bmin; RcVec3f orig = solid.bmin;
int ix = (int)Math.Floor((x - orig.x) / cs); int ix = (int)Math.Floor((x - orig.X) / cs);
int iz = (int)Math.Floor((z - orig.z) / cs); int iz = (int)Math.Floor((z - orig.Z) / cs);
if (ix < 0 || iz < 0 || ix > w || iz > h) if (ix < 0 || iz < 0 || ix > w || iz > h)
{ {
@ -73,8 +73,8 @@ namespace DotRecast.Detour.Extras.Jumplink
while (s != null) while (s != null)
{ {
float symin = orig.y + s.smin * ch; float symin = orig.Y + s.smin * ch;
float symax = orig.y + s.smax * ch; float symax = orig.Y + s.smax * ch;
if (OverlapRange(ymin, ymax, symin, symax)) if (OverlapRange(ymin, ymax, symin, symax))
{ {
return true; return true;

View File

@ -126,15 +126,15 @@ 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;

View File

@ -63,21 +63,21 @@ namespace DotRecast.Detour.Extras.Unity.Astar
// In case of external link to other tiles we must find the direction // In case of external link to other tiles we must find the direction
private void BuildExternalLink(DtMeshData tile, DtPoly node, DtMeshData neighbourTile) private void BuildExternalLink(DtMeshData tile, DtPoly node, DtMeshData neighbourTile)
{ {
if (neighbourTile.header.bmin.x > tile.header.bmin.x) if (neighbourTile.header.bmin.X > tile.header.bmin.X)
{ {
node.neis[DtPolyUtils.FindEdge(node, tile, neighbourTile.header.bmin.x, 0)] = DtNavMesh.DT_EXT_LINK; node.neis[DtPolyUtils.FindEdge(node, tile, neighbourTile.header.bmin.X, 0)] = DtNavMesh.DT_EXT_LINK;
} }
else if (neighbourTile.header.bmin.x < tile.header.bmin.x) else if (neighbourTile.header.bmin.X < tile.header.bmin.X)
{ {
node.neis[DtPolyUtils.FindEdge(node, tile, tile.header.bmin.x, 0)] = DtNavMesh.DT_EXT_LINK | 4; node.neis[DtPolyUtils.FindEdge(node, tile, tile.header.bmin.X, 0)] = DtNavMesh.DT_EXT_LINK | 4;
} }
else if (neighbourTile.header.bmin.z > tile.header.bmin.z) else if (neighbourTile.header.bmin.Z > tile.header.bmin.Z)
{ {
node.neis[DtPolyUtils.FindEdge(node, tile, neighbourTile.header.bmin.z, 2)] = DtNavMesh.DT_EXT_LINK | 2; node.neis[DtPolyUtils.FindEdge(node, tile, neighbourTile.header.bmin.Z, 2)] = DtNavMesh.DT_EXT_LINK | 2;
} }
else else
{ {
node.neis[DtPolyUtils.FindEdge(node, tile, tile.header.bmin.z, 2)] = DtNavMesh.DT_EXT_LINK | 6; node.neis[DtPolyUtils.FindEdge(node, tile, tile.header.bmin.Z, 2)] = DtNavMesh.DT_EXT_LINK | 6;
} }
} }
} }

View File

@ -36,13 +36,13 @@ namespace DotRecast.Detour.Extras.Unity.Astar
int connectedNode1 = buffer.GetInt(); int connectedNode1 = buffer.GetInt();
int connectedNode2 = buffer.GetInt(); int connectedNode2 = buffer.GetInt();
RcVec3f clamped1 = new RcVec3f(); RcVec3f clamped1 = new RcVec3f();
clamped1.x = buffer.GetFloat(); clamped1.X = buffer.GetFloat();
clamped1.y = buffer.GetFloat(); clamped1.Y = buffer.GetFloat();
clamped1.z = buffer.GetFloat(); clamped1.Z = buffer.GetFloat();
RcVec3f clamped2 = new RcVec3f(); RcVec3f clamped2 = new RcVec3f();
clamped2.x = buffer.GetFloat(); clamped2.X = buffer.GetFloat();
clamped2.y = buffer.GetFloat(); clamped2.Y = buffer.GetFloat();
clamped2.z = buffer.GetFloat(); clamped2.Z = buffer.GetFloat();
bool postScanCalled = buffer.Get() != 0; bool postScanCalled = buffer.Get() != 0;
links[i] = new NodeLink2(linkID, startNode, endNode, clamped1, clamped2); links[i] = new NodeLink2(linkID, startNode, endNode, clamped1, clamped2);
} }

View File

@ -48,8 +48,8 @@ namespace DotRecast.Detour.Extras.Unity.Astar
connection.poly = poly; connection.poly = poly;
connection.pos = new float[] connection.pos = new float[]
{ {
l.clamped1.x, l.clamped1.y, l.clamped1.z, l.clamped1.X, l.clamped1.Y, l.clamped1.Z,
l.clamped2.x, l.clamped2.y, l.clamped2.z l.clamped2.X, l.clamped2.Y, l.clamped2.Z
}; };
connection.rad = 0.1f; connection.rad = 0.1f;
connection.side = startTile == endTile connection.side = startTile == endTile

View File

@ -63,9 +63,9 @@ namespace DotRecast.Detour.Extras.Unity.Astar
option.maxPolys = 32768; option.maxPolys = 32768;
option.tileWidth = graphMeta.tileSizeX * graphMeta.cellSize; option.tileWidth = graphMeta.tileSizeX * graphMeta.cellSize;
option.tileHeight = graphMeta.tileSizeZ * graphMeta.cellSize; option.tileHeight = graphMeta.tileSizeZ * graphMeta.cellSize;
option.orig.x = -0.5f * graphMeta.forcedBoundsSize.x + graphMeta.forcedBoundsCenter.x; option.orig.X = -0.5f * graphMeta.forcedBoundsSize.x + graphMeta.forcedBoundsCenter.x;
option.orig.y = -0.5f * graphMeta.forcedBoundsSize.y + graphMeta.forcedBoundsCenter.y; option.orig.Y = -0.5f * graphMeta.forcedBoundsSize.y + graphMeta.forcedBoundsCenter.y;
option.orig.z = -0.5f * graphMeta.forcedBoundsSize.z + graphMeta.forcedBoundsCenter.z; option.orig.Z = -0.5f * graphMeta.forcedBoundsSize.z + graphMeta.forcedBoundsCenter.z;
DtNavMesh mesh = new DtNavMesh(option, 3); DtNavMesh mesh = new DtNavMesh(option, 3);
foreach (DtMeshData t in graphMeshData.tiles) foreach (DtMeshData t in graphMeshData.tiles)
{ {

View File

@ -441,10 +441,10 @@ namespace DotRecast.Detour.TileCache
List<long> results = new List<long>(); List<long> results = new List<long>();
float tw = m_params.width * m_params.cs; float tw = m_params.width * m_params.cs;
float th = m_params.height * m_params.cs; float th = m_params.height * m_params.cs;
int tx0 = (int)Math.Floor((bmin.x - m_params.orig.x) / tw); int tx0 = (int)Math.Floor((bmin.X - m_params.orig.X) / tw);
int tx1 = (int)Math.Floor((bmax.x - m_params.orig.x) / tw); int tx1 = (int)Math.Floor((bmax.X - m_params.orig.X) / tw);
int ty0 = (int)Math.Floor((bmin.z - m_params.orig.z) / th); int ty0 = (int)Math.Floor((bmin.Z - m_params.orig.Z) / th);
int ty1 = (int)Math.Floor((bmax.z - m_params.orig.z) / th); int ty1 = (int)Math.Floor((bmax.Z - m_params.orig.Z) / th);
for (int ty = ty0; ty <= ty1; ++ty) for (int ty = ty0; ty <= ty1; ++ty)
{ {
for (int tx = tx0; tx <= tx1; ++tx) for (int tx = tx0; tx <= tx1; ++tx)
@ -682,24 +682,24 @@ namespace DotRecast.Detour.TileCache
void CalcTightTileBounds(DtTileCacheLayerHeader header, ref RcVec3f bmin, ref RcVec3f bmax) void CalcTightTileBounds(DtTileCacheLayerHeader header, ref RcVec3f bmin, ref RcVec3f bmax)
{ {
float cs = m_params.cs; float cs = m_params.cs;
bmin.x = header.bmin.x + header.minx * cs; bmin.X = header.bmin.X + header.minx * cs;
bmin.y = header.bmin.y; bmin.Y = header.bmin.Y;
bmin.z = header.bmin.z + header.miny * cs; bmin.Z = header.bmin.Z + header.miny * cs;
bmax.x = header.bmin.x + (header.maxx + 1) * cs; bmax.X = header.bmin.X + (header.maxx + 1) * cs;
bmax.y = header.bmax.y; bmax.Y = header.bmax.Y;
bmax.z = header.bmin.z + (header.maxy + 1) * cs; bmax.Z = header.bmin.Z + (header.maxy + 1) * cs;
} }
public void GetObstacleBounds(DtTileCacheObstacle ob, ref RcVec3f bmin, ref RcVec3f bmax) public void GetObstacleBounds(DtTileCacheObstacle ob, ref RcVec3f bmin, ref RcVec3f bmax)
{ {
if (ob.type == DtTileCacheObstacleType.CYLINDER) if (ob.type == DtTileCacheObstacleType.CYLINDER)
{ {
bmin.x = ob.pos.x - ob.radius; bmin.X = ob.pos.X - ob.radius;
bmin.y = ob.pos.y; bmin.Y = ob.pos.Y;
bmin.z = ob.pos.z - ob.radius; bmin.Z = ob.pos.Z - ob.radius;
bmax.x = ob.pos.x + ob.radius; bmax.X = ob.pos.X + ob.radius;
bmax.y = ob.pos.y + ob.height; bmax.Y = ob.pos.Y + ob.height;
bmax.z = ob.pos.z + ob.radius; bmax.Z = ob.pos.Z + ob.radius;
} }
else if (ob.type == DtTileCacheObstacleType.BOX) else if (ob.type == DtTileCacheObstacleType.BOX)
{ {
@ -708,13 +708,13 @@ namespace DotRecast.Detour.TileCache
} }
else if (ob.type == DtTileCacheObstacleType.ORIENTED_BOX) else if (ob.type == DtTileCacheObstacleType.ORIENTED_BOX)
{ {
float maxr = 1.41f * Math.Max(ob.extents.x, ob.extents.z); float maxr = 1.41f * Math.Max(ob.extents.X, ob.extents.Z);
bmin.x = ob.center.x - maxr; bmin.X = ob.center.X - maxr;
bmax.x = ob.center.x + maxr; bmax.X = ob.center.X + maxr;
bmin.y = ob.center.y - ob.extents.y; bmin.Y = ob.center.Y - ob.extents.Y;
bmax.y = ob.center.y + ob.extents.y; bmax.Y = ob.center.Y + ob.extents.Y;
bmin.z = ob.center.z - maxr; bmin.Z = ob.center.Z - maxr;
bmax.z = ob.center.z + maxr; bmax.Z = ob.center.Z + maxr;
} }
} }

View File

@ -1804,12 +1804,12 @@ namespace DotRecast.Detour.TileCache
{ {
RcVec3f bmin = new RcVec3f(); RcVec3f bmin = new RcVec3f();
RcVec3f bmax = new RcVec3f(); RcVec3f bmax = new RcVec3f();
bmin.x = pos.x - radius; bmin.X = pos.X - radius;
bmin.y = pos.y; bmin.Y = pos.Y;
bmin.z = pos.z - radius; bmin.Z = pos.Z - radius;
bmax.x = pos.x + radius; bmax.X = pos.X + radius;
bmax.y = pos.y + height; bmax.Y = pos.Y + height;
bmax.z = pos.z + radius; bmax.Z = pos.Z + radius;
float r2 = RcMath.Sqr(radius / cs + 0.5f); float r2 = RcMath.Sqr(radius / cs + 0.5f);
int w = layer.header.width; int w = layer.header.width;
@ -1817,15 +1817,15 @@ namespace DotRecast.Detour.TileCache
float ics = 1.0f / cs; float ics = 1.0f / cs;
float ich = 1.0f / ch; float ich = 1.0f / ch;
float px = (pos.x - orig.x) * ics; float px = (pos.X - orig.X) * ics;
float pz = (pos.z - orig.z) * ics; float pz = (pos.Z - orig.Z) * ics;
int minx = (int)Math.Floor((bmin.x - orig.x) * ics); int minx = (int)Math.Floor((bmin.X - orig.X) * ics);
int miny = (int)Math.Floor((bmin.y - orig.y) * ich); int miny = (int)Math.Floor((bmin.Y - orig.Y) * ich);
int minz = (int)Math.Floor((bmin.z - orig.z) * ics); int minz = (int)Math.Floor((bmin.Z - orig.Z) * ics);
int maxx = (int)Math.Floor((bmax.x - orig.x) * ics); int maxx = (int)Math.Floor((bmax.X - orig.X) * ics);
int maxy = (int)Math.Floor((bmax.y - orig.y) * ich); int maxy = (int)Math.Floor((bmax.Y - orig.Y) * ich);
int maxz = (int)Math.Floor((bmax.z - orig.z) * ics); int maxz = (int)Math.Floor((bmax.Z - orig.Z) * ics);
if (maxx < 0) if (maxx < 0)
return; return;
@ -1868,12 +1868,12 @@ namespace DotRecast.Detour.TileCache
float ics = 1.0f / cs; float ics = 1.0f / cs;
float ich = 1.0f / ch; float ich = 1.0f / ch;
int minx = (int)Math.Floor((bmin.x - orig.x) * ics); int minx = (int)Math.Floor((bmin.X - orig.X) * ics);
int miny = (int)Math.Floor((bmin.y - orig.y) * ich); int miny = (int)Math.Floor((bmin.Y - orig.Y) * ich);
int minz = (int)Math.Floor((bmin.z - orig.z) * ics); int minz = (int)Math.Floor((bmin.Z - orig.Z) * ics);
int maxx = (int)Math.Floor((bmax.x - orig.x) * ics); int maxx = (int)Math.Floor((bmax.X - orig.X) * ics);
int maxy = (int)Math.Floor((bmax.y - orig.y) * ich); int maxy = (int)Math.Floor((bmax.Y - orig.Y) * ich);
int maxz = (int)Math.Floor((bmax.z - orig.z) * ics); int maxz = (int)Math.Floor((bmax.Z - orig.Z) * ics);
if (maxx < 0) if (maxx < 0)
return; return;
@ -1997,16 +1997,16 @@ namespace DotRecast.Detour.TileCache
float ics = 1.0f / cs; float ics = 1.0f / cs;
float ich = 1.0f / ch; float ich = 1.0f / ch;
float cx = (center.x - orig.x) * ics; float cx = (center.X - orig.X) * ics;
float cz = (center.z - orig.z) * ics; float cz = (center.Z - orig.Z) * ics;
float maxr = 1.41f * Math.Max(extents.x, extents.z); float maxr = 1.41f * Math.Max(extents.X, extents.Z);
int minx = (int)Math.Floor(cx - maxr * ics); int minx = (int)Math.Floor(cx - maxr * ics);
int maxx = (int)Math.Floor(cx + maxr * ics); int maxx = (int)Math.Floor(cx + maxr * ics);
int minz = (int)Math.Floor(cz - maxr * ics); int minz = (int)Math.Floor(cz - maxr * ics);
int maxz = (int)Math.Floor(cz + maxr * ics); int maxz = (int)Math.Floor(cz + maxr * ics);
int miny = (int)Math.Floor((center.y - extents.y - orig.y) * ich); int miny = (int)Math.Floor((center.Y - extents.Y - orig.Y) * ich);
int maxy = (int)Math.Floor((center.y + extents.y - orig.y) * ich); int maxy = (int)Math.Floor((center.Y + extents.Y - orig.Y) * ich);
if (maxx < 0) if (maxx < 0)
return; return;
@ -2026,8 +2026,8 @@ namespace DotRecast.Detour.TileCache
if (maxz >= h) if (maxz >= h)
maxz = h - 1; maxz = h - 1;
float xhalf = extents.x * ics + 0.5f; float xhalf = extents.X * ics + 0.5f;
float zhalf = extents.z * ics + 0.5f; float zhalf = extents.Z * ics + 0.5f;
for (int z = minz; z <= maxz; ++z) for (int z = minz; z <= maxz; ++z)
{ {
for (int x = minx; x <= maxx; ++x) for (int x = minx; x <= maxx; ++x)

View File

@ -40,12 +40,12 @@ namespace DotRecast.Detour.TileCache.Io
header.ty = data.GetInt(); header.ty = data.GetInt();
header.tlayer = data.GetInt(); header.tlayer = data.GetInt();
header.bmin.x = data.GetFloat(); header.bmin.X = data.GetFloat();
header.bmin.y = data.GetFloat(); header.bmin.Y = data.GetFloat();
header.bmin.z = data.GetFloat(); header.bmin.Z = data.GetFloat();
header.bmax.x = data.GetFloat(); header.bmax.X = data.GetFloat();
header.bmax.y = data.GetFloat(); header.bmax.Y = data.GetFloat();
header.bmax.z = data.GetFloat(); header.bmax.Z = data.GetFloat();
header.hmin = data.GetShort() & 0xFFFF; header.hmin = data.GetShort() & 0xFFFF;
header.hmax = data.GetShort() & 0xFFFF; header.hmax = data.GetShort() & 0xFFFF;

View File

@ -34,12 +34,12 @@ namespace DotRecast.Detour.TileCache.Io
Write(stream, header.ty, order); Write(stream, header.ty, order);
Write(stream, header.tlayer, order); Write(stream, header.tlayer, order);
Write(stream, header.bmin.x, order); Write(stream, header.bmin.X, order);
Write(stream, header.bmin.y, order); Write(stream, header.bmin.Y, order);
Write(stream, header.bmin.z, order); Write(stream, header.bmin.Z, order);
Write(stream, header.bmax.x, order); Write(stream, header.bmax.X, order);
Write(stream, header.bmax.y, order); Write(stream, header.bmax.Y, order);
Write(stream, header.bmax.z, order); Write(stream, header.bmax.Z, order);
Write(stream, (short)header.hmin, order); Write(stream, (short)header.hmin, order);
Write(stream, (short)header.hmax, order); Write(stream, (short)header.hmax, order);

View File

@ -98,9 +98,9 @@ namespace DotRecast.Detour.TileCache.Io
{ {
DtTileCacheParams option = new DtTileCacheParams(); DtTileCacheParams option = new DtTileCacheParams();
option.orig.x = bb.GetFloat(); option.orig.X = bb.GetFloat();
option.orig.y = bb.GetFloat(); option.orig.Y = bb.GetFloat();
option.orig.z = bb.GetFloat(); option.orig.Z = bb.GetFloat();
option.cs = bb.GetFloat(); option.cs = bb.GetFloat();
option.ch = bb.GetFloat(); option.ch = bb.GetFloat();

View File

@ -72,9 +72,9 @@ namespace DotRecast.Detour.TileCache.Io
private void WriteCacheParams(BinaryWriter stream, DtTileCacheParams option, RcByteOrder order) private void WriteCacheParams(BinaryWriter stream, DtTileCacheParams option, RcByteOrder order)
{ {
Write(stream, option.orig.x, order); Write(stream, option.orig.X, order);
Write(stream, option.orig.y, order); Write(stream, option.orig.Y, order);
Write(stream, option.orig.z, order); Write(stream, option.orig.Z, order);
Write(stream, option.cs, order); Write(stream, option.cs, order);
Write(stream, option.ch, order); Write(stream, option.ch, order);

View File

@ -61,7 +61,7 @@ namespace DotRecast.Detour
RcVec3f A = a.Subtract(a1); RcVec3f A = a.Subtract(a1);
RcVec3f B = b.Subtract(b1); RcVec3f B = b.Subtract(b1);
float cross = B.x * A.z - A.x * B.z; // TriArea2D({0, 0}, A, B); float cross = B.X * A.Z - A.X * B.Z; // TriArea2D({0, 0}, A, B);
float aHB = DtUtils.TriArea2D(b1, b, a); float aHB = DtUtils.TriArea2D(b1, b, a);
float bHA = DtUtils.TriArea2D(a1, a, b); float bHA = DtUtils.TriArea2D(a1, a, b);
if (Math.Abs(cross) < EPSILON) if (Math.Abs(cross) < EPSILON)
@ -179,20 +179,20 @@ namespace DotRecast.Detour
{ {
if (ii > 0) if (ii > 0)
{ {
if (inters[ii - 3] == p.x && inters[ii - 2] == p.y && inters[ii - 1] == p.z) if (inters[ii - 3] == p.X && inters[ii - 2] == p.Y && inters[ii - 1] == p.Z)
{ {
return ii; return ii;
} }
if (inters[0] == p.x && inters[1] == p.y && inters[2] == p.z) if (inters[0] == p.X && inters[1] == p.Y && inters[2] == p.Z)
{ {
return ii; return ii;
} }
} }
inters[ii] = p.x; inters[ii] = p.X;
inters[ii + 1] = p.y; inters[ii + 1] = p.Y;
inters[ii + 2] = p.z; inters[ii + 2] = p.Z;
return ii + 3; return ii + 3;
} }
@ -217,9 +217,9 @@ namespace DotRecast.Detour
{ {
if (s >= 0.0f && s <= 1.0f && t >= 0.0f && t <= 1.0f) if (s >= 0.0f && s <= 1.0f && t >= 0.0f && t <= 1.0f)
{ {
p.x = a.x + (b.x - a.x) * s; p.X = a.X + (b.X - a.X) * s;
p.y = a.y + (b.y - a.y) * s; p.Y = a.Y + (b.Y - a.Y) * s;
p.z = a.z + (b.z - a.z) * s; p.Z = a.Z + (b.Z - a.Z) * s;
return DtConvexConvexIntersection.Single; return DtConvexConvexIntersection.Single;
} }
} }
@ -276,13 +276,13 @@ namespace DotRecast.Detour
private static bool Between(RcVec3f a, RcVec3f b, RcVec3f c) private static bool Between(RcVec3f a, RcVec3f b, RcVec3f c)
{ {
if (Math.Abs(a.x - b.x) > Math.Abs(a.z - b.z)) if (Math.Abs(a.X - b.X) > Math.Abs(a.Z - b.Z))
{ {
return ((a.x <= c.x) && (c.x <= b.x)) || ((a.x >= c.x) && (c.x >= b.x)); return ((a.X <= c.X) && (c.X <= b.X)) || ((a.X >= c.X) && (c.X >= b.X));
} }
else else
{ {
return ((a.z <= c.z) && (c.z <= b.z)) || ((a.z >= c.z) && (c.z >= b.z)); return ((a.Z <= c.Z) && (c.Z <= b.Z)) || ((a.Z >= c.Z) && (c.Z >= b.Z));
} }
} }
} }

View File

@ -31,7 +31,7 @@ namespace DotRecast.Detour
RcVec3f diff = _center.Subtract(closestPtPoly); RcVec3f diff = _center.Subtract(closestPtPoly);
if (posOverPoly) if (posOverPoly)
{ {
d = Math.Abs(diff.y) - tile.data.header.walkableClimb; d = Math.Abs(diff.Y) - tile.data.header.walkableClimb;
d = d > 0 ? d * d : 0; d = d > 0 ? d * d : 0;
} }
else else

View File

@ -106,8 +106,8 @@ namespace DotRecast.Detour
{ {
DtNavMeshParams option = new DtNavMeshParams(); DtNavMeshParams option = new DtNavMeshParams();
option.orig = data.header.bmin; option.orig = data.header.bmin;
option.tileWidth = data.header.bmax.x - data.header.bmin.x; option.tileWidth = data.header.bmax.X - data.header.bmin.X;
option.tileHeight = data.header.bmax.z - data.header.bmin.z; option.tileHeight = data.header.bmax.Z - data.header.bmin.Z;
option.maxTiles = 1; option.maxTiles = 1;
option.maxPolys = data.header.polyCount; option.maxPolys = data.header.polyCount;
return option; return option;
@ -241,8 +241,8 @@ namespace DotRecast.Detour
*/ */
public void CalcTileLoc(RcVec3f pos, out int tx, out int ty) public void CalcTileLoc(RcVec3f pos, out int tx, out int ty)
{ {
tx = (int)Math.Floor((pos.x - m_orig.x) / m_tileWidth); tx = (int)Math.Floor((pos.X - m_orig.X) / m_tileWidth);
ty = (int)Math.Floor((pos.z - m_orig.z) / m_tileHeight); ty = (int)Math.Floor((pos.Z - m_orig.Z) / m_tileHeight);
} }
/// Gets the tile and polygon for the specified polygon reference. /// Gets the tile and polygon for the specified polygon reference.
@ -343,12 +343,12 @@ namespace DotRecast.Detour
int[] bmin = new int[3]; int[] bmin = new int[3];
int[] bmax = new int[3]; int[] bmax = new int[3];
// 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;
float minz = Math.Clamp(qmin.z, tbmin.z, tbmax.z) - tbmin.z; float minz = Math.Clamp(qmin.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
float maxx = Math.Clamp(qmax.x, tbmin.x, tbmax.x) - tbmin.x; float maxx = Math.Clamp(qmax.X, tbmin.X, tbmax.X) - tbmin.X;
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[0] = (int)(qfac * minx) & 0x7ffffffe;
bmin[1] = (int)(qfac * miny) & 0x7ffffffe; bmin[1] = (int)(qfac * miny) & 0x7ffffffe;
@ -831,16 +831,16 @@ namespace DotRecast.Detour
var ext = new RcVec3f() var ext = new RcVec3f()
{ {
x = targetCon.rad, X = targetCon.rad,
y = target.data.header.walkableClimb, Y = target.data.header.walkableClimb,
z = targetCon.rad Z = targetCon.rad
}; };
// Find polygon to connect to. // Find polygon to connect to.
RcVec3f p = new RcVec3f(); RcVec3f p = new RcVec3f();
p.x = targetCon.pos[3]; p.X = targetCon.pos[3];
p.y = targetCon.pos[4]; p.Y = targetCon.pos[4];
p.z = targetCon.pos[5]; p.Z = targetCon.pos[5];
var refs = FindNearestPolyInTile(tile, p, ext, out var nearestPt); var refs = FindNearestPolyInTile(tile, p, ext, out var nearestPt);
if (refs == 0) if (refs == 0)
{ {
@ -850,15 +850,15 @@ namespace DotRecast.Detour
// findNearestPoly may return too optimistic results, further check // findNearestPoly may return too optimistic results, further check
// to make sure. // to make sure.
if (RcMath.Sqr(nearestPt.x - p.x) + RcMath.Sqr(nearestPt.z - p.z) > RcMath.Sqr(targetCon.rad)) if (RcMath.Sqr(nearestPt.X - p.X) + RcMath.Sqr(nearestPt.Z - p.Z) > RcMath.Sqr(targetCon.rad))
{ {
continue; continue;
} }
// Make sure the location is on current mesh. // Make sure the location is on current mesh.
target.data.verts[targetPoly.verts[1] * 3] = nearestPt.x; target.data.verts[targetPoly.verts[1] * 3] = nearestPt.X;
target.data.verts[targetPoly.verts[1] * 3 + 1] = nearestPt.y; target.data.verts[targetPoly.verts[1] * 3 + 1] = nearestPt.Y;
target.data.verts[targetPoly.verts[1] * 3 + 2] = nearestPt.z; target.data.verts[targetPoly.verts[1] * 3 + 2] = nearestPt.Z;
// Link off-mesh connection to target poly. // Link off-mesh connection to target poly.
int idx = AllocLink(target); int idx = AllocLink(target);
@ -940,8 +940,8 @@ namespace DotRecast.Detour
// Add return value. // Add return value.
long refs = @base | (long)i; long refs = @base | (long)i;
float tmin = Math.Max(amin.x, bmin.x); float tmin = Math.Max(amin.X, bmin.X);
float tmax = Math.Min(amax.x, bmax.x); float tmax = Math.Min(amax.X, bmax.X);
cons.Add(new DtConnectPoly(refs, tmin, tmax)); cons.Add(new DtConnectPoly(refs, tmin, tmax));
n++; n++;
break; break;
@ -971,34 +971,34 @@ namespace DotRecast.Detour
{ {
if (verts[va + 2] < verts[vb + 2]) if (verts[va + 2] < verts[vb + 2])
{ {
bmin.x = verts[va + 2]; bmin.X = verts[va + 2];
bmin.y = verts[va + 1]; bmin.Y = verts[va + 1];
bmax.x = verts[vb + 2]; bmax.X = verts[vb + 2];
bmax.y = verts[vb + 1]; bmax.Y = verts[vb + 1];
} }
else else
{ {
bmin.x = verts[vb + 2]; bmin.X = verts[vb + 2];
bmin.y = verts[vb + 1]; bmin.Y = verts[vb + 1];
bmax.x = verts[va + 2]; bmax.X = verts[va + 2];
bmax.y = verts[va + 1]; bmax.Y = verts[va + 1];
} }
} }
else if (side == 2 || side == 6) else if (side == 2 || side == 6)
{ {
if (verts[va + 0] < verts[vb + 0]) if (verts[va + 0] < verts[vb + 0])
{ {
bmin.x = verts[va + 0]; bmin.X = verts[va + 0];
bmin.y = verts[va + 1]; bmin.Y = verts[va + 1];
bmax.x = verts[vb + 0]; bmax.X = verts[vb + 0];
bmax.y = verts[vb + 1]; bmax.Y = verts[vb + 1];
} }
else else
{ {
bmin.x = verts[vb + 0]; bmin.X = verts[vb + 0];
bmin.y = verts[vb + 1]; bmin.Y = verts[vb + 1];
bmax.x = verts[va + 0]; bmax.X = verts[va + 0];
bmax.y = verts[va + 1]; bmax.Y = verts[va + 1];
} }
} }
} }
@ -1008,18 +1008,18 @@ namespace DotRecast.Detour
// Check for horizontal overlap. // Check for horizontal overlap.
// The segment is shrunken a little so that slabs which touch // The segment is shrunken a little so that slabs which touch
// at end points are not connected. // at end points are not connected.
float minx = Math.Max(amin.x + px, bmin.x + px); float minx = Math.Max(amin.X + px, bmin.X + px);
float maxx = Math.Min(amax.x - px, bmax.x - px); float maxx = Math.Min(amax.X - px, bmax.X - px);
if (minx > maxx) if (minx > maxx)
{ {
return false; return false;
} }
// Check vertical overlap. // Check vertical overlap.
float ad = (amax.y - amin.y) / (amax.x - amin.x); float ad = (amax.Y - amin.Y) / (amax.X - amin.X);
float ak = amin.y - ad * amin.x; float ak = amin.Y - ad * amin.X;
float bd = (bmax.y - bmin.y) / (bmax.x - bmin.x); float bd = (bmax.Y - bmin.Y) / (bmax.X - bmin.X);
float bk = bmin.y - bd * bmin.x; float bk = bmin.Y - bd * bmin.X;
float aminy = ad * minx + ak; float aminy = ad * minx + ak;
float amaxy = ad * maxx + ak; float amaxy = ad * maxx + ak;
float bminy = bd * minx + bk; float bminy = bd * minx + bk;
@ -1065,9 +1065,9 @@ namespace DotRecast.Detour
var ext = new RcVec3f() var ext = new RcVec3f()
{ {
x = con.rad, X = con.rad,
y = tile.data.header.walkableClimb, Y = tile.data.header.walkableClimb,
z = con.rad, Z = con.rad,
}; };
// Find polygon to connect to. // Find polygon to connect to.
@ -1080,15 +1080,15 @@ namespace DotRecast.Detour
float[] p = con.pos; // First vertex float[] p = con.pos; // First vertex
// findNearestPoly may return too optimistic results, further check // findNearestPoly may return too optimistic results, further check
// to make sure. // to make sure.
if (RcMath.Sqr(nearestPt.x - p[0]) + RcMath.Sqr(nearestPt.z - p[2]) > RcMath.Sqr(con.rad)) if (RcMath.Sqr(nearestPt.X - p[0]) + RcMath.Sqr(nearestPt.Z - p[2]) > RcMath.Sqr(con.rad))
{ {
continue; continue;
} }
// Make sure the location is on current mesh. // Make sure the location is on current mesh.
tile.data.verts[poly.verts[0] * 3] = nearestPt.x; tile.data.verts[poly.verts[0] * 3] = nearestPt.X;
tile.data.verts[poly.verts[0] * 3 + 1] = nearestPt.y; tile.data.verts[poly.verts[0] * 3 + 1] = nearestPt.Y;
tile.data.verts[poly.verts[0] * 3 + 2] = nearestPt.z; tile.data.verts[poly.verts[0] * 3 + 2] = nearestPt.Z;
// Link off-mesh connection to target poly. // Link off-mesh connection to target poly.
int idx = AllocLink(tile); int idx = AllocLink(tile);
@ -1154,9 +1154,9 @@ namespace DotRecast.Detour
int index = poly.verts[tris[ti + j]] * 3; int index = poly.verts[tris[ti + j]] * 3;
v[j] = new RcVec3f v[j] = new RcVec3f
{ {
x = tile.data.verts[index], X = tile.data.verts[index],
y = tile.data.verts[index + 1], Y = tile.data.verts[index + 1],
z = tile.data.verts[index + 2] Z = tile.data.verts[index + 2]
}; };
} }
else else
@ -1164,9 +1164,9 @@ namespace DotRecast.Detour
int index = (pd.vertBase + (tris[ti + j] - poly.vertCount)) * 3; int index = (pd.vertBase + (tris[ti + j] - poly.vertCount)) * 3;
v[j] = new RcVec3f v[j] = new RcVec3f
{ {
x = tile.data.detailVerts[index], X = tile.data.detailVerts[index],
y = tile.data.detailVerts[index + 1], Y = tile.data.detailVerts[index + 1],
z = tile.data.detailVerts[index + 2] Z = tile.data.detailVerts[index + 2]
}; };
} }
} }
@ -1198,12 +1198,12 @@ namespace DotRecast.Detour
for (int j = 0; j < poly.vertCount; ++j) for (int j = 0; j < poly.vertCount; ++j)
{ {
int k = (j + 1) % poly.vertCount; int k = (j + 1) % poly.vertCount;
v[0].x = tile.data.verts[poly.verts[j] * 3]; v[0].X = tile.data.verts[poly.verts[j] * 3];
v[0].y = tile.data.verts[poly.verts[j] * 3 + 1]; v[0].Y = tile.data.verts[poly.verts[j] * 3 + 1];
v[0].z = tile.data.verts[poly.verts[j] * 3 + 2]; v[0].Z = tile.data.verts[poly.verts[j] * 3 + 2];
v[1].x = tile.data.verts[poly.verts[k] * 3]; v[1].X = tile.data.verts[poly.verts[k] * 3];
v[1].y = tile.data.verts[poly.verts[k] * 3 + 1]; v[1].Y = tile.data.verts[poly.verts[k] * 3 + 1];
v[1].z = tile.data.verts[poly.verts[k] * 3 + 2]; v[1].Z = tile.data.verts[poly.verts[k] * 3 + 2];
var d = DtUtils.DistancePtSegSqr2D(pos, v[0], v[1], out var t); var d = DtUtils.DistancePtSegSqr2D(pos, v[0], v[1], out var t);
if (d < dmin) if (d < dmin)
@ -1259,9 +1259,9 @@ namespace DotRecast.Detour
int index = poly.verts[tile.data.detailTris[t + k]] * 3; int index = poly.verts[tile.data.detailTris[t + k]] * 3;
v[k] = new RcVec3f v[k] = new RcVec3f
{ {
x = tile.data.verts[index], X = tile.data.verts[index],
y = tile.data.verts[index + 1], Y = tile.data.verts[index + 1],
z = tile.data.verts[index + 2] Z = tile.data.verts[index + 2]
}; };
} }
else else
@ -1269,9 +1269,9 @@ namespace DotRecast.Detour
int index = (pd.vertBase + (tile.data.detailTris[t + k] - poly.vertCount)) * 3; int index = (pd.vertBase + (tile.data.detailTris[t + k] - poly.vertCount)) * 3;
v[k] = new RcVec3f v[k] = new RcVec3f
{ {
x = tile.data.detailVerts[index], X = tile.data.detailVerts[index],
y = tile.data.detailVerts[index + 1], Y = tile.data.detailVerts[index + 1],
z = tile.data.detailVerts[index + 2] Z = tile.data.detailVerts[index + 2]
}; };
} }
} }
@ -1286,16 +1286,16 @@ namespace DotRecast.Detour
else else
{ {
RcVec3f[] v = new RcVec3f[3]; RcVec3f[] v = new RcVec3f[3];
v[0].x = tile.data.verts[poly.verts[0] * 3]; v[0].X = tile.data.verts[poly.verts[0] * 3];
v[0].y = tile.data.verts[poly.verts[0] * 3 + 1]; v[0].Y = tile.data.verts[poly.verts[0] * 3 + 1];
v[0].z = tile.data.verts[poly.verts[0] * 3 + 2]; v[0].Z = tile.data.verts[poly.verts[0] * 3 + 2];
for (int j = 1; j < poly.vertCount - 1; ++j) for (int j = 1; j < poly.vertCount - 1; ++j)
{ {
for (int k = 0; k < 2; ++k) for (int k = 0; k < 2; ++k)
{ {
v[k + 1].x = tile.data.verts[poly.verts[j + k] * 3]; v[k + 1].X = tile.data.verts[poly.verts[j + k] * 3];
v[k + 1].y = tile.data.verts[poly.verts[j + k] * 3 + 1]; v[k + 1].Y = tile.data.verts[poly.verts[j + k] * 3 + 1];
v[k + 1].z = tile.data.verts[poly.verts[j + k] * 3 + 2]; v[k + 1].Z = tile.data.verts[poly.verts[j + k] * 3 + 2];
} }
if (DtUtils.ClosestHeightPointTriangle(pos, v[0], v[1], v[2], out var h)) if (DtUtils.ClosestHeightPointTriangle(pos, v[0], v[1], v[2], out var h))
@ -1311,7 +1311,7 @@ namespace DotRecast.Detour
// closest. This should almost never happen so the extra iteration here is // closest. This should almost never happen so the extra iteration here is
// ok. // ok.
var closest = ClosestPointOnDetailEdges(tile, poly, pos, false); var closest = ClosestPointOnDetailEdges(tile, poly, pos, false);
height = closest.y; height = closest.Y;
return true; return true;
} }
@ -1322,7 +1322,7 @@ namespace DotRecast.Detour
if (GetPolyHeight(tile, poly, pos, out var h)) if (GetPolyHeight(tile, poly, pos, out var h))
{ {
closest.y = h; closest.Y = h;
posOverPoly = true; posOverPoly = true;
return; return;
} }
@ -1333,9 +1333,9 @@ namespace DotRecast.Detour
if (poly.GetPolyType() == DtPolyTypes.DT_POLYTYPE_OFFMESH_CONNECTION) if (poly.GetPolyType() == DtPolyTypes.DT_POLYTYPE_OFFMESH_CONNECTION)
{ {
int i = poly.verts[0] * 3; int i = poly.verts[0] * 3;
var v0 = new RcVec3f { x = tile.data.verts[i], y = tile.data.verts[i + 1], z = tile.data.verts[i + 2] }; var v0 = new RcVec3f { X = tile.data.verts[i], Y = tile.data.verts[i + 1], Z = tile.data.verts[i + 2] };
i = poly.verts[1] * 3; i = poly.verts[1] * 3;
var v1 = new RcVec3f { x = tile.data.verts[i], y = tile.data.verts[i + 1], z = tile.data.verts[i + 2] }; var v1 = new RcVec3f { X = tile.data.verts[i], Y = tile.data.verts[i + 1], Z = tile.data.verts[i + 2] };
DtUtils.DistancePtSegSqr2D(pos, v0, v1, out var t); DtUtils.DistancePtSegSqr2D(pos, v0, v1, out var t);
closest = RcVec3f.Lerp(v0, v1, t); closest = RcVec3f.Lerp(v0, v1, t);
return; return;
@ -1371,7 +1371,7 @@ namespace DotRecast.Detour
RcVec3f diff = center.Subtract(closestPtPoly); RcVec3f diff = center.Subtract(closestPtPoly);
if (posOverPoly) if (posOverPoly)
{ {
d = Math.Abs(diff.y) - tile.data.header.walkableClimb; d = Math.Abs(diff.Y) - tile.data.header.walkableClimb;
d = d > 0 ? d * d : 0; d = d > 0 ? d * d : 0;
} }
else else
@ -1730,15 +1730,15 @@ namespace DotRecast.Detour
for (int i = 0; i < poly.vertCount; ++i) for (int i = 0; i < poly.vertCount; ++i)
{ {
int v = poly.verts[i] * 3; int v = poly.verts[i] * 3;
center.x += tile.data.verts[v]; center.X += tile.data.verts[v];
center.y += tile.data.verts[v + 1]; center.Y += tile.data.verts[v + 1];
center.z += tile.data.verts[v + 2]; center.Z += tile.data.verts[v + 2];
} }
float s = 1.0f / poly.vertCount; float s = 1.0f / poly.vertCount;
center.x *= s; center.X *= s;
center.y *= s; center.Y *= s;
center.z *= s; center.Z *= s;
} }
return center; return center;
@ -1781,12 +1781,12 @@ namespace DotRecast.Detour
{ {
for (int i = 0; i < tile.data.verts.Length; i += 3) for (int i = 0; i < tile.data.verts.Length; i += 3)
{ {
bmin.x = Math.Min(bmin.x, tile.data.verts[i]); bmin.X = Math.Min(bmin.X, tile.data.verts[i]);
bmin.y = Math.Min(bmin.y, tile.data.verts[i + 1]); bmin.Y = Math.Min(bmin.Y, tile.data.verts[i + 1]);
bmin.z = Math.Min(bmin.z, tile.data.verts[i + 2]); bmin.Z = Math.Min(bmin.Z, tile.data.verts[i + 2]);
bmax.x = Math.Max(bmax.x, tile.data.verts[i]); bmax.X = Math.Max(bmax.X, tile.data.verts[i]);
bmax.y = Math.Max(bmax.y, tile.data.verts[i + 1]); bmax.Y = Math.Max(bmax.Y, tile.data.verts[i + 1]);
bmax.z = Math.Max(bmax.z, tile.data.verts[i + 2]); bmax.Z = Math.Max(bmax.Z, tile.data.verts[i + 2]);
} }
} }
} }

View File

@ -171,13 +171,13 @@ 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[0] = 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[1] = 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[2] = 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[0] = 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[1] = 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[2] = Math.Clamp((int)((bmax.Z - option.bmin.Z) * quantFactor), 0, int.MaxValue);
} }
else else
{ {
@ -226,10 +226,10 @@ namespace DotRecast.Detour
public static int ClassifyOffMeshPoint(RcVec3f pt, RcVec3f bmin, RcVec3f bmax) public static int ClassifyOffMeshPoint(RcVec3f pt, RcVec3f bmin, RcVec3f bmax)
{ {
int outcode = 0; int outcode = 0;
outcode |= (pt.x >= bmax.x) ? XP : 0; outcode |= (pt.X >= bmax.X) ? XP : 0;
outcode |= (pt.z >= bmax.z) ? ZP : 0; outcode |= (pt.Z >= bmax.Z) ? ZP : 0;
outcode |= (pt.x < bmin.x) ? XM : 0; outcode |= (pt.X < bmin.X) ? XM : 0;
outcode |= (pt.z < bmin.z) ? ZM : 0; outcode |= (pt.Z < bmin.Z) ? ZM : 0;
switch (outcode) switch (outcode)
{ {
@ -302,7 +302,7 @@ namespace DotRecast.Detour
for (int i = 0; i < option.vertCount; ++i) for (int i = 0; i < option.vertCount; ++i)
{ {
int iv = i * 3; int iv = i * 3;
float h = option.bmin.y + option.verts[iv + 1] * option.ch; float h = option.bmin.Y + option.verts[iv + 1] * option.ch;
hmin = Math.Min(hmin, h); hmin = Math.Min(hmin, h);
hmax = Math.Max(hmax, h); hmax = Math.Max(hmax, h);
} }
@ -314,8 +314,8 @@ namespace DotRecast.Detour
RcVec3f bmax = new RcVec3f(); RcVec3f bmax = new RcVec3f();
bmin = option.bmin; bmin = option.bmin;
bmax = option.bmax; bmax = option.bmax;
bmin.y = hmin; bmin.Y = hmin;
bmax.y = hmax; bmax.Y = hmax;
for (int i = 0; i < option.offMeshConCount; ++i) for (int i = 0; i < option.offMeshConCount; ++i)
{ {
@ -329,7 +329,7 @@ namespace DotRecast.Detour
// potentially touching the mesh. // potentially touching the mesh.
if (offMeshConClass[i * 2 + 0] == 0xff) if (offMeshConClass[i * 2 + 0] == 0xff)
{ {
if (p0.y < bmin.y || p0.y > bmax.y) if (p0.Y < bmin.Y || p0.Y > bmax.Y)
offMeshConClass[i * 2 + 0] = 0; offMeshConClass[i * 2 + 0] = 0;
} }
@ -458,9 +458,9 @@ namespace DotRecast.Detour
{ {
int iv = i * 3; int iv = i * 3;
int v = i * 3; int v = i * 3;
navVerts[v] = option.bmin.x + option.verts[iv] * option.cs; navVerts[v] = option.bmin.X + option.verts[iv] * option.cs;
navVerts[v + 1] = option.bmin.y + option.verts[iv + 1] * option.ch; navVerts[v + 1] = option.bmin.Y + option.verts[iv + 1] * option.ch;
navVerts[v + 2] = option.bmin.z + option.verts[iv + 2] * option.cs; navVerts[v + 2] = option.bmin.Z + option.verts[iv + 2] * option.cs;
} }
// Off-mesh link vertices. // Off-mesh link vertices.

View File

@ -513,11 +513,11 @@ namespace DotRecast.Detour
if (poly.GetPolyType() == DtPolyTypes.DT_POLYTYPE_OFFMESH_CONNECTION) if (poly.GetPolyType() == DtPolyTypes.DT_POLYTYPE_OFFMESH_CONNECTION)
{ {
int i = poly.verts[0] * 3; int i = poly.verts[0] * 3;
var v0 = new RcVec3f { x = tile.data.verts[i], y = tile.data.verts[i + 1], z = tile.data.verts[i + 2] }; var v0 = new RcVec3f { X = tile.data.verts[i], Y = tile.data.verts[i + 1], Z = tile.data.verts[i + 2] };
i = poly.verts[1] * 3; i = poly.verts[1] * 3;
var v1 = new RcVec3f { x = tile.data.verts[i], y = tile.data.verts[i + 1], z = tile.data.verts[i + 2] }; var v1 = new RcVec3f { X = tile.data.verts[i], Y = tile.data.verts[i + 1], Z = tile.data.verts[i + 2] };
DtUtils.DistancePtSegSqr2D(pos, v0, v1, out var t); DtUtils.DistancePtSegSqr2D(pos, v0, v1, out var t);
height = v0.y + (v1.y - v0.y) * t; height = v0.Y + (v1.Y - v0.Y) * t;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCSESS;
} }
@ -576,12 +576,12 @@ namespace DotRecast.Detour
int[] bmin = new int[3]; int[] bmin = new int[3];
int[] bmax = new int[3]; int[] bmax = new int[3];
// 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;
float minz = Math.Clamp(qmin.z, tbmin.z, tbmax.z) - tbmin.z; float minz = Math.Clamp(qmin.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
float maxx = Math.Clamp(qmax.x, tbmin.x, tbmax.x) - tbmin.x; float maxx = Math.Clamp(qmax.X, tbmin.X, tbmax.X) - tbmin.X;
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[0] = (int)(qfac * minx) & 0x7ffffffe;
bmin[1] = (int)(qfac * miny) & 0x7ffffffe; bmin[1] = (int)(qfac * miny) & 0x7ffffffe;
@ -2004,13 +2004,13 @@ namespace DotRecast.Detour
if (fromTile.links[i].refs == to) if (fromTile.links[i].refs == to)
{ {
int v = fromTile.links[i].edge; int v = fromTile.links[i].edge;
left.x = fromTile.data.verts[fromPoly.verts[v] * 3]; left.X = fromTile.data.verts[fromPoly.verts[v] * 3];
left.y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1]; left.Y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1];
left.z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2]; left.Z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2];
right.x = fromTile.data.verts[fromPoly.verts[v] * 3]; right.X = fromTile.data.verts[fromPoly.verts[v] * 3];
right.y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1]; right.Y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1];
right.z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2]; right.Z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2];
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCSESS;
} }
@ -2026,13 +2026,13 @@ namespace DotRecast.Detour
if (toTile.links[i].refs == from) if (toTile.links[i].refs == from)
{ {
int v = toTile.links[i].edge; int v = toTile.links[i].edge;
left.x = toTile.data.verts[toPoly.verts[v] * 3]; left.X = toTile.data.verts[toPoly.verts[v] * 3];
left.y = toTile.data.verts[toPoly.verts[v] * 3 + 1]; left.Y = toTile.data.verts[toPoly.verts[v] * 3 + 1];
left.z = toTile.data.verts[toPoly.verts[v] * 3 + 2]; left.Z = toTile.data.verts[toPoly.verts[v] * 3 + 2];
right.x = toTile.data.verts[toPoly.verts[v] * 3]; right.X = toTile.data.verts[toPoly.verts[v] * 3];
right.y = toTile.data.verts[toPoly.verts[v] * 3 + 1]; right.Y = toTile.data.verts[toPoly.verts[v] * 3 + 1];
right.z = toTile.data.verts[toPoly.verts[v] * 3 + 2]; right.Z = toTile.data.verts[toPoly.verts[v] * 3 + 2];
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCSESS;
} }
@ -2044,13 +2044,13 @@ namespace DotRecast.Detour
// Find portal vertices. // Find portal vertices.
int v0 = fromPoly.verts[link.edge]; int v0 = fromPoly.verts[link.edge];
int v1 = fromPoly.verts[(link.edge + 1) % fromPoly.vertCount]; int v1 = fromPoly.verts[(link.edge + 1) % fromPoly.vertCount];
left.x = fromTile.data.verts[v0 * 3]; left.X = fromTile.data.verts[v0 * 3];
left.y = fromTile.data.verts[v0 * 3 + 1]; left.Y = fromTile.data.verts[v0 * 3 + 1];
left.z = fromTile.data.verts[v0 * 3 + 2]; left.Z = fromTile.data.verts[v0 * 3 + 2];
right.x = fromTile.data.verts[v1 * 3]; right.X = fromTile.data.verts[v1 * 3];
right.y = fromTile.data.verts[v1 * 3 + 1]; right.Y = fromTile.data.verts[v1 * 3 + 1];
right.z = fromTile.data.verts[v1 * 3 + 2]; right.Z = fromTile.data.verts[v1 * 3 + 2];
// If the link is at tile boundary, dtClamp the vertices to // If the link is at tile boundary, dtClamp the vertices to
// the link width. // the link width.
@ -2079,9 +2079,9 @@ namespace DotRecast.Detour
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM; return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
} }
mid.x = (left.x + right.x) * 0.5f; mid.X = (left.X + right.X) * 0.5f;
mid.y = (left.y + right.y) * 0.5f; mid.Y = (left.Y + right.Y) * 0.5f;
mid.z = (left.z + right.z) * 0.5f; mid.Z = (left.Z + right.Z) * 0.5f;
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCSESS;
} }
@ -2304,7 +2304,7 @@ namespace DotRecast.Detour
} }
// Find Z intersection. // Find Z intersection.
float z = startPos.z + (endPos.z - startPos.z) * tmax; float z = startPos.Z + (endPos.Z - startPos.Z) * tmax;
if (z >= lmin && z <= lmax) if (z >= lmin && z <= lmax)
{ {
nextRef = link.refs; nextRef = link.refs;
@ -2325,7 +2325,7 @@ namespace DotRecast.Detour
} }
// Find X intersection. // Find X intersection.
float x = startPos.x + (endPos.x - startPos.x) * tmax; float x = startPos.X + (endPos.X - startPos.X) * tmax;
if (x >= lmin && x <= lmax) if (x >= lmin && x <= lmax)
{ {
nextRef = link.refs; nextRef = link.refs;
@ -2345,8 +2345,8 @@ namespace DotRecast.Detour
var e2 = verts[(segMax + 1) % nv]; var e2 = verts[(segMax + 1) % nv];
var eDir = e2.Subtract(e1); var eDir = e2.Subtract(e1);
var diff = curPos.Subtract(e1); var diff = curPos.Subtract(e1);
float s = RcMath.Sqr(eDir.x) > RcMath.Sqr(eDir.z) ? diff.x / eDir.x : diff.z / eDir.z; float s = RcMath.Sqr(eDir.X) > RcMath.Sqr(eDir.Z) ? diff.X / eDir.X : diff.Z / eDir.Z;
curPos.y = e1.y + eDir.y * s; curPos.Y = e1.Y + eDir.Y * s;
hit.pathCost += filter.GetCost(lastPos, curPos, prevRef, prevTile, prevPoly, curRef, tile, poly, hit.pathCost += filter.GetCost(lastPos, curPos, prevRef, prevTile, prevPoly, curRef, tile, poly,
nextRef, nextTile, nextPoly); nextRef, nextTile, nextPoly);
@ -2361,11 +2361,11 @@ namespace DotRecast.Detour
int b = segMax + 1 < nv ? segMax + 1 : 0; int b = segMax + 1 < nv ? segMax + 1 : 0;
// int va = a * 3; // int va = a * 3;
// int vb = b * 3; // int vb = b * 3;
float dx = verts[b].x - verts[a].x; float dx = verts[b].X - verts[a].X;
float dz = verts[b].z - verts[a].x; float dz = verts[b].Z - verts[a].X;
hit.hitNormal.x = dz; hit.hitNormal.X = dz;
hit.hitNormal.y = 0; hit.hitNormal.Y = 0;
hit.hitNormal.z = -dx; hit.hitNormal.Z = -dx;
hit.hitNormal.Normalize(); hit.hitNormal.Normalize();
return DtStatus.DT_SUCCSESS; return DtStatus.DT_SUCCSESS;
} }
@ -2621,9 +2621,9 @@ namespace DotRecast.Detour
} }
float scale = 1.0f / nverts; float scale = 1.0f / nverts;
centerPos.x *= scale; centerPos.X *= scale;
centerPos.y *= scale; centerPos.Y *= scale;
centerPos.z *= scale; centerPos.Z *= scale;
DtNode startNode = m_nodePool.GetNode(startRef); DtNode startNode = m_nodePool.GetNode(startRef);
startNode.pos = centerPos; startNode.pos = centerPos;
@ -3211,9 +3211,9 @@ namespace DotRecast.Detour
// Hit wall, update radius. // Hit wall, update radius.
radiusSqr = distSqr; radiusSqr = distSqr;
// Calculate hit pos. // Calculate hit pos.
hitPos.x = bestTile.data.verts[vj + 0] + (bestTile.data.verts[vi + 0] - bestTile.data.verts[vj + 0]) * tseg; hitPos.X = bestTile.data.verts[vj + 0] + (bestTile.data.verts[vi + 0] - bestTile.data.verts[vj + 0]) * tseg;
hitPos.y = bestTile.data.verts[vj + 1] + (bestTile.data.verts[vi + 1] - bestTile.data.verts[vj + 1]) * tseg; hitPos.Y = bestTile.data.verts[vj + 1] + (bestTile.data.verts[vi + 1] - bestTile.data.verts[vj + 1]) * tseg;
hitPos.z = bestTile.data.verts[vj + 2] + (bestTile.data.verts[vi + 2] - bestTile.data.verts[vj + 2]) * tseg; hitPos.Z = bestTile.data.verts[vj + 2] + (bestTile.data.verts[vi + 2] - bestTile.data.verts[vj + 2]) * tseg;
hasBestV = true; hasBestV = true;
bestvj = RcVec3f.Of(bestTile.data.verts, vj); bestvj = RcVec3f.Of(bestTile.data.verts, vj);
bestvi = RcVec3f.Of(bestTile.data.verts, vi); bestvi = RcVec3f.Of(bestTile.data.verts, vi);
@ -3302,9 +3302,9 @@ namespace DotRecast.Detour
if (hasBestV) if (hasBestV)
{ {
var tangent = bestvi.Subtract(bestvj); var tangent = bestvi.Subtract(bestvj);
hitNormal.x = tangent.z; hitNormal.X = tangent.Z;
hitNormal.y = 0; hitNormal.Y = 0;
hitNormal.z = -tangent.x; hitNormal.Z = -tangent.X;
hitNormal.Normalize(); hitNormal.Normalize();
} }

View File

@ -68,15 +68,15 @@ namespace DotRecast.Detour
int v = tile.data.detailTris[t + k]; int v = tile.data.detailTris[t + k];
if (v < p.vertCount) if (v < p.vertCount)
{ {
verts[k].x = tile.data.verts[p.verts[v] * 3]; verts[k].X = tile.data.verts[p.verts[v] * 3];
verts[k].y = tile.data.verts[p.verts[v] * 3 + 1]; verts[k].Y = tile.data.verts[p.verts[v] * 3 + 1];
verts[k].z = tile.data.verts[p.verts[v] * 3 + 2]; verts[k].Z = tile.data.verts[p.verts[v] * 3 + 2];
} }
else else
{ {
verts[k].x = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3]; verts[k].X = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3];
verts[k].y = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3 + 1]; verts[k].Y = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3 + 1];
verts[k].z = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3 + 2]; verts[k].Z = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3 + 2];
} }
} }

View File

@ -61,7 +61,7 @@ namespace DotRecast.Detour
return false; return false;
steerPos = straightPath[ns].pos; steerPos = straightPath[ns].pos;
steerPos.y = startPos.y; steerPos.Y = startPos.Y;
steerPosFlag = straightPath[ns].flags; steerPosFlag = straightPath[ns].flags;
steerPosRef = straightPath[ns].refs; steerPosRef = straightPath[ns].refs;
@ -70,9 +70,9 @@ namespace DotRecast.Detour
public static bool InRange(RcVec3f v1, RcVec3f v2, float r, float h) public static bool InRange(RcVec3f v1, RcVec3f v2, float r, float h)
{ {
float dx = v2.x - v1.x; float dx = v2.X - v1.X;
float dy = v2.y - v1.y; float dy = v2.Y - v1.Y;
float dz = v2.z - v1.z; float dz = v2.Z - v1.Z;
return (dx * dx + dz * dz) < r * r && Math.Abs(dy) < h; return (dx * dx + dz * dz) < r * r && Math.Abs(dy) < h;
} }

View File

@ -67,9 +67,9 @@ namespace DotRecast.Detour
float[] circle = new float[12 * 3]; float[] circle = new float[12 * 3];
for (int i = 0; i < CIRCLE_SEGMENTS * 3; i += 3) for (int i = 0; i < CIRCLE_SEGMENTS * 3; i += 3)
{ {
circle[i] = UnitCircle[i] * radius + center.x; circle[i] = UnitCircle[i] * radius + center.X;
circle[i + 1] = center.y; circle[i + 1] = center.Y;
circle[i + 2] = UnitCircle[i + 2] * radius + center.z; circle[i + 2] = UnitCircle[i + 2] * radius + center.Z;
} }
return circle; return circle;

View File

@ -82,9 +82,9 @@ namespace DotRecast.Detour
public static bool OverlapBounds(RcVec3f amin, RcVec3f amax, RcVec3f bmin, RcVec3f bmax) public static bool OverlapBounds(RcVec3f amin, RcVec3f amax, RcVec3f bmin, RcVec3f bmax)
{ {
bool overlap = true; bool overlap = true;
overlap = (amin.x > bmax.x || amax.x < bmin.x) ? false : overlap; overlap = (amin.X > bmax.X || amax.X < bmin.X) ? false : overlap;
overlap = (amin.y > bmax.y || amax.y < bmin.y) ? false : overlap; overlap = (amin.Y > bmax.Y || amax.Y < bmin.Y) ? false : overlap;
overlap = (amin.z > bmax.z || amax.z < bmin.z) ? false : overlap; overlap = (amin.Z > bmax.Z || amax.Z < bmin.Z) ? false : overlap;
return overlap; return overlap;
} }
@ -108,7 +108,7 @@ namespace DotRecast.Detour
RcVec2f aminmax = ProjectPoly(n, polya, npolya); RcVec2f aminmax = ProjectPoly(n, polya, npolya);
RcVec2f bminmax = ProjectPoly(n, polyb, npolyb); RcVec2f bminmax = ProjectPoly(n, polyb, npolyb);
if (!OverlapRange(aminmax.x, aminmax.y, bminmax.x, bminmax.y, eps)) if (!OverlapRange(aminmax.X, aminmax.Y, bminmax.X, bminmax.Y, eps))
{ {
// Found separating axis // Found separating axis
return false; return false;
@ -124,7 +124,7 @@ namespace DotRecast.Detour
RcVec2f aminmax = ProjectPoly(n, polya, npolya); RcVec2f aminmax = ProjectPoly(n, polya, npolya);
RcVec2f bminmax = ProjectPoly(n, polyb, npolyb); RcVec2f bminmax = ProjectPoly(n, polyb, npolyb);
if (!OverlapRange(aminmax.x, aminmax.y, bminmax.x, bminmax.y, eps)) if (!OverlapRange(aminmax.X, aminmax.Y, bminmax.X, bminmax.Y, eps))
{ {
// Found separating axis // Found separating axis
return false; return false;
@ -155,10 +155,10 @@ namespace DotRecast.Detour
public static float TriArea2D(RcVec3f a, RcVec3f b, RcVec3f c) public static float TriArea2D(RcVec3f a, RcVec3f b, RcVec3f c)
{ {
float abx = b.x - a.x; float abx = b.X - a.X;
float abz = b.z - a.z; float abz = b.Z - a.Z;
float acx = c.x - a.x; float acx = c.X - a.X;
float acz = c.z - a.z; float acz = c.Z - a.Z;
return acx * abz - abx * acz; return acx * abz - abx * acz;
} }
@ -203,9 +203,9 @@ namespace DotRecast.Detour
return new RcVec3f() return new RcVec3f()
{ {
x = a * pts[pa] + b * pts[pb] + c * pts[pc], X = a * pts[pa] + b * pts[pb] + c * pts[pc],
y = a * pts[pa + 1] + b * pts[pb + 1] + c * pts[pc + 1], Y = a * pts[pa + 1] + b * pts[pb + 1] + c * pts[pc + 1],
z = a * pts[pa + 2] + b * pts[pb + 2] + c * pts[pc + 2] Z = a * pts[pa + 2] + b * pts[pb + 2] + c * pts[pc + 2]
}; };
} }
@ -219,14 +219,14 @@ namespace DotRecast.Detour
RcVec3f v2 = p.Subtract(a); RcVec3f v2 = p.Subtract(a);
// Compute scaled barycentric coordinates // Compute scaled barycentric coordinates
float denom = v0.x * v1.z - v0.z * v1.x; float denom = v0.X * v1.Z - v0.Z * v1.X;
if (Math.Abs(denom) < EPS) if (Math.Abs(denom) < EPS)
{ {
return false; return false;
} }
float u = v1.z * v2.x - v1.x * v2.z; float u = v1.Z * v2.X - v1.X * v2.Z;
float v = v0.x * v2.z - v0.z * v2.x; float v = v0.X * v2.Z - v0.Z * v2.X;
if (denom < 0) if (denom < 0)
{ {
@ -238,7 +238,7 @@ namespace DotRecast.Detour
// If point lies inside the triangle, return interpolated ycoord. // If point lies inside the triangle, return interpolated ycoord.
if (u >= 0.0f && v >= 0.0f && (u + v) <= denom) if (u >= 0.0f && v >= 0.0f && (u + v) <= denom)
{ {
h = a.y + (v0.y * u + v1.y * v) / denom; h = a.Y + (v0.Y * u + v1.Y * v) / denom;
return true; return true;
} }
@ -258,8 +258,8 @@ namespace DotRecast.Detour
return new RcVec2f return new RcVec2f
{ {
x = rmin, X = rmin,
y = rmax, Y = rmax,
}; };
} }
@ -275,8 +275,8 @@ namespace DotRecast.Detour
{ {
int vi = i * 3; int vi = i * 3;
int vj = j * 3; int vj = j * 3;
if (((verts[vi + 2] > pt.z) != (verts[vj + 2] > pt.z)) && (pt.x < (verts[vj + 0] - verts[vi + 0]) if (((verts[vi + 2] > pt.Z) != (verts[vj + 2] > pt.Z)) && (pt.X < (verts[vj + 0] - verts[vi + 0])
* (pt.z - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0])) * (pt.Z - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0]))
{ {
c = !c; c = !c;
} }
@ -294,8 +294,8 @@ namespace DotRecast.Detour
{ {
int vi = i * 3; int vi = i * 3;
int vj = j * 3; int vj = j * 3;
if (((verts[vi + 2] > pt.z) != (verts[vj + 2] > pt.z)) && if (((verts[vi + 2] > pt.Z) != (verts[vj + 2] > pt.Z)) &&
(pt.x < (verts[vj + 0] - verts[vi + 0]) * (pt.z - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0])) (pt.X < (verts[vj + 0] - verts[vi + 0]) * (pt.Z - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0]))
{ {
c = !c; c = !c;
} }
@ -315,10 +315,10 @@ namespace DotRecast.Detour
public static float DistancePtSegSqr2D(RcVec3f pt, RcVec3f p, RcVec3f q, out float t) public static float DistancePtSegSqr2D(RcVec3f pt, RcVec3f p, RcVec3f q, out float t)
{ {
float pqx = q.x - p.x; float pqx = q.X - p.X;
float pqz = q.z - p.z; float pqz = q.Z - p.Z;
float dx = pt.x - p.x; float dx = pt.X - p.X;
float dz = pt.z - p.z; float dz = pt.Z - p.Z;
float d = pqx * pqx + pqz * pqz; float d = pqx * pqx + pqz * pqz;
t = pqx * dx + pqz * dz; t = pqx * dx + pqz * dz;
if (d > 0) if (d > 0)
@ -335,8 +335,8 @@ namespace DotRecast.Detour
t = 1; t = 1;
} }
dx = p.x + t * pqx - pt.x; dx = p.X + t * pqx - pt.X;
dz = p.z + t * pqz - pt.z; dz = p.Z + t * pqz - pt.Z;
return dx * dx + dz * dz; return dx * dx + dz * dz;
} }

View File

@ -92,13 +92,13 @@ namespace DotRecast.Detour.Io
header.walkableRadius = buf.GetFloat(); header.walkableRadius = buf.GetFloat();
header.walkableClimb = buf.GetFloat(); header.walkableClimb = buf.GetFloat();
header.bmin.x = buf.GetFloat(); header.bmin.X = buf.GetFloat();
header.bmin.y = buf.GetFloat(); header.bmin.Y = buf.GetFloat();
header.bmin.z = buf.GetFloat(); header.bmin.Z = buf.GetFloat();
header.bmax.x = buf.GetFloat(); header.bmax.X = buf.GetFloat();
header.bmax.y = buf.GetFloat(); header.bmax.Y = buf.GetFloat();
header.bmax.z = buf.GetFloat(); header.bmax.Z = buf.GetFloat();
header.bvQuantFactor = buf.GetFloat(); header.bvQuantFactor = buf.GetFloat();
data.verts = ReadVerts(buf, header.vertCount); data.verts = ReadVerts(buf, header.vertCount);

View File

@ -44,12 +44,12 @@ namespace DotRecast.Detour.Io
Write(stream, header.walkableHeight, order); Write(stream, header.walkableHeight, order);
Write(stream, header.walkableRadius, order); Write(stream, header.walkableRadius, order);
Write(stream, header.walkableClimb, order); Write(stream, header.walkableClimb, order);
Write(stream, header.bmin.x, order); Write(stream, header.bmin.X, order);
Write(stream, header.bmin.y, order); Write(stream, header.bmin.Y, order);
Write(stream, header.bmin.z, order); Write(stream, header.bmin.Z, order);
Write(stream, header.bmax.x, order); Write(stream, header.bmax.X, order);
Write(stream, header.bmax.y, order); Write(stream, header.bmax.Y, order);
Write(stream, header.bmax.z, order); Write(stream, header.bmax.Z, order);
Write(stream, header.bvQuantFactor, order); Write(stream, header.bvQuantFactor, order);
WriteVerts(stream, data.verts, header.vertCount, order); WriteVerts(stream, data.verts, header.vertCount, order);
WritePolys(stream, data, order, cCompatibility); WritePolys(stream, data, order, cCompatibility);

View File

@ -7,9 +7,9 @@ namespace DotRecast.Detour.Io
{ {
public void Write(BinaryWriter stream, DtNavMeshParams option, RcByteOrder order) public void Write(BinaryWriter stream, DtNavMeshParams option, RcByteOrder order)
{ {
Write(stream, option.orig.x, order); Write(stream, option.orig.X, order);
Write(stream, option.orig.y, order); Write(stream, option.orig.Y, order);
Write(stream, option.orig.z, order); Write(stream, option.orig.Z, order);
Write(stream, option.tileWidth, order); Write(stream, option.tileWidth, order);
Write(stream, option.tileHeight, order); Write(stream, option.tileHeight, order);
Write(stream, option.maxTiles, order); Write(stream, option.maxTiles, order);

View File

@ -7,9 +7,9 @@ namespace DotRecast.Detour.Io
public DtNavMeshParams Read(RcByteBuffer bb) public DtNavMeshParams Read(RcByteBuffer bb)
{ {
DtNavMeshParams option = new DtNavMeshParams(); DtNavMeshParams option = new DtNavMeshParams();
option.orig.x = bb.GetFloat(); option.orig.X = bb.GetFloat();
option.orig.y = bb.GetFloat(); option.orig.Y = bb.GetFloat();
option.orig.z = bb.GetFloat(); option.orig.Z = bb.GetFloat();
option.tileWidth = bb.GetFloat(); option.tileWidth = bb.GetFloat();
option.tileHeight = bb.GetFloat(); option.tileHeight = bb.GetFloat();
option.maxTiles = bb.GetInt(); option.maxTiles = bb.GetInt();

View File

@ -343,11 +343,11 @@ public class DebugDraw
float u = PAD + i * ARC_PTS_SCALE; float u = PAD + i * ARC_PTS_SCALE;
RcVec3f pt = new RcVec3f(); RcVec3f pt = new RcVec3f();
EvalArc(x0, y0, z0, dx, dy, dz, len * h, u, ref pt); EvalArc(x0, y0, z0, dx, dy, dz, len * h, u, ref pt);
Vertex(prev.x, prev.y, prev.z, col); Vertex(prev.X, prev.Y, prev.Z, col);
Vertex(pt.x, pt.y, pt.z, col); Vertex(pt.X, pt.Y, pt.Z, col);
prev.x = pt.x; prev.X = pt.X;
prev.y = pt.y; prev.Y = pt.Y;
prev.z = pt.z; prev.Z = pt.Z;
} }
// End arrows // End arrows
@ -372,9 +372,9 @@ public class DebugDraw
private void EvalArc(float x0, float y0, float z0, float dx, float dy, float dz, float h, float u, ref RcVec3f res) private void EvalArc(float x0, float y0, float z0, float dx, float dy, float dz, float h, float u, ref RcVec3f res)
{ {
res.x = x0 + dx * u; res.X = x0 + dx * u;
res.y = y0 + dy * u + h * (1 - (u * 2 - 1) * (u * 2 - 1)); res.Y = y0 + dy * u + h * (1 - (u * 2 - 1) * (u * 2 - 1));
res.z = z0 + dz * u; res.Z = z0 + dz * u;
} }
public void DebugDrawCross(float x, float y, float z, float size, int col, float lineWidth) public void DebugDrawCross(float x, float y, float z, float size, int col, float lineWidth)
@ -488,40 +488,40 @@ public class DebugDraw
Vertex(p, col); Vertex(p, col);
// Vertex(p.x+az.x*s+ay.x*s/2, p.y+az.y*s+ay.y*s/2, p.z+az.z*s+ay.z*s/2, col); // Vertex(p.x+az.x*s+ay.x*s/2, p.y+az.y*s+ay.y*s/2, p.z+az.z*s+ay.z*s/2, col);
Vertex(p.x + az.x * s + ax.x * s / 3, p.y + az.y * s + ax.y * s / 3, p.z + az.z * s + ax.z * s / 3, col); Vertex(p.X + az.X * s + ax.X * s / 3, p.Y + az.Y * s + ax.Y * s / 3, p.Z + az.Z * s + ax.Z * s / 3, col);
Vertex(p, col); Vertex(p, col);
// Vertex(p.x+az.x*s-ay.x*s/2, p.y+az.y*s-ay.y*s/2, p.z+az.z*s-ay.z*s/2, col); // Vertex(p.x+az.x*s-ay.x*s/2, p.y+az.y*s-ay.y*s/2, p.z+az.z*s-ay.z*s/2, col);
Vertex(p.x + az.x * s - ax.x * s / 3, p.y + az.y * s - ax.y * s / 3, p.z + az.z * s - ax.z * s / 3, col); Vertex(p.X + az.X * s - ax.X * s / 3, p.Y + az.Y * s - ax.Y * s / 3, p.Z + az.Z * s - ax.Z * s / 3, col);
} }
public void Vcross(ref RcVec3f dest, RcVec3f v1, RcVec3f v2) public void Vcross(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
{ {
dest.x = v1.y * v2.z - v1.z * v2.y; dest.X = v1.Y * v2.Z - v1.Z * v2.Y;
dest.y = v1.z * v2.x - v1.x * v2.z; dest.Y = v1.Z * v2.X - v1.X * v2.Z;
dest.z = v1.x * v2.y - v1.y * v2.x; dest.Z = v1.X * v2.Y - v1.Y * v2.X;
} }
public void Vnormalize(ref RcVec3f v) public void Vnormalize(ref RcVec3f v)
{ {
float d = (float)(1.0f / Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z)); float d = (float)(1.0f / Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z));
v.x *= d; v.X *= d;
v.y *= d; v.Y *= d;
v.z *= d; v.Z *= d;
} }
public void Vsub(ref RcVec3f dest, RcVec3f v1, RcVec3f v2) public void Vsub(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
{ {
dest.x = v1.x - v2.x; dest.X = v1.X - v2.X;
dest.y = v1.y - v2.y; dest.Y = v1.Y - v2.Y;
dest.z = v1.z - v2.z; dest.Z = v1.Z - v2.Z;
} }
public float VdistSqr(RcVec3f v1, RcVec3f v2) public float VdistSqr(RcVec3f v1, RcVec3f v2)
{ {
float x = v1.x - v2.x; float x = v1.X - v2.X;
float y = v1.y - v2.y; float y = v1.Y - v2.Y;
float z = v1.z - v2.z; float z = v1.Z - v2.Z;
return x * x + y * y + z * z; return x * x + y * y + z * z;
} }
@ -644,9 +644,9 @@ public class DebugDraw
var t = new RcMatrix4x4f(); var t = new RcMatrix4x4f();
t.M11 = t.M22 = t.M33 = t.M44 = 1; t.M11 = t.M22 = t.M33 = t.M44 = 1;
t.M41 = -cameraPos.x; t.M41 = -cameraPos.X;
t.M42 = -cameraPos.y; t.M42 = -cameraPos.Y;
t.M43 = -cameraPos.z; t.M43 = -cameraPos.Z;
_viewMatrix = RcMatrix4x4f.Mul(ref r, ref t); _viewMatrix = RcMatrix4x4f.Mul(ref r, ref t);
GetOpenGlDraw().ViewMatrix(ref _viewMatrix); GetOpenGlDraw().ViewMatrix(ref _viewMatrix);
UpdateFrustum(); UpdateFrustum();
@ -747,6 +747,6 @@ public class DebugDraw
public bool FrustumTest(RcVec3f bmin, RcVec3f bmax) public bool FrustumTest(RcVec3f bmin, RcVec3f bmax)
{ {
return FrustumTest(new float[] { bmin.x, bmin.y, bmin.z, bmax.x, bmax.y, bmax.z }); return FrustumTest(new float[] { bmin.X, bmin.Y, bmin.Z, bmax.X, bmax.Y, bmax.Z });
} }
} }

View File

@ -85,9 +85,9 @@ public static class GLU
if (@out[3] == 0.0) if (@out[3] == 0.0)
return 0; return 0;
@out[3] = 1.0f / @out[3]; @out[3] = 1.0f / @out[3];
objectCoordinate.x = @out[0] * @out[3]; objectCoordinate.X = @out[0] * @out[3];
objectCoordinate.y = @out[1] * @out[3]; objectCoordinate.Y = @out[1] * @out[3];
objectCoordinate.z = @out[2] * @out[3]; objectCoordinate.Z = @out[2] * @out[3];
return 1; return 1;
} }

View File

@ -212,10 +212,10 @@ public class NavMeshRenderer
// Draw bounds // Draw bounds
RcVec3f bmin = geom.GetMeshBoundsMin(); RcVec3f bmin = geom.GetMeshBoundsMin();
RcVec3f bmax = geom.GetMeshBoundsMax(); RcVec3f bmax = geom.GetMeshBoundsMax();
_debugDraw.DebugDrawBoxWire(bmin.x, bmin.y, bmin.z, bmax.x, bmax.y, bmax.z, _debugDraw.DebugDrawBoxWire(bmin.X, bmin.Y, bmin.Z, bmax.X, bmax.Y, bmax.Z,
DebugDraw.DuRGBA(255, 255, 255, 128), 1.0f); DebugDraw.DuRGBA(255, 255, 255, 128), 1.0f);
_debugDraw.Begin(DebugDrawPrimitives.POINTS, 5.0f); _debugDraw.Begin(DebugDrawPrimitives.POINTS, 5.0f);
_debugDraw.Vertex(bmin.x, bmin.y, bmin.z, DebugDraw.DuRGBA(255, 255, 255, 128)); _debugDraw.Vertex(bmin.X, bmin.Y, bmin.Z, DebugDraw.DuRGBA(255, 255, 255, 128));
_debugDraw.End(); _debugDraw.End();
} }
@ -264,16 +264,16 @@ public class NavMeshRenderer
var vb = RcVec3f.Of(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]); var vb = RcVec3f.Of(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
_debugDraw.Vertex(vol.verts[0], vol.hmax, vol.verts[2], col); _debugDraw.Vertex(vol.verts[0], vol.hmax, vol.verts[2], col);
_debugDraw.Vertex(vb.x, vol.hmax, vb.z, col); _debugDraw.Vertex(vb.X, vol.hmax, vb.Z, col);
_debugDraw.Vertex(va.x, vol.hmax, va.z, col); _debugDraw.Vertex(va.X, vol.hmax, va.Z, col);
_debugDraw.Vertex(va.x, vol.hmin, va.z, DebugDraw.DuDarkenCol(col)); _debugDraw.Vertex(va.X, vol.hmin, va.Z, DebugDraw.DuDarkenCol(col));
_debugDraw.Vertex(va.x, vol.hmax, va.z, col); _debugDraw.Vertex(va.X, vol.hmax, va.Z, col);
_debugDraw.Vertex(vb.x, vol.hmax, vb.z, col); _debugDraw.Vertex(vb.X, vol.hmax, vb.Z, col);
_debugDraw.Vertex(va.x, vol.hmin, va.z, DebugDraw.DuDarkenCol(col)); _debugDraw.Vertex(va.X, vol.hmin, va.Z, DebugDraw.DuDarkenCol(col));
_debugDraw.Vertex(vb.x, vol.hmax, vb.z, col); _debugDraw.Vertex(vb.X, vol.hmax, vb.Z, col);
_debugDraw.Vertex(vb.x, vol.hmin, vb.z, DebugDraw.DuDarkenCol(col)); _debugDraw.Vertex(vb.X, vol.hmin, vb.Z, DebugDraw.DuDarkenCol(col));
} }
} }
@ -287,12 +287,12 @@ public class NavMeshRenderer
{ {
var va = RcVec3f.Of(vol.verts[k], vol.verts[k + 1], vol.verts[k + 2]); 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 vb = RcVec3f.Of(vol.verts[j], vol.verts[j + 1], vol.verts[j + 2]);
_debugDraw.Vertex(va.x, vol.hmin, va.z, DebugDraw.DuDarkenCol(col)); _debugDraw.Vertex(va.X, vol.hmin, va.Z, DebugDraw.DuDarkenCol(col));
_debugDraw.Vertex(vb.x, vol.hmin, vb.z, DebugDraw.DuDarkenCol(col)); _debugDraw.Vertex(vb.X, vol.hmin, vb.Z, DebugDraw.DuDarkenCol(col));
_debugDraw.Vertex(va.x, vol.hmax, va.z, col); _debugDraw.Vertex(va.X, vol.hmax, va.Z, col);
_debugDraw.Vertex(vb.x, vol.hmax, vb.z, col); _debugDraw.Vertex(vb.X, vol.hmax, vb.Z, col);
_debugDraw.Vertex(va.x, vol.hmin, va.z, DebugDraw.DuDarkenCol(col)); _debugDraw.Vertex(va.X, vol.hmin, va.Z, DebugDraw.DuDarkenCol(col));
_debugDraw.Vertex(va.x, vol.hmax, va.z, col); _debugDraw.Vertex(va.X, vol.hmax, va.Z, col);
} }
} }

View File

@ -27,7 +27,7 @@ public struct OpenGLVertex
private readonly int color; private readonly int color;
public OpenGLVertex(RcVec3f pos, RcVec2f uv, int color) : public OpenGLVertex(RcVec3f pos, RcVec2f uv, int color) :
this(pos.x, pos.y, pos.z, uv.x, uv.y, color) this(pos.X, pos.Y, pos.Z, uv.X, uv.Y, color)
{ {
} }
@ -37,7 +37,7 @@ public struct OpenGLVertex
} }
public OpenGLVertex(RcVec3f pos, int color) : public OpenGLVertex(RcVec3f pos, int color) :
this(pos.x, pos.y, pos.z, 0f, 0f, color) this(pos.X, pos.Y, pos.Z, 0f, 0f, color)
{ {
} }

View File

@ -55,8 +55,8 @@ public class RecastDebugDraw : DebugDraw
RcVec3f norm = RcVec3f.Of(normals[i], normals[i + 1], normals[i + 2]); RcVec3f norm = RcVec3f.Of(normals[i], normals[i + 1], normals[i + 2]);
int color; int color;
char a = (char)(220 * (2 + norm.x + norm.y) / 4); char a = (char)(220 * (2 + norm.X + norm.Y) / 4);
if (norm.y < walkableThr) if (norm.Y < walkableThr)
{ {
color = DuLerpCol(DuRGBA(a, a, a, 255), unwalkable, 64); color = DuLerpCol(DuRGBA(a, a, a, 255), unwalkable, 64);
} }
@ -70,12 +70,12 @@ public class RecastDebugDraw : DebugDraw
RcVec3f vc = RcVec3f.Of(verts[tris[i + 2] * 3], verts[tris[i + 2] * 3 + 1], verts[tris[i + 2] * 3 + 2]); RcVec3f vc = RcVec3f.Of(verts[tris[i + 2] * 3], verts[tris[i + 2] * 3 + 1], verts[tris[i + 2] * 3 + 2]);
int ax = 0, ay = 0; int ax = 0, ay = 0;
if (Math.Abs(norm.y) > Math.Abs(norm[ax])) if (Math.Abs(norm.Y) > Math.Abs(norm[ax]))
{ {
ax = 1; ax = 1;
} }
if (Math.Abs(norm.z) > Math.Abs(norm[ax])) if (Math.Abs(norm.Z) > Math.Abs(norm[ax]))
{ {
ax = 2; ax = 2;
} }
@ -83,12 +83,12 @@ public class RecastDebugDraw : DebugDraw
ax = (1 << ax) & 3; // +1 mod 3 ax = (1 << ax) & 3; // +1 mod 3
ay = (1 << ax) & 3; // +1 mod 3 ay = (1 << ax) & 3; // +1 mod 3
uva.x = va[ax] * texScale; uva.X = va[ax] * texScale;
uva.y = va[ay] * texScale; uva.Y = va[ay] * texScale;
uvb.x = vb[ax] * texScale; uvb.X = vb[ax] * texScale;
uvb.y = vb[ay] * texScale; uvb.Y = vb[ay] * texScale;
uvc.x = vc[ax] * texScale; uvc.X = vc[ax] * texScale;
uvc.y = vc[ay] * texScale; uvc.Y = vc[ay] * texScale;
Vertex(va, color, uva); Vertex(va, color, uva);
Vertex(vb, color, uvb); Vertex(vb, color, uvb);
@ -213,12 +213,12 @@ public class RecastDebugDraw : DebugDraw
} }
// End points and their on-mesh locations. // End points and their on-mesh locations.
Vertex(va.x, va.y, va.z, col); Vertex(va.X, va.Y, va.Z, col);
Vertex(con.pos[0], con.pos[1], con.pos[2], col); Vertex(con.pos[0], con.pos[1], con.pos[2], col);
col2 = startSet ? col : DuRGBA(220, 32, 16, 196); col2 = startSet ? col : DuRGBA(220, 32, 16, 196);
AppendCircle(con.pos[0], con.pos[1] + 0.1f, con.pos[2], con.rad, col2); AppendCircle(con.pos[0], con.pos[1] + 0.1f, con.pos[2], con.rad, col2);
Vertex(vb.x, vb.y, vb.z, col); Vertex(vb.X, vb.Y, vb.Z, col);
Vertex(con.pos[3], con.pos[4], con.pos[5], col); Vertex(con.pos[3], con.pos[4], con.pos[5], col);
col2 = endSet ? col : DuRGBA(220, 32, 16, 196); col2 = endSet ? col : DuRGBA(220, 32, 16, 196);
AppendCircle(con.pos[3], con.pos[4] + 0.1f, con.pos[5], con.rad, col2); AppendCircle(con.pos[3], con.pos[4] + 0.1f, con.pos[5], con.rad, col2);
@ -424,10 +424,10 @@ public class RecastDebugDraw : DebugDraw
static float DistancePtLine2d(RcVec3f pt, RcVec3f p, RcVec3f q) static float DistancePtLine2d(RcVec3f pt, RcVec3f p, RcVec3f q)
{ {
float pqx = q.x - p.x; float pqx = q.X - p.X;
float pqz = q.z - p.z; float pqz = q.Z - p.Z;
float dx = pt.x - p.x; float dx = pt.X - p.X;
float dz = pt.z - p.z; float dz = pt.Z - p.Z;
float d = pqx * pqx + pqz * pqz; float d = pqx * pqx + pqz * pqz;
float t = pqx * dx + pqz * dz; float t = pqx * dx + pqz * dz;
if (d != 0) if (d != 0)
@ -435,8 +435,8 @@ public class RecastDebugDraw : DebugDraw
t /= d; t /= d;
} }
dx = p.x + t * pqx - pt.x; dx = p.X + t * pqx - pt.X;
dz = p.z + t * pqz - pt.z; dz = p.Z + t * pqz - pt.Z;
return dx * dx + dz * dz; return dx * dx + dz * dz;
} }
@ -465,9 +465,9 @@ 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.X + n.bmin[0] * cs, tile.data.header.bmin.Y + n.bmin[1] * cs,
tile.data.header.bmin.z + n.bmin[2] * cs, tile.data.header.bmin.x + n.bmax[0] * cs, tile.data.header.bmin.Z + n.bmin[2] * cs, tile.data.header.bmin.X + n.bmax[0] * 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.bmax[1] * cs, tile.data.header.bmin.Z + n.bmax[2] * cs,
DuRGBA(255, 255, 255, 128)); DuRGBA(255, 255, 255, 128));
} }
@ -485,8 +485,8 @@ public class RecastDebugDraw : DebugDraw
{ {
for (int x = 0; x < chf.width; ++x) for (int x = 0; x < chf.width; ++x)
{ {
float fx = chf.bmin.x + x * cs; float fx = chf.bmin.X + x * cs;
float fz = chf.bmin.z + y * cs; float fz = chf.bmin.Z + y * cs;
RcCompactCell c = chf.cells[x + y * chf.width]; RcCompactCell c = chf.cells[x + y * chf.width];
for (int i = c.index, ni = c.index + c.count; i < ni; ++i) for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
@ -508,7 +508,7 @@ public class RecastDebugDraw : DebugDraw
color = AreaToCol(area); color = AreaToCol(area);
} }
float fy = chf.bmin.y + (s.y + 1) * ch; float fy = chf.bmin.Y + (s.y + 1) * ch;
Vertex(fx, fy, fz, color); Vertex(fx, fy, fz, color);
Vertex(fx, fy, fz + cs, color); Vertex(fx, fy, fz + cs, color);
Vertex(fx + cs, fy, fz + cs, color); Vertex(fx + cs, fy, fz + cs, color);
@ -548,7 +548,7 @@ public class RecastDebugDraw : DebugDraw
if (cont2 != null) if (cont2 != null)
{ {
RcVec3f pos2 = GetContourCenter(cont2, orig, cs, ch); RcVec3f pos2 = GetContourCenter(cont2, orig, cs, ch);
AppendArc(pos.x, pos.y, pos.z, pos2.x, pos2.y, pos2.z, 0.25f, 0.6f, 0.6f, color); AppendArc(pos.X, pos.Y, pos.Z, pos2.X, pos2.Y, pos2.Z, 0.25f, 0.6f, 0.6f, color);
} }
} }
} }
@ -573,9 +573,9 @@ public class RecastDebugDraw : DebugDraw
private RcVec3f GetContourCenter(RcContour cont, RcVec3f orig, float cs, float ch) private RcVec3f GetContourCenter(RcContour cont, RcVec3f orig, float cs, float ch)
{ {
RcVec3f center = new RcVec3f(); RcVec3f center = new RcVec3f();
center.x = 0; center.X = 0;
center.y = 0; center.Y = 0;
center.z = 0; center.Z = 0;
if (cont.nverts == 0) if (cont.nverts == 0)
{ {
return center; return center;
@ -584,18 +584,18 @@ public class RecastDebugDraw : DebugDraw
for (int i = 0; i < cont.nverts; ++i) for (int i = 0; i < cont.nverts; ++i)
{ {
int v = i * 4; int v = i * 4;
center.x += cont.verts[v + 0]; center.X += cont.verts[v + 0];
center.y += cont.verts[v + 1]; center.Y += cont.verts[v + 1];
center.z += cont.verts[v + 2]; center.Z += cont.verts[v + 2];
} }
float s = 1.0f / cont.nverts; float s = 1.0f / cont.nverts;
center.x *= s * cs; center.X *= s * cs;
center.y *= s * ch; center.Y *= s * ch;
center.z *= s * cs; center.Z *= s * cs;
center.x += orig.x; center.X += orig.X;
center.y += orig.y + 4 * ch; center.Y += orig.Y + 4 * ch;
center.z += orig.z; center.Z += orig.Z;
return center; return center;
} }
@ -632,9 +632,9 @@ public class RecastDebugDraw : DebugDraw
int v0 = c.rverts[j * 4]; int v0 = c.rverts[j * 4];
int v1 = c.rverts[j * 4 + 1]; int v1 = c.rverts[j * 4 + 1];
int v2 = c.rverts[j * 4 + 2]; int v2 = c.rverts[j * 4 + 2];
float fx = orig.x + v0 * cs; float fx = orig.X + v0 * cs;
float fy = orig.y + (v1 + 1 + (i & 1)) * ch; float fy = orig.Y + (v1 + 1 + (i & 1)) * ch;
float fz = orig.z + v2 * cs; float fz = orig.Z + v2 * cs;
Vertex(fx, fy, fz, color); Vertex(fx, fy, fz, color);
if (j > 0) if (j > 0)
{ {
@ -647,9 +647,9 @@ public class RecastDebugDraw : DebugDraw
int v0 = c.rverts[0]; int v0 = c.rverts[0];
int v1 = c.rverts[1]; int v1 = c.rverts[1];
int v2 = c.rverts[2]; int v2 = c.rverts[2];
float fx = orig.x + v0 * cs; float fx = orig.X + v0 * cs;
float fy = orig.y + (v1 + 1 + (i & 1)) * ch; float fy = orig.Y + (v1 + 1 + (i & 1)) * ch;
float fz = orig.z + v2 * cs; float fz = orig.Z + v2 * cs;
Vertex(fx, fy, fz, color); Vertex(fx, fy, fz, color);
} }
} }
@ -677,9 +677,9 @@ public class RecastDebugDraw : DebugDraw
off = ch * 2; off = ch * 2;
} }
float fx = orig.x + v0 * cs; float fx = orig.X + v0 * cs;
float fy = orig.y + (v1 + 1 + (i & 1)) * ch + off; float fy = orig.Y + (v1 + 1 + (i & 1)) * ch + off;
float fz = orig.z + v2 * cs; float fz = orig.Z + v2 * cs;
Vertex(fx, fy, fz, colv); Vertex(fx, fy, fz, colv);
} }
} }
@ -720,14 +720,14 @@ public class RecastDebugDraw : DebugDraw
int vb2 = c.verts[j * 4 + 2]; int vb2 = c.verts[j * 4 + 2];
int col = (va3 & RcConstants.RC_AREA_BORDER) != 0 ? bcolor : color; int col = (va3 & RcConstants.RC_AREA_BORDER) != 0 ? bcolor : color;
float fx = orig.x + va0 * cs; float fx = orig.X + va0 * cs;
float fy = orig.y + (va1 + 1 + (i & 1)) * ch; float fy = orig.Y + (va1 + 1 + (i & 1)) * ch;
float fz = orig.z + va2 * cs; float fz = orig.Z + va2 * cs;
Vertex(fx, fy, fz, col); Vertex(fx, fy, fz, col);
fx = orig.x + vb0 * cs; fx = orig.X + vb0 * cs;
fy = orig.y + (vb1 + 1 + (i & 1)) * ch; fy = orig.Y + (vb1 + 1 + (i & 1)) * ch;
fz = orig.z + vb2 * cs; fz = orig.Z + vb2 * cs;
Vertex(fx, fy, fz, col); Vertex(fx, fy, fz, col);
} }
} }
@ -755,9 +755,9 @@ public class RecastDebugDraw : DebugDraw
off = ch * 2; off = ch * 2;
} }
float fx = orig.x + v0 * cs; float fx = orig.X + v0 * cs;
float fy = orig.y + (v1 + 1 + (i & 1)) * ch + off; float fy = orig.Y + (v1 + 1 + (i & 1)) * ch + off;
float fz = orig.z + v2 * cs; float fz = orig.Z + v2 * cs;
Vertex(fx, fy, fz, colv); Vertex(fx, fy, fz, colv);
} }
} }
@ -788,12 +788,12 @@ public class RecastDebugDraw : DebugDraw
{ {
for (int x = 0; x < w; ++x) for (int x = 0; x < w; ++x)
{ {
float fx = orig.x + x * cs; float fx = orig.X + x * cs;
float fz = orig.z + y * cs; float fz = orig.Z + y * cs;
RcSpan s = hf.spans[x + y * w]; RcSpan s = hf.spans[x + y * w];
while (s != null) while (s != null)
{ {
AppendBox(fx, orig.y + s.smin * ch, fz, fx + cs, orig.y + s.smax * ch, fz + cs, fcol); AppendBox(fx, orig.Y + s.smin * ch, fz, fx + cs, orig.Y + s.smax * ch, fz + cs, fcol);
s = s.next; s = s.next;
} }
} }
@ -820,8 +820,8 @@ public class RecastDebugDraw : DebugDraw
{ {
for (int x = 0; x < w; ++x) for (int x = 0; x < w; ++x)
{ {
float fx = orig.x + x * cs; float fx = orig.X + x * cs;
float fz = orig.z + y * cs; float fz = orig.Z + y * cs;
RcSpan s = hf.spans[x + y * w]; RcSpan s = hf.spans[x + y * w];
while (s != null) while (s != null)
{ {
@ -838,7 +838,7 @@ public class RecastDebugDraw : DebugDraw
fcol[0] = DuMultCol(AreaToCol(s.area), 200); fcol[0] = DuMultCol(AreaToCol(s.area), 200);
} }
AppendBox(fx, orig.y + s.smin * ch, fz, fx + cs, orig.y + s.smax * ch, fz + cs, fcol); AppendBox(fx, orig.Y + s.smin * ch, fz, fx + cs, orig.Y + s.smax * ch, fz + cs, fcol);
s = s.next; s = s.next;
} }
} }
@ -858,14 +858,14 @@ public class RecastDebugDraw : DebugDraw
{ {
for (int x = 0; x < chf.width; ++x) for (int x = 0; x < chf.width; ++x)
{ {
float fx = chf.bmin.x + x * cs; float fx = chf.bmin.X + x * cs;
float fz = chf.bmin.z + y * cs; float fz = chf.bmin.Z + y * cs;
RcCompactCell c = chf.cells[x + y * chf.width]; RcCompactCell c = chf.cells[x + y * chf.width];
for (int i = c.index, ni = c.index + c.count; i < ni; ++i) for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
{ {
RcCompactSpan s = chf.spans[i]; RcCompactSpan s = chf.spans[i];
float fy = chf.bmin.y + (s.y) * ch; float fy = chf.bmin.Y + (s.y) * ch;
int color; int color;
if (s.reg != 0) if (s.reg != 0)
{ {
@ -911,14 +911,14 @@ public class RecastDebugDraw : DebugDraw
{ {
for (int x = 0; x < chf.width; ++x) for (int x = 0; x < chf.width; ++x)
{ {
float fx = chf.bmin.x + x * cs; float fx = chf.bmin.X + x * cs;
float fz = chf.bmin.z + y * cs; float fz = chf.bmin.Z + y * cs;
RcCompactCell c = chf.cells[x + y * chf.width]; RcCompactCell c = chf.cells[x + y * chf.width];
for (int i = c.index, ni = c.index + c.count; i < ni; ++i) for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
{ {
RcCompactSpan s = chf.spans[i]; RcCompactSpan s = chf.spans[i];
float fy = chf.bmin.y + (s.y + 1) * ch; float fy = chf.bmin.Y + (s.y + 1) * ch;
char cd = (char)(chf.dist[i] * dscale); char cd = (char)(chf.dist[i] * dscale);
int color = DuRGBA(cd, cd, cd, 255); int color = DuRGBA(cd, cd, cd, 255);
Vertex(fx, fy, fz, color); Vertex(fx, fy, fz, color);
@ -976,9 +976,9 @@ public class RecastDebugDraw : DebugDraw
int v0 = mesh.verts[vi[k] * 3]; int v0 = mesh.verts[vi[k] * 3];
int v1 = mesh.verts[vi[k] * 3 + 1]; int v1 = mesh.verts[vi[k] * 3 + 1];
int v2 = mesh.verts[vi[k] * 3 + 2]; int v2 = mesh.verts[vi[k] * 3 + 2];
float x = orig.x + v0 * cs; float x = orig.X + v0 * cs;
float y = orig.y + (v1 + 1) * ch; float y = orig.Y + (v1 + 1) * ch;
float z = orig.z + v2 * cs; float z = orig.Z + v2 * cs;
Vertex(x, y, z, color); Vertex(x, y, z, color);
} }
} }
@ -1010,9 +1010,9 @@ public class RecastDebugDraw : DebugDraw
for (int k = 0; k < 2; ++k) for (int k = 0; k < 2; ++k)
{ {
int v = vi[k] * 3; int v = vi[k] * 3;
float x = orig.x + mesh.verts[v] * cs; float x = orig.X + mesh.verts[v] * cs;
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f; float y = orig.Y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
float z = orig.z + mesh.verts[v + 2] * cs; float z = orig.Z + mesh.verts[v + 2] * cs;
Vertex(x, y, z, coln); Vertex(x, y, z, coln);
} }
} }
@ -1050,9 +1050,9 @@ public class RecastDebugDraw : DebugDraw
for (int k = 0; k < 2; ++k) for (int k = 0; k < 2; ++k)
{ {
int v = vi[k] * 3; int v = vi[k] * 3;
float x = orig.x + mesh.verts[v] * cs; float x = orig.X + mesh.verts[v] * cs;
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f; float y = orig.Y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
float z = orig.z + mesh.verts[v + 2] * cs; float z = orig.Z + mesh.verts[v + 2] * cs;
Vertex(x, y, z, col); Vertex(x, y, z, col);
} }
} }
@ -1065,9 +1065,9 @@ public class RecastDebugDraw : DebugDraw
for (int i = 0; i < mesh.nverts; ++i) for (int i = 0; i < mesh.nverts; ++i)
{ {
int v = i * 3; int v = i * 3;
float x = orig.x + mesh.verts[v] * cs; float x = orig.X + mesh.verts[v] * cs;
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f; float y = orig.Y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
float z = orig.z + mesh.verts[v + 2] * cs; float z = orig.Z + mesh.verts[v + 2] * cs;
Vertex(x, y, z, colv); Vertex(x, y, z, colv);
} }
@ -1211,7 +1211,7 @@ public class RecastDebugDraw : DebugDraw
continue; continue;
} }
Vertex(node.pos.x, node.pos.y + off, node.pos.z, DuRGBA(255, 192, 0, 255)); Vertex(node.pos.X, node.pos.Y + off, node.pos.Z, DuRGBA(255, 192, 0, 255));
} }
} }
@ -1238,8 +1238,8 @@ public class RecastDebugDraw : DebugDraw
continue; continue;
} }
Vertex(node.pos.x, node.pos.y + off, node.pos.z, DuRGBA(255, 192, 0, 128)); Vertex(node.pos.X, node.pos.Y + off, node.pos.Z, DuRGBA(255, 192, 0, 128));
Vertex(parent.pos.x, parent.pos.y + off, parent.pos.z, DuRGBA(255, 192, 0, 128)); Vertex(parent.pos.X, parent.pos.Y + off, parent.pos.Z, DuRGBA(255, 192, 0, 128));
} }
} }
@ -1362,37 +1362,37 @@ public class RecastDebugDraw : DebugDraw
{ {
int col = side == 0 ? DuRGBA(128, 0, 0, 128) : DuRGBA(128, 0, 128, 128); int col = side == 0 ? DuRGBA(128, 0, 0, 128) : DuRGBA(128, 0, 128, 128);
float x = va.x + ((side == 0) ? -padx : padx); float x = va.X + ((side == 0) ? -padx : padx);
Vertex(x, va.y - pady, va.z, col); Vertex(x, va.Y - pady, va.Z, col);
Vertex(x, va.y + pady, va.z, col); Vertex(x, va.Y + pady, va.Z, col);
Vertex(x, va.y + pady, va.z, col); Vertex(x, va.Y + pady, va.Z, col);
Vertex(x, vb.y + pady, vb.z, col); Vertex(x, vb.Y + pady, vb.Z, col);
Vertex(x, vb.y + pady, vb.z, col); Vertex(x, vb.Y + pady, vb.Z, col);
Vertex(x, vb.y - pady, vb.z, col); Vertex(x, vb.Y - pady, vb.Z, col);
Vertex(x, vb.y - pady, vb.z, col); Vertex(x, vb.Y - pady, vb.Z, col);
Vertex(x, va.y - pady, va.z, col); Vertex(x, va.Y - pady, va.Z, col);
} }
else if (side == 2 || side == 6) else if (side == 2 || side == 6)
{ {
int col = side == 2 ? DuRGBA(0, 128, 0, 128) : DuRGBA(0, 128, 128, 128); int col = side == 2 ? DuRGBA(0, 128, 0, 128) : DuRGBA(0, 128, 128, 128);
float z = va.z + ((side == 2) ? -padx : padx); float z = va.Z + ((side == 2) ? -padx : padx);
Vertex(va.x, va.y - pady, z, col); Vertex(va.X, va.Y - pady, z, col);
Vertex(va.x, va.y + pady, z, col); Vertex(va.X, va.Y + pady, z, col);
Vertex(va.x, va.y + pady, z, col); Vertex(va.X, va.Y + pady, z, col);
Vertex(vb.x, vb.y + pady, z, col); Vertex(vb.X, vb.Y + pady, z, col);
Vertex(vb.x, vb.y + pady, z, col); Vertex(vb.X, vb.Y + pady, z, col);
Vertex(vb.x, vb.y - pady, z, col); Vertex(vb.X, vb.Y - pady, z, col);
Vertex(vb.x, vb.y - pady, z, col); Vertex(vb.X, vb.Y - pady, z, col);
Vertex(va.x, va.y - pady, z, col); Vertex(va.X, va.Y - pady, z, col);
} }
} }
} }

View File

@ -147,9 +147,9 @@ public class RecastDemo : IRecastDemoChannel
} }
var modelviewMatrix = dd.ViewMatrix(cameraPos, cameraEulers); var modelviewMatrix = dd.ViewMatrix(cameraPos, cameraEulers);
cameraPos.x += scrollZoom * 2.0f * modelviewMatrix.M13; cameraPos.X += scrollZoom * 2.0f * modelviewMatrix.M13;
cameraPos.y += scrollZoom * 2.0f * modelviewMatrix.M23; cameraPos.Y += scrollZoom * 2.0f * modelviewMatrix.M23;
cameraPos.z += scrollZoom * 2.0f * modelviewMatrix.M33; cameraPos.Z += scrollZoom * 2.0f * modelviewMatrix.M33;
scrollZoom = 0; scrollZoom = 0;
} }
@ -174,13 +174,13 @@ public class RecastDemo : IRecastDemoChannel
var modelviewMatrix = dd.ViewMatrix(cameraPos, cameraEulers); var modelviewMatrix = dd.ViewMatrix(cameraPos, cameraEulers);
cameraPos = origCameraPos; cameraPos = origCameraPos;
cameraPos.x -= 0.1f * dx * modelviewMatrix.M11; cameraPos.X -= 0.1f * dx * modelviewMatrix.M11;
cameraPos.y -= 0.1f * dx * modelviewMatrix.M21; cameraPos.Y -= 0.1f * dx * modelviewMatrix.M21;
cameraPos.z -= 0.1f * dx * modelviewMatrix.M31; cameraPos.Z -= 0.1f * dx * modelviewMatrix.M31;
cameraPos.x += 0.1f * dy * modelviewMatrix.M12; cameraPos.X += 0.1f * dy * modelviewMatrix.M12;
cameraPos.y += 0.1f * dy * modelviewMatrix.M22; cameraPos.Y += 0.1f * dy * modelviewMatrix.M22;
cameraPos.z += 0.1f * dy * modelviewMatrix.M32; cameraPos.Z += 0.1f * dy * modelviewMatrix.M32;
if (dx * dx + dy * dy > 3 * 3) if (dx * dx + dy * dy > 3 * 3)
{ {
movedDuringPan = true; movedDuringPan = true;
@ -214,9 +214,9 @@ public class RecastDemo : IRecastDemoChannel
movedDuringPan = false; movedDuringPan = false;
origMousePos[0] = mousePos[0]; origMousePos[0] = mousePos[0];
origMousePos[1] = mousePos[1]; origMousePos[1] = mousePos[1];
origCameraPos.x = cameraPos.x; origCameraPos.X = cameraPos.X;
origCameraPos.y = cameraPos.y; origCameraPos.Y = cameraPos.Y;
origCameraPos.z = cameraPos.z; origCameraPos.Z = cameraPos.Z;
} }
} }
} }
@ -473,15 +473,15 @@ public class RecastDemo : IRecastDemoChannel
double movey = (_moveBack - _moveFront) * keySpeed * dt + scrollZoom * 2.0f; double movey = (_moveBack - _moveFront) * keySpeed * dt + scrollZoom * 2.0f;
scrollZoom = 0; scrollZoom = 0;
cameraPos.x += (float)(movex * modelviewMatrix[0]); cameraPos.X += (float)(movex * modelviewMatrix[0]);
cameraPos.y += (float)(movex * modelviewMatrix[4]); cameraPos.Y += (float)(movex * modelviewMatrix[4]);
cameraPos.z += (float)(movex * modelviewMatrix[8]); cameraPos.Z += (float)(movex * modelviewMatrix[8]);
cameraPos.x += (float)(movey * modelviewMatrix[2]); cameraPos.X += (float)(movey * modelviewMatrix[2]);
cameraPos.y += (float)(movey * modelviewMatrix[6]); cameraPos.Y += (float)(movey * modelviewMatrix[6]);
cameraPos.z += (float)(movey * modelviewMatrix[10]); cameraPos.Z += (float)(movey * modelviewMatrix[10]);
cameraPos.y += (float)((_moveUp - _moveDown) * keySpeed * dt); cameraPos.Y += (float)((_moveUp - _moveDown) * keySpeed * dt);
long time = RcFrequency.Ticks; long time = RcFrequency.Ticks;
prevFrameTime = time; prevFrameTime = time;
@ -552,15 +552,15 @@ public class RecastDemo : IRecastDemoChannel
} }
bminN = RcVec3f.Of( bminN = RcVec3f.Of(
Math.Min(bminN.x, result.GetSolidHeightfield().bmin.x), Math.Min(bminN.X, result.GetSolidHeightfield().bmin.X),
Math.Min(bminN.y, result.GetSolidHeightfield().bmin.y), Math.Min(bminN.Y, result.GetSolidHeightfield().bmin.Y),
Math.Min(bminN.z, result.GetSolidHeightfield().bmin.z) Math.Min(bminN.Z, result.GetSolidHeightfield().bmin.Z)
); );
bmaxN = RcVec3f.Of( bmaxN = RcVec3f.Of(
Math.Max(bmaxN.x, result.GetSolidHeightfield().bmax.x), Math.Max(bmaxN.X, result.GetSolidHeightfield().bmax.X),
Math.Max(bmaxN.y, result.GetSolidHeightfield().bmax.y), Math.Max(bmaxN.Y, result.GetSolidHeightfield().bmax.Y),
Math.Max(bmaxN.z, result.GetSolidHeightfield().bmax.z) Math.Max(bmaxN.Z, result.GetSolidHeightfield().bmax.Z)
); );
hasBound = true; hasBound = true;
@ -573,10 +573,10 @@ public class RecastDemo : IRecastDemoChannel
RcVec3f bmin = bminN; RcVec3f bmin = bminN;
RcVec3f bmax = bmaxN; RcVec3f bmax = bmaxN;
camr = (float)(Math.Sqrt(RcMath.Sqr(bmax.x - bmin.x) + RcMath.Sqr(bmax.y - bmin.y) + RcMath.Sqr(bmax.z - bmin.z)) / 2); camr = (float)(Math.Sqrt(RcMath.Sqr(bmax.X - bmin.X) + RcMath.Sqr(bmax.Y - bmin.Y) + RcMath.Sqr(bmax.Z - bmin.Z)) / 2);
cameraPos.x = (bmax.x + bmin.x) / 2 + camr; cameraPos.X = (bmax.X + bmin.X) / 2 + camr;
cameraPos.y = (bmax.y + bmin.y) / 2 + camr; cameraPos.Y = (bmax.Y + bmin.Y) / 2 + camr;
cameraPos.z = (bmax.z + bmin.z) / 2 + camr; cameraPos.Z = (bmax.Z + bmin.Z) / 2 + camr;
camr *= 5; camr *= 5;
cameraEulers[0] = 45; cameraEulers[0] = 45;
cameraEulers[1] = -45; cameraEulers[1] = -45;
@ -789,12 +789,12 @@ public class RecastDemo : IRecastDemoChannel
hit = RcPolyMeshRaycast.Raycast(_sample.GetRecastResults(), rayStart, rayEnd, out hitTime); 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 = RcVec3f.Of(rayEnd.X - rayStart.X, rayEnd.Y - rayStart.Y, rayEnd.Z - rayStart.Z);
ISampleTool raySampleTool = toolset.GetTool(); ISampleTool raySampleTool = toolset.GetTool();
rayDir.Normalize(); rayDir.Normalize();
if (raySampleTool != null) if (raySampleTool != null)
{ {
Logger.Information($"click ray - tool({raySampleTool.GetTool().GetName()}) rayStart({rayStart.x:0.#},{rayStart.y:0.#},{rayStart.z:0.#}) pos({rayDir.x:0.#},{rayDir.y:0.#},{rayDir.z:0.#}) shift({processHitTestShift})"); Logger.Information($"click ray - tool({raySampleTool.GetTool().GetName()}) rayStart({rayStart.X:0.#},{rayStart.Y:0.#},{rayStart.Z:0.#}) pos({rayDir.X:0.#},{rayDir.Y:0.#},{rayDir.Z:0.#}) shift({processHitTestShift})");
raySampleTool.HandleClickRay(rayStart, rayDir, processHitTestShift); raySampleTool.HandleClickRay(rayStart, rayDir, processHitTestShift);
} }
@ -804,19 +804,19 @@ public class RecastDemo : IRecastDemoChannel
{ {
// Marker // Marker
markerPositionSet = true; markerPositionSet = true;
markerPosition.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime; markerPosition.X = rayStart.X + (rayEnd.X - rayStart.X) * hitTime;
markerPosition.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime; markerPosition.Y = rayStart.Y + (rayEnd.Y - rayStart.Y) * hitTime;
markerPosition.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime; markerPosition.Z = rayStart.Z + (rayEnd.Z - rayStart.Z) * hitTime;
} }
else else
{ {
RcVec3f pos = new RcVec3f(); RcVec3f pos = new RcVec3f();
pos.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime; pos.X = rayStart.X + (rayEnd.X - rayStart.X) * hitTime;
pos.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime; pos.Y = rayStart.Y + (rayEnd.Y - rayStart.Y) * hitTime;
pos.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime; pos.Z = rayStart.Z + (rayEnd.Z - rayStart.Z) * hitTime;
if (raySampleTool != null) if (raySampleTool != null)
{ {
Logger.Information($"click - tool({raySampleTool.GetTool().GetName()}) rayStart({rayStart.x:0.#},{rayStart.y:0.#},{rayStart.z:0.#}) pos({pos.x:0.#},{pos.y:0.#},{pos.z:0.#}) shift({processHitTestShift})"); Logger.Information($"click - tool({raySampleTool.GetTool().GetName()}) rayStart({rayStart.X:0.#},{rayStart.Y:0.#},{rayStart.Z:0.#}) pos({pos.X:0.#},{pos.Y:0.#},{pos.Z:0.#}) shift({processHitTestShift})");
raySampleTool.HandleClick(rayStart, pos, processHitTestShift); raySampleTool.HandleClick(rayStart, pos, processHitTestShift);
} }
} }

View File

@ -103,7 +103,7 @@ public class ConvexVolumeSampleTool : ISampleTool
float minh = float.MaxValue, maxh = 0; float minh = float.MaxValue, maxh = 0;
for (int i = 0; i < pts.Count; ++i) for (int i = 0; i < pts.Count; ++i)
{ {
minh = Math.Min(minh, pts[i].y); minh = Math.Min(minh, pts[i].Y);
} }
minh -= _boxDescent; minh -= _boxDescent;
@ -118,7 +118,7 @@ public class ConvexVolumeSampleTool : ISampleTool
col = DuRGBA(240, 32, 16, 255); col = DuRGBA(240, 32, 16, 255);
} }
dd.Vertex(pts[i].x, pts[i].y + 0.1f, pts[i].z, col); dd.Vertex(pts[i].X, pts[i].Y + 0.1f, pts[i].Z, col);
} }
dd.End(); dd.End();
@ -128,12 +128,12 @@ public class ConvexVolumeSampleTool : ISampleTool
{ {
int vi = hull[j]; int vi = hull[j];
int vj = hull[i]; int vj = hull[i];
dd.Vertex(pts[vj].x, minh, pts[vj].z, DuRGBA(255, 255, 255, 64)); dd.Vertex(pts[vj].X, minh, pts[vj].Z, DuRGBA(255, 255, 255, 64));
dd.Vertex(pts[vi].x, minh, pts[vi].z, DuRGBA(255, 255, 255, 64)); dd.Vertex(pts[vi].X, minh, pts[vi].Z, DuRGBA(255, 255, 255, 64));
dd.Vertex(pts[vj].x, maxh, pts[vj].z, DuRGBA(255, 255, 255, 64)); dd.Vertex(pts[vj].X, maxh, pts[vj].Z, DuRGBA(255, 255, 255, 64));
dd.Vertex(pts[vi].x, maxh, pts[vi].z, DuRGBA(255, 255, 255, 64)); dd.Vertex(pts[vi].X, maxh, pts[vi].Z, DuRGBA(255, 255, 255, 64));
dd.Vertex(pts[vj].x, minh, pts[vj].z, DuRGBA(255, 255, 255, 64)); dd.Vertex(pts[vj].X, minh, pts[vj].Z, DuRGBA(255, 255, 255, 64));
dd.Vertex(pts[vj].x, maxh, pts[vj].z, DuRGBA(255, 255, 255, 64)); dd.Vertex(pts[vj].X, maxh, pts[vj].Z, DuRGBA(255, 255, 255, 64));
} }
dd.End(); dd.End();

View File

@ -134,7 +134,7 @@ public class CrowdAgentProfilingSampleTool : ISampleTool
{ {
float radius = ag.option.radius; float radius = ag.option.radius;
RcVec3f pos = ag.npos; RcVec3f pos = ag.npos;
dd.DebugDrawCircle(pos.x, pos.y, pos.z, radius, DuRGBA(0, 0, 0, 32), 2.0f); dd.DebugDrawCircle(pos.X, pos.Y, pos.Z, radius, DuRGBA(0, 0, 0, 32), 2.0f);
} }
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
@ -166,8 +166,8 @@ public class CrowdAgentProfilingSampleTool : ISampleTool
else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY) else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
col = DuLerpCol(col, DuRGBA(64, 255, 0, 128), 128); col = DuLerpCol(col, DuRGBA(64, 255, 0, 128), 128);
dd.DebugDrawCylinder(pos.x - radius, pos.y + radius * 0.1f, pos.z - radius, pos.x + radius, pos.y + height, dd.DebugDrawCylinder(pos.X - radius, pos.Y + radius * 0.1f, pos.Z - radius, pos.X + radius, pos.Y + height,
pos.z + radius, col); pos.Z + radius, col);
} }
} }

View File

@ -180,7 +180,7 @@ public class CrowdSampleTool : ISampleTool
} }
if (moveTargetRef != 0) if (moveTargetRef != 0)
dd.DebugDrawCross(moveTargetPos.x, moveTargetPos.y + 0.1f, moveTargetPos.z, rad, DuRGBA(255, 255, 255, 192), 2.0f); dd.DebugDrawCross(moveTargetPos.X, moveTargetPos.Y + 0.1f, moveTargetPos.Z, rad, DuRGBA(255, 255, 255, 192), 2.0f);
// Occupancy grid. // Occupancy grid.
if (_showGrid) if (_showGrid)
@ -189,7 +189,7 @@ public class CrowdSampleTool : ISampleTool
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
RcVec3f pos = ag.corridor.GetPos(); RcVec3f pos = ag.corridor.GetPos();
gridy = Math.Max(gridy, pos.y); gridy = Math.Max(gridy, pos.Y);
} }
gridy += 1.0f; gridy += 1.0f;
@ -231,7 +231,7 @@ public class CrowdSampleTool : ISampleTool
int idx = (trail.htrail + RcCrowdAgentTrail.AGENT_MAX_TRAIL - j) % RcCrowdAgentTrail.AGENT_MAX_TRAIL; int idx = (trail.htrail + RcCrowdAgentTrail.AGENT_MAX_TRAIL - j) % RcCrowdAgentTrail.AGENT_MAX_TRAIL;
int v = idx * 3; int v = idx * 3;
float a = 1 - j / (float)RcCrowdAgentTrail.AGENT_MAX_TRAIL; float a = 1 - j / (float)RcCrowdAgentTrail.AGENT_MAX_TRAIL;
dd.Vertex(prev.x, prev.y + 0.1f, prev.z, DuRGBA(0, 0, 0, (int)(128 * preva))); dd.Vertex(prev.X, prev.Y + 0.1f, prev.Z, DuRGBA(0, 0, 0, (int)(128 * preva)));
dd.Vertex(trail.trail[v], trail.trail[v + 1] + 0.1f, trail.trail[v + 2], DuRGBA(0, 0, 0, (int)(128 * a))); dd.Vertex(trail.trail[v], trail.trail[v + 1] + 0.1f, trail.trail[v + 2], DuRGBA(0, 0, 0, (int)(128 * a)));
preva = a; preva = a;
prev.Set(trail.trail, v); prev.Set(trail.trail, v);
@ -258,16 +258,16 @@ public class CrowdSampleTool : ISampleTool
{ {
RcVec3f va = j == 0 ? pos : ag.corners[j - 1].pos; RcVec3f va = j == 0 ? pos : ag.corners[j - 1].pos;
RcVec3f vb = ag.corners[j].pos; RcVec3f vb = ag.corners[j].pos;
dd.Vertex(va.x, va.y + radius, va.z, DuRGBA(128, 0, 0, 192)); dd.Vertex(va.X, va.Y + radius, va.Z, DuRGBA(128, 0, 0, 192));
dd.Vertex(vb.x, vb.y + radius, vb.z, DuRGBA(128, 0, 0, 192)); dd.Vertex(vb.X, vb.Y + radius, vb.Z, DuRGBA(128, 0, 0, 192));
} }
if ((ag.corners[ag.corners.Count - 1].flags if ((ag.corners[ag.corners.Count - 1].flags
& DtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0) & DtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
{ {
RcVec3f v = ag.corners[ag.corners.Count - 1].pos; RcVec3f v = ag.corners[ag.corners.Count - 1].pos;
dd.Vertex(v.x, v.y, v.z, DuRGBA(192, 0, 0, 192)); dd.Vertex(v.X, v.Y, v.Z, DuRGBA(192, 0, 0, 192));
dd.Vertex(v.x, v.y + radius * 2, v.z, DuRGBA(192, 0, 0, 192)); dd.Vertex(v.X, v.Y + radius * 2, v.Z, DuRGBA(192, 0, 0, 192));
} }
dd.End(); dd.End();
@ -300,8 +300,8 @@ public class CrowdSampleTool : ISampleTool
if (_showCollisionSegments) if (_showCollisionSegments)
{ {
RcVec3f center = ag.boundary.GetCenter(); RcVec3f center = ag.boundary.GetCenter();
dd.DebugDrawCross(center.x, center.y + radius, center.z, 0.2f, DuRGBA(192, 0, 128, 255), 2.0f); dd.DebugDrawCross(center.X, center.Y + radius, center.Z, 0.2f, DuRGBA(192, 0, 128, 255), 2.0f);
dd.DebugDrawCircle(center.x, center.y + radius, center.z, ag.option.collisionQueryRange, DuRGBA(192, 0, 128, 128), 2.0f); dd.DebugDrawCircle(center.X, center.Y + radius, center.Z, ag.option.collisionQueryRange, DuRGBA(192, 0, 128, 128), 2.0f);
dd.Begin(LINES, 3.0f); dd.Begin(LINES, 3.0f);
for (int j = 0; j < ag.boundary.GetSegmentCount(); ++j) for (int j = 0; j < ag.boundary.GetSegmentCount(); ++j)
@ -313,7 +313,7 @@ public class CrowdSampleTool : ISampleTool
if (DtUtils.TriArea2D(pos, s0, s3) < 0.0f) if (DtUtils.TriArea2D(pos, s0, s3) < 0.0f)
col = DuDarkenCol(col); col = DuDarkenCol(col);
dd.AppendArrow(s[0].x, s[0].y + 0.2f, s[0].z, s[1].x, s[1].z + 0.2f, s[1].z, 0.0f, 0.3f, col); dd.AppendArrow(s[0].X, s[0].Y + 0.2f, s[0].Z, s[1].X, s[1].Z + 0.2f, s[1].Z, 0.0f, 0.3f, col);
} }
dd.End(); dd.End();
@ -321,7 +321,7 @@ public class CrowdSampleTool : ISampleTool
if (_showNeis) if (_showNeis)
{ {
dd.DebugDrawCircle(pos.x, pos.y + radius, pos.z, ag.option.collisionQueryRange, DuRGBA(0, 192, 128, 128), dd.DebugDrawCircle(pos.X, pos.Y + radius, pos.Z, ag.option.collisionQueryRange, DuRGBA(0, 192, 128, 128),
2.0f); 2.0f);
dd.Begin(LINES, 2.0f); dd.Begin(LINES, 2.0f);
@ -330,8 +330,8 @@ public class CrowdSampleTool : ISampleTool
DtCrowdAgent nei = ag.neis[j].agent; DtCrowdAgent nei = ag.neis[j].agent;
if (nei != null) if (nei != null)
{ {
dd.Vertex(pos.x, pos.y + radius, pos.z, DuRGBA(0, 192, 128, 128)); dd.Vertex(pos.X, pos.Y + radius, pos.Z, DuRGBA(0, 192, 128, 128));
dd.Vertex(nei.npos.x, nei.npos.y + radius, nei.npos.z, DuRGBA(0, 192, 128, 128)); dd.Vertex(nei.npos.X, nei.npos.Y + radius, nei.npos.Z, DuRGBA(0, 192, 128, 128));
} }
} }
@ -341,9 +341,9 @@ public class CrowdSampleTool : ISampleTool
if (_showOpt) if (_showOpt)
{ {
dd.Begin(LINES, 2.0f); dd.Begin(LINES, 2.0f);
dd.Vertex(agentDebug.optStart.x, agentDebug.optStart.y + 0.3f, agentDebug.optStart.z, dd.Vertex(agentDebug.optStart.X, agentDebug.optStart.Y + 0.3f, agentDebug.optStart.Z,
DuRGBA(0, 128, 0, 192)); DuRGBA(0, 128, 0, 192));
dd.Vertex(agentDebug.optEnd.x, agentDebug.optEnd.y + 0.3f, agentDebug.optEnd.z, DuRGBA(0, 128, 0, 192)); dd.Vertex(agentDebug.optEnd.X, agentDebug.optEnd.Y + 0.3f, agentDebug.optEnd.Z, DuRGBA(0, 128, 0, 192));
dd.End(); dd.End();
} }
} }
@ -358,7 +358,7 @@ public class CrowdSampleTool : ISampleTool
if (agentDebug.agent == ag) if (agentDebug.agent == ag)
col = DuRGBA(255, 0, 0, 128); col = DuRGBA(255, 0, 0, 128);
dd.DebugDrawCircle(pos.x, pos.y, pos.z, radius, col, 2.0f); dd.DebugDrawCircle(pos.X, pos.Y, pos.Z, radius, col, 2.0f);
} }
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
@ -378,8 +378,8 @@ public class CrowdSampleTool : ISampleTool
else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY) else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
col = DuLerpCol(col, DuRGBA(64, 255, 0, 128), 128); col = DuLerpCol(col, DuRGBA(64, 255, 0, 128), 128);
dd.DebugDrawCylinder(pos.x - radius, pos.y + radius * 0.1f, pos.z - radius, pos.x + radius, pos.y + height, dd.DebugDrawCylinder(pos.X - radius, pos.Y + radius * 0.1f, pos.Z - radius, pos.X + radius, pos.Y + height,
pos.z + radius, col); pos.Z + radius, col);
} }
if (_showVO) if (_showVO)
@ -392,9 +392,9 @@ public class CrowdSampleTool : ISampleTool
// Draw detail about agent sela // Draw detail about agent sela
DtObstacleAvoidanceDebugData vod = agentDebug.vod; DtObstacleAvoidanceDebugData vod = agentDebug.vod;
float dx = ag.npos.x; float dx = ag.npos.X;
float dy = ag.npos.y + ag.option.height; float dy = ag.npos.Y + ag.option.height;
float dz = ag.npos.z; float dz = ag.npos.Z;
dd.DebugDrawCircle(dx, dy, dz, ag.option.maxSpeed, DuRGBA(255, 255, 255, 64), 2.0f); dd.DebugDrawCircle(dx, dy, dz, ag.option.maxSpeed, DuRGBA(255, 255, 255, 64), 2.0f);
@ -407,10 +407,10 @@ public class CrowdSampleTool : ISampleTool
float pen2 = vod.GetSamplePreferredSidePenalty(j); float pen2 = vod.GetSamplePreferredSidePenalty(j);
int col = DuLerpCol(DuRGBA(255, 255, 255, 220), DuRGBA(128, 96, 0, 220), (int)(pen * 255)); int col = DuLerpCol(DuRGBA(255, 255, 255, 220), DuRGBA(128, 96, 0, 220), (int)(pen * 255));
col = DuLerpCol(col, DuRGBA(128, 0, 0, 220), (int)(pen2 * 128)); col = DuLerpCol(col, DuRGBA(128, 0, 0, 220), (int)(pen2 * 128));
dd.Vertex(dx + p.x - sr, dy, dz + p.z - sr, col); dd.Vertex(dx + p.X - sr, dy, dz + p.Z - sr, col);
dd.Vertex(dx + p.x - sr, dy, dz + p.z + sr, col); dd.Vertex(dx + p.X - sr, dy, dz + p.Z + sr, col);
dd.Vertex(dx + p.x + sr, dy, dz + p.z + sr, col); dd.Vertex(dx + p.X + sr, dy, dz + p.Z + sr, col);
dd.Vertex(dx + p.x + sr, dy, dz + p.z - sr, col); dd.Vertex(dx + p.X + sr, dy, dz + p.Z - sr, col);
} }
dd.End(); dd.End();
@ -437,12 +437,12 @@ public class CrowdSampleTool : ISampleTool
else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY) else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
col = DuLerpCol(col, DuRGBA(64, 255, 0, 192), 128); col = DuLerpCol(col, DuRGBA(64, 255, 0, 192), 128);
dd.DebugDrawCircle(pos.x, pos.y + height, pos.z, radius, col, 2.0f); dd.DebugDrawCircle(pos.X, pos.Y + height, pos.Z, radius, col, 2.0f);
dd.DebugDrawArrow(pos.x, pos.y + height, pos.z, pos.x + dvel.x, pos.y + height + dvel.y, pos.z + dvel.z, dd.DebugDrawArrow(pos.X, pos.Y + height, pos.Z, pos.X + dvel.X, pos.Y + height + dvel.Y, pos.Z + dvel.Z,
0.0f, 0.4f, DuRGBA(0, 192, 255, 192), agentDebug.agent == ag ? 2.0f : 1.0f); 0.0f, 0.4f, DuRGBA(0, 192, 255, 192), agentDebug.agent == ag ? 2.0f : 1.0f);
dd.DebugDrawArrow(pos.x, pos.y + height, pos.z, pos.x + vel.x, pos.y + height + vel.y, pos.z + vel.z, 0.0f, dd.DebugDrawArrow(pos.X, pos.Y + height, pos.Z, pos.X + vel.X, pos.Y + height + vel.Y, pos.Z + vel.Z, 0.0f,
0.4f, DuRGBA(0, 0, 0, 160), 2.0f); 0.4f, DuRGBA(0, 0, 0, 160), 2.0f);
} }

View File

@ -254,17 +254,17 @@ public class DynamicUpdateSampleTool : ISampleTool
ImGui.Separator(); ImGui.Separator();
if (sposSet) if (sposSet)
{ {
ImGui.Text($"Start: {spos.x}, {spos.y + 1.3f}, {spos.z}"); ImGui.Text($"Start: {spos.X}, {spos.Y + 1.3f}, {spos.Z}");
} }
if (eposSet) if (eposSet)
{ {
ImGui.Text($"End: {epos.x}, {epos.y + 1.3f}, {epos.z}"); ImGui.Text($"End: {epos.X}, {epos.Y + 1.3f}, {epos.Z}");
} }
if (raycastHit) if (raycastHit)
{ {
ImGui.Text($"Hit: {raycastHitPos.x}, {raycastHitPos.y}, {raycastHitPos.z}"); ImGui.Text($"Hit: {raycastHitPos.X}, {raycastHitPos.Y}, {raycastHitPos.Z}");
} }
ImGui.NewLine(); ImGui.NewLine();
@ -308,8 +308,8 @@ public class DynamicUpdateSampleTool : ISampleTool
{ {
int spathCol = raycastHit ? DuRGBA(128, 32, 16, 220) : DuRGBA(64, 128, 240, 220); int spathCol = raycastHit ? DuRGBA(128, 32, 16, 220) : DuRGBA(64, 128, 240, 220);
dd.Begin(LINES, 2.0f); dd.Begin(LINES, 2.0f);
dd.Vertex(spos.x, spos.y + 1.3f, spos.z, spathCol); dd.Vertex(spos.X, spos.Y + 1.3f, spos.Z, spathCol);
dd.Vertex(raycastHitPos.x, raycastHitPos.y, raycastHitPos.z, spathCol); dd.Vertex(raycastHitPos.X, raycastHitPos.Y, raycastHitPos.Z, spathCol);
dd.End(); dd.End();
} }
@ -325,16 +325,16 @@ public class DynamicUpdateSampleTool : ISampleTool
float c = settings.agentMaxClimb; float c = settings.agentMaxClimb;
dd.DepthMask(false); dd.DepthMask(false);
// Agent dimensions. // Agent dimensions.
dd.DebugDrawCylinderWire(pos.x - r, pos.y + 0.02f, pos.z - r, pos.x + r, pos.y + h, pos.z + r, col, 2.0f); dd.DebugDrawCylinderWire(pos.X - r, pos.Y + 0.02f, pos.Z - r, pos.X + r, pos.Y + h, pos.Z + r, col, 2.0f);
dd.DebugDrawCircle(pos.x, pos.y + c, pos.z, r, DuRGBA(0, 0, 0, 64), 1.0f); dd.DebugDrawCircle(pos.X, pos.Y + c, pos.Z, r, DuRGBA(0, 0, 0, 64), 1.0f);
int colb = DuRGBA(0, 0, 0, 196); int colb = DuRGBA(0, 0, 0, 196);
dd.Begin(LINES); dd.Begin(LINES);
dd.Vertex(pos.x, pos.y - c, pos.z, colb); dd.Vertex(pos.X, pos.Y - c, pos.Z, colb);
dd.Vertex(pos.x, pos.y + c, pos.z, colb); dd.Vertex(pos.X, pos.Y + c, pos.Z, colb);
dd.Vertex(pos.x - r / 2, pos.y + 0.02f, pos.z, colb); dd.Vertex(pos.X - r / 2, pos.Y + 0.02f, pos.Z, colb);
dd.Vertex(pos.x + r / 2, pos.y + 0.02f, pos.z, colb); dd.Vertex(pos.X + r / 2, pos.Y + 0.02f, pos.Z, colb);
dd.Vertex(pos.x, pos.y + 0.02f, pos.z - r / 2, colb); dd.Vertex(pos.X, pos.Y + 0.02f, pos.Z - r / 2, colb);
dd.Vertex(pos.x, pos.y + 0.02f, pos.z + r / 2, colb); dd.Vertex(pos.X, pos.Y + 0.02f, pos.Z + r / 2, colb);
dd.End(); dd.End();
dd.DepthMask(true); dd.DepthMask(true);
} }

View File

@ -47,11 +47,11 @@ public static class GizmoRenderer
e1[j] = vertices[v2 + j] - vertices[v0 + j]; e1[j] = vertices[v2 + j] - vertices[v0 + j];
} }
normal.x = e0.y * e1.z - e0.z * e1.y; normal.X = e0.Y * e1.Z - e0.Z * e1.Y;
normal.y = e0.z * e1.x - e0.x * e1.z; normal.Y = e0.Z * e1.X - e0.X * e1.Z;
normal.z = e0.x * e1.y - e0.y * e1.x; normal.Z = e0.X * e1.Y - e0.Y * e1.X;
RcVec3f.Normalize(ref normal); RcVec3f.Normalize(ref normal);
float c = Math.Clamp(0.57735026f * (normal.x + normal.y + normal.z), -1, 1); float c = Math.Clamp(0.57735026f * (normal.X + normal.Y + normal.Z), -1, 1);
int col = DebugDraw.DuLerpCol( int col = DebugDraw.DuLerpCol(
DebugDraw.DuRGBA(32, 32, 0, 160), DebugDraw.DuRGBA(32, 32, 0, 160),
DebugDraw.DuRGBA(220, 220, 0, 160), DebugDraw.DuRGBA(220, 220, 0, 160),
@ -62,15 +62,15 @@ public static class GizmoRenderer
public static void RenderBox(RecastDebugDraw debugDraw, RcBoxGizmo box) 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 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 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 trZ = RcVec3f.Of(box.halfEdges[0].Z, box.halfEdges[1].Z, box.halfEdges[2].Z);
float[] vertices = new float[8 * 3]; float[] vertices = new float[8 * 3];
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
vertices[i * 3 + 0] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trX) + box.center.x; vertices[i * 3 + 0] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trX) + box.center.X;
vertices[i * 3 + 1] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trY) + box.center.y; vertices[i * 3 + 1] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trY) + box.center.Y;
vertices[i * 3 + 2] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trZ) + box.center.z; vertices[i * 3 + 2] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trZ) + box.center.Z;
} }
debugDraw.Begin(DebugDrawPrimitives.TRIS); debugDraw.Begin(DebugDrawPrimitives.TRIS);
@ -144,9 +144,9 @@ public static class GizmoRenderer
int col = DebugDraw.DuLerpCol(DebugDraw.DuRGBA(32, 32, 0, 160), DebugDraw.DuRGBA(220, 220, 0, 160), (int)(127 * (1 + c))); int col = DebugDraw.DuLerpCol(DebugDraw.DuRGBA(32, 32, 0, 160), DebugDraw.DuRGBA(220, 220, 0, 160), (int)(127 * (1 + c)));
debugDraw.Vertex( debugDraw.Vertex(
sphere.radius * sphere.vertices[v] + sphere.center.x, sphere.radius * sphere.vertices[v] + sphere.center.X,
sphere.radius * sphere.vertices[v + 1] + sphere.center.y, sphere.radius * sphere.vertices[v + 1] + sphere.center.Y,
sphere.radius * sphere.vertices[v + 2] + sphere.center.z, sphere.radius * sphere.vertices[v + 2] + sphere.center.Z,
col col
); );
} }

View File

@ -245,14 +245,14 @@ public class JumpLinkBuilderSampleTool : ISampleTool
dd.End(); dd.End();
dd.Begin(LINES, 1.0f); dd.Begin(LINES, 1.0f);
dd.Vertex(link.start.p.x, link.start.p.y, link.start.p.z, colb); dd.Vertex(link.start.p.X, link.start.p.Y, link.start.p.Z, colb);
dd.Vertex(link.start.p.x, link.start.p.y + r, link.start.p.z, colb); dd.Vertex(link.start.p.X, link.start.p.Y + r, link.start.p.Z, colb);
dd.Vertex(link.start.p.x, link.start.p.y + r, link.start.p.z, colb); dd.Vertex(link.start.p.X, link.start.p.Y + r, link.start.p.Z, colb);
dd.Vertex(link.start.q.x, link.start.q.y + r, link.start.q.z, colb); dd.Vertex(link.start.q.X, link.start.q.Y + r, link.start.q.Z, colb);
dd.Vertex(link.start.q.x, link.start.q.y + r, link.start.q.z, colb); dd.Vertex(link.start.q.X, link.start.q.Y + r, link.start.q.Z, colb);
dd.Vertex(link.start.q.x, link.start.q.y, link.start.q.z, colb); dd.Vertex(link.start.q.X, link.start.q.Y, link.start.q.Z, colb);
dd.Vertex(link.start.q.x, link.start.q.y, link.start.q.z, colb); dd.Vertex(link.start.q.X, link.start.q.Y, link.start.q.Z, colb);
dd.Vertex(link.start.p.x, link.start.p.y, link.start.p.z, colb); dd.Vertex(link.start.p.X, link.start.p.Y, link.start.p.Z, colb);
dd.End(); dd.End();
GroundSegment end = link.end; GroundSegment end = link.end;
@ -264,14 +264,14 @@ public class JumpLinkBuilderSampleTool : ISampleTool
dd.End(); dd.End();
dd.Begin(LINES, 1.0f); dd.Begin(LINES, 1.0f);
dd.Vertex(end.p.x, end.p.y, end.p.z, colb); dd.Vertex(end.p.X, end.p.Y, end.p.Z, colb);
dd.Vertex(end.p.x, end.p.y + r, end.p.z, colb); dd.Vertex(end.p.X, end.p.Y + r, end.p.Z, colb);
dd.Vertex(end.p.x, end.p.y + r, end.p.z, colb); dd.Vertex(end.p.X, end.p.Y + r, end.p.Z, colb);
dd.Vertex(end.q.x, end.q.y + r, end.q.z, colb); dd.Vertex(end.q.X, end.q.Y + r, end.q.Z, colb);
dd.Vertex(end.q.x, end.q.y + r, end.q.z, colb); dd.Vertex(end.q.X, end.q.Y + r, end.q.Z, colb);
dd.Vertex(end.q.x, end.q.y, end.q.z, colb); dd.Vertex(end.q.X, end.q.Y, end.q.Z, colb);
dd.Vertex(end.q.x, end.q.y, end.q.z, colb); dd.Vertex(end.q.X, end.q.Y, end.q.Z, colb);
dd.Vertex(end.p.x, end.p.y, end.p.z, colb); dd.Vertex(end.p.X, end.p.Y, end.p.Z, colb);
dd.End(); dd.End();
dd.Begin(LINES, 4.0f); dd.Begin(LINES, 4.0f);
@ -311,7 +311,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
col = DuRGBA(220, 32, 32, 255); col = DuRGBA(220, 32, 32, 255);
} }
spt.y = s.p.y + off; spt.Y = s.p.Y + off;
dd.Vertex(spt, col); dd.Vertex(spt, col);
} }
@ -330,7 +330,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
off = 0.1f; off = 0.1f;
} }
spt.y = s.p.y + off; spt.Y = s.p.Y + off;
dd.Vertex(spt, col); dd.Vertex(spt, col);
} }
@ -351,7 +351,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
col = DuRGBA(220, 32, 32, 255); col = DuRGBA(220, 32, 32, 255);
} }
spt.y = s.p.y + off; spt.Y = s.p.Y + off;
dd.Vertex(spt, col); dd.Vertex(spt, col);
} }
@ -369,7 +369,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
off = 0.1f; off = 0.1f;
} }
spt.y = s.p.y + off; spt.Y = s.p.Y + off;
dd.Vertex(spt, col); dd.Vertex(spt, col);
} }

View File

@ -62,7 +62,7 @@ public class OffMeshConnectionSampleTool : ISampleTool
if (_hasStartPt) if (_hasStartPt)
{ {
dd.DebugDrawCross(_startPt.x, _startPt.y + 0.1f, _startPt.z, s, DuRGBA(0, 0, 0, 128), 2.0f); dd.DebugDrawCross(_startPt.X, _startPt.Y + 0.1f, _startPt.Z, s, DuRGBA(0, 0, 0, 128), 2.0f);
} }
DemoInputGeomProvider geom = _sample.GetInputGeom(); DemoInputGeomProvider geom = _sample.GetInputGeom();

View File

@ -223,7 +223,7 @@ public class TestNavmeshSampleTool : ISampleTool
dd.Begin(LINES, 3.0f); dd.Begin(LINES, 3.0f);
for (int i = 0; i < m_smoothPath.Count; ++i) for (int i = 0; i < m_smoothPath.Count; ++i)
{ {
dd.Vertex(m_smoothPath[i].x, m_smoothPath[i].y + 0.1f, m_smoothPath[i].z, spathCol); dd.Vertex(m_smoothPath[i].X, m_smoothPath[i].Y + 0.1f, m_smoothPath[i].Z, spathCol);
} }
dd.End(); dd.End();
@ -297,8 +297,8 @@ public class TestNavmeshSampleTool : ISampleTool
col = spathCol; col = spathCol;
} }
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f, straightPathItem.pos.z, col); dd.Vertex(straightPathItem.pos.X, straightPathItem.pos.Y + 0.4f, straightPathItem.pos.Z, col);
dd.Vertex(straightPathItem2.pos.x, straightPathItem2.pos.y + 0.4f, straightPathItem2.pos.z, col); dd.Vertex(straightPathItem2.pos.X, straightPathItem2.pos.Y + 0.4f, straightPathItem2.pos.Z, col);
} }
dd.End(); dd.End();
@ -324,7 +324,7 @@ public class TestNavmeshSampleTool : ISampleTool
col = spathCol; col = spathCol;
} }
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f, straightPathItem.pos.z, col); dd.Vertex(straightPathItem.pos.X, straightPathItem.pos.Y + 0.4f, straightPathItem.pos.Z, col);
} }
dd.End(); dd.End();
@ -352,8 +352,8 @@ public class TestNavmeshSampleTool : ISampleTool
{ {
DtStraightPath straightPathItem = m_straightPath[i]; DtStraightPath straightPathItem = m_straightPath[i];
DtStraightPath straightPathItem2 = m_straightPath[i + 1]; DtStraightPath straightPathItem2 = m_straightPath[i + 1];
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f, straightPathItem.pos.z, spathCol); dd.Vertex(straightPathItem.pos.X, straightPathItem.pos.Y + 0.4f, straightPathItem.pos.Z, spathCol);
dd.Vertex(straightPathItem2.pos.x, straightPathItem2.pos.y + 0.4f, straightPathItem2.pos.z, spathCol); dd.Vertex(straightPathItem2.pos.X, straightPathItem2.pos.Y + 0.4f, straightPathItem2.pos.Z, spathCol);
} }
dd.End(); dd.End();
@ -361,7 +361,7 @@ public class TestNavmeshSampleTool : ISampleTool
for (int i = 0; i < m_straightPath.Count; ++i) for (int i = 0; i < m_straightPath.Count; ++i)
{ {
DtStraightPath straightPathItem = m_straightPath[i]; DtStraightPath straightPathItem = m_straightPath[i];
dd.Vertex(straightPathItem.pos.x, straightPathItem.pos.y + 0.4f, straightPathItem.pos.z, spathCol); dd.Vertex(straightPathItem.pos.X, straightPathItem.pos.Y + 0.4f, straightPathItem.pos.Z, spathCol);
} }
dd.End(); dd.End();
@ -370,8 +370,8 @@ public class TestNavmeshSampleTool : ISampleTool
{ {
int hitCol = DuRGBA(0, 0, 0, 128); int hitCol = DuRGBA(0, 0, 0, 128);
dd.Begin(LINES, 2.0f); dd.Begin(LINES, 2.0f);
dd.Vertex(m_hitPos.x, m_hitPos.y + 0.4f, m_hitPos.z, hitCol); dd.Vertex(m_hitPos.X, m_hitPos.Y + 0.4f, m_hitPos.Z, hitCol);
dd.Vertex(m_hitPos.x + m_hitNormal.x * agentRadius, m_hitPos.y + 0.4f + m_hitNormal.y * agentRadius, m_hitPos.z + m_hitNormal.z * agentRadius, hitCol); dd.Vertex(m_hitPos.X + m_hitNormal.X * agentRadius, m_hitPos.Y + 0.4f + m_hitNormal.Y * agentRadius, m_hitPos.Z + m_hitNormal.Z * agentRadius, hitCol);
dd.End(); dd.End();
} }
@ -384,14 +384,14 @@ public class TestNavmeshSampleTool : ISampleTool
dd.DepthMask(false); dd.DepthMask(false);
if (m_spos != RcVec3f.Zero) if (m_spos != RcVec3f.Zero)
{ {
dd.DebugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, m_distanceToWall, DuRGBA(64, 16, 0, 220), 2.0f); dd.DebugDrawCircle(m_spos.X, m_spos.Y + agentHeight / 2, m_spos.Z, m_distanceToWall, DuRGBA(64, 16, 0, 220), 2.0f);
} }
if (m_hitPos != RcVec3f.Zero) if (m_hitPos != RcVec3f.Zero)
{ {
dd.Begin(LINES, 3.0f); dd.Begin(LINES, 3.0f);
dd.Vertex(m_hitPos.x, m_hitPos.y + 0.02f, m_hitPos.z, DuRGBA(0, 0, 0, 192)); dd.Vertex(m_hitPos.X, m_hitPos.Y + 0.02f, m_hitPos.Z, DuRGBA(0, 0, 0, 192));
dd.Vertex(m_hitPos.x, m_hitPos.y + agentHeight, m_hitPos.z, DuRGBA(0, 0, 0, 192)); dd.Vertex(m_hitPos.X, m_hitPos.Y + agentHeight, m_hitPos.Z, DuRGBA(0, 0, 0, 192));
dd.End(); dd.End();
} }
@ -410,7 +410,7 @@ public class TestNavmeshSampleTool : ISampleTool
dd.DepthMask(false); dd.DepthMask(false);
RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[i]); RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[i]);
RcVec3f p1 = m_navMesh.GetPolyCenter(m_polys[i]); RcVec3f p1 = m_navMesh.GetPolyCenter(m_polys[i]);
dd.DebugDrawArc(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, 0.25f, 0.0f, 0.4f, DuRGBA(0, 0, 0, 128), 2.0f); dd.DebugDrawArc(p0.X, p0.Y, p0.Z, p1.X, p1.Y, p1.Z, 0.25f, 0.0f, 0.4f, DuRGBA(0, 0, 0, 128), 2.0f);
dd.DepthMask(true); dd.DepthMask(true);
} }
@ -421,10 +421,10 @@ public class TestNavmeshSampleTool : ISampleTool
if (m_sposSet && m_eposSet) if (m_sposSet && m_eposSet)
{ {
dd.DepthMask(false); dd.DepthMask(false);
float dx = m_epos.x - m_spos.x; float dx = m_epos.X - m_spos.X;
float dz = m_epos.z - m_spos.z; float dz = m_epos.Z - m_spos.Z;
float dist = (float)Math.Sqrt(dx * dx + dz * dz); float dist = (float)Math.Sqrt(dx * dx + dz * dz);
dd.DebugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, dist, DuRGBA(64, 16, 0, 220), 2.0f); dd.DebugDrawCircle(m_spos.X, m_spos.Y + agentHeight / 2, m_spos.Z, dist, DuRGBA(64, 16, 0, 220), 2.0f);
dd.DepthMask(true); dd.DepthMask(true);
} }
} }
@ -441,7 +441,7 @@ public class TestNavmeshSampleTool : ISampleTool
dd.DepthMask(false); dd.DepthMask(false);
RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[i]); RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[i]);
RcVec3f p1 = m_navMesh.GetPolyCenter(m_polys[i]); RcVec3f p1 = m_navMesh.GetPolyCenter(m_polys[i]);
dd.DebugDrawArc(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, 0.25f, 0.0f, 0.4f, DuRGBA(0, 0, 0, 128), 2.0f); dd.DebugDrawArc(p0.X, p0.Y, p0.Z, p1.X, p1.Y, p1.Z, 0.25f, 0.0f, 0.4f, DuRGBA(0, 0, 0, 128), 2.0f);
dd.DepthMask(true); dd.DepthMask(true);
} }
@ -456,8 +456,8 @@ public class TestNavmeshSampleTool : ISampleTool
dd.Begin(LINES, 2.0f); dd.Begin(LINES, 2.0f);
for (int i = 0, j = 3; i < 4; j = i++) for (int i = 0, j = 3; i < 4; j = i++)
{ {
dd.Vertex(m_queryPoly[j].x, m_queryPoly[j].y, m_queryPoly[j].z, col); dd.Vertex(m_queryPoly[j].X, m_queryPoly[j].Y, m_queryPoly[j].Z, col);
dd.Vertex(m_queryPoly[i].x, m_queryPoly[i].y, m_queryPoly[i].z, col); dd.Vertex(m_queryPoly[i].X, m_queryPoly[i].Y, m_queryPoly[i].Z, col);
} }
dd.End(); dd.End();
@ -480,7 +480,7 @@ public class TestNavmeshSampleTool : ISampleTool
dd.DepthMask(false); dd.DepthMask(false);
RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[i]); RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[i]);
RcVec3f p1 = m_navMesh.GetPolyCenter(m_polys[i]); RcVec3f p1 = m_navMesh.GetPolyCenter(m_polys[i]);
dd.DebugDrawArc(p0.x, p0.y, p0.z, p1.x, p1.y, p1.z, 0.25f, 0.0f, 0.4f, DuRGBA(0, 0, 0, 128), 2.0f); dd.DebugDrawArc(p0.X, p0.Y, p0.Z, p1.X, p1.Y, p1.Z, 0.25f, 0.0f, 0.4f, DuRGBA(0, 0, 0, 128), 2.0f);
dd.DepthMask(true); dd.DepthMask(true);
} }
@ -508,15 +508,15 @@ public class TestNavmeshSampleTool : ISampleTool
RcVec3f delta = s3.Subtract(s.vmin); RcVec3f delta = s3.Subtract(s.vmin);
RcVec3f p0 = RcVec3f.Mad(s.vmin, delta, 0.5f); RcVec3f p0 = RcVec3f.Mad(s.vmin, delta, 0.5f);
RcVec3f norm = RcVec3f.Of(delta.z, 0, -delta.x); RcVec3f norm = RcVec3f.Of(delta.Z, 0, -delta.X);
norm.Normalize(); norm.Normalize();
RcVec3f p1 = RcVec3f.Mad(p0, norm, agentRadius * 0.5f); RcVec3f p1 = RcVec3f.Mad(p0, norm, agentRadius * 0.5f);
// Skip backfacing segments. // Skip backfacing segments.
if (segmentRefs[j] != 0) if (segmentRefs[j] != 0)
{ {
int col = DuRGBA(255, 255, 255, 32); int col = DuRGBA(255, 255, 255, 32);
dd.Vertex(s.vmin.x, s.vmin.y + agentClimb, s.vmin.z, col); dd.Vertex(s.vmin.X, s.vmin.Y + agentClimb, s.vmin.Z, col);
dd.Vertex(s.vmax.x, s.vmax.y + agentClimb, s.vmax.z, col); dd.Vertex(s.vmax.X, s.vmax.Y + agentClimb, s.vmax.Z, col);
} }
else else
{ {
@ -526,11 +526,11 @@ public class TestNavmeshSampleTool : ISampleTool
col = DuRGBA(96, 32, 16, 192); col = DuRGBA(96, 32, 16, 192);
} }
dd.Vertex(p0.x, p0.y + agentClimb, p0.z, col); dd.Vertex(p0.X, p0.Y + agentClimb, p0.Z, col);
dd.Vertex(p1.x, p1.y + agentClimb, p1.z, col); dd.Vertex(p1.X, p1.Y + agentClimb, p1.Z, col);
dd.Vertex(s.vmin.x, s.vmin.y + agentClimb, s.vmin.z, col); dd.Vertex(s.vmin.X, s.vmin.Y + agentClimb, s.vmin.Z, col);
dd.Vertex(s.vmax.x, s.vmax.y + agentClimb, s.vmax.z, col); dd.Vertex(s.vmax.X, s.vmax.Y + agentClimb, s.vmax.Z, col);
} }
} }
@ -544,7 +544,7 @@ public class TestNavmeshSampleTool : ISampleTool
if (m_sposSet) if (m_sposSet)
{ {
dd.DepthMask(false); dd.DepthMask(false);
dd.DebugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, m_neighbourhoodRadius, DuRGBA(64, 16, 0, 220), 2.0f); dd.DebugDrawCircle(m_spos.X, m_spos.Y + agentHeight / 2, m_spos.Z, m_neighbourhoodRadius, DuRGBA(64, 16, 0, 220), 2.0f);
dd.DepthMask(true); dd.DepthMask(true);
} }
} }
@ -556,17 +556,17 @@ public class TestNavmeshSampleTool : ISampleTool
int col = DuRGBA(64, 16, 0, 220); int col = DuRGBA(64, 16, 0, 220);
foreach (RcVec3f point in _randomPoints) foreach (RcVec3f point in _randomPoints)
{ {
dd.Vertex(point.x, point.y + 0.1f, point.z, col); dd.Vertex(point.X, point.Y + 0.1f, point.Z, col);
} }
dd.End(); dd.End();
if (m_sposSet && m_eposSet) if (m_sposSet && m_eposSet)
{ {
dd.DepthMask(false); dd.DepthMask(false);
float dx = m_epos.x - m_spos.x; float dx = m_epos.X - m_spos.X;
float dz = m_epos.z - m_spos.z; float dz = m_epos.Z - m_spos.Z;
float dist = (float)Math.Sqrt(dx * dx + dz * dz); float dist = (float)Math.Sqrt(dx * dx + dz * dz);
dd.DebugDrawCircle(m_spos.x, m_spos.y + agentHeight / 2, m_spos.z, dist, DuRGBA(64, 16, 0, 220), 2.0f); dd.DebugDrawCircle(m_spos.X, m_spos.Y + agentHeight / 2, m_spos.Z, dist, DuRGBA(64, 16, 0, 220), 2.0f);
dd.DepthMask(true); dd.DepthMask(true);
} }
@ -582,16 +582,16 @@ public class TestNavmeshSampleTool : ISampleTool
float c = settings.agentMaxClimb; float c = settings.agentMaxClimb;
dd.DepthMask(false); dd.DepthMask(false);
// Agent dimensions. // Agent dimensions.
dd.DebugDrawCylinderWire(pos.x - r, pos.y + 0.02f, pos.z - r, pos.x + r, pos.y + h, pos.z + r, col, 2.0f); dd.DebugDrawCylinderWire(pos.X - r, pos.Y + 0.02f, pos.Z - r, pos.X + r, pos.Y + h, pos.Z + r, col, 2.0f);
dd.DebugDrawCircle(pos.x, pos.y + c, pos.z, r, DuRGBA(0, 0, 0, 64), 1.0f); dd.DebugDrawCircle(pos.X, pos.Y + c, pos.Z, r, DuRGBA(0, 0, 0, 64), 1.0f);
int colb = DuRGBA(0, 0, 0, 196); int colb = DuRGBA(0, 0, 0, 196);
dd.Begin(LINES); dd.Begin(LINES);
dd.Vertex(pos.x, pos.y - c, pos.z, colb); dd.Vertex(pos.X, pos.Y - c, pos.Z, colb);
dd.Vertex(pos.x, pos.y + c, pos.z, colb); dd.Vertex(pos.X, pos.Y + c, pos.Z, colb);
dd.Vertex(pos.x - r / 2, pos.y + 0.02f, pos.z, colb); dd.Vertex(pos.X - r / 2, pos.Y + 0.02f, pos.Z, colb);
dd.Vertex(pos.x + r / 2, pos.y + 0.02f, pos.z, colb); dd.Vertex(pos.X + r / 2, pos.Y + 0.02f, pos.Z, colb);
dd.Vertex(pos.x, pos.y + 0.02f, pos.z - r / 2, colb); dd.Vertex(pos.X, pos.Y + 0.02f, pos.Z - r / 2, colb);
dd.Vertex(pos.x, pos.y + 0.02f, pos.z + r / 2, colb); dd.Vertex(pos.X, pos.Y + 0.02f, pos.Z + r / 2, colb);
dd.End(); dd.End();
dd.DepthMask(true); dd.DepthMask(true);
} }

View File

@ -59,8 +59,8 @@ public class TileSampleTool : ISampleTool
var s = settings.agentRadius; var s = settings.agentRadius;
float ts = settings.tileSize * settings.cellSize; float ts = settings.tileSize * settings.cellSize;
int tx = (int)((_hitPos.x - bmin[0]) / ts); int tx = (int)((_hitPos.X - bmin[0]) / ts);
int ty = (int)((_hitPos.z - bmin[2]) / ts); int ty = (int)((_hitPos.Z - bmin[2]) / ts);
RcVec3f lastBuiltTileBmin = RcVec3f.Zero; RcVec3f lastBuiltTileBmin = RcVec3f.Zero;
RcVec3f lastBuiltTileBmax = RcVec3f.Zero; RcVec3f lastBuiltTileBmax = RcVec3f.Zero;
@ -73,10 +73,10 @@ public class TileSampleTool : ISampleTool
lastBuiltTileBmax[1] = bmax[1]; lastBuiltTileBmax[1] = bmax[1];
lastBuiltTileBmax[2] = bmin[2] + (ty + 1) * ts; lastBuiltTileBmax[2] = bmin[2] + (ty + 1) * ts;
dd.DebugDrawCross(_hitPos.x, _hitPos.y + 0.1f, _hitPos.z, s, DuRGBA(0, 0, 0, 128), 2.0f); dd.DebugDrawCross(_hitPos.X, _hitPos.Y + 0.1f, _hitPos.Z, s, DuRGBA(0, 0, 0, 128), 2.0f);
dd.DebugDrawBoxWire( dd.DebugDrawBoxWire(
lastBuiltTileBmin.x, lastBuiltTileBmin.y, lastBuiltTileBmin.z, lastBuiltTileBmin.X, lastBuiltTileBmin.Y, lastBuiltTileBmin.Z,
lastBuiltTileBmax.x, lastBuiltTileBmax.y, lastBuiltTileBmax.z, lastBuiltTileBmax.X, lastBuiltTileBmax.Y, lastBuiltTileBmax.Z,
DuRGBA(255, 255, 255, 64), 1.0f); DuRGBA(255, 255, 255, 64), 1.0f);
// 표기 // 표기

View File

@ -98,9 +98,9 @@ namespace DotRecast.Recast.Toolset.Geom
e1[j] = vertices[v2 + j] - vertices[v0 + j]; e1[j] = vertices[v2 + j] - vertices[v0 + j];
} }
normals[i] = e0.y * e1.z - e0.z * e1.y; normals[i] = e0.Y * e1.Z - e0.Z * e1.Y;
normals[i + 1] = e0.z * e1.x - e0.x * e1.z; normals[i + 1] = e0.Z * e1.X - e0.X * e1.Z;
normals[i + 2] = e0.x * e1.y - e0.y * e1.x; normals[i + 2] = e0.X * e1.Y - e0.Y * e1.X;
float d = (float)Math.Sqrt(normals[i] * normals[i] + normals[i + 1] * normals[i + 1] + normals[i + 2] * normals[i + 2]); float d = (float)Math.Sqrt(normals[i] * normals[i] + normals[i + 1] * normals[i + 1] + normals[i + 2] * normals[i + 2]);
if (d > 0) if (d > 0)
{ {
@ -150,10 +150,10 @@ namespace DotRecast.Recast.Toolset.Geom
float[] p = new float[2]; float[] p = new float[2];
float[] q = new float[2]; float[] q = new float[2];
p[0] = src.x + (dst.x - src.x) * btmin; p[0] = src.X + (dst.X - src.X) * btmin;
p[1] = src.z + (dst.z - src.z) * btmin; p[1] = src.Z + (dst.Z - src.Z) * btmin;
q[0] = src.x + (dst.x - src.x) * btmax; q[0] = src.X + (dst.X - src.X) * btmax;
q[1] = src.z + (dst.z - src.z) * btmax; q[1] = src.Z + (dst.Z - src.Z) * btmax;
List<RcChunkyTriMeshNode> chunks = _mesh.chunkyTriMesh.GetChunksOverlappingSegment(p, q); List<RcChunkyTriMeshNode> chunks = _mesh.chunkyTriMesh.GetChunksOverlappingSegment(p, q);
if (0 == chunks.Count) if (0 == chunks.Count)

View File

@ -41,9 +41,9 @@ namespace DotRecast.Recast.Toolset.Gizmos
float s0 = (i & 1) != 0 ? 1f : -1f; float s0 = (i & 1) != 0 ? 1f : -1f;
float s1 = (i & 2) != 0 ? 1f : -1f; float s1 = (i & 2) != 0 ? 1f : -1f;
float s2 = (i & 4) != 0 ? 1f : -1f; float s2 = (i & 4) != 0 ? 1f : -1f;
vertices[i * 3 + 0] = center.x + s0 * halfEdges[0].x + s1 * halfEdges[1].x + s2 * halfEdges[2].x; vertices[i * 3 + 0] = center.X + s0 * halfEdges[0].X + s1 * halfEdges[1].X + s2 * halfEdges[2].X;
vertices[i * 3 + 1] = center.y + s0 * halfEdges[0].y + s1 * halfEdges[1].y + s2 * halfEdges[2].y; vertices[i * 3 + 1] = center.Y + s0 * halfEdges[0].Y + s1 * halfEdges[1].Y + s2 * halfEdges[2].Y;
vertices[i * 3 + 2] = center.z + s0 * halfEdges[0].z + s1 * halfEdges[1].z + s2 * halfEdges[2].z; vertices[i * 3 + 2] = center.Z + s0 * halfEdges[0].Z + s1 * halfEdges[1].Z + s2 * halfEdges[2].Z;
} }
} }
} }

View File

@ -16,21 +16,21 @@ namespace DotRecast.Recast.Toolset.Gizmos
{ {
center = new float[] center = new float[]
{ {
0.5f * (start.x + end.x), 0.5f * (start.y + end.y), 0.5f * (start.X + end.X), 0.5f * (start.Y + end.Y),
0.5f * (start.z + end.z) 0.5f * (start.Z + end.Z)
}; };
RcVec3f axis = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z); RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
RcVec3f[] normals = new RcVec3f[3]; RcVec3f[] normals = new RcVec3f[3];
normals[1] = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z); normals[1] = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
RcVec3f.Normalize(ref normals[1]); RcVec3f.Normalize(ref normals[1]);
normals[0] = GetSideVector(axis); normals[0] = GetSideVector(axis);
normals[2] = RcVec3f.Zero; normals[2] = RcVec3f.Zero;
RcVec3f.Cross(ref normals[2], normals[0], normals[1]); RcVec3f.Cross(ref normals[2], normals[0], normals[1]);
RcVec3f.Normalize(ref normals[2]); RcVec3f.Normalize(ref normals[2]);
triangles = GenerateSphericalTriangles(); triangles = GenerateSphericalTriangles();
var trX = RcVec3f.Of(normals[0].x, normals[1].x, normals[2].x); 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 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 trZ = RcVec3f.Of(normals[0].Z, normals[1].Z, normals[2].Z);
float[] spVertices = GenerateSphericalVertices(); float[] spVertices = GenerateSphericalVertices();
float halfLength = 0.5f * axis.Length(); float halfLength = 0.5f * axis.Length();
vertices = new float[spVertices.Length]; vertices = new float[spVertices.Length];
@ -42,21 +42,21 @@ namespace DotRecast.Recast.Toolset.Gizmos
float x = radius * spVertices[i]; float x = radius * spVertices[i];
float y = radius * spVertices[i + 1] + offset; float y = radius * spVertices[i + 1] + offset;
float z = radius * spVertices[i + 2]; float z = radius * spVertices[i + 2];
vertices[i] = x * trX.x + y * trX.y + z * trX.z + center[0]; vertices[i] = x * trX.X + y * trX.Y + z * trX.Z + center[0];
vertices[i + 1] = x * trY.x + y * trY.y + z * trY.z + center[1]; vertices[i + 1] = x * trY.X + y * trY.Y + z * trY.Z + center[1];
vertices[i + 2] = x * trZ.x + y * trZ.y + z * trZ.z + center[2]; vertices[i + 2] = x * trZ.X + y * trZ.Y + z * trZ.Z + center[2];
v.x = vertices[i] - center[0]; v.X = vertices[i] - center[0];
v.y = vertices[i + 1] - center[1]; v.Y = vertices[i + 1] - center[1];
v.z = vertices[i + 2] - center[2]; v.Z = vertices[i + 2] - center[2];
RcVec3f.Normalize(ref v); RcVec3f.Normalize(ref v);
gradient[i / 3] = Math.Clamp(0.57735026f * (v.x + v.y + v.z), -1, 1); gradient[i / 3] = Math.Clamp(0.57735026f * (v.X + v.Y + v.Z), -1, 1);
} }
} }
private RcVec3f GetSideVector(RcVec3f axis) private RcVec3f GetSideVector(RcVec3f axis)
{ {
RcVec3f side = RcVec3f.Of(1, 0, 0); RcVec3f side = RcVec3f.Of(1, 0, 0);
if (axis.x > 0.8) if (axis.X > 0.8)
{ {
side = RcVec3f.Of(0, 0, 1); side = RcVec3f.Of(0, 0, 1);
} }

View File

@ -16,21 +16,21 @@ namespace DotRecast.Recast.Toolset.Gizmos
public RcCylinderGizmo(RcVec3f start, RcVec3f end, float radius) public RcCylinderGizmo(RcVec3f start, RcVec3f end, float radius)
{ {
center = RcVec3f.Of( center = RcVec3f.Of(
0.5f * (start.x + end.x), 0.5f * (start.y + end.y), 0.5f * (start.X + end.X), 0.5f * (start.Y + end.Y),
0.5f * (start.z + end.z) 0.5f * (start.Z + end.Z)
); );
RcVec3f axis = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z); RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
RcVec3f[] normals = new RcVec3f[3]; RcVec3f[] normals = new RcVec3f[3];
normals[1] = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z); normals[1] = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
RcVec3f.Normalize(ref normals[1]); RcVec3f.Normalize(ref normals[1]);
normals[0] = GetSideVector(axis); normals[0] = GetSideVector(axis);
normals[2] = RcVec3f.Zero; normals[2] = RcVec3f.Zero;
RcVec3f.Cross(ref normals[2], normals[0], normals[1]); RcVec3f.Cross(ref normals[2], normals[0], normals[1]);
RcVec3f.Normalize(ref normals[2]); RcVec3f.Normalize(ref normals[2]);
triangles = GenerateCylindricalTriangles(); triangles = GenerateCylindricalTriangles();
RcVec3f trX = RcVec3f.Of(normals[0].x, normals[1].x, normals[2].x); 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 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 trZ = RcVec3f.Of(normals[0].Z, normals[1].Z, normals[2].Z);
vertices = GenerateCylindricalVertices(); vertices = GenerateCylindricalVertices();
float halfLength = 0.5f * axis.Length(); float halfLength = 0.5f * axis.Length();
gradient = new float[vertices.Length / 3]; gradient = new float[vertices.Length / 3];
@ -41,20 +41,20 @@ namespace DotRecast.Recast.Toolset.Gizmos
float x = radius * vertices[i]; float x = radius * vertices[i];
float y = vertices[i + 1] + offset; float y = vertices[i + 1] + offset;
float z = radius * vertices[i + 2]; float z = radius * vertices[i + 2];
vertices[i] = x * trX.x + y * trX.y + z * trX.z + center.x; vertices[i] = x * trX.X + y * trX.Y + z * trX.Z + center.X;
vertices[i + 1] = x * trY.x + y * trY.y + z * trY.z + center.y; vertices[i + 1] = x * trY.X + y * trY.Y + z * trY.Z + center.Y;
vertices[i + 2] = x * trZ.x + y * trZ.y + z * trZ.z + center.z; vertices[i + 2] = x * trZ.X + y * trZ.Y + z * trZ.Z + center.Z;
if (i < vertices.Length / 4 || i >= 3 * vertices.Length / 4) if (i < vertices.Length / 4 || i >= 3 * vertices.Length / 4)
{ {
gradient[i / 3] = 1; gradient[i / 3] = 1;
} }
else else
{ {
v.x = vertices[i] - center.x; v.X = vertices[i] - center.X;
v.y = vertices[i + 1] - center.y; v.Y = vertices[i + 1] - center.Y;
v.z = vertices[i + 2] - center.z; v.Z = vertices[i + 2] - center.Z;
RcVec3f.Normalize(ref v); RcVec3f.Normalize(ref v);
gradient[i / 3] = Math.Clamp(0.57735026f * (v.x + v.y + v.z), -1, 1); gradient[i / 3] = Math.Clamp(0.57735026f * (v.X + v.Y + v.Z), -1, 1);
} }
} }
} }
@ -62,7 +62,7 @@ namespace DotRecast.Recast.Toolset.Gizmos
private RcVec3f GetSideVector(RcVec3f axis) private RcVec3f GetSideVector(RcVec3f axis)
{ {
RcVec3f side = RcVec3f.Of(1, 0, 0); RcVec3f side = RcVec3f.Of(1, 0, 0);
if (axis.x > 0.8) if (axis.X > 0.8)
{ {
side = RcVec3f.Of(0, 0, 1); side = RcVec3f.Of(0, 0, 1);
} }

View File

@ -80,8 +80,8 @@ namespace DotRecast.Recast.Toolset.Tools
IList<RcConvexVolume> vols = geom.ConvexVolumes(); IList<RcConvexVolume> vols = geom.ConvexVolumes();
for (int i = 0; i < vols.Count; ++i) for (int i = 0; i < vols.Count; ++i)
{ {
if (RcAreas.PointInPoly(vols[i].verts, pos) && pos.y >= vols[i].hmin if (RcAreas.PointInPoly(vols[i].verts, pos) && pos.Y >= vols[i].hmin
&& pos.y <= vols[i].hmax) && pos.Y <= vols[i].hmax)
{ {
nearestIndex = i; nearestIndex = i;
} }
@ -113,9 +113,9 @@ namespace DotRecast.Recast.Toolset.Tools
float[] verts = new float[hull.Count * 3]; float[] verts = new float[hull.Count * 3];
for (int i = 0; i < hull.Count; ++i) for (int i = 0; i < hull.Count; ++i)
{ {
verts[i * 3] = pts[hull[i]].x; verts[i * 3] = pts[hull[i]].X;
verts[i * 3 + 1] = pts[hull[i]].y; verts[i * 3 + 1] = pts[hull[i]].Y;
verts[i * 3 + 2] = pts[hull[i]].z; verts[i * 3 + 2] = pts[hull[i]].Z;
} }
float minh = float.MaxValue, maxh = 0; float minh = float.MaxValue, maxh = 0;

View File

@ -306,9 +306,9 @@ namespace DotRecast.Recast.Toolset.Tools
if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VALID) if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VALID)
{ {
float dx = ag.targetPos.x - ag.npos.x; float dx = ag.targetPos.X - ag.npos.X;
float dy = ag.targetPos.y - ag.npos.y; float dy = ag.targetPos.Y - ag.npos.Y;
float dz = ag.targetPos.z - ag.npos.z; float dz = ag.targetPos.Z - ag.npos.Z;
return dx * dx + dy * dy + dz * dz < 0.3f; return dx * dx + dy * dy + dz * dz < 0.3f;
} }

View File

@ -150,9 +150,9 @@ namespace DotRecast.Recast.Toolset.Tools
RcCrowdAgentTrail trail = _trails[ag.idx]; RcCrowdAgentTrail trail = _trails[ag.idx];
// Update agent movement trail. // Update agent movement trail.
trail.htrail = (trail.htrail + 1) % RcCrowdAgentTrail.AGENT_MAX_TRAIL; trail.htrail = (trail.htrail + 1) % RcCrowdAgentTrail.AGENT_MAX_TRAIL;
trail.trail[trail.htrail * 3] = ag.npos.x; trail.trail[trail.htrail * 3] = ag.npos.X;
trail.trail[trail.htrail * 3 + 1] = ag.npos.y; trail.trail[trail.htrail * 3 + 1] = ag.npos.Y;
trail.trail[trail.htrail * 3 + 2] = ag.npos.z; trail.trail[trail.htrail * 3 + 2] = ag.npos.Z;
} }
_agentDebug.vod.NormalizeSamples(); _agentDebug.vod.NormalizeSamples();
@ -188,9 +188,9 @@ namespace DotRecast.Recast.Toolset.Tools
for (int i = 0; i < RcCrowdAgentTrail.AGENT_MAX_TRAIL; ++i) for (int i = 0; i < RcCrowdAgentTrail.AGENT_MAX_TRAIL; ++i)
{ {
trail.trail[i * 3] = p.x; trail.trail[i * 3] = p.X;
trail.trail[i * 3 + 1] = p.y; trail.trail[i * 3 + 1] = p.Y;
trail.trail[i * 3 + 2] = p.z; trail.trail[i * 3 + 2] = p.Z;
} }
trail.htrail = 0; trail.htrail = 0;
@ -240,12 +240,12 @@ namespace DotRecast.Recast.Toolset.Tools
RcVec3f p = ag.npos; RcVec3f p = ag.npos;
float r = ag.option.radius; float r = ag.option.radius;
float h = ag.option.height; float h = ag.option.height;
bmin.x = p.x - r; bmin.X = p.X - r;
bmin.y = p.y; bmin.Y = p.Y;
bmin.z = p.z - r; bmin.Z = p.Z - r;
bmax.x = p.x + r; bmax.X = p.X + r;
bmax.y = p.y + h; bmax.Y = p.Y + h;
bmax.z = p.z + r; bmax.Z = p.Z + r;
} }
public void SetMoveTarget(RcVec3f p, bool adjust) public void SetMoveTarget(RcVec3f p, bool adjust)
@ -295,7 +295,7 @@ namespace DotRecast.Recast.Toolset.Tools
private RcVec3f CalcVel(RcVec3f pos, RcVec3f tgt, float speed) private RcVec3f CalcVel(RcVec3f pos, RcVec3f tgt, float speed)
{ {
RcVec3f vel = tgt.Subtract(pos); RcVec3f vel = tgt.Subtract(pos);
vel.y = 0.0f; vel.Y = 0.0f;
vel.Normalize(); vel.Normalize();
return vel.Scale(speed); return vel.Scale(speed);
} }

View File

@ -68,16 +68,16 @@ namespace DotRecast.Recast.Toolset.Tools
float dy = 0.5f * (bounds[4] - bounds[1]); float dy = 0.5f * (bounds[4] - bounds[1]);
float dz = 0.5f * (bounds[5] - bounds[2]); float dz = 0.5f * (bounds[5] - bounds[2]);
float rSqr = dx * dx + dy * dy + dz * dz; float rSqr = dx * dx + dy * dy + dz * dz;
float mx = point.x - cx; float mx = point.X - cx;
float my = point.y - cy; float my = point.Y - cy;
float mz = point.z - cz; float mz = point.Z - cz;
float c = mx * mx + my * my + mz * mz - rSqr; float c = mx * mx + my * my + mz * mz - rSqr;
if (c <= 0.0f) if (c <= 0.0f)
{ {
return true; return true;
} }
float b = mx * dir.x + my * dir.y + mz * dir.z; float b = mx * dir.X + my * dir.Y + mz * dir.Z;
if (b > 0.0f) if (b > 0.0f)
{ {
return false; return false;
@ -184,11 +184,11 @@ namespace DotRecast.Recast.Toolset.Tools
); );
a.Normalize(); a.Normalize();
float len = 1f + (float)random.NextDouble() * 20f; float len = 1f + (float)random.NextDouble() * 20f;
a.x *= len; a.X *= len;
a.y *= len; a.Y *= len;
a.z *= len; a.Z *= len;
RcVec3f start = RcVec3f.Of(p.x, p.y, p.z); 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 end = RcVec3f.Of(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 collider = new DtCapsuleCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb);
var gizmo = RcGizmoFactory.Capsule(start, end, radius); var gizmo = RcGizmoFactory.Capsule(start, end, radius);
return new RcGizmo(collider, gizmo); return new RcGizmo(collider, gizmo);
@ -218,8 +218,8 @@ namespace DotRecast.Recast.Toolset.Tools
a[0] *= len; a[0] *= len;
a[1] *= len; a[1] *= len;
a[2] *= len; a[2] *= len;
RcVec3f start = RcVec3f.Of(p.x, p.y, p.z); 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 end = RcVec3f.Of(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 collider = new DtCylinderCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb);
var gizmo = RcGizmoFactory.Cylinder(start, end, radius); var gizmo = RcGizmoFactory.Cylinder(start, end, radius);
@ -229,7 +229,7 @@ namespace DotRecast.Recast.Toolset.Tools
public RcGizmo CompositeCollider(RcVec3f p, float walkableClimb) public RcGizmo CompositeCollider(RcVec3f p, float walkableClimb)
{ {
RcVec3f baseExtent = RcVec3f.Of(5, 3, 8); RcVec3f baseExtent = RcVec3f.Of(5, 3, 8);
RcVec3f baseCenter = RcVec3f.Of(p.x, p.y + 3, p.z); RcVec3f baseCenter = RcVec3f.Of(p.X, p.Y + 3, p.Z);
RcVec3f baseUp = RcVec3f.Of(0, 1, 0); RcVec3f baseUp = RcVec3f.Of(0, 1, 0);
RcVec3f forward = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble())); RcVec3f forward = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
forward.Normalize(); forward.Normalize();
@ -238,22 +238,22 @@ namespace DotRecast.Recast.Toolset.Tools
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb); SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb);
var roofUp = RcVec3f.Zero; var roofUp = RcVec3f.Zero;
RcVec3f roofExtent = RcVec3f.Of(4.5f, 4.5f, 8f); RcVec3f roofExtent = RcVec3f.Of(4.5f, 4.5f, 8f);
var rx = RcMatrix4x4f.CreateFromRotate(45, forward.x, forward.y, forward.z); var rx = RcMatrix4x4f.CreateFromRotate(45, forward.X, forward.Y, forward.Z);
roofUp = MulMatrixVector(ref roofUp, rx, baseUp); roofUp = MulMatrixVector(ref roofUp, rx, baseUp);
RcVec3f roofCenter = RcVec3f.Of(p.x, p.y + 6, p.z); RcVec3f roofCenter = RcVec3f.Of(p.X, p.Y + 6, p.Z);
DtBoxCollider roof = new DtBoxCollider(roofCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(roofUp, forward, roofExtent), DtBoxCollider roof = new DtBoxCollider(roofCenter, Detour.Dynamic.Colliders.DtBoxCollider.GetHalfEdges(roofUp, forward, roofExtent),
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb); SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb);
RcVec3f trunkStart = RcVec3f.Of( RcVec3f trunkStart = RcVec3f.Of(
baseCenter.x - forward.x * 15 + side.x * 6, baseCenter.X - forward.X * 15 + side.X * 6,
p.y, p.Y,
baseCenter.z - forward.z * 15 + side.z * 6 baseCenter.Z - forward.Z * 15 + side.Z * 6
); );
RcVec3f trunkEnd = RcVec3f.Of(trunkStart.x, trunkStart.y + 10, trunkStart.z); RcVec3f trunkEnd = RcVec3f.Of(trunkStart.X, trunkStart.Y + 10, trunkStart.Z);
DtCapsuleCollider trunk = new DtCapsuleCollider(trunkStart, trunkEnd, 0.5f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, DtCapsuleCollider trunk = new DtCapsuleCollider(trunkStart, trunkEnd, 0.5f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD,
walkableClimb); walkableClimb);
RcVec3f crownCenter = RcVec3f.Of( RcVec3f crownCenter = RcVec3f.Of(
baseCenter.x - forward.x * 15 + side.x * 6, p.y + 10, baseCenter.X - forward.X * 15 + side.X * 6, p.Y + 10,
baseCenter.z - forward.z * 15 + side.z * 6 baseCenter.Z - forward.Z * 15 + side.Z * 6
); );
DtSphereCollider crown = new DtSphereCollider(crownCenter, 4f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GRASS, DtSphereCollider crown = new DtSphereCollider(crownCenter, 4f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GRASS,
walkableClimb); walkableClimb);
@ -305,16 +305,16 @@ namespace DotRecast.Recast.Toolset.Tools
RcVec3f vr = new RcVec3f(); RcVec3f vr = new RcVec3f();
for (int i = 0; i < geom.vertices.Length; i += 3) for (int i = 0; i < geom.vertices.Length; i += 3)
{ {
v.x = geom.vertices[i]; v.X = geom.vertices[i];
v.y = geom.vertices[i + 1]; v.Y = geom.vertices[i + 1];
v.z = geom.vertices[i + 2]; v.Z = geom.vertices[i + 2];
MulMatrixVector(ref vr, m, v); MulMatrixVector(ref vr, m, v);
vr.x += p.x; vr.X += p.X;
vr.y += p.y - 0.1f; vr.Y += p.Y - 0.1f;
vr.z += p.z; vr.Z += p.Z;
verts[i] = vr.x; verts[i] = vr.X;
verts[i + 1] = vr.y; verts[i + 1] = vr.Y;
verts[i + 2] = vr.z; verts[i + 2] = vr.Z;
} }
return verts; return verts;
@ -330,9 +330,9 @@ namespace DotRecast.Recast.Toolset.Tools
private static RcVec3f MulMatrixVector(ref RcVec3f resultvector, RcMatrix4x4f matrix, RcVec3f pvector) private static RcVec3f MulMatrixVector(ref RcVec3f resultvector, RcMatrix4x4f matrix, RcVec3f pvector)
{ {
resultvector.x = matrix.M11 * pvector.x + matrix.M21 * pvector.y + matrix.M31 * pvector.z; resultvector.X = matrix.M11 * pvector.X + matrix.M21 * pvector.Y + matrix.M31 * pvector.Z;
resultvector.y = matrix.M12 * pvector.x + matrix.M22 * pvector.y + matrix.M32 * pvector.z; resultvector.Y = matrix.M12 * pvector.X + matrix.M22 * pvector.Y + matrix.M32 * pvector.Z;
resultvector.z = matrix.M13 * pvector.x + matrix.M23 * pvector.y + matrix.M33 * pvector.z; resultvector.Z = matrix.M13 * pvector.X + matrix.M23 * pvector.Y + matrix.M33 * pvector.Z;
return resultvector; return resultvector;
} }
@ -354,12 +354,12 @@ namespace DotRecast.Recast.Toolset.Tools
public bool Raycast(RcVec3f spos, RcVec3f epos, out float hitPos, out RcVec3f raycastHitPos) 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 sp = RcVec3f.Of(spos.X, spos.Y + 1.3f, spos.Z);
RcVec3f ep = RcVec3f.Of(epos.x, epos.y + 1.3f, epos.z); RcVec3f ep = RcVec3f.Of(epos.X, epos.Y + 1.3f, epos.Z);
bool hasHit = dynaMesh.VoxelQuery().Raycast(sp, ep, out hitPos); bool hasHit = dynaMesh.VoxelQuery().Raycast(sp, ep, out hitPos);
raycastHitPos = hasHit 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)) ? RcVec3f.Of(sp.X + hitPos * (ep.X - sp.X), sp.Y + hitPos * (ep.Y - sp.Y), sp.Z + hitPos * (ep.Z - sp.Z))
: ep; : ep;
return hasHit; return hasHit;

View File

@ -109,7 +109,7 @@ namespace DotRecast.Recast.Toolset.Tools
if (null == _tc) if (null == _tc)
return 0; return 0;
p.y -= 0.5f; p.Y -= 0.5f;
return _tc.AddObstacle(p, 1.0f, 2.0f); return _tc.AddObstacle(p, 1.0f, 2.0f);
} }

View File

@ -97,7 +97,7 @@ namespace DotRecast.Recast.Toolset.Tools
var status = navQuery.GetPolyHeight(polys[0], result, out var h); var status = navQuery.GetPolyHeight(polys[0], result, out var h);
if (status.Succeeded()) if (status.Succeeded())
{ {
iterPos.y = h; iterPos.Y = h;
} }
// Handle end of path and off-mesh links when close enough. // Handle end of path and off-mesh links when close enough.
@ -148,7 +148,7 @@ namespace DotRecast.Recast.Toolset.Tools
// Move position at the other side of the off-mesh link. // Move position at the other side of the off-mesh link.
iterPos = endPos; iterPos = endPos;
navQuery.GetPolyHeight(polys[0], iterPos, out var eh); navQuery.GetPolyHeight(polys[0], iterPos, out var eh);
iterPos.y = eh; iterPos.Y = eh;
} }
} }
@ -183,7 +183,7 @@ namespace DotRecast.Recast.Toolset.Tools
return DtStatus.DT_FAILURE; return DtStatus.DT_FAILURE;
// In case of partial path, make sure the end point is clamped to the last polygon. // 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 = RcVec3f.Of(endPt.X, endPt.Y, endPt.Z);
if (polys[polys.Count - 1] != endRef) if (polys[polys.Count - 1] != endRef)
{ {
var result = navQuery.ClosestPointOnPoly(polys[polys.Count - 1], endPt, out var closest, out var _); var result = navQuery.ClosestPointOnPoly(polys[polys.Count - 1], endPt, out var closest, out var _);
@ -285,7 +285,7 @@ namespace DotRecast.Recast.Toolset.Tools
var result = navQuery.GetPolyHeight(rayHit.path[rayHit.path.Count - 1], hitPos, out var h); var result = navQuery.GetPolyHeight(rayHit.path[rayHit.path.Count - 1], hitPos, out var h);
if (result.Succeeded()) if (result.Succeeded())
{ {
hitPos.y = h; hitPos.Y = h;
} }
} }
@ -326,8 +326,8 @@ namespace DotRecast.Recast.Toolset.Tools
return DtStatus.DT_FAILURE; return DtStatus.DT_FAILURE;
} }
float dx = epos.x - spos.x; float dx = epos.X - spos.X;
float dz = epos.z - spos.z; float dz = epos.Z - spos.Z;
float dist = (float)Math.Sqrt(dx * dx + dz * dz); float dist = (float)Math.Sqrt(dx * dx + dz * dz);
List<long> tempResultRefs = new List<long>(); List<long> tempResultRefs = new List<long>();
@ -372,25 +372,25 @@ namespace DotRecast.Recast.Toolset.Tools
return DtStatus.DT_FAILURE; return DtStatus.DT_FAILURE;
} }
float nx = (epos.z - spos.z) * 0.25f; float nx = (epos.Z - spos.Z) * 0.25f;
float nz = -(epos.x - spos.x) * 0.25f; float nz = -(epos.X - spos.X) * 0.25f;
var tempQueryPoly = new RcVec3f[4]; var tempQueryPoly = new RcVec3f[4];
tempQueryPoly[0].x = spos.x + nx * 1.2f; tempQueryPoly[0].X = spos.X + nx * 1.2f;
tempQueryPoly[0].y = spos.y + agentHeight / 2; tempQueryPoly[0].Y = spos.Y + agentHeight / 2;
tempQueryPoly[0].z = spos.z + nz * 1.2f; tempQueryPoly[0].Z = spos.Z + nz * 1.2f;
tempQueryPoly[1].x = spos.x - nx * 1.3f; tempQueryPoly[1].X = spos.X - nx * 1.3f;
tempQueryPoly[1].y = spos.y + agentHeight / 2; tempQueryPoly[1].Y = spos.Y + agentHeight / 2;
tempQueryPoly[1].z = spos.z - nz * 1.3f; tempQueryPoly[1].Z = spos.Z - nz * 1.3f;
tempQueryPoly[2].x = epos.x - nx * 0.8f; tempQueryPoly[2].X = epos.X - nx * 0.8f;
tempQueryPoly[2].y = epos.y + agentHeight / 2; tempQueryPoly[2].Y = epos.Y + agentHeight / 2;
tempQueryPoly[2].z = epos.z - nz * 0.8f; tempQueryPoly[2].Z = epos.Z - nz * 0.8f;
tempQueryPoly[3].x = epos.x + nx; tempQueryPoly[3].X = epos.X + nx;
tempQueryPoly[3].y = epos.y + agentHeight / 2; tempQueryPoly[3].Y = epos.Y + agentHeight / 2;
tempQueryPoly[3].z = epos.z + nz; tempQueryPoly[3].Z = epos.Z + nz;
var tempResultRefs = new List<long>(); var tempResultRefs = new List<long>();
var tempResultParents = new List<long>(); var tempResultParents = new List<long>();
@ -414,8 +414,8 @@ namespace DotRecast.Recast.Toolset.Tools
return DtStatus.DT_FAILURE; return DtStatus.DT_FAILURE;
} }
float dx = epos.x - spos.x; float dx = epos.X - spos.X;
float dz = epos.z - spos.z; float dz = epos.Z - spos.Z;
float dist = (float)Math.Sqrt(dx * dx + dz * dz); float dist = (float)Math.Sqrt(dx * dx + dz * dz);
IDtPolygonByCircleConstraint constraint = constrainByCircle IDtPolygonByCircleConstraint constraint = constrainByCircle

View File

@ -124,8 +124,8 @@ namespace DotRecast.Recast.Toolset.Tools
RcVec3f bmin = geom.GetMeshBoundsMin(); RcVec3f bmin = geom.GetMeshBoundsMin();
RcVec3f bmax = geom.GetMeshBoundsMax(); RcVec3f bmax = geom.GetMeshBoundsMax();
int tx = (int)((pos.x - bmin[0]) / ts); int tx = (int)((pos.X - bmin[0]) / ts);
int ty = (int)((pos.z - bmin[2]) / ts); int ty = (int)((pos.Z - bmin[2]) / ts);
return BuildTile(geom, settings, navMesh, tx, ty, out tileBuildTicks, out tileTriCount, out tileMemUsage); return BuildTile(geom, settings, navMesh, tx, ty, out tileBuildTicks, out tileTriCount, out tileMemUsage);
} }
@ -139,8 +139,8 @@ namespace DotRecast.Recast.Toolset.Tools
var bmin = geom.GetMeshBoundsMin(); var bmin = geom.GetMeshBoundsMin();
int tx = (int)((pos.x - bmin[0]) / ts); int tx = (int)((pos.X - bmin[0]) / ts);
int ty = (int)((pos.z - bmin[2]) / ts); int ty = (int)((pos.Z - bmin[2]) / ts);
var tileRef = navMesh.GetTileRefAt(tx, ty, 0); var tileRef = navMesh.GetTileRefAt(tx, ty, 0);
navMesh.RemoveTile(tileRef); navMesh.RemoveTile(tileRef);

View File

@ -12,7 +12,7 @@ namespace DotRecast.Recast.Geom
public int Compare(BoundsItem a, BoundsItem b) public int Compare(BoundsItem a, BoundsItem b)
{ {
return a.bmin.x.CompareTo(b.bmin.x); return a.bmin.X.CompareTo(b.bmin.X);
} }
} }
} }

View File

@ -12,7 +12,7 @@ namespace DotRecast.Recast.Geom
public int Compare(BoundsItem a, BoundsItem b) public int Compare(BoundsItem a, BoundsItem b)
{ {
return a.bmin.y.CompareTo(b.bmin.y); return a.bmin.Y.CompareTo(b.bmin.Y);
} }
} }
} }

View File

@ -32,33 +32,33 @@ namespace DotRecast.Recast.Geom
private void CalcExtends(BoundsItem[] items, int imin, int imax, ref RcVec2f bmin, ref RcVec2f bmax) private void CalcExtends(BoundsItem[] items, int imin, int imax, ref RcVec2f bmin, ref RcVec2f bmax)
{ {
bmin.x = items[imin].bmin.x; bmin.X = items[imin].bmin.X;
bmin.y = items[imin].bmin.y; bmin.Y = items[imin].bmin.Y;
bmax.x = items[imin].bmax.x; bmax.X = items[imin].bmax.X;
bmax.y = items[imin].bmax.y; bmax.Y = items[imin].bmax.Y;
for (int i = imin + 1; i < imax; ++i) for (int i = imin + 1; i < imax; ++i)
{ {
BoundsItem it = items[i]; BoundsItem it = items[i];
if (it.bmin.x < bmin.x) if (it.bmin.X < bmin.X)
{ {
bmin.x = it.bmin.x; bmin.X = it.bmin.X;
} }
if (it.bmin.y < bmin.y) if (it.bmin.Y < bmin.Y)
{ {
bmin.y = it.bmin.y; bmin.Y = it.bmin.Y;
} }
if (it.bmax.x > bmax.x) if (it.bmax.X > bmax.X)
{ {
bmax.x = it.bmax.x; bmax.X = it.bmax.X;
} }
if (it.bmax.y > bmax.y) if (it.bmax.Y > bmax.Y)
{ {
bmax.y = it.bmax.y; bmax.Y = it.bmax.Y;
} }
} }
} }
@ -98,7 +98,7 @@ namespace DotRecast.Recast.Geom
// Split // Split
CalcExtends(items, imin, imax, ref node.bmin, ref node.bmax); CalcExtends(items, imin, imax, ref node.bmin, ref node.bmax);
int axis = LongestAxis(node.bmax.x - node.bmin.x, node.bmax.y - node.bmin.y); int axis = LongestAxis(node.bmax.X - node.bmin.X, node.bmax.Y - node.bmin.Y);
if (axis == 0) if (axis == 0)
{ {
@ -139,29 +139,29 @@ namespace DotRecast.Recast.Geom
BoundsItem it = items[i] = new BoundsItem(); BoundsItem it = items[i] = new BoundsItem();
it.i = i; it.i = i;
// Calc triangle XZ bounds. // Calc triangle XZ bounds.
it.bmin.x = it.bmax.x = verts[tris[t] * 3 + 0]; it.bmin.X = it.bmax.X = verts[tris[t] * 3 + 0];
it.bmin.y = it.bmax.y = verts[tris[t] * 3 + 2]; it.bmin.Y = it.bmax.Y = verts[tris[t] * 3 + 2];
for (int j = 1; j < 3; ++j) for (int j = 1; j < 3; ++j)
{ {
int v = tris[t + j] * 3; int v = tris[t + j] * 3;
if (verts[v] < it.bmin.x) if (verts[v] < it.bmin.X)
{ {
it.bmin.x = verts[v]; it.bmin.X = verts[v];
} }
if (verts[v + 2] < it.bmin.y) if (verts[v + 2] < it.bmin.Y)
{ {
it.bmin.y = verts[v + 2]; it.bmin.Y = verts[v + 2];
} }
if (verts[v] > it.bmax.x) if (verts[v] > it.bmax.X)
{ {
it.bmax.x = verts[v]; it.bmax.X = verts[v];
} }
if (verts[v + 2] > it.bmax.y) if (verts[v + 2] > it.bmax.Y)
{ {
it.bmax.y = verts[v + 2]; it.bmax.Y = verts[v + 2];
} }
} }
} }
@ -188,8 +188,8 @@ namespace DotRecast.Recast.Geom
private bool CheckOverlapRect(float[] amin, float[] amax, RcVec2f bmin, RcVec2f bmax) private bool CheckOverlapRect(float[] amin, float[] amax, RcVec2f bmin, RcVec2f bmax)
{ {
bool overlap = true; bool overlap = true;
overlap = (amin[0] > bmax.x || amax[0] < bmin.x) ? false : overlap; overlap = (amin[0] > bmax.X || amax[0] < bmin.X) ? false : overlap;
overlap = (amin[1] > bmax.y || amax[1] < bmin.y) ? false : overlap; overlap = (amin[1] > bmax.Y || amax[1] < bmin.Y) ? false : overlap;
return overlap; return overlap;
} }

View File

@ -36,12 +36,12 @@ namespace DotRecast.Recast.Geom
public RcOffMeshConnection(RcVec3f start, RcVec3f end, float radius, bool bidir, int area, int flags) public RcOffMeshConnection(RcVec3f start, RcVec3f end, float radius, bool bidir, int area, int flags)
{ {
verts = new float[6]; verts = new float[6];
verts[0] = start.x; verts[0] = start.X;
verts[1] = start.y; verts[1] = start.Y;
verts[2] = start.z; verts[2] = start.Z;
verts[3] = end.x; verts[3] = end.X;
verts[4] = end.y; verts[4] = end.Y;
verts[5] = end.z; verts[5] = end.Z;
this.radius = radius; this.radius = radius;
this.bidir = bidir; this.bidir = bidir;
this.area = area; this.area = area;

View File

@ -152,17 +152,17 @@ namespace DotRecast.Recast.Geom
var e0 = new RcVec3f(); var e0 = new RcVec3f();
var e1 = new RcVec3f(); var e1 = new RcVec3f();
e0.x = vertices[v1 + 0] - vertices[v0 + 0]; e0.X = vertices[v1 + 0] - vertices[v0 + 0];
e0.y = vertices[v1 + 1] - vertices[v0 + 1]; e0.Y = vertices[v1 + 1] - vertices[v0 + 1];
e0.z = vertices[v1 + 2] - vertices[v0 + 2]; e0.Z = vertices[v1 + 2] - vertices[v0 + 2];
e1.x = vertices[v2 + 0] - vertices[v0 + 0]; e1.X = vertices[v2 + 0] - vertices[v0 + 0];
e1.y = vertices[v2 + 1] - vertices[v0 + 1]; e1.Y = vertices[v2 + 1] - vertices[v0 + 1];
e1.z = vertices[v2 + 2] - vertices[v0 + 2]; e1.Z = vertices[v2 + 2] - vertices[v0 + 2];
normals[i] = e0.y * e1.z - e0.z * e1.y; normals[i] = e0.Y * e1.Z - e0.Z * e1.Y;
normals[i + 1] = e0.z * e1.x - e0.x * e1.z; normals[i + 1] = e0.Z * e1.X - e0.X * e1.Z;
normals[i + 2] = e0.x * e1.y - e0.y * e1.x; normals[i + 2] = e0.X * e1.Y - e0.Y * e1.X;
float d = (float)Math.Sqrt(normals[i] * normals[i] + normals[i + 1] * normals[i + 1] + normals[i + 2] * normals[i + 2]); float d = (float)Math.Sqrt(normals[i] * normals[i] + normals[i + 1] * normals[i + 1] + normals[i + 2] * normals[i + 2]);
if (d > 0) if (d > 0)
{ {

View File

@ -351,12 +351,12 @@ namespace DotRecast.Recast
int zStride = xSize; // For readability int zStride = xSize; // For readability
// Find the footprint of the box area in grid cell coordinates. // Find the footprint of the box area in grid cell coordinates.
int minX = (int)((boxMinBounds[0] - compactHeightfield.bmin.x) / compactHeightfield.cs); int minX = (int)((boxMinBounds[0] - compactHeightfield.bmin.X) / compactHeightfield.cs);
int minY = (int)((boxMinBounds[1] - compactHeightfield.bmin.y) / compactHeightfield.ch); int minY = (int)((boxMinBounds[1] - compactHeightfield.bmin.Y) / compactHeightfield.ch);
int minZ = (int)((boxMinBounds[2] - compactHeightfield.bmin.z) / compactHeightfield.cs); int minZ = (int)((boxMinBounds[2] - compactHeightfield.bmin.Z) / compactHeightfield.cs);
int maxX = (int)((boxMaxBounds[0] - compactHeightfield.bmin.x) / compactHeightfield.cs); int maxX = (int)((boxMaxBounds[0] - compactHeightfield.bmin.X) / compactHeightfield.cs);
int maxY = (int)((boxMaxBounds[1] - compactHeightfield.bmin.y) / compactHeightfield.ch); int maxY = (int)((boxMaxBounds[1] - compactHeightfield.bmin.Y) / compactHeightfield.ch);
int maxZ = (int)((boxMaxBounds[2] - compactHeightfield.bmin.z) / compactHeightfield.cs); int maxZ = (int)((boxMaxBounds[2] - compactHeightfield.bmin.Z) / compactHeightfield.cs);
if (maxX < 0) if (maxX < 0)
{ {
@ -465,16 +465,16 @@ namespace DotRecast.Recast
bmax.Max(verts, i); bmax.Max(verts, i);
} }
bmin.y = minY; bmin.Y = minY;
bmax.y = maxY; bmax.Y = maxY;
// Compute the grid footprint of the polygon // Compute the grid footprint of the polygon
int minx = (int)((bmin.x - compactHeightfield.bmin.x) / compactHeightfield.cs); int minx = (int)((bmin.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
int miny = (int)((bmin.y - compactHeightfield.bmin.y) / compactHeightfield.ch); int miny = (int)((bmin.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
int minz = (int)((bmin.z - compactHeightfield.bmin.z) / compactHeightfield.cs); int minz = (int)((bmin.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
int maxx = (int)((bmax.x - compactHeightfield.bmin.x) / compactHeightfield.cs); int maxx = (int)((bmax.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
int maxy = (int)((bmax.y - compactHeightfield.bmin.y) / compactHeightfield.ch); int maxy = (int)((bmax.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
int maxz = (int)((bmax.z - compactHeightfield.bmin.z) / compactHeightfield.cs); int maxz = (int)((bmax.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
// Early-out if the polygon lies entirely outside the grid. // Early-out if the polygon lies entirely outside the grid.
if (maxx < 0) if (maxx < 0)
@ -540,9 +540,9 @@ namespace DotRecast.Recast
} }
RcVec3f point = new RcVec3f( RcVec3f point = new RcVec3f(
compactHeightfield.bmin.x + (x + 0.5f) * compactHeightfield.cs, compactHeightfield.bmin.X + (x + 0.5f) * compactHeightfield.cs,
0, 0,
compactHeightfield.bmin.z + (z + 0.5f) * compactHeightfield.cs compactHeightfield.bmin.Z + (z + 0.5f) * compactHeightfield.cs
); );
if (PointInPoly(verts, point)) if (PointInPoly(verts, point))
@ -590,12 +590,12 @@ namespace DotRecast.Recast
); );
// Compute the grid footprint of the cylinder // Compute the grid footprint of the cylinder
int minx = (int)((cylinderBBMin.x - compactHeightfield.bmin.x) / compactHeightfield.cs); int minx = (int)((cylinderBBMin.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
int miny = (int)((cylinderBBMin.y - compactHeightfield.bmin.y) / compactHeightfield.ch); int miny = (int)((cylinderBBMin.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
int minz = (int)((cylinderBBMin.z - compactHeightfield.bmin.z) / compactHeightfield.cs); int minz = (int)((cylinderBBMin.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
int maxx = (int)((cylinderBBMax.x - compactHeightfield.bmin.x) / compactHeightfield.cs); int maxx = (int)((cylinderBBMax.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
int maxy = (int)((cylinderBBMax.y - compactHeightfield.bmin.y) / compactHeightfield.ch); int maxy = (int)((cylinderBBMax.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
int maxz = (int)((cylinderBBMax.z - compactHeightfield.bmin.z) / compactHeightfield.cs); int maxz = (int)((cylinderBBMax.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
// Early-out if the cylinder is completely outside the grid bounds. // Early-out if the cylinder is completely outside the grid bounds.
if (maxx < 0) if (maxx < 0)
@ -710,12 +710,12 @@ namespace DotRecast.Recast
{ {
RcVec3f vi = RcVec3f.Of(verts[i * 3], verts[i * 3 + 1], verts[i * 3 + 2]); 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 vj = RcVec3f.Of(verts[j * 3], verts[j * 3 + 1], verts[j * 3 + 2]);
if (vi.z > point.z == vj.z > point.z) if (vi.Z > point.Z == vj.Z > point.Z)
{ {
continue; continue;
} }
if (point.x >= (vj.x - vi.x) * (point.z - vi.z) / (vj.z - vi.z) + vi.x) if (point.X >= (vj.X - vi.X) * (point.Z - vi.Z) / (vj.Z - vi.Z) + vi.X)
{ {
continue; continue;
} }
@ -759,26 +759,26 @@ namespace DotRecast.Recast
// From A to B on the x/z plane // From A to B on the x/z plane
RcVec3f prevSegmentDir = vertB.Subtract(vertA); RcVec3f prevSegmentDir = vertB.Subtract(vertA);
prevSegmentDir.y = 0; // Squash onto x/z plane prevSegmentDir.Y = 0; // Squash onto x/z plane
prevSegmentDir.SafeNormalize(); prevSegmentDir.SafeNormalize();
// From B to C on the x/z plane // From B to C on the x/z plane
RcVec3f currSegmentDir = vertC.Subtract(vertB); RcVec3f currSegmentDir = vertC.Subtract(vertB);
currSegmentDir.y = 0; // Squash onto x/z plane currSegmentDir.Y = 0; // Squash onto x/z plane
currSegmentDir.SafeNormalize(); currSegmentDir.SafeNormalize();
// The y component of the cross product of the two normalized segment directions. // The y component of the cross product of the two normalized segment directions.
// The X and Z components of the cross product are both zero because the two // The X and Z components of the cross product are both zero because the two
// segment direction vectors fall within the x/z plane. // segment direction vectors fall within the x/z plane.
float cross = currSegmentDir.x * prevSegmentDir.z - prevSegmentDir.x * currSegmentDir.z; float cross = currSegmentDir.X * prevSegmentDir.Z - prevSegmentDir.X * currSegmentDir.Z;
// CCW perpendicular vector to AB. The segment normal. // CCW perpendicular vector to AB. The segment normal.
float prevSegmentNormX = -prevSegmentDir.z; float prevSegmentNormX = -prevSegmentDir.Z;
float prevSegmentNormZ = prevSegmentDir.x; float prevSegmentNormZ = prevSegmentDir.X;
// CCW perpendicular vector to BC. The segment normal. // CCW perpendicular vector to BC. The segment normal.
float currSegmentNormX = -currSegmentDir.z; float currSegmentNormX = -currSegmentDir.Z;
float currSegmentNormZ = currSegmentDir.x; float currSegmentNormZ = currSegmentDir.X;
// Average the two segment normals to get the proportional miter offset for B. // Average the two segment normals to get the proportional miter offset for B.
// This isn't normalized because it's defining the distance and direction the corner will need to be // This isn't normalized because it's defining the distance and direction the corner will need to be
@ -808,16 +808,16 @@ namespace DotRecast.Recast
// Generate two bevel vertices at a distances from B proportional to the angle between the two segments. // Generate two bevel vertices at a distances from B proportional to the angle between the two segments.
// Move each bevel vertex out proportional to the given offset. // Move each bevel vertex out proportional to the given offset.
float d = (1.0f - (prevSegmentDir.x * currSegmentDir.x + prevSegmentDir.z * currSegmentDir.z)) * 0.5f; float d = (1.0f - (prevSegmentDir.X * currSegmentDir.X + prevSegmentDir.Z * currSegmentDir.Z)) * 0.5f;
outVerts[numOutVerts * 3 + 0] = vertB.x + (-prevSegmentNormX + prevSegmentDir.x * d) * offset; outVerts[numOutVerts * 3 + 0] = vertB.X + (-prevSegmentNormX + prevSegmentDir.X * d) * offset;
outVerts[numOutVerts * 3 + 1] = vertB.y; outVerts[numOutVerts * 3 + 1] = vertB.Y;
outVerts[numOutVerts * 3 + 2] = vertB.z + (-prevSegmentNormZ + prevSegmentDir.z * d) * offset; outVerts[numOutVerts * 3 + 2] = vertB.Z + (-prevSegmentNormZ + prevSegmentDir.Z * d) * offset;
numOutVerts++; numOutVerts++;
outVerts[numOutVerts * 3 + 0] = vertB.x + (-currSegmentNormX - currSegmentDir.x * d) * offset; outVerts[numOutVerts * 3 + 0] = vertB.X + (-currSegmentNormX - currSegmentDir.X * d) * offset;
outVerts[numOutVerts * 3 + 1] = vertB.y; outVerts[numOutVerts * 3 + 1] = vertB.Y;
outVerts[numOutVerts * 3 + 2] = vertB.z + (-currSegmentNormZ - currSegmentDir.z * d) * offset; outVerts[numOutVerts * 3 + 2] = vertB.Z + (-currSegmentNormZ - currSegmentDir.Z * d) * offset;
numOutVerts++; numOutVerts++;
} }
else else
@ -828,9 +828,9 @@ namespace DotRecast.Recast
} }
// Move B along the miter direction by the specified offset. // Move B along the miter direction by the specified offset.
outVerts[numOutVerts * 3 + 0] = vertB.x - cornerMiterX * offset; outVerts[numOutVerts * 3 + 0] = vertB.X - cornerMiterX * offset;
outVerts[numOutVerts * 3 + 1] = vertB.y; outVerts[numOutVerts * 3 + 1] = vertB.Y;
outVerts[numOutVerts * 3 + 2] = vertB.z - cornerMiterZ * offset; outVerts[numOutVerts * 3 + 2] = vertB.Z - cornerMiterZ * offset;
numOutVerts++; numOutVerts++;
} }
} }

View File

@ -56,10 +56,10 @@ namespace DotRecast.Recast
{ {
float tsx = cfg.TileSizeX * cfg.Cs; float tsx = cfg.TileSizeX * cfg.Cs;
float tsz = cfg.TileSizeZ * cfg.Cs; float tsz = cfg.TileSizeZ * cfg.Cs;
this.bmin.x += tileX * tsx; this.bmin.X += tileX * tsx;
this.bmin.z += tileZ * tsz; this.bmin.Z += tileZ * tsz;
this.bmax.x = this.bmin.x + tsx; this.bmax.X = this.bmin.X + tsx;
this.bmax.z = this.bmin.z + tsz; this.bmax.Z = this.bmin.Z + tsz;
// Expand the heighfield bounding box by border size to find the extents of geometry we need to build this tile. // Expand the heighfield bounding box by border size to find the extents of geometry we need to build this tile.
// //
@ -83,10 +83,10 @@ namespace DotRecast.Recast
// you will need to pass in data from neighbour terrain tiles too! In a simple case, just pass in all the 8 neighbours, // you will need to pass in data from neighbour terrain tiles too! In a simple case, just pass in all the 8 neighbours,
// or use the bounding box below to only pass in a sliver of each of the 8 neighbours. // or use the bounding box below to only pass in a sliver of each of the 8 neighbours.
this.bmin.x -= cfg.BorderSize * cfg.Cs; this.bmin.X -= cfg.BorderSize * cfg.Cs;
this.bmin.z -= cfg.BorderSize * cfg.Cs; this.bmin.Z -= cfg.BorderSize * cfg.Cs;
this.bmax.x += cfg.BorderSize * cfg.Cs; this.bmax.X += cfg.BorderSize * cfg.Cs;
this.bmax.z += cfg.BorderSize * cfg.Cs; this.bmax.Z += cfg.BorderSize * cfg.Cs;
width = cfg.TileSizeX + cfg.BorderSize * 2; width = cfg.TileSizeX + cfg.BorderSize * 2;
height = cfg.TileSizeZ + cfg.BorderSize * 2; height = cfg.TileSizeZ + cfg.BorderSize * 2;
} }

View File

@ -99,8 +99,8 @@ namespace DotRecast.Recast
public static void CalcGridSize(RcVec3f bmin, RcVec3f bmax, float cs, out int sizeX, out int sizeZ) public static void CalcGridSize(RcVec3f bmin, RcVec3f bmax, float cs, out int sizeX, out int sizeZ)
{ {
sizeX = (int)((bmax.x - bmin.x) / cs + 0.5f); sizeX = (int)((bmax.X - bmin.X) / cs + 0.5f);
sizeZ = (int)((bmax.z - bmin.z) / cs + 0.5f); sizeZ = (int)((bmax.Z - bmin.Z) / cs + 0.5f);
} }
@ -128,7 +128,7 @@ namespace DotRecast.Recast
int tri = i * 3; int tri = i * 3;
CalcTriNormal(verts, tris[tri], tris[tri + 1], tris[tri + 2], ref norm); CalcTriNormal(verts, tris[tri], tris[tri + 1], tris[tri + 2], ref norm);
// Check if the face is walkable. // Check if the face is walkable.
if (norm.y > walkableThr) if (norm.Y > walkableThr)
areas[i] = areaMod.Apply(areas[i]); areas[i] = areaMod.Apply(areas[i]);
} }
@ -165,7 +165,7 @@ namespace DotRecast.Recast
int tri = i * 3; int tri = i * 3;
CalcTriNormal(verts, tris[tri], tris[tri + 1], tris[tri + 2], ref norm); CalcTriNormal(verts, tris[tri], tris[tri + 1], tris[tri + 2], ref norm);
// Check if the face is walkable. // Check if the face is walkable.
if (norm.y <= walkableThr) if (norm.Y <= walkableThr)
areas[i] = RC_NULL_AREA; areas[i] = RC_NULL_AREA;
} }
} }

View File

@ -62,7 +62,7 @@ namespace DotRecast.Recast
chf.maxRegions = 0; chf.maxRegions = 0;
chf.bmin = hf.bmin; chf.bmin = hf.bmin;
chf.bmax = hf.bmax; chf.bmax = hf.bmax;
chf.bmax.y += walkableHeight * hf.ch; chf.bmax.Y += walkableHeight * hf.ch;
chf.cs = hf.cs; chf.cs = hf.cs;
chf.ch = hf.ch; chf.ch = hf.ch;
chf.cells = new RcCompactCell[w * h]; chf.cells = new RcCompactCell[w * h];

View File

@ -736,10 +736,10 @@ namespace DotRecast.Recast
{ {
// If the heightfield was build with bordersize, remove the offset. // If the heightfield was build with bordersize, remove the offset.
float pad = borderSize * chf.cs; float pad = borderSize * chf.cs;
cset.bmin.x += pad; cset.bmin.X += pad;
cset.bmin.z += pad; cset.bmin.Z += pad;
cset.bmax.x -= pad; cset.bmax.X -= pad;
cset.bmax.z -= pad; cset.bmax.Z -= pad;
} }
cset.cs = chf.cs; cset.cs = chf.cs;

View File

@ -36,8 +36,8 @@ namespace DotRecast.Recast
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_SPHERE); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_SPHERE);
float[] bounds = float[] bounds =
{ {
center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius, center.X - radius, center.Y - radius, center.Z - radius, center.X + radius, center.Y + radius,
center.z + radius center.Z + radius
}; };
RasterizationFilledShape(hf, bounds, area, flagMergeThr, RasterizationFilledShape(hf, bounds, area, flagMergeThr,
rectangle => IntersectSphere(rectangle, center, radius * radius)); rectangle => IntersectSphere(rectangle, center, radius * radius));
@ -48,11 +48,11 @@ namespace DotRecast.Recast
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CAPSULE); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CAPSULE);
float[] bounds = float[] bounds =
{ {
Math.Min(start.x, end.x) - radius, Math.Min(start.y, end.y) - radius, Math.Min(start.X, end.X) - radius, Math.Min(start.Y, end.Y) - radius,
Math.Min(start.z, end.z) - radius, Math.Max(start.x, end.x) + radius, Math.Max(start.y, end.y) + radius, 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 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 = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
RasterizationFilledShape(hf, bounds, area, flagMergeThr, RasterizationFilledShape(hf, bounds, area, flagMergeThr,
rectangle => IntersectCapsule(rectangle, start, end, axis, radius * radius)); rectangle => IntersectCapsule(rectangle, start, end, axis, radius * radius));
} }
@ -62,11 +62,11 @@ namespace DotRecast.Recast
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CYLINDER); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CYLINDER);
float[] bounds = float[] bounds =
{ {
Math.Min(start.x, end.x) - radius, Math.Min(start.y, end.y) - radius, Math.Min(start.X, end.X) - radius, Math.Min(start.Y, end.Y) - radius,
Math.Min(start.z, end.z) - radius, Math.Max(start.x, end.x) + radius, Math.Max(start.y, end.y) + radius, 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 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 = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
RasterizationFilledShape(hf, bounds, area, flagMergeThr, RasterizationFilledShape(hf, bounds, area, flagMergeThr,
rectangle => IntersectCylinder(rectangle, start, end, axis, radius * radius)); 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); using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_BOX);
RcVec3f[] normals = RcVec3f[] normals =
{ {
RcVec3f.Of(halfEdges[0].x, halfEdges[0].y, halfEdges[0].z), 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[1].X, halfEdges[1].Y, halfEdges[1].Z),
RcVec3f.Of(halfEdges[2].x, halfEdges[2].y, halfEdges[2].z), RcVec3f.Of(halfEdges[2].X, halfEdges[2].Y, halfEdges[2].Z),
}; };
RcVec3f.Normalize(ref normals[0]); RcVec3f.Normalize(ref normals[0]);
RcVec3f.Normalize(ref normals[1]); RcVec3f.Normalize(ref normals[1]);
@ -95,9 +95,9 @@ namespace DotRecast.Recast
float s0 = (i & 1) != 0 ? 1f : -1f; float s0 = (i & 1) != 0 ? 1f : -1f;
float s1 = (i & 2) != 0 ? 1f : -1f; float s1 = (i & 2) != 0 ? 1f : -1f;
float s2 = (i & 4) != 0 ? 1f : -1f; float s2 = (i & 4) != 0 ? 1f : -1f;
vertices[i * 3 + 0] = center.x + s0 * halfEdges[0].x + s1 * halfEdges[1].x + s2 * halfEdges[2].x; vertices[i * 3 + 0] = center.X + s0 * halfEdges[0].X + s1 * halfEdges[1].X + s2 * halfEdges[2].X;
vertices[i * 3 + 1] = center.y + s0 * halfEdges[0].y + s1 * halfEdges[1].y + s2 * halfEdges[2].y; vertices[i * 3 + 1] = center.Y + s0 * halfEdges[0].Y + s1 * halfEdges[1].Y + s2 * halfEdges[2].Y;
vertices[i * 3 + 2] = center.z + s0 * halfEdges[0].z + s1 * halfEdges[1].z + s2 * halfEdges[2].z; vertices[i * 3 + 2] = center.Z + s0 * halfEdges[0].Z + s1 * halfEdges[1].Z + s2 * halfEdges[2].Z;
bounds[0] = Math.Min(bounds[0], vertices[i * 3 + 0]); bounds[0] = Math.Min(bounds[0], vertices[i * 3 + 0]);
bounds[1] = Math.Min(bounds[1], vertices[i * 3 + 1]); bounds[1] = Math.Min(bounds[1], vertices[i * 3 + 1]);
bounds[2] = Math.Min(bounds[2], vertices[i * 3 + 2]); bounds[2] = Math.Min(bounds[2], vertices[i * 3 + 2]);
@ -111,9 +111,9 @@ namespace DotRecast.Recast
{ {
float m = i < 3 ? -1 : 1; float m = i < 3 ? -1 : 1;
int vi = i < 3 ? 0 : 7; int vi = i < 3 ? 0 : 7;
planes[i][0] = m * normals[i % 3].x; planes[i][0] = m * normals[i % 3].X;
planes[i][1] = m * normals[i % 3].y; planes[i][1] = m * normals[i % 3].Y;
planes[i][2] = m * normals[i % 3].z; planes[i][2] = m * normals[i % 3].Z;
planes[i][3] = vertices[vi * 3] * planes[i][0] + vertices[vi * 3 + 1] * planes[i][1] planes[i][3] = vertices[vi * 3] * planes[i][0] + vertices[vi * 3 + 1] * planes[i][1]
+ vertices[vi * 3 + 2] * planes[i][2]; + vertices[vi * 3 + 2] * planes[i][2];
} }
@ -189,10 +189,10 @@ namespace DotRecast.Recast
return; return;
} }
bounds[3] = Math.Min(bounds[3], hf.bmax.x); bounds[3] = Math.Min(bounds[3], hf.bmax.X);
bounds[5] = Math.Min(bounds[5], hf.bmax.z); bounds[5] = Math.Min(bounds[5], hf.bmax.Z);
bounds[0] = Math.Max(bounds[0], hf.bmin.x); bounds[0] = Math.Max(bounds[0], hf.bmin.X);
bounds[2] = Math.Max(bounds[2], hf.bmin.z); bounds[2] = Math.Max(bounds[2], hf.bmin.Z);
if (bounds[3] <= bounds[0] || bounds[4] <= bounds[1] || bounds[5] <= bounds[2]) if (bounds[3] <= bounds[0] || bounds[4] <= bounds[1] || bounds[5] <= bounds[2])
{ {
@ -201,25 +201,25 @@ namespace DotRecast.Recast
float ics = 1.0f / hf.cs; float ics = 1.0f / hf.cs;
float ich = 1.0f / hf.ch; float ich = 1.0f / hf.ch;
int xMin = (int)((bounds[0] - hf.bmin.x) * ics); int xMin = (int)((bounds[0] - hf.bmin.X) * ics);
int zMin = (int)((bounds[2] - hf.bmin.z) * ics); int zMin = (int)((bounds[2] - hf.bmin.Z) * ics);
int xMax = Math.Min(hf.width - 1, (int)((bounds[3] - hf.bmin.x) * ics)); int xMax = Math.Min(hf.width - 1, (int)((bounds[3] - hf.bmin.X) * ics));
int zMax = Math.Min(hf.height - 1, (int)((bounds[5] - hf.bmin.z) * ics)); int zMax = Math.Min(hf.height - 1, (int)((bounds[5] - hf.bmin.Z) * ics));
float[] rectangle = new float[5]; float[] rectangle = new float[5];
rectangle[4] = hf.bmin.y; rectangle[4] = hf.bmin.Y;
for (int x = xMin; x <= xMax; x++) for (int x = xMin; x <= xMax; x++)
{ {
for (int z = zMin; z <= zMax; z++) for (int z = zMin; z <= zMax; z++)
{ {
rectangle[0] = x * hf.cs + hf.bmin.x; rectangle[0] = x * hf.cs + hf.bmin.X;
rectangle[1] = z * hf.cs + hf.bmin.z; rectangle[1] = z * hf.cs + hf.bmin.Z;
rectangle[2] = rectangle[0] + hf.cs; rectangle[2] = rectangle[0] + hf.cs;
rectangle[3] = rectangle[1] + hf.cs; rectangle[3] = rectangle[1] + hf.cs;
float[] h = intersection.Invoke(rectangle); float[] h = intersection.Invoke(rectangle);
if (h != null) if (h != null)
{ {
int smin = (int)Math.Floor((h[0] - hf.bmin.y) * ich); int smin = (int)Math.Floor((h[0] - hf.bmin.Y) * ich);
int smax = (int)Math.Ceiling((h[1] - hf.bmin.y) * ich); int smax = (int)Math.Ceiling((h[1] - hf.bmin.Y) * ich);
if (smin != smax) if (smin != smax)
{ {
int ismin = Math.Clamp(smin, 0, SPAN_MAX_HEIGHT); int ismin = Math.Clamp(smin, 0, SPAN_MAX_HEIGHT);
@ -233,13 +233,13 @@ namespace DotRecast.Recast
private static float[] IntersectSphere(float[] rectangle, RcVec3f center, float radiusSqr) private static float[] IntersectSphere(float[] rectangle, RcVec3f center, float radiusSqr)
{ {
float x = Math.Max(rectangle[0], Math.Min(center.x, rectangle[2])); float x = Math.Max(rectangle[0], Math.Min(center.X, rectangle[2]));
float y = rectangle[4]; float y = rectangle[4];
float z = Math.Max(rectangle[1], Math.Min(center.z, rectangle[3])); float z = Math.Max(rectangle[1], Math.Min(center.Z, rectangle[3]));
float mx = x - center.x; float mx = x - center.X;
float my = y - center.y; float my = y - center.Y;
float mz = z - center.z; float mz = z - center.Z;
float b = my; // Dot(m, d) d = (0, 1, 0) float b = my; // Dot(m, d) d = (0, 1, 0)
float c = LenSqr(mx, my, mz) - radiusSqr; float c = LenSqr(mx, my, mz) - radiusSqr;
@ -269,7 +269,7 @@ namespace DotRecast.Recast
private static float[] IntersectCapsule(float[] rectangle, RcVec3f start, RcVec3f end, RcVec3f axis, float radiusSqr) private static float[] IntersectCapsule(float[] rectangle, RcVec3f start, RcVec3f end, RcVec3f axis, float radiusSqr)
{ {
float[] s = MergeIntersections(IntersectSphere(rectangle, start, radiusSqr), IntersectSphere(rectangle, end, radiusSqr)); float[] s = MergeIntersections(IntersectSphere(rectangle, start, radiusSqr), IntersectSphere(rectangle, end, radiusSqr));
float axisLen2dSqr = axis.x * axis.x + axis.z * axis.z; float axisLen2dSqr = axis.X * axis.X + axis.Z * axis.Z;
if (axisLen2dSqr > EPSILON) if (axisLen2dSqr > EPSILON)
{ {
s = SlabsCylinderIntersection(rectangle, start, end, axis, radiusSqr, s); s = SlabsCylinderIntersection(rectangle, start, end, axis, radiusSqr, s);
@ -282,20 +282,20 @@ namespace DotRecast.Recast
{ {
float[] s = MergeIntersections( float[] s = MergeIntersections(
RayCylinderIntersection(RcVec3f.Of( RayCylinderIntersection(RcVec3f.Of(
Math.Clamp(start.x, rectangle[0], rectangle[2]), rectangle[4], Math.Clamp(start.X, rectangle[0], rectangle[2]), rectangle[4],
Math.Clamp(start.z, rectangle[1], rectangle[3]) Math.Clamp(start.Z, rectangle[1], rectangle[3])
), start, axis, radiusSqr), ), start, axis, radiusSqr),
RayCylinderIntersection(RcVec3f.Of( RayCylinderIntersection(RcVec3f.Of(
Math.Clamp(end.x, rectangle[0], rectangle[2]), rectangle[4], Math.Clamp(end.X, rectangle[0], rectangle[2]), rectangle[4],
Math.Clamp(end.z, rectangle[1], rectangle[3]) Math.Clamp(end.Z, rectangle[1], rectangle[3])
), start, axis, radiusSqr)); ), start, axis, radiusSqr));
float axisLen2dSqr = axis.x * axis.x + axis.z * axis.z; float axisLen2dSqr = axis.X * axis.X + axis.Z * axis.Z;
if (axisLen2dSqr > EPSILON) if (axisLen2dSqr > EPSILON)
{ {
s = SlabsCylinderIntersection(rectangle, start, end, axis, radiusSqr, s); s = SlabsCylinderIntersection(rectangle, start, end, axis, radiusSqr, s);
} }
if (axis.y * axis.y > EPSILON) if (axis.Y * axis.Y > EPSILON)
{ {
RcVec3f[] rectangleOnStartPlane = new RcVec3f[4]; RcVec3f[] rectangleOnStartPlane = new RcVec3f[4];
RcVec3f[] rectangleOnEndPlane = new RcVec3f[4]; RcVec3f[] rectangleOnEndPlane = new RcVec3f[4];
@ -307,14 +307,14 @@ namespace DotRecast.Recast
float z = rectangle[(i & 2) + 1]; float z = rectangle[(i & 2) + 1];
RcVec3f a = RcVec3f.Of(x, rectangle[4], z); RcVec3f a = RcVec3f.Of(x, rectangle[4], z);
float dotAxisA = RcVec3f.Dot(axis, a); float dotAxisA = RcVec3f.Dot(axis, a);
float t = (ds - dotAxisA) / axis.y; float t = (ds - dotAxisA) / axis.Y;
rectangleOnStartPlane[i].x = x; rectangleOnStartPlane[i].X = x;
rectangleOnStartPlane[i].y = rectangle[4] + t; rectangleOnStartPlane[i].Y = rectangle[4] + t;
rectangleOnStartPlane[i].z = z; rectangleOnStartPlane[i].Z = z;
t = (de - dotAxisA) / axis.y; t = (de - dotAxisA) / axis.Y;
rectangleOnEndPlane[i].x = x; rectangleOnEndPlane[i].X = x;
rectangleOnEndPlane[i].y = rectangle[4] + t; rectangleOnEndPlane[i].Y = rectangle[4] + t;
rectangleOnEndPlane[i].z = z; rectangleOnEndPlane[i].Z = z;
} }
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -332,14 +332,14 @@ namespace DotRecast.Recast
int j = (i + 1) % 4; int j = (i + 1) % 4;
// Ray against sphere intersection // Ray against sphere intersection
var m = RcVec3f.Of( var m = RcVec3f.Of(
rectangleOnPlane[i].x - start.x, rectangleOnPlane[i].X - start.X,
rectangleOnPlane[i].y - start.y, rectangleOnPlane[i].Y - start.Y,
rectangleOnPlane[i].z - start.z rectangleOnPlane[i].Z - start.Z
); );
var d = RcVec3f.Of( var d = RcVec3f.Of(
rectangleOnPlane[j].x - rectangleOnPlane[i].x, rectangleOnPlane[j].X - rectangleOnPlane[i].X,
rectangleOnPlane[j].y - rectangleOnPlane[i].y, rectangleOnPlane[j].Y - rectangleOnPlane[i].Y,
rectangleOnPlane[j].z - rectangleOnPlane[i].z rectangleOnPlane[j].Z - rectangleOnPlane[i].Z
); );
float dl = RcVec3f.Dot(d, d); float dl = RcVec3f.Dot(d, d);
float b = RcVec3f.Dot(m, d) / dl; float b = RcVec3f.Dot(m, d) / dl;
@ -354,8 +354,8 @@ namespace DotRecast.Recast
{ {
t1 = Math.Max(0, t1); t1 = Math.Max(0, t1);
t2 = Math.Min(1, t2); t2 = Math.Min(1, t2);
float y1 = rectangleOnPlane[i].y + t1 * d.y; float y1 = rectangleOnPlane[i].Y + t1 * d.Y;
float y2 = rectangleOnPlane[i].y + t2 * d.y; float y2 = rectangleOnPlane[i].Y + t2 * d.Y;
float[] y = { Math.Min(y1, y2), Math.Max(y1, y2) }; float[] y = { Math.Min(y1, y2), Math.Max(y1, y2) };
s = MergeIntersections(s, y); s = MergeIntersections(s, y);
} }
@ -366,22 +366,22 @@ namespace DotRecast.Recast
private static float[] SlabsCylinderIntersection(float[] rectangle, RcVec3f start, RcVec3f end, RcVec3f axis, float radiusSqr, float[] s) private static float[] SlabsCylinderIntersection(float[] rectangle, RcVec3f start, RcVec3f end, RcVec3f axis, float radiusSqr, float[] s)
{ {
if (Math.Min(start.x, end.x) < rectangle[0]) if (Math.Min(start.X, end.X) < rectangle[0])
{ {
s = MergeIntersections(s, XSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[0])); s = MergeIntersections(s, XSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[0]));
} }
if (Math.Max(start.x, end.x) > rectangle[2]) if (Math.Max(start.X, end.X) > rectangle[2])
{ {
s = MergeIntersections(s, XSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[2])); s = MergeIntersections(s, XSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[2]));
} }
if (Math.Min(start.z, end.z) < rectangle[1]) if (Math.Min(start.Z, end.Z) < rectangle[1])
{ {
s = MergeIntersections(s, ZSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[1])); s = MergeIntersections(s, ZSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[1]));
} }
if (Math.Max(start.z, end.z) > rectangle[3]) if (Math.Max(start.Z, end.Z) > rectangle[3])
{ {
s = MergeIntersections(s, ZSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[3])); s = MergeIntersections(s, ZSlabCylinderIntersection(rectangle, start, axis, radiusSqr, rectangle[3]));
} }
@ -397,8 +397,8 @@ namespace DotRecast.Recast
private static RcVec3f XSlabRayIntersection(float[] rectangle, RcVec3f start, RcVec3f direction, float x) private static RcVec3f XSlabRayIntersection(float[] rectangle, RcVec3f start, RcVec3f direction, float x)
{ {
// 2d intersection of plane and segment // 2d intersection of plane and segment
float t = (x - start.x) / direction.x; float t = (x - start.X) / direction.X;
float z = Math.Clamp(start.z + t * direction.z, rectangle[1], rectangle[3]); float z = Math.Clamp(start.Z + t * direction.Z, rectangle[1], rectangle[3]);
return RcVec3f.Of(x, rectangle[4], z); return RcVec3f.Of(x, rectangle[4], z);
} }
@ -410,8 +410,8 @@ namespace DotRecast.Recast
private static RcVec3f ZSlabRayIntersection(float[] rectangle, RcVec3f start, RcVec3f direction, float z) private static RcVec3f ZSlabRayIntersection(float[] rectangle, RcVec3f start, RcVec3f direction, float z)
{ {
// 2d intersection of plane and segment // 2d intersection of plane and segment
float t = (z - start.z) / direction.z; float t = (z - start.Z) / direction.Z;
float x = Math.Clamp(start.x + t * direction.x, rectangle[0], rectangle[2]); float x = Math.Clamp(start.X + t * direction.X, rectangle[0], rectangle[2]);
return RcVec3f.Of(x, rectangle[4], z); return RcVec3f.Of(x, rectangle[4], z);
} }
@ -419,17 +419,17 @@ namespace DotRecast.Recast
private static float[] RayCylinderIntersection(RcVec3f point, RcVec3f start, RcVec3f axis, float radiusSqr) private static float[] RayCylinderIntersection(RcVec3f point, RcVec3f start, RcVec3f axis, float radiusSqr)
{ {
RcVec3f d = axis; RcVec3f d = axis;
RcVec3f m = RcVec3f.Of(point.x - start.x, point.y - start.y, point.z - start.z); RcVec3f m = RcVec3f.Of(point.X - start.X, point.Y - start.Y, point.Z - start.Z);
// float[] n = { 0, 1, 0 }; // float[] n = { 0, 1, 0 };
float md = RcVec3f.Dot(m, d); float md = RcVec3f.Dot(m, d);
// float nd = Dot(n, d); // float nd = Dot(n, d);
float nd = axis.y; float nd = axis.Y;
float dd = RcVec3f.Dot(d, d); float dd = RcVec3f.Dot(d, d);
// float nn = Dot(n, n); // float nn = Dot(n, n);
float nn = 1; float nn = 1;
// float mn = Dot(m, n); // float mn = Dot(m, n);
float mn = m.y; float mn = m.Y;
// float a = dd * nn - nd * nd; // float a = dd * nn - nd * nd;
float a = dd - nd * nd; float a = dd - nd * nd;
float k = RcVec3f.Dot(m, m) - radiusSqr; float k = RcVec3f.Dot(m, m) - radiusSqr;
@ -445,7 +445,7 @@ namespace DotRecast.Recast
// Now known that segment intersects cylinder; figure out how it intersects // Now known that segment intersects cylinder; figure out how it intersects
float tt1 = -mn / nn; // Intersect segment against p endcap float tt1 = -mn / nn; // Intersect segment against p endcap
float tt2 = (nd - mn) / nn; // Intersect segment against q endcap float tt2 = (nd - mn) / nn; // Intersect segment against q endcap
return new float[] { point.y + Math.Min(tt1, tt2), point.y + Math.Max(tt1, tt2) }; return new float[] { point.Y + Math.Min(tt1, tt2), point.Y + Math.Max(tt1, tt2) };
} }
float b = dd * mn - nd * md; float b = dd * mn - nd * md;
@ -497,7 +497,7 @@ namespace DotRecast.Recast
} }
} }
return new float[] { point.y + Math.Min(t1, t2), point.y + Math.Max(t1, t2) }; return new float[] { point.Y + Math.Min(t1, t2), point.Y + Math.Max(t1, t2) };
} }
private static float[] IntersectBox(float[] rectangle, float[] vertices, float[][] planes) private static float[] IntersectBox(float[] rectangle, float[] vertices, float[][] planes)
@ -520,21 +520,21 @@ namespace DotRecast.Recast
var point = RcVec3f.Of(0, rectangle[1], 0); var point = RcVec3f.Of(0, rectangle[1], 0);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
point.x = ((i & 1) == 0) ? rectangle[0] : rectangle[2]; point.X = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
point.z = ((i & 2) == 0) ? rectangle[1] : rectangle[3]; point.Z = ((i & 2) == 0) ? rectangle[1] : rectangle[3];
for (int j = 0; j < 6; j++) for (int j = 0; j < 6; j++)
{ {
if (Math.Abs(planes[j][1]) > EPSILON) if (Math.Abs(planes[j][1]) > EPSILON)
{ {
float dotNormalPoint = RcVec3f.Dot(planes[j], point); float dotNormalPoint = RcVec3f.Dot(planes[j], point);
float t = (planes[j][3] - dotNormalPoint) / planes[j][1]; float t = (planes[j][3] - dotNormalPoint) / planes[j][1];
float y = point.y + t; float y = point.Y + t;
bool valid = true; bool valid = true;
for (int k = 0; k < 6; k++) for (int k = 0; k < 6; k++)
{ {
if (k != j) if (k != j)
{ {
if (point.x * planes[k][0] + y * planes[k][1] + point.z * planes[k][2] > planes[k][3]) if (point.X * planes[k][0] + y * planes[k][1] + point.Z * planes[k][2] > planes[k][3])
{ {
valid = false; valid = false;
break; break;
@ -673,8 +673,8 @@ namespace DotRecast.Recast
var point = RcVec3f.Of(0, rectangle[1], 0); var point = RcVec3f.Of(0, rectangle[1], 0);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
point.x = ((i & 1) == 0) ? rectangle[0] : rectangle[2]; point.X = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
point.z = ((i & 2) == 0) ? rectangle[1] : rectangle[3]; point.Z = ((i & 2) == 0) ? rectangle[1] : rectangle[3];
if (RayTriangleIntersection(point, tri, planes, out var y)) if (RayTriangleIntersection(point, tri, planes, out var y))
{ {
imin = Math.Min(imin, y); imin = Math.Min(imin, y);
@ -731,7 +731,7 @@ namespace DotRecast.Recast
{ {
y = 0.0f; y = 0.0f;
float t = (planes[plane][3] - RcVec3f.Dot(planes[plane], point)) / planes[plane][1]; float t = (planes[plane][3] - RcVec3f.Dot(planes[plane], point)) / planes[plane][1];
float[] s = { point.x, point.y + t, point.z }; float[] s = { point.X, point.Y + t, point.Z };
float u = RcVec3f.Dot(s, planes[plane + 1]) - planes[plane + 1][3]; float u = RcVec3f.Dot(s, planes[plane + 1]) - planes[plane + 1][3];
if (u < 0.0f || u > 1.0f) if (u < 0.0f || u > 1.0f)
{ {
@ -777,9 +777,9 @@ namespace DotRecast.Recast
private static bool OverlapBounds(RcVec3f amin, RcVec3f amax, float[] bounds) private static bool OverlapBounds(RcVec3f amin, RcVec3f amax, float[] bounds)
{ {
bool overlap = true; bool overlap = true;
overlap = (amin.x > bounds[3] || amax.x < bounds[0]) ? false : overlap; overlap = (amin.X > bounds[3] || amax.X < bounds[0]) ? false : overlap;
overlap = (amin.y > bounds[4]) ? false : overlap; overlap = (amin.Y > bounds[4]) ? false : overlap;
overlap = (amin.z > bounds[5] || amax.z < bounds[2]) ? false : overlap; overlap = (amin.Z > bounds[5] || amax.Z < bounds[2]) ? false : overlap;
return overlap; return overlap;
} }
} }

View File

@ -411,10 +411,10 @@ namespace DotRecast.Recast
// Build contracted bbox for layers. // Build contracted bbox for layers.
RcVec3f bmin = chf.bmin; RcVec3f bmin = chf.bmin;
RcVec3f bmax = chf.bmax; RcVec3f bmax = chf.bmax;
bmin.x += borderSize * chf.cs; bmin.X += borderSize * chf.cs;
bmin.z += borderSize * chf.cs; bmin.Z += borderSize * chf.cs;
bmax.x -= borderSize * chf.cs; bmax.X -= borderSize * chf.cs;
bmax.z -= borderSize * chf.cs; bmax.Z -= borderSize * chf.cs;
RcHeightfieldLayerSet lset = new RcHeightfieldLayerSet(); RcHeightfieldLayerSet lset = new RcHeightfieldLayerSet();
lset.layers = new RcHeightfieldLayer[layerId]; lset.layers = new RcHeightfieldLayer[layerId];
@ -456,8 +456,8 @@ namespace DotRecast.Recast
// Adjust the bbox to fit the heightfield. // Adjust the bbox to fit the heightfield.
layer.bmin = bmin; layer.bmin = bmin;
layer.bmax = bmax; layer.bmax = bmax;
layer.bmin.y = bmin.y + hmin * chf.ch; layer.bmin.Y = bmin.Y + hmin * chf.ch;
layer.bmax.y = bmin.y + hmax * chf.ch; layer.bmax.Y = bmin.Y + hmax * chf.ch;
layer.hmin = hmin; layer.hmin = hmin;
layer.hmax = hmax; layer.hmax = hmax;

View File

@ -47,7 +47,7 @@ namespace DotRecast.Recast
private static float Vdot2(RcVec3f a, RcVec3f b) private static float Vdot2(RcVec3f a, RcVec3f b)
{ {
return a.x * b.x + a.z * b.z; return a.X * b.X + a.Z * b.Z;
} }
@ -72,16 +72,16 @@ namespace DotRecast.Recast
private static float VdistSq2(float[] p, RcVec3f q) private static float VdistSq2(float[] p, RcVec3f q)
{ {
float dx = q.x - p[0]; float dx = q.X - p[0];
float dy = q.z - p[2]; float dy = q.Z - p[2];
return dx * dx + dy * dy; return dx * dx + dy * dy;
} }
private static float VdistSq2(RcVec3f p, RcVec3f q) private static float VdistSq2(RcVec3f p, RcVec3f q)
{ {
float dx = q.x - p.x; float dx = q.X - p.X;
float dy = q.z - p.z; float dy = q.Z - p.Z;
return dx * dx + dy * dy; return dx * dx + dy * dy;
} }
@ -111,8 +111,8 @@ namespace DotRecast.Recast
private static float VdistSq2(RcVec3f p, float[] verts, int q) private static float VdistSq2(RcVec3f p, float[] verts, int q)
{ {
float dx = verts[q + 0] - p.x; float dx = verts[q + 0] - p.X;
float dy = verts[q + 2] - p.z; float dy = verts[q + 2] - p.Z;
return dx * dx + dy * dy; return dx * dx + dy * dy;
} }
@ -148,10 +148,10 @@ namespace DotRecast.Recast
private static float Vcross2(RcVec3f p1, RcVec3f p2, RcVec3f p3) private static float Vcross2(RcVec3f p1, RcVec3f p2, RcVec3f p3)
{ {
float u1 = p2.x - p1.x; float u1 = p2.X - p1.X;
float v1 = p2.z - p1.z; float v1 = p2.Z - p1.Z;
float u2 = p3.x - p1.x; float u2 = p3.X - p1.X;
float v2 = p3.z - p1.z; float v2 = p3.Z - p1.Z;
return u1 * v2 - v1 * u2; return u1 * v2 - v1 * u2;
} }
@ -172,9 +172,9 @@ namespace DotRecast.Recast
float v1Sq = Vdot2(v1, v1); float v1Sq = Vdot2(v1, v1);
float v2Sq = Vdot2(v2, v2); float v2Sq = Vdot2(v2, v2);
float v3Sq = Vdot2(v3, v3); float v3Sq = Vdot2(v3, v3);
c.x = (v1Sq * (v2.z - v3.z) + v2Sq * (v3.z - v1.z) + v3Sq * (v1.z - v2.z)) / (2 * cp); c.X = (v1Sq * (v2.Z - v3.Z) + v2Sq * (v3.Z - v1.Z) + v3Sq * (v1.Z - v2.Z)) / (2 * cp);
c.y = 0; c.Y = 0;
c.z = (v1Sq * (v3.x - v2.x) + v2Sq * (v1.x - v3.x) + v3Sq * (v2.x - v1.x)) / (2 * cp); c.Z = (v1Sq * (v3.X - v2.X) + v2Sq * (v1.X - v3.X) + v3Sq * (v2.X - v1.X)) / (2 * cp);
r.Exchange(Vdist2(c, v1)); r.Exchange(Vdist2(c, v1));
RcVec3f.Add(ref c, c, verts, p1); RcVec3f.Add(ref c, c, verts, p1);
return true; return true;
@ -209,8 +209,8 @@ namespace DotRecast.Recast
const float EPS = 1e-4f; const float EPS = 1e-4f;
if (u >= -EPS && v >= -EPS && (u + v) <= 1 + EPS) if (u >= -EPS && v >= -EPS && (u + v) <= 1 + EPS)
{ {
float y = verts[a + 1] + v0.y * u + v1.y * v; float y = verts[a + 1] + v0.Y * u + v1.Y * v;
return Math.Abs(y - p.y); return Math.Abs(y - p.Y);
} }
return float.MaxValue; return float.MaxValue;
@ -251,8 +251,8 @@ namespace DotRecast.Recast
{ {
float pqx = poly[q + 0] - poly[p + 0]; float pqx = poly[q + 0] - poly[p + 0];
float pqz = poly[q + 2] - poly[p + 2]; float pqz = poly[q + 2] - poly[p + 2];
float dx = verts.x - poly[p + 0]; float dx = verts.X - poly[p + 0];
float dz = verts.z - poly[p + 2]; float dz = verts.Z - poly[p + 2];
float d = pqx * pqx + pqz * pqz; float d = pqx * pqx + pqz * pqz;
float t = pqx * dx + pqz * dz; float t = pqx * dx + pqz * dz;
if (d > 0) if (d > 0)
@ -269,8 +269,8 @@ namespace DotRecast.Recast
t = 1; t = 1;
} }
dx = poly[p + 0] + t * pqx - verts.x; dx = poly[p + 0] + t * pqx - verts.X;
dz = poly[p + 2] + t * pqz - verts.z; dz = poly[p + 2] + t * pqz - verts.Z;
return dx * dx + dz * dz; return dx * dx + dz * dz;
} }
@ -335,8 +335,8 @@ namespace DotRecast.Recast
{ {
int vi = i * 3; int vi = i * 3;
int vj = j * 3; int vj = j * 3;
if (((verts[vi + 2] > p.z) != (verts[vj + 2] > p.z)) && (p.x < (verts[vj + 0] - verts[vi + 0]) if (((verts[vi + 2] > p.Z) != (verts[vj + 2] > p.Z)) && (p.X < (verts[vj + 0] - verts[vi + 0])
* (p.z - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0])) * (p.Z - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0]))
{ {
c = !c; c = !c;
} }
@ -1015,19 +1015,19 @@ namespace DotRecast.Recast
bmax.Max(@in, i * 3); bmax.Max(@in, i * 3);
} }
int x0 = (int)Math.Floor(bmin.x / sampleDist); int x0 = (int)Math.Floor(bmin.X / sampleDist);
int x1 = (int)Math.Ceiling(bmax.x / sampleDist); int x1 = (int)Math.Ceiling(bmax.X / sampleDist);
int z0 = (int)Math.Floor(bmin.z / sampleDist); int z0 = (int)Math.Floor(bmin.Z / sampleDist);
int z1 = (int)Math.Ceiling(bmax.z / sampleDist); int z1 = (int)Math.Ceiling(bmax.Z / sampleDist);
samples.Clear(); samples.Clear();
for (int z = z0; z < z1; ++z) for (int z = z0; z < z1; ++z)
{ {
for (int x = x0; x < x1; ++x) for (int x = x0; x < x1; ++x)
{ {
RcVec3f pt = new RcVec3f(); RcVec3f pt = new RcVec3f();
pt.x = x * sampleDist; pt.X = x * sampleDist;
pt.y = (bmax.y + bmin.y) * 0.5f; pt.Y = (bmax.Y + bmin.Y) * 0.5f;
pt.z = z * sampleDist; pt.Z = z * sampleDist;
// Make sure the samples are not too close to the edges. // Make sure the samples are not too close to the edges.
if (DistToPoly(nin, @in, pt) > -sampleDist / 2) if (DistToPoly(nin, @in, pt) > -sampleDist / 2)
{ {
@ -1035,7 +1035,7 @@ namespace DotRecast.Recast
} }
samples.Add(x); samples.Add(x);
samples.Add(GetHeight(pt.x, pt.y, pt.z, cs, ics, chf.ch, heightSearchRadius, hp)); samples.Add(GetHeight(pt.X, pt.Y, pt.Z, cs, ics, chf.ch, heightSearchRadius, hp));
samples.Add(z); samples.Add(z);
samples.Add(0); // Not added samples.Add(0); // Not added
} }
@ -1067,9 +1067,9 @@ namespace DotRecast.Recast
RcVec3f pt = new RcVec3f(); RcVec3f pt = new RcVec3f();
// The sample location is jittered to get rid of some bad triangulations // The sample location is jittered to get rid of some bad triangulations
// which are cause by symmetrical data from the grid structure. // which are cause by symmetrical data from the grid structure.
pt.x = samples[s + 0] * sampleDist + GetJitterX(i) * cs * 0.1f; pt.X = samples[s + 0] * sampleDist + GetJitterX(i) * cs * 0.1f;
pt.y = samples[s + 1] * chf.ch; pt.Y = samples[s + 1] * chf.ch;
pt.z = samples[s + 2] * sampleDist + GetJitterY(i) * cs * 0.1f; pt.Z = samples[s + 2] * sampleDist + GetJitterY(i) * cs * 0.1f;
float d = DistToTriMesh(pt, verts, nverts, tris, tris.Count / 4); float d = DistToTriMesh(pt, verts, nverts, tris, tris.Count / 4);
if (d < 0) if (d < 0)
{ {
@ -1536,18 +1536,18 @@ namespace DotRecast.Recast
// Move detail verts to world space. // Move detail verts to world space.
for (int j = 0; j < nverts; ++j) for (int j = 0; j < nverts; ++j)
{ {
verts[j * 3 + 0] += orig.x; verts[j * 3 + 0] += orig.X;
verts[j * 3 + 1] += orig.y + chf.ch; // Is this offset necessary? See verts[j * 3 + 1] += orig.Y + chf.ch; // Is this offset necessary? See
// https://groups.google.com/d/msg/recastnavigation/UQFN6BGCcV0/-1Ny4koOBpkJ // https://groups.google.com/d/msg/recastnavigation/UQFN6BGCcV0/-1Ny4koOBpkJ
verts[j * 3 + 2] += orig.z; verts[j * 3 + 2] += orig.Z;
} }
// Offset poly too, will be used to flag checking. // Offset poly too, will be used to flag checking.
for (int j = 0; j < npoly; ++j) for (int j = 0; j < npoly; ++j)
{ {
poly[j * 3 + 0] += orig.x; poly[j * 3 + 0] += orig.X;
poly[j * 3 + 1] += orig.y; poly[j * 3 + 1] += orig.Y;
poly[j * 3 + 2] += orig.z; poly[j * 3 + 2] += orig.Z;
} }
// Store detail submesh. // Store detail submesh.

View File

@ -1259,13 +1259,13 @@ namespace DotRecast.Recast
{ {
RcPolyMesh pmesh = meshes[i]; RcPolyMesh pmesh = meshes[i];
int ox = (int)Math.Floor((pmesh.bmin.x - mesh.bmin.x) / mesh.cs + 0.5f); int ox = (int)Math.Floor((pmesh.bmin.X - mesh.bmin.X) / mesh.cs + 0.5f);
int oz = (int)Math.Floor((pmesh.bmin.z - mesh.bmin.z) / mesh.cs + 0.5f); int oz = (int)Math.Floor((pmesh.bmin.Z - mesh.bmin.Z) / mesh.cs + 0.5f);
bool isMinX = (ox == 0); bool isMinX = (ox == 0);
bool isMinZ = (oz == 0); bool isMinZ = (oz == 0);
bool isMaxX = (Math.Floor((mesh.bmax.x - pmesh.bmax.x) / mesh.cs + 0.5f)) == 0; bool isMaxX = (Math.Floor((mesh.bmax.X - pmesh.bmax.X) / mesh.cs + 0.5f)) == 0;
bool isMaxZ = (Math.Floor((mesh.bmax.z - pmesh.bmax.z) / mesh.cs + 0.5f)) == 0; bool isMaxZ = (Math.Floor((mesh.bmax.Z - pmesh.bmax.Z) / mesh.cs + 0.5f)) == 0;
bool isOnBorder = (isMinX || isMinZ || isMaxX || isMaxZ); bool isOnBorder = (isMinX || isMinZ || isMaxX || isMaxZ);
for (int j = 0; j < pmesh.nverts; ++j) for (int j = 0; j < pmesh.nverts; ++j)

View File

@ -59,9 +59,9 @@ namespace DotRecast.Recast
RcVec3f[] vs = new RcVec3f[3]; RcVec3f[] vs = new RcVec3f[3];
for (int k = 0; k < 3; ++k) for (int k = 0; k < 3; ++k)
{ {
vs[k].x = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3]; vs[k].X = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3];
vs[k].y = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3 + 1]; vs[k].Y = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3 + 1];
vs[k].z = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3 + 2]; vs[k].Z = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3 + 2];
} }
if (RcIntersections.IntersectSegmentTriangle(sp, sq, vs[0], vs[1], vs[2], out hitTime)) if (RcIntersections.IntersectSegmentTriangle(sp, sq, vs[0], vs[1], vs[2], out hitTime))

View File

@ -53,9 +53,9 @@ namespace DotRecast.Recast
private static bool OverlapBounds(RcVec3f amin, RcVec3f amax, RcVec3f bmin, RcVec3f bmax) private static bool OverlapBounds(RcVec3f amin, RcVec3f amax, RcVec3f bmin, RcVec3f bmax)
{ {
bool overlap = true; bool overlap = true;
overlap = (amin.x > bmax.x || amax.x < bmin.x) ? false : overlap; overlap = (amin.X > bmax.X || amax.X < bmin.X) ? false : overlap;
overlap = (amin.y > bmax.y || amax.y < bmin.y) ? false : overlap; overlap = (amin.Y > bmax.Y || amax.Y < bmin.Y) ? false : overlap;
overlap = (amin.z > bmax.z || amax.z < bmin.z) ? false : overlap; overlap = (amin.Z > bmax.Z || amax.Z < bmin.Z) ? false : overlap;
return overlap; return overlap;
} }
@ -237,7 +237,7 @@ namespace DotRecast.Recast
{ {
RcVec3f tmin = new RcVec3f(); RcVec3f tmin = new RcVec3f();
RcVec3f tmax = new RcVec3f(); RcVec3f tmax = new RcVec3f();
float by = heightfieldBBMax.y - heightfieldBBMin.y; float by = heightfieldBBMax.Y - heightfieldBBMin.Y;
// Calculate the bounding box of the triangle. // Calculate the bounding box of the triangle.
RcVec3f.Copy(ref tmin, verts, v0 * 3); RcVec3f.Copy(ref tmin, verts, v0 * 3);
@ -252,8 +252,8 @@ namespace DotRecast.Recast
return; return;
// Calculate the footprint of the triangle on the grid's y-axis // Calculate the footprint of the triangle on the grid's y-axis
int z0 = (int)((tmin.z - heightfieldBBMin.z) * inverseCellSize); int z0 = (int)((tmin.Z - heightfieldBBMin.Z) * inverseCellSize);
int z1 = (int)((tmax.z - heightfieldBBMin.z) * inverseCellSize); int z1 = (int)((tmax.Z - heightfieldBBMin.Z) * inverseCellSize);
int w = heightfield.width; int w = heightfield.width;
int h = heightfield.height; int h = heightfield.height;
@ -276,7 +276,7 @@ namespace DotRecast.Recast
for (int z = z0; z <= z1; ++z) for (int z = z0; z <= z1; ++z)
{ {
// Clip polygon to row. Store the remaining polygon as well // Clip polygon to row. Store the remaining polygon as well
float cellZ = heightfieldBBMin.z + z * cellSize; float cellZ = heightfieldBBMin.Z + z * cellSize;
DividePoly(buf, @in, nvIn, inRow, out nvRow, p1, out nvIn, cellZ + cellSize, 2); DividePoly(buf, @in, nvIn, inRow, out nvRow, p1, out nvIn, cellZ + cellSize, 2);
(@in, p1) = (p1, @in); (@in, p1) = (p1, @in);
@ -297,8 +297,8 @@ namespace DotRecast.Recast
maxX = Math.Max(maxX, v); maxX = Math.Max(maxX, v);
} }
int x0 = (int)((minX - heightfieldBBMin.x) * inverseCellSize); int x0 = (int)((minX - heightfieldBBMin.X) * inverseCellSize);
int x1 = (int)((maxX - heightfieldBBMin.x) * inverseCellSize); int x1 = (int)((maxX - heightfieldBBMin.X) * inverseCellSize);
if (x1 < 0 || x0 >= w) if (x1 < 0 || x0 >= w)
{ {
continue; continue;
@ -311,7 +311,7 @@ namespace DotRecast.Recast
for (int x = x0; x <= x1; ++x) for (int x = x0; x <= x1; ++x)
{ {
// Clip polygon to column. store the remaining polygon as well // Clip polygon to column. store the remaining polygon as well
float cx = heightfieldBBMin.x + x * cellSize; float cx = heightfieldBBMin.X + x * cellSize;
DividePoly(buf, inRow, nv2, p1, out nv, p2, out nv2, cx + cellSize, 0); DividePoly(buf, inRow, nv2, p1, out nv, p2, out nv2, cx + cellSize, 0);
(inRow, p2) = (p2, inRow); (inRow, p2) = (p2, inRow);
@ -332,8 +332,8 @@ namespace DotRecast.Recast
spanMax = Math.Max(spanMax, buf[p1 + i * 3 + 1]); spanMax = Math.Max(spanMax, buf[p1 + i * 3 + 1]);
} }
spanMin -= heightfieldBBMin.y; spanMin -= heightfieldBBMin.Y;
spanMax -= heightfieldBBMin.y; spanMax -= heightfieldBBMin.Y;
// Skip the span if it is outside the heightfield bbox // Skip the span if it is outside the heightfield bbox
if (spanMax < 0.0f) if (spanMax < 0.0f)
continue; continue;

View File

@ -49,10 +49,10 @@ namespace DotRecast.Recast
{ {
float[] tbmin = new float[2]; float[] tbmin = new float[2];
float[] tbmax = new float[2]; float[] tbmax = new float[2];
tbmin[0] = builderCfg.bmin.x; tbmin[0] = builderCfg.bmin.X;
tbmin[1] = builderCfg.bmin.z; tbmin[1] = builderCfg.bmin.Z;
tbmax[0] = builderCfg.bmax.x; tbmax[0] = builderCfg.bmax.X;
tbmax[1] = builderCfg.bmax.z; tbmax[1] = builderCfg.bmax.Z;
List<RcChunkyTriMeshNode> nodes = geom.GetChunksOverlappingRect(tbmin, tbmax); List<RcChunkyTriMeshNode> nodes = geom.GetChunksOverlappingRect(tbmin, tbmax);
foreach (RcChunkyTriMeshNode node in nodes) foreach (RcChunkyTriMeshNode node in nodes)
{ {

View File

@ -121,9 +121,9 @@ public class AbstractCrowdTest
for (int j = 0; j < size; j++) for (int j = 0; j < size; j++)
{ {
RcVec3f pos = new RcVec3f(); RcVec3f pos = new RcVec3f();
pos.x = startPos.x + i * distance; pos.X = startPos.X + i * distance;
pos.y = startPos.y; pos.Y = startPos.Y;
pos.z = startPos.z + j * distance; pos.Z = startPos.Z + j * distance;
agents.Add(crowd.AddAgent(pos, ap)); agents.Add(crowd.AddAgent(pos, ap));
} }
} }
@ -154,7 +154,7 @@ public class AbstractCrowdTest
protected RcVec3f CalcVel(RcVec3f pos, RcVec3f tgt, float speed) protected RcVec3f CalcVel(RcVec3f pos, RcVec3f tgt, float speed)
{ {
RcVec3f vel = tgt.Subtract(pos); RcVec3f vel = tgt.Subtract(pos);
vel.y = 0.0f; vel.Y = 0.0f;
vel.Normalize(); vel.Normalize();
vel = vel.Scale(speed); vel = vel.Scale(speed);
return vel; return vel;
@ -166,8 +166,8 @@ public class AbstractCrowdTest
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Console.WriteLine(ag.state + ", " + ag.targetState); Console.WriteLine(ag.state + ", " + ag.targetState);
Console.WriteLine(ag.npos.x + ", " + ag.npos.y + ", " + ag.npos.z); Console.WriteLine(ag.npos.X + ", " + ag.npos.Y + ", " + ag.npos.Z);
Console.WriteLine(ag.nvel.x + ", " + ag.nvel.y + ", " + ag.nvel.z); Console.WriteLine(ag.nvel.X + ", " + ag.nvel.Y + ", " + ag.nvel.Z);
} }
} }
} }

View File

@ -577,12 +577,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q0TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q0TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q0TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q0TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q0TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q0TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -601,12 +601,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0TVT[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q0TVT[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0TVT[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q0TVT[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0TVT[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q0TVT[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0TVT[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q0TVT[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0TVT[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q0TVT[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0TVT[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q0TVT[i][5]).Within(0.001f));
} }
} }
} }
@ -623,12 +623,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0TV[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q0TV[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0TV[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q0TV[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0TV[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q0TV[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0TV[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q0TV[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0TV[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q0TV[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0TV[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q0TV[i][5]).Within(0.001f));
} }
} }
} }
@ -645,12 +645,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q0T[i][0]).Within(0.001)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q0T[i][0]).Within(0.001));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q0T[i][1]).Within(0.001)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q0T[i][1]).Within(0.001));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q0T[i][2]).Within(0.001)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q0T[i][2]).Within(0.001));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q0T[i][3]).Within(0.001)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q0T[i][3]).Within(0.001));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q0T[i][4]).Within(0.001)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q0T[i][4]).Within(0.001));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q0T[i][5]).Within(0.001)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q0T[i][5]).Within(0.001));
} }
} }
} }
@ -670,12 +670,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q1TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q1TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q1TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q1TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q1TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q1TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q1TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q1TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q1TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q1TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q1TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q1TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -695,12 +695,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -720,12 +720,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f));
} }
} }
} }
@ -746,12 +746,12 @@ public class Crowd1Test : AbstractCrowdTest
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
foreach (DtCrowdAgent ag in crowd.GetActiveAgents()) foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
{ {
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][5]).Within(0.001f));
} }
} }
} }

View File

@ -319,12 +319,12 @@ public class Crowd4Test : AbstractCrowdTest
{ {
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
DtCrowdAgent ag = agents[2]; DtCrowdAgent ag = agents[2];
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f), $"{i}"); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q2TVTA[i][0]).Within(0.001f), $"{i}");
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f), $"{i}"); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][1]).Within(0.001f), $"{i}");
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f), $"{i}"); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][2]).Within(0.001f), $"{i}");
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q2TVTA[i][3]).Within(0.001f), $"{i}");
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).Within(0.001f), $"{i}");
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q2TVTA[i][5]).Within(0.001f), $"{i}");
} }
} }
@ -343,12 +343,12 @@ public class Crowd4Test : AbstractCrowdTest
{ {
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
DtCrowdAgent ag = agents[2]; DtCrowdAgent ag = agents[2];
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][0]).Within(0.001f), $"{i}"); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][0]).Within(0.001f), $"{i}");
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][1]).Within(0.001f), $"{i}"); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][1]).Within(0.001f), $"{i}");
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][2]).Within(0.001f), $"{i}"); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][2]).Within(0.001f), $"{i}");
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][3]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][3]).Within(0.001f), $"{i}");
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][4]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][4]).Within(0.001f), $"{i}");
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][5]).Within(0.001f), $"{i}"); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q2TVTAS[i][5]).Within(0.001f), $"{i}");
} }
} }
@ -363,12 +363,12 @@ public class Crowd4Test : AbstractCrowdTest
{ {
crowd.Update(1 / 5f, null); crowd.Update(1 / 5f, null);
DtCrowdAgent ag = agents[2]; DtCrowdAgent ag = agents[2];
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q2T[i][0]).Within(0.00001f), $"{i} - {ag.npos.x} {EXPECTED_A1Q2T[i][0]}"); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q2T[i][0]).Within(0.00001f), $"{i} - {ag.npos.X} {EXPECTED_A1Q2T[i][0]}");
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q2T[i][1]).Within(0.00001f), $"{i} - {ag.npos.y} {EXPECTED_A1Q2T[i][1]}"); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q2T[i][1]).Within(0.00001f), $"{i} - {ag.npos.Y} {EXPECTED_A1Q2T[i][1]}");
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q2T[i][2]).Within(0.00001f), $"{i} - {ag.npos.z} {EXPECTED_A1Q2T[i][2]}"); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q2T[i][2]).Within(0.00001f), $"{i} - {ag.npos.Z} {EXPECTED_A1Q2T[i][2]}");
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q2T[i][3]).Within(0.00001f), $"{i} - {ag.nvel.x} {EXPECTED_A1Q2T[i][3]}"); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q2T[i][3]).Within(0.00001f), $"{i} - {ag.nvel.X} {EXPECTED_A1Q2T[i][3]}");
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q2T[i][4]).Within(0.00001f), $"{i} - {ag.nvel.y} {EXPECTED_A1Q2T[i][4]}"); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q2T[i][4]).Within(0.00001f), $"{i} - {ag.nvel.Y} {EXPECTED_A1Q2T[i][4]}");
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q2T[i][5]).Within(0.00001f), $"{i} - {ag.nvel.z} {EXPECTED_A1Q2T[i][5]}"); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q2T[i][5]).Within(0.00001f), $"{i} - {ag.nvel.Z} {EXPECTED_A1Q2T[i][5]}");
} }
} }
} }

View File

@ -115,12 +115,12 @@ public class Crowd4VelocityTest : AbstractCrowdTest
} }
DtCrowdAgent ag = agents[1]; DtCrowdAgent ag = agents[1];
Assert.That(ag.npos.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f)); Assert.That(ag.npos.X, Is.EqualTo(EXPECTED_A1Q3TVTA[i][0]).Within(0.001f));
Assert.That(ag.npos.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f)); Assert.That(ag.npos.Y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][1]).Within(0.001f));
Assert.That(ag.npos.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f)); Assert.That(ag.npos.Z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][2]).Within(0.001f));
Assert.That(ag.nvel.x, Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f)); Assert.That(ag.nvel.X, Is.EqualTo(EXPECTED_A1Q3TVTA[i][3]).Within(0.001f));
Assert.That(ag.nvel.y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f)); Assert.That(ag.nvel.Y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f));
Assert.That(ag.nvel.z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f)); Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f));
} }
} }
} }

View File

@ -56,13 +56,13 @@ public class FindDistanceToWallTest : AbstractDetourTest
out var hitDist, out var hitPos, out var hitNormal); out var hitDist, out var hitPos, out var hitNormal);
Assert.That(hitDist, Is.EqualTo(DISTANCES_TO_WALL[i]).Within(0.001f)); Assert.That(hitDist, Is.EqualTo(DISTANCES_TO_WALL[i]).Within(0.001f));
Assert.That(hitPos.x, Is.EqualTo(HIT_POSITION[i].x).Within(0.001f)); Assert.That(hitPos.X, Is.EqualTo(HIT_POSITION[i].X).Within(0.001f));
Assert.That(hitPos.y, Is.EqualTo(HIT_POSITION[i].y).Within(0.001f)); Assert.That(hitPos.Y, Is.EqualTo(HIT_POSITION[i].Y).Within(0.001f));
Assert.That(hitPos.z, Is.EqualTo(HIT_POSITION[i].z).Within(0.001f)); Assert.That(hitPos.Z, Is.EqualTo(HIT_POSITION[i].Z).Within(0.001f));
Assert.That(hitNormal.x, Is.EqualTo(HIT_NORMAL[i].x).Within(0.001f)); Assert.That(hitNormal.X, Is.EqualTo(HIT_NORMAL[i].X).Within(0.001f));
Assert.That(hitNormal.y, Is.EqualTo(HIT_NORMAL[i].y).Within(0.001f)); Assert.That(hitNormal.Y, Is.EqualTo(HIT_NORMAL[i].Y).Within(0.001f));
Assert.That(hitNormal.z, Is.EqualTo(HIT_NORMAL[i].z).Within(0.001f)); Assert.That(hitNormal.Z, Is.EqualTo(HIT_NORMAL[i].Z).Within(0.001f));
} }
} }
} }

View File

@ -160,26 +160,26 @@ public class FindPolysAroundShapeTest : AbstractDetourTest
private RcVec3f[] GetQueryPoly(RcVec3f m_spos, RcVec3f m_epos) private RcVec3f[] GetQueryPoly(RcVec3f m_spos, RcVec3f m_epos)
{ {
float nx = (m_epos.z - m_spos.z) * 0.25f; float nx = (m_epos.Z - m_spos.Z) * 0.25f;
float nz = -(m_epos.x - m_spos.x) * 0.25f; float nz = -(m_epos.X - m_spos.X) * 0.25f;
float agentHeight = 2.0f; float agentHeight = 2.0f;
RcVec3f[] m_queryPoly = new RcVec3f[4]; RcVec3f[] m_queryPoly = new RcVec3f[4];
m_queryPoly[0].x = m_spos.x + nx * 1.2f; m_queryPoly[0].X = m_spos.X + nx * 1.2f;
m_queryPoly[0].y = m_spos.y + agentHeight / 2; m_queryPoly[0].Y = m_spos.Y + agentHeight / 2;
m_queryPoly[0].z = m_spos.z + nz * 1.2f; m_queryPoly[0].Z = m_spos.Z + nz * 1.2f;
m_queryPoly[1].x = m_spos.x - nx * 1.3f; m_queryPoly[1].X = m_spos.X - nx * 1.3f;
m_queryPoly[1].y = m_spos.y + agentHeight / 2; m_queryPoly[1].Y = m_spos.Y + agentHeight / 2;
m_queryPoly[1].z = m_spos.z - nz * 1.3f; m_queryPoly[1].Z = m_spos.Z - nz * 1.3f;
m_queryPoly[2].x = m_epos.x - nx * 0.8f; m_queryPoly[2].X = m_epos.X - nx * 0.8f;
m_queryPoly[2].y = m_epos.y + agentHeight / 2; m_queryPoly[2].Y = m_epos.Y + agentHeight / 2;
m_queryPoly[2].z = m_epos.z - nz * 0.8f; m_queryPoly[2].Z = m_epos.Z - nz * 0.8f;
m_queryPoly[3].x = m_epos.x + nx; m_queryPoly[3].X = m_epos.X + nx;
m_queryPoly[3].y = m_epos.y + agentHeight / 2; m_queryPoly[3].Y = m_epos.Y + agentHeight / 2;
m_queryPoly[3].z = m_epos.z + nz; m_queryPoly[3].Z = m_epos.Z + nz;
return m_queryPoly; return m_queryPoly;
} }
} }

View File

@ -93,12 +93,12 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest
Assert.That(segmentRefs.Count, Is.EqualTo(REFS[i].Length)); Assert.That(segmentRefs.Count, Is.EqualTo(REFS[i].Length));
for (int v = 0; v < VERTICES[i].Length / 6; v++) for (int v = 0; v < VERTICES[i].Length / 6; v++)
{ {
Assert.That(segmentVerts[v].vmin.x, Is.EqualTo(VERTICES[i][v].vmin.x).Within(0.001f)); Assert.That(segmentVerts[v].vmin.X, Is.EqualTo(VERTICES[i][v].vmin.X).Within(0.001f));
Assert.That(segmentVerts[v].vmin.y, Is.EqualTo(VERTICES[i][v].vmin.y).Within(0.001f)); Assert.That(segmentVerts[v].vmin.Y, Is.EqualTo(VERTICES[i][v].vmin.Y).Within(0.001f));
Assert.That(segmentVerts[v].vmin.z, Is.EqualTo(VERTICES[i][v].vmin.z).Within(0.001f)); Assert.That(segmentVerts[v].vmin.Z, Is.EqualTo(VERTICES[i][v].vmin.Z).Within(0.001f));
Assert.That(segmentVerts[v].vmax.x, Is.EqualTo(VERTICES[i][v].vmax.x).Within(0.001f)); Assert.That(segmentVerts[v].vmax.X, Is.EqualTo(VERTICES[i][v].vmax.X).Within(0.001f));
Assert.That(segmentVerts[v].vmax.y, Is.EqualTo(VERTICES[i][v].vmax.y).Within(0.001f)); Assert.That(segmentVerts[v].vmax.Y, Is.EqualTo(VERTICES[i][v].vmax.Y).Within(0.001f));
Assert.That(segmentVerts[v].vmax.z, Is.EqualTo(VERTICES[i][v].vmax.z).Within(0.001f)); Assert.That(segmentVerts[v].vmax.Z, Is.EqualTo(VERTICES[i][v].vmax.Z).Within(0.001f));
} }
for (int v = 0; v < REFS[i].Length; v++) for (int v = 0; v < REFS[i].Length; v++)

View File

@ -50,10 +50,10 @@ public class RandomPointTest : AbstractDetourTest
bmax[1] = j == 0 ? tile.data.verts[v + 2] : Math.Max(bmax[1], tile.data.verts[v + 2]); bmax[1] = j == 0 ? tile.data.verts[v + 2] : Math.Max(bmax[1], tile.data.verts[v + 2]);
} }
Assert.That(randomPt.x >= bmin[0], Is.True); Assert.That(randomPt.X >= bmin[0], Is.True);
Assert.That(randomPt.x <= bmax[0], Is.True); Assert.That(randomPt.X <= bmax[0], Is.True);
Assert.That(randomPt.z >= bmin[1], Is.True); Assert.That(randomPt.Z >= bmin[1], Is.True);
Assert.That(randomPt.z <= bmax[1], Is.True); Assert.That(randomPt.Z <= bmax[1], Is.True);
} }
} }
@ -84,10 +84,10 @@ public class RandomPointTest : AbstractDetourTest
bmax[1] = j == 0 ? tile.data.verts[v + 2] : Math.Max(bmax[1], tile.data.verts[v + 2]); bmax[1] = j == 0 ? tile.data.verts[v + 2] : Math.Max(bmax[1], tile.data.verts[v + 2]);
} }
Assert.That(randomPt.x >= bmin[0], Is.True); Assert.That(randomPt.X >= bmin[0], Is.True);
Assert.That(randomPt.x <= bmax[0], Is.True); Assert.That(randomPt.X <= bmax[0], Is.True);
Assert.That(randomPt.z >= bmin[1], Is.True); Assert.That(randomPt.Z >= bmin[1], Is.True);
Assert.That(randomPt.z <= bmax[1], Is.True); Assert.That(randomPt.Z <= bmax[1], Is.True);
} }
} }

View File

@ -281,9 +281,9 @@ public class RecastSoloMeshTest
using StreamWriter fw = new StreamWriter(path); using StreamWriter fw = new StreamWriter(path);
for (int v = 0; v < mesh.nverts; v++) for (int v = 0; v < mesh.nverts; v++)
{ {
fw.Write("v " + (mesh.bmin.x + mesh.verts[v * 3] * mesh.cs) + " " fw.Write("v " + (mesh.bmin.X + mesh.verts[v * 3] * mesh.cs) + " "
+ (mesh.bmin.y + mesh.verts[v * 3 + 1] * mesh.ch) + " " + (mesh.bmin.Y + mesh.verts[v * 3 + 1] * mesh.ch) + " "
+ (mesh.bmin.z + mesh.verts[v * 3 + 2] * mesh.cs) + "\n"); + (mesh.bmin.Z + mesh.verts[v * 3 + 2] * mesh.cs) + "\n");
} }
for (int i = 0; i < mesh.npolys; i++) for (int i = 0; i < mesh.npolys; i++)