From dcacbc25bc0fb850b56673f7f167aa623d1e2fb5 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Thu, 10 May 2012 20:32:41 +0000 Subject: Modify CCGSubsurf to subdivide an arbitrary number of (float) layers. The layout of vert data in CCGSubSurf is almost the same; previously it was three floats (for xyz coordinate) optionally followed by three floats for the normal. The only change is that the first three floats can now be any number of floats. * _getSubSurf takes a numLayers parameter to set the number of layers, stored in CCGMeshIFC.numLayers. * All calls to _getSubSurf currently have numLayers set to 3, except for UV subsurf, where it is reduced to 2 (with a corresponding change when reading the results out to use float (*)[2] rather than float (*)[3].) * The various VertData* macros in CCGSubSurf.c are now functions that take a CCGSubSurf pointer, which provides access to CCGMeshIFC, which has numLayers. * Add ccgSubSurf_setNumLayers() to the API. Only changes the number of layers that get subdivided, doesn't change the amount of memory allocated. So if space for N layers is allocated, it's safe to set the number of layers to less than N, but not more. * The rest of the changes are just adding the 'ss' parameter. --- source/blender/blenkernel/intern/CCGSubSurf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/CCGSubSurf.h') diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h index e73ef6b543e..76e1911b0a5 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.h +++ b/source/blender/blenkernel/intern/CCGSubSurf.h @@ -15,7 +15,7 @@ typedef struct CCGFace CCGFace; typedef struct CCGMeshIFC { int vertUserSize, edgeUserSize, faceUserSize; - + int numLayers; int vertDataSize; } CCGMeshIFC; @@ -77,6 +77,8 @@ CCGError ccgSubSurf_setUseAgeCounts (CCGSubSurf *ss, int useAgeCounts, int ver CCGError ccgSubSurf_setCalcVertexNormals (CCGSubSurf *ss, int useVertNormals, int normalDataOffset); +void ccgSubSurf_setNumLayers (CCGSubSurf *ss, int numLayers); + /***/ int ccgSubSurf_getNumVerts (const CCGSubSurf *ss); -- cgit v1.2.3