change name RcSegmentVert for unity3d

This commit is contained in:
ikpil 2023-07-17 23:24:28 +09:00
parent 5588f6f17b
commit 6dbd22ecb7
5 changed files with 18 additions and 18 deletions

View File

@ -1,11 +1,11 @@
namespace DotRecast.Core namespace DotRecast.Core
{ {
public struct SegmentVert public struct RcSegmentVert
{ {
public RcVec3f vmin; public RcVec3f vmin;
public RcVec3f vmax; public RcVec3f vmax;
public SegmentVert(float v0, float v1, float v2, float v3, float v4, float v5) public RcSegmentVert(float v0, float v1, float v2, float v3, float v4, float v5)
{ {
vmin.x = v0; vmin.x = v0;
vmin.y = v1; vmin.y = v1;

View File

@ -48,7 +48,7 @@ namespace DotRecast.Detour.Crowd
m_segs.Clear(); m_segs.Clear();
} }
protected void AddSegment(float dist, SegmentVert s) protected void AddSegment(float dist, RcSegmentVert s)
{ {
// Insert neighbour based on the distance. // Insert neighbour based on the distance.
DtSegment seg = new DtSegment(); DtSegment seg = new DtSegment();
@ -107,7 +107,7 @@ namespace DotRecast.Detour.Crowd
// Secondly, store all polygon edges. // Secondly, store all polygon edges.
m_segs.Clear(); m_segs.Clear();
var segmentVerts = new List<SegmentVert>(); var segmentVerts = new List<RcSegmentVert>();
var segmentRefs = new List<long>(); var segmentRefs = new List<long>();
for (int j = 0; j < m_polys.Count; ++j) for (int j = 0; j < m_polys.Count; ++j)
@ -117,7 +117,7 @@ namespace DotRecast.Detour.Crowd
{ {
for (int k = 0; k < segmentRefs.Count; ++k) for (int k = 0; k < segmentRefs.Count; ++k)
{ {
SegmentVert s = segmentVerts[k]; RcSegmentVert s = segmentVerts[k];
var s0 = s.vmin; var s0 = s.vmin;
var s3 = s.vmax; var s3 = s.vmax;

View File

@ -2998,7 +2998,7 @@ namespace DotRecast.Detour
/// @param[in] maxSegments The maximum number of segments the result arrays can hold. /// @param[in] maxSegments The maximum number of segments the result arrays can hold.
/// @returns The status flags for the query. /// @returns The status flags for the query.
public DtStatus GetPolyWallSegments(long refs, bool storePortals, IDtQueryFilter filter, public DtStatus GetPolyWallSegments(long refs, bool storePortals, IDtQueryFilter filter,
ref List<SegmentVert> segmentVerts, ref List<long> segmentRefs) ref List<RcSegmentVert> segmentVerts, ref List<long> segmentRefs)
{ {
segmentVerts.Clear(); segmentVerts.Clear();
segmentRefs.Clear(); segmentRefs.Clear();
@ -3060,7 +3060,7 @@ namespace DotRecast.Detour
int ivj = poly.verts[j] * 3; int ivj = poly.verts[j] * 3;
int ivi = poly.verts[i] * 3; int ivi = poly.verts[i] * 3;
var seg = new SegmentVert(); var seg = new RcSegmentVert();
seg.vmin.Set(tile.data.verts, ivj); seg.vmin.Set(tile.data.verts, ivj);
seg.vmax.Set(tile.data.verts, ivi); seg.vmax.Set(tile.data.verts, ivi);
// Array.Copy(tile.data.verts, ivj, seg, 0, 3); // Array.Copy(tile.data.verts, ivj, seg, 0, 3);
@ -3084,7 +3084,7 @@ namespace DotRecast.Detour
{ {
float tmin = ints[k].tmin / 255.0f; float tmin = ints[k].tmin / 255.0f;
float tmax = ints[k].tmax / 255.0f; float tmax = ints[k].tmax / 255.0f;
var seg = new SegmentVert(); var seg = new RcSegmentVert();
seg.vmin = RcVec3f.Lerp(tile.data.verts, vj, vi, tmin); seg.vmin = RcVec3f.Lerp(tile.data.verts, vj, vi, tmin);
seg.vmax = RcVec3f.Lerp(tile.data.verts, vj, vi, tmax); seg.vmax = RcVec3f.Lerp(tile.data.verts, vj, vi, tmax);
segmentVerts.Add(seg); segmentVerts.Add(seg);
@ -3098,7 +3098,7 @@ namespace DotRecast.Detour
{ {
float tmin = imin / 255.0f; float tmin = imin / 255.0f;
float tmax = imax / 255.0f; float tmax = imax / 255.0f;
var seg = new SegmentVert(); var seg = new RcSegmentVert();
seg.vmin = RcVec3f.Lerp(tile.data.verts, vj, vi, tmin); seg.vmin = RcVec3f.Lerp(tile.data.verts, vj, vi, tmin);
seg.vmax = RcVec3f.Lerp(tile.data.verts, vj, vi, tmax); seg.vmax = RcVec3f.Lerp(tile.data.verts, vj, vi, tmax);
segmentVerts.Add(seg); segmentVerts.Add(seg);

View File

@ -688,7 +688,7 @@ public class TestNavmeshTool : IRcTool
{ {
if (m_polys != null) if (m_polys != null)
{ {
var segmentVerts = new List<SegmentVert>(); var segmentVerts = new List<RcSegmentVert>();
var segmentRefs = new List<long>(); var segmentRefs = new List<long>();
for (int i = 0; i < m_polys.Count; i++) for (int i = 0; i < m_polys.Count; i++)
@ -717,7 +717,7 @@ public class TestNavmeshTool : IRcTool
dd.Begin(LINES, 2.0f); dd.Begin(LINES, 2.0f);
for (int j = 0; j < segmentVerts.Count; ++j) for (int j = 0; j < segmentVerts.Count; ++j)
{ {
SegmentVert s = segmentVerts[j]; RcSegmentVert s = segmentVerts[j];
var v0 = s.vmin; var v0 = s.vmin;
var s3 = s.vmax; var s3 = s.vmax;
// Skip too distant segments. // Skip too distant segments.

View File

@ -25,15 +25,15 @@ namespace DotRecast.Detour.Test;
[Parallelizable] [Parallelizable]
public class GetPolyWallSegmentsTest : AbstractDetourTest public class GetPolyWallSegmentsTest : AbstractDetourTest
{ {
private static readonly SegmentVert[][] VERTICES = private static readonly RcSegmentVert[][] VERTICES =
{ {
new SegmentVert[] new RcSegmentVert[]
{ {
new(22.084785f, 10.197294f, -48.341274f, 22.684784f, 10.197294f, -44.141273f), new(22.084785f, 10.197294f, -48.341274f, 22.684784f, 10.197294f, -44.141273f),
new(22.684784f, 10.197294f, -44.141273f, 23.884785f, 10.197294f, -48.041275f), new(22.684784f, 10.197294f, -44.141273f, 23.884785f, 10.197294f, -48.041275f),
new(23.884785f, 10.197294f, -48.041275f, 22.084785f, 10.197294f, -48.341274f), new(23.884785f, 10.197294f, -48.041275f, 22.084785f, 10.197294f, -48.341274f),
}, },
new SegmentVert[] new RcSegmentVert[]
{ {
new(27.784786f, 10.197294f, 4.158730f, 28.384785f, 10.197294f, 2.358727f), new(27.784786f, 10.197294f, 4.158730f, 28.384785f, 10.197294f, 2.358727f),
new(28.384785f, 10.197294f, 2.358727f, 28.384785f, 10.197294f, -2.141273f), new(28.384785f, 10.197294f, 2.358727f, 28.384785f, 10.197294f, -2.141273f),
@ -42,7 +42,7 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest
new(19.684784f, 10.197294f, -4.241272f, 19.684784f, 10.197294f, 4.158730f), new(19.684784f, 10.197294f, -4.241272f, 19.684784f, 10.197294f, 4.158730f),
new(19.684784f, 10.197294f, 4.158730f, 27.784786f, 10.197294f, 4.158730f), new(19.684784f, 10.197294f, 4.158730f, 27.784786f, 10.197294f, 4.158730f),
}, },
new SegmentVert[] new RcSegmentVert[]
{ {
new(22.384785f, 14.997294f, -71.741272f, 19.084785f, 16.597294f, -74.741272f), new(22.384785f, 14.997294f, -71.741272f, 19.084785f, 16.597294f, -74.741272f),
new(19.084785f, 16.597294f, -74.741272f, 18.184784f, 15.997294f, -73.541275f), new(19.084785f, 16.597294f, -74.741272f, 18.184784f, 15.997294f, -73.541275f),
@ -51,7 +51,7 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest
new(17.584785f, 14.997294f, -70.841278f, 22.084785f, 14.997294f, -70.541275f), new(17.584785f, 14.997294f, -70.841278f, 22.084785f, 14.997294f, -70.541275f),
new(22.084785f, 14.997294f, -70.541275f, 22.384785f, 14.997294f, -71.741272f), new(22.084785f, 14.997294f, -70.541275f, 22.384785f, 14.997294f, -71.741272f),
}, },
new SegmentVert[] new RcSegmentVert[]
{ {
new(4.684784f, 10.197294f, -6.941269f, 1.984785f, 10.197294f, -8.441269f), new(4.684784f, 10.197294f, -6.941269f, 1.984785f, 10.197294f, -8.441269f),
new(1.984785f, 10.197294f, -8.441269f, -4.015217f, 10.197294f, -6.941269f), new(1.984785f, 10.197294f, -8.441269f, -4.015217f, 10.197294f, -6.941269f),
@ -60,7 +60,7 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest
new(1.384785f, 10.197294f, 1.458725f, 7.984783f, 10.197294f, -2.441269f), new(1.384785f, 10.197294f, 1.458725f, 7.984783f, 10.197294f, -2.441269f),
new(7.984783f, 10.197294f, -2.441269f, 4.684784f, 10.197294f, -6.941269f), new(7.984783f, 10.197294f, -2.441269f, 4.684784f, 10.197294f, -6.941269f),
}, },
new SegmentVert[] new RcSegmentVert[]
{ {
new(-22.315216f, 6.597294f, -17.141273f, -23.815216f, 5.397294f, -13.841270f), new(-22.315216f, 6.597294f, -17.141273f, -23.815216f, 5.397294f, -13.841270f),
new(-23.815216f, 5.397294f, -13.841270f, -24.115217f, 4.997294f, -12.041275f), new(-23.815216f, 5.397294f, -13.841270f, -24.115217f, 4.997294f, -12.041275f),
@ -82,7 +82,7 @@ public class GetPolyWallSegmentsTest : AbstractDetourTest
[Test] [Test]
public void TestFindDistanceToWall() public void TestFindDistanceToWall()
{ {
var segmentVerts = new List<SegmentVert>(); var segmentVerts = new List<RcSegmentVert>();
var segmentRefs = new List<long>(); var segmentRefs = new List<long>();
IDtQueryFilter filter = new DtQueryDefaultFilter(); IDtQueryFilter filter = new DtQueryDefaultFilter();