remove IConvexVolumeProvider

This commit is contained in:
ikpil 2023-08-20 13:05:04 +09:00
parent bac7a76258
commit 90f48d1021
3 changed files with 9 additions and 34 deletions

View File

@ -1,29 +0,0 @@
/*
recast4j copyright (c) 2021 Piotr Piastucki piotr@jtilia.org
DotRecast Copyright (c) 2023 Choi Ikpil ikpil@naver.com
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
using System.Collections.Generic;
namespace DotRecast.Recast.Geom
{
public interface IConvexVolumeProvider
{
void AddConvexVolume(RcConvexVolume convexVolume);
IList<RcConvexVolume> ConvexVolumes();
}
}

View File

@ -24,13 +24,17 @@ using DotRecast.Core;
namespace DotRecast.Recast.Geom
{
public interface IInputGeomProvider : IConvexVolumeProvider
public interface IInputGeomProvider
{
RcVec3f GetMeshBoundsMin();
RcVec3f GetMeshBoundsMax();
IEnumerable<RcTriMesh> Meshes();
// convex volume
void AddConvexVolume(RcConvexVolume convexVolume);
IList<RcConvexVolume> ConvexVolumes();
// off mesh connections
public List<DtOffMeshConnectionParam> GetOffMeshConnections();

View File

@ -166,7 +166,7 @@ namespace DotRecast.Recast
return Build(builderCfg.tileX, builderCfg.tileZ, geom, cfg, solid, ctx);
}
public RecastBuilderResult Build(int tileX, int tileZ, IConvexVolumeProvider geom, RcConfig cfg, RcHeightfield solid, RcTelemetry ctx)
public RecastBuilderResult Build(int tileX, int tileZ, IInputGeomProvider geom, RcConfig cfg, RcHeightfield solid, RcTelemetry ctx)
{
FilterHeightfield(solid, cfg, ctx);
RcCompactHeightfield chf = BuildCompactHeightfield(geom, cfg, ctx, solid);
@ -280,7 +280,7 @@ namespace DotRecast.Recast
/*
* Step 3. Partition walkable surface to simple regions.
*/
private RcCompactHeightfield BuildCompactHeightfield(IConvexVolumeProvider volumeProvider, RcConfig cfg, RcTelemetry ctx,
private RcCompactHeightfield BuildCompactHeightfield(IInputGeomProvider geom, RcConfig cfg, RcTelemetry ctx,
RcHeightfield solid)
{
// Compact the heightfield so that it is faster to handle from now on.
@ -291,9 +291,9 @@ namespace DotRecast.Recast
// Erode the walkable area by agent radius.
RecastArea.ErodeWalkableArea(ctx, cfg.WalkableRadius, chf);
// (Optional) Mark areas.
if (volumeProvider != null)
if (geom != null)
{
foreach (RcConvexVolume vol in volumeProvider.ConvexVolumes())
foreach (RcConvexVolume vol in geom.ConvexVolumes())
{
RecastArea.MarkConvexPolyArea(ctx, vol.verts, vol.hmin, vol.hmax, vol.areaMod, chf);
}