From d129fb5bb35a3d39c7b83e4bc7e37a6c5c8b89b2 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 14 Aug 2020 14:53:07 +0800 Subject: [PATCH] 1 --- server/gameserver/navmeshbuilder.cc | 17 +++++++++-------- server/gameserver/navmeshhelper.h | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/server/gameserver/navmeshbuilder.cc b/server/gameserver/navmeshbuilder.cc index ecd6c3d..9660d75 100644 --- a/server/gameserver/navmeshbuilder.cc +++ b/server/gameserver/navmeshbuilder.cc @@ -210,14 +210,15 @@ int NavMeshBuilder::RasterizeTileLayers(BuilderParams& builder_params, // Once all geometry is rasterized, we do initial pass of filtering to // remove unwanted overhangs caused by the conservative rasterization // as well as filter spans where the character cannot possibly stand. - #if 0 - if (m_filterLowHangingObstacles) - rcFilterLowHangingWalkableObstacles(m_ctx, tcfg.walkableClimb, *rc.solid); - if (m_filterLedgeSpans) - rcFilterLedgeSpans(m_ctx, tcfg.walkableHeight, tcfg.walkableClimb, *rc.solid); - if (m_filterWalkableLowHeightSpans) - rcFilterWalkableLowHeightSpans(m_ctx, tcfg.walkableHeight, *rc.solid); - #endif + if (builder_params.kFilterLowHangingObstacles) { + rcFilterLowHangingWalkableObstacles(ctx, tcfg.walkableClimb, *rc.solid); + } + if (builder_params.kFilterLedgeSpans) { + rcFilterLedgeSpans(ctx, tcfg.walkableHeight, tcfg.walkableClimb, *rc.solid); + } + if (builder_params.kFilterWalkableLowHeightSpans) { + rcFilterWalkableLowHeightSpans(ctx, tcfg.walkableHeight, *rc.solid); + } rc.chf = rcAllocCompactHeightfield(); if (!rc.chf) { diff --git a/server/gameserver/navmeshhelper.h b/server/gameserver/navmeshhelper.h index a9eddb9..7ce8df3 100644 --- a/server/gameserver/navmeshhelper.h +++ b/server/gameserver/navmeshhelper.h @@ -290,6 +290,10 @@ struct BuilderParams const int kMaxTiles = 0; const int kMaxPolysPerTile = 0; + const bool kFilterLowHangingObstacles = false; + const bool kFilterLedgeSpans = false; + const bool kFilterWalkableLowHeightSpans = false; + int grid_width = 0; int grid_height = 0; int tile_size = 0;