diff --git a/src/DotRecast.Core/Numerics/RcVec3f.cs b/src/DotRecast.Core/Numerics/RcVec3f.cs index ca24885..95f29d9 100644 --- a/src/DotRecast.Core/Numerics/RcVec3f.cs +++ b/src/DotRecast.Core/Numerics/RcVec3f.cs @@ -49,42 +49,6 @@ namespace DotRecast.Core.Numerics Z = f; } - public float this[int index] - { - get => GetElement(index); - set => SetElement(index, value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public float GetElement(int index) - { - switch (index) - { - case 0: return X; - case 1: return Y; - case 2: return Z; - default: throw new IndexOutOfRangeException($"{index}"); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SetElement(int index, float value) - { - switch (index) - { - case 0: - X = value; - break; - case 1: - Y = value; - break; - case 2: - Z = value; - break; - - default: throw new IndexOutOfRangeException($"{index}-{value}"); - } - } [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly float Length() diff --git a/src/DotRecast.Core/Numerics/RcVecUtils.cs b/src/DotRecast.Core/Numerics/RcVecUtils.cs index f63a92f..bbe9efd 100644 --- a/src/DotRecast.Core/Numerics/RcVecUtils.cs +++ b/src/DotRecast.Core/Numerics/RcVecUtils.cs @@ -6,7 +6,7 @@ namespace DotRecast.Core.Numerics public static class RcVecUtils { public const float EPSILON = 1e-6f; - + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static RcVec3f Create(float[] values) { @@ -42,7 +42,6 @@ namespace DotRecast.Core.Numerics } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static RcVec3f Scale(this RcVec3f v, float scale) { diff --git a/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs b/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs index 446d8b7..1f99bb0 100644 --- a/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs +++ b/src/DotRecast.Recast.Demo/Draw/RecastDebugDraw.cs @@ -37,8 +37,7 @@ public class RecastDebugDraw : DebugDraw { } - public void DebugDrawTriMeshSlope(float[] verts, int[] tris, float[] normals, float walkableSlopeAngle, - float texScale) + public void DebugDrawTriMeshSlope(float[] verts, int[] tris, float[] normals, float walkableSlopeAngle, float texScale) { float walkableThr = MathF.Cos(walkableSlopeAngle / 180.0f * MathF.PI); @@ -70,12 +69,12 @@ public class RecastDebugDraw : DebugDraw RcVec3f vc = new RcVec3f(verts[tris[i + 2] * 3], verts[tris[i + 2] * 3 + 1], verts[tris[i + 2] * 3 + 2]); int ax = 0, ay = 0; - if (MathF.Abs(norm.Y) > MathF.Abs(norm[ax])) + if (MathF.Abs(norm.Y) > MathF.Abs(norm.Get(ax))) { ax = 1; } - if (MathF.Abs(norm.Z) > MathF.Abs(norm[ax])) + if (MathF.Abs(norm.Z) > MathF.Abs(norm.Get(ax))) { ax = 2; } @@ -83,12 +82,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.Get(ax) * texScale; + uva.Y = va.Get(ay) * texScale; + uvb.X = vb.Get(ax) * texScale; + uvb.Y = vb.Get(ay) * texScale; + uvc.X = vc.Get(ax) * texScale; + uvc.Y = vc.Get(ay) * texScale; Vertex(va, color, uva); Vertex(vb, color, uvb);