diff options
author | Daniel Dunbar <daniel@zuster.org> | 2005-08-20 07:08:23 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2005-08-20 07:08:23 +0400 |
commit | a30740c1964059e1e6d3ca652da324ff0d505a1a (patch) | |
tree | e0104696db9dd12419f4efd4e456483997cab393 /source/blender/blenkernel/BKE_DerivedMesh.h | |
parent | d81a5abf3252aff1f09c40bd5046700ddfe6676e (diff) |
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
Diffstat (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 99d438743fa..9c0d87b0254 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -48,9 +48,6 @@ struct MVert; struct Object; struct EditMesh; -struct EditVert; -struct EditEdge; -struct EditFace; struct DispListMesh; struct ModifierData; @@ -68,19 +65,19 @@ struct DerivedMesh { * coordinate and normal. For historical reasons the normal can be * passed as a float or short array, only one should be non-NULL. */ - void (*foreachMappedVertEM)(DerivedMesh *dm, void (*func)(void *userData, struct EditVert *vert, float *co, float *no_f, short *no_s), void *userData); + void (*foreachMappedVert)(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no_f, short *no_s), void *userData); /* Iterate over each mapped vertex in the derived mesh, calling the * given function with the original vert and the mapped edge's new * coordinates. */ - void (*foreachMappedEdgeEM)(DerivedMesh *dm, void (*func)(void *userData, struct EditEdge *edge, float *v0co, float *v1co), void *userData); + void (*foreachMappedEdge)(DerivedMesh *dm, void (*func)(void *userData, int index, float *v0co, float *v1co), void *userData); /* Iterate over each mapped face in the derived mesh, calling the * given function with the original face and the mapped face's (or * faces') center and normal. */ - void (*foreachMappedFaceCenterEM)(DerivedMesh *dm, void (*func)(void *userData, struct EditFace *face, float *cent, float *no), void *userData); + void (*foreachMappedFaceCenter)(DerivedMesh *dm, void (*func)(void *userData, int index, float *cent, float *no), void *userData); /* Convert to new DispListMesh, should be free'd by caller. * @@ -91,18 +88,6 @@ struct DerivedMesh { */ struct DispListMesh* (*convertToDispListMesh)(DerivedMesh *dm, int allowShared); - /* Convert to new DispListMesh, should be free'd by caller. - * - * Additionally, allocate and return map arrays. Each map array should be - * have a length corresponding to the returned DLMs totvert, totedge, and - * totface fields respectively. - * - * Each index in the array should give the EditMesh element from which the - * element at the same index in the DLMs vert, edge, or face array was - * derived (which may be null). - */ - struct DispListMesh* (*convertToDispListMeshMapped)(DerivedMesh *dm, int allowShared, struct EditVert ***vertMap_r, struct EditEdge ***edgeMap_r, struct EditFace ***faceMap_r); - /* Iterate over all vertex points, calling DO_MINMAX with given args. * * Also called in Editmode @@ -158,33 +143,40 @@ struct DerivedMesh { /* Draw all faces uses TFace * o Drawing options too complicated to enumerate, look at code. */ - void (*drawFacesTex)(DerivedMesh *dm, int (*setDrawParams)(TFace *tf, int matnr)); + void (*drawFacesTex)(DerivedMesh *dm, int (*setDrawOptions)(TFace *tf, int matnr)); + + /* Draw mapped faces (no color, or texture) + * o Only if !setDrawOptions or setDrawOptions(userData, mapped-face-index, drawSmooth_r) returns true + * + * If drawSmooth is set to true then vertex normals should be set and glShadeModel + * called with GL_SMOOTH. Otherwise the face normal should be set and glShadeModel + * called with GL_FLAT. + * + * The setDrawOptions is allowed to not set drawSmooth (for example, when lighting + * is disabled), in which case the implementation should draw as smooth shaded. + */ + void (*drawMappedFaces)(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData); /* Draw mapped edges as lines * o Only if !setDrawOptions or setDrawOptions(userData, mapped-edge) returns true */ - void (*drawMappedEdgesEM)(DerivedMesh *dm, int (*setDrawOptions)(void *userData, struct EditEdge *eed), void *userData); + void (*drawMappedEdges)(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData); /* Draw mapped edges as lines with interpolation values * o Only if !setDrawOptions or setDrawOptions(userData, mapped-edge, mapped-v0, mapped-v1, t) returns true * * NOTE: This routine is optional! */ - void (*drawMappedEdgesInterpEM)(DerivedMesh *dm, - int (*setDrawOptions)(void *userData, struct EditEdge *eed), - void (*setDrawInterpOptions)(void *userData, struct EditEdge *eed, float t), + void (*drawMappedEdgesInterp)(DerivedMesh *dm, + int (*setDrawOptions)(void *userData, int index), + void (*setDrawInterpOptions)(void *userData, int index, float t), void *userData); - /* Draw all faces - * o Only if !setDrawOptions or setDrawOptions(userData, mapped-face) returns true - */ - void (*drawMappedFacesEM)(DerivedMesh *dm, int (*setDrawOptions)(void *userData, struct EditFace *efa), void *userData); - void (*release)(DerivedMesh *dm); }; /* Internal function, just temporarily exposed */ -DerivedMesh *derivedmesh_from_displistmesh(struct DispListMesh *dlm, float (*vertexCos)[3], struct EditVert **vertMap, struct EditEdge **edgeMap, struct EditFace **faceMap); +DerivedMesh *derivedmesh_from_displistmesh(struct DispListMesh *dlm, float (*vertexCos)[3]); DerivedMesh *mesh_get_derived_final(struct Object *ob, int *needsFree_r); DerivedMesh *mesh_get_derived_deform(struct Object *ob, int *needsFree_r); |