forked from mirror/DotRecast
Changed class `Trajectory` to interface `ITrajectory`
This commit is contained in:
parent
e9a5512bb2
commit
d94408f7a1
|
@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Changed `MAX_STEER_POINTS` from class constant to local.
|
||||
- Changed `List<DtStraightPath>` to `Span<DtStraightPath>` for enhanced memory efficiency
|
||||
- Changed `DtWriter` to a static class and renamed it to `RcIO`
|
||||
- Changed class `Trajectory` to interface `ITrajectory`
|
||||
|
||||
### Removed
|
||||
- Nothing
|
||||
|
|
|
@ -4,9 +4,9 @@ using DotRecast.Core.Numerics;
|
|||
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
public class ClimbTrajectory : Trajectory
|
||||
public class ClimbTrajectory : ITrajectory
|
||||
{
|
||||
public override RcVec3f Apply(RcVec3f start, RcVec3f end, float u)
|
||||
public RcVec3f Apply(RcVec3f start, RcVec3f end, float u)
|
||||
{
|
||||
return new RcVec3f()
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
if (i > 41 || i < 41)
|
||||
{
|
||||
// continue;
|
||||
// continue;
|
||||
}
|
||||
|
||||
int nvp = mesh.nvp;
|
||||
|
@ -29,7 +29,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
if (j != 1)
|
||||
{
|
||||
// continue;
|
||||
// continue;
|
||||
}
|
||||
|
||||
if (mesh.polys[p + j] == RC_MESH_NULL_IDX)
|
||||
|
|
|
@ -7,13 +7,13 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
public readonly GroundSegment start = new GroundSegment();
|
||||
public readonly List<GroundSegment> end = new List<GroundSegment>();
|
||||
public readonly Trajectory trajectory;
|
||||
public readonly ITrajectory trajectory;
|
||||
|
||||
public readonly RcVec3f ax = new RcVec3f();
|
||||
public readonly RcVec3f ay = new RcVec3f();
|
||||
public readonly RcVec3f az = new RcVec3f();
|
||||
|
||||
public EdgeSampler(JumpEdge edge, Trajectory trajectory)
|
||||
public EdgeSampler(JumpEdge edge, ITrajectory trajectory)
|
||||
{
|
||||
this.trajectory = trajectory;
|
||||
ax = RcVec3f.Subtract(edge.sq, edge.sp);
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
public class GroundSample
|
||||
{
|
||||
public RcVec3f p = new RcVec3f();
|
||||
public RcVec3f p;
|
||||
public bool validTrajectory;
|
||||
public bool validHeight;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
{
|
||||
public class GroundSegment
|
||||
{
|
||||
public RcVec3f p = new RcVec3f();
|
||||
public RcVec3f q = new RcVec3f();
|
||||
public RcVec3f p;
|
||||
public RcVec3f q;
|
||||
public GroundSample[] gsamples;
|
||||
public float height;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
using DotRecast.Core.Numerics;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
public interface ITrajectory
|
||||
{
|
||||
public RcVec3f Apply(RcVec3f start, RcVec3f end, float u);
|
||||
}
|
||||
}
|
|
@ -10,6 +10,6 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
public GroundSample[] endSamples;
|
||||
public GroundSegment start;
|
||||
public GroundSegment end;
|
||||
public Trajectory trajectory;
|
||||
public ITrajectory trajectory;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ using DotRecast.Core.Numerics;
|
|||
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
public class JumpTrajectory : Trajectory
|
||||
public class JumpTrajectory : ITrajectory
|
||||
{
|
||||
private readonly float jumpHeight;
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
this.jumpHeight = jumpHeight;
|
||||
}
|
||||
|
||||
public override RcVec3f Apply(RcVec3f start, RcVec3f end, float u)
|
||||
public RcVec3f Apply(RcVec3f start, RcVec3f end, float u)
|
||||
{
|
||||
return new RcVec3f
|
||||
{
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using DotRecast.Core.Numerics;
|
||||
|
||||
namespace DotRecast.Detour.Extras.Jumplink
|
||||
{
|
||||
public class Trajectory
|
||||
{
|
||||
public virtual RcVec3f Apply(RcVec3f start, RcVec3f end, float u)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ namespace DotRecast.Detour.Extras.Jumplink
|
|||
}
|
||||
}
|
||||
|
||||
private bool SampleTrajectory(JumpLinkBuilderConfig acfg, RcHeightfield solid, RcVec3f pa, RcVec3f pb, Trajectory tra)
|
||||
private bool SampleTrajectory(JumpLinkBuilderConfig acfg, RcHeightfield solid, RcVec3f pa, RcVec3f pb, ITrajectory tra)
|
||||
{
|
||||
float cs = Math.Min(acfg.cellSize, acfg.cellHeight);
|
||||
float d = RcVecUtils.Dist2D(pa, pb) + MathF.Abs(pa.Y - pb.Y);
|
||||
|
|
|
@ -417,7 +417,7 @@ public class JumpLinkBuilderSampleTool : ISampleTool
|
|||
}
|
||||
|
||||
|
||||
private void DrawTrajectory(RecastDebugDraw dd, JumpLink link, RcVec3f pa, RcVec3f pb, Trajectory tra, int cola)
|
||||
private void DrawTrajectory(RecastDebugDraw dd, JumpLink link, RcVec3f pa, RcVec3f pb, ITrajectory tra, int cola)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue