From 90f48d1021390b91c5f2a3e27ec38870597e3fdb Mon Sep 17 00:00:00 2001 From: ikpil Date: Sun, 20 Aug 2023 13:05:04 +0900 Subject: [PATCH] remove IConvexVolumeProvider --- .../Geom/IConvexVolumeProvider.cs | 29 ------------------- .../Geom/IInputGeomProvider.cs | 6 +++- src/DotRecast.Recast/RecastBuilder.cs | 8 ++--- 3 files changed, 9 insertions(+), 34 deletions(-) delete mode 100644 src/DotRecast.Recast/Geom/IConvexVolumeProvider.cs diff --git a/src/DotRecast.Recast/Geom/IConvexVolumeProvider.cs b/src/DotRecast.Recast/Geom/IConvexVolumeProvider.cs deleted file mode 100644 index ba7420f..0000000 --- a/src/DotRecast.Recast/Geom/IConvexVolumeProvider.cs +++ /dev/null @@ -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 ConvexVolumes(); - } -} \ No newline at end of file diff --git a/src/DotRecast.Recast/Geom/IInputGeomProvider.cs b/src/DotRecast.Recast/Geom/IInputGeomProvider.cs index 17238d7..99333ac 100644 --- a/src/DotRecast.Recast/Geom/IInputGeomProvider.cs +++ b/src/DotRecast.Recast/Geom/IInputGeomProvider.cs @@ -24,13 +24,17 @@ using DotRecast.Core; namespace DotRecast.Recast.Geom { - public interface IInputGeomProvider : IConvexVolumeProvider + public interface IInputGeomProvider { RcVec3f GetMeshBoundsMin(); RcVec3f GetMeshBoundsMax(); IEnumerable Meshes(); + + // convex volume + void AddConvexVolume(RcConvexVolume convexVolume); + IList ConvexVolumes(); // off mesh connections public List GetOffMeshConnections(); diff --git a/src/DotRecast.Recast/RecastBuilder.cs b/src/DotRecast.Recast/RecastBuilder.cs index 6701c06..88081f5 100644 --- a/src/DotRecast.Recast/RecastBuilder.cs +++ b/src/DotRecast.Recast/RecastBuilder.cs @@ -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); }