forked from mirror/DotRecast
public class EdgeSamplerFactory
This commit is contained in:
parent
17ecdb1cc7
commit
e9a5512bb2
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using DotRecast.Core;
|
||||||
using DotRecast.Core.Numerics;
|
using DotRecast.Core.Numerics;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Jumplink
|
namespace DotRecast.Detour.Extras.Jumplink
|
||||||
|
@ -9,9 +10,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
return new RcVec3f()
|
return new RcVec3f()
|
||||||
{
|
{
|
||||||
X = Lerp(start.X, end.X, Math.Min(2f * u, 1f)),
|
X = RcMath.Lerp(start.X, end.X, Math.Min(2f * u, 1f)),
|
||||||
Y = Lerp(start.Y, end.Y, Math.Max(0f, 2f * u - 1f)),
|
Y = RcMath.Lerp(start.Y, end.Y, Math.Max(0f, 2f * u - 1f)),
|
||||||
Z = Lerp(start.Z, end.Z, Math.Min(2f * u, 1f))
|
Z = RcMath.Lerp(start.Z, end.Z, Math.Min(2f * u, 1f))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ using DotRecast.Core.Numerics;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Jumplink
|
namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
class EdgeSamplerFactory
|
public class EdgeSamplerFactory
|
||||||
{
|
{
|
||||||
public EdgeSampler Get(JumpLinkBuilderConfig acfg, JumpLinkType type, JumpEdge edge)
|
public EdgeSampler Get(JumpLinkBuilderConfig acfg, JumpLinkType type, JumpEdge edge)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ using DotRecast.Core;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Jumplink
|
namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
class JumpSegmentBuilder
|
public class JumpSegmentBuilder
|
||||||
{
|
{
|
||||||
public JumpSegment[] Build(JumpLinkBuilderConfig acfg, EdgeSampler es)
|
public JumpSegment[] Build(JumpLinkBuilderConfig acfg, EdgeSampler es)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using DotRecast.Core;
|
||||||
using DotRecast.Core.Numerics;
|
using DotRecast.Core.Numerics;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Jumplink
|
namespace DotRecast.Detour.Extras.Jumplink
|
||||||
|
@ -16,9 +17,9 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
return new RcVec3f
|
return new RcVec3f
|
||||||
{
|
{
|
||||||
X = Lerp(start.X, end.X, u),
|
X = RcMath.Lerp(start.X, end.X, u),
|
||||||
Y = InterpolateHeight(start.Y, end.Y, u),
|
Y = InterpolateHeight(start.Y, end.Y, u),
|
||||||
Z = Lerp(start.Z, end.Z, u)
|
Z = RcMath.Lerp(start.Z, end.Z, u)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ using DotRecast.Recast;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Jumplink
|
namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
class NavMeshGroundSampler : AbstractGroundSampler
|
public class NavMeshGroundSampler : AbstractGroundSampler
|
||||||
{
|
{
|
||||||
public override void Sample(JumpLinkBuilderConfig acfg, RcBuilderResult result, EdgeSampler es)
|
public override void Sample(JumpLinkBuilderConfig acfg, RcBuilderResult result, EdgeSampler es)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,11 +5,6 @@ namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
public class Trajectory
|
public class Trajectory
|
||||||
{
|
{
|
||||||
public float Lerp(float f, float g, float u)
|
|
||||||
{
|
|
||||||
return u * g + (1f - u) * f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual RcVec3f Apply(RcVec3f start, RcVec3f end, float u)
|
public virtual RcVec3f Apply(RcVec3f start, RcVec3f end, float u)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
|
@ -5,7 +5,7 @@ using DotRecast.Recast;
|
||||||
|
|
||||||
namespace DotRecast.Detour.Extras.Jumplink
|
namespace DotRecast.Detour.Extras.Jumplink
|
||||||
{
|
{
|
||||||
class TrajectorySampler
|
public class TrajectorySampler
|
||||||
{
|
{
|
||||||
public void Sample(JumpLinkBuilderConfig acfg, RcHeightfield heightfield, EdgeSampler es)
|
public void Sample(JumpLinkBuilderConfig acfg, RcHeightfield heightfield, EdgeSampler es)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue