mirror of
https://github.com/recastnavigation/recastnavigation.git
synced 2026-09-17 15:54:35 +00:00
Add settings storage to geometry sets
This adds the ability for geometry sets to store build settings that can be automatically applied when they are loaded. This should allow sharing of .gset files to demonstrate problems with certain settings on certain files. It also allows people to diagnose problems more easily by being able to dump their own triangle meshes and settings and load them in the demo, with all of its visualization options. .gset files can be created from the current mesh and settings by pressing the 9 key, which will generate it in the same folder as the input mesh. Also converts more of the demo to use STL.
This commit is contained in:
@@ -105,19 +105,45 @@ void Sample::handleRenderOverlay(double* /*proj*/, double* /*model*/, int* /*vie
|
||||
void Sample::handleMeshChanged(InputGeom* geom)
|
||||
{
|
||||
m_geom = geom;
|
||||
|
||||
const BuildSettings* buildSettings = geom->getBuildSettings();
|
||||
if (buildSettings)
|
||||
{
|
||||
m_cellSize = buildSettings->cellSize;
|
||||
m_cellHeight = buildSettings->cellHeight;
|
||||
m_agentHeight = buildSettings->agentHeight;
|
||||
m_agentRadius = buildSettings->agentRadius;
|
||||
m_agentMaxClimb = buildSettings->agentMaxClimb;
|
||||
m_agentMaxSlope = buildSettings->agentMaxSlope;
|
||||
m_regionMinSize = buildSettings->regionMinSize;
|
||||
m_regionMergeSize = buildSettings->regionMergeSize;
|
||||
m_edgeMaxLen = buildSettings->edgeMaxLen;
|
||||
m_edgeMaxError = buildSettings->edgeMaxError;
|
||||
m_vertsPerPoly = buildSettings->vertsPerPoly;
|
||||
m_detailSampleDist = buildSettings->detailSampleDist;
|
||||
m_detailSampleMaxError = buildSettings->detailSampleMaxError;
|
||||
m_partitionType = buildSettings->partitionType;
|
||||
}
|
||||
}
|
||||
|
||||
const float* Sample::getBoundsMin()
|
||||
void Sample::collectSettings(BuildSettings& settings)
|
||||
{
|
||||
if (!m_geom) return 0;
|
||||
return m_geom->getMeshBoundsMin();
|
||||
settings.cellSize = m_cellSize;
|
||||
settings.cellHeight = m_cellHeight;
|
||||
settings.agentHeight = m_agentHeight;
|
||||
settings.agentRadius = m_agentRadius;
|
||||
settings.agentMaxClimb = m_agentMaxClimb;
|
||||
settings.agentMaxSlope = m_agentMaxSlope;
|
||||
settings.regionMinSize = m_regionMinSize;
|
||||
settings.regionMergeSize = m_regionMergeSize;
|
||||
settings.edgeMaxLen = m_edgeMaxLen;
|
||||
settings.edgeMaxError = m_edgeMaxError;
|
||||
settings.vertsPerPoly = m_vertsPerPoly;
|
||||
settings.detailSampleDist = m_detailSampleDist;
|
||||
settings.detailSampleMaxError = m_detailSampleMaxError;
|
||||
settings.partitionType = m_partitionType;
|
||||
}
|
||||
|
||||
const float* Sample::getBoundsMax()
|
||||
{
|
||||
if (!m_geom) return 0;
|
||||
return m_geom->getMeshBoundsMax();
|
||||
}
|
||||
|
||||
void Sample::resetCommonSettings()
|
||||
{
|
||||
@@ -145,8 +171,8 @@ void Sample::handleCommonSettings()
|
||||
|
||||
if (m_geom)
|
||||
{
|
||||
const float* bmin = m_geom->getMeshBoundsMin();
|
||||
const float* bmax = m_geom->getMeshBoundsMax();
|
||||
const float* bmin = m_geom->getNavMeshBoundsMin();
|
||||
const float* bmax = m_geom->getNavMeshBoundsMax();
|
||||
int gw = 0, gh = 0;
|
||||
rcCalcGridSize(bmin, bmax, m_cellSize, &gw, &gh);
|
||||
char text[64];
|
||||
|
||||
Reference in New Issue
Block a user