|
Blender
V2.93
|
#include <stdarg.h>#include <stddef.h>#include <math.h>#include <stdlib.h>#include "MEM_guardedalloc.h"#include "DNA_collection_types.h"#include "DNA_curve_types.h"#include "DNA_listBase.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_object_force_types.h"#include "DNA_object_types.h"#include "DNA_particle_types.h"#include "DNA_scene_types.h"#include "DNA_texture_types.h"#include "BLI_blenlib.h"#include "BLI_ghash.h"#include "BLI_math.h"#include "BLI_noise.h"#include "BLI_rand.h"#include "BLI_utildefines.h"#include "PIL_time.h"#include "BKE_anim_path.h"#include "BKE_bvhutils.h"#include "BKE_collection.h"#include "BKE_collision.h"#include "BKE_curve.h"#include "BKE_displist.h"#include "BKE_effect.h"#include "BKE_fluid.h"#include "BKE_global.h"#include "BKE_layer.h"#include "BKE_modifier.h"#include "BKE_object.h"#include "BKE_particle.h"#include "BKE_scene.h"#include "DEG_depsgraph.h"#include "DEG_depsgraph_physics.h"#include "DEG_depsgraph_query.h"#include "RE_texture.h"Go to the source code of this file.
Macros | |
| #define | rot(x, k) (((x) << (k)) | ((x) >> (32 - (k)))) |
Variables | |
| SimDebugData * | _sim_debug_data = NULL |
|
static |
Definition at line 201 of file effect.c.
References BLI_addtail(), EffectorCache::depsgraph, depsgraph, EffectorCache::frame, MEM_callocN, NULL, EffectorCache::ob, EffectorCache::pd, precalculate_effector(), EffectorCache::psys, EffectorCache::scene, and scene.
Referenced by BKE_effectors_create().
|
static |
Definition at line 188 of file effect.c.
References BLI_addtail(), MEM_callocN, EffectorRelation::ob, EffectorRelation::pd, and EffectorRelation::psys.
Referenced by BKE_effector_relations_create().
| EffectorWeights* BKE_effector_add_weights | ( | Collection * | collection | ) |
Definition at line 73 of file effect.c.
References EffectorWeights::global_gravity, EffectorWeights::group, MEM_callocN, NUM_PFIELD_TYPES, and EffectorWeights::weight.
Referenced by BKE_fluid_modifier_create_type_data(), BKE_modifier_blend_read_data(), dynamicPaint_createNewSurface(), initData(), object_blend_read_data(), particle_settings_blend_read_data(), particle_settings_blend_read_lib(), particle_settings_init(), sbNew(), and scene_blend_read_data().
| ListBase* BKE_effector_relations_create | ( | Depsgraph * | depsgraph, |
| ViewLayer * | view_layer, | ||
| Collection * | collection | ||
| ) |
Definition at line 227 of file effect.c.
References add_effector_relation(), BASE_ENABLED_RENDER, BASE_ENABLED_VIEWPORT, BKE_collection_or_layer_objects(), DAG_EVAL_RENDER, DEG_get_mode(), depsgraph, Base::flag, PartDeflect::forcefield, LISTBASE_FOREACH, MEM_callocN, Base::next, NULL, Base::object, Object::particlesystem, Object::pd, ParticleSettings::pd, ParticleSettings::pd2, and psys_check_enabled().
Referenced by blender::deg::build_effector_relations().
| void BKE_effector_relations_free | ( | ListBase * | lb | ) |
Definition at line 265 of file effect.c.
References BLI_freelistN(), and MEM_freeN.
Referenced by blender::deg::clear_physics_relations().
| void BKE_effectors_apply | ( | ListBase * | effectors, |
| ListBase * | colliders, | ||
| EffectorWeights * | weights, | ||
| EffectedPoint * | point, | ||
| float * | force, | ||
| float * | wind_force, | ||
| float * | impulse | ||
| ) |
Definition at line 1145 of file effect.c.
References add_v3_v3(), add_v3_v3v3(), do_physical_effector(), do_texture_effector(), eff_calc_visibility(), effector_falloff(), PartDeflect::f_wind_factor, EffectorData::falloff, ListBase::first, EffectedPoint::flag, EffectorCache::flag, PartDeflect::forcefield, get_effector_data(), get_effector_tot(), madd_v3_v3fl(), EffectorCache::next, EffectorCache::pd, PE_VELOCITY_TO_IMPULSE, PE_WIND_AS_SPEED, PFIELD_TEXTURE, sub_v3_v3v3(), and EffectorData::vel.
Referenced by _scan_for_ext_spring_forces(), _softbody_calc_forces_slice_in_a_thread(), basic_force_cb(), boid_body(), cloth_calc_force(), do_path_effectors(), and dynamic_paint_prepare_effect_cb().
| ListBase* BKE_effectors_create | ( | Depsgraph * | depsgraph, |
| Object * | ob_src, | ||
| ParticleSystem * | psys_src, | ||
| EffectorWeights * | weights, | ||
| bool | use_rotation | ||
| ) |
Definition at line 333 of file effect.c.
References add_effector_evaluation(), BKE_object_get_evaluated_mesh(), BLI_findstring(), DEG_get_effector_relations(), DEG_get_evaluated_id(), DEG_get_evaluated_scene(), depsgraph, ParticleSettings::flag, EffectorWeights::group, if(), is_effector_relevant(), LISTBASE_FOREACH, NULL, ParticleSystem::part, PART_SELF_EFFECT, Object::particlesystem, Object::pd, ParticleSettings::pd, ParticleSettings::pd2, PFIELD_SHAPE_POINTS, scene, and PartDeflect::shape.
Referenced by do_step_cloth(), dynamicPaint_prepareEffectStep(), psys_update_effectors(), sb_sfesf_threads_run(), and softbody_calc_forces().
| void BKE_effectors_free | ( | ListBase * | lb | ) |
Definition at line 388 of file effect.c.
References BLI_freelistN(), LISTBASE_FOREACH, and MEM_freeN.
Referenced by do_step_cloth(), dynamicPaint_prepareEffectStep(), psys_free(), psys_update_effectors(), sb_sfesf_threads_run(), and softbody_calc_forces().
| PartDeflect* BKE_partdeflect_copy | ( | const struct PartDeflect * | pd_src | ) |
Definition at line 125 of file effect.c.
References BLI_rng_copy(), MEM_dupallocN, NULL, and PartDeflect::rng.
Referenced by particle_settings_copy_data().
| void BKE_partdeflect_free | ( | PartDeflect * | pd | ) |
Definition at line 137 of file effect.c.
References BLI_rng_free(), MEM_freeN, and PartDeflect::rng.
Referenced by object_free_data(), and particle_settings_free_data().
| PartDeflect* BKE_partdeflect_new | ( | int | type | ) |
Definition at line 86 of file effect.c.
References ceil(), PartDeflect::f_damp, PartDeflect::f_flow, PartDeflect::f_size, PartDeflect::f_strength, PartDeflect::f_wind_factor, PartDeflect::flag, PartDeflect::forcefield, MEM_callocN, PartDeflect::pdef_cfrict, PartDeflect::pdef_sbdamp, PartDeflect::pdef_sbift, PartDeflect::pdef_sboft, PFIELD_CLOTH_USE_CULLING, PFIELD_DO_LOCATION, PFIELD_DO_ROTATION, PFIELD_FLUIDFLOW, PFIELD_SHAPE_PLANE, PFIELD_TEXTURE, PFIELD_VORTEX, PFIELD_WIND, PIL_check_seconds_timer(), PartDeflect::seed, PartDeflect::shape, and type.
Referenced by ED_object_modifier_add(), effector_add_exec(), and forcefield_toggle_exec().
| 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 | ||
| ) |
Definition at line 1322 of file effect.c.
References _sim_debug_data, BKE_sim_debug_data_set_enabled(), BLI_ghashutil_strhash_p(), BLI_strncpy(), SimDebugElement::category_hash, SimDebugElement::color, copy_v3_v3(), debug_data_insert(), G, G_DEBUG_SIMDATA, SimDebugElement::hash, hash, MEM_callocN, r, str, SimDebugElement::str, SimDebugElement::type, type, SimDebugElement::v1, v1, SimDebugElement::v2, v2, and zero_v3().
| void BKE_sim_debug_data_clear | ( | void | ) |
Definition at line 1383 of file effect.c.
References _sim_debug_data, BLI_ghash_clear(), debug_element_free(), SimDebugData::gh, and NULL.
| void BKE_sim_debug_data_clear_category | ( | const char * | category | ) |
Definition at line 1393 of file effect.c.
References _sim_debug_data, BLI_ghash_remove(), BLI_ghashIterator_done(), BLI_ghashIterator_getValue(), BLI_ghashIterator_init(), BLI_ghashIterator_step(), BLI_ghashutil_strhash_p(), SimDebugElement::category_hash, debug_element_free(), SimDebugData::gh, and NULL.
Referenced by cloth_continuum_step(), and SIM_cloth_solve().
| void BKE_sim_debug_data_free | ( | void | ) |
Definition at line 1300 of file effect.c.
References _sim_debug_data, BLI_ghash_free(), debug_element_free(), SimDebugData::gh, MEM_freeN, and NULL.
Referenced by BKE_sim_debug_data_set_enabled().
| bool BKE_sim_debug_data_get_enabled | ( | void | ) |
Definition at line 1295 of file effect.c.
References _sim_debug_data, and NULL.
| uint BKE_sim_debug_data_hash | ( | int | i | ) |
Definition at line 1223 of file effect.c.
References BLI_ghashutil_uinthash().
Definition at line 1228 of file effect.c.
References Freestyle::a, Freestyle::c, and rot.
| void BKE_sim_debug_data_remove_element | ( | uint | hash | ) |
Definition at line 1373 of file effect.c.
References _sim_debug_data, BLI_ghash_remove(), debug_element_free(), SimDebugData::gh, SimDebugElement::hash, hash, and NULL.
| void BKE_sim_debug_data_set_enabled | ( | bool | enable | ) |
Definition at line 1281 of file effect.c.
References _sim_debug_data, BKE_sim_debug_data_free(), BLI_ghash_new(), debug_element_compare(), debug_element_hash(), SimDebugData::gh, and MEM_callocN.
Referenced by BKE_sim_debug_data_add_element().
| int closest_point_on_surface | ( | SurfaceModifierData * | surmd, |
| const float | co[3], | ||
| float | surface_co[3], | ||
| float | surface_nor[3], | ||
| float | surface_vel[3] | ||
| ) |
Definition at line 657 of file effect.c.
References add_v3_v3(), BLI_bvhtree_find_nearest(), SurfaceModifierData::bvhtree, BVHTreeNearest::co, MVert::co, copy_v3_v3(), BVHTreeNearest::dist_sq, BVHTreeNearest::index, BVHTreeFromMesh::loop, BVHTreeFromMesh::looptri, mul_v3_fl(), BVHTreeFromMesh::nearest_callback, BVHTreeNearest::no, BVHTreeFromMesh::tree, MLoopTri::tri, MLoop::v, and SurfaceModifierData::v.
Referenced by boid_find_ground(), and get_effector_data().
|
static |
Definition at line 1310 of file effect.c.
References BLI_ghash_insert(), BLI_ghash_lookup(), SimDebugData::gh, and MEM_freeN.
Referenced by BKE_sim_debug_data_add_element().
|
static |
Definition at line 1264 of file effect.c.
References Freestyle::a, and SimDebugElement::hash.
Referenced by BKE_sim_debug_data_set_enabled().
|
static |
Definition at line 1275 of file effect.c.
References MEM_freeN.
Referenced by BKE_sim_debug_data_clear(), BKE_sim_debug_data_clear_category(), BKE_sim_debug_data_free(), and BKE_sim_debug_data_remove_element().
|
static |
Definition at line 1258 of file effect.c.
References SimDebugElement::hash.
Referenced by BKE_sim_debug_data_set_enabled().
|
static |
Definition at line 971 of file effect.c.
References add_v3_v3(), add_v3_v3v3(), EffectedPoint::ave, BKE_fluid_get_velocity_at(), BLI_noise_generic_turbulence(), EffectedPoint::charge, copy_v3_v3(), cross_v3_v3v3(), EffectorData::distance, ELEM, PartDeflect::f_damp, PartDeflect::f_flow, PartDeflect::f_noise, PartDeflect::f_size, PartDeflect::f_source, PartDeflect::f_strength, fabsf, EffectorData::falloff, PartDeflect::flag, PartDeflect::forcefield, EffectedPoint::loc, madd_v3_v3fl(), MIN2, mul_qt_v3(), mul_v3_fl(), EffectorData::nor, EffectorData::nor2, normalize_v3(), EffectorCache::pd, PFIELD_BOID, PFIELD_CHARGE, PFIELD_DO_LOCATION, PFIELD_DO_ROTATION, PFIELD_DRAG, PFIELD_FLUIDFLOW, PFIELD_FORCE, PFIELD_GLOBAL_CO, PFIELD_GRAVITATION, PFIELD_HARMONIC, PFIELD_LENNARDJ, PFIELD_MAGNET, PFIELD_SHAPE_LINE, PFIELD_SHAPE_POINT, PFIELD_SMOKE_DENSITY, PFIELD_TURBULENCE, PFIELD_VORTEX, PFIELD_WIND, KDL::pow(), powf, PartDeflect::rng, EffectedPoint::rot, PartDeflect::shape, EffectedPoint::size, EffectorData::size, sqrtf, EffectorData::vec_to_point, EffectorData::vec_to_point2, EffectedPoint::vel, EffectedPoint::vel_to_sec, wind_func(), and zero_v3().
Referenced by BKE_effectors_apply().
|
static |
Definition at line 871 of file effect.c.
References add_v3_v3(), BKE_scene_check_color_management_enabled(), copy_v3_v3(), dot_v3v3(), PartDeflect::f_strength, EffectorData::falloff, PartDeflect::flag, Object::imat, EffectedPoint::loc, madd_v3_v3fl(), mul_m4_v3(), multitex_ext(), EffectorData::nor, NULL, EffectorCache::ob, EffectorCache::pd, PFIELD_DO_LOCATION, PFIELD_TEX_2D, PFIELD_TEX_GRAD, PFIELD_TEX_OBJECT, PFIELD_TEX_RGB, result, EffectorCache::scene, PartDeflect::tex, PartDeflect::tex_mode, PartDeflect::tex_nabla, TEX_RGB, and zero_v3().
Referenced by BKE_effectors_apply().
|
static |
Definition at line 485 of file effect.c.
References absorption(), BKE_collider_cache_create(), BKE_collider_cache_free(), BLI_bvhtree_ray_cast_ex(), BVH_RAYCAST_DEFAULT, BVH_RAYCAST_WATERTIGHT, CollisionModifierData::bvhtree, CLAMPIS, col, EffectorCache::depsgraph, BVHTreeRayHit::dist, eff_tri_ray_hit(), ListBase::first, PartDeflect::flag, BVHTreeRayHit::index, len, EffectedPoint::loc, negate_v3_v3(), norm(), normalize_v3(), NULL, EffectorCache::ob, EffectorCache::pd, PFIELD_VISIBILITY, and EffectorData::vec_to_point.
Referenced by BKE_effectors_apply().
|
static |
Definition at line 474 of file effect.c.
References BVHTreeRayHit::dist, and BVHTreeRayHit::index.
Referenced by eff_calc_visibility().
| float effector_falloff | ( | EffectorCache * | eff, |
| EffectorData * | efd, | ||
| EffectedPoint * | UNUSEDpoint, | ||
| EffectorWeights * | weights | ||
| ) |
Definition at line 608 of file effect.c.
References EffectorData::distance, dot_v3v3(), fabsf, PartDeflect::falloff, falloff_func_dist(), falloff_func_rad(), PartDeflect::forcefield, len_v3(), madd_v3_v3v3fl(), EffectorData::nor, EffectorCache::pd, PFIELD_FALL_CONE, PFIELD_FALL_SPHERE, PFIELD_FALL_TUBE, PFIELD_Z_NEG, PFIELD_Z_POS, RAD2DEGF, saacos(), EffectorData::vec_to_point2, EffectorWeights::weight, and PartDeflect::zdir.
Referenced by BKE_effectors_apply().
|
static |
Definition at line 569 of file effect.c.
References KDL::pow().
Referenced by falloff_func_dist(), and falloff_func_rad().
|
static |
Definition at line 588 of file effect.c.
References PartDeflect::f_power, falloff_func(), PartDeflect::flag, PartDeflect::maxdist, PartDeflect::mindist, PFIELD_USEMAX, and PFIELD_USEMIN.
Referenced by effector_falloff().
|
static |
Definition at line 598 of file effect.c.
References PartDeflect::f_power_r, falloff_func(), PartDeflect::flag, PartDeflect::maxrad, PartDeflect::minrad, PFIELD_USEMAXR, and PFIELD_USEMINR.
Referenced by effector_falloff().
| int get_effector_data | ( | EffectorCache * | eff, |
| EffectorData * | efd, | ||
| EffectedPoint * | point, | ||
| int | real_velocity | ||
| ) |
Definition at line 693 of file effect.c.
References add_v3_v3(), add_v3_v3v3(), BKE_object_get_evaluated_mesh(), SurfaceModifierData::bvhtree, closest_point_on_surface(), MVert::co, copy_v3_v3(), DEG_get_ctime(), EffectorCache::depsgraph, ParticleSimulationData::depsgraph, EffectorData::distance, ELEM, PartDeflect::f_size, EffectorCache::flag, PartDeflect::forcefield, EffectedPoint::index, EffectorData::index, len_v3(), EffectedPoint::loc, EffectorData::loc, mul_m4_v3(), mul_mat3_m4_v3(), mul_qt_v3(), mul_v3_fl(), Mesh::mvert, MVert::no, EffectorData::nor, EffectorData::nor2, normal_short_to_float_v3(), normalize_v3(), normalize_v3_v3(), NULL, EffectorCache::ob, ParticleSimulationData::ob, Object::obmat, ParticleSystem::particles, EffectorCache::pd, PE_USE_NORMAL_DATA, PFIELD_HARMONIC, PFIELD_SHAPE_LINE, PFIELD_SHAPE_PLANE, PFIELD_SHAPE_POINTS, PFIELD_SHAPE_SURFACE, PFIELD_VORTEX, project_v3_v3v3(), EffectedPoint::psys, EffectorCache::psys, ParticleSimulationData::psys, psys_get_particle_state(), ret, EffectorCache::scene, ParticleSimulationData::scene, PartDeflect::shape, EffectorData::size, ParticleData::size, state, sub_v3_v3v3(), EffectorCache::surmd, EffectorData::vec_to_point, EffectorData::vec_to_point2, EffectedPoint::vel, EffectorData::vel, EffectedPoint::vel_to_frame, and zero_v3().
Referenced by BKE_effectors_apply(), and rule_goal_avoid().
|
static |
Definition at line 825 of file effect.c.
References BKE_object_get_evaluated_mesh(), EffectorData::charge, ParticleSettings::effector_amount, PartDeflect::f_strength, PartDeflect::flag, PartDeflect::forcefield, EffectedPoint::index, EffectorData::index, NULL, EffectorCache::ob, ParticleSystem::part, EffectorCache::pd, PFIELD_CHARGE, PFIELD_HARMONIC, PFIELD_MULTIPLE_SPRINGS, PFIELD_SHAPE_POINTS, EffectorCache::psys, PartDeflect::shape, ParticleSystem::totpart, and Mesh::totvert.
Referenced by BKE_effectors_apply().
|
static |
Definition at line 274 of file effect.c.
References PartDeflect::flag, PartDeflect::forcefield, NULL, PFIELD_BOID, PFIELD_DO_LOCATION, PFIELD_DO_ROTATION, PFIELD_GUIDE, PFIELD_TEXTURE, and PartDeflect::tex.
Referenced by is_effector_relevant().
|
static |
Definition at line 295 of file effect.c.
References PartDeflect::f_damp, PartDeflect::f_flow, PartDeflect::f_noise, PartDeflect::f_strength, PartDeflect::forcefield, PFIELD_BOID, PFIELD_DRAG, PFIELD_GUIDE, PFIELD_SHAPE_POINT, PFIELD_TEXTURE, PFIELD_VORTEX, and PartDeflect::shape.
Referenced by is_effector_relevant().
|
static |
Definition at line 326 of file effect.c.
References PartDeflect::forcefield, is_effector_enabled(), is_effector_nonzero_strength(), and EffectorWeights::weight.
Referenced by BKE_effectors_create().
| void pd_point_from_loc | ( | Scene * | scene, |
| float * | loc, | ||
| float * | vel, | ||
| int | index, | ||
| EffectedPoint * | point | ||
| ) |
Definition at line 438 of file effect.c.
References EffectedPoint::ave, EffectedPoint::flag, float(), RenderData::frs_sec, EffectedPoint::index, EffectedPoint::loc, NULL, EffectedPoint::psys, Scene::r, EffectedPoint::rot, scene, EffectedPoint::size, EffectedPoint::vel, EffectedPoint::vel_to_frame, and EffectedPoint::vel_to_sec.
Referenced by cloth_calc_force(), and dynamic_paint_prepare_effect_cb().
| void pd_point_from_particle | ( | ParticleSimulationData * | sim, |
| ParticleData * | pa, | ||
| ParticleKey * | state, | ||
| EffectedPoint * | point | ||
| ) |
Definition at line 402 of file effect.c.
References EffectedPoint::ave, EffectedPoint::charge, PartDeflect::f_strength, EffectedPoint::flag, ParticleSettings::flag, PartDeflect::forcefield, EffectedPoint::index, EffectedPoint::loc, NULL, ParticleSystem::part, PART_ROT_DYN, ParticleSystem::particles, ParticleSettings::pd, ParticleSettings::pd2, PFIELD_CHARGE, EffectedPoint::psys, ParticleSimulationData::psys, psys_get_timestep(), EffectedPoint::rot, EffectedPoint::size, ParticleData::size, state, EffectedPoint::vel, EffectedPoint::vel_to_frame, and EffectedPoint::vel_to_sec.
Referenced by basic_force_cb(), boid_body(), do_path_effectors(), precalc_guides(), and rule_goal_avoid().
| void pd_point_from_soft | ( | Scene * | scene, |
| float * | loc, | ||
| float * | vel, | ||
| int | index, | ||
| EffectedPoint * | point | ||
| ) |
Definition at line 453 of file effect.c.
References EffectedPoint::ave, EffectedPoint::flag, float(), RenderData::frs_sec, EffectedPoint::index, EffectedPoint::loc, NULL, PE_WIND_AS_SPEED, EffectedPoint::psys, Scene::r, EffectedPoint::rot, scene, EffectedPoint::size, EffectedPoint::vel, EffectedPoint::vel_to_frame, and EffectedPoint::vel_to_sec.
Referenced by _scan_for_ext_spring_forces(), and _softbody_calc_forces_slice_in_a_thread().
|
static |
Definition at line 150 of file effect.c.
References CurveCache::anim_path_accum_length, BKE_displist_make_curveTypes(), BKE_modifiers_findby_type(), BKE_where_on_path(), BLI_rng_new(), BLI_rng_srandom(), CU_PATH, Object_Runtime::curve_cache, Object::data, DEG_get_ctime(), depsgraph, eModifierType_Surface, EffectorCache::flag, Curve::flag, PartDeflect::forcefield, EffectorCache::guide_dir, EffectorCache::guide_loc, EffectorCache::guide_radius, mul_m4_v3(), mul_mat3_m4_v3(), NULL, EffectorCache::ob, OB_CURVE, Object::obmat, EffectorCache::pd, PE_USE_NORMAL_DATA, PFIELD_GUIDE, PFIELD_SHAPE_SURFACE, EffectorCache::psys, psys_update_particle_tree(), PartDeflect::rng, Object::runtime, EffectorCache::scene, PartDeflect::seed, PartDeflect::shape, EffectorCache::surmd, and Object::type.
Referenced by add_effector_evaluation().
Definition at line 551 of file effect.c.
References BLI_rng_get_float(), BLI_rng_get_int(), float(), random(), ret, and KDL::sign().
Referenced by do_physical_effector().
| SimDebugData* _sim_debug_data = NULL |
Definition at line 1221 of file effect.c.
Referenced by BKE_sim_debug_data_add_element(), BKE_sim_debug_data_clear(), BKE_sim_debug_data_clear_category(), BKE_sim_debug_data_free(), BKE_sim_debug_data_get_enabled(), BKE_sim_debug_data_remove_element(), and BKE_sim_debug_data_set_enabled().