forked from mirror/DotRecast
reuse list
This commit is contained in:
parent
d2661a4318
commit
9bb037849c
|
@ -2621,12 +2621,12 @@ namespace DotRecast.Detour
|
|||
/// @param[in] maxResult The maximum number of polygons the result arrays can hold.
|
||||
/// @returns The status flags for the query.
|
||||
public DtStatus FindPolysAroundShape(long startRef, float[] verts, IDtQueryFilter filter,
|
||||
out List<long> resultRef, out List<long> resultParent, out List<float> resultCost)
|
||||
ref List<long> resultRef, ref List<long> resultParent, ref List<float> resultCost)
|
||||
{
|
||||
resultRef = new List<long>();
|
||||
resultParent = new List<long>();
|
||||
resultCost = new List<float>();
|
||||
|
||||
resultRef.Clear();
|
||||
resultParent.Clear();
|
||||
resultCost.Clear();
|
||||
|
||||
// Validate input
|
||||
int nverts = verts.Length / 3;
|
||||
if (!m_nav.IsValidPolyRef(startRef) || null == verts || nverts < 3 || null == filter)
|
||||
|
|
|
@ -453,7 +453,11 @@ public class TestNavmeshTool : IRcTool
|
|||
m_queryPoly[10] = m_epos.y + agentHeight / 2;
|
||||
m_queryPoly[11] = m_epos.z + nz;
|
||||
|
||||
var status = m_navQuery.FindPolysAroundShape(m_startRef, m_queryPoly, m_filter, out var refs, out var parentRefs, out var costs);
|
||||
var refs = new List<long>();
|
||||
var parentRefs = new List<long>();
|
||||
var costs = new List<float>();
|
||||
|
||||
var status = m_navQuery.FindPolysAroundShape(m_startRef, m_queryPoly, m_filter, ref refs, ref parentRefs, ref costs);
|
||||
if (status.Succeeded())
|
||||
{
|
||||
m_polys = refs;
|
||||
|
|
|
@ -16,8 +16,8 @@ freely, subject to the following restrictions:
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using DotRecast.Core;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DotRecast.Detour.Test;
|
||||
|
@ -129,11 +129,16 @@ public class FindPolysAroundShapeTest : AbstractDetourTest
|
|||
public void TestFindPolysAroundShape()
|
||||
{
|
||||
IDtQueryFilter filter = new DtQueryDefaultFilter();
|
||||
var refs = new List<long>();
|
||||
var parentRefs = new List<long>();
|
||||
var costs = new List<float>();
|
||||
|
||||
for (int i = 0; i < startRefs.Length; i++)
|
||||
{
|
||||
long startRef = startRefs[i];
|
||||
RcVec3f startPos = startPoss[i];
|
||||
query.FindPolysAroundShape(startRef, GetQueryPoly(startPos, endPoss[i]), filter, out var refs, out var parentRefs, out var costs);
|
||||
query.FindPolysAroundShape(startRef, GetQueryPoly(startPos, endPoss[i]), filter, ref refs, ref parentRefs, ref costs);
|
||||
|
||||
Assert.That(refs.Count, Is.EqualTo(REFS[i].Length));
|
||||
for (int v = 0; v < REFS[i].Length; v++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue