From 0924b82f629e7606b5d294b9f600e012b2e42e56 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sat, 28 Oct 2023 13:22:02 +0900 Subject: [PATCH] refactor: support .netstandard2.1 vector3 --- .../Draw/NavMeshRenderer.cs | 2 +- src/DotRecast.Recast.Demo/Tools/GizmoRenderer.cs | 4 ++-- .../Tools/ObstacleSampleTool.cs | 4 ++-- .../Tools/TileSampleTool.cs | 16 ++++++++-------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/DotRecast.Recast.Demo/Draw/NavMeshRenderer.cs b/src/DotRecast.Recast.Demo/Draw/NavMeshRenderer.cs index 0ede906..352d7bf 100644 --- a/src/DotRecast.Recast.Demo/Draw/NavMeshRenderer.cs +++ b/src/DotRecast.Recast.Demo/Draw/NavMeshRenderer.cs @@ -86,7 +86,7 @@ public class NavMeshRenderer int tw = (gw + settings.tileSize - 1) / settings.tileSize; int th = (gh + settings.tileSize - 1) / settings.tileSize; float s = settings.tileSize * settings.cellSize; - _debugDraw.DebugDrawGridXZ(bmin[0], bmin[1], bmin[2], tw, th, s, DebugDraw.DuRGBA(0, 0, 0, 64), 1.0f); + _debugDraw.DebugDrawGridXZ(bmin.X, bmin.Y, bmin.Z, tw, th, s, DebugDraw.DuRGBA(0, 0, 0, 64), 1.0f); } if (navMesh != null && navQuery != null diff --git a/src/DotRecast.Recast.Demo/Tools/GizmoRenderer.cs b/src/DotRecast.Recast.Demo/Tools/GizmoRenderer.cs index bcf02fc..2b8cf87 100644 --- a/src/DotRecast.Recast.Demo/Tools/GizmoRenderer.cs +++ b/src/DotRecast.Recast.Demo/Tools/GizmoRenderer.cs @@ -43,8 +43,8 @@ public static class GizmoRenderer RcVec3f normal = new RcVec3f(); for (int j = 0; j < 3; ++j) { - e0[j] = vertices[v1 + j] - vertices[v0 + j]; - e1[j] = vertices[v2 + j] - vertices[v0 + j]; + e0 = RcVecUtils.Subtract(vertices, v1, v0); + e1 = RcVecUtils.Subtract(vertices, v2, v0); } normal.X = e0.Y * e1.Z - e0.Z * e1.Y; diff --git a/src/DotRecast.Recast.Demo/Tools/ObstacleSampleTool.cs b/src/DotRecast.Recast.Demo/Tools/ObstacleSampleTool.cs index b02e568..e38688f 100644 --- a/src/DotRecast.Recast.Demo/Tools/ObstacleSampleTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/ObstacleSampleTool.cs @@ -79,8 +79,8 @@ public class ObstacleSampleTool : ISampleTool else if (ob.state == DtObstacleState.DT_OBSTACLE_REMOVING) col = DebugDraw.DuRGBA(220, 0, 0, 128); - dd.DebugDrawCylinder(bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2], col); - dd.DebugDrawCylinderWire(bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2], DebugDraw.DuDarkenCol(col), 2); + dd.DebugDrawCylinder(bmin.X, bmin.Y, bmin.Z, bmax.X, bmax.Y, bmax.Z, col); + dd.DebugDrawCylinderWire(bmin.X, bmin.Y, bmin.Z, bmax.X, bmax.Y, bmax.Z, DebugDraw.DuDarkenCol(col), 2); } } diff --git a/src/DotRecast.Recast.Demo/Tools/TileSampleTool.cs b/src/DotRecast.Recast.Demo/Tools/TileSampleTool.cs index 327989c..5b33b99 100644 --- a/src/DotRecast.Recast.Demo/Tools/TileSampleTool.cs +++ b/src/DotRecast.Recast.Demo/Tools/TileSampleTool.cs @@ -59,19 +59,19 @@ 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.X) / ts); + int ty = (int)((_hitPos.Z - bmin.Z) / ts); RcVec3f lastBuiltTileBmin = RcVec3f.Zero; RcVec3f lastBuiltTileBmax = RcVec3f.Zero; - lastBuiltTileBmin[0] = bmin[0] + tx * ts; - lastBuiltTileBmin[1] = bmin[1]; - lastBuiltTileBmin[2] = bmin[2] + ty * ts; + lastBuiltTileBmin.X = bmin.X + tx * ts; + lastBuiltTileBmin.Y = bmin.Y; + lastBuiltTileBmin.Z = bmin.Z + ty * ts; - lastBuiltTileBmax[0] = bmin[0] + (tx + 1) * ts; - lastBuiltTileBmax[1] = bmax[1]; - lastBuiltTileBmax[2] = bmin[2] + (ty + 1) * ts; + lastBuiltTileBmax.X = bmin.X + (tx + 1) * ts; + lastBuiltTileBmax.Y = bmax.Y; + lastBuiltTileBmax.Z = bmin.Z + (ty + 1) * ts; dd.DebugDrawCross(_hitPos.X, _hitPos.Y + 0.1f, _hitPos.Z, s, DuRGBA(0, 0, 0, 128), 2.0f); dd.DebugDrawBoxWire(