67 weights->
group = collection;
112 if (pd_src ==
nullptr) {
132 uint cfra =
uint(ctime >= 0 ? ctime : -ctime);
139 if (eff->
ob->
runtime->curve_cache ==
nullptr ||
140 eff->
ob->
runtime->curve_cache->anim_path_accum_length ==
nullptr)
145 if (eff->
ob->
runtime->curve_cache->anim_path_accum_length) {
159 else if (eff->
psys) {
171 relation->
psys = psys;
184 if (*effectors ==
nullptr) {
211 for (; base; base = base->
next) {
212 if (!(base->
flag & base_flag)) {
292 return pd->
f_damp != 0.0f;
324 if (relation->psys) {
334 PartDeflect *pd = (relation->pd == relation->psys->part->pd) ? part->
pd : part->
pd2;
368 if (eff->guide_data) {
408 point->
ave = point->
rot =
nullptr;
418 point->
index = index;
426 point->
ave = point->
rot =
nullptr;
427 point->
psys =
nullptr;
433 point->
index = index;
441 point->
ave = point->
rot =
nullptr;
443 point->
psys =
nullptr;
490 if (
col->ob == eff->
ob) {
512 visibility *= std::clamp(1.0f -
absorption, 0.0f, 1.0f);
514 if (visibility <= 0.0f) {
548 float fac,
int usemin,
float mindist,
int usemax,
float maxdist,
float power)
551 if (usemax && fac > maxdist) {
555 if (usemin && fac < mindist) {
563 return pow(
double(1.0f + fac - mindist),
double(-
power));
611 if (falloff == 0.0f) {
621 if (falloff == 0.0f) {
638 float surface_nor[3],
639 float surface_vel[3])
649 if (nearest.
index != -1) {
693 eff->
surmd, vec, efd->
loc, efd->
nor, real_velocity ? efd->
vel :
nullptr);
700 if (mesh_eval !=
nullptr) {
716 else if (eff->
psys) {
732 state.time = cfra - 1.0f;
745 efd->
nor[1] = efd->
nor[2] = 0.0f;
762 float temp[3], translate[3];
768 add_v3_v3v3(efd->
loc, ob->object_to_world().location(), translate);
816 *tot = mesh_eval !=
nullptr ? mesh_eval->
verts_num : 1;
819 *p = point->
index % *tot;
823 else if (eff->
psys) {
847 *
step = (totpart > amount) ?
int(
ceil(
float(totpart) /
float(amount))) : 1;
860 float tex_co[3], strength, force[3];
874 mul_m4_v3(eff->
ob->world_to_object().ptr(), tex_co);
888 force[0] = (0.5f -
result->trgba[0]) * strength;
889 force[1] = (0.5f -
result->trgba[1]) * strength;
890 force[2] = (0.5f -
result->trgba[2]) * strength;
892 else if (nabla != 0) {
909 for (
int i = 0;
i < 4;
i++) {
910 result[
i].tin = (1.0f / 3.0f) *
919 float dbdy, dgdz, drdz, dbdx, dgdx, drdy;
928 force[0] = (dbdy - dgdz) * strength;
929 force[1] = (drdz - dbdx) * strength;
930 force[2] = (dgdx - drdy) * strength;
953 float force[3] = {0, 0, 0};
958 float noise_factor = pd->
f_noise;
959 float flow_falloff = efd->
falloff;
961 if (noise_factor > 0.0f) {
962 strength +=
wind_func(rng, noise_factor);
1033 fac = -fac * (1.0f - fac) / efd->
distance;
1036 fac = ((fac > 2.0f) ? 2.0f : fac);
1051 pd->
f_size, temp[0], temp[1], temp[2], 2,
false, 2);
1053 pd->
f_size, temp[1], temp[2], temp[0], 2,
false, 2);
1055 pd->
f_size, temp[2], temp[0], temp[1], 2,
false, 2);
1062 strength = std::min(strength, 2.0f);
1063 damp = std::min(damp, 2.0f);
1073 if (density >= 0.0f) {
1074 float influence = strength * efd->
falloff;
1076 influence *= density;
1079 flow_falloff = influence;
1095 float xvec[3] = {1.0f, 0.0f, 0.0f};
1099 if (pd->
f_flow != 0.0f) {
1144 int p = 0, tot = 1,
step = 1;
1155 for (; p < tot; p +=
step) {
1163 float out_force[3] = {0, 0, 0};
1178 madd_v3_v3fl(force, out_force, 1.0f - eff->pd->f_wind_factor);
1179 madd_v3_v3fl(wind_force, out_force, eff->pd->f_wind_factor);
1206#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k))))
1210 a =
b = c = 0xdeadbeef + (2 << 2) + 13;
1306 const char *category,
1344 elem->
str[0] =
'\0';
bool BKE_where_on_path(const struct Object *ob, float ctime, float r_vec[4], float r_dir[3], float r_quat[4], float *r_radius, float *r_weight)
Base * BKE_collection_or_layer_objects(const Scene *scene, ViewLayer *view_layer, Collection *collection)
void BKE_collider_cache_free(struct ListBase **colliders)
struct ListBase * BKE_collider_cache_create(struct Depsgraph *depsgraph, struct Object *self, struct Collection *collection)
display list (or rather multi purpose list) stuff.
void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *ob, bool for_render)
SimDebugData * _sim_debug_data
#define PE_VELOCITY_TO_IMPULSE
#define PE_USE_NORMAL_DATA
float BKE_fluid_get_velocity_at(struct Object *ob, float position[3], float velocity[3])
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
General operations, lookup, etc. for blender objects.
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
float psys_get_timestep(struct ParticleSimulationData *sim)
void psys_update_particle_tree(struct ParticleSystem *psys, float cfra)
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
unsigned int BLI_ghashutil_uinthash(unsigned int key)
void BLI_ghashIterator_step(GHashIterator *ghi)
void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
#define BVH_RAYCAST_DEFAULT
int BLI_bvhtree_ray_cast_ex(const BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata, int flag)
int BLI_bvhtree_find_nearest(const BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float safe_acosf(float a)
void mul_m4_v3(const float M[4][4], float r[3])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void mul_qt_v3(const float q[4], float r[3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
float BLI_noise_generic_turbulence(float noisesize, float x, float y, float z, int oct, bool hard, int noisebasis)
void int BLI_rng_get_int(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
struct RNG * BLI_rng_new(unsigned int seed)
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * STRNCPY(char(&dst)[N], const char *src)
Platform independent time functions.
double BLI_time_now_seconds(void)
ListBase * DEG_get_effector_relations(const Depsgraph *depsgraph, Collection *collection)
float DEG_get_ctime(const Depsgraph *graph)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
These structs are the foundation for all linked lists in the library system.
@ PFIELD_MULTIPLE_SPRINGS
@ PFIELD_CLOTH_USE_CULLING
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
constexpr const T * data() const
bool closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3])
ListBase * BKE_effector_relations_create(Depsgraph *depsgraph, const Scene *scene, ViewLayer *view_layer, Collection *collection)
void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, uint hash)
EffectorWeights * BKE_effector_add_weights(Collection *collection)
static bool is_effector_relevant(PartDeflect *pd, EffectorWeights *weights, bool use_rotation)
void BKE_sim_debug_data_clear_category(const char *category)
static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force)
static void debug_data_insert(SimDebugData *debug_data, SimDebugElement *elem)
bool BKE_sim_debug_data_get_enabled()
void BKE_effectors_free(ListBase *lb)
static bool is_effector_enabled(PartDeflect *pd, bool use_rotation)
uint BKE_sim_debug_data_hash(int i)
static uint debug_element_hash(const void *key)
static bool debug_element_compare(const void *a, const void *b)
void pd_point_from_loc(Scene *scene, float *loc, float *vel, int index, EffectedPoint *point)
void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, ParticleKey *state, EffectedPoint *point)
static float falloff_func_dist(PartDeflect *pd, float fac)
static void do_physical_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force)
static void add_effector_evaluation(ListBase **effectors, Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd)
PartDeflect * BKE_partdeflect_new(int type)
void BKE_effector_relations_free(ListBase *lb)
void BKE_sim_debug_data_set_enabled(bool enable)
void BKE_partdeflect_free(PartDeflect *pd)
void BKE_sim_debug_data_remove_element(uint hash)
static float wind_func(RNG *rng, float strength)
void BKE_effectors_apply(ListBase *effectors, ListBase *colliders, EffectorWeights *weights, EffectedPoint *point, float *force, float *wind_force, float *impulse)
static void eff_tri_ray_hit(void *, int, const BVHTreeRay *, BVHTreeRayHit *hit)
static void add_effector_relation(ListBase *relations, Object *ob, ParticleSystem *psys, PartDeflect *pd)
void BKE_sim_debug_data_clear()
static void debug_element_free(void *val)
static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
static bool is_effector_nonzero_strength(PartDeflect *pd)
void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, EffectedPoint *point)
PartDeflect * BKE_partdeflect_copy(const PartDeflect *pd_src)
bool get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int real_velocity)
float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *, EffectorWeights *weights)
ListBase * BKE_effectors_create(Depsgraph *depsgraph, Object *ob_src, ParticleSystem *psys_src, EffectorWeights *weights, bool use_rotation)
uint BKE_sim_debug_data_hash_combine(uint kx, uint ky)
static void precalculate_effector(Depsgraph *depsgraph, EffectorCache *eff)
static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, EffectorData *efd, EffectedPoint *point)
static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
static float falloff_func_rad(PartDeflect *pd, float fac)
void BKE_sim_debug_data_free()
IMETHOD void random(Vector &a)
addDelta operator for displacement rotational velocity.
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
ccl_device_inline float2 power(const float2 v, const float e)
VecBase< int32_t, 3 > int3
closure color absorption() BUILTIN
struct ParticleSystem * psys
struct ParticleSystem * psys
struct SurfaceModifierData * surmd
struct Depsgraph * depsgraph
struct ParticleSystem * psys
struct Collection * group
ObjectRuntimeHandle * runtime
struct Depsgraph * depsgraph
struct ParticleSystem * psys
unsigned int category_hash
BVHTreeFromMeshHandle * bvhtree
float(* vert_velocities)[3]
SurfaceModifierData_Runtime runtime
BVHTree_NearestPointCallback nearest_callback
int multitex_ext(Tex *tex, const float texvec[3], TexResult *texres, const short thread, ImagePool *pool, bool scene_color_manage, const bool skip_load_image)