forked from mirror/DotRecast
change access
This commit is contained in:
parent
11558e4b81
commit
6300a24a81
|
@ -120,9 +120,9 @@ namespace DotRecast.Detour.Crowd
|
||||||
if (result.succeeded())
|
if (result.succeeded())
|
||||||
{
|
{
|
||||||
GetPolyWallSegmentsResult gpws = result.result;
|
GetPolyWallSegmentsResult gpws = result.result;
|
||||||
for (int k = 0; k < gpws.getSegmentRefs().Count; ++k)
|
for (int k = 0; k < gpws.countSegmentRefs(); ++k)
|
||||||
{
|
{
|
||||||
SegmentVert s = gpws.getSegmentVerts()[k];
|
SegmentVert s = gpws.getSegmentVert(k);
|
||||||
// Skip too distant segments.
|
// Skip too distant segments.
|
||||||
Tuple<float, float> distseg = distancePtSegSqr2D(pos, s, 0, 3);
|
Tuple<float, float> distseg = distancePtSegSqr2D(pos, s, 0, 3);
|
||||||
if (distseg.Item1 > sqr(collisionQueryRange))
|
if (distseg.Item1 > sqr(collisionQueryRange))
|
||||||
|
|
|
@ -25,23 +25,34 @@ namespace DotRecast.Detour
|
||||||
{
|
{
|
||||||
public class GetPolyWallSegmentsResult
|
public class GetPolyWallSegmentsResult
|
||||||
{
|
{
|
||||||
private readonly List<SegmentVert> segmentVerts;
|
private readonly List<SegmentVert> _segmentVerts;
|
||||||
private readonly List<long> segmentRefs;
|
private readonly List<long> _segmentRefs;
|
||||||
|
|
||||||
public GetPolyWallSegmentsResult(List<SegmentVert> segmentVerts, List<long> segmentRefs)
|
public GetPolyWallSegmentsResult(List<SegmentVert> segmentVerts, List<long> segmentRefs)
|
||||||
{
|
{
|
||||||
this.segmentVerts = segmentVerts;
|
_segmentVerts = segmentVerts;
|
||||||
this.segmentRefs = segmentRefs;
|
_segmentRefs = segmentRefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SegmentVert> getSegmentVerts()
|
public int countSegmentVerts()
|
||||||
{
|
{
|
||||||
return segmentVerts;
|
return _segmentVerts.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int countSegmentRefs()
|
||||||
|
{
|
||||||
|
return _segmentRefs.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<long> getSegmentRefs()
|
|
||||||
|
public SegmentVert getSegmentVert(int idx)
|
||||||
{
|
{
|
||||||
return segmentRefs;
|
return _segmentVerts[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSegmentRef(int idx)
|
||||||
|
{
|
||||||
|
return _segmentRefs[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -843,9 +843,9 @@ public class TestNavmeshTool : Tool
|
||||||
{
|
{
|
||||||
dd.begin(LINES, 2.0f);
|
dd.begin(LINES, 2.0f);
|
||||||
GetPolyWallSegmentsResult wallSegments = result.result;
|
GetPolyWallSegmentsResult wallSegments = result.result;
|
||||||
for (int j = 0; j < wallSegments.getSegmentVerts().Count; ++j)
|
for (int j = 0; j < wallSegments.countSegmentVerts(); ++j)
|
||||||
{
|
{
|
||||||
SegmentVert s = wallSegments.getSegmentVerts()[j];
|
SegmentVert s = wallSegments.getSegmentVert(j);
|
||||||
Vector3f s3 = Vector3f.Of(s[3], s[4], s[5]);
|
Vector3f s3 = Vector3f.Of(s[3], s[4], s[5]);
|
||||||
// Skip too distant segments.
|
// Skip too distant segments.
|
||||||
Tuple<float, float> distSqr = distancePtSegSqr2D(m_spos, s, 0, 3);
|
Tuple<float, float> distSqr = distancePtSegSqr2D(m_spos, s, 0, 3);
|
||||||
|
@ -860,7 +860,7 @@ public class TestNavmeshTool : Tool
|
||||||
vNormalize(ref norm);
|
vNormalize(ref norm);
|
||||||
Vector3f p1 = vMad(p0, norm, agentRadius * 0.5f);
|
Vector3f p1 = vMad(p0, norm, agentRadius * 0.5f);
|
||||||
// Skip backfacing segments.
|
// Skip backfacing segments.
|
||||||
if (wallSegments.getSegmentRefs()[j] != 0)
|
if (wallSegments.getSegmentRef(j) != 0)
|
||||||
{
|
{
|
||||||
int col = duRGBA(255, 255, 255, 32);
|
int col = duRGBA(255, 255, 255, 32);
|
||||||
dd.vertex(s[0], s[1] + agentClimb, s[2], col);
|
dd.vertex(s[0], s[1] + agentClimb, s[2], col);
|
||||||
|
|
|
@ -80,19 +80,19 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest
|
||||||
{
|
{
|
||||||
Result<GetPolyWallSegmentsResult> result = query.getPolyWallSegments(startRefs[i], true, filter);
|
Result<GetPolyWallSegmentsResult> result = query.getPolyWallSegments(startRefs[i], true, filter);
|
||||||
GetPolyWallSegmentsResult segments = result.result;
|
GetPolyWallSegmentsResult segments = result.result;
|
||||||
Assert.That(segments.getSegmentVerts().Count, Is.EqualTo(VERTICES[i].Length / 6));
|
Assert.That(segments.countSegmentVerts(), Is.EqualTo(VERTICES[i].Length / 6));
|
||||||
Assert.That(segments.getSegmentRefs().Count, Is.EqualTo(REFS[i].Length));
|
Assert.That(segments.countSegmentRefs(), Is.EqualTo(REFS[i].Length));
|
||||||
for (int v = 0; v < VERTICES[i].Length / 6; v++)
|
for (int v = 0; v < VERTICES[i].Length / 6; v++)
|
||||||
{
|
{
|
||||||
for (int n = 0; n < 6; n++)
|
for (int n = 0; n < 6; n++)
|
||||||
{
|
{
|
||||||
Assert.That(segments.getSegmentVerts()[v][n], Is.EqualTo(VERTICES[i][v * 6 + n]).Within(0.001f));
|
Assert.That(segments.getSegmentVert(v)[n], Is.EqualTo(VERTICES[i][v * 6 + n]).Within(0.001f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int v = 0; v < REFS[i].Length; v++)
|
for (int v = 0; v < REFS[i].Length; v++)
|
||||||
{
|
{
|
||||||
Assert.That(segments.getSegmentRefs()[v], Is.EqualTo(REFS[i][v]));
|
Assert.That(segments.getSegmentRef(v), Is.EqualTo(REFS[i][v]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue