mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast editor cleanup and improvements
* Removed Samples button and dialogue. * Removed SoloMesh. * Removed TempObstacles. * Limit 'Verts Per Poly' to 6 (DT_VERTS_PER_POLYGON). * Moved hulldef constant and handler to TileMesh. * Set m_tileSize based on hull (small = 32, med_short = 32, medium = 32, large = 64, extra_large = 64).
This commit is contained in:
parent
112a530d5a
commit
ba97662c99
@ -178,25 +178,8 @@ void Sample::resetCommonSettings()
|
|||||||
m_partitionType = SAMPLE_PARTITION_WATERSHED;
|
m_partitionType = SAMPLE_PARTITION_WATERSHED;
|
||||||
m_reachabilityTableCount = 4;
|
m_reachabilityTableCount = 4;
|
||||||
}
|
}
|
||||||
const hulldef hulls[5] = {
|
|
||||||
{ "small", 8, 72 * 0.5, 45, 512.0f },
|
|
||||||
{ "med_short", 20, 72 * 0.5, 50, 512.0f },
|
|
||||||
{ "medium", 48, 150 * 0.5, 55, 512.0f },
|
|
||||||
{ "large", 60, 235 * 0.5, 60, 960.0f },
|
|
||||||
{ "extra_large", 88, 235 * 0.5, 65, 960.0f },
|
|
||||||
};
|
|
||||||
void Sample::handleCommonSettings()
|
void Sample::handleCommonSettings()
|
||||||
{
|
{
|
||||||
for (const hulldef& h : hulls)
|
|
||||||
{
|
|
||||||
if (imguiButton(h.name))
|
|
||||||
{
|
|
||||||
m_agentRadius = h.radius;
|
|
||||||
m_agentMaxClimb = h.climb_height;
|
|
||||||
m_agentHeight = h.height;
|
|
||||||
m_navmeshName = h.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
imguiLabel("Rasterization");
|
imguiLabel("Rasterization");
|
||||||
imguiSlider("Cell Size", &m_cellSize, 0.1f, 100.0f, 0.01f);
|
imguiSlider("Cell Size", &m_cellSize, 0.1f, 100.0f, 0.01f);
|
||||||
imguiSlider("Cell Height", &m_cellHeight, 0.1f, 100.0f, 0.01f);
|
imguiSlider("Cell Height", &m_cellHeight, 0.1f, 100.0f, 0.01f);
|
||||||
@ -246,7 +229,7 @@ void Sample::handleCommonSettings()
|
|||||||
imguiLabel("Polygonization");
|
imguiLabel("Polygonization");
|
||||||
imguiSlider("Max Edge Length", &m_edgeMaxLen, 0.0f, 50.0f, 1.0f);
|
imguiSlider("Max Edge Length", &m_edgeMaxLen, 0.0f, 50.0f, 1.0f);
|
||||||
imguiSlider("Max Edge Error", &m_edgeMaxError, 0.1f, 3.0f, 0.1f);
|
imguiSlider("Max Edge Error", &m_edgeMaxError, 0.1f, 3.0f, 0.1f);
|
||||||
imguiSlider("Verts Per Poly", &m_vertsPerPoly, 3.0f, 12.0f, 1.0f);
|
imguiSlider("Verts Per Poly", &m_vertsPerPoly, 3.0f, 6.0f, 1.0f);
|
||||||
|
|
||||||
imguiSeparator();
|
imguiSeparator();
|
||||||
imguiLabel("Detail Mesh");
|
imguiLabel("Detail Mesh");
|
||||||
|
@ -207,9 +207,26 @@ void Sample_TileMesh::cleanup()
|
|||||||
rcFreePolyMeshDetail(m_dmesh);
|
rcFreePolyMeshDetail(m_dmesh);
|
||||||
m_dmesh = 0;
|
m_dmesh = 0;
|
||||||
}
|
}
|
||||||
|
const hulldef hulls[5] = {
|
||||||
|
{ "small", 8, 72 * 0.5, 45, 32.0f },
|
||||||
|
{ "med_short", 20, 72 * 0.5, 50, 32.0f },
|
||||||
|
{ "medium", 48, 150 * 0.5, 55, 32.0f },
|
||||||
|
{ "large", 60, 235 * 0.5, 60, 64.0f },
|
||||||
|
{ "extra_large", 88, 235 * 0.5, 65, 64.0f },
|
||||||
|
};
|
||||||
void Sample_TileMesh::handleSettings()
|
void Sample_TileMesh::handleSettings()
|
||||||
{
|
{
|
||||||
|
for (const hulldef& h : hulls)
|
||||||
|
{
|
||||||
|
if (imguiButton(h.name))
|
||||||
|
{
|
||||||
|
m_agentRadius = h.radius;
|
||||||
|
m_agentMaxClimb = h.climb_height;
|
||||||
|
m_agentHeight = h.height;
|
||||||
|
m_navmeshName = h.name;
|
||||||
|
m_tileSize = h.tile_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
Sample::handleCommonSettings();
|
Sample::handleCommonSettings();
|
||||||
|
|
||||||
if (imguiCheck("Keep Itermediate Results", m_keepInterResults))
|
if (imguiCheck("Keep Itermediate Results", m_keepInterResults))
|
||||||
@ -776,6 +793,7 @@ void Sample_TileMesh::buildAllHulls()
|
|||||||
m_agentMaxClimb = h.climb_height;
|
m_agentMaxClimb = h.climb_height;
|
||||||
m_agentHeight = h.height;
|
m_agentHeight = h.height;
|
||||||
m_navmeshName = h.name;
|
m_navmeshName = h.name;
|
||||||
|
m_tileSize = h.tile_size;
|
||||||
|
|
||||||
handleSettings();
|
handleSettings();
|
||||||
handleBuild();
|
handleBuild();
|
||||||
|
@ -135,7 +135,7 @@ protected:
|
|||||||
float m_detailSampleMaxError;
|
float m_detailSampleMaxError;
|
||||||
int m_partitionType;
|
int m_partitionType;
|
||||||
int m_reachabilityTableCount;
|
int m_reachabilityTableCount;
|
||||||
const char* m_navmeshName="unk";
|
const char* m_navmeshName = "unnamed";
|
||||||
|
|
||||||
SampleTool* m_tool;
|
SampleTool* m_tool;
|
||||||
SampleToolState* m_toolStates[MAX_TOOLS];
|
SampleToolState* m_toolStates[MAX_TOOLS];
|
||||||
|
@ -23,9 +23,7 @@
|
|||||||
#include "NavEditor/Include/InputGeom.h"
|
#include "NavEditor/Include/InputGeom.h"
|
||||||
#include "NavEditor/Include/TestCase.h"
|
#include "NavEditor/Include/TestCase.h"
|
||||||
#include "NavEditor/Include/Filelist.h"
|
#include "NavEditor/Include/Filelist.h"
|
||||||
#include "NavEditor/Include/Sample_SoloMesh.h"
|
|
||||||
#include "NavEditor/Include/Sample_TileMesh.h"
|
#include "NavEditor/Include/Sample_TileMesh.h"
|
||||||
#include "NavEditor/Include/Sample_TempObstacles.h"
|
|
||||||
#include "NavEditor/Include/Sample_Debug.h"
|
#include "NavEditor/Include/Sample_Debug.h"
|
||||||
#include "NavEditor/include/DroidSans.h"
|
#include "NavEditor/include/DroidSans.h"
|
||||||
|
|
||||||
@ -37,17 +35,8 @@ struct SampleItem
|
|||||||
Sample* (*create)();
|
Sample* (*create)();
|
||||||
const string name;
|
const string name;
|
||||||
};
|
};
|
||||||
Sample* createSolo() { return new Sample_SoloMesh(); }
|
|
||||||
Sample* createTile() { return new Sample_TileMesh(); }
|
Sample* createTile() { return new Sample_TileMesh(); }
|
||||||
Sample* createTempObstacle() { return new Sample_TempObstacles(); }
|
|
||||||
Sample* createDebug() { return new Sample_Debug(); }
|
Sample* createDebug() { return new Sample_Debug(); }
|
||||||
static SampleItem g_samples[] =
|
|
||||||
{
|
|
||||||
{ createSolo, "Solo Mesh" },
|
|
||||||
{ createTile, "Tile Mesh" },
|
|
||||||
{ createTempObstacle, "Temp Obstacles" },
|
|
||||||
};
|
|
||||||
static const int g_nsamples = sizeof(g_samples) / sizeof(SampleItem);
|
|
||||||
|
|
||||||
void save_ply(std::vector<float>& pts,std::vector<int>& colors,rcIntArray& tris)
|
void save_ply(std::vector<float>& pts,std::vector<int>& colors,rcIntArray& tris)
|
||||||
{
|
{
|
||||||
@ -395,7 +384,6 @@ int not_main(int argc, char** argv)
|
|||||||
float camr = 1000;
|
float camr = 1000;
|
||||||
float origCameraEulers[] = {0, 0}; // Used to compute rotational changes across frames.
|
float origCameraEulers[] = {0, 0}; // Used to compute rotational changes across frames.
|
||||||
|
|
||||||
string sampleName = "Choose Sample...";
|
|
||||||
vector<string> files;
|
vector<string> files;
|
||||||
const string meshesFolder = "Levels";
|
const string meshesFolder = "Levels";
|
||||||
string meshName = "Choose Level...";
|
string meshName = "Choose Level...";
|
||||||
@ -411,8 +399,7 @@ int not_main(int argc, char** argv)
|
|||||||
|
|
||||||
//Load tiled sample
|
//Load tiled sample
|
||||||
|
|
||||||
sample = g_samples[1].create();
|
sample = createTile();
|
||||||
sampleName = g_samples[1].name;
|
|
||||||
sample->setContext(&ctx);
|
sample->setContext(&ctx);
|
||||||
if (geom)
|
if (geom)
|
||||||
{
|
{
|
||||||
@ -828,22 +815,6 @@ int not_main(int argc, char** argv)
|
|||||||
if (imguiCheck("Show Tools", showTools))
|
if (imguiCheck("Show Tools", showTools))
|
||||||
showTools = !showTools;
|
showTools = !showTools;
|
||||||
|
|
||||||
imguiSeparator();
|
|
||||||
imguiLabel("Sample");
|
|
||||||
if (imguiButton(sampleName.c_str()))
|
|
||||||
{
|
|
||||||
if (showSample)
|
|
||||||
{
|
|
||||||
showSample = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
showSample = true;
|
|
||||||
showLevels = false;
|
|
||||||
showTestCases = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
imguiSeparator();
|
imguiSeparator();
|
||||||
imguiLabel("Input Level");
|
imguiLabel("Input Level");
|
||||||
|
|
||||||
@ -940,34 +911,6 @@ int not_main(int argc, char** argv)
|
|||||||
if (showSample)
|
if (showSample)
|
||||||
{
|
{
|
||||||
static int levelScroll = 0;
|
static int levelScroll = 0;
|
||||||
if (imguiBeginScrollArea("Choose Sample", width-10-250-10-200, height-10-250, 200, 250, &levelScroll))
|
|
||||||
mouseOverMenu = true;
|
|
||||||
|
|
||||||
Sample* newSample = 0;
|
|
||||||
for (int i = 0; i < g_nsamples; ++i)
|
|
||||||
{
|
|
||||||
if (imguiItem(g_samples[i].name.c_str()))
|
|
||||||
{
|
|
||||||
newSample = g_samples[i].create();
|
|
||||||
if (newSample)
|
|
||||||
{
|
|
||||||
sampleName = g_samples[i].name;
|
|
||||||
//newSample->is_tf2 = &tf2_transforms;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newSample)
|
|
||||||
{
|
|
||||||
delete sample;
|
|
||||||
sample = newSample;
|
|
||||||
sample->setContext(&ctx);
|
|
||||||
if (geom)
|
|
||||||
{
|
|
||||||
sample->handleMeshChanged(geom);
|
|
||||||
}
|
|
||||||
showSample = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (geom || sample)
|
if (geom || sample)
|
||||||
{
|
{
|
||||||
const float* bmin = 0;
|
const float* bmin = 0;
|
||||||
@ -1085,24 +1028,6 @@ int not_main(int argc, char** argv)
|
|||||||
test = 0;
|
test = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create sample
|
|
||||||
Sample* newSample = 0;
|
|
||||||
for (int i = 0; i < g_nsamples; ++i)
|
|
||||||
{
|
|
||||||
if (g_samples[i].name == test->getSampleName())
|
|
||||||
{
|
|
||||||
newSample = g_samples[i].create();
|
|
||||||
if (newSample)
|
|
||||||
{
|
|
||||||
sampleName = g_samples[i].name;
|
|
||||||
//newSample->is_tf2 = &tf2_transforms;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete sample;
|
|
||||||
sample = newSample;
|
|
||||||
|
|
||||||
if (sample)
|
if (sample)
|
||||||
{
|
{
|
||||||
sample->setContext(&ctx);
|
sample->setContext(&ctx);
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
<ClInclude Include="..\naveditor\include\Sample.h" />
|
<ClInclude Include="..\naveditor\include\Sample.h" />
|
||||||
<ClInclude Include="..\naveditor\include\SampleInterfaces.h" />
|
<ClInclude Include="..\naveditor\include\SampleInterfaces.h" />
|
||||||
<ClInclude Include="..\naveditor\include\Sample_Debug.h" />
|
<ClInclude Include="..\naveditor\include\Sample_Debug.h" />
|
||||||
<ClInclude Include="..\naveditor\include\Sample_SoloMesh.h" />
|
|
||||||
<ClInclude Include="..\naveditor\include\Sample_TempObstacles.h" />
|
|
||||||
<ClInclude Include="..\naveditor\include\Sample_TileMesh.h" />
|
<ClInclude Include="..\naveditor\include\Sample_TileMesh.h" />
|
||||||
<ClInclude Include="..\naveditor\include\TestCase.h" />
|
<ClInclude Include="..\naveditor\include\TestCase.h" />
|
||||||
<ClInclude Include="..\naveditor\include\ValueHistory.h" />
|
<ClInclude Include="..\naveditor\include\ValueHistory.h" />
|
||||||
@ -58,8 +56,6 @@
|
|||||||
<ClCompile Include="..\naveditor\Sample.cpp" />
|
<ClCompile Include="..\naveditor\Sample.cpp" />
|
||||||
<ClCompile Include="..\naveditor\SampleInterfaces.cpp" />
|
<ClCompile Include="..\naveditor\SampleInterfaces.cpp" />
|
||||||
<ClCompile Include="..\naveditor\Sample_Debug.cpp" />
|
<ClCompile Include="..\naveditor\Sample_Debug.cpp" />
|
||||||
<ClCompile Include="..\naveditor\Sample_SoloMesh.cpp" />
|
|
||||||
<ClCompile Include="..\naveditor\Sample_TempObstacles.cpp" />
|
|
||||||
<ClCompile Include="..\naveditor\Sample_TileMesh.cpp" />
|
<ClCompile Include="..\naveditor\Sample_TileMesh.cpp" />
|
||||||
<ClCompile Include="..\naveditor\TestCase.cpp" />
|
<ClCompile Include="..\naveditor\TestCase.cpp" />
|
||||||
<ClCompile Include="..\naveditor\ValueHistory.cpp" />
|
<ClCompile Include="..\naveditor\ValueHistory.cpp" />
|
||||||
|
@ -57,12 +57,6 @@
|
|||||||
<ClInclude Include="..\naveditor\include\InputGeom.h">
|
<ClInclude Include="..\naveditor\include\InputGeom.h">
|
||||||
<Filter>builder\include</Filter>
|
<Filter>builder\include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\naveditor\include\Sample_SoloMesh.h">
|
|
||||||
<Filter>builder\include</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\naveditor\include\Sample_TempObstacles.h">
|
|
||||||
<Filter>builder\include</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\naveditor\include\Sample_TileMesh.h">
|
<ClInclude Include="..\naveditor\include\Sample_TileMesh.h">
|
||||||
<Filter>builder\include</Filter>
|
<Filter>builder\include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -176,12 +170,6 @@
|
|||||||
<ClCompile Include="..\naveditor\ValueHistory.cpp">
|
<ClCompile Include="..\naveditor\ValueHistory.cpp">
|
||||||
<Filter>utils</Filter>
|
<Filter>utils</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\naveditor\Sample_SoloMesh.cpp">
|
|
||||||
<Filter>builder</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\naveditor\Sample_TempObstacles.cpp">
|
|
||||||
<Filter>builder</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\naveditor\Sample_TileMesh.cpp">
|
<ClCompile Include="..\naveditor\Sample_TileMesh.cpp">
|
||||||
<Filter>builder</Filter>
|
<Filter>builder</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user