forked from mirror/DotRecast
remove VCopy
This commit is contained in:
parent
50090a4555
commit
0af084afb8
|
@ -120,22 +120,6 @@ namespace DotRecast.Core
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void VCopy(ref Vector3f @out, float[] @in)
|
||||
{
|
||||
@out.x = @in[0];
|
||||
@out.y = @in[1];
|
||||
@out.z = @in[2];
|
||||
}
|
||||
|
||||
public static void VCopy(ref Vector3f @out, float[] @in, int i)
|
||||
{
|
||||
@out.x = @in[i];
|
||||
@out.y = @in[i + 1];
|
||||
@out.z = @in[i + 2];
|
||||
}
|
||||
|
||||
public static void VMin(ref Vector3f @out, float[] @in, int i)
|
||||
{
|
||||
@out.x = Math.Min(@out.x, @in[i]);
|
||||
|
|
|
@ -111,6 +111,21 @@ namespace DotRecast.Core
|
|||
z = c;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Set(float[] @in)
|
||||
{
|
||||
Set(@in, 0);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Set(float[] @in, int i)
|
||||
{
|
||||
x = @in[i];
|
||||
y = @in[i + 1];
|
||||
z = @in[i + 2];
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly float Length()
|
||||
{
|
||||
|
|
|
@ -528,7 +528,7 @@ namespace DotRecast.Detour.Crowd
|
|||
if (n == 0)
|
||||
{
|
||||
// The first polyref is bad, use current safe values.
|
||||
VCopy(ref m_pos, safePos);
|
||||
m_pos.Set(safePos);
|
||||
m_path.Clear();
|
||||
m_path.Add(safeRef);
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ namespace DotRecast.Detour.Extras
|
|||
it.i = i;
|
||||
Vector3f bmin = new Vector3f();
|
||||
Vector3f bmax = new Vector3f();
|
||||
VCopy(ref bmin, data.verts, data.polys[i].verts[0] * 3);
|
||||
VCopy(ref bmax, data.verts, data.polys[i].verts[0] * 3);
|
||||
bmin.Set(data.verts, data.polys[i].verts[0] * 3);
|
||||
bmax.Set(data.verts, data.polys[i].verts[0] * 3);
|
||||
for (int j = 1; j < data.polys[i].vertCount; j++)
|
||||
{
|
||||
VMin(ref bmin, data.verts, data.polys[i].verts[j] * 3);
|
||||
|
|
|
@ -54,10 +54,10 @@ namespace DotRecast.Detour
|
|||
|
||||
do
|
||||
{
|
||||
VCopy(ref a, p, 3 * (ai % n));
|
||||
VCopy(ref b, q, 3 * (bi % m));
|
||||
VCopy(ref a1, p, 3 * ((ai + n - 1) % n)); // prev a
|
||||
VCopy(ref b1, q, 3 * ((bi + m - 1) % m)); // prev b
|
||||
a.Set(p, 3 * (ai % n));
|
||||
b.Set(q, 3 * (bi % m));
|
||||
a1.Set(p, 3 * ((ai + n - 1) % n)); // prev a
|
||||
b1.Set(q, 3 * ((bi + m - 1) % m)); // prev b
|
||||
|
||||
Vector3f A = a.Subtract(a1);
|
||||
Vector3f B = b.Subtract(b1);
|
||||
|
|
|
@ -407,8 +407,8 @@ namespace DotRecast.Detour
|
|||
|
||||
// Calc polygon bounds.
|
||||
int v = p.verts[0] * 3;
|
||||
VCopy(ref bmin, tile.data.verts, v);
|
||||
VCopy(ref bmax, tile.data.verts, v);
|
||||
bmin.Set(tile.data.verts, v);
|
||||
bmax.Set(tile.data.verts, v);
|
||||
for (int j = 1; j < p.vertCount; ++j)
|
||||
{
|
||||
v = p.verts[j] * 3;
|
||||
|
@ -1575,8 +1575,8 @@ namespace DotRecast.Detour
|
|||
|
||||
Vector3f startPos = new Vector3f();
|
||||
Vector3f endPos = new Vector3f();
|
||||
VCopy(ref startPos, tile.data.verts, poly.verts[idx0] * 3);
|
||||
VCopy(ref endPos, tile.data.verts, poly.verts[idx1] * 3);
|
||||
startPos.Set(tile.data.verts, poly.verts[idx0] * 3);
|
||||
endPos.Set(tile.data.verts, poly.verts[idx1] * 3);
|
||||
return Results.Success(Tuple.Create(startPos, endPos));
|
||||
}
|
||||
|
||||
|
|
|
@ -162,8 +162,8 @@ namespace DotRecast.Detour
|
|||
Vector3f bmin = new Vector3f();
|
||||
Vector3f bmax = new Vector3f();
|
||||
int dv = vb * 3;
|
||||
VCopy(ref bmin, option.detailVerts, dv);
|
||||
VCopy(ref bmax, option.detailVerts, dv);
|
||||
bmin.Set(option.detailVerts, dv);
|
||||
bmax.Set(option.detailVerts, dv);
|
||||
for (int j = 1; j < ndv; j++)
|
||||
{
|
||||
VMin(ref bmin, option.detailVerts, dv + j * 3);
|
||||
|
|
|
@ -651,8 +651,8 @@ namespace DotRecast.Detour
|
|||
|
||||
// Calc polygon bounds.
|
||||
int v = p.verts[0] * 3;
|
||||
VCopy(ref bmin, tile.data.verts, v);
|
||||
VCopy(ref bmax, tile.data.verts, v);
|
||||
bmin.Set(tile.data.verts, v);
|
||||
bmax.Set(tile.data.verts, v);
|
||||
for (int j = 1; j < p.vertCount; ++j)
|
||||
{
|
||||
v = p.verts[j] * 3;
|
||||
|
@ -3099,8 +3099,8 @@ namespace DotRecast.Detour
|
|||
int ivj = poly.verts[j] * 3;
|
||||
int ivi = poly.verts[i] * 3;
|
||||
var seg = new SegmentVert();
|
||||
VCopy(ref seg.vmin, tile.data.verts, ivj);
|
||||
VCopy(ref seg.vmax, tile.data.verts, ivi);
|
||||
seg.vmin.Set(tile.data.verts, ivj);
|
||||
seg.vmax.Set(tile.data.verts, ivi);
|
||||
// Array.Copy(tile.data.verts, ivj, seg, 0, 3);
|
||||
// Array.Copy(tile.data.verts, ivi, seg, 3, 3);
|
||||
segmentVerts.Add(seg);
|
||||
|
|
|
@ -410,7 +410,7 @@ public class CrowdTool : Tool
|
|||
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;
|
||||
VCopy(ref prev, trail.trail, v);
|
||||
prev.Set(trail.trail, v);
|
||||
}
|
||||
|
||||
dd.End();
|
||||
|
|
Loading…
Reference in New Issue