remove Vector3 vSet

This commit is contained in:
ikpil 2023-04-12 23:33:15 +09:00
parent 066f6b3f34
commit b1b2bb9e3e
5 changed files with 16 additions and 23 deletions

View File

@ -19,6 +19,7 @@ freely, subject to the following restrictions:
*/
using System;
using System.Numerics;
namespace DotRecast.Core
{
@ -227,13 +228,6 @@ namespace DotRecast.Core
@out.y = @in[1];
@out.z = @in[2];
}
public static void vCopy(float[] @out, float[] @in, int i)
{
@out[0] = @in[i];
@out[1] = @in[i + 1];
@out[2] = @in[i + 2];
}
public static void vCopy(ref Vector3f @out, float[] @in, int i)
{

View File

@ -28,6 +28,7 @@ namespace DotRecast.Core
public float z { get; set; }
public static Vector3f Zero { get; } = new Vector3f(0, 0, 0);
public static Vector3f Up { get; } = new Vector3f(0, 1, 0);
public static Vector3f Of(float[] f)
{

View File

@ -254,9 +254,9 @@ namespace DotRecast.Detour.Crowd
ag.topologyOptTime = 0;
ag.targetReplanTime = 0;
vSet(ref ag.dvel, 0, 0, 0);
vSet(ref ag.nvel, 0, 0, 0);
vSet(ref ag.vel, 0, 0, 0);
ag.dvel = Vector3f.Zero;
ag.nvel = Vector3f.Zero;
ag.vel = Vector3f.Zero;
vCopy(ref ag.npos, nearest);
ag.desiredSpeed = 0;
@ -340,8 +340,8 @@ namespace DotRecast.Detour.Crowd
{
// Initialize request.
agent.targetRef = 0;
vSet(ref agent.targetPos, 0, 0, 0);
vSet(ref agent.dvel, 0, 0, 0);
agent.targetPos = Vector3f.Zero;
agent.dvel = Vector3f.Zero;
agent.targetPathQueryResult = null;
agent.targetReplan = false;
agent.targetState = CrowdAgent.MoveRequestState.DT_CROWDAGENT_TARGET_NONE;
@ -974,8 +974,8 @@ namespace DotRecast.Detour.Crowd
// Copy data for debug purposes.
if (debugAgent == ag)
{
vSet(ref debug.optStart, 0, 0, 0);
vSet(ref debug.optEnd, 0, 0, 0);
debug.optStart = Vector3f.Zero;
debug.optEnd = Vector3f.Zero;
}
}
}
@ -1234,7 +1234,7 @@ namespace DotRecast.Detour.Crowd
continue;
}
vSet(ref ag.disp, 0, 0, 0);
ag.disp = Vector3f.Zero;
float w = 0;
@ -1361,8 +1361,8 @@ namespace DotRecast.Detour.Crowd
}
// Update velocity.
vSet(ref ag.vel, 0, 0, 0);
vSet(ref ag.dvel, 0, 0, 0);
ag.vel = Vector3f.Zero;
ag.dvel = Vector3f.Zero;
}
_telemetry.stop("updateOffMeshConnections");

View File

@ -149,7 +149,7 @@ namespace DotRecast.Detour.Crowd
if (vLen(vel) > 0.0001f)
npos = vMad(npos, vel, dt);
else
vSet(ref vel, 0, 0, 0);
vel = Vector3f.Zero;
}
public bool overOffmeshConnection(float radius)

View File

@ -401,8 +401,7 @@ namespace DotRecast.Detour.Crowd
m_vmax = vmax;
m_invVmax = vmax > 0 ? 1.0f / vmax : float.MaxValue;
Vector3f nvel = new Vector3f();
vSet(ref nvel, 0f, 0f, 0f);
Vector3f nvel = Vector3f.Zero;
if (debug != null)
debug.reset();
@ -472,8 +471,7 @@ namespace DotRecast.Detour.Crowd
m_vmax = vmax;
m_invVmax = vmax > 0 ? 1.0f / vmax : float.MaxValue;
Vector3f nvel = new Vector3f();
vSet(ref nvel, 0f, 0f, 0f);
Vector3f nvel = Vector3f.Zero;
if (debug != null)
debug.reset();
@ -546,7 +544,7 @@ namespace DotRecast.Detour.Crowd
{
float minPenalty = float.MaxValue;
Vector3f bvel = new Vector3f();
vSet(ref bvel, 0, 0, 0);
bvel = Vector3f.Zero;
for (int i = 0; i < npat; ++i)
{