forked from bit/DotRecastNetSim
refactor: preparing for switching build with System.Numerics.Vector3
This commit is contained in:
parent
3ab732e900
commit
8d5b4c0c95
|
@ -109,13 +109,9 @@ namespace DotRecast.Core.Numerics
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public readonly RcVec3f Add(RcVec3f v2)
|
public static RcVec3f Add(RcVec3f left, RcVec3f right)
|
||||||
{
|
{
|
||||||
return new RcVec3f(
|
return left + right;
|
||||||
X + v2.X,
|
|
||||||
Y + v2.Y,
|
|
||||||
Z + v2.Z
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
@ -270,7 +266,11 @@ namespace DotRecast.Core.Numerics
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static RcVec3f operator +(RcVec3f left, RcVec3f right)
|
public static RcVec3f operator +(RcVec3f left, RcVec3f right)
|
||||||
{
|
{
|
||||||
return left.Add(right);
|
return new RcVec3f(
|
||||||
|
left.X + right.X,
|
||||||
|
left.Y + right.Y,
|
||||||
|
left.Z + right.Z
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
|
@ -1273,7 +1273,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ag.npos = ag.npos.Add(ag.disp);
|
ag.npos = RcVec3f.Add(ag.npos, ag.disp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace DotRecast.Detour.Crowd
|
||||||
float ds = dv.Length();
|
float ds = dv.Length();
|
||||||
if (ds > maxDelta)
|
if (ds > maxDelta)
|
||||||
dv = dv.Scale(maxDelta / ds);
|
dv = dv.Scale(maxDelta / ds);
|
||||||
vel = vel.Add(dv);
|
vel = RcVec3f.Add(vel, dv);
|
||||||
|
|
||||||
// Integrate
|
// Integrate
|
||||||
if (vel.Length() > 0.0001f)
|
if (vel.Length() > 0.0001f)
|
||||||
|
|
|
@ -1353,7 +1353,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
bool overPoly = false;
|
bool overPoly = false;
|
||||||
RcVec3f bmin = RcVec3f.Subtract(center, halfExtents);
|
RcVec3f bmin = RcVec3f.Subtract(center, halfExtents);
|
||||||
RcVec3f bmax = center.Add(halfExtents);
|
RcVec3f bmax = RcVec3f.Add(center, halfExtents);
|
||||||
|
|
||||||
// Get nearby polygons from proximity grid.
|
// Get nearby polygons from proximity grid.
|
||||||
List<long> polys = QueryPolygonsInTile(tile, bmin, bmax);
|
List<long> polys = QueryPolygonsInTile(tile, bmin, bmax);
|
||||||
|
|
|
@ -680,7 +680,7 @@ namespace DotRecast.Detour
|
||||||
|
|
||||||
// Find tiles the query touches.
|
// Find tiles the query touches.
|
||||||
RcVec3f bmin = RcVec3f.Subtract(center, halfExtents);
|
RcVec3f bmin = RcVec3f.Subtract(center, halfExtents);
|
||||||
RcVec3f bmax = center.Add(halfExtents);
|
RcVec3f bmax = RcVec3f.Add(center, halfExtents);
|
||||||
foreach (var t in QueryTiles(center, halfExtents))
|
foreach (var t in QueryTiles(center, halfExtents))
|
||||||
{
|
{
|
||||||
QueryPolygonsInTile(t, bmin, bmax, filter, query);
|
QueryPolygonsInTile(t, bmin, bmax, filter, query);
|
||||||
|
@ -700,7 +700,7 @@ namespace DotRecast.Detour
|
||||||
}
|
}
|
||||||
|
|
||||||
RcVec3f bmin = RcVec3f.Subtract(center, halfExtents);
|
RcVec3f bmin = RcVec3f.Subtract(center, halfExtents);
|
||||||
RcVec3f bmax = center.Add(halfExtents);
|
RcVec3f bmax = RcVec3f.Add(center, halfExtents);
|
||||||
m_nav.CalcTileLoc(bmin, out var minx, out var miny);
|
m_nav.CalcTileLoc(bmin, out var minx, out var miny);
|
||||||
m_nav.CalcTileLoc(bmax, out var maxx, out var maxy);
|
m_nav.CalcTileLoc(bmax, out var maxx, out var maxy);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue