Skip to content

Commit

Permalink
refactor: support .netstandard2.1 vector3
Browse files Browse the repository at this point in the history
  • Loading branch information
ikpil committed Oct 28, 2023
1 parent ffdbdb7 commit 0924b82
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/DotRecast.Recast.Demo/Draw/NavMeshRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void Render(DemoSample sample, DrawMode drawMode)
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
Expand Down
4 changes: 2 additions & 2 deletions src/DotRecast.Recast.Demo/Tools/GizmoRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public static int GetColorByNormal(float[] vertices, int v0, int v1, int v2)
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;
Expand Down
4 changes: 2 additions & 2 deletions src/DotRecast.Recast.Demo/Tools/ObstacleSampleTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ private void DrawObstacles(RecastDebugDraw dd)
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);
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/DotRecast.Recast.Demo/Tools/TileSampleTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ public void HandleRender(NavMeshRenderer renderer)
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(
Expand Down

0 comments on commit 0924b82

Please sign in to comment.