Implement C-API accessor to evaluator topology

This way external application might check whether it need to
re-create evaluator from scratch or it might re-use existing
one without storing extra data from it's side.

TODO: Tags are still not accessible via C-API, it's marked as
to be solved later when it becomes more clear what is the best
way to expose them and when there'll be a real application to
test the tags.
This commit is contained in:
Sergey Sharybin 2014-05-10 17:07:42 +02:00
parent 727077a8e0
commit 8b627c1c73
2 changed files with 32 additions and 1 deletions

View File

@ -146,4 +146,23 @@ void openSubdiv_evaluateLimit(
evaluation_descr->evaluator.EvaluateLimit(coords, P, dPdu, dPdv);
}
void openSubdiv_getEvaluatorTopology(
struct OpenSubdiv_EvaluatorDescr *evaluation_descr,
int *numVertices,
int *refinementLevel,
int *numIndices,
int **indices,
int *numNVerts,
int **nverts)
{
// TODO(sergey): Tag data is also need to do the full comparison,
// but it's not that clear how to pass it via C-API and no real
// application to test this yet.
*numVertices = evaluation_descr->topology.numVertices;
*refinementLevel = evaluation_descr->topology.refinementLevel;
*numIndices = evaluation_descr->topology.indices.size();
*indices = &evaluation_descr->topology.indices[0];
*numNVerts = evaluation_descr->topology.nverts.size();
*nverts = &evaluation_descr->topology.nverts[0];
}

View File

@ -58,6 +58,18 @@ void openSubdiv_evaluateLimit(
/* Get topology stored in the evaluator descriptor in order to be able */
/* to check whether it still matches the mesh topology one is going to */
/* evaluate. */
void openSubdiv_getEvaluatorTopology(
struct OpenSubdiv_EvaluatorDescr *evaluation_descr,
int *numVertices,
int *refinementLevel,
int *numIndices,
int **indices,
int *numNVerts,
int **nverts);
#ifdef __cplusplus
}
#endif