mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: update poly area's for MSET >= 7
These should be the poly area enumerants for MSET version 7 or higher.
This commit is contained in:
parent
ce4d4aa598
commit
c7adefa56c
@ -91,7 +91,7 @@ static int pointInPoly(int nvert, const float* verts, const float* p) // todo(am
|
||||
|
||||
ConvexVolumeTool::ConvexVolumeTool() :
|
||||
m_editor(0),
|
||||
m_areaType(EDITOR_POLYAREA_GROUND),
|
||||
m_areaType(RC_NULL_AREA),
|
||||
m_polyOffset(0.0f),
|
||||
m_boxHeight(650.0f),
|
||||
m_boxDescent(150.0f),
|
||||
@ -126,31 +126,15 @@ void ConvexVolumeTool::handleMenu()
|
||||
ImGui::Text("Brushes");
|
||||
ImGui::Indent();
|
||||
|
||||
bool isEnabled = m_areaType == EDITOR_POLYAREA_GROUND;
|
||||
bool isEnabled = m_areaType == RC_NULL_AREA;
|
||||
|
||||
if (ImGui::Checkbox("Clip", &isEnabled))
|
||||
m_areaType = EDITOR_POLYAREA_GROUND;
|
||||
|
||||
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))
|
||||
m_areaType = EDITOR_POLYAREA_ROAD;
|
||||
m_areaType = RC_NULL_AREA;
|
||||
|
||||
isEnabled = m_areaType == EDITOR_POLYAREA_DOOR;
|
||||
if (ImGui::Checkbox("Door", &isEnabled))
|
||||
if (ImGui::Checkbox("Trigger", &isEnabled))
|
||||
m_areaType = EDITOR_POLYAREA_DOOR;
|
||||
|
||||
isEnabled = m_areaType == EDITOR_POLYAREA_GRASS;
|
||||
if (ImGui::Checkbox("Grass", &isEnabled))
|
||||
m_areaType = EDITOR_POLYAREA_GRASS;
|
||||
|
||||
isEnabled = m_areaType == EDITOR_POLYAREA_WATER;
|
||||
if (ImGui::Checkbox("Water", &isEnabled))
|
||||
m_areaType = EDITOR_POLYAREA_WATER;
|
||||
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::Separator();
|
||||
|
@ -37,20 +37,14 @@ unsigned int EditorDebugDraw::areaToCol(unsigned int area)
|
||||
{
|
||||
switch(area)
|
||||
{
|
||||
// Ground (0) : light blue
|
||||
// Ground : light blue
|
||||
case EDITOR_POLYAREA_GROUND: return duRGBA(0, 192, 215, 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);
|
||||
// Water : blue
|
||||
case EDITOR_POLYAREA_WATER: return duRGBA(0, 0, 255, 255);
|
||||
// Unexpected : orange
|
||||
default: return duRGBA(255, 100, 10, 255);
|
||||
// Jump : purple
|
||||
case EDITOR_POLYAREA_JUMP: return duRGBA(255, 0, 255, 255);
|
||||
// Trigger : light green
|
||||
case EDITOR_POLYAREA_DOOR: return duRGBA(20, 245, 0, 255);
|
||||
// Unexpected : white
|
||||
default: return duRGBA(255, 255, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -448,16 +448,18 @@ bool Editor_SoloMesh::handleBuild()
|
||||
if (m_pmesh->areas[i] == RC_WALKABLE_AREA)
|
||||
m_pmesh->areas[i] = EDITOR_POLYAREA_GROUND;
|
||||
|
||||
if (m_pmesh->areas[i] == EDITOR_POLYAREA_GROUND ||
|
||||
m_pmesh->areas[i] == EDITOR_POLYAREA_GRASS ||
|
||||
m_pmesh->areas[i] == EDITOR_POLYAREA_ROAD)
|
||||
if (m_pmesh->areas[i] == EDITOR_POLYAREA_GROUND
|
||||
//||
|
||||
//m_pmesh->areas[i] == EDITOR_POLYAREA_GRASS ||
|
||||
//m_pmesh->areas[i] == EDITOR_POLYAREA_ROAD
|
||||
)
|
||||
{
|
||||
m_pmesh->flags[i] = EDITOR_POLYFLAGS_WALK;
|
||||
}
|
||||
else if (m_pmesh->areas[i] == EDITOR_POLYAREA_WATER)
|
||||
{
|
||||
m_pmesh->flags[i] = EDITOR_POLYFLAGS_SWIM;
|
||||
}
|
||||
//else if (m_pmesh->areas[i] == EDITOR_POLYAREA_WATER)
|
||||
//{
|
||||
// m_pmesh->flags[i] = EDITOR_POLYFLAGS_SWIM;
|
||||
//}
|
||||
else if (m_pmesh->areas[i] == EDITOR_POLYAREA_DOOR)
|
||||
{
|
||||
m_pmesh->flags[i] = EDITOR_POLYFLAGS_WALK | EDITOR_POLYFLAGS_DOOR;
|
||||
|
@ -176,16 +176,18 @@ struct MeshProcess : public dtTileCacheMeshProcess
|
||||
if (polyAreas[i] == DT_TILECACHE_WALKABLE_AREA)
|
||||
polyAreas[i] = EDITOR_POLYAREA_GROUND;
|
||||
|
||||
if (polyAreas[i] == EDITOR_POLYAREA_GROUND ||
|
||||
polyAreas[i] == EDITOR_POLYAREA_GRASS ||
|
||||
polyAreas[i] == EDITOR_POLYAREA_ROAD)
|
||||
if (polyAreas[i] == EDITOR_POLYAREA_GROUND
|
||||
//||
|
||||
//polyAreas[i] == EDITOR_POLYAREA_GRASS ||
|
||||
//polyAreas[i] == EDITOR_POLYAREA_ROAD
|
||||
)
|
||||
{
|
||||
polyFlags[i] = EDITOR_POLYFLAGS_WALK;
|
||||
}
|
||||
else if (polyAreas[i] == EDITOR_POLYAREA_WATER)
|
||||
{
|
||||
polyFlags[i] = EDITOR_POLYFLAGS_SWIM;
|
||||
}
|
||||
//else if (polyAreas[i] == EDITOR_POLYAREA_WATER)
|
||||
//{
|
||||
// polyFlags[i] = EDITOR_POLYFLAGS_SWIM;
|
||||
//}
|
||||
else if (polyAreas[i] == EDITOR_POLYAREA_DOOR)
|
||||
{
|
||||
polyFlags[i] = EDITOR_POLYFLAGS_WALK | EDITOR_POLYFLAGS_DOOR;
|
||||
|
@ -986,16 +986,18 @@ unsigned char* Editor_TileMesh::buildTileMesh(const int tx, const int ty, const
|
||||
if (m_pmesh->areas[i] == RC_WALKABLE_AREA)
|
||||
m_pmesh->areas[i] = EDITOR_POLYAREA_GROUND;
|
||||
|
||||
if (m_pmesh->areas[i] == EDITOR_POLYAREA_GROUND ||
|
||||
m_pmesh->areas[i] == EDITOR_POLYAREA_GRASS ||
|
||||
m_pmesh->areas[i] == EDITOR_POLYAREA_ROAD)
|
||||
if (m_pmesh->areas[i] == EDITOR_POLYAREA_GROUND
|
||||
//||
|
||||
//m_pmesh->areas[i] == EDITOR_POLYAREA_GRASS ||
|
||||
//m_pmesh->areas[i] == EDITOR_POLYAREA_ROAD
|
||||
)
|
||||
{
|
||||
m_pmesh->flags[i] = EDITOR_POLYFLAGS_WALK;
|
||||
}
|
||||
else if (m_pmesh->areas[i] == EDITOR_POLYAREA_WATER)
|
||||
{
|
||||
m_pmesh->flags[i] = EDITOR_POLYFLAGS_SWIM;
|
||||
}
|
||||
//else if (m_pmesh->areas[i] == EDITOR_POLYAREA_WATER)
|
||||
//{
|
||||
// m_pmesh->flags[i] = EDITOR_POLYFLAGS_SWIM;
|
||||
//}
|
||||
else if (m_pmesh->areas[i] == EDITOR_POLYAREA_DOOR)
|
||||
{
|
||||
m_pmesh->flags[i] = EDITOR_POLYFLAGS_WALK | EDITOR_POLYFLAGS_DOOR;
|
||||
|
@ -644,8 +644,8 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, const float* offset, b
|
||||
const ConvexVolume* vol = &m_volumes[i];
|
||||
unsigned int col;
|
||||
|
||||
if (vol->area == EDITOR_POLYAREA_GROUND)
|
||||
col = duRGBA(255, 0, 0, 128); // Use red for visibility (ground acts as deletion).
|
||||
if (vol->area == RC_NULL_AREA)
|
||||
col = duRGBA(255, 0, 0, 128); // Use red for visibility (null acts as deletion).
|
||||
else
|
||||
col = duTransCol(dd->areaToCol(vol->area), 64);
|
||||
|
||||
@ -676,7 +676,7 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, const float* offset, b
|
||||
const ConvexVolume* vol = &m_volumes[i];
|
||||
unsigned int col;
|
||||
|
||||
if (vol->area == EDITOR_POLYAREA_GROUND)
|
||||
if (vol->area == RC_NULL_AREA)
|
||||
col = duRGBA(255, 0, 0, 220);
|
||||
else
|
||||
col = duTransCol(dd->areaToCol(vol->area), 220);
|
||||
@ -701,7 +701,7 @@ void InputGeom::drawConvexVolumes(struct duDebugDraw* dd, const float* offset, b
|
||||
const ConvexVolume* vol = &m_volumes[i];
|
||||
unsigned int col;
|
||||
|
||||
if (vol->area == EDITOR_POLYAREA_GROUND)
|
||||
if (vol->area == RC_NULL_AREA)
|
||||
col = duRGBA(255, 0, 0, 220);
|
||||
else
|
||||
col = duDarkenCol(duTransCol(dd->areaToCol(vol->area), 220));
|
||||
|
@ -198,10 +198,10 @@ void NavMeshTesterTool::init(Editor* editor)
|
||||
// Change costs.
|
||||
m_filter.setAreaCost(EDITOR_POLYAREA_GROUND, 1.0f);
|
||||
m_filter.setAreaCost(EDITOR_POLYAREA_JUMP, 1.5f);
|
||||
m_filter.setAreaCost(EDITOR_POLYAREA_ROAD, 1.0f);
|
||||
//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_WATER, 10.0f);
|
||||
//m_filter.setAreaCost(EDITOR_POLYAREA_GRASS, 2.0f);
|
||||
//m_filter.setAreaCost(EDITOR_POLYAREA_WATER, 10.0f);
|
||||
}
|
||||
|
||||
m_neighbourhoodRadius = editor->getAgentRadius() * 20.0f;
|
||||
|
@ -52,15 +52,33 @@ enum EditorToolType
|
||||
|
||||
/// These are just poly areas to use consistent values across the editors.
|
||||
/// The use should specify these base on his needs.
|
||||
//enum EditorPolyAreas // note: original poly area's for reference.
|
||||
//{
|
||||
// EDITOR_POLYAREA_GROUND,
|
||||
// EDITOR_POLYAREA_JUMP,
|
||||
// EDITOR_POLYAREA_ROAD,
|
||||
// EDITOR_POLYAREA_DOOR,
|
||||
// EDITOR_POLYAREA_GRASS,
|
||||
// EDITOR_POLYAREA_WATER,
|
||||
//};
|
||||
|
||||
#if DT_NAVMESH_SET_VERSION >= 7
|
||||
enum EditorPolyAreas
|
||||
{
|
||||
EDITOR_POLYAREA_JUMP,
|
||||
EDITOR_POLYAREA_GROUND,
|
||||
EDITOR_POLYAREA_RESERVED,
|
||||
EDITOR_POLYAREA_DOOR, // rename to trigger
|
||||
};
|
||||
#else
|
||||
enum EditorPolyAreas
|
||||
{
|
||||
EDITOR_POLYAREA_GROUND,
|
||||
EDITOR_POLYAREA_JUMP,
|
||||
EDITOR_POLYAREA_ROAD,
|
||||
EDITOR_POLYAREA_DOOR,
|
||||
EDITOR_POLYAREA_GRASS,
|
||||
EDITOR_POLYAREA_WATER,
|
||||
};
|
||||
#endif
|
||||
|
||||
enum EditorPolyFlags
|
||||
{
|
||||
EDITOR_POLYFLAGS_WALK = 0x01, // Ability to walk (ground, grass, road)
|
||||
|
@ -287,9 +287,9 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh
|
||||
|
||||
unsigned int col;
|
||||
if (query && query->isInClosedList(base | (dtPolyRef)i))
|
||||
col = duRGBA(255,196,0,220);
|
||||
col = duRGBA(255, 196, 0, 220);
|
||||
else
|
||||
col = duDarkenCol(duTransCol(duRGBA(0,0,255,255), 220));
|
||||
col = duDarkenCol(duTransCol(dd->areaToCol(p->getArea()), 220));
|
||||
|
||||
const float* va = &tile->verts[p->verts[0]*3];
|
||||
const float* vb = &tile->verts[p->verts[1]*3];
|
||||
|
Loading…
x
Reference in New Issue
Block a user