Added lean heighfield to store minimal, easy to compress representation of the heightfield. Added temporary obstacle demo.

This commit is contained in:
Mikko Mononen
2011-01-14 10:55:37 +00:00
parent ebd5358010
commit 2f47c29336
34 changed files with 12011 additions and 35 deletions

View File

@@ -1036,18 +1036,30 @@ unsigned char* Sample_TileMesh::buildTileMesh(const int tx, const int ty, const
for (int i = 0; i < m_geom->getConvexVolumeCount(); ++i)
rcMarkConvexPolyArea(m_ctx, vols[i].verts, vols[i].nverts, vols[i].hmin, vols[i].hmax, (unsigned char)vols[i].area, *m_chf);
// Prepare for region partitioning, by calculating distance field along the walkable surface.
if (!rcBuildDistanceField(m_ctx, *m_chf))
if (m_monotonePartitioning)
{
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build distance field.");
return 0;
// Partition the walkable surface into simple regions without holes.
if (!rcBuildRegionsMonotone(m_ctx, *m_chf, m_cfg.borderSize, m_cfg.minRegionArea, m_cfg.mergeRegionArea))
{
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build regions.");
return 0;
}
}
// Partition the walkable surface into simple regions without holes.
if (!rcBuildRegions(m_ctx, *m_chf, m_cfg.borderSize, m_cfg.minRegionArea, m_cfg.mergeRegionArea))
else
{
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build regions.");
return 0;
// Prepare for region partitioning, by calculating distance field along the walkable surface.
if (!rcBuildDistanceField(m_ctx, *m_chf))
{
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build distance field.");
return 0;
}
// Partition the walkable surface into simple regions without holes.
if (!rcBuildRegions(m_ctx, *m_chf, m_cfg.borderSize, m_cfg.minRegionArea, m_cfg.mergeRegionArea))
{
m_ctx->log(RC_LOG_ERROR, "buildNavigation: Could not build regions.");
return 0;
}
}
// Create contours.