diff options
author | Ben Batt <benbatt@gmail.com> | 2006-12-05 20:42:03 +0300 |
---|---|---|
committer | Ben Batt <benbatt@gmail.com> | 2006-12-05 20:42:03 +0300 |
commit | 4f8079d49cc0cc037ef429123ee6faf031b5c333 (patch) | |
tree | 027e9ed89fd694d45827b4a46431976ab59fa755 /source/blender/blenkernel/BKE_DerivedMesh.h | |
parent | 869eeadeff956f88f48a3b26ea69d0c2938233a3 (diff) |
Modifier Stack: Limit calculation to required data.
This commit upgrades the modifier stack to only calculate the data which is
needed, either by modifiers further down the stack or by other functions at
the end of the stack (e.g. drawing functions).
This speeds up modifier stack recalculation, especially where vertex
groups and UV coordinates are concerned. For example, a mesh with an Armature
modifier followed by a Subsurf modifier would previously have required the
Subsurf modifier to interpolate all the vertex groups in the mesh, slowing
down modifier calculations considerably. With this update, vertex group data
is not propagated beyond the Armature modifier, so calculations are faster.
Note that this depends on the order of modifiers in the stack. If the Armature
and Subsurf modifiers were swapped in the above example, the Subsurf modifier
would have to interpolate vertex groups, as they are needed by the Armature
modifier.
Diffstat (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 8a72b9ae2a9..f7c771394b8 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -46,6 +46,7 @@ */ #include "DNA_customdata_types.h" +#include "BKE_customdata.h" struct MVert; struct MEdge; @@ -295,6 +296,12 @@ int DM_release(DerivedMesh *dm); */ void DM_to_mesh(DerivedMesh *dm, struct Mesh *me); +/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is + * zero for the layer type, so only layer types specified by the mask + * will be copied + */ +void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask); + /* adds a vertex/edge/face custom data layer to a DerivedMesh, optionally * backed by an external data array * if layer != NULL, it is used as the layer data array, otherwise new memory @@ -337,7 +344,7 @@ void DM_set_face_data(struct DerivedMesh *dm, int index, int type, void *data); /* custom data copy functions * copy count elements from source_index in source to dest_index in dest - * these copy all layers for which the LAYERFLAG_NOCOPY flag is not set + * these copy all layers for which the CD_FLAG_NOCOPY flag is not set */ void DM_copy_vert_data(struct DerivedMesh *source, struct DerivedMesh *dest, int source_index, int dest_index, int count); @@ -396,21 +403,34 @@ void DM_swap_face_data(struct DerivedMesh *dm, int index, int *corner_indices); float *mesh_get_mapped_verts_nors(struct Object *ob); /* */ -DerivedMesh *mesh_get_derived_final(struct Object *ob); -DerivedMesh *mesh_get_derived_deform(struct Object *ob); +DerivedMesh *mesh_get_derived_final(struct Object *ob, + CustomDataMask dataMask); +DerivedMesh *mesh_get_derived_deform(struct Object *ob, + CustomDataMask dataMask); DerivedMesh *mesh_create_derived_for_modifier(struct Object *ob, struct ModifierData *md); -DerivedMesh *mesh_create_derived_render(struct Object *ob); -DerivedMesh *mesh_create_derived_view(struct Object *ob); /* same as above but wont use render settings */ -DerivedMesh *mesh_create_derived_no_deform(struct Object *ob, float (*vertCos)[3]); -DerivedMesh *mesh_create_derived_no_deform_render(struct Object *ob, float (*vertCos)[3]); +DerivedMesh *mesh_create_derived_render(struct Object *ob, + CustomDataMask dataMask); +/* same as above but wont use render settings */ +DerivedMesh *mesh_create_derived_view(struct Object *ob, + CustomDataMask dataMask); +DerivedMesh *mesh_create_derived_no_deform(struct Object *ob, + float (*vertCos)[3], + CustomDataMask dataMask); +DerivedMesh *mesh_create_derived_no_deform_render(struct Object *ob, + float (*vertCos)[3], + CustomDataMask dataMask); DerivedMesh *editmesh_get_derived_base(void); -DerivedMesh *editmesh_get_derived_cage(void); -DerivedMesh *editmesh_get_derived_cage_and_final(DerivedMesh **final_r); +DerivedMesh *editmesh_get_derived_cage(CustomDataMask dataMask); +DerivedMesh *editmesh_get_derived_cage_and_final(DerivedMesh **final_r, + CustomDataMask dataMask); void weight_to_rgb(float input, float *fr, float *fg, float *fb); +/* determines required DerivedMesh data according to view and edit modes */ +CustomDataMask get_viewedit_datamask(); + #endif |