forked from bit/DotRecastNetSim
poly.GetType -> poly.GetPolyType
This commit is contained in:
parent
db64fbd047
commit
86ad3c4148
|
@ -40,7 +40,7 @@ namespace DotRecast.Detour.Extras.Unity.Astar
|
|||
startTile.polys[poly] = new DtPoly(poly, 2);
|
||||
startTile.polys[poly].verts[0] = startTile.header.vertCount;
|
||||
startTile.polys[poly].verts[1] = startTile.header.vertCount + 1;
|
||||
startTile.polys[poly].SetType(DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION);
|
||||
startTile.polys[poly].SetPolyType(DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION);
|
||||
startTile.verts = RcArrayUtils.CopyOf(startTile.verts, startTile.verts.Length + 6);
|
||||
startTile.header.polyCount++;
|
||||
startTile.header.vertCount += 2;
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace DotRecast.Detour
|
|||
}
|
||||
|
||||
/** Sets the polygon type. (See: #dtPolyTypes.) */
|
||||
public void SetType(int t)
|
||||
public void SetPolyType(int t)
|
||||
{
|
||||
areaAndtype = (areaAndtype & 0x3f) | (t << 6);
|
||||
}
|
||||
|
|
|
@ -487,7 +487,7 @@ namespace DotRecast.Detour
|
|||
p.vertCount = 0;
|
||||
p.flags = option.polyFlags[i];
|
||||
p.SetArea(option.polyAreas[i]);
|
||||
p.SetType(DtPoly.DT_POLYTYPE_GROUND);
|
||||
p.SetPolyType(DtPoly.DT_POLYTYPE_GROUND);
|
||||
for (int j = 0; j < nvp; ++j)
|
||||
{
|
||||
if (option.polys[src + j] == MESH_NULL_IDX)
|
||||
|
@ -534,7 +534,7 @@ namespace DotRecast.Detour
|
|||
p.verts[1] = offMeshVertsBase + n * 2 + 1;
|
||||
p.flags = option.offMeshConFlags[i];
|
||||
p.SetArea(option.offMeshConAreas[i]);
|
||||
p.SetType(DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION);
|
||||
p.SetPolyType(DtPoly.DT_POLYTYPE_OFFMESH_CONNECTION);
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
private readonly TileNavMeshBuilder tileNavMeshBuilder = new TileNavMeshBuilder();
|
||||
|
||||
private string _lastGeomFileName;
|
||||
private Sample sample;
|
||||
private Sample _sample;
|
||||
|
||||
private bool processHitTest = false;
|
||||
private bool processHitTestShift;
|
||||
|
@ -324,7 +324,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
|
||||
if (null != mesh)
|
||||
{
|
||||
sample.Update(sample.GetInputGeom(), ImmutableArray<RecastBuilderResult>.Empty, mesh);
|
||||
_sample.Update(_sample.GetInputGeom(), ImmutableArray<RecastBuilderResult>.Empty, mesh);
|
||||
toolset.SetEnabled(true);
|
||||
}
|
||||
}
|
||||
|
@ -375,10 +375,10 @@ public class RecastDemo : IRecastDemoChannel
|
|||
_imgui = new ImGuiController(_gl, window, _input, imGuiFontConfig);
|
||||
|
||||
DemoInputGeomProvider geom = LoadInputMesh("nav_test.obj");
|
||||
sample = new Sample(geom, ImmutableArray<RecastBuilderResult>.Empty, null);
|
||||
_sample = new Sample(geom, ImmutableArray<RecastBuilderResult>.Empty, null);
|
||||
|
||||
settingsView = new RcSettingsView(this);
|
||||
settingsView.SetSample(sample);
|
||||
settingsView.SetSample(_sample);
|
||||
|
||||
toolset = new RcToolsetView(
|
||||
new TestNavmeshTool(),
|
||||
|
@ -444,16 +444,16 @@ public class RecastDemo : IRecastDemoChannel
|
|||
* try (MemoryStack stack = StackPush()) { int[] w = stack.MallocInt(1); int[] h =
|
||||
* stack.MallocInt(1); GlfwGetWindowSize(win, w, h); width = w.x; height = h.x; }
|
||||
*/
|
||||
if (sample.GetInputGeom() != null)
|
||||
if (_sample.GetInputGeom() != null)
|
||||
{
|
||||
var settings = sample.GetSettings();
|
||||
RcVec3f bmin = sample.GetInputGeom().GetMeshBoundsMin();
|
||||
RcVec3f bmax = sample.GetInputGeom().GetMeshBoundsMax();
|
||||
var settings = _sample.GetSettings();
|
||||
RcVec3f bmin = _sample.GetInputGeom().GetMeshBoundsMin();
|
||||
RcVec3f bmax = _sample.GetInputGeom().GetMeshBoundsMax();
|
||||
Recast.CalcGridSize(bmin, bmax, settings.cellSize, out var gw, out var gh);
|
||||
settingsView.SetVoxels(gw, gh);
|
||||
settingsView.SetTiles(tileNavMeshBuilder.GetTiles(sample.GetInputGeom(), settings.cellSize, settings.tileSize));
|
||||
settingsView.SetMaxTiles(tileNavMeshBuilder.GetMaxTiles(sample.GetInputGeom(), settings.cellSize, settings.tileSize));
|
||||
settingsView.SetMaxPolys(tileNavMeshBuilder.GetMaxPolysPerTile(sample.GetInputGeom(), settings.cellSize, settings.tileSize));
|
||||
settingsView.SetTiles(tileNavMeshBuilder.GetTiles(_sample.GetInputGeom(), settings.cellSize, settings.tileSize));
|
||||
settingsView.SetMaxTiles(tileNavMeshBuilder.GetMaxTiles(_sample.GetInputGeom(), settings.cellSize, settings.tileSize));
|
||||
settingsView.SetMaxPolys(tileNavMeshBuilder.GetMaxPolysPerTile(_sample.GetInputGeom(), settings.cellSize, settings.tileSize));
|
||||
}
|
||||
|
||||
UpdateKeyboard((float)dt);
|
||||
|
@ -490,7 +490,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
while (timeAcc > DELTA_TIME)
|
||||
{
|
||||
timeAcc -= DELTA_TIME;
|
||||
if (simIter < 5 && sample != null)
|
||||
if (simIter < 5 && _sample != null)
|
||||
{
|
||||
toolset.HandleUpdate(DELTA_TIME);
|
||||
}
|
||||
|
@ -515,24 +515,24 @@ public class RecastDemo : IRecastDemoChannel
|
|||
});
|
||||
}
|
||||
|
||||
if (sample.IsChanged())
|
||||
if (_sample.IsChanged())
|
||||
{
|
||||
RcVec3f? bminN = null;
|
||||
RcVec3f? bmaxN = null;
|
||||
if (sample.GetInputGeom() != null)
|
||||
if (_sample.GetInputGeom() != null)
|
||||
{
|
||||
bminN = sample.GetInputGeom().GetMeshBoundsMin();
|
||||
bmaxN = sample.GetInputGeom().GetMeshBoundsMax();
|
||||
bminN = _sample.GetInputGeom().GetMeshBoundsMin();
|
||||
bmaxN = _sample.GetInputGeom().GetMeshBoundsMax();
|
||||
}
|
||||
else if (sample.GetNavMesh() != null)
|
||||
else if (_sample.GetNavMesh() != null)
|
||||
{
|
||||
RcVec3f[] bounds = NavMeshUtils.GetNavMeshBounds(sample.GetNavMesh());
|
||||
RcVec3f[] bounds = NavMeshUtils.GetNavMeshBounds(_sample.GetNavMesh());
|
||||
bminN = bounds[0];
|
||||
bmaxN = bounds[1];
|
||||
}
|
||||
else if (0 < sample.GetRecastResults().Count)
|
||||
else if (0 < _sample.GetRecastResults().Count)
|
||||
{
|
||||
foreach (RecastBuilderResult result in sample.GetRecastResults())
|
||||
foreach (RecastBuilderResult result in _sample.GetRecastResults())
|
||||
{
|
||||
if (result.GetSolidHeightfield() != null)
|
||||
{
|
||||
|
@ -573,8 +573,8 @@ public class RecastDemo : IRecastDemoChannel
|
|||
cameraEulers[1] = -45;
|
||||
}
|
||||
|
||||
sample.SetChanged(false);
|
||||
toolset.SetSample(sample);
|
||||
_sample.SetChanged(false);
|
||||
toolset.SetSample(_sample);
|
||||
}
|
||||
|
||||
if (_messages.TryDequeue(out var msg))
|
||||
|
@ -601,7 +601,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
modelviewMatrix = dd.ViewMatrix(cameraPos, cameraEulers);
|
||||
|
||||
dd.Fog(camr * 0.1f, camr * 1.25f);
|
||||
renderer.Render(sample, settingsView.GetDrawMode());
|
||||
renderer.Render(_sample, settingsView.GetDrawMode());
|
||||
|
||||
IRcTool tool = toolset.GetTool();
|
||||
if (tool != null)
|
||||
|
@ -652,18 +652,18 @@ public class RecastDemo : IRecastDemoChannel
|
|||
{
|
||||
var geom = LoadInputMesh(args.FilePath);
|
||||
|
||||
sample.Update(geom, ImmutableArray<RecastBuilderResult>.Empty, null);
|
||||
_sample.Update(geom, ImmutableArray<RecastBuilderResult>.Empty, null);
|
||||
}
|
||||
|
||||
private void OnNavMeshBuildBegan(NavMeshBuildBeganEvent args)
|
||||
{
|
||||
if (null == sample.GetInputGeom())
|
||||
if (null == _sample.GetInputGeom())
|
||||
{
|
||||
Logger.Information($"not found source geom");
|
||||
return;
|
||||
}
|
||||
|
||||
var settings = sample.GetSettings();
|
||||
var settings = _sample.GetSettings();
|
||||
var partitioning = settings.partitioning;
|
||||
var cellSize = settings.cellSize;
|
||||
var cellHeight = settings.cellHeight;
|
||||
|
@ -691,7 +691,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
if (settings.tiled)
|
||||
{
|
||||
buildResult = tileNavMeshBuilder.Build(
|
||||
sample.GetInputGeom(),
|
||||
_sample.GetInputGeom(),
|
||||
partitioning,
|
||||
cellSize,
|
||||
cellHeight,
|
||||
|
@ -715,7 +715,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
else
|
||||
{
|
||||
buildResult = soloNavMeshBuilder.Build(
|
||||
sample.GetInputGeom(),
|
||||
_sample.GetInputGeom(),
|
||||
partitioning,
|
||||
cellSize,
|
||||
cellHeight,
|
||||
|
@ -736,11 +736,11 @@ public class RecastDemo : IRecastDemoChannel
|
|||
);
|
||||
}
|
||||
|
||||
sample.Update(sample.GetInputGeom(), buildResult.RecastBuilderResults, buildResult.NavMesh);
|
||||
sample.SetChanged(false);
|
||||
_sample.Update(_sample.GetInputGeom(), buildResult.RecastBuilderResults, buildResult.NavMesh);
|
||||
_sample.SetChanged(false);
|
||||
settingsView.SetBuildTime((RcFrequency.Ticks - t) / TimeSpan.TicksPerMillisecond);
|
||||
//settingsUI.SetBuildTelemetry(buildResult.Item1.Select(x => x.GetTelemetry()).ToList());
|
||||
toolset.SetSample(sample);
|
||||
toolset.SetSample(_sample);
|
||||
|
||||
Logger.Information($"build times");
|
||||
Logger.Information($"-----------------------------------------");
|
||||
|
@ -758,7 +758,7 @@ public class RecastDemo : IRecastDemoChannel
|
|||
|
||||
private void OnNavMeshSaveBegan(NavMeshSaveBeganEvent args)
|
||||
{
|
||||
var navMesh = sample.GetNavMesh();
|
||||
var navMesh = _sample.GetNavMesh();
|
||||
if (null == navMesh)
|
||||
{
|
||||
Logger.Error("navmesh is null");
|
||||
|
@ -809,8 +809,8 @@ public class RecastDemo : IRecastDemoChannel
|
|||
var rayEnd = args.End;
|
||||
|
||||
// Hit test mesh.
|
||||
DemoInputGeomProvider inputGeom = sample.GetInputGeom();
|
||||
if (sample == null)
|
||||
DemoInputGeomProvider inputGeom = _sample.GetInputGeom();
|
||||
if (_sample == null)
|
||||
return;
|
||||
|
||||
float? hit = null;
|
||||
|
@ -819,14 +819,14 @@ public class RecastDemo : IRecastDemoChannel
|
|||
hit = inputGeom.RaycastMesh(rayStart, rayEnd);
|
||||
}
|
||||
|
||||
if (!hit.HasValue && sample.GetNavMesh() != null)
|
||||
if (!hit.HasValue && _sample.GetNavMesh() != null)
|
||||
{
|
||||
hit = NavMeshRaycast.Raycast(sample.GetNavMesh(), rayStart, rayEnd);
|
||||
hit = NavMeshRaycast.Raycast(_sample.GetNavMesh(), rayStart, rayEnd);
|
||||
}
|
||||
|
||||
if (!hit.HasValue && sample.GetRecastResults() != null)
|
||||
if (!hit.HasValue && _sample.GetRecastResults() != null)
|
||||
{
|
||||
hit = PolyMeshRaycast.Raycast(sample.GetRecastResults(), rayStart, rayEnd);
|
||||
hit = PolyMeshRaycast.Raycast(_sample.GetRecastResults(), rayStart, rayEnd);
|
||||
}
|
||||
|
||||
RcVec3f rayDir = RcVec3f.Of(rayEnd.x - rayStart.x, rayEnd.y - rayStart.y, rayEnd.z - rayStart.z);
|
||||
|
|
Loading…
Reference in New Issue