Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2018-05-01 18:33:04 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2018-05-01 19:02:17 +0300
commit334b55fd2e89d66023a499e1ce7f867d9789290d (patch)
tree3afcc711d6a9eeda85d9ae069ce1ac9cfc9fcb89 /source/blender/modifiers/intern/MOD_surface.c
parent6b9f1ffe6e56ee4d55f4cde5c724c31a3a90292b (diff)
Extract common modifier parameters into ModifierEvalContext struct
The contents of the ModifierEvalContext struct are constant while iterating over the modifier stack. The struct thus should be only created once, outside any loop over the modifiers.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_surface.c')
-rw-r--r--source/blender/modifiers/intern/MOD_surface.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index 8d6fafd5ab6..8bae5c3e6bc 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -85,11 +85,10 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
return true;
}
-static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
- Object *ob, DerivedMesh *derivedData,
+static void deformVerts(ModifierData *md, const ModifierEvalContext *ctx,
+ DerivedMesh *derivedData,
float (*vertexCos)[3],
- int UNUSED(numVerts),
- ModifierApplyFlag UNUSED(flag))
+ int UNUSED(numVerts))
{
SurfaceModifierData *surmd = (SurfaceModifierData *) md;
@@ -98,9 +97,9 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
/* if possible use/create DerivedMesh */
if (derivedData) surmd->dm = CDDM_copy(derivedData);
- else surmd->dm = get_dm(ob, NULL, NULL, NULL, false, false);
+ else surmd->dm = get_dm(ctx->object, NULL, NULL, NULL, false, false);
- if (!ob->pd) {
+ if (!ctx->object->pd) {
printf("SurfaceModifier deformVerts: Should not happen!\n");
return;
}
@@ -141,7 +140,7 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
/* convert to global coordinates and calculate velocity */
for (i = 0, x = surmd->x, v = surmd->v; i < numverts; i++, x++, v++) {
vec = CDDM_get_vert(surmd->dm, i)->co;
- mul_m4_v3(ob->obmat, vec);
+ mul_m4_v3(ctx->object->obmat, vec);
if (init)
v->co[0] = v->co[1] = v->co[2] = 0.0f;