forked from bit/DotRecastNetSim
class StraightPathItem -> readonly struct StraightPathItem
This commit is contained in:
parent
04fd0abea0
commit
061c4469ed
|
@ -21,6 +21,7 @@ freely, subject to the following restrictions:
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Numerics;
|
||||
using DotRecast.Core;
|
||||
|
||||
namespace DotRecast.Detour
|
||||
|
@ -1437,8 +1438,7 @@ namespace DotRecast.Detour
|
|||
if (straightPath.Count > 0 && DetourCommon.VEqual(straightPath[straightPath.Count - 1].pos, pos))
|
||||
{
|
||||
// The vertices are equal, update flags and poly.
|
||||
straightPath[straightPath.Count - 1].flags = flags;
|
||||
straightPath[straightPath.Count - 1].refs = refs;
|
||||
straightPath[straightPath.Count - 1] = new StraightPathItem(straightPath[straightPath.Count - 1].pos, flags, refs);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace DotRecast.Detour
|
|||
steerPosRef = 0;
|
||||
|
||||
// Find steer target.
|
||||
var straightPath = new List<StraightPathItem>();
|
||||
var straightPath = new List<StraightPathItem>(MAX_STEER_POINTS);
|
||||
var result = navQuery.FindStraightPath(startPos, endPos, path, ref straightPath, MAX_STEER_POINTS, 0);
|
||||
if (result.Failed())
|
||||
{
|
||||
|
|
|
@ -23,11 +23,11 @@ using DotRecast.Core;
|
|||
namespace DotRecast.Detour
|
||||
{
|
||||
//TODO: (PP) Add comments
|
||||
public class StraightPathItem
|
||||
public readonly struct StraightPathItem
|
||||
{
|
||||
public RcVec3f pos;
|
||||
public int flags;
|
||||
public long refs;
|
||||
public readonly RcVec3f pos;
|
||||
public readonly int flags;
|
||||
public readonly long refs;
|
||||
|
||||
public StraightPathItem(RcVec3f pos, int flags, long refs)
|
||||
{
|
||||
|
|
|
@ -809,6 +809,7 @@ public class TestNavmeshTool : IRcTool
|
|||
}
|
||||
}
|
||||
|
||||
m_straightPath = new(MAX_POLYS);
|
||||
m_navQuery.FindStraightPath(m_spos, epos, m_polys, ref m_straightPath, MAX_POLYS, DtNavMeshQuery.DT_STRAIGHTPATH_ALL_CROSSINGS);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace DotRecast.Recast.DemoTool.Tools
|
|||
{
|
||||
public class TestNavmeshToolImpl : ISampleTool
|
||||
{
|
||||
private const int MAX_POLYS = 256;
|
||||
private const int MAX_SMOOTH = 2048;
|
||||
public const int MAX_POLYS = 256;
|
||||
public const int MAX_SMOOTH = 2048;
|
||||
|
||||
private Sample _sample;
|
||||
private readonly TestNavmeshToolOption _option;
|
||||
|
|
Loading…
Reference in New Issue