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_cast.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_cast.c')
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 3f049771682..11c8ba4a9cd 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -429,22 +429,21 @@ static void cuboid_do(
}
}
-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 numVerts,
- ModifierApplyFlag UNUSED(flag))
+ int numVerts)
{
DerivedMesh *dm = NULL;
CastModifierData *cmd = (CastModifierData *)md;
- dm = get_dm(ob, NULL, derivedData, NULL, false, false);
+ dm = get_dm(ctx->object, NULL, derivedData, NULL, false, false);
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
- cuboid_do(cmd, ob, dm, vertexCos, numVerts);
+ cuboid_do(cmd, ctx->object, dm, vertexCos, numVerts);
}
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
- sphere_do(cmd, ob, dm, vertexCos, numVerts);
+ sphere_do(cmd, ctx->object, dm, vertexCos, numVerts);
}
if (dm != derivedData)
@@ -452,18 +451,18 @@ static void deformVerts(ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
}
static void deformVertsEM(
- ModifierData *md, struct Depsgraph *UNUSED(depsgraph),
- Object *ob, struct BMEditMesh *editData,
+ ModifierData *md, const ModifierEvalContext *ctx,
+ struct BMEditMesh *editData,
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
- DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
+ DerivedMesh *dm = get_dm(ctx->object, editData, derivedData, NULL, false, false);
CastModifierData *cmd = (CastModifierData *)md;
if (cmd->type == MOD_CAST_TYPE_CUBOID) {
- cuboid_do(cmd, ob, dm, vertexCos, numVerts);
+ cuboid_do(cmd, ctx->object, dm, vertexCos, numVerts);
}
else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
- sphere_do(cmd, ob, dm, vertexCos, numVerts);
+ sphere_do(cmd, ctx->object, dm, vertexCos, numVerts);
}
if (dm != derivedData)