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_particleinstance.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_particleinstance.c')
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 399a02bd69b..56f6fa57b51 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -202,9 +202,8 @@ static void store_float_in_vcol(MLoopCol *vcol, float float_value)
vcol->a = 1.0f;
}
-static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
- Object *ob, DerivedMesh *derivedData,
- ModifierApplyFlag UNUSED(flag))
+static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
+ DerivedMesh *derivedData)
{
DerivedMesh *dm = derivedData, *result;
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;
@@ -217,7 +216,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
int totvert, totpoly, totloop /* , totedge */;
int maxvert, maxpoly, maxloop, part_end = 0, part_start;
int k, p, p_skip;
- short track = ob->trackflag % 3, trackneg, axis = pimd->axis;
+ short track = ctx->object->trackflag % 3, trackneg, axis = pimd->axis;
float max_co = 0.0, min_co = 0.0, temp_co[3];
float *size = NULL;
float spacemat[4][4];
@@ -225,9 +224,9 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
const bool use_children = pimd->flag & eParticleInstanceFlag_Children;
bool between;
- trackneg = ((ob->trackflag > 2) ? 1 : 0);
+ trackneg = ((ctx->object->trackflag > 2) ? 1 : 0);
- if (pimd->ob == ob) {
+ if (pimd->ob == ctx->object) {
pimd->ob = NULL;
return derivedData;
}
@@ -252,7 +251,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Depsgraph *depsgraph,
if (part_end == 0)
return derivedData;
- sim.depsgraph = depsgraph;
+ sim.depsgraph = ctx->depsgraph;
sim.scene = md->scene;
sim.ob = pimd->ob;
sim.psys = psys;