Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/effect.c
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_effect.h" | #include "BKE_effect.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_smoke.h" | #include "BKE_manta.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DEG_depsgraph_physics.h" | #include "DEG_depsgraph_physics.h" | ||||
| #include "DEG_depsgraph_query.h" | #include "DEG_depsgraph_query.h" | ||||
| #include "RE_render_ext.h" | #include "RE_render_ext.h" | ||||
| #include "RE_shader_ext.h" | #include "RE_shader_ext.h" | ||||
| /* fluid sim particle import */ | |||||
| #ifdef WITH_MOD_FLUID | |||||
| # include "LBM_fluidsim.h" | |||||
| # include <zlib.h> | |||||
| # include <string.h> | |||||
| #endif // WITH_MOD_FLUID | |||||
| EffectorWeights *BKE_effector_add_weights(Collection *collection) | EffectorWeights *BKE_effector_add_weights(Collection *collection) | ||||
| { | { | ||||
| EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights"); | EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights"); | ||||
| int i; | int i; | ||||
| for (i = 0; i < NUM_PFIELD_TYPES; i++) { | for (i = 0; i < NUM_PFIELD_TYPES; i++) { | ||||
| weights->weight[i] = 1.0f; | weights->weight[i] = 1.0f; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 939 Lines • ▼ Show 20 Lines | case PFIELD_DRAG: | ||||
| damp = MIN2(damp, 2.0f); | damp = MIN2(damp, 2.0f); | ||||
| mul_v3_fl(force, -efd->falloff * fac * (strength * fac + damp)); | mul_v3_fl(force, -efd->falloff * fac * (strength * fac + damp)); | ||||
| break; | break; | ||||
| case PFIELD_SMOKEFLOW: | case PFIELD_SMOKEFLOW: | ||||
| zero_v3(force); | zero_v3(force); | ||||
| if (pd->f_source) { | if (pd->f_source) { | ||||
| float density; | float density; | ||||
| if ((density = BKE_smoke_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) { | if ((density = BKE_manta_get_velocity_at(pd->f_source, point->loc, force)) >= 0.0f) { | ||||
| float influence = strength * efd->falloff; | float influence = strength * efd->falloff; | ||||
| if (pd->flag & PFIELD_SMOKE_DENSITY) { | if (pd->flag & PFIELD_SMOKE_DENSITY) { | ||||
| influence *= density; | influence *= density; | ||||
| } | } | ||||
| mul_v3_fl(force, influence); | mul_v3_fl(force, influence); | ||||
| /* apply flow */ | /* apply flow */ | ||||
| madd_v3_v3fl(total_force, point->vel, -pd->f_flow * influence); | madd_v3_v3fl(total_force, point->vel, -pd->f_flow * influence); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 306 Lines • Show Last 20 Lines | |||||