forked from mirror/DotRecast
refactor: Change 'xyz' to uppercase in preparation for switching to System.Numeric.Vector3
This commit is contained in:
parent
8d3a1d2d68
commit
7965af390e
|
@ -66,22 +66,22 @@ namespace DotRecast.Core
|
|||
// Returns true if 'a' is more lower-left than 'b'.
|
||||
private static bool Cmppt(RcVec3f a, RcVec3f b)
|
||||
{
|
||||
if (a.x < b.x)
|
||||
if (a.X < b.X)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (a.x > b.x)
|
||||
if (a.X > b.X)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a.z < b.z)
|
||||
if (a.Z < b.Z)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (a.z > b.z)
|
||||
if (a.Z > b.Z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -92,10 +92,10 @@ namespace DotRecast.Core
|
|||
// Returns true if 'c' is left of line 'a'-'b'.
|
||||
private static bool Left(RcVec3f a, RcVec3f b, RcVec3f c)
|
||||
{
|
||||
float u1 = b.x - a.x;
|
||||
float v1 = b.z - a.z;
|
||||
float u2 = c.x - a.x;
|
||||
float v2 = c.z - a.z;
|
||||
float u1 = b.X - a.X;
|
||||
float v1 = b.Z - a.Z;
|
||||
float u2 = c.X - a.X;
|
||||
float v2 = c.Z - a.Z;
|
||||
return u1 * v2 - v1 * u2 < 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,9 +84,9 @@ namespace DotRecast.Core
|
|||
const float EPS = 1e-6f;
|
||||
|
||||
RcVec3f d = new RcVec3f();
|
||||
d.x = sq.x - sp.x;
|
||||
d.y = sq.y - sp.y;
|
||||
d.z = sq.z - sp.z;
|
||||
d.X = sq.X - sp.X;
|
||||
d.Y = sq.Y - sp.Y;
|
||||
d.Z = sq.Z - sp.Z;
|
||||
tmin = 0.0f;
|
||||
tmax = float.MaxValue;
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
public RcSegmentVert(float v0, float v1, float v2, float v3, float v4, float v5)
|
||||
{
|
||||
vmin.x = v0;
|
||||
vmin.y = v1;
|
||||
vmin.z = v2;
|
||||
vmin.X = v0;
|
||||
vmin.Y = v1;
|
||||
vmin.Z = v2;
|
||||
|
||||
vmax.x = v3;
|
||||
vmax.y = v4;
|
||||
vmax.z = v5;
|
||||
vmax.X = v3;
|
||||
vmax.Y = v4;
|
||||
vmax.Z = v5;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,19 +5,19 @@ namespace DotRecast.Core
|
|||
{
|
||||
public struct RcVec2f
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float X;
|
||||
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)]
|
||||
public float Get(int idx)
|
||||
{
|
||||
if (0 == idx)
|
||||
return x;
|
||||
return X;
|
||||
|
||||
if (1 == idx)
|
||||
return y;
|
||||
return Y;
|
||||
|
||||
throw new IndexOutOfRangeException("vector2f index out of range");
|
||||
}
|
||||
|
@ -33,15 +33,15 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(RcVec2f other)
|
||||
{
|
||||
return x.Equals(other.x) &&
|
||||
y.Equals(other.y);
|
||||
return X.Equals(other.X) &&
|
||||
Y.Equals(other.Y);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = x.GetHashCode();
|
||||
hash = RcHashCodes.CombineHashCodes(hash, y.GetHashCode());
|
||||
int hash = X.GetHashCode();
|
||||
hash = RcHashCodes.CombineHashCodes(hash, Y.GetHashCode());
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{x}, {y}";
|
||||
return $"{X}, {Y}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,9 +23,9 @@ namespace DotRecast.Core
|
|||
{
|
||||
public struct RcVec3f
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float z;
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Z;
|
||||
|
||||
public static RcVec3f Zero { get; } = new RcVec3f(0.0f, 0.0f, 0.0f);
|
||||
public static RcVec3f One { get; } = new RcVec3f(1.0f);
|
||||
|
@ -51,26 +51,26 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public RcVec3f(float x, float y, float z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
this.Z = z;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public RcVec3f(float f)
|
||||
{
|
||||
x = f;
|
||||
y = f;
|
||||
z = f;
|
||||
X = f;
|
||||
Y = f;
|
||||
Z = f;
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public RcVec3f(float[] f)
|
||||
{
|
||||
x = f[0];
|
||||
y = f[1];
|
||||
z = f[2];
|
||||
X = f[0];
|
||||
Y = f[1];
|
||||
Z = f[2];
|
||||
}
|
||||
|
||||
public float this[int index]
|
||||
|
@ -84,9 +84,9 @@ namespace DotRecast.Core
|
|||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0: return x;
|
||||
case 1: return y;
|
||||
case 2: return z;
|
||||
case 0: return X;
|
||||
case 1: return Y;
|
||||
case 2: return Z;
|
||||
default: throw new IndexOutOfRangeException($"{index}");
|
||||
}
|
||||
}
|
||||
|
@ -97,13 +97,13 @@ namespace DotRecast.Core
|
|||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
x = value;
|
||||
X = value;
|
||||
break;
|
||||
case 1:
|
||||
y = value;
|
||||
Y = value;
|
||||
break;
|
||||
case 2:
|
||||
z = value;
|
||||
Z = value;
|
||||
break;
|
||||
|
||||
default: throw new IndexOutOfRangeException($"{index}-{value}");
|
||||
|
@ -113,9 +113,9 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Set(float a, float b, float c)
|
||||
{
|
||||
x = a;
|
||||
y = b;
|
||||
z = c;
|
||||
X = a;
|
||||
Y = b;
|
||||
Z = c;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
@ -127,25 +127,25 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Set(float[] @in, int i)
|
||||
{
|
||||
x = @in[i];
|
||||
y = @in[i + 1];
|
||||
z = @in[i + 2];
|
||||
X = @in[i];
|
||||
Y = @in[i + 1];
|
||||
Z = @in[i + 2];
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)]
|
||||
public readonly RcVec3f Subtract(RcVec3f right)
|
||||
{
|
||||
return new RcVec3f(
|
||||
x - right.x,
|
||||
y - right.y,
|
||||
z - right.z
|
||||
X - right.X,
|
||||
Y - right.Y,
|
||||
Z - right.Z
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -153,9 +153,9 @@ namespace DotRecast.Core
|
|||
public readonly RcVec3f Add(RcVec3f v2)
|
||||
{
|
||||
return new RcVec3f(
|
||||
x + v2.x,
|
||||
y + v2.y,
|
||||
z + v2.z
|
||||
X + v2.X,
|
||||
Y + v2.Y,
|
||||
Z + v2.Z
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -163,9 +163,9 @@ namespace DotRecast.Core
|
|||
public readonly RcVec3f Scale(float scale)
|
||||
{
|
||||
return new RcVec3f(
|
||||
x * scale,
|
||||
y * scale,
|
||||
z * scale
|
||||
X * scale,
|
||||
Y * scale,
|
||||
Z * scale
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -180,13 +180,13 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly float Dot2D(RcVec3f v)
|
||||
{
|
||||
return x * v.x + z * v.z;
|
||||
return X * v.X + Z * v.Z;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)]
|
||||
public bool Equals(RcVec3f other)
|
||||
{
|
||||
return x.Equals(other.x) &&
|
||||
y.Equals(other.y) &&
|
||||
z.Equals(other.z);
|
||||
return X.Equals(other.X) &&
|
||||
Y.Equals(other.Y) &&
|
||||
Z.Equals(other.Z);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
int hash = x.GetHashCode();
|
||||
hash = RcHashCodes.CombineHashCodes(hash, y.GetHashCode());
|
||||
hash = RcHashCodes.CombineHashCodes(hash, z.GetHashCode());
|
||||
int hash = X.GetHashCode();
|
||||
hash = RcHashCodes.CombineHashCodes(hash, Y.GetHashCode());
|
||||
hash = RcHashCodes.CombineHashCodes(hash, Z.GetHashCode());
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
@ -221,12 +221,12 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)
|
||||
{
|
||||
x *= d;
|
||||
y *= d;
|
||||
z *= d;
|
||||
X *= d;
|
||||
Y *= d;
|
||||
Z *= d;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,52 +238,52 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)
|
||||
{
|
||||
float inverseMag = 1.0f / (float)Math.Sqrt(sqMag);
|
||||
x *= inverseMag;
|
||||
y *= inverseMag;
|
||||
z *= inverseMag;
|
||||
X *= inverseMag;
|
||||
Y *= inverseMag;
|
||||
Z *= inverseMag;
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Min(float[] @in, int i)
|
||||
{
|
||||
x = Math.Min(x, @in[i]);
|
||||
y = Math.Min(y, @in[i + 1]);
|
||||
z = Math.Min(z, @in[i + 2]);
|
||||
X = Math.Min(X, @in[i]);
|
||||
Y = Math.Min(Y, @in[i + 1]);
|
||||
Z = Math.Min(Z, @in[i + 2]);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Min(RcVec3f b)
|
||||
{
|
||||
x = Math.Min(x, b.x);
|
||||
y = Math.Min(y, b.y);
|
||||
z = Math.Min(z, b.z);
|
||||
X = Math.Min(X, b.X);
|
||||
Y = Math.Min(Y, b.Y);
|
||||
Z = Math.Min(Z, b.Z);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Max(RcVec3f b)
|
||||
{
|
||||
x = Math.Max(x, b.x);
|
||||
y = Math.Max(y, b.y);
|
||||
z = Math.Max(z, b.z);
|
||||
X = Math.Max(X, b.X);
|
||||
Y = Math.Max(Y, b.Y);
|
||||
Z = Math.Max(Z, b.Z);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Max(float[] @in, int i)
|
||||
{
|
||||
x = Math.Max(x, @in[i]);
|
||||
y = Math.Max(y, @in[i + 1]);
|
||||
z = Math.Max(z, @in[i + 2]);
|
||||
X = Math.Max(X, @in[i]);
|
||||
Y = Math.Max(Y, @in[i + 1]);
|
||||
Z = Math.Max(Z, @in[i + 2]);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{x}, {y}, {z}";
|
||||
return $"{X}, {Y}, {Z}";
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
@ -314,9 +314,9 @@ namespace DotRecast.Core
|
|||
public static RcVec3f operator *(RcVec3f left, RcVec3f right)
|
||||
{
|
||||
return new RcVec3f(
|
||||
left.x * right.x,
|
||||
left.y * right.y,
|
||||
left.z * right.z
|
||||
left.X * right.X,
|
||||
left.Y * right.Y,
|
||||
left.Z * right.Z
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -336,9 +336,9 @@ namespace DotRecast.Core
|
|||
public static RcVec3f Cross(RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
return new RcVec3f(
|
||||
(v1.y * v2.z) - (v1.z * v2.y),
|
||||
(v1.z * v2.x) - (v1.x * v2.z),
|
||||
(v1.x * v2.y) - (v1.y * v2.x)
|
||||
(v1.Y * v2.Z) - (v1.Z * v2.Y),
|
||||
(v1.Z * v2.X) - (v1.X * v2.Z),
|
||||
(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)
|
||||
{
|
||||
return new RcVec3f(
|
||||
v1.x + (v2.x - v1.x) * t,
|
||||
v1.y + (v2.y - v1.y) * t,
|
||||
v1.z + (v2.z - v1.z) * t
|
||||
v1.X + (v2.X - v1.X) * t,
|
||||
v1.Y + (v2.Y - v1.Y) * t,
|
||||
v1.Z + (v2.Z - v1.Z) * t
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -359,17 +359,17 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Distance(RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
float dx = v2.x - v1.x;
|
||||
float dy = v2.y - v1.y;
|
||||
float dz = v2.z - v1.z;
|
||||
float dx = v2.X - v1.X;
|
||||
float dy = v2.Y - v1.Y;
|
||||
float dz = v2.Z - v1.Z;
|
||||
return (float)Math.Sqrt(dx * dx + dy * dy + dz * dz);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Dot(RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
return (v1.x * v2.x) + (v1.y * v2.y)
|
||||
+ (v1.z * v2.z);
|
||||
return (v1.X * v2.X) + (v1.Y * v2.Y)
|
||||
+ (v1.Z * v2.Z);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
@ -381,14 +381,14 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)]
|
||||
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))
|
||||
|
@ -401,9 +401,9 @@ namespace DotRecast.Core
|
|||
{
|
||||
return new RcVec3f()
|
||||
{
|
||||
x = v1.x + (v2.x * s),
|
||||
y = v1.y + (v2.y * s),
|
||||
z = v1.z + (v2.z * s),
|
||||
X = v1.X + (v2.X * s),
|
||||
Y = v1.Y + (v2.Y * s),
|
||||
Z = v1.Z + (v2.Z * s),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -431,18 +431,18 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float DistSqr(RcVec3f v1, float[] v2, int i)
|
||||
{
|
||||
float dx = v2[i] - v1.x;
|
||||
float dy = v2[i + 1] - v1.y;
|
||||
float dz = v2[i + 2] - v1.z;
|
||||
float dx = v2[i] - v1.X;
|
||||
float dy = v2[i + 1] - v1.Y;
|
||||
float dz = v2[i + 2] - v1.Z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float DistSqr(RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
float dx = v2.x - v1.x;
|
||||
float dy = v2.y - v1.y;
|
||||
float dz = v2.z - v1.z;
|
||||
float dx = v2.X - v1.X;
|
||||
float dy = v2.Y - v1.Y;
|
||||
float dz = v2.Z - v1.Z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
|
||||
|
@ -482,8 +482,8 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Dist2D(RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
float dx = v2.x - v1.x;
|
||||
float dz = v2.z - v1.z;
|
||||
float dx = v2.X - v1.X;
|
||||
float dz = v2.Z - v1.Z;
|
||||
return (float)Math.Sqrt(dx * dx + dz * dz);
|
||||
}
|
||||
|
||||
|
@ -499,16 +499,16 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Dist2DSqr(RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
float dx = v2.x - v1.x;
|
||||
float dz = v2.z - v1.z;
|
||||
float dx = v2.X - v1.X;
|
||||
float dz = v2.Z - v1.Z;
|
||||
return dx * dx + dz * dz;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Dist2DSqr(RcVec3f p, float[] verts, int i)
|
||||
{
|
||||
float dx = verts[i] - p.x;
|
||||
float dz = verts[i + 2] - p.z;
|
||||
float dx = verts[i] - p.X;
|
||||
float dz = verts[i + 2] - p.Z;
|
||||
return dx * dx + dz * dz;
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)
|
||||
|
@ -531,7 +531,7 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)]
|
||||
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.
|
||||
|
@ -550,7 +550,7 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)]
|
||||
public static void Add(ref RcVec3f e0, RcVec3f a, float[] verts, int i)
|
||||
{
|
||||
e0.x = a.x + verts[i];
|
||||
e0.y = a.y + verts[i + 1];
|
||||
e0.z = a.z + verts[i + 2];
|
||||
e0.X = a.X + verts[i];
|
||||
e0.Y = a.Y + verts[i + 1];
|
||||
e0.Z = a.Z + verts[i + 2];
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Sub(ref RcVec3f e0, float[] verts, int i, int j)
|
||||
{
|
||||
e0.x = verts[i] - verts[j];
|
||||
e0.y = verts[i + 1] - verts[j + 1];
|
||||
e0.z = verts[i + 2] - verts[j + 2];
|
||||
e0.X = verts[i] - verts[j];
|
||||
e0.Y = verts[i + 1] - verts[j + 1];
|
||||
e0.Z = verts[i + 2] - verts[j + 2];
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Sub(ref RcVec3f e0, RcVec3f i, float[] verts, int j)
|
||||
{
|
||||
e0.x = i.x - verts[j];
|
||||
e0.y = i.y - verts[j + 1];
|
||||
e0.z = i.z - verts[j + 2];
|
||||
e0.X = i.X - verts[j];
|
||||
e0.Y = i.Y - verts[j + 1];
|
||||
e0.Z = i.Z - verts[j + 2];
|
||||
}
|
||||
|
||||
|
||||
|
@ -622,27 +622,27 @@ namespace DotRecast.Core
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Cross(float[] dest, RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
dest[0] = v1.y * v2.z - v1.z * v2.y;
|
||||
dest[1] = v1.z * v2.x - v1.x * v2.z;
|
||||
dest[2] = v1.x * v2.y - v1.y * v2.x;
|
||||
dest[0] = v1.Y * v2.Z - v1.Z * v2.Y;
|
||||
dest[1] = v1.Z * v2.X - v1.X * v2.Z;
|
||||
dest[2] = v1.X * v2.Y - v1.Y * v2.X;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Cross(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
dest.x = v1.y * v2.z - v1.z * v2.y;
|
||||
dest.y = v1.z * v2.x - v1.x * v2.z;
|
||||
dest.z = v1.x * v2.y - v1.y * v2.x;
|
||||
dest.X = v1.Y * v2.Z - v1.Z * v2.Y;
|
||||
dest.Y = v1.Z * v2.X - v1.X * v2.Z;
|
||||
dest.Z = v1.X * v2.Y - v1.Y * v2.X;
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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));
|
||||
v.x *= d;
|
||||
v.y *= d;
|
||||
v.z *= d;
|
||||
float d = (float)(1.0f / Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z));
|
||||
v.X *= d;
|
||||
v.Y *= d;
|
||||
v.Z *= d;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -857,7 +857,7 @@ namespace DotRecast.Detour.Crowd
|
|||
{
|
||||
RcVec3f p = ag.npos;
|
||||
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();
|
||||
|
||||
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)
|
||||
{
|
||||
if (ag == skip)
|
||||
|
@ -903,12 +903,12 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
// Check for overlap.
|
||||
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;
|
||||
}
|
||||
|
||||
diff.y = 0;
|
||||
diff.Y = 0;
|
||||
float distSqr = RcVec3f.LenSqr(diff);
|
||||
if (distSqr > RcMath.Sqr(range))
|
||||
{
|
||||
|
@ -1076,7 +1076,7 @@ namespace DotRecast.Detour.Crowd
|
|||
DtCrowdAgent nei = ag.neis[j].agent;
|
||||
|
||||
RcVec3f diff = ag.npos.Subtract(nei.npos);
|
||||
diff.y = 0;
|
||||
diff.Y = 0;
|
||||
|
||||
float distSqr = RcVec3f.LenSqr(diff);
|
||||
if (distSqr < 0.00001f)
|
||||
|
@ -1223,7 +1223,7 @@ namespace DotRecast.Detour.Crowd
|
|||
DtCrowdAgent nei = ag.neis[j].agent;
|
||||
long idx1 = nei.idx;
|
||||
RcVec3f diff = ag.npos.Subtract(nei.npos);
|
||||
diff.y = 0;
|
||||
diff.Y = 0;
|
||||
|
||||
float dist = RcVec3f.LenSqr(diff);
|
||||
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.
|
||||
if (idx0 > idx1)
|
||||
{
|
||||
diff.Set(-ag.dvel.z, 0, ag.dvel.x);
|
||||
diff.Set(-ag.dvel.Z, 0, ag.dvel.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
diff.Set(ag.dvel.z, 0, -ag.dvel.x);
|
||||
diff.Set(ag.dvel.Z, 0, -ag.dvel.X);
|
||||
}
|
||||
|
||||
pen = 0.01f;
|
||||
|
|
|
@ -169,17 +169,17 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
var dir0 = p0.Subtract(npos);
|
||||
var dir1 = p1.Subtract(npos);
|
||||
dir0.y = 0;
|
||||
dir1.y = 0;
|
||||
dir0.Y = 0;
|
||||
dir1.Y = 0;
|
||||
|
||||
float len0 = dir0.Length();
|
||||
float len1 = dir1.Length();
|
||||
if (len1 > 0.001f)
|
||||
dir1 = dir1.Scale(1.0f / len1);
|
||||
|
||||
dir.x = dir0.x - dir1.x * len0 * 0.5f;
|
||||
dir.y = 0;
|
||||
dir.z = dir0.z - dir1.z * len0 * 0.5f;
|
||||
dir.X = dir0.X - dir1.X * len0 * 0.5f;
|
||||
dir.Y = 0;
|
||||
dir.Z = dir0.Z - dir1.Z * len0 * 0.5f;
|
||||
dir.Normalize();
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ namespace DotRecast.Detour.Crowd
|
|||
if (0 < corners.Count)
|
||||
{
|
||||
dir = corners[0].pos.Subtract(npos);
|
||||
dir.y = 0;
|
||||
dir.Y = 0;
|
||||
dir.Normalize();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
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()
|
||||
{
|
||||
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_segs.Clear();
|
||||
}
|
||||
|
|
|
@ -82,9 +82,9 @@ namespace DotRecast.Detour.Crowd
|
|||
{
|
||||
if (m_nsamples >= m_maxSamples)
|
||||
return;
|
||||
m_vel[m_nsamples * 3] = vel.x;
|
||||
m_vel[m_nsamples * 3 + 1] = vel.y;
|
||||
m_vel[m_nsamples * 3 + 2] = vel.z;
|
||||
m_vel[m_nsamples * 3] = vel.X;
|
||||
m_vel[m_nsamples * 3 + 1] = vel.Y;
|
||||
m_vel[m_nsamples * 3 + 2] = vel.Z;
|
||||
m_ssize[m_nsamples] = ssize;
|
||||
m_pen[m_nsamples] = pen;
|
||||
m_vpen[m_nsamples] = vpen;
|
||||
|
@ -102,9 +102,9 @@ namespace DotRecast.Detour.Crowd
|
|||
public RcVec3f GetSampleVelocity(int i)
|
||||
{
|
||||
RcVec3f vel = new RcVec3f();
|
||||
vel.x = m_vel[i * 3];
|
||||
vel.y = m_vel[i * 3 + 1];
|
||||
vel.z = m_vel[i * 3 + 2];
|
||||
vel.X = m_vel[i * 3];
|
||||
vel.Y = m_vel[i * 3 + 1];
|
||||
vel.Z = m_vel[i * 3 + 2];
|
||||
return vel;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,13 +132,13 @@ namespace DotRecast.Detour.Crowd
|
|||
float a = DtUtils.TriArea2D(orig, cir.dp, dv);
|
||||
if (a < 0.01f)
|
||||
{
|
||||
cir.np.x = -cir.dp.z;
|
||||
cir.np.z = cir.dp.x;
|
||||
cir.np.X = -cir.dp.Z;
|
||||
cir.np.Z = cir.dp.X;
|
||||
}
|
||||
else
|
||||
{
|
||||
cir.np.x = cir.dp.z;
|
||||
cir.np.z = -cir.dp.x;
|
||||
cir.np.X = cir.dp.Z;
|
||||
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.
|
||||
RcVec3f sdir = seg.q.Subtract(seg.p);
|
||||
RcVec3f snorm = new RcVec3f();
|
||||
snorm.x = -sdir.z;
|
||||
snorm.z = sdir.x;
|
||||
snorm.X = -sdir.Z;
|
||||
snorm.Z = sdir.X;
|
||||
// If the velocity is pointing towards the segment, no collision.
|
||||
if (snorm.Dot2D(vcand) < 0.0f)
|
||||
continue;
|
||||
|
@ -331,8 +331,8 @@ namespace DotRecast.Detour.Crowd
|
|||
if (debug != null)
|
||||
debug.Reset();
|
||||
|
||||
float cvx = dvel.x * m_params.velBias;
|
||||
float cvz = dvel.z * m_params.velBias;
|
||||
float cvx = dvel.X * m_params.velBias;
|
||||
float cvz = dvel.Z * m_params.velBias;
|
||||
float cs = vmax * 2 * (1 - m_params.velBias) / (m_params.gridSize - 1);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
|
||||
float penalty = ProcessSample(vcand, cs, pos, rad, vel, dvel, minPenalty, debug);
|
||||
|
@ -377,9 +377,9 @@ namespace DotRecast.Detour.Crowd
|
|||
RcVec3f dest = new RcVec3f();
|
||||
float c = (float)Math.Cos(ang);
|
||||
float s = (float)Math.Sin(ang);
|
||||
dest.x = v[0] * c - v[2] * s;
|
||||
dest.z = v[0] * s + v[2] * c;
|
||||
dest.y = v[1];
|
||||
dest.X = v[0] * c - v[2] * s;
|
||||
dest.Z = v[0] * s + v[2] * c;
|
||||
dest.Y = v[1];
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
@ -416,14 +416,14 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
// desired direction
|
||||
float[] ddir = new float[6];
|
||||
ddir[0] = dvel.x;
|
||||
ddir[1] = dvel.y;
|
||||
ddir[2] = dvel.z;
|
||||
ddir[0] = dvel.X;
|
||||
ddir[1] = dvel.Y;
|
||||
ddir[2] = dvel.Z;
|
||||
DtNormalize2D(ddir);
|
||||
RcVec3f rotated = DtRotate2D(ddir, da * 0.5f); // rotated by da/2
|
||||
ddir[3] = rotated.x;
|
||||
ddir[4] = rotated.y;
|
||||
ddir[5] = rotated.z;
|
||||
ddir[3] = rotated.X;
|
||||
ddir[4] = rotated.Y;
|
||||
ddir[5] = rotated.Z;
|
||||
|
||||
// Always add sample at zero
|
||||
pat[npat * 2 + 0] = 0;
|
||||
|
@ -463,7 +463,7 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
// Start sampling.
|
||||
float cr = vmax * (1.0f - m_params.velBias);
|
||||
RcVec3f res = RcVec3f.Of(dvel.x * m_params.velBias, 0, dvel.z * m_params.velBias);
|
||||
RcVec3f res = RcVec3f.Of(dvel.X * m_params.velBias, 0, dvel.Z * m_params.velBias);
|
||||
int ns = 0;
|
||||
for (int k = 0; k < depth; ++k)
|
||||
{
|
||||
|
@ -473,8 +473,8 @@ namespace DotRecast.Detour.Crowd
|
|||
|
||||
for (int i = 0; i < npat; ++i)
|
||||
{
|
||||
RcVec3f vcand = RcVec3f.Of(res.x + pat[i * 2 + 0] * cr, 0f, res.z + pat[i * 2 + 1] * cr);
|
||||
if (RcMath.Sqr(vcand.x) + RcMath.Sqr(vcand.z) > RcMath.Sqr(vmax + 0.001f))
|
||||
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))
|
||||
continue;
|
||||
|
||||
float penalty = ProcessSample(vcand, cr / 10, pos, rad, vel, dvel, minPenalty, debug);
|
||||
|
|
|
@ -314,7 +314,7 @@ namespace DotRecast.Detour.Crowd
|
|||
status = navquery.GetPolyHeight(m_path[0], result, out var h);
|
||||
if (status.Succeeded())
|
||||
{
|
||||
m_pos.y = h;
|
||||
m_pos.Y = h;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -47,9 +47,9 @@ namespace DotRecast.Detour.Dynamic.Colliders
|
|||
float s0 = (i & 1) != 0 ? 1f : -1f;
|
||||
float s1 = (i & 2) != 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 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 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 vz = center.Z + s0 * halfEdges[0].Z + s1 * halfEdges[1].Z + s2 * halfEdges[2].Z;
|
||||
bounds[0] = Math.Min(bounds[0], vx);
|
||||
bounds[1] = Math.Min(bounds[1], vy);
|
||||
bounds[2] = Math.Min(bounds[2], vz);
|
||||
|
@ -72,7 +72,7 @@ namespace DotRecast.Detour.Dynamic.Colliders
|
|||
RcVec3f[] halfEdges =
|
||||
{
|
||||
RcVec3f.Zero,
|
||||
RcVec3f.Of(up.x, up.y, up.z),
|
||||
RcVec3f.Of(up.X, up.Y, up.Z),
|
||||
RcVec3f.Zero
|
||||
};
|
||||
RcVec3f.Normalize(ref halfEdges[1]);
|
||||
|
@ -80,15 +80,15 @@ namespace DotRecast.Detour.Dynamic.Colliders
|
|||
RcVec3f.Normalize(ref halfEdges[0]);
|
||||
RcVec3f.Cross(ref halfEdges[2], halfEdges[0], up);
|
||||
RcVec3f.Normalize(ref halfEdges[2]);
|
||||
halfEdges[0].x *= extent.x;
|
||||
halfEdges[0].y *= extent.x;
|
||||
halfEdges[0].z *= extent.x;
|
||||
halfEdges[1].x *= extent.y;
|
||||
halfEdges[1].y *= extent.y;
|
||||
halfEdges[1].z *= extent.y;
|
||||
halfEdges[2].x *= extent.z;
|
||||
halfEdges[2].y *= extent.z;
|
||||
halfEdges[2].z *= extent.z;
|
||||
halfEdges[0].X *= extent.X;
|
||||
halfEdges[0].Y *= extent.X;
|
||||
halfEdges[0].Z *= extent.X;
|
||||
halfEdges[1].X *= extent.Y;
|
||||
halfEdges[1].Y *= extent.Y;
|
||||
halfEdges[1].Z *= extent.Y;
|
||||
halfEdges[2].X *= extent.Z;
|
||||
halfEdges[2].Y *= extent.Z;
|
||||
halfEdges[2].Z *= extent.Z;
|
||||
return halfEdges;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,9 +46,9 @@ namespace DotRecast.Detour.Dynamic.Colliders
|
|||
{
|
||||
return new float[]
|
||||
{
|
||||
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.Max(start.z, end.z) + 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.Max(start.Z, end.Z) + radius
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,9 +47,9 @@ namespace DotRecast.Detour.Dynamic.Colliders
|
|||
{
|
||||
return new float[]
|
||||
{
|
||||
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.Max(start.z, end.z) + 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.Max(start.Z, end.Z) + radius
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,12 +45,12 @@ namespace DotRecast.Detour.Dynamic.Colliders
|
|||
{
|
||||
return new float[]
|
||||
{
|
||||
center.x - radius,
|
||||
center.y - radius,
|
||||
center.z - radius,
|
||||
center.x + radius,
|
||||
center.y + radius,
|
||||
center.z + radius
|
||||
center.X - radius,
|
||||
center.Y - radius,
|
||||
center.Z - radius,
|
||||
center.X + radius,
|
||||
center.Y + radius,
|
||||
center.Z + radius
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ namespace DotRecast.Detour.Dynamic
|
|||
config.detailSampleMaxError = voxelFile.detailSampleMaxError;
|
||||
builder = new RcBuilder();
|
||||
navMeshParams = new DtNavMeshParams();
|
||||
navMeshParams.orig.x = voxelFile.bounds[0];
|
||||
navMeshParams.orig.y = voxelFile.bounds[1];
|
||||
navMeshParams.orig.z = voxelFile.bounds[2];
|
||||
navMeshParams.orig.X = voxelFile.bounds[0];
|
||||
navMeshParams.orig.Y = voxelFile.bounds[1];
|
||||
navMeshParams.orig.Z = voxelFile.bounds[2];
|
||||
navMeshParams.tileWidth = voxelFile.cellSize * voxelFile.tileSizeX;
|
||||
navMeshParams.tileHeight = voxelFile.cellSize * voxelFile.tileSizeZ;
|
||||
navMeshParams.maxTiles = voxelFile.tiles.Count;
|
||||
|
@ -189,10 +189,10 @@ namespace DotRecast.Detour.Dynamic
|
|||
return _tiles.Values;
|
||||
}
|
||||
|
||||
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 maxx = (int)Math.Floor((bounds[3] - navMeshParams.orig.x) / navMeshParams.tileWidth);
|
||||
int maxz = (int)Math.Floor((bounds[5] - navMeshParams.orig.z) / navMeshParams.tileHeight);
|
||||
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 maxx = (int)Math.Floor((bounds[3] - navMeshParams.orig.X) / navMeshParams.tileWidth);
|
||||
int maxz = (int)Math.Floor((bounds[5] - navMeshParams.orig.Z) / navMeshParams.tileHeight);
|
||||
List<DtDynamicTile> tiles = new List<DtDynamicTile>();
|
||||
for (int z = minz; z <= maxz; ++z)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace DotRecast.Detour.Dynamic
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,20 +55,20 @@ namespace DotRecast.Detour.Dynamic
|
|||
|
||||
private bool TraverseTiles(RcVec3f start, RcVec3f end, out float hit)
|
||||
{
|
||||
float relStartX = start.x - origin.x;
|
||||
float relStartZ = start.z - origin.z;
|
||||
float relStartX = start.X - origin.X;
|
||||
float relStartZ = start.Z - origin.Z;
|
||||
int sx = (int)Math.Floor(relStartX / tileWidth);
|
||||
int sz = (int)Math.Floor(relStartZ / tileDepth);
|
||||
int ex = (int)Math.Floor((end.x - origin.x) / tileWidth);
|
||||
int ez = (int)Math.Floor((end.z - origin.z) / tileDepth);
|
||||
int ex = (int)Math.Floor((end.X - origin.X) / tileWidth);
|
||||
int ez = (int)Math.Floor((end.Z - origin.Z) / tileDepth);
|
||||
int dx = ex - sx;
|
||||
int dz = ez - sz;
|
||||
int stepX = dx < 0 ? -1 : 1;
|
||||
int stepZ = dz < 0 ? -1 : 1;
|
||||
float xRem = (tileWidth + (relStartX % tileWidth)) % tileWidth;
|
||||
float zRem = (tileDepth + (relStartZ % tileDepth)) % tileDepth;
|
||||
float tx = end.x - start.x;
|
||||
float tz = end.z - start.z;
|
||||
float tx = end.X - start.X;
|
||||
float tz = end.Z - start.Z;
|
||||
float xOffest = Math.Abs(tx < 0 ? xRem : tileWidth - xRem);
|
||||
float zOffest = Math.Abs(tz < 0 ? zRem : tileDepth - zRem);
|
||||
tx = Math.Abs(tx);
|
||||
|
@ -113,17 +113,17 @@ namespace DotRecast.Detour.Dynamic
|
|||
RcHeightfield hf = heightfieldProvider.Invoke(x, z);
|
||||
if (null != hf)
|
||||
{
|
||||
float tx = end.x - start.x;
|
||||
float ty = end.y - start.y;
|
||||
float tz = end.z - start.z;
|
||||
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 relStartX = entry[0] - hf.bmin.x;
|
||||
float relStartZ = entry[2] - hf.bmin.z;
|
||||
float tx = end.X - start.X;
|
||||
float ty = end.Y - start.Y;
|
||||
float tz = end.Z - start.Z;
|
||||
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 relStartX = entry[0] - hf.bmin.X;
|
||||
float relStartZ = entry[2] - hf.bmin.Z;
|
||||
int sx = (int)Math.Floor(relStartX / hf.cs);
|
||||
int sz = (int)Math.Floor(relStartZ / 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 ex = (int)Math.Floor((exit[0] - hf.bmin.X) / hf.cs);
|
||||
int ez = (int)Math.Floor((exit[2] - hf.bmin.Z) / hf.cs);
|
||||
int dx = ex - sx;
|
||||
int dz = ez - sz;
|
||||
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)
|
||||
{
|
||||
float y1 = start.y + ty * (tMin + t) - hf.bmin.y;
|
||||
float y2 = start.y + ty * (tMin + Math.Min(tMaxX, tMaxZ)) - 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 ymin = Math.Min(y1, y2) / hf.ch;
|
||||
float ymax = Math.Max(y1, y2) / hf.ch;
|
||||
RcSpan span = hf.spans[sx + sz * hf.width];
|
||||
|
|
|
@ -109,12 +109,12 @@ namespace DotRecast.Detour.Dynamic.Io
|
|||
foreach (RcBuilderResult r in results)
|
||||
{
|
||||
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[1] = Math.Min(f.bounds[1], r.GetSolidHeightfield().bmin.y);
|
||||
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[4] = Math.Max(f.bounds[4], r.GetSolidHeightfield().bmax.y);
|
||||
f.bounds[5] = Math.Max(f.bounds[5], r.GetSolidHeightfield().bmax.z);
|
||||
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[2] = Math.Min(f.bounds[2], r.GetSolidHeightfield().bmin.Z);
|
||||
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[5] = Math.Max(f.bounds[5], r.GetSolidHeightfield().bmax.Z);
|
||||
}
|
||||
|
||||
return f;
|
||||
|
@ -154,12 +154,12 @@ namespace DotRecast.Detour.Dynamic.Io
|
|||
{
|
||||
RcHeightfield heightfield = vt.Heightfield();
|
||||
f.tiles.Add(new DtVoxelTile(vt.tileX, vt.tileZ, heightfield));
|
||||
f.bounds[0] = Math.Min(f.bounds[0], vt.boundsMin.x);
|
||||
f.bounds[1] = Math.Min(f.bounds[1], vt.boundsMin.y);
|
||||
f.bounds[2] = Math.Min(f.bounds[2], vt.boundsMin.z);
|
||||
f.bounds[3] = Math.Max(f.bounds[3], vt.boundsMax.x);
|
||||
f.bounds[4] = Math.Max(f.bounds[4], vt.boundsMax.y);
|
||||
f.bounds[5] = Math.Max(f.bounds[5], vt.boundsMax.z);
|
||||
f.bounds[0] = Math.Min(f.bounds[0], vt.boundsMin.X);
|
||||
f.bounds[1] = Math.Min(f.bounds[1], vt.boundsMin.Y);
|
||||
f.bounds[2] = Math.Min(f.bounds[2], vt.boundsMin.Z);
|
||||
f.bounds[3] = Math.Max(f.bounds[3], vt.boundsMax.X);
|
||||
f.bounds[4] = Math.Max(f.bounds[4], vt.boundsMax.Y);
|
||||
f.bounds[5] = Math.Max(f.bounds[5], vt.boundsMax.Z);
|
||||
}
|
||||
|
||||
return f;
|
||||
|
|
|
@ -79,9 +79,9 @@ namespace DotRecast.Detour.Dynamic.Io
|
|||
file.useTiles = buf.Get() != 0;
|
||||
file.tileSizeX = buf.GetInt();
|
||||
file.tileSizeZ = buf.GetInt();
|
||||
file.rotation.x = buf.GetFloat();
|
||||
file.rotation.y = buf.GetFloat();
|
||||
file.rotation.z = buf.GetFloat();
|
||||
file.rotation.X = buf.GetFloat();
|
||||
file.rotation.Y = buf.GetFloat();
|
||||
file.rotation.Z = buf.GetFloat();
|
||||
file.bounds[0] = buf.GetFloat();
|
||||
file.bounds[1] = buf.GetFloat();
|
||||
file.bounds[2] = buf.GetFloat();
|
||||
|
@ -108,22 +108,22 @@ namespace DotRecast.Detour.Dynamic.Io
|
|||
int depth = buf.GetInt();
|
||||
int borderSize = buf.GetInt();
|
||||
RcVec3f boundsMin = new RcVec3f();
|
||||
boundsMin.x = buf.GetFloat();
|
||||
boundsMin.y = buf.GetFloat();
|
||||
boundsMin.z = buf.GetFloat();
|
||||
boundsMin.X = buf.GetFloat();
|
||||
boundsMin.Y = buf.GetFloat();
|
||||
boundsMin.Z = buf.GetFloat();
|
||||
RcVec3f boundsMax = new RcVec3f();
|
||||
boundsMax.x = buf.GetFloat();
|
||||
boundsMax.y = buf.GetFloat();
|
||||
boundsMax.z = buf.GetFloat();
|
||||
boundsMax.X = buf.GetFloat();
|
||||
boundsMax.Y = buf.GetFloat();
|
||||
boundsMax.Z = buf.GetFloat();
|
||||
if (isExportedFromAstar)
|
||||
{
|
||||
// bounds are local
|
||||
boundsMin.x += file.bounds[0];
|
||||
boundsMin.y += file.bounds[1];
|
||||
boundsMin.z += file.bounds[2];
|
||||
boundsMax.x += file.bounds[0];
|
||||
boundsMax.y += file.bounds[1];
|
||||
boundsMax.z += file.bounds[2];
|
||||
boundsMin.X += file.bounds[0];
|
||||
boundsMin.Y += file.bounds[1];
|
||||
boundsMin.Z += file.bounds[2];
|
||||
boundsMax.X += file.bounds[0];
|
||||
boundsMax.Y += file.bounds[1];
|
||||
boundsMax.Z += file.bounds[2];
|
||||
}
|
||||
|
||||
float cellSize = buf.GetFloat();
|
||||
|
|
|
@ -57,9 +57,9 @@ namespace DotRecast.Detour.Dynamic.Io
|
|||
Write(stream, f.useTiles);
|
||||
Write(stream, f.tileSizeX, byteOrder);
|
||||
Write(stream, f.tileSizeZ, byteOrder);
|
||||
Write(stream, f.rotation.x, byteOrder);
|
||||
Write(stream, f.rotation.y, byteOrder);
|
||||
Write(stream, f.rotation.z, byteOrder);
|
||||
Write(stream, f.rotation.X, byteOrder);
|
||||
Write(stream, f.rotation.Y, byteOrder);
|
||||
Write(stream, f.rotation.Z, byteOrder);
|
||||
Write(stream, f.bounds[0], byteOrder);
|
||||
Write(stream, f.bounds[1], byteOrder);
|
||||
Write(stream, f.bounds[2], byteOrder);
|
||||
|
@ -80,12 +80,12 @@ namespace DotRecast.Detour.Dynamic.Io
|
|||
Write(stream, tile.width, byteOrder);
|
||||
Write(stream, tile.depth, byteOrder);
|
||||
Write(stream, tile.borderSize, byteOrder);
|
||||
Write(stream, tile.boundsMin.x, byteOrder);
|
||||
Write(stream, tile.boundsMin.y, byteOrder);
|
||||
Write(stream, tile.boundsMin.z, byteOrder);
|
||||
Write(stream, tile.boundsMax.x, byteOrder);
|
||||
Write(stream, tile.boundsMax.y, byteOrder);
|
||||
Write(stream, tile.boundsMax.z, byteOrder);
|
||||
Write(stream, tile.boundsMin.X, byteOrder);
|
||||
Write(stream, tile.boundsMin.Y, byteOrder);
|
||||
Write(stream, tile.boundsMin.Z, byteOrder);
|
||||
Write(stream, tile.boundsMax.X, byteOrder);
|
||||
Write(stream, tile.boundsMax.Y, byteOrder);
|
||||
Write(stream, tile.boundsMax.Z, byteOrder);
|
||||
Write(stream, tile.cellSize, byteOrder);
|
||||
Write(stream, tile.cellHeight, byteOrder);
|
||||
byte[] bytes = tile.spanData;
|
||||
|
|
|
@ -51,12 +51,12 @@ namespace DotRecast.Detour.Extras
|
|||
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[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.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[2] = Math.Clamp((int)((bmax.z - data.header.bmin.z) * 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[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[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);
|
||||
}
|
||||
|
||||
return DtNavMeshBuilder.Subdivide(items, data.header.polyCount, 0, data.header.polyCount, 0, nodes);
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
seg.gsamples[i] = s;
|
||||
RcVec3f pt = RcVec3f.Lerp(seg.p, seg.q, u);
|
||||
bool success = heightFunc.Invoke(pt, seg.height, out var height);
|
||||
s.p.x = pt.x;
|
||||
s.p.y = height;
|
||||
s.p.z = pt.z;
|
||||
s.p.X = pt.X;
|
||||
s.p.Y = height;
|
||||
s.p.Z = pt.Z;
|
||||
|
||||
if (!success)
|
||||
{
|
||||
|
|
|
@ -9,9 +9,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
return new RcVec3f()
|
||||
{
|
||||
x = Lerp(start.x, end.x, Math.Min(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))
|
||||
X = Lerp(start.X, end.X, Math.Min(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))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,12 +58,12 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
int va = mesh.polys[p + j] * 3;
|
||||
int vb = mesh.polys[p + nj] * 3;
|
||||
JumpEdge e = new JumpEdge();
|
||||
e.sp.x = orig.x + mesh.verts[vb] * cs;
|
||||
e.sp.y = orig.y + mesh.verts[vb + 1] * ch;
|
||||
e.sp.z = orig.z + mesh.verts[vb + 2] * cs;
|
||||
e.sq.x = orig.x + mesh.verts[va] * cs;
|
||||
e.sq.y = orig.y + mesh.verts[va + 1] * ch;
|
||||
e.sq.z = orig.z + mesh.verts[va + 2] * cs;
|
||||
e.sp.X = orig.X + mesh.verts[vb] * cs;
|
||||
e.sp.Y = orig.Y + mesh.verts[vb + 1] * ch;
|
||||
e.sp.Z = orig.Z + mesh.verts[vb + 2] * cs;
|
||||
e.sq.X = orig.X + mesh.verts[va] * cs;
|
||||
e.sq.Y = orig.Y + mesh.verts[va + 1] * ch;
|
||||
e.sq.Z = orig.Z + mesh.verts[va + 2] * cs;
|
||||
edges.Add(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
this.trajectory = trajectory;
|
||||
ax = edge.sq.Subtract(edge.sp);
|
||||
ax.Normalize();
|
||||
az.Set(ax.z, 0, -ax.x);
|
||||
az.Set(ax.Z, 0, -ax.X);
|
||||
az.Normalize();
|
||||
ay.Set(0, 1, 0);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
EdgeSampler es = new EdgeSampler(edge, new JumpTrajectory(acfg.jumpHeight));
|
||||
es.start.height = acfg.agentClimb * 2;
|
||||
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.q, edge.sq, offset);
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
float v = (float)j / (float)(nsamples - 1);
|
||||
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();
|
||||
end.height = acfg.heightRange;
|
||||
Vadd(ref end.p, edge.sp, offset);
|
||||
|
@ -58,11 +58,11 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
EdgeSampler es = new EdgeSampler(edge, new ClimbTrajectory());
|
||||
es.start.height = acfg.agentClimb * 2;
|
||||
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.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();
|
||||
end.height = acfg.heightRange;
|
||||
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)
|
||||
{
|
||||
dest.x = v1.x + v2.x;
|
||||
dest.y = v1.y + v2.y;
|
||||
dest.z = v1.z + v2.z;
|
||||
dest.X = v1.X + v2.X;
|
||||
dest.Y = v1.Y + v2.Y;
|
||||
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)
|
||||
{
|
||||
dst.x = ax.x * pt.x + ay.x * pt.y;
|
||||
dst.y = ax.y * pt.x + ay.y * pt.y;
|
||||
dst.z = ax.z * pt.x + ay.z * pt.y;
|
||||
dst.X = ax.X * pt.X + ay.X * pt.Y;
|
||||
dst.Y = ax.Y * pt.X + ay.Y * pt.Y;
|
||||
dst.Z = ax.Z * pt.X + ay.Z * pt.Y;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,14 +72,14 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
float u = ((float)j) / (link.nspine - 1);
|
||||
RcVec3f p = es.trajectory.Apply(sp, ep, u);
|
||||
link.spine0[j * 3] = p.x;
|
||||
link.spine0[j * 3 + 1] = p.y;
|
||||
link.spine0[j * 3 + 2] = p.z;
|
||||
link.spine0[j * 3] = p.X;
|
||||
link.spine0[j * 3 + 1] = p.Y;
|
||||
link.spine0[j * 3 + 2] = p.Z;
|
||||
|
||||
p = es.trajectory.Apply(sq, eq, u);
|
||||
link.spine1[j * 3] = p.x;
|
||||
link.spine1[j * 3 + 1] = p.y;
|
||||
link.spine1[j * 3 + 2] = p.z;
|
||||
link.spine1[j * 3] = p.X;
|
||||
link.spine1[j * 3 + 1] = p.Y;
|
||||
link.spine1[j * 3 + 2] = p.Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
GroundSample p = es.end[j].gsamples[i];
|
||||
sampleGrid[i][j] = region;
|
||||
float h = p.p.y;
|
||||
float h = p.p.Y;
|
||||
if (i < sampleGrid.Length - 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 });
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
return new RcVec3f
|
||||
{
|
||||
x = Lerp(start.x, end.x, u),
|
||||
y = InterpolateHeight(start.y, end.y, u),
|
||||
z = Lerp(start.z, end.z, u)
|
||||
X = Lerp(start.X, end.X, u),
|
||||
Y = InterpolateHeight(start.Y, end.Y, u),
|
||||
Z = Lerp(start.Z, end.Z, u)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
height = default;
|
||||
|
||||
RcVec3f halfExtents = new RcVec3f { x = cs, y = heightRange, z = cs };
|
||||
float maxHeight = pt.y + heightRange;
|
||||
RcVec3f halfExtents = new RcVec3f { X = cs, Y = heightRange, Z = cs };
|
||||
float maxHeight = pt.Y + heightRange;
|
||||
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) =>
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
return true;
|
||||
}
|
||||
|
||||
height = pt.y;
|
||||
height = pt.Y;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,13 +35,13 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
private bool SampleTrajectory(JumpLinkBuilderConfig acfg, RcHeightfield solid, RcVec3f pa, RcVec3f pb, Trajectory tra)
|
||||
{
|
||||
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));
|
||||
for (int i = 0; i < nsamples; ++i)
|
||||
{
|
||||
float u = (float)i / (float)(nsamples - 1);
|
||||
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;
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
float cs = solid.cs;
|
||||
float ch = solid.ch;
|
||||
RcVec3f orig = solid.bmin;
|
||||
int ix = (int)Math.Floor((x - orig.x) / cs);
|
||||
int iz = (int)Math.Floor((z - orig.z) / cs);
|
||||
int ix = (int)Math.Floor((x - orig.X) / cs);
|
||||
int iz = (int)Math.Floor((z - orig.Z) / cs);
|
||||
|
||||
if (ix < 0 || iz < 0 || ix > w || iz > h)
|
||||
{
|
||||
|
@ -73,8 +73,8 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
|
||||
while (s != null)
|
||||
{
|
||||
float symin = orig.y + s.smin * ch;
|
||||
float symax = orig.y + s.smax * ch;
|
||||
float symin = orig.Y + s.smin * ch;
|
||||
float symax = orig.Y + s.smax * ch;
|
||||
if (OverlapRange(ymin, ymax, symin, symax))
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -126,15 +126,15 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
|||
header.detailMeshCount = nodeCount;
|
||||
header.detailTriCount = nodeCount;
|
||||
header.maxLinkCount = nodeCount * 3 * 2; // XXX: Needed by Recast, not needed by recast4j
|
||||
header.bmin.x = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x
|
||||
header.bmin.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x
|
||||
+ meta.cellSize * meta.tileSizeX * x;
|
||||
header.bmin.y = ymin;
|
||||
header.bmin.z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z
|
||||
header.bmin.Y = ymin;
|
||||
header.bmin.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z
|
||||
+ meta.cellSize * meta.tileSizeZ * z;
|
||||
header.bmax.x = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x
|
||||
header.bmax.X = meta.forcedBoundsCenter.x - 0.5f * meta.forcedBoundsSize.x
|
||||
+ meta.cellSize * meta.tileSizeX * (x + 1);
|
||||
header.bmax.y = ymax;
|
||||
header.bmax.z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z
|
||||
header.bmax.Y = ymax;
|
||||
header.bmax.Z = meta.forcedBoundsCenter.z - 0.5f * meta.forcedBoundsSize.z
|
||||
+ meta.cellSize * meta.tileSizeZ * (z + 1);
|
||||
header.bvQuantFactor = 1.0f / meta.cellSize;
|
||||
header.offMeshBase = nodeCount;
|
||||
|
|
|
@ -63,21 +63,21 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
|||
// In case of external link to other tiles we must find the direction
|
||||
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
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,13 +36,13 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
|||
int connectedNode1 = buffer.GetInt();
|
||||
int connectedNode2 = buffer.GetInt();
|
||||
RcVec3f clamped1 = new RcVec3f();
|
||||
clamped1.x = buffer.GetFloat();
|
||||
clamped1.y = buffer.GetFloat();
|
||||
clamped1.z = buffer.GetFloat();
|
||||
clamped1.X = buffer.GetFloat();
|
||||
clamped1.Y = buffer.GetFloat();
|
||||
clamped1.Z = buffer.GetFloat();
|
||||
RcVec3f clamped2 = new RcVec3f();
|
||||
clamped2.x = buffer.GetFloat();
|
||||
clamped2.y = buffer.GetFloat();
|
||||
clamped2.z = buffer.GetFloat();
|
||||
clamped2.X = buffer.GetFloat();
|
||||
clamped2.Y = buffer.GetFloat();
|
||||
clamped2.Z = buffer.GetFloat();
|
||||
bool postScanCalled = buffer.Get() != 0;
|
||||
links[i] = new NodeLink2(linkID, startNode, endNode, clamped1, clamped2);
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
|||
connection.poly = poly;
|
||||
connection.pos = new float[]
|
||||
{
|
||||
l.clamped1.x, l.clamped1.y, l.clamped1.z,
|
||||
l.clamped2.x, l.clamped2.y, l.clamped2.z
|
||||
l.clamped1.X, l.clamped1.Y, l.clamped1.Z,
|
||||
l.clamped2.X, l.clamped2.Y, l.clamped2.Z
|
||||
};
|
||||
connection.rad = 0.1f;
|
||||
connection.side = startTile == endTile
|
||||
|
|
|
@ -63,9 +63,9 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
|||
option.maxPolys = 32768;
|
||||
option.tileWidth = graphMeta.tileSizeX * graphMeta.cellSize;
|
||||
option.tileHeight = graphMeta.tileSizeZ * graphMeta.cellSize;
|
||||
option.orig.x = -0.5f * graphMeta.forcedBoundsSize.x + graphMeta.forcedBoundsCenter.x;
|
||||
option.orig.y = -0.5f * graphMeta.forcedBoundsSize.y + graphMeta.forcedBoundsCenter.y;
|
||||
option.orig.z = -0.5f * graphMeta.forcedBoundsSize.z + graphMeta.forcedBoundsCenter.z;
|
||||
option.orig.X = -0.5f * graphMeta.forcedBoundsSize.x + graphMeta.forcedBoundsCenter.x;
|
||||
option.orig.Y = -0.5f * graphMeta.forcedBoundsSize.y + graphMeta.forcedBoundsCenter.y;
|
||||
option.orig.Z = -0.5f * graphMeta.forcedBoundsSize.z + graphMeta.forcedBoundsCenter.z;
|
||||
DtNavMesh mesh = new DtNavMesh(option, 3);
|
||||
foreach (DtMeshData t in graphMeshData.tiles)
|
||||
{
|
||||
|
|
|
@ -441,10 +441,10 @@ namespace DotRecast.Detour.TileCache
|
|||
List<long> results = new List<long>();
|
||||
float tw = m_params.width * m_params.cs;
|
||||
float th = m_params.height * m_params.cs;
|
||||
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 ty0 = (int)Math.Floor((bmin.z - m_params.orig.z) / th);
|
||||
int ty1 = (int)Math.Floor((bmax.z - m_params.orig.z) / th);
|
||||
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 ty0 = (int)Math.Floor((bmin.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 tx = tx0; tx <= tx1; ++tx)
|
||||
|
@ -682,24 +682,24 @@ namespace DotRecast.Detour.TileCache
|
|||
void CalcTightTileBounds(DtTileCacheLayerHeader header, ref RcVec3f bmin, ref RcVec3f bmax)
|
||||
{
|
||||
float cs = m_params.cs;
|
||||
bmin.x = header.bmin.x + header.minx * cs;
|
||||
bmin.y = header.bmin.y;
|
||||
bmin.z = header.bmin.z + header.miny * cs;
|
||||
bmax.x = header.bmin.x + (header.maxx + 1) * cs;
|
||||
bmax.y = header.bmax.y;
|
||||
bmax.z = header.bmin.z + (header.maxy + 1) * cs;
|
||||
bmin.X = header.bmin.X + header.minx * cs;
|
||||
bmin.Y = header.bmin.Y;
|
||||
bmin.Z = header.bmin.Z + header.miny * cs;
|
||||
bmax.X = header.bmin.X + (header.maxx + 1) * cs;
|
||||
bmax.Y = header.bmax.Y;
|
||||
bmax.Z = header.bmin.Z + (header.maxy + 1) * cs;
|
||||
}
|
||||
|
||||
public void GetObstacleBounds(DtTileCacheObstacle ob, ref RcVec3f bmin, ref RcVec3f bmax)
|
||||
{
|
||||
if (ob.type == DtTileCacheObstacleType.CYLINDER)
|
||||
{
|
||||
bmin.x = ob.pos.x - ob.radius;
|
||||
bmin.y = ob.pos.y;
|
||||
bmin.z = ob.pos.z - ob.radius;
|
||||
bmax.x = ob.pos.x + ob.radius;
|
||||
bmax.y = ob.pos.y + ob.height;
|
||||
bmax.z = ob.pos.z + ob.radius;
|
||||
bmin.X = ob.pos.X - ob.radius;
|
||||
bmin.Y = ob.pos.Y;
|
||||
bmin.Z = ob.pos.Z - ob.radius;
|
||||
bmax.X = ob.pos.X + ob.radius;
|
||||
bmax.Y = ob.pos.Y + ob.height;
|
||||
bmax.Z = ob.pos.Z + ob.radius;
|
||||
}
|
||||
else if (ob.type == DtTileCacheObstacleType.BOX)
|
||||
{
|
||||
|
@ -708,13 +708,13 @@ namespace DotRecast.Detour.TileCache
|
|||
}
|
||||
else if (ob.type == DtTileCacheObstacleType.ORIENTED_BOX)
|
||||
{
|
||||
float maxr = 1.41f * Math.Max(ob.extents.x, ob.extents.z);
|
||||
bmin.x = ob.center.x - maxr;
|
||||
bmax.x = ob.center.x + maxr;
|
||||
bmin.y = ob.center.y - ob.extents.y;
|
||||
bmax.y = ob.center.y + ob.extents.y;
|
||||
bmin.z = ob.center.z - maxr;
|
||||
bmax.z = ob.center.z + maxr;
|
||||
float maxr = 1.41f * Math.Max(ob.extents.X, ob.extents.Z);
|
||||
bmin.X = ob.center.X - maxr;
|
||||
bmax.X = ob.center.X + maxr;
|
||||
bmin.Y = ob.center.Y - ob.extents.Y;
|
||||
bmax.Y = ob.center.Y + ob.extents.Y;
|
||||
bmin.Z = ob.center.Z - maxr;
|
||||
bmax.Z = ob.center.Z + maxr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1804,12 +1804,12 @@ namespace DotRecast.Detour.TileCache
|
|||
{
|
||||
RcVec3f bmin = new RcVec3f();
|
||||
RcVec3f bmax = new RcVec3f();
|
||||
bmin.x = pos.x - radius;
|
||||
bmin.y = pos.y;
|
||||
bmin.z = pos.z - radius;
|
||||
bmax.x = pos.x + radius;
|
||||
bmax.y = pos.y + height;
|
||||
bmax.z = pos.z + radius;
|
||||
bmin.X = pos.X - radius;
|
||||
bmin.Y = pos.Y;
|
||||
bmin.Z = pos.Z - radius;
|
||||
bmax.X = pos.X + radius;
|
||||
bmax.Y = pos.Y + height;
|
||||
bmax.Z = pos.Z + radius;
|
||||
float r2 = RcMath.Sqr(radius / cs + 0.5f);
|
||||
|
||||
int w = layer.header.width;
|
||||
|
@ -1817,15 +1817,15 @@ namespace DotRecast.Detour.TileCache
|
|||
float ics = 1.0f / cs;
|
||||
float ich = 1.0f / ch;
|
||||
|
||||
float px = (pos.x - orig.x) * ics;
|
||||
float pz = (pos.z - orig.z) * ics;
|
||||
float px = (pos.X - orig.X) * ics;
|
||||
float pz = (pos.Z - orig.Z) * ics;
|
||||
|
||||
int minx = (int)Math.Floor((bmin.x - orig.x) * ics);
|
||||
int miny = (int)Math.Floor((bmin.y - orig.y) * ich);
|
||||
int minz = (int)Math.Floor((bmin.z - orig.z) * ics);
|
||||
int maxx = (int)Math.Floor((bmax.x - orig.x) * ics);
|
||||
int maxy = (int)Math.Floor((bmax.y - orig.y) * ich);
|
||||
int maxz = (int)Math.Floor((bmax.z - orig.z) * ics);
|
||||
int minx = (int)Math.Floor((bmin.X - orig.X) * ics);
|
||||
int miny = (int)Math.Floor((bmin.Y - orig.Y) * ich);
|
||||
int minz = (int)Math.Floor((bmin.Z - orig.Z) * ics);
|
||||
int maxx = (int)Math.Floor((bmax.X - orig.X) * ics);
|
||||
int maxy = (int)Math.Floor((bmax.Y - orig.Y) * ich);
|
||||
int maxz = (int)Math.Floor((bmax.Z - orig.Z) * ics);
|
||||
|
||||
if (maxx < 0)
|
||||
return;
|
||||
|
@ -1868,12 +1868,12 @@ namespace DotRecast.Detour.TileCache
|
|||
float ics = 1.0f / cs;
|
||||
float ich = 1.0f / ch;
|
||||
|
||||
int minx = (int)Math.Floor((bmin.x - orig.x) * ics);
|
||||
int miny = (int)Math.Floor((bmin.y - orig.y) * ich);
|
||||
int minz = (int)Math.Floor((bmin.z - orig.z) * ics);
|
||||
int maxx = (int)Math.Floor((bmax.x - orig.x) * ics);
|
||||
int maxy = (int)Math.Floor((bmax.y - orig.y) * ich);
|
||||
int maxz = (int)Math.Floor((bmax.z - orig.z) * ics);
|
||||
int minx = (int)Math.Floor((bmin.X - orig.X) * ics);
|
||||
int miny = (int)Math.Floor((bmin.Y - orig.Y) * ich);
|
||||
int minz = (int)Math.Floor((bmin.Z - orig.Z) * ics);
|
||||
int maxx = (int)Math.Floor((bmax.X - orig.X) * ics);
|
||||
int maxy = (int)Math.Floor((bmax.Y - orig.Y) * ich);
|
||||
int maxz = (int)Math.Floor((bmax.Z - orig.Z) * ics);
|
||||
|
||||
if (maxx < 0)
|
||||
return;
|
||||
|
@ -1997,16 +1997,16 @@ namespace DotRecast.Detour.TileCache
|
|||
float ics = 1.0f / cs;
|
||||
float ich = 1.0f / ch;
|
||||
|
||||
float cx = (center.x - orig.x) * ics;
|
||||
float cz = (center.z - orig.z) * ics;
|
||||
float cx = (center.X - orig.X) * 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 maxx = (int)Math.Floor(cx + maxr * ics);
|
||||
int minz = (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 maxy = (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);
|
||||
|
||||
if (maxx < 0)
|
||||
return;
|
||||
|
@ -2026,8 +2026,8 @@ namespace DotRecast.Detour.TileCache
|
|||
if (maxz >= h)
|
||||
maxz = h - 1;
|
||||
|
||||
float xhalf = extents.x * ics + 0.5f;
|
||||
float zhalf = extents.z * ics + 0.5f;
|
||||
float xhalf = extents.X * ics + 0.5f;
|
||||
float zhalf = extents.Z * ics + 0.5f;
|
||||
for (int z = minz; z <= maxz; ++z)
|
||||
{
|
||||
for (int x = minx; x <= maxx; ++x)
|
||||
|
|
|
@ -40,12 +40,12 @@ namespace DotRecast.Detour.TileCache.Io
|
|||
header.ty = data.GetInt();
|
||||
header.tlayer = data.GetInt();
|
||||
|
||||
header.bmin.x = data.GetFloat();
|
||||
header.bmin.y = data.GetFloat();
|
||||
header.bmin.z = data.GetFloat();
|
||||
header.bmax.x = data.GetFloat();
|
||||
header.bmax.y = data.GetFloat();
|
||||
header.bmax.z = data.GetFloat();
|
||||
header.bmin.X = data.GetFloat();
|
||||
header.bmin.Y = data.GetFloat();
|
||||
header.bmin.Z = data.GetFloat();
|
||||
header.bmax.X = data.GetFloat();
|
||||
header.bmax.Y = data.GetFloat();
|
||||
header.bmax.Z = data.GetFloat();
|
||||
|
||||
header.hmin = data.GetShort() & 0xFFFF;
|
||||
header.hmax = data.GetShort() & 0xFFFF;
|
||||
|
|
|
@ -34,12 +34,12 @@ namespace DotRecast.Detour.TileCache.Io
|
|||
Write(stream, header.ty, order);
|
||||
Write(stream, header.tlayer, order);
|
||||
|
||||
Write(stream, header.bmin.x, order);
|
||||
Write(stream, header.bmin.y, order);
|
||||
Write(stream, header.bmin.z, order);
|
||||
Write(stream, header.bmax.x, order);
|
||||
Write(stream, header.bmax.y, order);
|
||||
Write(stream, header.bmax.z, order);
|
||||
Write(stream, header.bmin.X, order);
|
||||
Write(stream, header.bmin.Y, order);
|
||||
Write(stream, header.bmin.Z, order);
|
||||
Write(stream, header.bmax.X, order);
|
||||
Write(stream, header.bmax.Y, order);
|
||||
Write(stream, header.bmax.Z, order);
|
||||
|
||||
Write(stream, (short)header.hmin, order);
|
||||
Write(stream, (short)header.hmax, order);
|
||||
|
|
|
@ -98,9 +98,9 @@ namespace DotRecast.Detour.TileCache.Io
|
|||
{
|
||||
DtTileCacheParams option = new DtTileCacheParams();
|
||||
|
||||
option.orig.x = bb.GetFloat();
|
||||
option.orig.y = bb.GetFloat();
|
||||
option.orig.z = bb.GetFloat();
|
||||
option.orig.X = bb.GetFloat();
|
||||
option.orig.Y = bb.GetFloat();
|
||||
option.orig.Z = bb.GetFloat();
|
||||
|
||||
option.cs = bb.GetFloat();
|
||||
option.ch = bb.GetFloat();
|
||||
|
|
|
@ -72,9 +72,9 @@ namespace DotRecast.Detour.TileCache.Io
|
|||
|
||||
private void WriteCacheParams(BinaryWriter stream, DtTileCacheParams option, RcByteOrder order)
|
||||
{
|
||||
Write(stream, option.orig.x, order);
|
||||
Write(stream, option.orig.y, order);
|
||||
Write(stream, option.orig.z, order);
|
||||
Write(stream, option.orig.X, order);
|
||||
Write(stream, option.orig.Y, order);
|
||||
Write(stream, option.orig.Z, order);
|
||||
|
||||
Write(stream, option.cs, order);
|
||||
Write(stream, option.ch, order);
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace DotRecast.Detour
|
|||
RcVec3f A = a.Subtract(a1);
|
||||
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 bHA = DtUtils.TriArea2D(a1, a, b);
|
||||
if (Math.Abs(cross) < EPSILON)
|
||||
|
@ -179,20 +179,20 @@ namespace DotRecast.Detour
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
inters[ii] = p.x;
|
||||
inters[ii + 1] = p.y;
|
||||
inters[ii + 2] = p.z;
|
||||
inters[ii] = p.X;
|
||||
inters[ii + 1] = p.Y;
|
||||
inters[ii + 2] = p.Z;
|
||||
return ii + 3;
|
||||
}
|
||||
|
||||
|
@ -217,9 +217,9 @@ namespace DotRecast.Detour
|
|||
{
|
||||
if (s >= 0.0f && s <= 1.0f && t >= 0.0f && t <= 1.0f)
|
||||
{
|
||||
p.x = a.x + (b.x - a.x) * s;
|
||||
p.y = a.y + (b.y - a.y) * s;
|
||||
p.z = a.z + (b.z - a.z) * s;
|
||||
p.X = a.X + (b.X - a.X) * s;
|
||||
p.Y = a.Y + (b.Y - a.Y) * s;
|
||||
p.Z = a.Z + (b.Z - a.Z) * s;
|
||||
return DtConvexConvexIntersection.Single;
|
||||
}
|
||||
}
|
||||
|
@ -276,13 +276,13 @@ namespace DotRecast.Detour
|
|||
|
||||
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
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace DotRecast.Detour
|
|||
RcVec3f diff = _center.Subtract(closestPtPoly);
|
||||
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;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -106,8 +106,8 @@ namespace DotRecast.Detour
|
|||
{
|
||||
DtNavMeshParams option = new DtNavMeshParams();
|
||||
option.orig = data.header.bmin;
|
||||
option.tileWidth = data.header.bmax.x - data.header.bmin.x;
|
||||
option.tileHeight = data.header.bmax.z - data.header.bmin.z;
|
||||
option.tileWidth = data.header.bmax.X - data.header.bmin.X;
|
||||
option.tileHeight = data.header.bmax.Z - data.header.bmin.Z;
|
||||
option.maxTiles = 1;
|
||||
option.maxPolys = data.header.polyCount;
|
||||
return option;
|
||||
|
@ -241,8 +241,8 @@ namespace DotRecast.Detour
|
|||
*/
|
||||
public void CalcTileLoc(RcVec3f pos, out int tx, out int ty)
|
||||
{
|
||||
tx = (int)Math.Floor((pos.x - m_orig.x) / m_tileWidth);
|
||||
ty = (int)Math.Floor((pos.z - m_orig.z) / m_tileHeight);
|
||||
tx = (int)Math.Floor((pos.X - m_orig.X) / m_tileWidth);
|
||||
ty = (int)Math.Floor((pos.Z - m_orig.Z) / m_tileHeight);
|
||||
}
|
||||
|
||||
/// Gets the tile and polygon for the specified polygon reference.
|
||||
|
@ -343,12 +343,12 @@ namespace DotRecast.Detour
|
|||
int[] bmin = new int[3];
|
||||
int[] bmax = new int[3];
|
||||
// dtClamp query box to world box.
|
||||
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 minz = Math.Clamp(qmin.z, tbmin.z, tbmax.z) - tbmin.z;
|
||||
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 maxz = Math.Clamp(qmax.z, tbmin.z, tbmax.z) - tbmin.z;
|
||||
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 minz = Math.Clamp(qmin.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
|
||||
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 maxz = Math.Clamp(qmax.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
|
||||
// Quantize
|
||||
bmin[0] = (int)(qfac * minx) & 0x7ffffffe;
|
||||
bmin[1] = (int)(qfac * miny) & 0x7ffffffe;
|
||||
|
@ -831,16 +831,16 @@ namespace DotRecast.Detour
|
|||
|
||||
var ext = new RcVec3f()
|
||||
{
|
||||
x = targetCon.rad,
|
||||
y = target.data.header.walkableClimb,
|
||||
z = targetCon.rad
|
||||
X = targetCon.rad,
|
||||
Y = target.data.header.walkableClimb,
|
||||
Z = targetCon.rad
|
||||
};
|
||||
|
||||
// Find polygon to connect to.
|
||||
RcVec3f p = new RcVec3f();
|
||||
p.x = targetCon.pos[3];
|
||||
p.y = targetCon.pos[4];
|
||||
p.z = targetCon.pos[5];
|
||||
p.X = targetCon.pos[3];
|
||||
p.Y = targetCon.pos[4];
|
||||
p.Z = targetCon.pos[5];
|
||||
var refs = FindNearestPolyInTile(tile, p, ext, out var nearestPt);
|
||||
if (refs == 0)
|
||||
{
|
||||
|
@ -850,15 +850,15 @@ namespace DotRecast.Detour
|
|||
// findNearestPoly may return too optimistic results, further check
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Make sure the location is on current mesh.
|
||||
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 + 2] = nearestPt.z;
|
||||
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 + 2] = nearestPt.Z;
|
||||
|
||||
// Link off-mesh connection to target poly.
|
||||
int idx = AllocLink(target);
|
||||
|
@ -940,8 +940,8 @@ namespace DotRecast.Detour
|
|||
|
||||
// Add return value.
|
||||
long refs = @base | (long)i;
|
||||
float tmin = Math.Max(amin.x, bmin.x);
|
||||
float tmax = Math.Min(amax.x, bmax.x);
|
||||
float tmin = Math.Max(amin.X, bmin.X);
|
||||
float tmax = Math.Min(amax.X, bmax.X);
|
||||
cons.Add(new DtConnectPoly(refs, tmin, tmax));
|
||||
n++;
|
||||
break;
|
||||
|
@ -971,34 +971,34 @@ namespace DotRecast.Detour
|
|||
{
|
||||
if (verts[va + 2] < verts[vb + 2])
|
||||
{
|
||||
bmin.x = verts[va + 2];
|
||||
bmin.y = verts[va + 1];
|
||||
bmax.x = verts[vb + 2];
|
||||
bmax.y = verts[vb + 1];
|
||||
bmin.X = verts[va + 2];
|
||||
bmin.Y = verts[va + 1];
|
||||
bmax.X = verts[vb + 2];
|
||||
bmax.Y = verts[vb + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
bmin.x = verts[vb + 2];
|
||||
bmin.y = verts[vb + 1];
|
||||
bmax.x = verts[va + 2];
|
||||
bmax.y = verts[va + 1];
|
||||
bmin.X = verts[vb + 2];
|
||||
bmin.Y = verts[vb + 1];
|
||||
bmax.X = verts[va + 2];
|
||||
bmax.Y = verts[va + 1];
|
||||
}
|
||||
}
|
||||
else if (side == 2 || side == 6)
|
||||
{
|
||||
if (verts[va + 0] < verts[vb + 0])
|
||||
{
|
||||
bmin.x = verts[va + 0];
|
||||
bmin.y = verts[va + 1];
|
||||
bmax.x = verts[vb + 0];
|
||||
bmax.y = verts[vb + 1];
|
||||
bmin.X = verts[va + 0];
|
||||
bmin.Y = verts[va + 1];
|
||||
bmax.X = verts[vb + 0];
|
||||
bmax.Y = verts[vb + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
bmin.x = verts[vb + 0];
|
||||
bmin.y = verts[vb + 1];
|
||||
bmax.x = verts[va + 0];
|
||||
bmax.y = verts[va + 1];
|
||||
bmin.X = verts[vb + 0];
|
||||
bmin.Y = verts[vb + 1];
|
||||
bmax.X = verts[va + 0];
|
||||
bmax.Y = verts[va + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1008,18 +1008,18 @@ namespace DotRecast.Detour
|
|||
// Check for horizontal overlap.
|
||||
// The segment is shrunken a little so that slabs which touch
|
||||
// at end points are not connected.
|
||||
float minx = Math.Max(amin.x + px, bmin.x + px);
|
||||
float maxx = Math.Min(amax.x - px, bmax.x - px);
|
||||
float minx = Math.Max(amin.X + px, bmin.X + px);
|
||||
float maxx = Math.Min(amax.X - px, bmax.X - px);
|
||||
if (minx > maxx)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check vertical overlap.
|
||||
float ad = (amax.y - amin.y) / (amax.x - amin.x);
|
||||
float ak = amin.y - ad * amin.x;
|
||||
float bd = (bmax.y - bmin.y) / (bmax.x - bmin.x);
|
||||
float bk = bmin.y - bd * bmin.x;
|
||||
float ad = (amax.Y - amin.Y) / (amax.X - amin.X);
|
||||
float ak = amin.Y - ad * amin.X;
|
||||
float bd = (bmax.Y - bmin.Y) / (bmax.X - bmin.X);
|
||||
float bk = bmin.Y - bd * bmin.X;
|
||||
float aminy = ad * minx + ak;
|
||||
float amaxy = ad * maxx + ak;
|
||||
float bminy = bd * minx + bk;
|
||||
|
@ -1065,9 +1065,9 @@ namespace DotRecast.Detour
|
|||
|
||||
var ext = new RcVec3f()
|
||||
{
|
||||
x = con.rad,
|
||||
y = tile.data.header.walkableClimb,
|
||||
z = con.rad,
|
||||
X = con.rad,
|
||||
Y = tile.data.header.walkableClimb,
|
||||
Z = con.rad,
|
||||
};
|
||||
|
||||
// Find polygon to connect to.
|
||||
|
@ -1080,15 +1080,15 @@ namespace DotRecast.Detour
|
|||
float[] p = con.pos; // First vertex
|
||||
// findNearestPoly may return too optimistic results, further check
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Make sure the location is on current mesh.
|
||||
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 + 2] = nearestPt.z;
|
||||
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 + 2] = nearestPt.Z;
|
||||
|
||||
// Link off-mesh connection to target poly.
|
||||
int idx = AllocLink(tile);
|
||||
|
@ -1154,9 +1154,9 @@ namespace DotRecast.Detour
|
|||
int index = poly.verts[tris[ti + j]] * 3;
|
||||
v[j] = new RcVec3f
|
||||
{
|
||||
x = tile.data.verts[index],
|
||||
y = tile.data.verts[index + 1],
|
||||
z = tile.data.verts[index + 2]
|
||||
X = tile.data.verts[index],
|
||||
Y = tile.data.verts[index + 1],
|
||||
Z = tile.data.verts[index + 2]
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -1164,9 +1164,9 @@ namespace DotRecast.Detour
|
|||
int index = (pd.vertBase + (tris[ti + j] - poly.vertCount)) * 3;
|
||||
v[j] = new RcVec3f
|
||||
{
|
||||
x = tile.data.detailVerts[index],
|
||||
y = tile.data.detailVerts[index + 1],
|
||||
z = tile.data.detailVerts[index + 2]
|
||||
X = tile.data.detailVerts[index],
|
||||
Y = tile.data.detailVerts[index + 1],
|
||||
Z = tile.data.detailVerts[index + 2]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1198,12 +1198,12 @@ namespace DotRecast.Detour
|
|||
for (int j = 0; j < poly.vertCount; ++j)
|
||||
{
|
||||
int k = (j + 1) % poly.vertCount;
|
||||
v[0].x = tile.data.verts[poly.verts[j] * 3];
|
||||
v[0].y = tile.data.verts[poly.verts[j] * 3 + 1];
|
||||
v[0].z = tile.data.verts[poly.verts[j] * 3 + 2];
|
||||
v[1].x = tile.data.verts[poly.verts[k] * 3];
|
||||
v[1].y = tile.data.verts[poly.verts[k] * 3 + 1];
|
||||
v[1].z = tile.data.verts[poly.verts[k] * 3 + 2];
|
||||
v[0].X = tile.data.verts[poly.verts[j] * 3];
|
||||
v[0].Y = tile.data.verts[poly.verts[j] * 3 + 1];
|
||||
v[0].Z = tile.data.verts[poly.verts[j] * 3 + 2];
|
||||
v[1].X = tile.data.verts[poly.verts[k] * 3];
|
||||
v[1].Y = tile.data.verts[poly.verts[k] * 3 + 1];
|
||||
v[1].Z = tile.data.verts[poly.verts[k] * 3 + 2];
|
||||
|
||||
var d = DtUtils.DistancePtSegSqr2D(pos, v[0], v[1], out var t);
|
||||
if (d < dmin)
|
||||
|
@ -1259,9 +1259,9 @@ namespace DotRecast.Detour
|
|||
int index = poly.verts[tile.data.detailTris[t + k]] * 3;
|
||||
v[k] = new RcVec3f
|
||||
{
|
||||
x = tile.data.verts[index],
|
||||
y = tile.data.verts[index + 1],
|
||||
z = tile.data.verts[index + 2]
|
||||
X = tile.data.verts[index],
|
||||
Y = tile.data.verts[index + 1],
|
||||
Z = tile.data.verts[index + 2]
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -1269,9 +1269,9 @@ namespace DotRecast.Detour
|
|||
int index = (pd.vertBase + (tile.data.detailTris[t + k] - poly.vertCount)) * 3;
|
||||
v[k] = new RcVec3f
|
||||
{
|
||||
x = tile.data.detailVerts[index],
|
||||
y = tile.data.detailVerts[index + 1],
|
||||
z = tile.data.detailVerts[index + 2]
|
||||
X = tile.data.detailVerts[index],
|
||||
Y = tile.data.detailVerts[index + 1],
|
||||
Z = tile.data.detailVerts[index + 2]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1286,16 +1286,16 @@ namespace DotRecast.Detour
|
|||
else
|
||||
{
|
||||
RcVec3f[] v = new RcVec3f[3];
|
||||
v[0].x = tile.data.verts[poly.verts[0] * 3];
|
||||
v[0].y = tile.data.verts[poly.verts[0] * 3 + 1];
|
||||
v[0].z = tile.data.verts[poly.verts[0] * 3 + 2];
|
||||
v[0].X = tile.data.verts[poly.verts[0] * 3];
|
||||
v[0].Y = tile.data.verts[poly.verts[0] * 3 + 1];
|
||||
v[0].Z = tile.data.verts[poly.verts[0] * 3 + 2];
|
||||
for (int j = 1; j < poly.vertCount - 1; ++j)
|
||||
{
|
||||
for (int k = 0; k < 2; ++k)
|
||||
{
|
||||
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].z = tile.data.verts[poly.verts[j + k] * 3 + 2];
|
||||
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].Z = tile.data.verts[poly.verts[j + k] * 3 + 2];
|
||||
}
|
||||
|
||||
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
|
||||
// ok.
|
||||
var closest = ClosestPointOnDetailEdges(tile, poly, pos, false);
|
||||
height = closest.y;
|
||||
height = closest.Y;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1322,7 @@ namespace DotRecast.Detour
|
|||
|
||||
if (GetPolyHeight(tile, poly, pos, out var h))
|
||||
{
|
||||
closest.y = h;
|
||||
closest.Y = h;
|
||||
posOverPoly = true;
|
||||
return;
|
||||
}
|
||||
|
@ -1333,9 +1333,9 @@ namespace DotRecast.Detour
|
|||
if (poly.GetPolyType() == DtPolyTypes.DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||
{
|
||||
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;
|
||||
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);
|
||||
closest = RcVec3f.Lerp(v0, v1, t);
|
||||
return;
|
||||
|
@ -1371,7 +1371,7 @@ namespace DotRecast.Detour
|
|||
RcVec3f diff = center.Subtract(closestPtPoly);
|
||||
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;
|
||||
}
|
||||
else
|
||||
|
@ -1730,15 +1730,15 @@ namespace DotRecast.Detour
|
|||
for (int i = 0; i < poly.vertCount; ++i)
|
||||
{
|
||||
int v = poly.verts[i] * 3;
|
||||
center.x += tile.data.verts[v];
|
||||
center.y += tile.data.verts[v + 1];
|
||||
center.z += tile.data.verts[v + 2];
|
||||
center.X += tile.data.verts[v];
|
||||
center.Y += tile.data.verts[v + 1];
|
||||
center.Z += tile.data.verts[v + 2];
|
||||
}
|
||||
|
||||
float s = 1.0f / poly.vertCount;
|
||||
center.x *= s;
|
||||
center.y *= s;
|
||||
center.z *= s;
|
||||
center.X *= s;
|
||||
center.Y *= s;
|
||||
center.Z *= s;
|
||||
}
|
||||
|
||||
return center;
|
||||
|
@ -1781,12 +1781,12 @@ namespace DotRecast.Detour
|
|||
{
|
||||
for (int i = 0; i < tile.data.verts.Length; i += 3)
|
||||
{
|
||||
bmin.x = Math.Min(bmin.x, tile.data.verts[i]);
|
||||
bmin.y = Math.Min(bmin.y, tile.data.verts[i + 1]);
|
||||
bmin.z = Math.Min(bmin.z, tile.data.verts[i + 2]);
|
||||
bmax.x = Math.Max(bmax.x, tile.data.verts[i]);
|
||||
bmax.y = Math.Max(bmax.y, tile.data.verts[i + 1]);
|
||||
bmax.z = Math.Max(bmax.z, tile.data.verts[i + 2]);
|
||||
bmin.X = Math.Min(bmin.X, tile.data.verts[i]);
|
||||
bmin.Y = Math.Min(bmin.Y, tile.data.verts[i + 1]);
|
||||
bmin.Z = Math.Min(bmin.Z, tile.data.verts[i + 2]);
|
||||
bmax.X = Math.Max(bmax.X, tile.data.verts[i]);
|
||||
bmax.Y = Math.Max(bmax.Y, tile.data.verts[i + 1]);
|
||||
bmax.Z = Math.Max(bmax.Z, tile.data.verts[i + 2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,13 +171,13 @@ namespace DotRecast.Detour
|
|||
}
|
||||
|
||||
// BV-tree uses cs for all dimensions
|
||||
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[2] = Math.Clamp((int)((bmin.z - option.bmin.z) * 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[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[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[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[2] = Math.Clamp((int)((bmax.Z - option.bmin.Z) * quantFactor), 0, int.MaxValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -226,10 +226,10 @@ namespace DotRecast.Detour
|
|||
public static int ClassifyOffMeshPoint(RcVec3f pt, RcVec3f bmin, RcVec3f bmax)
|
||||
{
|
||||
int outcode = 0;
|
||||
outcode |= (pt.x >= bmax.x) ? XP : 0;
|
||||
outcode |= (pt.z >= bmax.z) ? ZP : 0;
|
||||
outcode |= (pt.x < bmin.x) ? XM : 0;
|
||||
outcode |= (pt.z < bmin.z) ? ZM : 0;
|
||||
outcode |= (pt.X >= bmax.X) ? XP : 0;
|
||||
outcode |= (pt.Z >= bmax.Z) ? ZP : 0;
|
||||
outcode |= (pt.X < bmin.X) ? XM : 0;
|
||||
outcode |= (pt.Z < bmin.Z) ? ZM : 0;
|
||||
|
||||
switch (outcode)
|
||||
{
|
||||
|
@ -302,7 +302,7 @@ namespace DotRecast.Detour
|
|||
for (int i = 0; i < option.vertCount; ++i)
|
||||
{
|
||||
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);
|
||||
hmax = Math.Max(hmax, h);
|
||||
}
|
||||
|
@ -314,8 +314,8 @@ namespace DotRecast.Detour
|
|||
RcVec3f bmax = new RcVec3f();
|
||||
bmin = option.bmin;
|
||||
bmax = option.bmax;
|
||||
bmin.y = hmin;
|
||||
bmax.y = hmax;
|
||||
bmin.Y = hmin;
|
||||
bmax.Y = hmax;
|
||||
|
||||
for (int i = 0; i < option.offMeshConCount; ++i)
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ namespace DotRecast.Detour
|
|||
// potentially touching the mesh.
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -458,9 +458,9 @@ namespace DotRecast.Detour
|
|||
{
|
||||
int iv = i * 3;
|
||||
int v = i * 3;
|
||||
navVerts[v] = option.bmin.x + option.verts[iv] * option.cs;
|
||||
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] = option.bmin.X + option.verts[iv] * option.cs;
|
||||
navVerts[v + 1] = option.bmin.Y + option.verts[iv + 1] * option.ch;
|
||||
navVerts[v + 2] = option.bmin.Z + option.verts[iv + 2] * option.cs;
|
||||
}
|
||||
|
||||
// Off-mesh link vertices.
|
||||
|
|
|
@ -513,11 +513,11 @@ namespace DotRecast.Detour
|
|||
if (poly.GetPolyType() == DtPolyTypes.DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||
{
|
||||
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;
|
||||
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);
|
||||
height = v0.y + (v1.y - v0.y) * t;
|
||||
height = v0.Y + (v1.Y - v0.Y) * t;
|
||||
|
||||
return DtStatus.DT_SUCCSESS;
|
||||
}
|
||||
|
@ -576,12 +576,12 @@ namespace DotRecast.Detour
|
|||
int[] bmin = new int[3];
|
||||
int[] bmax = new int[3];
|
||||
// dtClamp query box to world box.
|
||||
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 minz = Math.Clamp(qmin.z, tbmin.z, tbmax.z) - tbmin.z;
|
||||
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 maxz = Math.Clamp(qmax.z, tbmin.z, tbmax.z) - tbmin.z;
|
||||
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 minz = Math.Clamp(qmin.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
|
||||
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 maxz = Math.Clamp(qmax.Z, tbmin.Z, tbmax.Z) - tbmin.Z;
|
||||
// Quantize
|
||||
bmin[0] = (int)(qfac * minx) & 0x7ffffffe;
|
||||
bmin[1] = (int)(qfac * miny) & 0x7ffffffe;
|
||||
|
@ -2004,13 +2004,13 @@ namespace DotRecast.Detour
|
|||
if (fromTile.links[i].refs == to)
|
||||
{
|
||||
int v = fromTile.links[i].edge;
|
||||
left.x = fromTile.data.verts[fromPoly.verts[v] * 3];
|
||||
left.y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1];
|
||||
left.z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2];
|
||||
left.X = fromTile.data.verts[fromPoly.verts[v] * 3];
|
||||
left.Y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1];
|
||||
left.Z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2];
|
||||
|
||||
right.x = fromTile.data.verts[fromPoly.verts[v] * 3];
|
||||
right.y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1];
|
||||
right.z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2];
|
||||
right.X = fromTile.data.verts[fromPoly.verts[v] * 3];
|
||||
right.Y = fromTile.data.verts[fromPoly.verts[v] * 3 + 1];
|
||||
right.Z = fromTile.data.verts[fromPoly.verts[v] * 3 + 2];
|
||||
|
||||
return DtStatus.DT_SUCCSESS;
|
||||
}
|
||||
|
@ -2026,13 +2026,13 @@ namespace DotRecast.Detour
|
|||
if (toTile.links[i].refs == from)
|
||||
{
|
||||
int v = toTile.links[i].edge;
|
||||
left.x = toTile.data.verts[toPoly.verts[v] * 3];
|
||||
left.y = toTile.data.verts[toPoly.verts[v] * 3 + 1];
|
||||
left.z = toTile.data.verts[toPoly.verts[v] * 3 + 2];
|
||||
left.X = toTile.data.verts[toPoly.verts[v] * 3];
|
||||
left.Y = toTile.data.verts[toPoly.verts[v] * 3 + 1];
|
||||
left.Z = toTile.data.verts[toPoly.verts[v] * 3 + 2];
|
||||
|
||||
right.x = toTile.data.verts[toPoly.verts[v] * 3];
|
||||
right.y = toTile.data.verts[toPoly.verts[v] * 3 + 1];
|
||||
right.z = toTile.data.verts[toPoly.verts[v] * 3 + 2];
|
||||
right.X = toTile.data.verts[toPoly.verts[v] * 3];
|
||||
right.Y = toTile.data.verts[toPoly.verts[v] * 3 + 1];
|
||||
right.Z = toTile.data.verts[toPoly.verts[v] * 3 + 2];
|
||||
|
||||
return DtStatus.DT_SUCCSESS;
|
||||
}
|
||||
|
@ -2044,13 +2044,13 @@ namespace DotRecast.Detour
|
|||
// Find portal vertices.
|
||||
int v0 = fromPoly.verts[link.edge];
|
||||
int v1 = fromPoly.verts[(link.edge + 1) % fromPoly.vertCount];
|
||||
left.x = fromTile.data.verts[v0 * 3];
|
||||
left.y = fromTile.data.verts[v0 * 3 + 1];
|
||||
left.z = fromTile.data.verts[v0 * 3 + 2];
|
||||
left.X = fromTile.data.verts[v0 * 3];
|
||||
left.Y = fromTile.data.verts[v0 * 3 + 1];
|
||||
left.Z = fromTile.data.verts[v0 * 3 + 2];
|
||||
|
||||
right.x = fromTile.data.verts[v1 * 3];
|
||||
right.y = fromTile.data.verts[v1 * 3 + 1];
|
||||
right.z = fromTile.data.verts[v1 * 3 + 2];
|
||||
right.X = fromTile.data.verts[v1 * 3];
|
||||
right.Y = fromTile.data.verts[v1 * 3 + 1];
|
||||
right.Z = fromTile.data.verts[v1 * 3 + 2];
|
||||
|
||||
// If the link is at tile boundary, dtClamp the vertices to
|
||||
// the link width.
|
||||
|
@ -2079,9 +2079,9 @@ namespace DotRecast.Detour
|
|||
return DtStatus.DT_FAILURE | DtStatus.DT_INVALID_PARAM;
|
||||
}
|
||||
|
||||
mid.x = (left.x + right.x) * 0.5f;
|
||||
mid.y = (left.y + right.y) * 0.5f;
|
||||
mid.z = (left.z + right.z) * 0.5f;
|
||||
mid.X = (left.X + right.X) * 0.5f;
|
||||
mid.Y = (left.Y + right.Y) * 0.5f;
|
||||
mid.Z = (left.Z + right.Z) * 0.5f;
|
||||
|
||||
return DtStatus.DT_SUCCSESS;
|
||||
}
|
||||
|
@ -2304,7 +2304,7 @@ namespace DotRecast.Detour
|
|||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
nextRef = link.refs;
|
||||
|
@ -2325,7 +2325,7 @@ namespace DotRecast.Detour
|
|||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
nextRef = link.refs;
|
||||
|
@ -2345,8 +2345,8 @@ namespace DotRecast.Detour
|
|||
var e2 = verts[(segMax + 1) % nv];
|
||||
var eDir = e2.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;
|
||||
curPos.y = e1.y + eDir.y * s;
|
||||
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;
|
||||
|
||||
hit.pathCost += filter.GetCost(lastPos, curPos, prevRef, prevTile, prevPoly, curRef, tile, poly,
|
||||
nextRef, nextTile, nextPoly);
|
||||
|
@ -2361,11 +2361,11 @@ namespace DotRecast.Detour
|
|||
int b = segMax + 1 < nv ? segMax + 1 : 0;
|
||||
// int va = a * 3;
|
||||
// int vb = b * 3;
|
||||
float dx = verts[b].x - verts[a].x;
|
||||
float dz = verts[b].z - verts[a].x;
|
||||
hit.hitNormal.x = dz;
|
||||
hit.hitNormal.y = 0;
|
||||
hit.hitNormal.z = -dx;
|
||||
float dx = verts[b].X - verts[a].X;
|
||||
float dz = verts[b].Z - verts[a].X;
|
||||
hit.hitNormal.X = dz;
|
||||
hit.hitNormal.Y = 0;
|
||||
hit.hitNormal.Z = -dx;
|
||||
hit.hitNormal.Normalize();
|
||||
return DtStatus.DT_SUCCSESS;
|
||||
}
|
||||
|
@ -2621,9 +2621,9 @@ namespace DotRecast.Detour
|
|||
}
|
||||
|
||||
float scale = 1.0f / nverts;
|
||||
centerPos.x *= scale;
|
||||
centerPos.y *= scale;
|
||||
centerPos.z *= scale;
|
||||
centerPos.X *= scale;
|
||||
centerPos.Y *= scale;
|
||||
centerPos.Z *= scale;
|
||||
|
||||
DtNode startNode = m_nodePool.GetNode(startRef);
|
||||
startNode.pos = centerPos;
|
||||
|
@ -3211,9 +3211,9 @@ namespace DotRecast.Detour
|
|||
// Hit wall, update radius.
|
||||
radiusSqr = distSqr;
|
||||
// Calculate hit pos.
|
||||
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.z = bestTile.data.verts[vj + 2] + (bestTile.data.verts[vi + 2] - bestTile.data.verts[vj + 2]) * 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.Z = bestTile.data.verts[vj + 2] + (bestTile.data.verts[vi + 2] - bestTile.data.verts[vj + 2]) * tseg;
|
||||
hasBestV = true;
|
||||
bestvj = RcVec3f.Of(bestTile.data.verts, vj);
|
||||
bestvi = RcVec3f.Of(bestTile.data.verts, vi);
|
||||
|
@ -3302,9 +3302,9 @@ namespace DotRecast.Detour
|
|||
if (hasBestV)
|
||||
{
|
||||
var tangent = bestvi.Subtract(bestvj);
|
||||
hitNormal.x = tangent.z;
|
||||
hitNormal.y = 0;
|
||||
hitNormal.z = -tangent.x;
|
||||
hitNormal.X = tangent.Z;
|
||||
hitNormal.Y = 0;
|
||||
hitNormal.Z = -tangent.X;
|
||||
hitNormal.Normalize();
|
||||
}
|
||||
|
||||
|
|
|
@ -68,15 +68,15 @@ namespace DotRecast.Detour
|
|||
int v = tile.data.detailTris[t + k];
|
||||
if (v < p.vertCount)
|
||||
{
|
||||
verts[k].x = tile.data.verts[p.verts[v] * 3];
|
||||
verts[k].y = tile.data.verts[p.verts[v] * 3 + 1];
|
||||
verts[k].z = tile.data.verts[p.verts[v] * 3 + 2];
|
||||
verts[k].X = tile.data.verts[p.verts[v] * 3];
|
||||
verts[k].Y = tile.data.verts[p.verts[v] * 3 + 1];
|
||||
verts[k].Z = tile.data.verts[p.verts[v] * 3 + 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
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].z = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3 + 2];
|
||||
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].Z = tile.data.detailVerts[(pd.vertBase + v - p.vertCount) * 3 + 2];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace DotRecast.Detour
|
|||
return false;
|
||||
|
||||
steerPos = straightPath[ns].pos;
|
||||
steerPos.y = startPos.y;
|
||||
steerPos.Y = startPos.Y;
|
||||
steerPosFlag = straightPath[ns].flags;
|
||||
steerPosRef = straightPath[ns].refs;
|
||||
|
||||
|
@ -70,9 +70,9 @@ namespace DotRecast.Detour
|
|||
|
||||
public static bool InRange(RcVec3f v1, RcVec3f v2, float r, float h)
|
||||
{
|
||||
float dx = v2.x - v1.x;
|
||||
float dy = v2.y - v1.y;
|
||||
float dz = v2.z - v1.z;
|
||||
float dx = v2.X - v1.X;
|
||||
float dy = v2.Y - v1.Y;
|
||||
float dz = v2.Z - v1.Z;
|
||||
return (dx * dx + dz * dz) < r * r && Math.Abs(dy) < h;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,9 +67,9 @@ namespace DotRecast.Detour
|
|||
float[] circle = new float[12 * 3];
|
||||
for (int i = 0; i < CIRCLE_SEGMENTS * 3; i += 3)
|
||||
{
|
||||
circle[i] = UnitCircle[i] * radius + center.x;
|
||||
circle[i + 1] = center.y;
|
||||
circle[i + 2] = UnitCircle[i + 2] * radius + center.z;
|
||||
circle[i] = UnitCircle[i] * radius + center.X;
|
||||
circle[i + 1] = center.Y;
|
||||
circle[i + 2] = UnitCircle[i + 2] * radius + center.Z;
|
||||
}
|
||||
|
||||
return circle;
|
||||
|
|
|
@ -82,9 +82,9 @@ namespace DotRecast.Detour
|
|||
public static bool OverlapBounds(RcVec3f amin, RcVec3f amax, RcVec3f bmin, RcVec3f bmax)
|
||||
{
|
||||
bool overlap = true;
|
||||
overlap = (amin.x > bmax.x || amax.x < bmin.x) ? 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.X > bmax.X || amax.X < bmin.X) ? false : overlap;
|
||||
overlap = (amin.Y > bmax.Y || amax.Y < bmin.Y) ? false : overlap;
|
||||
overlap = (amin.Z > bmax.Z || amax.Z < bmin.Z) ? false : overlap;
|
||||
return overlap;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace DotRecast.Detour
|
|||
|
||||
RcVec2f aminmax = ProjectPoly(n, polya, npolya);
|
||||
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
|
||||
return false;
|
||||
|
@ -124,7 +124,7 @@ namespace DotRecast.Detour
|
|||
|
||||
RcVec2f aminmax = ProjectPoly(n, polya, npolya);
|
||||
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
|
||||
return false;
|
||||
|
@ -155,10 +155,10 @@ namespace DotRecast.Detour
|
|||
|
||||
public static float TriArea2D(RcVec3f a, RcVec3f b, RcVec3f c)
|
||||
{
|
||||
float abx = b.x - a.x;
|
||||
float abz = b.z - a.z;
|
||||
float acx = c.x - a.x;
|
||||
float acz = c.z - a.z;
|
||||
float abx = b.X - a.X;
|
||||
float abz = b.Z - a.Z;
|
||||
float acx = c.X - a.X;
|
||||
float acz = c.Z - a.Z;
|
||||
return acx * abz - abx * acz;
|
||||
}
|
||||
|
||||
|
@ -203,9 +203,9 @@ namespace DotRecast.Detour
|
|||
|
||||
return new RcVec3f()
|
||||
{
|
||||
x = a * pts[pa] + b * pts[pb] + c * pts[pc],
|
||||
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]
|
||||
X = a * pts[pa] + b * pts[pb] + c * pts[pc],
|
||||
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]
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -219,14 +219,14 @@ namespace DotRecast.Detour
|
|||
RcVec3f v2 = p.Subtract(a);
|
||||
|
||||
// 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)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float u = v1.z * v2.x - v1.x * v2.z;
|
||||
float v = v0.x * v2.z - v0.z * v2.x;
|
||||
float u = v1.Z * v2.X - v1.X * v2.Z;
|
||||
float v = v0.X * v2.Z - v0.Z * v2.X;
|
||||
|
||||
if (denom < 0)
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ namespace DotRecast.Detour
|
|||
// If point lies inside the triangle, return interpolated ycoord.
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -258,8 +258,8 @@ namespace DotRecast.Detour
|
|||
|
||||
return new RcVec2f
|
||||
{
|
||||
x = rmin,
|
||||
y = rmax,
|
||||
X = rmin,
|
||||
Y = rmax,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -275,8 +275,8 @@ namespace DotRecast.Detour
|
|||
{
|
||||
int vi = i * 3;
|
||||
int vj = j * 3;
|
||||
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]))
|
||||
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]))
|
||||
{
|
||||
c = !c;
|
||||
}
|
||||
|
@ -294,8 +294,8 @@ namespace DotRecast.Detour
|
|||
{
|
||||
int vi = i * 3;
|
||||
int vj = j * 3;
|
||||
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]))
|
||||
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]))
|
||||
{
|
||||
c = !c;
|
||||
}
|
||||
|
@ -315,10 +315,10 @@ namespace DotRecast.Detour
|
|||
|
||||
public static float DistancePtSegSqr2D(RcVec3f pt, RcVec3f p, RcVec3f q, out float t)
|
||||
{
|
||||
float pqx = q.x - p.x;
|
||||
float pqz = q.z - p.z;
|
||||
float dx = pt.x - p.x;
|
||||
float dz = pt.z - p.z;
|
||||
float pqx = q.X - p.X;
|
||||
float pqz = q.Z - p.Z;
|
||||
float dx = pt.X - p.X;
|
||||
float dz = pt.Z - p.Z;
|
||||
float d = pqx * pqx + pqz * pqz;
|
||||
t = pqx * dx + pqz * dz;
|
||||
if (d > 0)
|
||||
|
@ -335,8 +335,8 @@ namespace DotRecast.Detour
|
|||
t = 1;
|
||||
}
|
||||
|
||||
dx = p.x + t * pqx - pt.x;
|
||||
dz = p.z + t * pqz - pt.z;
|
||||
dx = p.X + t * pqx - pt.X;
|
||||
dz = p.Z + t * pqz - pt.Z;
|
||||
return dx * dx + dz * dz;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,13 +92,13 @@ namespace DotRecast.Detour.Io
|
|||
header.walkableRadius = buf.GetFloat();
|
||||
header.walkableClimb = buf.GetFloat();
|
||||
|
||||
header.bmin.x = buf.GetFloat();
|
||||
header.bmin.y = buf.GetFloat();
|
||||
header.bmin.z = buf.GetFloat();
|
||||
header.bmin.X = buf.GetFloat();
|
||||
header.bmin.Y = buf.GetFloat();
|
||||
header.bmin.Z = buf.GetFloat();
|
||||
|
||||
header.bmax.x = buf.GetFloat();
|
||||
header.bmax.y = buf.GetFloat();
|
||||
header.bmax.z = buf.GetFloat();
|
||||
header.bmax.X = buf.GetFloat();
|
||||
header.bmax.Y = buf.GetFloat();
|
||||
header.bmax.Z = buf.GetFloat();
|
||||
|
||||
header.bvQuantFactor = buf.GetFloat();
|
||||
data.verts = ReadVerts(buf, header.vertCount);
|
||||
|
|
|
@ -44,12 +44,12 @@ namespace DotRecast.Detour.Io
|
|||
Write(stream, header.walkableHeight, order);
|
||||
Write(stream, header.walkableRadius, order);
|
||||
Write(stream, header.walkableClimb, order);
|
||||
Write(stream, header.bmin.x, order);
|
||||
Write(stream, header.bmin.y, order);
|
||||
Write(stream, header.bmin.z, order);
|
||||
Write(stream, header.bmax.x, order);
|
||||
Write(stream, header.bmax.y, order);
|
||||
Write(stream, header.bmax.z, order);
|
||||
Write(stream, header.bmin.X, order);
|
||||
Write(stream, header.bmin.Y, order);
|
||||
Write(stream, header.bmin.Z, order);
|
||||
Write(stream, header.bmax.X, order);
|
||||
Write(stream, header.bmax.Y, order);
|
||||
Write(stream, header.bmax.Z, order);
|
||||
Write(stream, header.bvQuantFactor, order);
|
||||
WriteVerts(stream, data.verts, header.vertCount, order);
|
||||
WritePolys(stream, data, order, cCompatibility);
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace DotRecast.Detour.Io
|
|||
{
|
||||
public void Write(BinaryWriter stream, DtNavMeshParams option, RcByteOrder order)
|
||||
{
|
||||
Write(stream, option.orig.x, order);
|
||||
Write(stream, option.orig.y, order);
|
||||
Write(stream, option.orig.z, order);
|
||||
Write(stream, option.orig.X, order);
|
||||
Write(stream, option.orig.Y, order);
|
||||
Write(stream, option.orig.Z, order);
|
||||
Write(stream, option.tileWidth, order);
|
||||
Write(stream, option.tileHeight, order);
|
||||
Write(stream, option.maxTiles, order);
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace DotRecast.Detour.Io
|
|||
public DtNavMeshParams Read(RcByteBuffer bb)
|
||||
{
|
||||
DtNavMeshParams option = new DtNavMeshParams();
|
||||
option.orig.x = bb.GetFloat();
|
||||
option.orig.y = bb.GetFloat();
|
||||
option.orig.z = bb.GetFloat();
|
||||
option.orig.X = bb.GetFloat();
|
||||
option.orig.Y = bb.GetFloat();
|
||||
option.orig.Z = bb.GetFloat();
|
||||
option.tileWidth = bb.GetFloat();
|
||||
option.tileHeight = bb.GetFloat();
|
||||
option.maxTiles = bb.GetInt();
|
||||
|
|
|
@ -343,11 +343,11 @@ public class DebugDraw
|
|||
float u = PAD + i * ARC_PTS_SCALE;
|
||||
RcVec3f pt = new RcVec3f();
|
||||
EvalArc(x0, y0, z0, dx, dy, dz, len * h, u, ref pt);
|
||||
Vertex(prev.x, prev.y, prev.z, col);
|
||||
Vertex(pt.x, pt.y, pt.z, col);
|
||||
prev.x = pt.x;
|
||||
prev.y = pt.y;
|
||||
prev.z = pt.z;
|
||||
Vertex(prev.X, prev.Y, prev.Z, col);
|
||||
Vertex(pt.X, pt.Y, pt.Z, col);
|
||||
prev.X = pt.X;
|
||||
prev.Y = pt.Y;
|
||||
prev.Z = pt.Z;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
res.x = x0 + dx * u;
|
||||
res.y = y0 + dy * u + h * (1 - (u * 2 - 1) * (u * 2 - 1));
|
||||
res.z = z0 + dz * u;
|
||||
res.X = x0 + dx * u;
|
||||
res.Y = y0 + dy * u + h * (1 - (u * 2 - 1) * (u * 2 - 1));
|
||||
res.Z = z0 + dz * u;
|
||||
}
|
||||
|
||||
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.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.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)
|
||||
{
|
||||
dest.x = v1.y * v2.z - v1.z * v2.y;
|
||||
dest.y = v1.z * v2.x - v1.x * v2.z;
|
||||
dest.z = v1.x * v2.y - v1.y * v2.x;
|
||||
dest.X = v1.Y * v2.Z - v1.Z * v2.Y;
|
||||
dest.Y = v1.Z * v2.X - v1.X * v2.Z;
|
||||
dest.Z = v1.X * v2.Y - v1.Y * v2.X;
|
||||
}
|
||||
|
||||
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));
|
||||
v.x *= d;
|
||||
v.y *= d;
|
||||
v.z *= d;
|
||||
float d = (float)(1.0f / Math.Sqrt(v.X * v.X + v.Y * v.Y + v.Z * v.Z));
|
||||
v.X *= d;
|
||||
v.Y *= d;
|
||||
v.Z *= d;
|
||||
}
|
||||
|
||||
public void Vsub(ref RcVec3f dest, RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
dest.x = v1.x - v2.x;
|
||||
dest.y = v1.y - v2.y;
|
||||
dest.z = v1.z - v2.z;
|
||||
dest.X = v1.X - v2.X;
|
||||
dest.Y = v1.Y - v2.Y;
|
||||
dest.Z = v1.Z - v2.Z;
|
||||
}
|
||||
|
||||
public float VdistSqr(RcVec3f v1, RcVec3f v2)
|
||||
{
|
||||
float x = v1.x - v2.x;
|
||||
float y = v1.y - v2.y;
|
||||
float z = v1.z - v2.z;
|
||||
float x = v1.X - v2.X;
|
||||
float y = v1.Y - v2.Y;
|
||||
float z = v1.Z - v2.Z;
|
||||
return x * x + y * y + z * z;
|
||||
}
|
||||
|
||||
|
@ -644,9 +644,9 @@ public class DebugDraw
|
|||
|
||||
var t = new RcMatrix4x4f();
|
||||
t.M11 = t.M22 = t.M33 = t.M44 = 1;
|
||||
t.M41 = -cameraPos.x;
|
||||
t.M42 = -cameraPos.y;
|
||||
t.M43 = -cameraPos.z;
|
||||
t.M41 = -cameraPos.X;
|
||||
t.M42 = -cameraPos.Y;
|
||||
t.M43 = -cameraPos.Z;
|
||||
_viewMatrix = RcMatrix4x4f.Mul(ref r, ref t);
|
||||
GetOpenGlDraw().ViewMatrix(ref _viewMatrix);
|
||||
UpdateFrustum();
|
||||
|
@ -747,6 +747,6 @@ public class DebugDraw
|
|||
|
||||
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 });
|
||||
}
|
||||
}
|
|
@ -85,9 +85,9 @@ public static class GLU
|
|||
if (@out[3] == 0.0)
|
||||
return 0;
|
||||
@out[3] = 1.0f / @out[3];
|
||||
objectCoordinate.x = @out[0] * @out[3];
|
||||
objectCoordinate.y = @out[1] * @out[3];
|
||||
objectCoordinate.z = @out[2] * @out[3];
|
||||
objectCoordinate.X = @out[0] * @out[3];
|
||||
objectCoordinate.Y = @out[1] * @out[3];
|
||||
objectCoordinate.Z = @out[2] * @out[3];
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,10 +212,10 @@ public class NavMeshRenderer
|
|||
// Draw bounds
|
||||
RcVec3f bmin = geom.GetMeshBoundsMin();
|
||||
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.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();
|
||||
}
|
||||
|
||||
|
@ -264,16 +264,16 @@ public class NavMeshRenderer
|
|||
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(vb.x, vol.hmax, vb.z, col);
|
||||
_debugDraw.Vertex(va.x, vol.hmax, va.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.hmin, va.z, DebugDraw.DuDarkenCol(col));
|
||||
_debugDraw.Vertex(va.x, vol.hmax, va.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.hmax, va.Z, col);
|
||||
_debugDraw.Vertex(vb.X, vol.hmax, vb.Z, 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.hmin, vb.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.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 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(vb.x, vol.hmin, vb.z, DebugDraw.DuDarkenCol(col));
|
||||
_debugDraw.Vertex(va.x, vol.hmax, va.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.hmax, va.z, 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(va.X, vol.hmax, va.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.hmax, va.Z, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public struct OpenGLVertex
|
|||
private readonly 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) :
|
||||
this(pos.x, pos.y, pos.z, 0f, 0f, color)
|
||||
this(pos.X, pos.Y, pos.Z, 0f, 0f, color)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
RcVec3f norm = RcVec3f.Of(normals[i], normals[i + 1], normals[i + 2]);
|
||||
|
||||
int color;
|
||||
char a = (char)(220 * (2 + norm.x + norm.y) / 4);
|
||||
if (norm.y < walkableThr)
|
||||
char a = (char)(220 * (2 + norm.X + norm.Y) / 4);
|
||||
if (norm.Y < walkableThr)
|
||||
{
|
||||
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]);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (Math.Abs(norm.z) > Math.Abs(norm[ax]))
|
||||
if (Math.Abs(norm.Z) > Math.Abs(norm[ax]))
|
||||
{
|
||||
ax = 2;
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ public class RecastDebugDraw : DebugDraw
|
|||
ax = (1 << ax) & 3; // +1 mod 3
|
||||
ay = (1 << ax) & 3; // +1 mod 3
|
||||
|
||||
uva.x = va[ax] * texScale;
|
||||
uva.y = va[ay] * texScale;
|
||||
uvb.x = vb[ax] * texScale;
|
||||
uvb.y = vb[ay] * texScale;
|
||||
uvc.x = vc[ax] * texScale;
|
||||
uvc.y = vc[ay] * texScale;
|
||||
uva.X = va[ax] * texScale;
|
||||
uva.Y = va[ay] * texScale;
|
||||
uvb.X = vb[ax] * texScale;
|
||||
uvb.Y = vb[ay] * texScale;
|
||||
uvc.X = vc[ax] * texScale;
|
||||
uvc.Y = vc[ay] * texScale;
|
||||
|
||||
Vertex(va, color, uva);
|
||||
Vertex(vb, color, uvb);
|
||||
|
@ -213,12 +213,12 @@ public class RecastDebugDraw : DebugDraw
|
|||
}
|
||||
|
||||
// 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);
|
||||
col2 = startSet ? col : DuRGBA(220, 32, 16, 196);
|
||||
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);
|
||||
col2 = endSet ? col : DuRGBA(220, 32, 16, 196);
|
||||
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)
|
||||
{
|
||||
float pqx = q.x - p.x;
|
||||
float pqz = q.z - p.z;
|
||||
float dx = pt.x - p.x;
|
||||
float dz = pt.z - p.z;
|
||||
float pqx = q.X - p.X;
|
||||
float pqz = q.Z - p.Z;
|
||||
float dx = pt.X - p.X;
|
||||
float dz = pt.Z - p.Z;
|
||||
float d = pqx * pqx + pqz * pqz;
|
||||
float t = pqx * dx + pqz * dz;
|
||||
if (d != 0)
|
||||
|
@ -435,8 +435,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
t /= d;
|
||||
}
|
||||
|
||||
dx = p.x + t * pqx - pt.x;
|
||||
dz = p.z + t * pqz - pt.z;
|
||||
dx = p.X + t * pqx - pt.X;
|
||||
dz = p.Z + t * pqz - pt.Z;
|
||||
return dx * dx + dz * dz;
|
||||
}
|
||||
|
||||
|
@ -465,9 +465,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
continue;
|
||||
}
|
||||
|
||||
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.y + n.bmax[1] * cs, tile.data.header.bmin.z + n.bmax[2] * 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.Y + n.bmax[1] * cs, tile.data.header.bmin.Z + n.bmax[2] * cs,
|
||||
DuRGBA(255, 255, 255, 128));
|
||||
}
|
||||
|
||||
|
@ -485,8 +485,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < chf.width; ++x)
|
||||
{
|
||||
float fx = chf.bmin.x + x * cs;
|
||||
float fz = chf.bmin.z + y * cs;
|
||||
float fx = chf.bmin.X + x * cs;
|
||||
float fz = chf.bmin.Z + y * cs;
|
||||
RcCompactCell c = chf.cells[x + y * chf.width];
|
||||
|
||||
for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
|
||||
|
@ -508,7 +508,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
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 + cs, color);
|
||||
Vertex(fx + cs, fy, fz + cs, color);
|
||||
|
@ -548,7 +548,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
if (cont2 != null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
RcVec3f center = new RcVec3f();
|
||||
center.x = 0;
|
||||
center.y = 0;
|
||||
center.z = 0;
|
||||
center.X = 0;
|
||||
center.Y = 0;
|
||||
center.Z = 0;
|
||||
if (cont.nverts == 0)
|
||||
{
|
||||
return center;
|
||||
|
@ -584,18 +584,18 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int i = 0; i < cont.nverts; ++i)
|
||||
{
|
||||
int v = i * 4;
|
||||
center.x += cont.verts[v + 0];
|
||||
center.y += cont.verts[v + 1];
|
||||
center.z += cont.verts[v + 2];
|
||||
center.X += cont.verts[v + 0];
|
||||
center.Y += cont.verts[v + 1];
|
||||
center.Z += cont.verts[v + 2];
|
||||
}
|
||||
|
||||
float s = 1.0f / cont.nverts;
|
||||
center.x *= s * cs;
|
||||
center.y *= s * ch;
|
||||
center.z *= s * cs;
|
||||
center.x += orig.x;
|
||||
center.y += orig.y + 4 * ch;
|
||||
center.z += orig.z;
|
||||
center.X *= s * cs;
|
||||
center.Y *= s * ch;
|
||||
center.Z *= s * cs;
|
||||
center.X += orig.X;
|
||||
center.Y += orig.Y + 4 * ch;
|
||||
center.Z += orig.Z;
|
||||
return center;
|
||||
}
|
||||
|
||||
|
@ -632,9 +632,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
int v0 = c.rverts[j * 4];
|
||||
int v1 = c.rverts[j * 4 + 1];
|
||||
int v2 = c.rverts[j * 4 + 2];
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.z + v2 * cs;
|
||||
float fx = orig.X + v0 * cs;
|
||||
float fy = orig.Y + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.Z + v2 * cs;
|
||||
Vertex(fx, fy, fz, color);
|
||||
if (j > 0)
|
||||
{
|
||||
|
@ -647,9 +647,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
int v0 = c.rverts[0];
|
||||
int v1 = c.rverts[1];
|
||||
int v2 = c.rverts[2];
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.z + v2 * cs;
|
||||
float fx = orig.X + v0 * cs;
|
||||
float fy = orig.Y + (v1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.Z + v2 * cs;
|
||||
Vertex(fx, fy, fz, color);
|
||||
}
|
||||
}
|
||||
|
@ -677,9 +677,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
off = ch * 2;
|
||||
}
|
||||
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig.z + v2 * cs;
|
||||
float fx = orig.X + v0 * cs;
|
||||
float fy = orig.Y + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig.Z + v2 * cs;
|
||||
Vertex(fx, fy, fz, colv);
|
||||
}
|
||||
}
|
||||
|
@ -720,14 +720,14 @@ public class RecastDebugDraw : DebugDraw
|
|||
int vb2 = c.verts[j * 4 + 2];
|
||||
int col = (va3 & RcConstants.RC_AREA_BORDER) != 0 ? bcolor : color;
|
||||
|
||||
float fx = orig.x + va0 * cs;
|
||||
float fy = orig.y + (va1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.z + va2 * cs;
|
||||
float fx = orig.X + va0 * cs;
|
||||
float fy = orig.Y + (va1 + 1 + (i & 1)) * ch;
|
||||
float fz = orig.Z + va2 * cs;
|
||||
Vertex(fx, fy, fz, col);
|
||||
|
||||
fx = orig.x + vb0 * cs;
|
||||
fy = orig.y + (vb1 + 1 + (i & 1)) * ch;
|
||||
fz = orig.z + vb2 * cs;
|
||||
fx = orig.X + vb0 * cs;
|
||||
fy = orig.Y + (vb1 + 1 + (i & 1)) * ch;
|
||||
fz = orig.Z + vb2 * cs;
|
||||
Vertex(fx, fy, fz, col);
|
||||
}
|
||||
}
|
||||
|
@ -755,9 +755,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
off = ch * 2;
|
||||
}
|
||||
|
||||
float fx = orig.x + v0 * cs;
|
||||
float fy = orig.y + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig.z + v2 * cs;
|
||||
float fx = orig.X + v0 * cs;
|
||||
float fy = orig.Y + (v1 + 1 + (i & 1)) * ch + off;
|
||||
float fz = orig.Z + v2 * cs;
|
||||
Vertex(fx, fy, fz, colv);
|
||||
}
|
||||
}
|
||||
|
@ -788,12 +788,12 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < w; ++x)
|
||||
{
|
||||
float fx = orig.x + x * cs;
|
||||
float fz = orig.z + y * cs;
|
||||
float fx = orig.X + x * cs;
|
||||
float fz = orig.Z + y * cs;
|
||||
RcSpan s = hf.spans[x + y * w];
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -820,8 +820,8 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < w; ++x)
|
||||
{
|
||||
float fx = orig.x + x * cs;
|
||||
float fz = orig.z + y * cs;
|
||||
float fx = orig.X + x * cs;
|
||||
float fz = orig.Z + y * cs;
|
||||
RcSpan s = hf.spans[x + y * w];
|
||||
while (s != null)
|
||||
{
|
||||
|
@ -838,7 +838,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
@ -858,14 +858,14 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < chf.width; ++x)
|
||||
{
|
||||
float fx = chf.bmin.x + x * cs;
|
||||
float fz = chf.bmin.z + y * cs;
|
||||
float fx = chf.bmin.X + x * cs;
|
||||
float fz = chf.bmin.Z + y * cs;
|
||||
RcCompactCell c = chf.cells[x + y * chf.width];
|
||||
|
||||
for (int i = c.index, ni = c.index + c.count; i < ni; ++i)
|
||||
{
|
||||
RcCompactSpan s = chf.spans[i];
|
||||
float fy = chf.bmin.y + (s.y) * ch;
|
||||
float fy = chf.bmin.Y + (s.y) * ch;
|
||||
int color;
|
||||
if (s.reg != 0)
|
||||
{
|
||||
|
@ -911,14 +911,14 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
for (int x = 0; x < chf.width; ++x)
|
||||
{
|
||||
float fx = chf.bmin.x + x * cs;
|
||||
float fz = chf.bmin.z + y * cs;
|
||||
float fx = chf.bmin.X + x * cs;
|
||||
float fz = chf.bmin.Z + y * cs;
|
||||
RcCompactCell c = chf.cells[x + y * chf.width];
|
||||
|
||||
for (int i = c.index, ni = c.index + c.count; i < ni; ++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);
|
||||
int color = DuRGBA(cd, cd, cd, 255);
|
||||
Vertex(fx, fy, fz, color);
|
||||
|
@ -976,9 +976,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
int v0 = mesh.verts[vi[k] * 3];
|
||||
int v1 = mesh.verts[vi[k] * 3 + 1];
|
||||
int v2 = mesh.verts[vi[k] * 3 + 2];
|
||||
float x = orig.x + v0 * cs;
|
||||
float y = orig.y + (v1 + 1) * ch;
|
||||
float z = orig.z + v2 * cs;
|
||||
float x = orig.X + v0 * cs;
|
||||
float y = orig.Y + (v1 + 1) * ch;
|
||||
float z = orig.Z + v2 * cs;
|
||||
Vertex(x, y, z, color);
|
||||
}
|
||||
}
|
||||
|
@ -1010,9 +1010,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int k = 0; k < 2; ++k)
|
||||
{
|
||||
int v = vi[k] * 3;
|
||||
float x = orig.x + mesh.verts[v] * cs;
|
||||
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.z + mesh.verts[v + 2] * cs;
|
||||
float x = orig.X + mesh.verts[v] * cs;
|
||||
float y = orig.Y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.Z + mesh.verts[v + 2] * cs;
|
||||
Vertex(x, y, z, coln);
|
||||
}
|
||||
}
|
||||
|
@ -1050,9 +1050,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int k = 0; k < 2; ++k)
|
||||
{
|
||||
int v = vi[k] * 3;
|
||||
float x = orig.x + mesh.verts[v] * cs;
|
||||
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.z + mesh.verts[v + 2] * cs;
|
||||
float x = orig.X + mesh.verts[v] * cs;
|
||||
float y = orig.Y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.Z + mesh.verts[v + 2] * cs;
|
||||
Vertex(x, y, z, col);
|
||||
}
|
||||
}
|
||||
|
@ -1065,9 +1065,9 @@ public class RecastDebugDraw : DebugDraw
|
|||
for (int i = 0; i < mesh.nverts; ++i)
|
||||
{
|
||||
int v = i * 3;
|
||||
float x = orig.x + mesh.verts[v] * cs;
|
||||
float y = orig.y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.z + mesh.verts[v + 2] * cs;
|
||||
float x = orig.X + mesh.verts[v] * cs;
|
||||
float y = orig.Y + (mesh.verts[v + 1] + 1) * ch + 0.1f;
|
||||
float z = orig.Z + mesh.verts[v + 2] * cs;
|
||||
Vertex(x, y, z, colv);
|
||||
}
|
||||
|
||||
|
@ -1211,7 +1211,7 @@ public class RecastDebugDraw : DebugDraw
|
|||
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;
|
||||
}
|
||||
|
||||
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(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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1362,37 +1362,37 @@ public class RecastDebugDraw : DebugDraw
|
|||
{
|
||||
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, vb.y + pady, vb.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, va.y - pady, va.z, col);
|
||||
Vertex(x, vb.Y - pady, vb.Z, col);
|
||||
Vertex(x, va.Y - pady, va.Z, col);
|
||||
}
|
||||
else if (side == 2 || side == 6)
|
||||
{
|
||||
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(vb.x, vb.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(va.x, va.y - pady, z, col);
|
||||
Vertex(vb.X, vb.Y - pady, z, col);
|
||||
Vertex(va.X, va.Y - pady, z, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,9 +147,9 @@ public class RecastDemo : IRecastDemoChannel
|
|||
}
|
||||
|
||||
var modelviewMatrix = dd.ViewMatrix(cameraPos, cameraEulers);
|
||||
cameraPos.x += scrollZoom * 2.0f * modelviewMatrix.M13;
|
||||
cameraPos.y += scrollZoom * 2.0f * modelviewMatrix.M23;
|
||||
cameraPos.z += scrollZoom * 2.0f * modelviewMatrix.M33;
|
||||
cameraPos.X += scrollZoom * 2.0f * modelviewMatrix.M13;
|
||||
cameraPos.Y += scrollZoom * 2.0f * modelviewMatrix.M23;
|
||||
cameraPos.Z += scrollZoom * 2.0f * modelviewMatrix.M33;
|
||||
scrollZoom = 0;
|
||||
}
|
||||
|
||||
|
@ -174,13 +174,13 @@ public class RecastDemo : IRecastDemoChannel
|
|||
var modelviewMatrix = dd.ViewMatrix(cameraPos, cameraEulers);
|
||||
cameraPos = origCameraPos;
|
||||
|
||||
cameraPos.x -= 0.1f * dx * modelviewMatrix.M11;
|
||||
cameraPos.y -= 0.1f * dx * modelviewMatrix.M21;
|
||||
cameraPos.z -= 0.1f * dx * modelviewMatrix.M31;
|
||||
cameraPos.X -= 0.1f * dx * modelviewMatrix.M11;
|
||||
cameraPos.Y -= 0.1f * dx * modelviewMatrix.M21;
|
||||
cameraPos.Z -= 0.1f * dx * modelviewMatrix.M31;
|
||||
|
||||
cameraPos.x += 0.1f * dy * modelviewMatrix.M12;
|
||||
cameraPos.y += 0.1f * dy * modelviewMatrix.M22;
|
||||
cameraPos.z += 0.1f * dy * modelviewMatrix.M32;
|
||||
cameraPos.X += 0.1f * dy * modelviewMatrix.M12;
|
||||
cameraPos.Y += 0.1f * dy * modelviewMatrix.M22;
|
||||
cameraPos.Z += 0.1f * dy * modelviewMatrix.M32;
|
||||
if (dx * dx + dy * dy > 3 * 3)
|
||||
{
|
||||
movedDuringPan = true;
|
||||
|
@ -214,9 +214,9 @@ public class RecastDemo : IRecastDemoChannel
|
|||
movedDuringPan = false;
|
||||
origMousePos[0] = mousePos[0];
|
||||
origMousePos[1] = mousePos[1];
|
||||
origCameraPos.x = cameraPos.x;
|
||||
origCameraPos.y = cameraPos.y;
|
||||
origCameraPos.z = cameraPos.z;
|
||||
origCameraPos.X = cameraPos.X;
|
||||
origCameraPos.Y = cameraPos.Y;
|
||||
origCameraPos.Z = cameraPos.Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -473,15 +473,15 @@ public class RecastDemo : IRecastDemoChannel
|
|||
double movey = (_moveBack - _moveFront) * keySpeed * dt + scrollZoom * 2.0f;
|
||||
scrollZoom = 0;
|
||||
|
||||
cameraPos.x += (float)(movex * modelviewMatrix[0]);
|
||||
cameraPos.y += (float)(movex * modelviewMatrix[4]);
|
||||
cameraPos.z += (float)(movex * modelviewMatrix[8]);
|
||||
cameraPos.X += (float)(movex * modelviewMatrix[0]);
|
||||
cameraPos.Y += (float)(movex * modelviewMatrix[4]);
|
||||
cameraPos.Z += (float)(movex * modelviewMatrix[8]);
|
||||
|
||||
cameraPos.x += (float)(movey * modelviewMatrix[2]);
|
||||
cameraPos.y += (float)(movey * modelviewMatrix[6]);
|
||||
cameraPos.z += (float)(movey * modelviewMatrix[10]);
|
||||
cameraPos.X += (float)(movey * modelviewMatrix[2]);
|
||||
cameraPos.Y += (float)(movey * modelviewMatrix[6]);
|
||||
cameraPos.Z += (float)(movey * modelviewMatrix[10]);
|
||||
|
||||
cameraPos.y += (float)((_moveUp - _moveDown) * keySpeed * dt);
|
||||
cameraPos.Y += (float)((_moveUp - _moveDown) * keySpeed * dt);
|
||||
|
||||
long time = RcFrequency.Ticks;
|
||||
prevFrameTime = time;
|
||||
|
@ -552,15 +552,15 @@ public class RecastDemo : IRecastDemoChannel
|
|||
}
|
||||
|
||||
bminN = RcVec3f.Of(
|
||||
Math.Min(bminN.x, result.GetSolidHeightfield().bmin.x),
|
||||
Math.Min(bminN.y, result.GetSolidHeightfield().bmin.y),
|
||||
Math.Min(bminN.z, result.GetSolidHeightfield().bmin.z)
|
||||
Math.Min(bminN.X, result.GetSolidHeightfield().bmin.X),
|
||||
Math.Min(bminN.Y, result.GetSolidHeightfield().bmin.Y),
|
||||
Math.Min(bminN.Z, result.GetSolidHeightfield().bmin.Z)
|
||||
);
|
||||
|
||||
bmaxN = RcVec3f.Of(
|
||||
Math.Max(bmaxN.x, result.GetSolidHeightfield().bmax.x),
|
||||
Math.Max(bmaxN.y, result.GetSolidHeightfield().bmax.y),
|
||||
Math.Max(bmaxN.z, result.GetSolidHeightfield().bmax.z)
|
||||
Math.Max(bmaxN.X, result.GetSolidHeightfield().bmax.X),
|
||||
Math.Max(bmaxN.Y, result.GetSolidHeightfield().bmax.Y),
|
||||
Math.Max(bmaxN.Z, result.GetSolidHeightfield().bmax.Z)
|
||||
);
|
||||
|
||||
hasBound = true;
|
||||
|
@ -573,10 +573,10 @@ public class RecastDemo : IRecastDemoChannel
|
|||
RcVec3f bmin = bminN;
|
||||
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);
|
||||
cameraPos.x = (bmax.x + bmin.x) / 2 + camr;
|
||||
cameraPos.y = (bmax.y + bmin.y) / 2 + camr;
|
||||
cameraPos.z = (bmax.z + bmin.z) / 2 + camr;
|
||||
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.Y = (bmax.Y + bmin.Y) / 2 + camr;
|
||||
cameraPos.Z = (bmax.Z + bmin.Z) / 2 + camr;
|
||||
camr *= 5;
|
||||
cameraEulers[0] = 45;
|
||||
cameraEulers[1] = -45;
|
||||
|
@ -789,12 +789,12 @@ public class RecastDemo : IRecastDemoChannel
|
|||
hit = RcPolyMeshRaycast.Raycast(_sample.GetRecastResults(), rayStart, rayEnd, out hitTime);
|
||||
}
|
||||
|
||||
RcVec3f rayDir = RcVec3f.Of(rayEnd.x - rayStart.x, rayEnd.y - rayStart.y, rayEnd.z - rayStart.z);
|
||||
RcVec3f rayDir = RcVec3f.Of(rayEnd.X - rayStart.X, rayEnd.Y - rayStart.Y, rayEnd.Z - rayStart.Z);
|
||||
ISampleTool raySampleTool = toolset.GetTool();
|
||||
rayDir.Normalize();
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -804,19 +804,19 @@ public class RecastDemo : IRecastDemoChannel
|
|||
{
|
||||
// Marker
|
||||
markerPositionSet = true;
|
||||
markerPosition.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime;
|
||||
markerPosition.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime;
|
||||
markerPosition.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime;
|
||||
markerPosition.X = rayStart.X + (rayEnd.X - rayStart.X) * hitTime;
|
||||
markerPosition.Y = rayStart.Y + (rayEnd.Y - rayStart.Y) * hitTime;
|
||||
markerPosition.Z = rayStart.Z + (rayEnd.Z - rayStart.Z) * hitTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
RcVec3f pos = new RcVec3f();
|
||||
pos.x = rayStart.x + (rayEnd.x - rayStart.x) * hitTime;
|
||||
pos.y = rayStart.y + (rayEnd.y - rayStart.y) * hitTime;
|
||||
pos.z = rayStart.z + (rayEnd.z - rayStart.z) * hitTime;
|
||||
pos.X = rayStart.X + (rayEnd.X - rayStart.X) * hitTime;
|
||||
pos.Y = rayStart.Y + (rayEnd.Y - rayStart.Y) * hitTime;
|
||||
pos.Z = rayStart.Z + (rayEnd.Z - rayStart.Z) * hitTime;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class ConvexVolumeSampleTool : ISampleTool
|
|||
float minh = float.MaxValue, maxh = 0;
|
||||
for (int i = 0; i < pts.Count; ++i)
|
||||
{
|
||||
minh = Math.Min(minh, pts[i].y);
|
||||
minh = Math.Min(minh, pts[i].Y);
|
||||
}
|
||||
|
||||
minh -= _boxDescent;
|
||||
|
@ -118,7 +118,7 @@ public class ConvexVolumeSampleTool : ISampleTool
|
|||
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();
|
||||
|
@ -128,12 +128,12 @@ public class ConvexVolumeSampleTool : ISampleTool
|
|||
{
|
||||
int vi = hull[j];
|
||||
int vj = hull[i];
|
||||
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[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[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, 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[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[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.End();
|
||||
|
|
|
@ -134,7 +134,7 @@ public class CrowdAgentProfilingSampleTool : ISampleTool
|
|||
{
|
||||
float radius = ag.option.radius;
|
||||
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())
|
||||
|
@ -166,8 +166,8 @@ public class CrowdAgentProfilingSampleTool : ISampleTool
|
|||
else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
|
||||
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,
|
||||
pos.z + radius, col);
|
||||
dd.DebugDrawCylinder(pos.X - radius, pos.Y + radius * 0.1f, pos.Z - radius, pos.X + radius, pos.Y + height,
|
||||
pos.Z + radius, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ public class CrowdSampleTool : ISampleTool
|
|||
}
|
||||
|
||||
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.
|
||||
if (_showGrid)
|
||||
|
@ -189,7 +189,7 @@ public class CrowdSampleTool : ISampleTool
|
|||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
RcVec3f pos = ag.corridor.GetPos();
|
||||
gridy = Math.Max(gridy, pos.y);
|
||||
gridy = Math.Max(gridy, pos.Y);
|
||||
}
|
||||
|
||||
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 v = idx * 3;
|
||||
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)));
|
||||
preva = a;
|
||||
prev.Set(trail.trail, v);
|
||||
|
@ -258,16 +258,16 @@ public class CrowdSampleTool : ISampleTool
|
|||
{
|
||||
RcVec3f va = j == 0 ? pos : ag.corners[j - 1].pos;
|
||||
RcVec3f vb = ag.corners[j].pos;
|
||||
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(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));
|
||||
}
|
||||
|
||||
if ((ag.corners[ag.corners.Count - 1].flags
|
||||
& DtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION) != 0)
|
||||
{
|
||||
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 + radius * 2, 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.End();
|
||||
|
@ -300,8 +300,8 @@ public class CrowdSampleTool : ISampleTool
|
|||
if (_showCollisionSegments)
|
||||
{
|
||||
RcVec3f center = ag.boundary.GetCenter();
|
||||
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.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.Begin(LINES, 3.0f);
|
||||
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)
|
||||
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();
|
||||
|
@ -321,7 +321,7 @@ public class CrowdSampleTool : ISampleTool
|
|||
|
||||
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);
|
||||
|
||||
dd.Begin(LINES, 2.0f);
|
||||
|
@ -330,8 +330,8 @@ public class CrowdSampleTool : ISampleTool
|
|||
DtCrowdAgent nei = ag.neis[j].agent;
|
||||
if (nei != null)
|
||||
{
|
||||
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(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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,9 +341,9 @@ public class CrowdSampleTool : ISampleTool
|
|||
if (_showOpt)
|
||||
{
|
||||
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));
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ public class CrowdSampleTool : ISampleTool
|
|||
if (agentDebug.agent == ag)
|
||||
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())
|
||||
|
@ -378,8 +378,8 @@ public class CrowdSampleTool : ISampleTool
|
|||
else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
|
||||
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,
|
||||
pos.z + radius, col);
|
||||
dd.DebugDrawCylinder(pos.X - radius, pos.Y + radius * 0.1f, pos.Z - radius, pos.X + radius, pos.Y + height,
|
||||
pos.Z + radius, col);
|
||||
}
|
||||
|
||||
if (_showVO)
|
||||
|
@ -392,9 +392,9 @@ public class CrowdSampleTool : ISampleTool
|
|||
// Draw detail about agent sela
|
||||
DtObstacleAvoidanceDebugData vod = agentDebug.vod;
|
||||
|
||||
float dx = ag.npos.x;
|
||||
float dy = ag.npos.y + ag.option.height;
|
||||
float dz = ag.npos.z;
|
||||
float dx = ag.npos.X;
|
||||
float dy = ag.npos.Y + ag.option.height;
|
||||
float dz = ag.npos.Z;
|
||||
|
||||
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);
|
||||
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));
|
||||
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();
|
||||
|
@ -437,12 +437,12 @@ public class CrowdSampleTool : ISampleTool
|
|||
else if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VELOCITY)
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,17 +254,17 @@ public class DynamicUpdateSampleTool : ISampleTool
|
|||
ImGui.Separator();
|
||||
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)
|
||||
{
|
||||
ImGui.Text($"End: {epos.x}, {epos.y + 1.3f}, {epos.z}");
|
||||
ImGui.Text($"End: {epos.X}, {epos.Y + 1.3f}, {epos.Z}");
|
||||
}
|
||||
|
||||
if (raycastHit)
|
||||
{
|
||||
ImGui.Text($"Hit: {raycastHitPos.x}, {raycastHitPos.y}, {raycastHitPos.z}");
|
||||
ImGui.Text($"Hit: {raycastHitPos.X}, {raycastHitPos.Y}, {raycastHitPos.Z}");
|
||||
}
|
||||
|
||||
ImGui.NewLine();
|
||||
|
@ -308,8 +308,8 @@ public class DynamicUpdateSampleTool : ISampleTool
|
|||
{
|
||||
int spathCol = raycastHit ? DuRGBA(128, 32, 16, 220) : DuRGBA(64, 128, 240, 220);
|
||||
dd.Begin(LINES, 2.0f);
|
||||
dd.Vertex(spos.x, spos.y + 1.3f, spos.z, spathCol);
|
||||
dd.Vertex(raycastHitPos.x, raycastHitPos.y, raycastHitPos.z, spathCol);
|
||||
dd.Vertex(spos.X, spos.Y + 1.3f, spos.Z, spathCol);
|
||||
dd.Vertex(raycastHitPos.X, raycastHitPos.Y, raycastHitPos.Z, spathCol);
|
||||
dd.End();
|
||||
}
|
||||
|
||||
|
@ -325,16 +325,16 @@ public class DynamicUpdateSampleTool : ISampleTool
|
|||
float c = settings.agentMaxClimb;
|
||||
dd.DepthMask(false);
|
||||
// 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.DebugDrawCircle(pos.x, pos.y + c, pos.z, r, DuRGBA(0, 0, 0, 64), 1.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);
|
||||
int colb = DuRGBA(0, 0, 0, 196);
|
||||
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 - 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 - 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, 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.DepthMask(true);
|
||||
}
|
||||
|
|
|
@ -47,11 +47,11 @@ public static class GizmoRenderer
|
|||
e1[j] = vertices[v2 + j] - vertices[v0 + j];
|
||||
}
|
||||
|
||||
normal.x = e0.y * e1.z - e0.z * e1.y;
|
||||
normal.y = e0.z * e1.x - e0.x * e1.z;
|
||||
normal.z = e0.x * e1.y - e0.y * e1.x;
|
||||
normal.X = e0.Y * e1.Z - e0.Z * e1.Y;
|
||||
normal.Y = e0.Z * e1.X - e0.X * e1.Z;
|
||||
normal.Z = e0.X * e1.Y - e0.Y * e1.X;
|
||||
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(
|
||||
DebugDraw.DuRGBA(32, 32, 0, 160),
|
||||
DebugDraw.DuRGBA(220, 220, 0, 160),
|
||||
|
@ -62,15 +62,15 @@ public static class GizmoRenderer
|
|||
|
||||
public static void RenderBox(RecastDebugDraw debugDraw, RcBoxGizmo box)
|
||||
{
|
||||
var trX = RcVec3f.Of(box.halfEdges[0].x, box.halfEdges[1].x, box.halfEdges[2].x);
|
||||
var trY = RcVec3f.Of(box.halfEdges[0].y, box.halfEdges[1].y, box.halfEdges[2].y);
|
||||
var trZ = RcVec3f.Of(box.halfEdges[0].z, box.halfEdges[1].z, box.halfEdges[2].z);
|
||||
var trX = RcVec3f.Of(box.halfEdges[0].X, box.halfEdges[1].X, box.halfEdges[2].X);
|
||||
var trY = RcVec3f.Of(box.halfEdges[0].Y, box.halfEdges[1].Y, box.halfEdges[2].Y);
|
||||
var trZ = RcVec3f.Of(box.halfEdges[0].Z, box.halfEdges[1].Z, box.halfEdges[2].Z);
|
||||
float[] vertices = new float[8 * 3];
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
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 + 2] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trZ) + box.center.z;
|
||||
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 + 2] = RcVec3f.Dot(RcBoxGizmo.VERTS[i], trZ) + box.center.Z;
|
||||
}
|
||||
|
||||
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)));
|
||||
|
||||
debugDraw.Vertex(
|
||||
sphere.radius * sphere.vertices[v] + sphere.center.x,
|
||||
sphere.radius * sphere.vertices[v + 1] + sphere.center.y,
|
||||
sphere.radius * sphere.vertices[v + 2] + sphere.center.z,
|
||||
sphere.radius * sphere.vertices[v] + sphere.center.X,
|
||||
sphere.radius * sphere.vertices[v + 1] + sphere.center.Y,
|
||||
sphere.radius * sphere.vertices[v + 2] + sphere.center.Z,
|
||||
col
|
||||
);
|
||||
}
|
||||
|
|
|
@ -245,14 +245,14 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
dd.End();
|
||||
|
||||
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 + 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, 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.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, 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.End();
|
||||
|
||||
GroundSegment end = link.end;
|
||||
|
@ -264,14 +264,14 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
dd.End();
|
||||
|
||||
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 + 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, 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.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, 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.End();
|
||||
|
||||
dd.Begin(LINES, 4.0f);
|
||||
|
@ -311,7 +311,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
col = DuRGBA(220, 32, 32, 255);
|
||||
}
|
||||
|
||||
spt.y = s.p.y + off;
|
||||
spt.Y = s.p.Y + off;
|
||||
dd.Vertex(spt, col);
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
off = 0.1f;
|
||||
}
|
||||
|
||||
spt.y = s.p.y + off;
|
||||
spt.Y = s.p.Y + off;
|
||||
dd.Vertex(spt, col);
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
col = DuRGBA(220, 32, 32, 255);
|
||||
}
|
||||
|
||||
spt.y = s.p.y + off;
|
||||
spt.Y = s.p.Y + off;
|
||||
dd.Vertex(spt, col);
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
off = 0.1f;
|
||||
}
|
||||
|
||||
spt.y = s.p.y + off;
|
||||
spt.Y = s.p.Y + off;
|
||||
dd.Vertex(spt, col);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class OffMeshConnectionSampleTool : ISampleTool
|
|||
|
||||
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();
|
||||
|
|
|
@ -223,7 +223,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
dd.Begin(LINES, 3.0f);
|
||||
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();
|
||||
|
@ -297,8 +297,8 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
col = spathCol;
|
||||
}
|
||||
|
||||
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(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.End();
|
||||
|
@ -324,7 +324,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
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();
|
||||
|
@ -352,8 +352,8 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
{
|
||||
DtStraightPath straightPathItem = m_straightPath[i];
|
||||
DtStraightPath straightPathItem2 = m_straightPath[i + 1];
|
||||
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(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.End();
|
||||
|
@ -361,7 +361,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
for (int i = 0; i < m_straightPath.Count; ++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();
|
||||
|
@ -370,8 +370,8 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
{
|
||||
int hitCol = DuRGBA(0, 0, 0, 128);
|
||||
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_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_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.End();
|
||||
}
|
||||
|
||||
|
@ -384,14 +384,14 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
dd.DepthMask(false);
|
||||
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)
|
||||
{
|
||||
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 + agentHeight, 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.End();
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
dd.DepthMask(false);
|
||||
RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[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);
|
||||
}
|
||||
|
||||
|
@ -421,10 +421,10 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
if (m_sposSet && m_eposSet)
|
||||
{
|
||||
dd.DepthMask(false);
|
||||
float dx = m_epos.x - m_spos.x;
|
||||
float dz = m_epos.z - m_spos.z;
|
||||
float dx = m_epos.X - m_spos.X;
|
||||
float dz = m_epos.Z - m_spos.Z;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
dd.DepthMask(false);
|
||||
RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[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);
|
||||
}
|
||||
|
||||
|
@ -456,8 +456,8 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
dd.Begin(LINES, 2.0f);
|
||||
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[i].x, m_queryPoly[i].y, m_queryPoly[i].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.End();
|
||||
|
@ -480,7 +480,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
dd.DepthMask(false);
|
||||
RcVec3f p0 = m_navMesh.GetPolyCenter(m_parent[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);
|
||||
}
|
||||
|
||||
|
@ -508,15 +508,15 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
|
||||
RcVec3f delta = s3.Subtract(s.vmin);
|
||||
RcVec3f p0 = RcVec3f.Mad(s.vmin, delta, 0.5f);
|
||||
RcVec3f norm = RcVec3f.Of(delta.z, 0, -delta.x);
|
||||
RcVec3f norm = RcVec3f.Of(delta.Z, 0, -delta.X);
|
||||
norm.Normalize();
|
||||
RcVec3f p1 = RcVec3f.Mad(p0, norm, agentRadius * 0.5f);
|
||||
// Skip backfacing segments.
|
||||
if (segmentRefs[j] != 0)
|
||||
{
|
||||
int col = DuRGBA(255, 255, 255, 32);
|
||||
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.vmin.X, s.vmin.Y + agentClimb, s.vmin.Z, col);
|
||||
dd.Vertex(s.vmax.X, s.vmax.Y + agentClimb, s.vmax.Z, col);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -526,11 +526,11 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
col = DuRGBA(96, 32, 16, 192);
|
||||
}
|
||||
|
||||
dd.Vertex(p0.x, p0.y + agentClimb, p0.z, col);
|
||||
dd.Vertex(p1.x, p1.y + agentClimb, p1.z, col);
|
||||
dd.Vertex(p0.X, p0.Y + agentClimb, p0.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.vmax.x, s.vmax.y + agentClimb, s.vmax.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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
if (m_sposSet)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -556,17 +556,17 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
int col = DuRGBA(64, 16, 0, 220);
|
||||
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();
|
||||
if (m_sposSet && m_eposSet)
|
||||
{
|
||||
dd.DepthMask(false);
|
||||
float dx = m_epos.x - m_spos.x;
|
||||
float dz = m_epos.z - m_spos.z;
|
||||
float dx = m_epos.X - m_spos.X;
|
||||
float dz = m_epos.Z - m_spos.Z;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -582,16 +582,16 @@ public class TestNavmeshSampleTool : ISampleTool
|
|||
float c = settings.agentMaxClimb;
|
||||
dd.DepthMask(false);
|
||||
// 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.DebugDrawCircle(pos.x, pos.y + c, pos.z, r, DuRGBA(0, 0, 0, 64), 1.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);
|
||||
int colb = DuRGBA(0, 0, 0, 196);
|
||||
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 - 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 - 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, 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.DepthMask(true);
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ public class TileSampleTool : ISampleTool
|
|||
var s = settings.agentRadius;
|
||||
|
||||
float ts = settings.tileSize * settings.cellSize;
|
||||
int tx = (int)((_hitPos.x - bmin[0]) / ts);
|
||||
int ty = (int)((_hitPos.z - bmin[2]) / ts);
|
||||
int tx = (int)((_hitPos.X - bmin[0]) / ts);
|
||||
int ty = (int)((_hitPos.Z - bmin[2]) / ts);
|
||||
|
||||
RcVec3f lastBuiltTileBmin = RcVec3f.Zero;
|
||||
RcVec3f lastBuiltTileBmax = RcVec3f.Zero;
|
||||
|
@ -73,10 +73,10 @@ public class TileSampleTool : ISampleTool
|
|||
lastBuiltTileBmax[1] = bmax[1];
|
||||
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(
|
||||
lastBuiltTileBmin.x, lastBuiltTileBmin.y, lastBuiltTileBmin.z,
|
||||
lastBuiltTileBmax.x, lastBuiltTileBmax.y, lastBuiltTileBmax.z,
|
||||
lastBuiltTileBmin.X, lastBuiltTileBmin.Y, lastBuiltTileBmin.Z,
|
||||
lastBuiltTileBmax.X, lastBuiltTileBmax.Y, lastBuiltTileBmax.Z,
|
||||
DuRGBA(255, 255, 255, 64), 1.0f);
|
||||
|
||||
// 표기
|
||||
|
|
|
@ -98,9 +98,9 @@ namespace DotRecast.Recast.Toolset.Geom
|
|||
e1[j] = vertices[v2 + j] - vertices[v0 + j];
|
||||
}
|
||||
|
||||
normals[i] = e0.y * e1.z - e0.z * e1.y;
|
||||
normals[i + 1] = e0.z * e1.x - e0.x * e1.z;
|
||||
normals[i + 2] = e0.x * e1.y - e0.y * e1.x;
|
||||
normals[i] = e0.Y * e1.Z - e0.Z * e1.Y;
|
||||
normals[i + 1] = e0.Z * e1.X - e0.X * e1.Z;
|
||||
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]);
|
||||
if (d > 0)
|
||||
{
|
||||
|
@ -150,10 +150,10 @@ namespace DotRecast.Recast.Toolset.Geom
|
|||
|
||||
float[] p = new float[2];
|
||||
float[] q = new float[2];
|
||||
p[0] = src.x + (dst.x - src.x) * btmin;
|
||||
p[1] = src.z + (dst.z - src.z) * btmin;
|
||||
q[0] = src.x + (dst.x - src.x) * btmax;
|
||||
q[1] = src.z + (dst.z - src.z) * btmax;
|
||||
p[0] = src.X + (dst.X - src.X) * btmin;
|
||||
p[1] = src.Z + (dst.Z - src.Z) * btmin;
|
||||
q[0] = src.X + (dst.X - src.X) * btmax;
|
||||
q[1] = src.Z + (dst.Z - src.Z) * btmax;
|
||||
|
||||
List<RcChunkyTriMeshNode> chunks = _mesh.chunkyTriMesh.GetChunksOverlappingSegment(p, q);
|
||||
if (0 == chunks.Count)
|
||||
|
|
|
@ -41,9 +41,9 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
float s0 = (i & 1) != 0 ? 1f : -1f;
|
||||
float s1 = (i & 2) != 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 + 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 + 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 + 2] = center.Z + s0 * halfEdges[0].Z + s1 * halfEdges[1].Z + s2 * halfEdges[2].Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,21 +16,21 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
{
|
||||
center = new float[]
|
||||
{
|
||||
0.5f * (start.x + end.x), 0.5f * (start.y + end.y),
|
||||
0.5f * (start.z + end.z)
|
||||
0.5f * (start.X + end.X), 0.5f * (start.Y + end.Y),
|
||||
0.5f * (start.Z + end.Z)
|
||||
};
|
||||
RcVec3f axis = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f[] normals = new RcVec3f[3];
|
||||
normals[1] = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
normals[1] = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f.Normalize(ref normals[1]);
|
||||
normals[0] = GetSideVector(axis);
|
||||
normals[2] = RcVec3f.Zero;
|
||||
RcVec3f.Cross(ref normals[2], normals[0], normals[1]);
|
||||
RcVec3f.Normalize(ref normals[2]);
|
||||
triangles = GenerateSphericalTriangles();
|
||||
var trX = RcVec3f.Of(normals[0].x, normals[1].x, normals[2].x);
|
||||
var trY = RcVec3f.Of(normals[0].y, normals[1].y, normals[2].y);
|
||||
var trZ = RcVec3f.Of(normals[0].z, normals[1].z, normals[2].z);
|
||||
var trX = RcVec3f.Of(normals[0].X, normals[1].X, normals[2].X);
|
||||
var trY = RcVec3f.Of(normals[0].Y, normals[1].Y, normals[2].Y);
|
||||
var trZ = RcVec3f.Of(normals[0].Z, normals[1].Z, normals[2].Z);
|
||||
float[] spVertices = GenerateSphericalVertices();
|
||||
float halfLength = 0.5f * axis.Length();
|
||||
vertices = new float[spVertices.Length];
|
||||
|
@ -42,21 +42,21 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
float x = radius * spVertices[i];
|
||||
float y = radius * spVertices[i + 1] + offset;
|
||||
float z = radius * spVertices[i + 2];
|
||||
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 + 2] = x * trZ.x + y * trZ.y + z * trZ.z + center[2];
|
||||
v.x = vertices[i] - center[0];
|
||||
v.y = vertices[i + 1] - center[1];
|
||||
v.z = vertices[i + 2] - center[2];
|
||||
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 + 2] = x * trZ.X + y * trZ.Y + z * trZ.Z + center[2];
|
||||
v.X = vertices[i] - center[0];
|
||||
v.Y = vertices[i + 1] - center[1];
|
||||
v.Z = vertices[i + 2] - center[2];
|
||||
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)
|
||||
{
|
||||
RcVec3f side = RcVec3f.Of(1, 0, 0);
|
||||
if (axis.x > 0.8)
|
||||
if (axis.X > 0.8)
|
||||
{
|
||||
side = RcVec3f.Of(0, 0, 1);
|
||||
}
|
||||
|
|
|
@ -16,21 +16,21 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
public RcCylinderGizmo(RcVec3f start, RcVec3f end, float radius)
|
||||
{
|
||||
center = RcVec3f.Of(
|
||||
0.5f * (start.x + end.x), 0.5f * (start.y + end.y),
|
||||
0.5f * (start.z + end.z)
|
||||
0.5f * (start.X + end.X), 0.5f * (start.Y + end.Y),
|
||||
0.5f * (start.Z + end.Z)
|
||||
);
|
||||
RcVec3f axis = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
RcVec3f axis = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f[] normals = new RcVec3f[3];
|
||||
normals[1] = RcVec3f.Of(end.x - start.x, end.y - start.y, end.z - start.z);
|
||||
normals[1] = RcVec3f.Of(end.X - start.X, end.Y - start.Y, end.Z - start.Z);
|
||||
RcVec3f.Normalize(ref normals[1]);
|
||||
normals[0] = GetSideVector(axis);
|
||||
normals[2] = RcVec3f.Zero;
|
||||
RcVec3f.Cross(ref normals[2], normals[0], normals[1]);
|
||||
RcVec3f.Normalize(ref normals[2]);
|
||||
triangles = GenerateCylindricalTriangles();
|
||||
RcVec3f trX = RcVec3f.Of(normals[0].x, normals[1].x, normals[2].x);
|
||||
RcVec3f trY = RcVec3f.Of(normals[0].y, normals[1].y, normals[2].y);
|
||||
RcVec3f trZ = RcVec3f.Of(normals[0].z, normals[1].z, normals[2].z);
|
||||
RcVec3f trX = RcVec3f.Of(normals[0].X, normals[1].X, normals[2].X);
|
||||
RcVec3f trY = RcVec3f.Of(normals[0].Y, normals[1].Y, normals[2].Y);
|
||||
RcVec3f trZ = RcVec3f.Of(normals[0].Z, normals[1].Z, normals[2].Z);
|
||||
vertices = GenerateCylindricalVertices();
|
||||
float halfLength = 0.5f * axis.Length();
|
||||
gradient = new float[vertices.Length / 3];
|
||||
|
@ -41,20 +41,20 @@ namespace DotRecast.Recast.Toolset.Gizmos
|
|||
float x = radius * vertices[i];
|
||||
float y = vertices[i + 1] + offset;
|
||||
float z = radius * vertices[i + 2];
|
||||
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 + 2] = x * trZ.x + y * trZ.y + z * trZ.z + center.z;
|
||||
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 + 2] = x * trZ.X + y * trZ.Y + z * trZ.Z + center.Z;
|
||||
if (i < vertices.Length / 4 || i >= 3 * vertices.Length / 4)
|
||||
{
|
||||
gradient[i / 3] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
v.x = vertices[i] - center.x;
|
||||
v.y = vertices[i + 1] - center.y;
|
||||
v.z = vertices[i + 2] - center.z;
|
||||
v.X = vertices[i] - center.X;
|
||||
v.Y = vertices[i + 1] - center.Y;
|
||||
v.Z = vertices[i + 2] - center.Z;
|
||||
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)
|
||||
{
|
||||
RcVec3f side = RcVec3f.Of(1, 0, 0);
|
||||
if (axis.x > 0.8)
|
||||
if (axis.X > 0.8)
|
||||
{
|
||||
side = RcVec3f.Of(0, 0, 1);
|
||||
}
|
||||
|
|
|
@ -80,8 +80,8 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
IList<RcConvexVolume> vols = geom.ConvexVolumes();
|
||||
for (int i = 0; i < vols.Count; ++i)
|
||||
{
|
||||
if (RcAreas.PointInPoly(vols[i].verts, pos) && pos.y >= vols[i].hmin
|
||||
&& pos.y <= vols[i].hmax)
|
||||
if (RcAreas.PointInPoly(vols[i].verts, pos) && pos.Y >= vols[i].hmin
|
||||
&& pos.Y <= vols[i].hmax)
|
||||
{
|
||||
nearestIndex = i;
|
||||
}
|
||||
|
@ -113,9 +113,9 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
float[] verts = new float[hull.Count * 3];
|
||||
for (int i = 0; i < hull.Count; ++i)
|
||||
{
|
||||
verts[i * 3] = pts[hull[i]].x;
|
||||
verts[i * 3 + 1] = pts[hull[i]].y;
|
||||
verts[i * 3 + 2] = pts[hull[i]].z;
|
||||
verts[i * 3] = pts[hull[i]].X;
|
||||
verts[i * 3 + 1] = pts[hull[i]].Y;
|
||||
verts[i * 3 + 2] = pts[hull[i]].Z;
|
||||
}
|
||||
|
||||
float minh = float.MaxValue, maxh = 0;
|
||||
|
|
|
@ -306,9 +306,9 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
|
||||
if (ag.targetState == DtMoveRequestState.DT_CROWDAGENT_TARGET_VALID)
|
||||
{
|
||||
float dx = ag.targetPos.x - ag.npos.x;
|
||||
float dy = ag.targetPos.y - ag.npos.y;
|
||||
float dz = ag.targetPos.z - ag.npos.z;
|
||||
float dx = ag.targetPos.X - ag.npos.X;
|
||||
float dy = ag.targetPos.Y - ag.npos.Y;
|
||||
float dz = ag.targetPos.Z - ag.npos.Z;
|
||||
return dx * dx + dy * dy + dz * dz < 0.3f;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,9 +150,9 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
RcCrowdAgentTrail trail = _trails[ag.idx];
|
||||
// Update agent movement trail.
|
||||
trail.htrail = (trail.htrail + 1) % RcCrowdAgentTrail.AGENT_MAX_TRAIL;
|
||||
trail.trail[trail.htrail * 3] = ag.npos.x;
|
||||
trail.trail[trail.htrail * 3 + 1] = ag.npos.y;
|
||||
trail.trail[trail.htrail * 3 + 2] = ag.npos.z;
|
||||
trail.trail[trail.htrail * 3] = ag.npos.X;
|
||||
trail.trail[trail.htrail * 3 + 1] = ag.npos.Y;
|
||||
trail.trail[trail.htrail * 3 + 2] = ag.npos.Z;
|
||||
}
|
||||
|
||||
_agentDebug.vod.NormalizeSamples();
|
||||
|
@ -188,9 +188,9 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
|
||||
for (int i = 0; i < RcCrowdAgentTrail.AGENT_MAX_TRAIL; ++i)
|
||||
{
|
||||
trail.trail[i * 3] = p.x;
|
||||
trail.trail[i * 3 + 1] = p.y;
|
||||
trail.trail[i * 3 + 2] = p.z;
|
||||
trail.trail[i * 3] = p.X;
|
||||
trail.trail[i * 3 + 1] = p.Y;
|
||||
trail.trail[i * 3 + 2] = p.Z;
|
||||
}
|
||||
|
||||
trail.htrail = 0;
|
||||
|
@ -240,12 +240,12 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
RcVec3f p = ag.npos;
|
||||
float r = ag.option.radius;
|
||||
float h = ag.option.height;
|
||||
bmin.x = p.x - r;
|
||||
bmin.y = p.y;
|
||||
bmin.z = p.z - r;
|
||||
bmax.x = p.x + r;
|
||||
bmax.y = p.y + h;
|
||||
bmax.z = p.z + r;
|
||||
bmin.X = p.X - r;
|
||||
bmin.Y = p.Y;
|
||||
bmin.Z = p.Z - r;
|
||||
bmax.X = p.X + r;
|
||||
bmax.Y = p.Y + h;
|
||||
bmax.Z = p.Z + r;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
RcVec3f vel = tgt.Subtract(pos);
|
||||
vel.y = 0.0f;
|
||||
vel.Y = 0.0f;
|
||||
vel.Normalize();
|
||||
return vel.Scale(speed);
|
||||
}
|
||||
|
|
|
@ -68,16 +68,16 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
float dy = 0.5f * (bounds[4] - bounds[1]);
|
||||
float dz = 0.5f * (bounds[5] - bounds[2]);
|
||||
float rSqr = dx * dx + dy * dy + dz * dz;
|
||||
float mx = point.x - cx;
|
||||
float my = point.y - cy;
|
||||
float mz = point.z - cz;
|
||||
float mx = point.X - cx;
|
||||
float my = point.Y - cy;
|
||||
float mz = point.Z - cz;
|
||||
float c = mx * mx + my * my + mz * mz - rSqr;
|
||||
if (c <= 0.0f)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return false;
|
||||
|
@ -184,11 +184,11 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
);
|
||||
a.Normalize();
|
||||
float len = 1f + (float)random.NextDouble() * 20f;
|
||||
a.x *= len;
|
||||
a.y *= len;
|
||||
a.z *= len;
|
||||
RcVec3f start = RcVec3f.Of(p.x, p.y, p.z);
|
||||
RcVec3f end = RcVec3f.Of(p.x + a.x, p.y + a.y, p.z + a.z);
|
||||
a.X *= len;
|
||||
a.Y *= len;
|
||||
a.Z *= len;
|
||||
RcVec3f start = RcVec3f.Of(p.X, p.Y, p.Z);
|
||||
RcVec3f end = RcVec3f.Of(p.X + a.X, p.Y + a.Y, p.Z + a.Z);
|
||||
var collider = new DtCapsuleCollider(start, end, radius, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_WATER, walkableClimb);
|
||||
var gizmo = RcGizmoFactory.Capsule(start, end, radius);
|
||||
return new RcGizmo(collider, gizmo);
|
||||
|
@ -218,8 +218,8 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
a[0] *= len;
|
||||
a[1] *= len;
|
||||
a[2] *= len;
|
||||
RcVec3f start = RcVec3f.Of(p.x, p.y, p.z);
|
||||
RcVec3f end = RcVec3f.Of(p.x + a.x, p.y + a.y, p.z + a.z);
|
||||
RcVec3f start = RcVec3f.Of(p.X, p.Y, p.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 gizmo = RcGizmoFactory.Cylinder(start, end, radius);
|
||||
|
||||
|
@ -229,7 +229,7 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
public RcGizmo CompositeCollider(RcVec3f p, float walkableClimb)
|
||||
{
|
||||
RcVec3f baseExtent = RcVec3f.Of(5, 3, 8);
|
||||
RcVec3f baseCenter = RcVec3f.Of(p.x, p.y + 3, p.z);
|
||||
RcVec3f baseCenter = RcVec3f.Of(p.X, p.Y + 3, p.Z);
|
||||
RcVec3f baseUp = RcVec3f.Of(0, 1, 0);
|
||||
RcVec3f forward = RcVec3f.Of((1f - 2 * (float)random.NextDouble()), 0, (1f - 2 * (float)random.NextDouble()));
|
||||
forward.Normalize();
|
||||
|
@ -238,22 +238,22 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb);
|
||||
var roofUp = RcVec3f.Zero;
|
||||
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);
|
||||
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),
|
||||
SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD, walkableClimb);
|
||||
RcVec3f trunkStart = RcVec3f.Of(
|
||||
baseCenter.x - forward.x * 15 + side.x * 6,
|
||||
p.y,
|
||||
baseCenter.z - forward.z * 15 + side.z * 6
|
||||
baseCenter.X - forward.X * 15 + side.X * 6,
|
||||
p.Y,
|
||||
baseCenter.Z - forward.Z * 15 + side.Z * 6
|
||||
);
|
||||
RcVec3f trunkEnd = RcVec3f.Of(trunkStart.x, trunkStart.y + 10, trunkStart.z);
|
||||
RcVec3f trunkEnd = RcVec3f.Of(trunkStart.X, trunkStart.Y + 10, trunkStart.Z);
|
||||
DtCapsuleCollider trunk = new DtCapsuleCollider(trunkStart, trunkEnd, 0.5f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_ROAD,
|
||||
walkableClimb);
|
||||
RcVec3f crownCenter = RcVec3f.Of(
|
||||
baseCenter.x - forward.x * 15 + side.x * 6, p.y + 10,
|
||||
baseCenter.z - forward.z * 15 + side.z * 6
|
||||
baseCenter.X - forward.X * 15 + side.X * 6, p.Y + 10,
|
||||
baseCenter.Z - forward.Z * 15 + side.Z * 6
|
||||
);
|
||||
DtSphereCollider crown = new DtSphereCollider(crownCenter, 4f, SampleAreaModifications.SAMPLE_POLYAREA_TYPE_GRASS,
|
||||
walkableClimb);
|
||||
|
@ -305,16 +305,16 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
RcVec3f vr = new RcVec3f();
|
||||
for (int i = 0; i < geom.vertices.Length; i += 3)
|
||||
{
|
||||
v.x = geom.vertices[i];
|
||||
v.y = geom.vertices[i + 1];
|
||||
v.z = geom.vertices[i + 2];
|
||||
v.X = geom.vertices[i];
|
||||
v.Y = geom.vertices[i + 1];
|
||||
v.Z = geom.vertices[i + 2];
|
||||
MulMatrixVector(ref vr, m, v);
|
||||
vr.x += p.x;
|
||||
vr.y += p.y - 0.1f;
|
||||
vr.z += p.z;
|
||||
verts[i] = vr.x;
|
||||
verts[i + 1] = vr.y;
|
||||
verts[i + 2] = vr.z;
|
||||
vr.X += p.X;
|
||||
vr.Y += p.Y - 0.1f;
|
||||
vr.Z += p.Z;
|
||||
verts[i] = vr.X;
|
||||
verts[i + 1] = vr.Y;
|
||||
verts[i + 2] = vr.Z;
|
||||
}
|
||||
|
||||
return verts;
|
||||
|
@ -330,9 +330,9 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
|
||||
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.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.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.Z = matrix.M13 * pvector.X + matrix.M23 * pvector.Y + matrix.M33 * pvector.Z;
|
||||
return resultvector;
|
||||
}
|
||||
|
||||
|
@ -354,12 +354,12 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
|
||||
public bool Raycast(RcVec3f spos, RcVec3f epos, out float hitPos, out RcVec3f raycastHitPos)
|
||||
{
|
||||
RcVec3f sp = RcVec3f.Of(spos.x, spos.y + 1.3f, spos.z);
|
||||
RcVec3f ep = RcVec3f.Of(epos.x, epos.y + 1.3f, epos.z);
|
||||
RcVec3f sp = RcVec3f.Of(spos.X, spos.Y + 1.3f, spos.Z);
|
||||
RcVec3f ep = RcVec3f.Of(epos.X, epos.Y + 1.3f, epos.Z);
|
||||
|
||||
bool hasHit = dynaMesh.VoxelQuery().Raycast(sp, ep, out hitPos);
|
||||
raycastHitPos = hasHit
|
||||
? RcVec3f.Of(sp.x + hitPos * (ep.x - sp.x), sp.y + hitPos * (ep.y - sp.y), sp.z + hitPos * (ep.z - sp.z))
|
||||
? RcVec3f.Of(sp.X + hitPos * (ep.X - sp.X), sp.Y + hitPos * (ep.Y - sp.Y), sp.Z + hitPos * (ep.Z - sp.Z))
|
||||
: ep;
|
||||
|
||||
return hasHit;
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
if (null == _tc)
|
||||
return 0;
|
||||
|
||||
p.y -= 0.5f;
|
||||
p.Y -= 0.5f;
|
||||
return _tc.AddObstacle(p, 1.0f, 2.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
var status = navQuery.GetPolyHeight(polys[0], result, out var h);
|
||||
if (status.Succeeded())
|
||||
{
|
||||
iterPos.y = h;
|
||||
iterPos.Y = h;
|
||||
}
|
||||
|
||||
// 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.
|
||||
iterPos = endPos;
|
||||
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;
|
||||
|
||||
// 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)
|
||||
{
|
||||
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);
|
||||
if (result.Succeeded())
|
||||
{
|
||||
hitPos.y = h;
|
||||
hitPos.Y = h;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,8 +326,8 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
return DtStatus.DT_FAILURE;
|
||||
}
|
||||
|
||||
float dx = epos.x - spos.x;
|
||||
float dz = epos.z - spos.z;
|
||||
float dx = epos.X - spos.X;
|
||||
float dz = epos.Z - spos.Z;
|
||||
float dist = (float)Math.Sqrt(dx * dx + dz * dz);
|
||||
|
||||
List<long> tempResultRefs = new List<long>();
|
||||
|
@ -372,25 +372,25 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
return DtStatus.DT_FAILURE;
|
||||
}
|
||||
|
||||
float nx = (epos.z - spos.z) * 0.25f;
|
||||
float nz = -(epos.x - spos.x) * 0.25f;
|
||||
float nx = (epos.Z - spos.Z) * 0.25f;
|
||||
float nz = -(epos.X - spos.X) * 0.25f;
|
||||
|
||||
var tempQueryPoly = new RcVec3f[4];
|
||||
tempQueryPoly[0].x = spos.x + nx * 1.2f;
|
||||
tempQueryPoly[0].y = spos.y + agentHeight / 2;
|
||||
tempQueryPoly[0].z = spos.z + nz * 1.2f;
|
||||
tempQueryPoly[0].X = spos.X + nx * 1.2f;
|
||||
tempQueryPoly[0].Y = spos.Y + agentHeight / 2;
|
||||
tempQueryPoly[0].Z = spos.Z + nz * 1.2f;
|
||||
|
||||
tempQueryPoly[1].x = spos.x - nx * 1.3f;
|
||||
tempQueryPoly[1].y = spos.y + agentHeight / 2;
|
||||
tempQueryPoly[1].z = spos.z - nz * 1.3f;
|
||||
tempQueryPoly[1].X = spos.X - nx * 1.3f;
|
||||
tempQueryPoly[1].Y = spos.Y + agentHeight / 2;
|
||||
tempQueryPoly[1].Z = spos.Z - nz * 1.3f;
|
||||
|
||||
tempQueryPoly[2].x = epos.x - nx * 0.8f;
|
||||
tempQueryPoly[2].y = epos.y + agentHeight / 2;
|
||||
tempQueryPoly[2].z = epos.z - nz * 0.8f;
|
||||
tempQueryPoly[2].X = epos.X - nx * 0.8f;
|
||||
tempQueryPoly[2].Y = epos.Y + agentHeight / 2;
|
||||
tempQueryPoly[2].Z = epos.Z - nz * 0.8f;
|
||||
|
||||
tempQueryPoly[3].x = epos.x + nx;
|
||||
tempQueryPoly[3].y = epos.y + agentHeight / 2;
|
||||
tempQueryPoly[3].z = epos.z + nz;
|
||||
tempQueryPoly[3].X = epos.X + nx;
|
||||
tempQueryPoly[3].Y = epos.Y + agentHeight / 2;
|
||||
tempQueryPoly[3].Z = epos.Z + nz;
|
||||
|
||||
var tempResultRefs = new List<long>();
|
||||
var tempResultParents = new List<long>();
|
||||
|
@ -414,8 +414,8 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
return DtStatus.DT_FAILURE;
|
||||
}
|
||||
|
||||
float dx = epos.x - spos.x;
|
||||
float dz = epos.z - spos.z;
|
||||
float dx = epos.X - spos.X;
|
||||
float dz = epos.Z - spos.Z;
|
||||
float dist = (float)Math.Sqrt(dx * dx + dz * dz);
|
||||
|
||||
IDtPolygonByCircleConstraint constraint = constrainByCircle
|
||||
|
|
|
@ -124,8 +124,8 @@ namespace DotRecast.Recast.Toolset.Tools
|
|||
RcVec3f bmin = geom.GetMeshBoundsMin();
|
||||
RcVec3f bmax = geom.GetMeshBoundsMax();
|
||||
|
||||
int tx = (int)((pos.x - bmin[0]) / ts);
|
||||
int ty = (int)((pos.z - bmin[2]) / ts);
|
||||
int tx = (int)((pos.X - bmin[0]) / ts);
|
||||
int ty = (int)((pos.Z - bmin[2]) / ts);
|
||||
|
||||
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();
|
||||
|
||||
int tx = (int)((pos.x - bmin[0]) / ts);
|
||||
int ty = (int)((pos.z - bmin[2]) / ts);
|
||||
int tx = (int)((pos.X - bmin[0]) / ts);
|
||||
int ty = (int)((pos.Z - bmin[2]) / ts);
|
||||
|
||||
var tileRef = navMesh.GetTileRefAt(tx, ty, 0);
|
||||
navMesh.RemoveTile(tileRef);
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace DotRecast.Recast.Geom
|
|||
|
||||
public int Compare(BoundsItem a, BoundsItem b)
|
||||
{
|
||||
return a.bmin.x.CompareTo(b.bmin.x);
|
||||
return a.bmin.X.CompareTo(b.bmin.X);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ namespace DotRecast.Recast.Geom
|
|||
|
||||
public int Compare(BoundsItem a, BoundsItem b)
|
||||
{
|
||||
return a.bmin.y.CompareTo(b.bmin.y);
|
||||
return a.bmin.Y.CompareTo(b.bmin.Y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,33 +32,33 @@ namespace DotRecast.Recast.Geom
|
|||
|
||||
private void CalcExtends(BoundsItem[] items, int imin, int imax, ref RcVec2f bmin, ref RcVec2f bmax)
|
||||
{
|
||||
bmin.x = items[imin].bmin.x;
|
||||
bmin.y = items[imin].bmin.y;
|
||||
bmin.X = items[imin].bmin.X;
|
||||
bmin.Y = items[imin].bmin.Y;
|
||||
|
||||
bmax.x = items[imin].bmax.x;
|
||||
bmax.y = items[imin].bmax.y;
|
||||
bmax.X = items[imin].bmax.X;
|
||||
bmax.Y = items[imin].bmax.Y;
|
||||
|
||||
for (int i = imin + 1; i < imax; ++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
|
||||
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)
|
||||
{
|
||||
|
@ -139,29 +139,29 @@ namespace DotRecast.Recast.Geom
|
|||
BoundsItem it = items[i] = new BoundsItem();
|
||||
it.i = i;
|
||||
// Calc triangle XZ bounds.
|
||||
it.bmin.x = it.bmax.x = verts[tris[t] * 3 + 0];
|
||||
it.bmin.y = it.bmax.y = verts[tris[t] * 3 + 2];
|
||||
it.bmin.X = it.bmax.X = verts[tris[t] * 3 + 0];
|
||||
it.bmin.Y = it.bmax.Y = verts[tris[t] * 3 + 2];
|
||||
for (int j = 1; j < 3; ++j)
|
||||
{
|
||||
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)
|
||||
{
|
||||
bool overlap = true;
|
||||
overlap = (amin[0] > bmax.x || amax[0] < bmin.x) ? false : overlap;
|
||||
overlap = (amin[1] > bmax.y || amax[1] < bmin.y) ? false : overlap;
|
||||
overlap = (amin[0] > bmax.X || amax[0] < bmin.X) ? false : overlap;
|
||||
overlap = (amin[1] > bmax.Y || amax[1] < bmin.Y) ? false : overlap;
|
||||
return overlap;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,12 +36,12 @@ namespace DotRecast.Recast.Geom
|
|||
public RcOffMeshConnection(RcVec3f start, RcVec3f end, float radius, bool bidir, int area, int flags)
|
||||
{
|
||||
verts = new float[6];
|
||||
verts[0] = start.x;
|
||||
verts[1] = start.y;
|
||||
verts[2] = start.z;
|
||||
verts[3] = end.x;
|
||||
verts[4] = end.y;
|
||||
verts[5] = end.z;
|
||||
verts[0] = start.X;
|
||||
verts[1] = start.Y;
|
||||
verts[2] = start.Z;
|
||||
verts[3] = end.X;
|
||||
verts[4] = end.Y;
|
||||
verts[5] = end.Z;
|
||||
this.radius = radius;
|
||||
this.bidir = bidir;
|
||||
this.area = area;
|
||||
|
|
|
@ -152,17 +152,17 @@ namespace DotRecast.Recast.Geom
|
|||
|
||||
var e0 = new RcVec3f();
|
||||
var e1 = new RcVec3f();
|
||||
e0.x = vertices[v1 + 0] - vertices[v0 + 0];
|
||||
e0.y = vertices[v1 + 1] - vertices[v0 + 1];
|
||||
e0.z = vertices[v1 + 2] - vertices[v0 + 2];
|
||||
e0.X = vertices[v1 + 0] - vertices[v0 + 0];
|
||||
e0.Y = vertices[v1 + 1] - vertices[v0 + 1];
|
||||
e0.Z = vertices[v1 + 2] - vertices[v0 + 2];
|
||||
|
||||
e1.x = vertices[v2 + 0] - vertices[v0 + 0];
|
||||
e1.y = vertices[v2 + 1] - vertices[v0 + 1];
|
||||
e1.z = vertices[v2 + 2] - vertices[v0 + 2];
|
||||
e1.X = vertices[v2 + 0] - vertices[v0 + 0];
|
||||
e1.Y = vertices[v2 + 1] - vertices[v0 + 1];
|
||||
e1.Z = vertices[v2 + 2] - vertices[v0 + 2];
|
||||
|
||||
normals[i] = e0.y * e1.z - e0.z * e1.y;
|
||||
normals[i + 1] = e0.z * e1.x - e0.x * e1.z;
|
||||
normals[i + 2] = e0.x * e1.y - e0.y * e1.x;
|
||||
normals[i] = e0.Y * e1.Z - e0.Z * e1.Y;
|
||||
normals[i + 1] = e0.Z * e1.X - e0.X * e1.Z;
|
||||
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]);
|
||||
if (d > 0)
|
||||
{
|
||||
|
|
|
@ -351,12 +351,12 @@ namespace DotRecast.Recast
|
|||
int zStride = xSize; // For readability
|
||||
|
||||
// Find the footprint of the box area in grid cell coordinates.
|
||||
int minX = (int)((boxMinBounds[0] - compactHeightfield.bmin.x) / compactHeightfield.cs);
|
||||
int minY = (int)((boxMinBounds[1] - compactHeightfield.bmin.y) / compactHeightfield.ch);
|
||||
int minZ = (int)((boxMinBounds[2] - compactHeightfield.bmin.z) / compactHeightfield.cs);
|
||||
int maxX = (int)((boxMaxBounds[0] - compactHeightfield.bmin.x) / compactHeightfield.cs);
|
||||
int maxY = (int)((boxMaxBounds[1] - compactHeightfield.bmin.y) / compactHeightfield.ch);
|
||||
int maxZ = (int)((boxMaxBounds[2] - compactHeightfield.bmin.z) / compactHeightfield.cs);
|
||||
int minX = (int)((boxMinBounds[0] - compactHeightfield.bmin.X) / compactHeightfield.cs);
|
||||
int minY = (int)((boxMinBounds[1] - compactHeightfield.bmin.Y) / compactHeightfield.ch);
|
||||
int minZ = (int)((boxMinBounds[2] - compactHeightfield.bmin.Z) / compactHeightfield.cs);
|
||||
int maxX = (int)((boxMaxBounds[0] - compactHeightfield.bmin.X) / compactHeightfield.cs);
|
||||
int maxY = (int)((boxMaxBounds[1] - compactHeightfield.bmin.Y) / compactHeightfield.ch);
|
||||
int maxZ = (int)((boxMaxBounds[2] - compactHeightfield.bmin.Z) / compactHeightfield.cs);
|
||||
|
||||
if (maxX < 0)
|
||||
{
|
||||
|
@ -465,16 +465,16 @@ namespace DotRecast.Recast
|
|||
bmax.Max(verts, i);
|
||||
}
|
||||
|
||||
bmin.y = minY;
|
||||
bmax.y = maxY;
|
||||
bmin.Y = minY;
|
||||
bmax.Y = maxY;
|
||||
|
||||
// Compute the grid footprint of the polygon
|
||||
int minx = (int)((bmin.x - compactHeightfield.bmin.x) / compactHeightfield.cs);
|
||||
int miny = (int)((bmin.y - compactHeightfield.bmin.y) / compactHeightfield.ch);
|
||||
int minz = (int)((bmin.z - compactHeightfield.bmin.z) / compactHeightfield.cs);
|
||||
int maxx = (int)((bmax.x - compactHeightfield.bmin.x) / compactHeightfield.cs);
|
||||
int maxy = (int)((bmax.y - compactHeightfield.bmin.y) / compactHeightfield.ch);
|
||||
int maxz = (int)((bmax.z - compactHeightfield.bmin.z) / compactHeightfield.cs);
|
||||
int minx = (int)((bmin.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
|
||||
int miny = (int)((bmin.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
|
||||
int minz = (int)((bmin.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
|
||||
int maxx = (int)((bmax.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
|
||||
int maxy = (int)((bmax.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
|
||||
int maxz = (int)((bmax.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
|
||||
|
||||
// Early-out if the polygon lies entirely outside the grid.
|
||||
if (maxx < 0)
|
||||
|
@ -540,9 +540,9 @@ namespace DotRecast.Recast
|
|||
}
|
||||
|
||||
RcVec3f point = new RcVec3f(
|
||||
compactHeightfield.bmin.x + (x + 0.5f) * compactHeightfield.cs,
|
||||
compactHeightfield.bmin.X + (x + 0.5f) * compactHeightfield.cs,
|
||||
0,
|
||||
compactHeightfield.bmin.z + (z + 0.5f) * compactHeightfield.cs
|
||||
compactHeightfield.bmin.Z + (z + 0.5f) * compactHeightfield.cs
|
||||
);
|
||||
|
||||
if (PointInPoly(verts, point))
|
||||
|
@ -590,12 +590,12 @@ namespace DotRecast.Recast
|
|||
);
|
||||
|
||||
// Compute the grid footprint of the cylinder
|
||||
int minx = (int)((cylinderBBMin.x - compactHeightfield.bmin.x) / compactHeightfield.cs);
|
||||
int miny = (int)((cylinderBBMin.y - compactHeightfield.bmin.y) / compactHeightfield.ch);
|
||||
int minz = (int)((cylinderBBMin.z - compactHeightfield.bmin.z) / compactHeightfield.cs);
|
||||
int maxx = (int)((cylinderBBMax.x - compactHeightfield.bmin.x) / compactHeightfield.cs);
|
||||
int maxy = (int)((cylinderBBMax.y - compactHeightfield.bmin.y) / compactHeightfield.ch);
|
||||
int maxz = (int)((cylinderBBMax.z - compactHeightfield.bmin.z) / compactHeightfield.cs);
|
||||
int minx = (int)((cylinderBBMin.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
|
||||
int miny = (int)((cylinderBBMin.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
|
||||
int minz = (int)((cylinderBBMin.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
|
||||
int maxx = (int)((cylinderBBMax.X - compactHeightfield.bmin.X) / compactHeightfield.cs);
|
||||
int maxy = (int)((cylinderBBMax.Y - compactHeightfield.bmin.Y) / compactHeightfield.ch);
|
||||
int maxz = (int)((cylinderBBMax.Z - compactHeightfield.bmin.Z) / compactHeightfield.cs);
|
||||
|
||||
// Early-out if the cylinder is completely outside the grid bounds.
|
||||
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 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -759,26 +759,26 @@ namespace DotRecast.Recast
|
|||
|
||||
// From A to B on the x/z plane
|
||||
RcVec3f prevSegmentDir = vertB.Subtract(vertA);
|
||||
prevSegmentDir.y = 0; // Squash onto x/z plane
|
||||
prevSegmentDir.Y = 0; // Squash onto x/z plane
|
||||
prevSegmentDir.SafeNormalize();
|
||||
|
||||
// From B to C on the x/z plane
|
||||
RcVec3f currSegmentDir = vertC.Subtract(vertB);
|
||||
currSegmentDir.y = 0; // Squash onto x/z plane
|
||||
currSegmentDir.Y = 0; // Squash onto x/z plane
|
||||
currSegmentDir.SafeNormalize();
|
||||
|
||||
// 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
|
||||
// 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.
|
||||
float prevSegmentNormX = -prevSegmentDir.z;
|
||||
float prevSegmentNormZ = prevSegmentDir.x;
|
||||
float prevSegmentNormX = -prevSegmentDir.Z;
|
||||
float prevSegmentNormZ = prevSegmentDir.X;
|
||||
|
||||
// CCW perpendicular vector to BC. The segment normal.
|
||||
float currSegmentNormX = -currSegmentDir.z;
|
||||
float currSegmentNormZ = currSegmentDir.x;
|
||||
float currSegmentNormX = -currSegmentDir.Z;
|
||||
float currSegmentNormZ = currSegmentDir.X;
|
||||
|
||||
// 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
|
||||
|
@ -808,16 +808,16 @@ namespace DotRecast.Recast
|
|||
|
||||
// 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.
|
||||
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 + 1] = vertB.y;
|
||||
outVerts[numOutVerts * 3 + 2] = vertB.z + (-prevSegmentNormZ + prevSegmentDir.z * d) * offset;
|
||||
outVerts[numOutVerts * 3 + 0] = vertB.X + (-prevSegmentNormX + prevSegmentDir.X * d) * offset;
|
||||
outVerts[numOutVerts * 3 + 1] = vertB.Y;
|
||||
outVerts[numOutVerts * 3 + 2] = vertB.Z + (-prevSegmentNormZ + prevSegmentDir.Z * d) * offset;
|
||||
numOutVerts++;
|
||||
|
||||
outVerts[numOutVerts * 3 + 0] = vertB.x + (-currSegmentNormX - currSegmentDir.x * d) * offset;
|
||||
outVerts[numOutVerts * 3 + 1] = vertB.y;
|
||||
outVerts[numOutVerts * 3 + 2] = vertB.z + (-currSegmentNormZ - currSegmentDir.z * d) * offset;
|
||||
outVerts[numOutVerts * 3 + 0] = vertB.X + (-currSegmentNormX - currSegmentDir.X * d) * offset;
|
||||
outVerts[numOutVerts * 3 + 1] = vertB.Y;
|
||||
outVerts[numOutVerts * 3 + 2] = vertB.Z + (-currSegmentNormZ - currSegmentDir.Z * d) * offset;
|
||||
numOutVerts++;
|
||||
}
|
||||
else
|
||||
|
@ -828,9 +828,9 @@ namespace DotRecast.Recast
|
|||
}
|
||||
|
||||
// Move B along the miter direction by the specified offset.
|
||||
outVerts[numOutVerts * 3 + 0] = vertB.x - cornerMiterX * offset;
|
||||
outVerts[numOutVerts * 3 + 1] = vertB.y;
|
||||
outVerts[numOutVerts * 3 + 2] = vertB.z - cornerMiterZ * offset;
|
||||
outVerts[numOutVerts * 3 + 0] = vertB.X - cornerMiterX * offset;
|
||||
outVerts[numOutVerts * 3 + 1] = vertB.Y;
|
||||
outVerts[numOutVerts * 3 + 2] = vertB.Z - cornerMiterZ * offset;
|
||||
numOutVerts++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,10 +56,10 @@ namespace DotRecast.Recast
|
|||
{
|
||||
float tsx = cfg.TileSizeX * cfg.Cs;
|
||||
float tsz = cfg.TileSizeZ * cfg.Cs;
|
||||
this.bmin.x += tileX * tsx;
|
||||
this.bmin.z += tileZ * tsz;
|
||||
this.bmax.x = this.bmin.x + tsx;
|
||||
this.bmax.z = this.bmin.z + tsz;
|
||||
this.bmin.X += tileX * tsx;
|
||||
this.bmin.Z += tileZ * tsz;
|
||||
this.bmax.X = this.bmin.X + tsx;
|
||||
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.
|
||||
//
|
||||
|
@ -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,
|
||||
// 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.z -= cfg.BorderSize * cfg.Cs;
|
||||
this.bmax.x += cfg.BorderSize * cfg.Cs;
|
||||
this.bmax.z += cfg.BorderSize * cfg.Cs;
|
||||
this.bmin.X -= cfg.BorderSize * cfg.Cs;
|
||||
this.bmin.Z -= cfg.BorderSize * cfg.Cs;
|
||||
this.bmax.X += cfg.BorderSize * cfg.Cs;
|
||||
this.bmax.Z += cfg.BorderSize * cfg.Cs;
|
||||
width = cfg.TileSizeX + cfg.BorderSize * 2;
|
||||
height = cfg.TileSizeZ + cfg.BorderSize * 2;
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ namespace DotRecast.Recast
|
|||
|
||||
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);
|
||||
sizeZ = (int)((bmax.z - bmin.z) / cs + 0.5f);
|
||||
sizeX = (int)((bmax.X - bmin.X) / cs + 0.5f);
|
||||
sizeZ = (int)((bmax.Z - bmin.Z) / cs + 0.5f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ namespace DotRecast.Recast
|
|||
int tri = i * 3;
|
||||
CalcTriNormal(verts, tris[tri], tris[tri + 1], tris[tri + 2], ref norm);
|
||||
// Check if the face is walkable.
|
||||
if (norm.y > walkableThr)
|
||||
if (norm.Y > walkableThr)
|
||||
areas[i] = areaMod.Apply(areas[i]);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ namespace DotRecast.Recast
|
|||
int tri = i * 3;
|
||||
CalcTriNormal(verts, tris[tri], tris[tri + 1], tris[tri + 2], ref norm);
|
||||
// Check if the face is walkable.
|
||||
if (norm.y <= walkableThr)
|
||||
if (norm.Y <= walkableThr)
|
||||
areas[i] = RC_NULL_AREA;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace DotRecast.Recast
|
|||
chf.maxRegions = 0;
|
||||
chf.bmin = hf.bmin;
|
||||
chf.bmax = hf.bmax;
|
||||
chf.bmax.y += walkableHeight * hf.ch;
|
||||
chf.bmax.Y += walkableHeight * hf.ch;
|
||||
chf.cs = hf.cs;
|
||||
chf.ch = hf.ch;
|
||||
chf.cells = new RcCompactCell[w * h];
|
||||
|
|
|
@ -736,10 +736,10 @@ namespace DotRecast.Recast
|
|||
{
|
||||
// If the heightfield was build with bordersize, remove the offset.
|
||||
float pad = borderSize * chf.cs;
|
||||
cset.bmin.x += pad;
|
||||
cset.bmin.z += pad;
|
||||
cset.bmax.x -= pad;
|
||||
cset.bmax.z -= pad;
|
||||
cset.bmin.X += pad;
|
||||
cset.bmin.Z += pad;
|
||||
cset.bmax.X -= pad;
|
||||
cset.bmax.Z -= pad;
|
||||
}
|
||||
|
||||
cset.cs = chf.cs;
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace DotRecast.Recast
|
|||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_SPHERE);
|
||||
float[] bounds =
|
||||
{
|
||||
center.x - radius, center.y - radius, center.z - radius, center.x + radius, center.y + radius,
|
||||
center.z + radius
|
||||
center.X - radius, center.Y - radius, center.Z - radius, center.X + radius, center.Y + radius,
|
||||
center.Z + radius
|
||||
};
|
||||
RasterizationFilledShape(hf, bounds, area, flagMergeThr,
|
||||
rectangle => IntersectSphere(rectangle, center, radius * radius));
|
||||
|
@ -48,11 +48,11 @@ namespace DotRecast.Recast
|
|||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_CAPSULE);
|
||||
float[] bounds =
|
||||
{
|
||||
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.Max(start.z, end.z) + 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.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,
|
||||
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);
|
||||
float[] bounds =
|
||||
{
|
||||
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.Max(start.z, end.z) + 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.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,
|
||||
rectangle => IntersectCylinder(rectangle, start, end, axis, radius * radius));
|
||||
}
|
||||
|
@ -76,9 +76,9 @@ namespace DotRecast.Recast
|
|||
using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_RASTERIZE_BOX);
|
||||
RcVec3f[] normals =
|
||||
{
|
||||
RcVec3f.Of(halfEdges[0].x, halfEdges[0].y, halfEdges[0].z),
|
||||
RcVec3f.Of(halfEdges[1].x, halfEdges[1].y, halfEdges[1].z),
|
||||
RcVec3f.Of(halfEdges[2].x, halfEdges[2].y, halfEdges[2].z),
|
||||
RcVec3f.Of(halfEdges[0].X, halfEdges[0].Y, halfEdges[0].Z),
|
||||
RcVec3f.Of(halfEdges[1].X, halfEdges[1].Y, halfEdges[1].Z),
|
||||
RcVec3f.Of(halfEdges[2].X, halfEdges[2].Y, halfEdges[2].Z),
|
||||
};
|
||||
RcVec3f.Normalize(ref normals[0]);
|
||||
RcVec3f.Normalize(ref normals[1]);
|
||||
|
@ -95,9 +95,9 @@ namespace DotRecast.Recast
|
|||
float s0 = (i & 1) != 0 ? 1f : -1f;
|
||||
float s1 = (i & 2) != 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 + 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 + 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 + 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[1] = Math.Min(bounds[1], vertices[i * 3 + 1]);
|
||||
bounds[2] = Math.Min(bounds[2], vertices[i * 3 + 2]);
|
||||
|
@ -111,9 +111,9 @@ namespace DotRecast.Recast
|
|||
{
|
||||
float m = i < 3 ? -1 : 1;
|
||||
int vi = i < 3 ? 0 : 7;
|
||||
planes[i][0] = m * normals[i % 3].x;
|
||||
planes[i][1] = m * normals[i % 3].y;
|
||||
planes[i][2] = m * normals[i % 3].z;
|
||||
planes[i][0] = m * normals[i % 3].X;
|
||||
planes[i][1] = m * normals[i % 3].Y;
|
||||
planes[i][2] = m * normals[i % 3].Z;
|
||||
planes[i][3] = vertices[vi * 3] * planes[i][0] + vertices[vi * 3 + 1] * planes[i][1]
|
||||
+ vertices[vi * 3 + 2] * planes[i][2];
|
||||
}
|
||||
|
@ -189,10 +189,10 @@ namespace DotRecast.Recast
|
|||
return;
|
||||
}
|
||||
|
||||
bounds[3] = Math.Min(bounds[3], hf.bmax.x);
|
||||
bounds[5] = Math.Min(bounds[5], hf.bmax.z);
|
||||
bounds[0] = Math.Max(bounds[0], hf.bmin.x);
|
||||
bounds[2] = Math.Max(bounds[2], hf.bmin.z);
|
||||
bounds[3] = Math.Min(bounds[3], hf.bmax.X);
|
||||
bounds[5] = Math.Min(bounds[5], hf.bmax.Z);
|
||||
bounds[0] = Math.Max(bounds[0], hf.bmin.X);
|
||||
bounds[2] = Math.Max(bounds[2], hf.bmin.Z);
|
||||
|
||||
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 ich = 1.0f / hf.ch;
|
||||
int xMin = (int)((bounds[0] - hf.bmin.x) * 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 zMax = Math.Min(hf.height - 1, (int)((bounds[5] - hf.bmin.z) * ics));
|
||||
int xMin = (int)((bounds[0] - hf.bmin.X) * 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 zMax = Math.Min(hf.height - 1, (int)((bounds[5] - hf.bmin.Z) * ics));
|
||||
float[] rectangle = new float[5];
|
||||
rectangle[4] = hf.bmin.y;
|
||||
rectangle[4] = hf.bmin.Y;
|
||||
for (int x = xMin; x <= xMax; x++)
|
||||
{
|
||||
for (int z = zMin; z <= zMax; z++)
|
||||
{
|
||||
rectangle[0] = x * hf.cs + hf.bmin.x;
|
||||
rectangle[1] = z * hf.cs + hf.bmin.z;
|
||||
rectangle[0] = x * hf.cs + hf.bmin.X;
|
||||
rectangle[1] = z * hf.cs + hf.bmin.Z;
|
||||
rectangle[2] = rectangle[0] + hf.cs;
|
||||
rectangle[3] = rectangle[1] + hf.cs;
|
||||
float[] h = intersection.Invoke(rectangle);
|
||||
if (h != null)
|
||||
{
|
||||
int smin = (int)Math.Floor((h[0] - hf.bmin.y) * ich);
|
||||
int smax = (int)Math.Ceiling((h[1] - 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);
|
||||
if (smin != smax)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 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 my = y - center.y;
|
||||
float mz = z - center.z;
|
||||
float mx = x - center.X;
|
||||
float my = y - center.Y;
|
||||
float mz = z - center.Z;
|
||||
|
||||
float b = my; // Dot(m, d) d = (0, 1, 0)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
s = SlabsCylinderIntersection(rectangle, start, end, axis, radiusSqr, s);
|
||||
|
@ -282,20 +282,20 @@ namespace DotRecast.Recast
|
|||
{
|
||||
float[] s = MergeIntersections(
|
||||
RayCylinderIntersection(RcVec3f.Of(
|
||||
Math.Clamp(start.x, rectangle[0], rectangle[2]), rectangle[4],
|
||||
Math.Clamp(start.z, rectangle[1], rectangle[3])
|
||||
Math.Clamp(start.X, rectangle[0], rectangle[2]), rectangle[4],
|
||||
Math.Clamp(start.Z, rectangle[1], rectangle[3])
|
||||
), start, axis, radiusSqr),
|
||||
RayCylinderIntersection(RcVec3f.Of(
|
||||
Math.Clamp(end.x, rectangle[0], rectangle[2]), rectangle[4],
|
||||
Math.Clamp(end.z, rectangle[1], rectangle[3])
|
||||
Math.Clamp(end.X, rectangle[0], rectangle[2]), rectangle[4],
|
||||
Math.Clamp(end.Z, rectangle[1], rectangle[3])
|
||||
), 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)
|
||||
{
|
||||
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[] rectangleOnEndPlane = new RcVec3f[4];
|
||||
|
@ -307,14 +307,14 @@ namespace DotRecast.Recast
|
|||
float z = rectangle[(i & 2) + 1];
|
||||
RcVec3f a = RcVec3f.Of(x, rectangle[4], z);
|
||||
float dotAxisA = RcVec3f.Dot(axis, a);
|
||||
float t = (ds - dotAxisA) / axis.y;
|
||||
rectangleOnStartPlane[i].x = x;
|
||||
rectangleOnStartPlane[i].y = rectangle[4] + t;
|
||||
rectangleOnStartPlane[i].z = z;
|
||||
t = (de - dotAxisA) / axis.y;
|
||||
rectangleOnEndPlane[i].x = x;
|
||||
rectangleOnEndPlane[i].y = rectangle[4] + t;
|
||||
rectangleOnEndPlane[i].z = z;
|
||||
float t = (ds - dotAxisA) / axis.Y;
|
||||
rectangleOnStartPlane[i].X = x;
|
||||
rectangleOnStartPlane[i].Y = rectangle[4] + t;
|
||||
rectangleOnStartPlane[i].Z = z;
|
||||
t = (de - dotAxisA) / axis.Y;
|
||||
rectangleOnEndPlane[i].X = x;
|
||||
rectangleOnEndPlane[i].Y = rectangle[4] + t;
|
||||
rectangleOnEndPlane[i].Z = z;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
@ -332,14 +332,14 @@ namespace DotRecast.Recast
|
|||
int j = (i + 1) % 4;
|
||||
// Ray against sphere intersection
|
||||
var m = RcVec3f.Of(
|
||||
rectangleOnPlane[i].x - start.x,
|
||||
rectangleOnPlane[i].y - start.y,
|
||||
rectangleOnPlane[i].z - start.z
|
||||
rectangleOnPlane[i].X - start.X,
|
||||
rectangleOnPlane[i].Y - start.Y,
|
||||
rectangleOnPlane[i].Z - start.Z
|
||||
);
|
||||
var d = RcVec3f.Of(
|
||||
rectangleOnPlane[j].x - rectangleOnPlane[i].x,
|
||||
rectangleOnPlane[j].y - rectangleOnPlane[i].y,
|
||||
rectangleOnPlane[j].z - rectangleOnPlane[i].z
|
||||
rectangleOnPlane[j].X - rectangleOnPlane[i].X,
|
||||
rectangleOnPlane[j].Y - rectangleOnPlane[i].Y,
|
||||
rectangleOnPlane[j].Z - rectangleOnPlane[i].Z
|
||||
);
|
||||
float dl = RcVec3f.Dot(d, d);
|
||||
float b = RcVec3f.Dot(m, d) / dl;
|
||||
|
@ -354,8 +354,8 @@ namespace DotRecast.Recast
|
|||
{
|
||||
t1 = Math.Max(0, t1);
|
||||
t2 = Math.Min(1, t2);
|
||||
float y1 = rectangleOnPlane[i].y + t1 * d.y;
|
||||
float y2 = rectangleOnPlane[i].y + t2 * d.y;
|
||||
float y1 = rectangleOnPlane[i].Y + t1 * d.Y;
|
||||
float y2 = rectangleOnPlane[i].Y + t2 * d.Y;
|
||||
float[] y = { Math.Min(y1, y2), Math.Max(y1, y2) };
|
||||
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)
|
||||
{
|
||||
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]));
|
||||
}
|
||||
|
||||
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]));
|
||||
}
|
||||
|
||||
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]));
|
||||
}
|
||||
|
||||
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]));
|
||||
}
|
||||
|
@ -397,8 +397,8 @@ namespace DotRecast.Recast
|
|||
private static RcVec3f XSlabRayIntersection(float[] rectangle, RcVec3f start, RcVec3f direction, float x)
|
||||
{
|
||||
// 2d intersection of plane and segment
|
||||
float t = (x - start.x) / direction.x;
|
||||
float z = Math.Clamp(start.z + t * direction.z, rectangle[1], rectangle[3]);
|
||||
float t = (x - start.X) / direction.X;
|
||||
float z = Math.Clamp(start.Z + t * direction.Z, rectangle[1], rectangle[3]);
|
||||
return RcVec3f.Of(x, rectangle[4], z);
|
||||
}
|
||||
|
||||
|
@ -410,8 +410,8 @@ namespace DotRecast.Recast
|
|||
private static RcVec3f ZSlabRayIntersection(float[] rectangle, RcVec3f start, RcVec3f direction, float z)
|
||||
{
|
||||
// 2d intersection of plane and segment
|
||||
float t = (z - start.z) / direction.z;
|
||||
float x = Math.Clamp(start.x + t * direction.x, rectangle[0], rectangle[2]);
|
||||
float t = (z - start.Z) / direction.Z;
|
||||
float x = Math.Clamp(start.X + t * direction.X, rectangle[0], rectangle[2]);
|
||||
return RcVec3f.Of(x, rectangle[4], z);
|
||||
}
|
||||
|
||||
|
@ -419,17 +419,17 @@ namespace DotRecast.Recast
|
|||
private static float[] RayCylinderIntersection(RcVec3f point, RcVec3f start, RcVec3f axis, float radiusSqr)
|
||||
{
|
||||
RcVec3f d = axis;
|
||||
RcVec3f m = RcVec3f.Of(point.x - start.x, point.y - start.y, point.z - start.z);
|
||||
RcVec3f m = RcVec3f.Of(point.X - start.X, point.Y - start.Y, point.Z - start.Z);
|
||||
// float[] n = { 0, 1, 0 };
|
||||
float md = RcVec3f.Dot(m, d);
|
||||
// float nd = Dot(n, d);
|
||||
float nd = axis.y;
|
||||
float nd = axis.Y;
|
||||
float dd = RcVec3f.Dot(d, d);
|
||||
|
||||
// float nn = Dot(n, n);
|
||||
float nn = 1;
|
||||
// float mn = Dot(m, n);
|
||||
float mn = m.y;
|
||||
float mn = m.Y;
|
||||
// float a = dd * nn - nd * nd;
|
||||
float a = dd - nd * nd;
|
||||
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
|
||||
float tt1 = -mn / nn; // Intersect segment against ’p’ 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;
|
||||
|
@ -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)
|
||||
|
@ -520,21 +520,21 @@ namespace DotRecast.Recast
|
|||
var point = RcVec3f.Of(0, rectangle[1], 0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
point.x = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
|
||||
point.z = ((i & 2) == 0) ? rectangle[1] : rectangle[3];
|
||||
point.X = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
|
||||
point.Z = ((i & 2) == 0) ? rectangle[1] : rectangle[3];
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
if (Math.Abs(planes[j][1]) > EPSILON)
|
||||
{
|
||||
float dotNormalPoint = RcVec3f.Dot(planes[j], point);
|
||||
float t = (planes[j][3] - dotNormalPoint) / planes[j][1];
|
||||
float y = point.y + t;
|
||||
float y = point.Y + t;
|
||||
bool valid = true;
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
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;
|
||||
break;
|
||||
|
@ -673,8 +673,8 @@ namespace DotRecast.Recast
|
|||
var point = RcVec3f.Of(0, rectangle[1], 0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
point.x = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
|
||||
point.z = ((i & 2) == 0) ? rectangle[1] : rectangle[3];
|
||||
point.X = ((i & 1) == 0) ? rectangle[0] : rectangle[2];
|
||||
point.Z = ((i & 2) == 0) ? rectangle[1] : rectangle[3];
|
||||
if (RayTriangleIntersection(point, tri, planes, out var y))
|
||||
{
|
||||
imin = Math.Min(imin, y);
|
||||
|
@ -731,7 +731,7 @@ namespace DotRecast.Recast
|
|||
{
|
||||
y = 0.0f;
|
||||
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];
|
||||
if (u < 0.0f || u > 1.0f)
|
||||
{
|
||||
|
@ -777,9 +777,9 @@ namespace DotRecast.Recast
|
|||
private static bool OverlapBounds(RcVec3f amin, RcVec3f amax, float[] bounds)
|
||||
{
|
||||
bool overlap = true;
|
||||
overlap = (amin.x > bounds[3] || amax.x < bounds[0]) ? false : overlap;
|
||||
overlap = (amin.y > bounds[4]) ? false : overlap;
|
||||
overlap = (amin.z > bounds[5] || amax.z < bounds[2]) ? false : overlap;
|
||||
overlap = (amin.X > bounds[3] || amax.X < bounds[0]) ? false : overlap;
|
||||
overlap = (amin.Y > bounds[4]) ? false : overlap;
|
||||
overlap = (amin.Z > bounds[5] || amax.Z < bounds[2]) ? false : overlap;
|
||||
return overlap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -411,10 +411,10 @@ namespace DotRecast.Recast
|
|||
// Build contracted bbox for layers.
|
||||
RcVec3f bmin = chf.bmin;
|
||||
RcVec3f bmax = chf.bmax;
|
||||
bmin.x += borderSize * chf.cs;
|
||||
bmin.z += borderSize * chf.cs;
|
||||
bmax.x -= borderSize * chf.cs;
|
||||
bmax.z -= borderSize * chf.cs;
|
||||
bmin.X += borderSize * chf.cs;
|
||||
bmin.Z += borderSize * chf.cs;
|
||||
bmax.X -= borderSize * chf.cs;
|
||||
bmax.Z -= borderSize * chf.cs;
|
||||
|
||||
RcHeightfieldLayerSet lset = new RcHeightfieldLayerSet();
|
||||
lset.layers = new RcHeightfieldLayer[layerId];
|
||||
|
@ -456,8 +456,8 @@ namespace DotRecast.Recast
|
|||
// Adjust the bbox to fit the heightfield.
|
||||
layer.bmin = bmin;
|
||||
layer.bmax = bmax;
|
||||
layer.bmin.y = bmin.y + hmin * chf.ch;
|
||||
layer.bmax.y = bmin.y + hmax * chf.ch;
|
||||
layer.bmin.Y = bmin.Y + hmin * chf.ch;
|
||||
layer.bmax.Y = bmin.Y + hmax * chf.ch;
|
||||
layer.hmin = hmin;
|
||||
layer.hmax = hmax;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace DotRecast.Recast
|
|||
|
||||
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)
|
||||
{
|
||||
float dx = q.x - p[0];
|
||||
float dy = q.z - p[2];
|
||||
float dx = q.X - p[0];
|
||||
float dy = q.Z - p[2];
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
|
||||
private static float VdistSq2(RcVec3f p, RcVec3f q)
|
||||
{
|
||||
float dx = q.x - p.x;
|
||||
float dy = q.z - p.z;
|
||||
float dx = q.X - p.X;
|
||||
float dy = q.Z - p.Z;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
|
@ -111,8 +111,8 @@ namespace DotRecast.Recast
|
|||
|
||||
private static float VdistSq2(RcVec3f p, float[] verts, int q)
|
||||
{
|
||||
float dx = verts[q + 0] - p.x;
|
||||
float dy = verts[q + 2] - p.z;
|
||||
float dx = verts[q + 0] - p.X;
|
||||
float dy = verts[q + 2] - p.Z;
|
||||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
|
@ -148,10 +148,10 @@ namespace DotRecast.Recast
|
|||
|
||||
private static float Vcross2(RcVec3f p1, RcVec3f p2, RcVec3f p3)
|
||||
{
|
||||
float u1 = p2.x - p1.x;
|
||||
float v1 = p2.z - p1.z;
|
||||
float u2 = p3.x - p1.x;
|
||||
float v2 = p3.z - p1.z;
|
||||
float u1 = p2.X - p1.X;
|
||||
float v1 = p2.Z - p1.Z;
|
||||
float u2 = p3.X - p1.X;
|
||||
float v2 = p3.Z - p1.Z;
|
||||
return u1 * v2 - v1 * u2;
|
||||
}
|
||||
|
||||
|
@ -172,9 +172,9 @@ namespace DotRecast.Recast
|
|||
float v1Sq = Vdot2(v1, v1);
|
||||
float v2Sq = Vdot2(v2, v2);
|
||||
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.y = 0;
|
||||
c.z = (v1Sq * (v3.x - v2.x) + v2Sq * (v1.x - v3.x) + v3Sq * (v2.x - v1.x)) / (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.Z = (v1Sq * (v3.X - v2.X) + v2Sq * (v1.X - v3.X) + v3Sq * (v2.X - v1.X)) / (2 * cp);
|
||||
r.Exchange(Vdist2(c, v1));
|
||||
RcVec3f.Add(ref c, c, verts, p1);
|
||||
return true;
|
||||
|
@ -209,8 +209,8 @@ namespace DotRecast.Recast
|
|||
const float EPS = 1e-4f;
|
||||
if (u >= -EPS && v >= -EPS && (u + v) <= 1 + EPS)
|
||||
{
|
||||
float y = verts[a + 1] + v0.y * u + v1.y * v;
|
||||
return Math.Abs(y - p.y);
|
||||
float y = verts[a + 1] + v0.Y * u + v1.Y * v;
|
||||
return Math.Abs(y - p.Y);
|
||||
}
|
||||
|
||||
return float.MaxValue;
|
||||
|
@ -251,8 +251,8 @@ namespace DotRecast.Recast
|
|||
{
|
||||
float pqx = poly[q + 0] - poly[p + 0];
|
||||
float pqz = poly[q + 2] - poly[p + 2];
|
||||
float dx = verts.x - poly[p + 0];
|
||||
float dz = verts.z - poly[p + 2];
|
||||
float dx = verts.X - poly[p + 0];
|
||||
float dz = verts.Z - poly[p + 2];
|
||||
float d = pqx * pqx + pqz * pqz;
|
||||
float t = pqx * dx + pqz * dz;
|
||||
if (d > 0)
|
||||
|
@ -269,8 +269,8 @@ namespace DotRecast.Recast
|
|||
t = 1;
|
||||
}
|
||||
|
||||
dx = poly[p + 0] + t * pqx - verts.x;
|
||||
dz = poly[p + 2] + t * pqz - verts.z;
|
||||
dx = poly[p + 0] + t * pqx - verts.X;
|
||||
dz = poly[p + 2] + t * pqz - verts.Z;
|
||||
|
||||
return dx * dx + dz * dz;
|
||||
}
|
||||
|
@ -335,8 +335,8 @@ namespace DotRecast.Recast
|
|||
{
|
||||
int vi = i * 3;
|
||||
int vj = j * 3;
|
||||
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]))
|
||||
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]))
|
||||
{
|
||||
c = !c;
|
||||
}
|
||||
|
@ -1015,19 +1015,19 @@ namespace DotRecast.Recast
|
|||
bmax.Max(@in, i * 3);
|
||||
}
|
||||
|
||||
int x0 = (int)Math.Floor(bmin.x / sampleDist);
|
||||
int x1 = (int)Math.Ceiling(bmax.x / sampleDist);
|
||||
int z0 = (int)Math.Floor(bmin.z / sampleDist);
|
||||
int z1 = (int)Math.Ceiling(bmax.z / sampleDist);
|
||||
int x0 = (int)Math.Floor(bmin.X / sampleDist);
|
||||
int x1 = (int)Math.Ceiling(bmax.X / sampleDist);
|
||||
int z0 = (int)Math.Floor(bmin.Z / sampleDist);
|
||||
int z1 = (int)Math.Ceiling(bmax.Z / sampleDist);
|
||||
samples.Clear();
|
||||
for (int z = z0; z < z1; ++z)
|
||||
{
|
||||
for (int x = x0; x < x1; ++x)
|
||||
{
|
||||
RcVec3f pt = new RcVec3f();
|
||||
pt.x = x * sampleDist;
|
||||
pt.y = (bmax.y + bmin.y) * 0.5f;
|
||||
pt.z = z * sampleDist;
|
||||
pt.X = x * sampleDist;
|
||||
pt.Y = (bmax.Y + bmin.Y) * 0.5f;
|
||||
pt.Z = z * sampleDist;
|
||||
// Make sure the samples are not too close to the edges.
|
||||
if (DistToPoly(nin, @in, pt) > -sampleDist / 2)
|
||||
{
|
||||
|
@ -1035,7 +1035,7 @@ namespace DotRecast.Recast
|
|||
}
|
||||
|
||||
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(0); // Not added
|
||||
}
|
||||
|
@ -1067,9 +1067,9 @@ namespace DotRecast.Recast
|
|||
RcVec3f pt = new RcVec3f();
|
||||
// The sample location is jittered to get rid of some bad triangulations
|
||||
// which are cause by symmetrical data from the grid structure.
|
||||
pt.x = samples[s + 0] * sampleDist + GetJitterX(i) * cs * 0.1f;
|
||||
pt.y = samples[s + 1] * chf.ch;
|
||||
pt.z = samples[s + 2] * sampleDist + GetJitterY(i) * cs * 0.1f;
|
||||
pt.X = samples[s + 0] * sampleDist + GetJitterX(i) * cs * 0.1f;
|
||||
pt.Y = samples[s + 1] * chf.ch;
|
||||
pt.Z = samples[s + 2] * sampleDist + GetJitterY(i) * cs * 0.1f;
|
||||
float d = DistToTriMesh(pt, verts, nverts, tris, tris.Count / 4);
|
||||
if (d < 0)
|
||||
{
|
||||
|
@ -1536,18 +1536,18 @@ namespace DotRecast.Recast
|
|||
// Move detail verts to world space.
|
||||
for (int j = 0; j < nverts; ++j)
|
||||
{
|
||||
verts[j * 3 + 0] += orig.x;
|
||||
verts[j * 3 + 1] += orig.y + chf.ch; // Is this offset necessary? See
|
||||
verts[j * 3 + 0] += orig.X;
|
||||
verts[j * 3 + 1] += orig.Y + chf.ch; // Is this offset necessary? See
|
||||
// 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.
|
||||
for (int j = 0; j < npoly; ++j)
|
||||
{
|
||||
poly[j * 3 + 0] += orig.x;
|
||||
poly[j * 3 + 1] += orig.y;
|
||||
poly[j * 3 + 2] += orig.z;
|
||||
poly[j * 3 + 0] += orig.X;
|
||||
poly[j * 3 + 1] += orig.Y;
|
||||
poly[j * 3 + 2] += orig.Z;
|
||||
}
|
||||
|
||||
// Store detail submesh.
|
||||
|
|
|
@ -1259,13 +1259,13 @@ namespace DotRecast.Recast
|
|||
{
|
||||
RcPolyMesh pmesh = meshes[i];
|
||||
|
||||
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 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);
|
||||
|
||||
bool isMinX = (ox == 0);
|
||||
bool isMinZ = (oz == 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 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 isOnBorder = (isMinX || isMinZ || isMaxX || isMaxZ);
|
||||
|
||||
for (int j = 0; j < pmesh.nverts; ++j)
|
||||
|
|
|
@ -59,9 +59,9 @@ namespace DotRecast.Recast
|
|||
RcVec3f[] vs = new RcVec3f[3];
|
||||
for (int k = 0; k < 3; ++k)
|
||||
{
|
||||
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].z = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3 + 2];
|
||||
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].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))
|
||||
|
|
|
@ -53,9 +53,9 @@ namespace DotRecast.Recast
|
|||
private static bool OverlapBounds(RcVec3f amin, RcVec3f amax, RcVec3f bmin, RcVec3f bmax)
|
||||
{
|
||||
bool overlap = true;
|
||||
overlap = (amin.x > bmax.x || amax.x < bmin.x) ? 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.X > bmax.X || amax.X < bmin.X) ? false : overlap;
|
||||
overlap = (amin.Y > bmax.Y || amax.Y < bmin.Y) ? false : overlap;
|
||||
overlap = (amin.Z > bmax.Z || amax.Z < bmin.Z) ? false : overlap;
|
||||
return overlap;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ namespace DotRecast.Recast
|
|||
{
|
||||
RcVec3f tmin = 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.
|
||||
RcVec3f.Copy(ref tmin, verts, v0 * 3);
|
||||
|
@ -252,8 +252,8 @@ namespace DotRecast.Recast
|
|||
return;
|
||||
|
||||
// Calculate the footprint of the triangle on the grid's y-axis
|
||||
int z0 = (int)((tmin.z - heightfieldBBMin.z) * inverseCellSize);
|
||||
int z1 = (int)((tmax.z - heightfieldBBMin.z) * inverseCellSize);
|
||||
int z0 = (int)((tmin.Z - heightfieldBBMin.Z) * inverseCellSize);
|
||||
int z1 = (int)((tmax.Z - heightfieldBBMin.Z) * inverseCellSize);
|
||||
|
||||
int w = heightfield.width;
|
||||
int h = heightfield.height;
|
||||
|
@ -276,7 +276,7 @@ namespace DotRecast.Recast
|
|||
for (int z = z0; z <= z1; ++z)
|
||||
{
|
||||
// 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);
|
||||
(@in, p1) = (p1, @in);
|
||||
|
||||
|
@ -297,8 +297,8 @@ namespace DotRecast.Recast
|
|||
maxX = Math.Max(maxX, v);
|
||||
}
|
||||
|
||||
int x0 = (int)((minX - heightfieldBBMin.x) * inverseCellSize);
|
||||
int x1 = (int)((maxX - heightfieldBBMin.x) * inverseCellSize);
|
||||
int x0 = (int)((minX - heightfieldBBMin.X) * inverseCellSize);
|
||||
int x1 = (int)((maxX - heightfieldBBMin.X) * inverseCellSize);
|
||||
if (x1 < 0 || x0 >= w)
|
||||
{
|
||||
continue;
|
||||
|
@ -311,7 +311,7 @@ namespace DotRecast.Recast
|
|||
for (int x = x0; x <= x1; ++x)
|
||||
{
|
||||
// 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);
|
||||
(inRow, p2) = (p2, inRow);
|
||||
|
||||
|
@ -332,8 +332,8 @@ namespace DotRecast.Recast
|
|||
spanMax = Math.Max(spanMax, buf[p1 + i * 3 + 1]);
|
||||
}
|
||||
|
||||
spanMin -= heightfieldBBMin.y;
|
||||
spanMax -= heightfieldBBMin.y;
|
||||
spanMin -= heightfieldBBMin.Y;
|
||||
spanMax -= heightfieldBBMin.Y;
|
||||
// Skip the span if it is outside the heightfield bbox
|
||||
if (spanMax < 0.0f)
|
||||
continue;
|
||||
|
|
|
@ -49,10 +49,10 @@ namespace DotRecast.Recast
|
|||
{
|
||||
float[] tbmin = new float[2];
|
||||
float[] tbmax = new float[2];
|
||||
tbmin[0] = builderCfg.bmin.x;
|
||||
tbmin[1] = builderCfg.bmin.z;
|
||||
tbmax[0] = builderCfg.bmax.x;
|
||||
tbmax[1] = builderCfg.bmax.z;
|
||||
tbmin[0] = builderCfg.bmin.X;
|
||||
tbmin[1] = builderCfg.bmin.Z;
|
||||
tbmax[0] = builderCfg.bmax.X;
|
||||
tbmax[1] = builderCfg.bmax.Z;
|
||||
List<RcChunkyTriMeshNode> nodes = geom.GetChunksOverlappingRect(tbmin, tbmax);
|
||||
foreach (RcChunkyTriMeshNode node in nodes)
|
||||
{
|
||||
|
|
|
@ -121,9 +121,9 @@ public class AbstractCrowdTest
|
|||
for (int j = 0; j < size; j++)
|
||||
{
|
||||
RcVec3f pos = new RcVec3f();
|
||||
pos.x = startPos.x + i * distance;
|
||||
pos.y = startPos.y;
|
||||
pos.z = startPos.z + j * distance;
|
||||
pos.X = startPos.X + i * distance;
|
||||
pos.Y = startPos.Y;
|
||||
pos.Z = startPos.Z + j * distance;
|
||||
agents.Add(crowd.AddAgent(pos, ap));
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class AbstractCrowdTest
|
|||
protected RcVec3f CalcVel(RcVec3f pos, RcVec3f tgt, float speed)
|
||||
{
|
||||
RcVec3f vel = tgt.Subtract(pos);
|
||||
vel.y = 0.0f;
|
||||
vel.Y = 0.0f;
|
||||
vel.Normalize();
|
||||
vel = vel.Scale(speed);
|
||||
return vel;
|
||||
|
@ -166,8 +166,8 @@ public class AbstractCrowdTest
|
|||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
Console.WriteLine(ag.state + ", " + ag.targetState);
|
||||
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.npos.X + ", " + ag.npos.Y + ", " + ag.npos.Z);
|
||||
Console.WriteLine(ag.nvel.X + ", " + ag.nvel.Y + ", " + ag.nvel.Z);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -577,12 +577,12 @@ public class Crowd1Test : AbstractCrowdTest
|
|||
crowd.Update(1 / 5f, null);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q0TVTA[i][4]).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);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q0TVT[i][4]).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);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q0TV[i][4]).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);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q0T[i][4]).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);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q1TVTA[i][4]).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);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q2TVTA[i][4]).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);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).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);
|
||||
foreach (DtCrowdAgent ag in crowd.GetActiveAgents())
|
||||
{
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][4]).Within(0.001f));
|
||||
Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q3TVTAS[i][5]).Within(0.001f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,12 +319,12 @@ public class Crowd4Test : AbstractCrowdTest
|
|||
{
|
||||
crowd.Update(1 / 5f, null);
|
||||
DtCrowdAgent ag = agents[2];
|
||||
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.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.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.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.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.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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,12 +343,12 @@ public class Crowd4Test : AbstractCrowdTest
|
|||
{
|
||||
crowd.Update(1 / 5f, null);
|
||||
DtCrowdAgent ag = agents[2];
|
||||
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.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.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.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.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.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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,12 +363,12 @@ public class Crowd4Test : AbstractCrowdTest
|
|||
{
|
||||
crowd.Update(1 / 5f, null);
|
||||
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.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.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.z, Is.EqualTo(EXPECTED_A1Q2T[i][5]).Within(0.00001f), $"{i} - {ag.nvel.z} {EXPECTED_A1Q2T[i][5]}");
|
||||
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.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.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]}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -115,12 +115,12 @@ public class Crowd4VelocityTest : AbstractCrowdTest
|
|||
}
|
||||
|
||||
DtCrowdAgent ag = agents[1];
|
||||
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.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.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.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.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.Y, Is.EqualTo(EXPECTED_A1Q3TVTA[i][4]).Within(0.001f));
|
||||
Assert.That(ag.nvel.Z, Is.EqualTo(EXPECTED_A1Q3TVTA[i][5]).Within(0.001f));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,13 +56,13 @@ public class FindDistanceToWallTest : AbstractDetourTest
|
|||
out var hitDist, out var hitPos, out var hitNormal);
|
||||
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.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.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.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.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.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.Z, Is.EqualTo(HIT_NORMAL[i].Z).Within(0.001f));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -160,26 +160,26 @@ public class FindPolysAroundShapeTest : AbstractDetourTest
|
|||
|
||||
private RcVec3f[] GetQueryPoly(RcVec3f m_spos, RcVec3f m_epos)
|
||||
{
|
||||
float nx = (m_epos.z - m_spos.z) * 0.25f;
|
||||
float nz = -(m_epos.x - m_spos.x) * 0.25f;
|
||||
float nx = (m_epos.Z - m_spos.Z) * 0.25f;
|
||||
float nz = -(m_epos.X - m_spos.X) * 0.25f;
|
||||
float agentHeight = 2.0f;
|
||||
|
||||
RcVec3f[] m_queryPoly = new RcVec3f[4];
|
||||
m_queryPoly[0].x = m_spos.x + nx * 1.2f;
|
||||
m_queryPoly[0].y = m_spos.y + agentHeight / 2;
|
||||
m_queryPoly[0].z = m_spos.z + nz * 1.2f;
|
||||
m_queryPoly[0].X = m_spos.X + nx * 1.2f;
|
||||
m_queryPoly[0].Y = m_spos.Y + agentHeight / 2;
|
||||
m_queryPoly[0].Z = m_spos.Z + nz * 1.2f;
|
||||
|
||||
m_queryPoly[1].x = m_spos.x - nx * 1.3f;
|
||||
m_queryPoly[1].y = m_spos.y + agentHeight / 2;
|
||||
m_queryPoly[1].z = m_spos.z - nz * 1.3f;
|
||||
m_queryPoly[1].X = m_spos.X - nx * 1.3f;
|
||||
m_queryPoly[1].Y = m_spos.Y + agentHeight / 2;
|
||||
m_queryPoly[1].Z = m_spos.Z - nz * 1.3f;
|
||||
|
||||
m_queryPoly[2].x = m_epos.x - nx * 0.8f;
|
||||
m_queryPoly[2].y = m_epos.y + agentHeight / 2;
|
||||
m_queryPoly[2].z = m_epos.z - nz * 0.8f;
|
||||
m_queryPoly[2].X = m_epos.X - nx * 0.8f;
|
||||
m_queryPoly[2].Y = m_epos.Y + agentHeight / 2;
|
||||
m_queryPoly[2].Z = m_epos.Z - nz * 0.8f;
|
||||
|
||||
m_queryPoly[3].x = m_epos.x + nx;
|
||||
m_queryPoly[3].y = m_epos.y + agentHeight / 2;
|
||||
m_queryPoly[3].z = m_epos.z + nz;
|
||||
m_queryPoly[3].X = m_epos.X + nx;
|
||||
m_queryPoly[3].Y = m_epos.Y + agentHeight / 2;
|
||||
m_queryPoly[3].Z = m_epos.Z + nz;
|
||||
return m_queryPoly;
|
||||
}
|
||||
}
|
|
@ -93,12 +93,12 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest
|
|||
Assert.That(segmentRefs.Count, Is.EqualTo(REFS[i].Length));
|
||||
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.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].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.z, Is.EqualTo(VERTICES[i][v].vmax.z).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.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.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));
|
||||
}
|
||||
|
||||
for (int v = 0; v < REFS[i].Length; v++)
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
Assert.That(randomPt.x >= bmin[0], Is.True);
|
||||
Assert.That(randomPt.x <= bmax[0], Is.True);
|
||||
Assert.That(randomPt.z >= bmin[1], Is.True);
|
||||
Assert.That(randomPt.z <= bmax[1], Is.True);
|
||||
Assert.That(randomPt.X >= bmin[0], Is.True);
|
||||
Assert.That(randomPt.X <= bmax[0], Is.True);
|
||||
Assert.That(randomPt.Z >= bmin[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]);
|
||||
}
|
||||
|
||||
Assert.That(randomPt.x >= bmin[0], Is.True);
|
||||
Assert.That(randomPt.x <= bmax[0], Is.True);
|
||||
Assert.That(randomPt.z >= bmin[1], Is.True);
|
||||
Assert.That(randomPt.z <= bmax[1], Is.True);
|
||||
Assert.That(randomPt.X >= bmin[0], Is.True);
|
||||
Assert.That(randomPt.X <= bmax[0], Is.True);
|
||||
Assert.That(randomPt.Z >= bmin[1], Is.True);
|
||||
Assert.That(randomPt.Z <= bmax[1], Is.True);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -281,9 +281,9 @@ public class RecastSoloMeshTest
|
|||
using StreamWriter fw = new StreamWriter(path);
|
||||
for (int v = 0; v < mesh.nverts; v++)
|
||||
{
|
||||
fw.Write("v " + (mesh.bmin.x + mesh.verts[v * 3] * mesh.cs) + " "
|
||||
+ (mesh.bmin.y + mesh.verts[v * 3 + 1] * mesh.ch) + " "
|
||||
+ (mesh.bmin.z + mesh.verts[v * 3 + 2] * mesh.cs) + "\n");
|
||||
fw.Write("v " + (mesh.bmin.X + mesh.verts[v * 3] * mesh.cs) + " "
|
||||
+ (mesh.bmin.Y + mesh.verts[v * 3 + 1] * mesh.ch) + " "
|
||||
+ (mesh.bmin.Z + mesh.verts[v * 3 + 2] * mesh.cs) + "\n");
|
||||
}
|
||||
|
||||
for (int i = 0; i < mesh.npolys; i++)
|
||||
|
|
Loading…
Reference in New Issue