diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-07 08:41:14 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-07 08:41:14 +0400 |
commit | 71e5edeb6a769e2fd861f5fe374e75391415402a (patch) | |
tree | 3de5b78bf14355bb00fc06383a357433c6bcadfa /source/blender/blenkernel/BKE_DerivedMesh.h | |
parent | b563870fd992ec2539a0332e024ba4eda72a6d6e (diff) |
Code cleanup: use typedefs for DerivedMesh drawing callbacks.
There are still fairly bewildering set of callbacks being tossed
around, but it's at least a little less verbose now.
Diffstat (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 8c03624dbf7..3fb245ff0fa 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -124,6 +124,14 @@ typedef enum DerivedMeshType { DM_TYPE_CCGDM } DerivedMeshType; +/* Drawing callback types */ +typedef int (*DMSetMaterial)(int mat_nr, void *attribs); +typedef int (*DMCompareDrawOptions)(void *userData, int cur_index, int next_index); +typedef void (*DMSetDrawInterpOptions)(void *userData, int index, float t); +typedef int (*DMSetDrawOptions)(void *userData, int index); +typedef int (*DMSetDrawOptionsTex)(struct MTFace *tface, int has_vcol, int matnr); +typedef int (*DMSetDrawOptionsShading)(void *userData, int index, int *drawSmooth_r); + typedef struct DerivedMesh DerivedMesh; struct DerivedMesh { /* Private DerivedMesh data, only for internal DerivedMesh use */ @@ -308,25 +316,21 @@ struct DerivedMesh { * Also called for *final* editmode DerivedMeshes */ void (*drawFacesSolid)(DerivedMesh *dm, float (*partial_redraw_planes)[4], - int fast, int (*setMaterial)(int, void *attribs)); + int fast, DMSetMaterial setMaterial); /* Draw all faces using MTFace * o Drawing options too complicated to enumerate, look at code. */ void (*drawFacesTex)(DerivedMesh *dm, - int (*setDrawOptions)(struct MTFace *tface, - int has_vcol, int matnr), - int (*compareDrawOptions)(void *userData, - int cur_index, - int next_index), - void *userData); + DMSetDrawOptionsTex setDrawOptions, + DMCompareDrawOptions compareDrawOptions, + void *userData); /* Draw all faces with GLSL materials * o setMaterial is called for every different material nr * o Only if setMaterial returns true */ - void (*drawFacesGLSL)(DerivedMesh *dm, - int (*setMaterial)(int, void *attribs)); + void (*drawFacesGLSL)(DerivedMesh *dm, DMSetMaterial setMaterial); /* Draw mapped faces (no color, or texture) * o Only if !setDrawOptions or @@ -342,23 +346,17 @@ struct DerivedMesh { * smooth shaded. */ void (*drawMappedFaces)(DerivedMesh *dm, - int (*setDrawOptions)(void *userData, int index, - int *drawSmooth_r), - int (*setMaterial)(int, void *attribs), - int (*compareDrawOptions)(void *userData, - int cur_index, - int next_index), + DMSetDrawOptionsShading setDrawOptions, + DMSetMaterial setMaterial, + DMCompareDrawOptions compareDrawOptions, void *userData, int useColors); /* Draw mapped faces using MTFace * o Drawing options too complicated to enumerate, look at code. */ void (*drawMappedFacesTex)(DerivedMesh *dm, - int (*setDrawOptions)(void *userData, - int index), - int (*compareDrawOptions)(void *userData, - int cur_index, - int next_index), + DMSetDrawOptions setDrawOptions, + DMCompareDrawOptions compareDrawOptions, void *userData); /* Draw mapped faces with GLSL materials @@ -367,8 +365,8 @@ struct DerivedMesh { * o Only if setMaterial and setDrawOptions return true */ void (*drawMappedFacesGLSL)(DerivedMesh *dm, - int (*setMaterial)(int, void *attribs), - int (*setDrawOptions)(void *userData, int index), + DMSetMaterial setMaterial, + DMSetDrawOptions setDrawOptions, void *userData); /* Draw mapped edges as lines @@ -376,7 +374,7 @@ struct DerivedMesh { * returns true */ void (*drawMappedEdges)(DerivedMesh *dm, - int (*setDrawOptions)(void *userData, int index), + DMSetDrawOptions setDrawOptions, void *userData); /* Draw mapped edges as lines with interpolation values @@ -387,11 +385,8 @@ struct DerivedMesh { * NOTE: This routine is optional! */ void (*drawMappedEdgesInterp)(DerivedMesh *dm, - int (*setDrawOptions)(void *userData, - int index), - void (*setDrawInterpOptions)(void *userData, - int index, - float t), + DMSetDrawOptions setDrawOptions, + DMSetDrawInterpOptions setDrawInterpOptions, void *userData); /* Draw all faces with materials |