Refactored rcBuildContext to be more customization friendly, changed name to rcContext.

This commit is contained in:
Mikko Mononen
2010-08-24 17:53:38 +00:00
parent 02b189a7cb
commit 5abddbf0cd
28 changed files with 3268 additions and 1444 deletions
+8 -13
View File
@@ -483,7 +483,7 @@ static void pushBack(int v, int* arr, int& an)
an++;
}
static bool canRemoveVertex(rcBuildContext* ctx, rcPolyMesh& mesh, const unsigned short rem)
static bool canRemoveVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned short rem)
{
const int nvp = mesh.nvp;
@@ -585,7 +585,7 @@ static bool canRemoveVertex(rcBuildContext* ctx, rcPolyMesh& mesh, const unsigne
return true;
}
static bool removeVertex(rcBuildContext* ctx, rcPolyMesh& mesh, const unsigned short rem, const int maxTris)
static bool removeVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned short rem, const int maxTris)
{
const int nvp = mesh.nvp;
@@ -893,11 +893,11 @@ static bool removeVertex(rcBuildContext* ctx, rcPolyMesh& mesh, const unsigned s
}
bool rcBuildPolyMesh(rcBuildContext* ctx, rcContourSet& cset, int nvp, rcPolyMesh& mesh)
bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, int nvp, rcPolyMesh& mesh)
{
rcAssert(ctx);
rcTimeVal startTime = ctx->getTime();
ctx->startTimer(RC_TIMER_BUILD_POLYMESH);
rcVcopy(mesh.bmin, cset.bmin);
rcVcopy(mesh.bmax, cset.bmax);
@@ -1163,21 +1163,19 @@ bool rcBuildPolyMesh(rcBuildContext* ctx, rcContourSet& cset, int nvp, rcPolyMes
}
memset(mesh.flags, 0, sizeof(unsigned short) * mesh.npolys);
rcTimeVal endTime = ctx->getTime();
ctx->reportBuildTime(RC_TIME_BUILD_POLYMESH, ctx->getDeltaTimeUsec(startTime, endTime));
ctx->stopTimer(RC_TIMER_BUILD_POLYMESH);
return true;
}
bool rcMergePolyMeshes(rcBuildContext* ctx, rcPolyMesh** meshes, const int nmeshes, rcPolyMesh& mesh)
bool rcMergePolyMeshes(rcContext* ctx, rcPolyMesh** meshes, const int nmeshes, rcPolyMesh& mesh)
{
rcAssert(ctx);
if (!nmeshes || !meshes)
return true;
rcTimeVal startTime = ctx->getTime();
ctx->startTimer(RC_TIMER_MERGE_POLYMESH);
mesh.nvp = meshes[0]->nvp;
mesh.cs = meshes[0]->cs;
@@ -1300,10 +1298,7 @@ bool rcMergePolyMeshes(rcBuildContext* ctx, rcPolyMesh** meshes, const int nmesh
return false;
}
rcTimeVal endTime = ctx->getTime();
ctx->reportBuildTime(RC_TIME_MERGE_POLYMESH, ctx->getDeltaTimeUsec(startTime, endTime));
ctx->stopTimer(RC_TIMER_MERGE_POLYMESH);
return true;
}