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_modifier.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_modifier.h')
-rw-r--r-- | source/blender/blenkernel/BKE_modifier.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index a4c050429e5..586ee4e8552 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -33,12 +33,15 @@ #ifndef BKE_MODIFIER_H #define BKE_MODIFIER_H +#include "BKE_customdata.h" + struct EditMesh; struct DerivedMesh; struct DagForest; struct DagNode; struct Object; struct ListBase; +struct LinkNode; struct bArmature; typedef enum { @@ -102,7 +105,6 @@ typedef struct ModifierTypeInfo { */ void (*copyData)(ModifierData *md, ModifierData *target); - /********************* Deform modifier functions *********************/ /* Only for deform types, should apply the deformation @@ -170,6 +172,24 @@ typedef struct ModifierTypeInfo { */ void (*initData)(ModifierData *md); + /* Should return a CustomDataMask indicating what data this + * modifier needs. If (mask & (1 << (layer type))) != 0, this modifier + * needs that custom data layer. This function's return value can change + * depending on the modifier's settings. + * + * Note that this means extra data (e.g. vertex groups) - it is assumed + * that all modifiers need mesh data and deform modifiers need vertex + * coordinates. + * + * Note that this limits the number of custom data layer types to 32. + * + * If this function is not present or it returns 0, it is assumed that + * no extra data is needed. + * + * This function is optional. + */ + CustomDataMask (*requiredDataMask)(ModifierData *md); + /* Free internal modifier data variables, this function should * not free the md variable itself. * @@ -253,6 +273,13 @@ struct Object *modifiers_isDeformedByArmature(struct Object *ob); int modifiers_usesArmature(struct Object *ob, struct bArmature *arm); int modifiers_isDeformed(struct Object *ob); +/* Calculates and returns a linked list of CustomDataMasks indicating the + * data required by each modifier in the stack pointed to by md for correct + * evaluation, assuming the data indicated by dataMask is required at the + * end of the stack. + */ +struct LinkNode *modifiers_calcDataMasks(ModifierData *md, + CustomDataMask dataMask); ModifierData *modifiers_getVirtualModifierList(struct Object *ob); #endif |