Add toggles for heightfield filtering
This commit is contained in:
parent
a2e16b8e6c
commit
12e8950bac
@ -114,6 +114,10 @@ protected:
|
||||
float m_detailSampleDist;
|
||||
float m_detailSampleMaxError;
|
||||
int m_partitionType;
|
||||
|
||||
bool m_filterLowHangingObstacles;
|
||||
bool m_filterLedgeSpans;
|
||||
bool m_filterWalkableLowHeightSpans;
|
||||
|
||||
SampleTool* m_tool;
|
||||
SampleToolState* m_toolStates[MAX_TOOLS];
|
||||
|
@ -42,7 +42,10 @@ Sample::Sample() :
|
||||
m_crowd(0),
|
||||
m_navMeshDrawFlags(DU_DRAWNAVMESH_OFFMESHCONS|DU_DRAWNAVMESH_CLOSEDLIST),
|
||||
m_tool(0),
|
||||
m_ctx(0)
|
||||
m_ctx(0),
|
||||
m_filterLowHangingObstacles(true),
|
||||
m_filterLedgeSpans(true),
|
||||
m_filterWalkableLowHeightSpans(true)
|
||||
{
|
||||
resetCommonSettings();
|
||||
m_navQuery = dtAllocNavMeshQuery();
|
||||
@ -201,6 +204,15 @@ void Sample::handleCommonSettings()
|
||||
if (imguiCheck("Layers", m_partitionType == SAMPLE_PARTITION_LAYERS))
|
||||
m_partitionType = SAMPLE_PARTITION_LAYERS;
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel("Filtering");
|
||||
if (imguiCheck("Low Hanging Obstacles", m_filterLowHangingObstacles))
|
||||
m_filterLowHangingObstacles = !m_filterLowHangingObstacles;
|
||||
if (imguiCheck("Ledge Spans", m_filterLedgeSpans))
|
||||
m_filterLedgeSpans= !m_filterLedgeSpans;
|
||||
if (imguiCheck("Walkable Low Height Spans", m_filterWalkableLowHeightSpans))
|
||||
m_filterWalkableLowHeightSpans = !m_filterWalkableLowHeightSpans;
|
||||
|
||||
imguiSeparator();
|
||||
imguiLabel("Polygonization");
|
||||
imguiSlider("Max Edge Length", &m_edgeMaxLen, 0.0f, 50.0f, 1.0f);
|
||||
|
@ -457,9 +457,12 @@ bool Sample_SoloMesh::handleBuild()
|
||||
// Once all geoemtry 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.
|
||||
rcFilterLowHangingWalkableObstacles(m_ctx, m_cfg.walkableClimb, *m_solid);
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, *m_solid);
|
||||
rcFilterWalkableLowHeightSpans(m_ctx, m_cfg.walkableHeight, *m_solid);
|
||||
if (m_filterLowHangingObstacles)
|
||||
rcFilterLowHangingWalkableObstacles(m_ctx, m_cfg.walkableClimb, *m_solid);
|
||||
if (m_filterLedgeSpans)
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, *m_solid);
|
||||
if (m_filterWalkableLowHeightSpans)
|
||||
rcFilterWalkableLowHeightSpans(m_ctx, m_cfg.walkableHeight, *m_solid);
|
||||
|
||||
|
||||
//
|
||||
|
@ -1056,9 +1056,12 @@ unsigned char* Sample_TileMesh::buildTileMesh(const int tx, const int ty, const
|
||||
// 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.
|
||||
rcFilterLowHangingWalkableObstacles(m_ctx, m_cfg.walkableClimb, *m_solid);
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, *m_solid);
|
||||
rcFilterWalkableLowHeightSpans(m_ctx, m_cfg.walkableHeight, *m_solid);
|
||||
if (m_filterLowHangingObstacles)
|
||||
rcFilterLowHangingWalkableObstacles(m_ctx, m_cfg.walkableClimb, *m_solid);
|
||||
if (m_filterLedgeSpans)
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, *m_solid);
|
||||
if (m_filterWalkableLowHeightSpans)
|
||||
rcFilterWalkableLowHeightSpans(m_ctx, m_cfg.walkableHeight, *m_solid);
|
||||
|
||||
// Compact the heightfield so that it is faster to handle from now on.
|
||||
// This will result more cache coherent data as well as the neighbours
|
||||
|
Loading…
x
Reference in New Issue
Block a user