diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-19 14:40:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-19 14:40:48 +0400 |
commit | 2457d4f5abd65095ae48be937ed43d026d47124a (patch) | |
tree | 79c9b666420fa06262c90fa8f9d11ec77e285719 /source/blender/modifiers/intern/MOD_weightvgproximity.c | |
parent | 5c6ee6b523c6a53c310683a9f7fbe5d730db6122 (diff) | |
parent | 90ef435145416313596cafa6f8c4c6c6aebe4e44 (diff) |
svn merge ^/trunk/blender -r42680:42722
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgproximity.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 8b44f262e41..db561eb59a6 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -449,9 +449,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der MEM_freeN(tdw); /* Get our vertex coordinates. */ - v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos"); - for (i = 0; i < numIdx; i++) - ret->getVertCo(ret, indices[i], v_cos[i]); + { + /* XXX In some situations, this code can be up to about 50 times more performant + * than simply using getVertCo for each affected vertex... + */ + float (*tv_cos)[3] = MEM_mallocN(sizeof(float[3]) * numVerts, "WeightVGProximity Modifier, tv_cos"); + v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos"); + ret->getVertCos(ret, tv_cos); + for (i = 0; i < numIdx; i++) + copy_v3_v3(v_cos[i], tv_cos[indices[i]]); + MEM_freeN(tv_cos); + } /* Compute wanted distances. */ if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) { |