Recast: numerous changes for jump links (WIP)

EditorPolyAreas::EDITOR_POLYAREA_JUMP is supposed to be right after EDITOR_POLYAREA_GROUND, this enumerant has been moved there (in exchange of water which is as far as i can tell unused). For the off-mesh connection tool the flags have to be set to EDITOR_POLYFLAGS_WALK (this is what Titanfall 2 does). Off-mesh links don't work yet, more work is needed in dtLink.
This commit is contained in:
Kawe Mazidjatari 2024-07-17 00:39:25 +02:00
parent 243bd3348e
commit 444172533e
5 changed files with 31 additions and 29 deletions

View File

@ -131,9 +131,9 @@ void ConvexVolumeTool::handleMenu()
if (ImGui::Checkbox("Clip", &isEnabled))
m_areaType = EDITOR_POLYAREA_GROUND;
isEnabled = m_areaType == EDITOR_POLYAREA_WATER;
if (ImGui::Checkbox("Water", &isEnabled))
m_areaType = EDITOR_POLYAREA_WATER;
isEnabled = m_areaType == EDITOR_POLYAREA_JUMP;
if (ImGui::Checkbox("Jump", &isEnabled))
m_areaType = EDITOR_POLYAREA_JUMP;
isEnabled = m_areaType == EDITOR_POLYAREA_ROAD;
if (ImGui::Checkbox("Road", &isEnabled))
@ -147,9 +147,9 @@ void ConvexVolumeTool::handleMenu()
if (ImGui::Checkbox("Grass", &isEnabled))
m_areaType = EDITOR_POLYAREA_GRASS;
isEnabled = m_areaType == EDITOR_POLYAREA_JUMP;
if (ImGui::Checkbox("Jump", &isEnabled))
m_areaType = EDITOR_POLYAREA_JUMP;
isEnabled = m_areaType == EDITOR_POLYAREA_WATER;
if (ImGui::Checkbox("Water", &isEnabled))
m_areaType = EDITOR_POLYAREA_WATER;
ImGui::Unindent();

View File

@ -40,16 +40,16 @@ unsigned int EditorDebugDraw::areaToCol(unsigned int area)
{
// Ground (0) : light blue
case EDITOR_POLYAREA_GROUND: return duRGBA(0, 192, 215, 255);
// Water : blue
case EDITOR_POLYAREA_WATER: return duRGBA(0, 0, 255, 255);
// Jump : yellow
case EDITOR_POLYAREA_JUMP: return duRGBA(255, 255, 0, 255);
// Road : brown
case EDITOR_POLYAREA_ROAD: return duRGBA(50, 20, 12, 255);
// Door : cyan
case EDITOR_POLYAREA_DOOR: return duRGBA(0, 255, 255, 255);
// Grass : green
case EDITOR_POLYAREA_GRASS: return duRGBA(0, 255, 0, 255);
// Jump : yellow
case EDITOR_POLYAREA_JUMP: return duRGBA(255, 255, 0, 255);
// Water : blue
case EDITOR_POLYAREA_WATER: return duRGBA(0, 0, 255, 255);
// Unexpected : orange
default: return duRGBA(255, 100, 10, 255);
}

View File

@ -197,11 +197,11 @@ void NavMeshTesterTool::init(Editor* editor)
{
// Change costs.
m_filter.setAreaCost(EDITOR_POLYAREA_GROUND, 1.0f);
m_filter.setAreaCost(EDITOR_POLYAREA_WATER, 10.0f);
m_filter.setAreaCost(EDITOR_POLYAREA_JUMP, 1.5f);
m_filter.setAreaCost(EDITOR_POLYAREA_ROAD, 1.0f);
m_filter.setAreaCost(EDITOR_POLYAREA_DOOR, 1.0f);
m_filter.setAreaCost(EDITOR_POLYAREA_GRASS, 2.0f);
m_filter.setAreaCost(EDITOR_POLYAREA_JUMP, 1.5f);
m_filter.setAreaCost(EDITOR_POLYAREA_WATER, 10.0f);
}
m_neighbourhoodRadius = editor->getAgentRadius() * 20.0f;
@ -394,11 +394,11 @@ void NavMeshTesterTool::handleMenu()
recalc();
}
isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_SWIM) != 0;
isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_JUMP) != 0;
if (ImGui::Checkbox("Swim##IncludeFlags", &isEnabled))
if (ImGui::Checkbox("Jump##IncludeFlags", &isEnabled))
{
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_SWIM);
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_JUMP);
recalc();
}
@ -410,13 +410,14 @@ void NavMeshTesterTool::handleMenu()
recalc();
}
isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_JUMP) != 0;
isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_SWIM) != 0;
if (ImGui::Checkbox("Jump##IncludeFlags", &isEnabled))
if (ImGui::Checkbox("Swim##IncludeFlags", &isEnabled))
{
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_JUMP);
m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_SWIM);
recalc();
}
ImGui::Unindent();
ImGui::Separator();
@ -432,11 +433,11 @@ void NavMeshTesterTool::handleMenu()
recalc();
}
isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_SWIM) != 0;
isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_JUMP) != 0;
if (ImGui::Checkbox("Swim##ExcludeFlags", &isEnabled))
if (ImGui::Checkbox("Jump##ExcludeFlags", &isEnabled))
{
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_SWIM);
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_JUMP);
recalc();
}
@ -448,13 +449,14 @@ void NavMeshTesterTool::handleMenu()
recalc();
}
isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_JUMP) != 0;
isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_SWIM) != 0;
if (ImGui::Checkbox("Jump##ExcludeFlags", &isEnabled))
if (ImGui::Checkbox("Swim##ExcludeFlags", &isEnabled))
{
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_JUMP);
m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_SWIM);
recalc();
}
ImGui::Unindent();
ImGui::Separator();

View File

@ -112,7 +112,7 @@ void OffMeshConnectionTool::handleClick(const float* /*s*/, const float* p, bool
else
{
const unsigned char area = EDITOR_POLYAREA_JUMP;
const unsigned short flags = EDITOR_POLYFLAGS_JUMP;
const unsigned short flags = EDITOR_POLYFLAGS_WALK;
geom->addOffMeshConnection(m_hitPos, p, m_editor->getAgentRadius(), m_bidir ? 1 : 0, area, flags);
m_hitPosSet = false;
}

View File

@ -54,18 +54,18 @@ enum EditorToolType
enum EditorPolyAreas
{
EDITOR_POLYAREA_GROUND,
EDITOR_POLYAREA_WATER,
EDITOR_POLYAREA_JUMP,
EDITOR_POLYAREA_ROAD,
EDITOR_POLYAREA_DOOR,
EDITOR_POLYAREA_GRASS,
EDITOR_POLYAREA_JUMP,
EDITOR_POLYAREA_WATER,
};
enum EditorPolyFlags
{
EDITOR_POLYFLAGS_WALK = 0x01, // Ability to walk (ground, grass, road)
EDITOR_POLYFLAGS_SWIM = 0x02, // Ability to swim (water).
EDITOR_POLYFLAGS_JUMP = 0x02, // Ability to jump.
EDITOR_POLYFLAGS_DOOR = 0x04, // Ability to move through doors.
EDITOR_POLYFLAGS_JUMP = 0x08, // Ability to jump.
EDITOR_POLYFLAGS_SWIM = 0x08, // Ability to swim (water).
EDITOR_POLYFLAGS_DISABLED = 0x10, // Disabled polygon
EDITOR_POLYFLAGS_ALL = 0xffff // All abilities.
};