|
Blender V4.3
|
#include <algorithm>#include <cmath>#include <cstddef>#include <cstdlib>#include <cstring>#include "MEM_guardedalloc.h"#include "DNA_boid_types.h"#include "DNA_cloth_types.h"#include "DNA_listBase.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_modifier_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_kdopbvh.h"#include "BLI_kdtree.h"#include "BLI_linklist.h"#include "BLI_math_base_safe.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_rand.h"#include "BLI_string_utils.hh"#include "BLI_task.h"#include "BLI_threads.h"#include "BLI_utildefines.h"#include "BKE_animsys.h"#include "BKE_boids.h"#include "BKE_collision.h"#include "BKE_colortools.hh"#include "BKE_customdata.hh"#include "BKE_effect.h"#include "BKE_lib_id.hh"#include "BKE_lib_query.hh"#include "BKE_mesh_legacy_convert.hh"#include "BKE_particle.h"#include "BKE_cloth.hh"#include "BKE_material.h"#include "BKE_mesh.hh"#include "BKE_modifier.hh"#include "BKE_object.hh"#include "BKE_pointcache.h"#include "BKE_scene.hh"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_query.hh"Go to the source code of this file.
Classes | |
| struct | SPHNeighbor |
| struct | SPHRangeData |
| struct | EfData |
| struct | DynamicStepSolverTaskData |
| struct | ParticleSystemIDLoopForModifier |
Macros | |
| #define | ZERO_F43 |
| #define | COLLISION_MIN_RADIUS 0.001f |
| #define | COLLISION_MIN_DISTANCE 0.0001f |
| #define | COLLISION_ZERO 0.00001f |
| #define | COLLISION_INIT_STEP 0.00008f |
Typedefs | |
| using | NRDistanceFunc |
Variables | |
| static ThreadRWMutex | psys_bvhtree_rwlock = BLI_RWLOCK_INITIALIZER |
| static const float | MIN_TIMESTEP = 1.0f / 101.0f |
| static const float | TIMESTEP_EXPANSION_FACTOR = 0.1f |
| static const float | TIMESTEP_EXPANSION_TOLERANCE = 1.5f |
SPH fluid physics | |
In theory, there could be unlimited implementation of SPH simulators This code uses in some parts adapted algorithms from the pseudo code as outlined in the Research paper: Titled: Particle-based Viscoelastic Fluid Simulation. Authors: Simon Clavet, Philippe Beaudoin and Pierre Poulin Website: http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/ Presented at SIGGRAPH, (2005) | |
| #define | PSYS_FLUID_SPRINGS_INITIAL_SIZE 256 |
| #define | SPH_NEIGHBORS 512 |
| static ParticleSpring * | sph_spring_add (ParticleSystem *psys, ParticleSpring *spring) |
| static void | sph_spring_delete (ParticleSystem *psys, int j) |
| static void | sph_springs_modify (ParticleSystem *psys, float dtime) |
| static blender::Map< blender::OrderedEdge, int > | sph_springhash_build (ParticleSystem *psys) |
| static void | sph_evaluate_func (BVHTree *tree, ParticleSystem **psys, const float co[3], SPHRangeData *pfr, float interaction_radius, BVHTree_RangeQuery callback) |
| static void | sph_density_accum_cb (void *userdata, int index, const float co[3], float squared_dist) |
| static void | sph_particle_courant (SPHData *sphdata, SPHRangeData *pfr) |
| static void | sph_force_cb (void *sphdata_v, ParticleKey *state, float *force, float *) |
| static void | sphclassical_density_accum_cb (void *userdata, int index, const float co[3], float) |
| static void | sphclassical_neighbor_accum_cb (void *userdata, int index, const float co[3], float) |
| static void | sphclassical_force_cb (void *sphdata_v, ParticleKey *state, float *force, float *) |
| static void | sphclassical_calc_dens (ParticleData *pa, float, SPHData *sphdata) |
| void | psys_sph_init (ParticleSimulationData *sim, SPHData *sphdata) |
| static void | psys_sph_flush_springs (SPHData *sphdata) |
| void | psys_sph_finalize (SPHData *sphdata) |
| void | psys_sph_density (BVHTree *tree, SPHData *sphdata, float co[3], float vars[2]) |
| static void | sph_integrate (ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata) |
| #define COLLISION_INIT_STEP 0.00008f |
Definition at line 2396 of file particle_system.cc.
Referenced by collision_newton_rhapson().
| #define COLLISION_MIN_DISTANCE 0.0001f |
Definition at line 2394 of file particle_system.cc.
Referenced by collision_response().
| #define COLLISION_MIN_RADIUS 0.001f |
Definition at line 2393 of file particle_system.cc.
Referenced by collision_check().
| #define COLLISION_ZERO 0.00001f |
Definition at line 2395 of file particle_system.cc.
Referenced by collision_newton_rhapson().
| #define PSYS_FLUID_SPRINGS_INITIAL_SIZE 256 |
Definition at line 1570 of file particle_system.cc.
Referenced by sph_spring_add(), and sph_spring_delete().
| #define SPH_NEIGHBORS 512 |
Definition at line 1673 of file particle_system.cc.
Referenced by sph_density_accum_cb(), and sphclassical_neighbor_accum_cb().
| #define ZERO_F43 |
Referenced by integrate_particle().
| using NRDistanceFunc |
Definition at line 2397 of file particle_system.cc.
|
static |
Definition at line 2235 of file particle_system.cc.
References EffectedPoint::ave, ParticleKey::ave, BKE_effectors_apply(), BLI_rng_get_float(), ParticleSimulationData::colliders, copy_v3_v3(), EFF_WEIGHT_DO_HAIR, ParticleSystem::effectors, ParticleTexture::field, len_v3(), madd_v3_v3fl(), mul_v3_fl(), EfData::pa, ParticleSystem::part, PART_HAIR, PART_ROT_DYN, pd_point_from_particle(), ParticleSimulationData::psys, EfData::ptex, ParticleSimulationData::rng, EfData::sim, ParticleData::size, ParticleData::state, and state.
Referenced by basic_integrate().
|
static |
Definition at line 2276 of file particle_system.cc.
References ParticleKey::ave, basic_force_cb(), CLAMP, ParticleKey::co, copy_v3_v3(), ParticleTexture::damp, ParticleSimulationData::depsgraph, do_guides(), EFF_WEIGHT_DO_HAIR, ParticleSystem::effectors, ParticleTexture::gravity, PhysicsSettings::gravity, integrate_particle(), ParticleData::lifetime, madd_v3_v3fl(), mul_v3_fl(), EfData::pa, PAMAP_PHYSICS, ParticleSystem::part, PART_HAIR, ParticleSystem::particles, Scene::physics_settings, ParticleData::prev_state, ParticleSimulationData::psys, psys_get_texture(), psys_get_timestep(), psys_uses_gravity(), EfData::ptex, ParticleSimulationData::scene, EfData::sim, ParticleData::state, sub_v3_v3v3(), ParticleData::time, ParticleKey::time, time, ParticleKey::vel, and zero_v3().
Referenced by dynamics_step(), dynamics_step_sph_classical_basic_integrate_task_cb_ex(), and dynamics_step_sph_ddr_task_cb_ex().
|
static |
Definition at line 2332 of file particle_system.cc.
References angle(), ParticleKey::ave, axis_angle_to_quat(), cross_v3_v3v3(), dot_v3v3(), ELEM, get_angular_velocity_vector(), len_v3(), mul_qt_qtqt(), mul_v3_fl(), normalize_qt(), normalize_v3(), PART_AVE_HORIZONTAL, PART_AVE_VELOCITY, PART_AVE_VERTICAL, PART_ROT_DYN, PART_ROTATIONS, ParticleData::prev_state, ParticleKey::rot, safe_acosf(), ParticleData::state, unit_qt(), ParticleKey::vel, and zero_v3().
Referenced by dynamics_step(), dynamics_step_sph_classical_integrate_task_cb_ex(), and dynamics_step_sph_ddr_task_cb_ex().
| void BKE_particle_settings_eval_reset | ( | Depsgraph * | depsgraph, |
| ParticleSettings * | particle_settings ) |
Definition at line 5088 of file particle_system.cc.
References DEG_debug_print_eval(), depsgraph, ParticleSettings::id, ID_RECALC_PSYS_RESET, ID::name, and ID::recalc.
| void BKE_particle_system_eval_init | ( | Depsgraph * | depsgraph, |
| Object * | object ) |
Definition at line 5094 of file particle_system.cc.
References DEG_debug_print_eval(), depsgraph, and ID_RECALC_PSYS_ALL.
Referenced by blender::deg::DepsgraphNodeBuilder::build_particle_systems().
| void BKE_particlesettings_fluid_default_settings | ( | ParticleSettings * | part | ) |
Definition at line 4722 of file particle_system.cc.
References SPHFluidSettings::buoyancy, SPHFluidSettings::flag, SPHFluidSettings::plasticity_constant, SPHFluidSettings::radius, SPHFluidSettings::rest_density, SPHFluidSettings::rest_length, SPH_FAC_DENSITY, SPH_FAC_RADIUS, SPH_FAC_REPULSION, SPH_FAC_REST_LENGTH, SPH_FAC_VISCOSITY, SPHFluidSettings::spring_k, SPHFluidSettings::stiffness_k, SPHFluidSettings::stiffness_knear, SPHFluidSettings::viscosity_beta, SPHFluidSettings::viscosity_omega, and SPHFluidSettings::yield_ratio.
| void BKE_particlesystem_id_loop | ( | ParticleSystem * | psys, |
| ParticleSystemIDFunc | func, | ||
| void * | userdata ) |
Definition at line 5029 of file particle_system.cc.
References BKE_lib_query_foreachid_process_flags_get(), BKE_modifier_get_info(), ParticleData::boid, ParticleSystem::clmd, ModifierTypeInfo::foreach_ID_link, BoidParticle::ground, IDWALK_CB_NEVER_NULL, IDWALK_CB_NOP, IDWALK_CB_USER, IDWALK_NO_ORIG_POINTERS_ACCESS, LISTBASE_FOREACH, ClothModifierData::modifier, ParticleSystem::parent, ParticleSystem::part, PART_PHYS_BOIDS, ParticleSystem::particles, particlesystem_modifiersForeachIDLink(), ParticleSettings::phystype, ParticleSystemIDLoopForModifier::psys, ParticleSystem::target_ob, ParticleSystem::targets, ParticleSystem::totpart, and ModifierData::type.
Referenced by object_foreach_id().
| void BKE_particlesystem_reset_all | ( | struct Object * | object | ) |
Reset all particle systems in the given object.
Definition at line 5072 of file particle_system.cc.
References eModifierType_ParticleSystem, ID_RECALC_PSYS_RESET, ParticleSystemModifierData::psys, and ParticleSystem::recalc.
Referenced by blender::ed::sculpt_paint::dyntopo::disable(), and blender::ed::object::editmode_exit_ex().
| void BKE_psys_collision_neartest_cb | ( | void * | userdata, |
| int | index, | ||
| const BVHTreeRay * | ray, | ||
| BVHTreeRayHit * | hit ) |
Definition at line 2790 of file particle_system.cc.
References col, collision_point_velocity(), collision_sphere_to_edges(), collision_sphere_to_tri(), collision_sphere_to_verts(), float, ParticleCollisionElement::index, ParticleCollisionElement::inside, ParticleCollisionElement::tot, ParticleCollisionElement::v, v, and ParticleCollisionElement::x.
Referenced by collision_detect().
|
static |
Definition at line 1317 of file particle_system.cc.
References BLI_bvhtree_balance().
Referenced by psys_update_particle_bvhtree().
|
static |
Definition at line 4122 of file particle_system.cc.
References ParticleData::alive, ParticleData::dietime, ParticleData::flag, PointCache::flag, LOOP_PARTICLES, PAMAP_SIZE, PARS_ALIVE, PARS_DEAD, PARS_NO_DISP, PARS_UNBORN, ParticleSystem::part, PART_UNBORN, PARTICLE_P, ParticleSystem::pointcache, ParticleSimulationData::psys, psys_frand(), psys_get_current_display_percentage(), psys_get_texture(), psys_sim_data_free(), psys_sim_data_init(), psys_update_effectors(), PTCACHE_EXTERNAL, reset_particle(), ParticleData::size, ParticleTexture::size, and ParticleData::time.
Referenced by system_step().
|
static |
Definition at line 3120 of file particle_system.cc.
References ParticleData::boid, BOID_ALLOW_LAND, ParticleSystem::cfra, ParticleKey::co, col, ParticleSimulationData::colliders, collision_detect(), collision_fail(), COLLISION_MIN_RADIUS, collision_response(), copy_v3_v3(), ParticleData::flag, BoidParticle::ground, mul_v3_fl(), ParticleSystem::part, PART_DIE_ON_COL, PART_PHYS_BOIDS, PART_ROT_DYN, PART_SIZE_DEFL, PARTICLE_COLLISION_MAX_COLLISIONS, ParticleSystem::particles, ParticleData::prev_state, ParticleSimulationData::psys, psys_get_timestep(), ParticleData::size, ParticleData::state, sub_v3_v3v3(), and ParticleKey::vel.
Referenced by dynamics_step(), dynamics_step_sph_classical_integrate_task_cb_ex(), and dynamics_step_sph_ddr_task_cb_ex().
|
static |
Definition at line 2830 of file particle_system.cc.
References BKE_psys_collision_neartest_cb(), BLI_bvhtree_ray_cast_ex(), BLI_listbase_is_empty(), BVH_RAYCAST_DEFAULT, BVH_RAYCAST_WATERTIGHT, col, LISTBASE_FOREACH, normalize_v3(), sub_v3_v3v3(), and ParticleData::time.
Referenced by collision_check().
|
static |
Definition at line 3100 of file particle_system.cc.
References ParticleKey::co, col, collision_point_on_surface(), copy_v3_v3(), mul_v3_fl(), ParticleData::state, and ParticleKey::vel.
Referenced by collision_check().
|
static |
| t | is the current time for newton rhapson. |
| fac | is the starting factor for current collision iteration. |
| col | The particle collision, col->fac's are factors for the particle sub-frame step start and end during collision modifier step. |
Definition at line 2461 of file particle_system.cc.
References col, madd_v3_v3v3fl(), mul(), ParticleCollisionElement::tot, ParticleCollisionElement::v, ParticleCollisionElement::x, ParticleCollisionElement::x0, ParticleCollisionElement::x1, and ParticleCollisionElement::x2.
Referenced by collision_newton_rhapson(), collision_point_distance_with_normal(), and collision_point_on_surface().
|
static |
Definition at line 2569 of file particle_system.cc.
References CLAMP, col, COLLISION_INIT_STEP, collision_interpolate_element(), COLLISION_ZERO, copy_v3_v3(), ParticleCollisionElement::inside, interp_v3_v3v3(), ParticleCollisionElement::inv_nor, ParticleCollisionElement::nor, nr_signed_distance_to_plane(), and ParticleCollisionElement::p.
Referenced by collision_sphere_to_edges(), collision_sphere_to_tri(), and collision_sphere_to_verts().
|
static |
Definition at line 2496 of file particle_system.cc.
References col, collision_interpolate_element(), dot_v3v3(), e, madd_v3_v3v3fl(), nor, normalize_v3(), nr_signed_distance_to_plane(), sub_v3_v3v3(), ParticleCollisionElement::tot, ParticleCollisionElement::x0, and ParticleCollisionElement::x1.
Referenced by collision_response().
|
static |
Definition at line 2522 of file particle_system.cc.
References col, collision_interpolate_element(), cross_v3_v3v3(), dot_v3v3(), e, ParticleCollisionElement::inv_nor, madd_v3_v3fl(), madd_v3_v3v3fl(), negate_v3(), nor, normalize_v3(), sub_v3_v3v3(), ParticleCollisionElement::tot, ParticleCollisionElement::uv, ParticleCollisionElement::x0, ParticleCollisionElement::x1, and ParticleCollisionElement::x2.
Referenced by collision_fail().
|
static |
Definition at line 2480 of file particle_system.cc.
References copy_v3_v3(), madd_v3_v3fl(), sub_v3_v3v3(), ParticleCollisionElement::tot, ParticleCollisionElement::uv, ParticleCollisionElement::v, v, and ParticleCollisionElement::vel.
Referenced by BKE_psys_collision_neartest_cb().
|
static |
Definition at line 2894 of file particle_system.cc.
References add_v3_v3(), add_v3_v3v3(), ParticleData::alive, ParticleKey::ave, BLI_rng_get_float(), ParticleData::boid, CLAMP, ParticleKey::co, col, COLLISION_MIN_DISTANCE, collision_point_distance_with_normal(), copy_v3_v3(), cross_v3_v3v3(), BoidParticle::data, ParticleData::dietime, distance(), dot(), dot_v3v3(), eBoidMode_OnLand, PartDeflect::flag, interp_qt_qtqt(), interp_v3_v3v3(), madd_v3_v3fl(), madd_v3_v3v3fl(), BoidData::mode, mul_v3_fl(), mul_v3_v3fl(), negate_v3_v3(), nor, ParticleCollisionElement::nor, PARS_DYING, PartDeflect::pdef_damp, PartDeflect::pdef_frict, PartDeflect::pdef_perm, PartDeflect::pdef_rdamp, PartDeflect::pdef_rfrict, PartDeflect::pdef_stickness, PDEFLE_KILL_PART, ParticleData::prev_state, ParticleSimulationData::rng, ParticleKey::rot, ParticleData::size, ParticleData::state, sub_v3_v3v3(), ParticleCollisionElement::vel, and ParticleKey::vel.
Referenced by collision_check().
|
static |
Definition at line 2710 of file particle_system.cc.
References col, collision_newton_rhapson(), dot_v3v3(), e, ParticleCollisionElement::inside, madd_v3_v3v3fl(), normalize_v3(), nr_distance_to_edge(), ParticleCollisionElement::p, sub_v3_v3v3(), ParticleCollisionElement::tot, ParticleCollisionElement::v, ParticleCollisionElement::x, ParticleCollisionElement::x0, and ParticleCollisionElement::x1.
Referenced by BKE_psys_collision_neartest_cb().
|
static |
Definition at line 2664 of file particle_system.cc.
References col, collision_newton_rhapson(), dot_v3v3(), ParticleCollisionElement::inside, ParticleCollisionElement::inv_nor, nr_signed_distance_to_plane(), ParticleCollisionElement::p, sub_v3_v3v3(), ParticleCollisionElement::uv, v, ParticleCollisionElement::x0, ParticleCollisionElement::x1, and ParticleCollisionElement::x2.
Referenced by BKE_psys_collision_neartest_cb().
|
static |
Definition at line 2757 of file particle_system.cc.
References col, collision_newton_rhapson(), ParticleCollisionElement::inside, normalize_v3(), nr_distance_to_vert(), ParticleCollisionElement::p, sub_v3_v3v3(), ParticleCollisionElement::tot, ParticleCollisionElement::v, ParticleCollisionElement::x, and ParticleCollisionElement::x0.
Referenced by BKE_psys_collision_neartest_cb().
|
static |
Definition at line 3457 of file particle_system.cc.
References BKE_id_copy_ex(), BKE_id_free(), BKE_modifier_new(), ParticleSystem::clmd, CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS, clothModifier_do(), ClothModifierData::coll_parms, ParticleSimulationData::depsgraph, ClothSimSettings::effector_weights, ParticleSettings::effector_weights, eModifierType_Cloth, ParticleData::flag, ClothCollSettings::flags, ClothSimSettings::flags, ClothSimSettings::goalspring, hair_create_input_mesh(), ParticleSystem::hair_in_mesh, ParticleSystem::hair_out_mesh, ClothModifierData::hairdata, Mesh::id, LIB_ID_COPY_LOCALIZE, LOOP_PARTICLES, MEM_freeN(), ParticleSimulationData::ob, PARS_UNEXIST, ParticleSystem::part, PARTICLE_P, ClothModifierData::point_cache, ParticleSystem::pointcache, ParticleSimulationData::psys, ParticleSimulationData::scene, ClothModifierData::sim_parms, and ParticleData::totkey.
Referenced by hair_step().
|
static |
Definition at line 3841 of file particle_system.cc.
References ParticleData::alive, basic_integrate(), basic_rotate(), BKE_collider_cache_create(), BKE_collider_cache_free(), BLI_findlink(), BLI_parallel_range_settings_defaults(), BLI_rng_free(), BLI_rng_new_srandom(), BLI_spin_end(), BLI_spin_init(), BLI_task_parallel_range(), boid_body(), boid_brain(), boids_precalc_rules(), BoidBrainData::cfra, ParticleSystem::cfra, ParticleSimulationData::colliders, collision_check(), copy_particle_key(), ParticleSimulationData::depsgraph, BoidBrainData::dfra, ParticleData::dietime, dynamics_step_sph_classical_basic_integrate_task_cb_ex(), dynamics_step_sph_classical_calc_density_task_cb_ex(), dynamics_step_sph_classical_integrate_task_cb_ex(), dynamics_step_sph_ddr_task_cb_ex(), dynamics_step_sphdata_reduce(), ELEM, ListBase::first, ParticleData::flag, BoidBrainData::goal_ob, LOOP_DYNAMIC_PARTICLES, LOOP_EXISTING_PARTICLES, LOOP_SHOWN_PARTICLES, ParticleTarget::next, ParticleSimulationData::ob, ParticleTarget::ob, PAMAP_SIZE, PARS_ALIVE, PARS_DEAD, PARS_DYING, PARS_NO_DISP, PARS_UNBORN, PARS_UNEXIST, BoidBrainData::part, ParticleSystem::part, PART_HAIR, PART_PHYS_BOIDS, PART_PHYS_FLUID, PART_PHYS_NEWTON, PART_PHYS_NO, PART_UNBORN, PARTICLE_P, Object::particlesystem, ParticleSystem::pointcache, ParticleData::prev_state, ParticleSimulationData::psys, ParticleTarget::psys, psys_frand(), psys_get_target_system(), psys_get_texture(), psys_get_timestep(), psys_sph_finalize(), psys_sph_init(), psys_update_effectors(), psys_update_particle_bvhtree(), psys_update_particle_tree(), reset_particle(), BoidBrainData::rng, ParticleSimulationData::rng, ParticleSystem::seed, BoidBrainData::sim, DynamicStepSolverTaskData::sim, ParticleData::size, ParticleTexture::size, SPH_SOLVER_DDR, sph_springs_modify(), ParticleData::state, PointCache::step, ParticleSystem::targets, ParticleData::time, ParticleKey::time, BoidBrainData::timestep, and ParticleSystem::totpart.
Referenced by system_step().
|
static |
Definition at line 3773 of file particle_system.cc.
References basic_integrate(), ParticleSystem::particles, ParticleSimulationData::psys, ParticleData::state, and ParticleKey::time.
Referenced by dynamics_step().
|
static |
Definition at line 3789 of file particle_system.cc.
References ParticleSystem::particles, ParticleSimulationData::psys, sphclassical_calc_dens(), ParticleData::state, and ParticleKey::time.
Referenced by dynamics_step().
|
static |
Definition at line 3807 of file particle_system.cc.
References basic_rotate(), ParticleSimulationData::colliders, collision_check(), ParticleSystem::part, PART_TIME_AUTOSF, ParticleSystem::particles, ParticleSimulationData::psys, sph_integrate(), ParticleData::state, ParticleKey::time, and update_courant_num().
Referenced by dynamics_step().
|
static |
Definition at line 3737 of file particle_system.cc.
References basic_integrate(), basic_rotate(), ParticleSimulationData::colliders, collision_check(), ParticleSystem::part, PART_TIME_AUTOSF, ParticleSystem::particles, ParticleSimulationData::psys, sph_integrate(), ParticleData::state, ParticleKey::time, and update_courant_num().
Referenced by dynamics_step().
|
static |
Definition at line 3720 of file particle_system.cc.
References BLI_buffer_append_array, BLI_buffer_at, BLI_buffer_field_free, BLI_Buffer::count, and SPHData::new_springs.
Referenced by dynamics_step().
|
static |
Definition at line 4473 of file particle_system.cc.
References ParticleSimulationData::psys, realloc_particles(), tot_particles(), and ParticleSystem::totpart.
Referenced by particle_system_update(), and system_step().
|
static |
Definition at line 1049 of file particle_system.cc.
References BKE_object_where_is_calc_time(), depsgraph, evaluate_emitter_anim(), and Object::parent.
Referenced by evaluate_emitter_anim(), particle_system_update(), and reset_particle().
|
static |
Definition at line 615 of file particle_system.cc.
References ParticleData::boid, LOOP_PARTICLES, MEM_callocN, MEM_freeN(), PARS_UNEXIST, PARTICLE_P, ParticleSystem::particles, ParticleSimulationData::psys, ParticleSystem::totpart, and ParticleSystem::totunexist.
Referenced by particle_system_update(), and system_step().
|
static |
Definition at line 673 of file particle_system.cc.
References copy_v3_v3(), cross_v3_v3v3(), PART_AVE_GLOBAL_X, PART_AVE_GLOBAL_Y, PART_AVE_GLOBAL_Z, PART_AVE_HORIZONTAL, PART_AVE_VELOCITY, PART_AVE_VERTICAL, and state.
Referenced by basic_rotate(), and psys_get_birth_coords().
|
static |
Definition at line 3660 of file particle_system.cc.
References float.
Referenced by system_step(), and update_timestep().
|
static |
Definition at line 3324 of file particle_system.cc.
References add_v3_v3v3(), BKE_mesh_new_nomain(), ParticleSystem::clmd, HairKey::co, copy_m3_m4(), copy_v3_v3(), ParticleData::flag, ParticleSettings::from, ParticleData::hair, ParticleData::hair_index, hair_set_pinning(), ClothModifierData::hairdata, len_v3v3(), length(), LOOP_PARTICLES, MEM_mallocN, mesh, ParticleSystemModifierData::mesh_final, mul_m4_m4m4(), mul_m4_v3(), normalize_m4(), ParticleSimulationData::ob, PARS_UNEXIST, ParticleSystem::part, PARTICLE_P, ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_frand(), psys_hair_use_simulation(), psys_mat_hair_to_object(), ClothModifierData::sim_parms, sub_v3_v3(), ParticleData::totkey, ClothSimSettings::vgroup_mass, and HairKey::weight.
Referenced by do_hair_dynamics().
|
static |
Definition at line 4765 of file particle_system.cc.
References ParticleSystem::edit, PTCacheEdit::edited, ParticleSettings::flag, ParticleSystem::flag, ID_RECALC_PSYS_RESET, ParticleSystem::part, PART_HAIR_REGROW, PSYS_EDITED, PSYS_HAIR_DONE, and ParticleSystem::recalc.
Referenced by particle_system_update().
|
static |
Definition at line 3310 of file particle_system.cc.
References MDeformVert::dw, MEM_callocN, MDeformVert::totweight, and MDeformWeight::weight.
Referenced by hair_create_input_mesh().
|
static |
Definition at line 3533 of file particle_system.cc.
References ParticleSystem::clmd, cloth_free_modifier(), do_hair_dynamics(), ParticleData::flag, ParticleSystem::flag, ID_RECALC_PSYS_RESET, LOOP_PARTICLES, ParticleSystemModifierData::mesh_final, ParticleSystemModifierData::mesh_original, ParticleSimulationData::ob, PARS_NO_DISP, ParticleSystem::part, PART_HAIR, PARTICLE_P, ParticleSystem::particles, ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_calc_dmcache(), psys_frand(), psys_get_current_display_percentage(), PSYS_HAIR_DYNAMICS, PSYS_HAIR_UPDATED, psys_update_effectors(), psys_update_path_cache(), ParticleSystem::recalc, ParticleData::size, and ParticleSettings::type.
Referenced by particle_system_update().
| void init_particle | ( | struct ParticleSimulationData * | sim, |
| struct ParticleData * | pa ) |
Set particle parameters that don't change during particle's life.
Definition at line 576 of file particle_system.cc.
References ParticleData::flag, float, ParticleData::hair_index, ParticleSystem::part, ParticleSystem::particles, ParticleSimulationData::psys, ParticleData::time, and ParticleSystem::totpart.
Referenced by brush_add(), and initialize_all_particles().
|
static |
Definition at line 552 of file particle_system.cc.
References ParticleTexture::exist, ParticleData::flag, PAMAP_INIT, PARS_UNEXIST, ParticleSystem::part, PART_EMITTER, PART_HAIR, ParticleSimulationData::psys, psys_frand(), psys_get_texture(), ParticleData::time, and ParticleTexture::time.
Referenced by reset_particle().
|
static |
Definition at line 590 of file particle_system.cc.
References ELEM, init_particle(), LOOP_PARTICLES, PARS_UNEXIST, ParticleSystem::part, PART_DISTR_GRID, PART_FROM_CHILD, PART_FROM_VERT, PARTICLE_P, and ParticleSimulationData::psys.
Referenced by particle_system_update(), and system_step().
|
static |
Definition at line 1408 of file particle_system.cc.
References add_v3_v3(), add_v3_v3v3(), ParticleKey::co, copy_particle_key(), copy_v3_v3(), madd_v3_v3fl(), madd_v3_v3v3fl(), mul_v3_fl(), mul_v3_v3fl(), PART_INT_EULER, PART_INT_MIDPOINT, PART_INT_RK4, PART_INT_VERLET, PART_SIZEMASS, ParticleData::prev_state, ParticleData::size, ParticleData::state, steps, sub_v3_v3v3(), ParticleKey::time, ParticleKey::vel, ZERO_F43, and zero_v3().
Referenced by basic_integrate(), and sph_integrate().
|
static |
Definition at line 2433 of file particle_system.cc.
References cross_v3_v3v3(), fabsf, len_v3(), sub_v3_v3v3(), v2, ParticleCollisionElement::x0, and ParticleCollisionElement::x1.
Referenced by collision_sphere_to_edges().
|
static |
Definition at line 2448 of file particle_system.cc.
References len_v3v3(), and ParticleCollisionElement::x0.
Referenced by collision_sphere_to_verts().
|
static |
Definition at line 2401 of file particle_system.cc.
References cross_v3_v3v3(), dot_v3v3(), ParticleCollisionElement::inv_nor, negate_v3(), nor, normalize_v3(), sub_v3_v3v3(), ParticleCollisionElement::x0, ParticleCollisionElement::x1, and ParticleCollisionElement::x2.
Referenced by collision_newton_rhapson(), collision_point_distance_with_normal(), and collision_sphere_to_tri().
|
static |
Definition at line 4784 of file particle_system.cc.
References BKE_libblock_free_data(), BKE_libblock_free_datablock(), BLI_assert, ParticleSettings::id, MEM_freeN(), and ID::py_instance.
Referenced by particle_system_update().
|
static |
Definition at line 4777 of file particle_system.cc.
References BKE_id_copy_ex(), ParticleSettings::id, and LIB_ID_COPY_LOCALIZE.
Referenced by particle_system_update().
| void particle_system_update | ( | struct Depsgraph * | depsgraph, |
| struct Scene * | scene, | ||
| struct Object * | ob, | ||
| struct ParticleSystem * | psys, | ||
| bool | use_render_params ) |
Main particle update call, checks that things are ok on the large scale and then advances in to actual particle calculations depending on particle type.
Definition at line 4792 of file particle_system.cc.
References ParticleSettings::adt, ADT_RECALC_ANIM, BKE_animsys_eval_context_construct(), BKE_animsys_evaluate_animdata(), BKE_mesh_tessface_ensure(), BKE_particle_batch_cache_dirty_tag(), BKE_PARTICLE_BATCH_DIRTY_ALL, ParticleSystem::cfra, DEG_get_ctime(), DEG_is_active(), depsgraph, ParticleSimulationData::depsgraph, distribute_particles(), ParticleSystem::edit, emit_particles(), eParticleSystemFlag_Pars, eParticleSystemFlag_psys_updated, evaluate_emitter_anim(), ParticleData::flag, ParticleDrawData::flag, ParticleSystem::flag, ParticleSystemModifierData::flag, PTCacheEdit::flags, float, ParticleSystem::free_edit, free_hair(), free_keyed_keys(), free_unexisting_particles(), hair_needs_recalc(), hair_step(), ParticleSettings::hair_step, ParticleSettings::id, ID_RECALC_PSYS_RESET, ParticleSystem::imat, initialize_all_particles(), invert_m4_m4(), LOOP_EXISTING_PARTICLES, ParticleSystemModifierData::mesh_final, ParticleSimulationData::ob, PAMAP_SIZE, PARS_NO_DISP, ParticleSystem::part, PART_FROM_VERT, PART_HAIR, PART_HAIR_REGROW, PART_PHYS_KEYED, PART_PHYS_NO, PARTICLE_P, particle_settings_free_local(), particle_settings_localize(), particles_fluid_step(), particles_has_bubble(), particles_has_flip(), particles_has_foam(), particles_has_spray(), particles_has_tracer(), ParticleSystem::pdd, ParticleSimulationData::psmd, PTCacheEdit::psmd_eval, ParticleSimulationData::psys, PTCacheEdit::psys, psys_check_enabled(), psys_count_keyed_targets(), PSYS_EDITED, PTCacheEdit::psys_eval, psys_frand(), psys_free_path_cache(), psys_get_current_display_percentage(), psys_get_modifier(), psys_get_texture(), PSYS_HAIR_DONE, PSYS_OB_ANIM_RESTORE, psys_orig_get(), psys_prepare_physics(), psys_reset(), PSYS_RESET_ALL, psys_update_path_cache(), PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL, ParticleSystem::recalc, reset_particle(), save_hair(), ParticleSimulationData::scene, scene, set_keyed_keys(), ParticleData::size, ParticleTexture::size, system_step(), ParticleSettings::totpart, ParticleSystem::totpart, and ParticleSystem::totunexist.
Referenced by BKE_object_handle_data_update(), and deform_verts().
|
static |
Definition at line 78 of file particle_system.cc.
References ELEM, ParticleSystem::flag, PointCache::flag, ParticleSystem::part, PART_HAIR, PART_PHYS_BOIDS, PART_PHYS_FLUID, PART_PHYS_NEWTON, ParticleSettings::phystype, ParticleSystem::pointcache, PSYS_HAIR_DYNAMICS, PTCACHE_BAKED, and ParticleSettings::type.
Referenced by psys_get_current_display_percentage().
|
static |
Definition at line 4196 of file particle_system.cc.
References add_v3_v3(), add_v3_v3v3(), ParticleData::alive, ParticleKey::ave, BKE_modifiers_findby_type(), BLI_rng_free(), BLI_rng_get_double(), BLI_rng_new_srandom(), BLI_snprintf(), FluidDomainSettings::cell_size, ParticleKey::co, copy_v3_v3(), ParticleData::dietime, FluidModifierData::domain, double(), FluidDomainSettings::dx, RenderData::efra, eModifierType_Fluid, fabsf, float, FluidDomainSettings::fluid, FLUID_DOMAIN_PARTICLE_BUBBLE, FLUID_DOMAIN_PARTICLE_FLIP, FLUID_DOMAIN_PARTICLE_FOAM, FLUID_DOMAIN_PARTICLE_SPRAY, FLUID_DOMAIN_PARTICLE_TRACER, ParticleData::lifetime, madd_v3fl_v3fl_v3fl_v3i(), manta_get_res_x(), manta_get_res_y(), manta_get_res_z(), manta_liquid_get_flip_particle_flag_at(), manta_liquid_get_flip_particle_position_x_at(), manta_liquid_get_flip_particle_position_y_at(), manta_liquid_get_flip_particle_position_z_at(), manta_liquid_get_flip_particle_velocity_x_at(), manta_liquid_get_flip_particle_velocity_y_at(), manta_liquid_get_flip_particle_velocity_z_at(), manta_liquid_get_num_flip_particles(), manta_liquid_get_num_snd_particles(), manta_liquid_get_particle_res_x(), manta_liquid_get_particle_res_y(), manta_liquid_get_particle_res_z(), manta_liquid_get_particle_upres(), manta_liquid_get_snd_particle_flag_at(), manta_liquid_get_snd_particle_position_x_at(), manta_liquid_get_snd_particle_position_y_at(), manta_liquid_get_snd_particle_position_z_at(), manta_liquid_get_snd_particle_velocity_x_at(), manta_liquid_get_snd_particle_velocity_y_at(), manta_liquid_get_snd_particle_velocity_z_at(), MEM_freeN(), min, mul_m4_v3(), mul_v3_fl(), mul_v3_v3(), ParticleSimulationData::ob, FluidDomainSettings::p0, FluidDomainSettings::p1, PARS_ALIVE, ParticleSystem::part, PART_FLUID_FLIP, FluidDomainSettings::particle_type, PARTICLE_TYPE_BUBBLE, PARTICLE_TYPE_DELETE, PARTICLE_TYPE_FOAM, PARTICLE_TYPE_SPRAY, PARTICLE_TYPE_TRACER, ParticleSystem::particles, particles_has_bubble(), particles_has_flip(), particles_has_foam(), particles_has_spray(), particles_has_tracer(), printf, ParticleSimulationData::psys, psys_frand(), Scene::r, realloc_particles(), FluidDomainSettings::res_max, FluidDomainSettings::res_min, ParticleSimulationData::rng, ParticleKey::rot, Object::scale, ParticleSimulationData::scene, ParticleSystem::seed, ParticleData::size, ParticleData::state, sub_v3_v3(), sub_v3_v3v3(), ParticleData::time, ParticleSystem::totpart, unit_qt(), UNUSED_VARS, ParticleKey::vel, and zero_v3().
Referenced by particle_system_update().
|
static |
Definition at line 4186 of file particle_system.cc.
References ELEM, PART_FLUID_BUBBLE, PART_FLUID_FOAMBUBBLE, and PART_FLUID_SPRAYFOAMBUBBLE.
Referenced by particle_system_update(), and particles_fluid_step().
|
static |
Definition at line 4171 of file particle_system.cc.
References PART_FLUID_FLIP.
Referenced by particle_system_update(), and particles_fluid_step().
|
static |
Definition at line 4191 of file particle_system.cc.
References ELEM, PART_FLUID_FOAM, PART_FLUID_SPRAYFOAM, and PART_FLUID_SPRAYFOAMBUBBLE.
Referenced by particle_system_update(), and particles_fluid_step().
|
static |
Definition at line 4181 of file particle_system.cc.
References ELEM, PART_FLUID_SPRAY, PART_FLUID_SPRAYFOAM, and PART_FLUID_SPRAYFOAMBUBBLE.
Referenced by particle_system_update(), and particles_fluid_step().
|
static |
Definition at line 4176 of file particle_system.cc.
References PART_FLUID_TRACER.
Referenced by particle_system_update(), and particles_fluid_step().
|
static |
Definition at line 5020 of file particle_system.cc.
References ParticleSystemIDLoopForModifier::func.
Referenced by BKE_particlesystem_id_loop().
| void psys_calc_dmcache | ( | Object * | ob, |
| Mesh * | mesh_final, | ||
| Mesh * | mesh_original, | ||
| ParticleSystem * | psys ) |
Definition at line 305 of file particle_system.cc.
References CD_ORIGINDEX, CustomData_get_layer(), Object::data, DMCACHE_ISCHILD, DMCACHE_NOTFOUND, Mesh::face_data, Mesh::fdata_legacy, ParticleSettings::from, LinkNode::link, LOOP_PARTICLES, MEM_callocN, MEM_freeN(), node, ORIGINDEX_NONE, ParticleSystem::part, PART_FROM_VERT, PARTICLE_P, POINTER_AS_INT, POINTER_FROM_INT, psys_particle_dm_face_lookup(), Mesh::runtime, Mesh::totface_legacy, ParticleSettings::use_modifier_stack, Mesh::vert_data, and Mesh::verts_num.
Referenced by distribute_particles_on_dm(), distribute_simple_children(), and hair_step().
| void psys_changed_type | ( | struct Object * | ob, |
| struct ParticleSystem * | psys ) |
System type has changed so set sensible defaults and clear non applicable flags.
Definition at line 4653 of file particle_system.cc.
References BKE_ptcache_id_clear(), BKE_ptcache_id_from_particles(), CLAMP, ELEM, ParticleSystem::flag, free_hair(), ParticleSystem::part, PART_DISTR_GRID, PART_DISTR_JIT, PART_DRAW_GR, PART_DRAW_NOT, PART_DRAW_OB, PART_DRAW_PATH, PART_DRAW_REND, PART_HAIR, PART_PHYS_KEYED, psys_reset(), PSYS_RESET_ALL, and PTCACHE_CLEAR_ALL.
Referenced by blender::ed::curves::convert_to_particle_system::try_convert_single_object().
| void psys_check_boid_data | ( | ParticleSystem * | psys | ) |
Definition at line 4691 of file particle_system.cc.
References ParticleData::boid, LOOP_PARTICLES, MEM_callocN, MEM_freeN(), ParticleSystem::part, PART_PHYS_BOIDS, PARTICLE_P, ParticleSystem::particles, ParticleSettings::phystype, and ParticleSystem::totpart.
Referenced by new_particle_settings_exec(), and psys_prepare_physics().
|
static |
Definition at line 1300 of file particle_system.cc.
References BKE_ptcache_free_mem(), PointCache::flag, PointCache::mem_cache, ParticleSystem::pointcache, and PTCACHE_DISK_CACHE.
Referenced by system_step().
| void psys_count_keyed_targets | ( | struct ParticleSimulationData * | sim | ) |
Counts valid keyed targets.
Definition at line 1180 of file particle_system.cc.
References ParticleTarget::duration, ListBase::first, ParticleSystem::flag, ParticleSettings::keyed_loops, ParticleTarget::next, ParticleSimulationData::ob, ParticleSystem::part, ParticleSimulationData::psys, psys_get_target_system(), PSYS_KEYED_TIMING, ParticleSystem::targets, and ParticleSystem::totkeyed.
Referenced by particle_system_update().
| void psys_get_birth_coords | ( | ParticleSimulationData * | sim, |
| ParticleData * | pa, | ||
| ParticleKey * | state, | ||
| float | dtime, | ||
| float | cfra ) |
Definition at line 709 of file particle_system.cc.
References axis_angle_to_quat(), BLI_assert, ParticleData::boid, copy_qt_qt(), copy_v3_v3(), cosf, cross_v3_v3v3(), dot_v3v3(), fabsf, ParticleData::foffset, ParticleData::fuv, get_angular_velocity_vector(), interp_qt_qtqt(), invert_qt_qt_normalized(), ParticleTexture::ivel, M_PI, madd_v3_v3fl(), mat3_to_quat(), mat3_to_quat_legacy(), mat4_to_quat(), mul_m4_v3(), mul_mat3_m4_v3(), mul_qt_qtqt(), mul_qt_v3(), mul_v3_fl(), mul_v3_v3fl(), negate_v3(), negate_v3_v3(), nor, normalize_qt(), normalize_v3(), normalize_v3_v3(), ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, OB_POSX, OB_POSZ, PAMAP_IVEL, ParticleSystem::part, PART_AVE_RAND, PART_PHYS_BOIDS, PART_ROT_GLOB_X, PART_ROT_GLOB_Y, PART_ROT_GLOB_Z, PART_ROT_NOR, PART_ROT_NOR_TAN, PART_ROT_OB_X, PART_ROT_OB_Y, PART_ROT_OB_Z, PART_ROT_VEL, ParticleSystem::particles, ParticleData::prev_state, project_v3_v3v3(), ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_frand(), psys_get_texture(), psys_particle_on_emitter(), psys_particle_value_from_verts(), rot, sinf, ParticleData::state, state, sub_v3_v3(), sub_v3_v3v3(), unit_qt(), vec_to_quat(), ParticleKey::vel, and zero_v3().
Referenced by explodeMesh(), and reset_particle().
| int psys_get_child_number | ( | Scene * | scene, |
| ParticleSystem * | psys, | ||
| const bool | use_render_params ) |
Definition at line 278 of file particle_system.cc.
References ParticleSettings::child_percent, ParticleSettings::child_render_percent, ParticleSettings::childtype, get_render_child_particle_number(), and ParticleSystem::part.
Referenced by distribute_simple_children(), and psys_get_tot_child().
| float psys_get_current_display_percentage | ( | ParticleSystem * | psys, |
| const bool | use_render_params ) |
Definition at line 91 of file particle_system.cc.
References ParticleSettings::disp, PointCache::flag, ParticleSystem::part, particles_are_dynamic(), ParticleSystem::pointcache, and PTCACHE_BAKING.
Referenced by cached_step(), hair_step(), particle_system_update(), and system_step().
| void psys_get_pointcache_start_end | ( | Scene * | scene, |
| ParticleSystem * | psys, | ||
| int * | sfra, | ||
| int * | efra ) |
Definition at line 1306 of file particle_system.cc.
References max_ii(), min_ii(), and ParticleSystem::part.
Referenced by BKE_ptcache_bake(), and system_step().
| ParticleSystem * psys_get_target_system | ( | Object * | ob, |
| ParticleTarget * | pt ) |
Definition at line 1155 of file particle_system.cc.
References BLI_findlink(), ELEM, ParticleTarget::flag, ParticleTarget::ob, Object::particlesystem, ParticleTarget::psys, and PTARGET_VALID.
Referenced by dynamics_step(), psys_count_keyed_targets(), psys_sph_init(), rule_avoid_collision(), rule_fight(), and rule_separate().
| int psys_get_tot_child | ( | Scene * | scene, |
| ParticleSystem * | psys, | ||
| const bool | use_render_params ) |
Definition at line 296 of file particle_system.cc.
References psys_get_child_number(), and ParticleSystem::totpart.
Referenced by distribute_invalid(), distribute_simple_children(), psys_thread_context_init_distribute(), psys_update_path_cache(), and update_children().
|
static |
Definition at line 3283 of file particle_system.cc.
References HairKey::co, ParticleData::hair, len_v3v3(), and ParticleData::totkey.
Referenced by hair_create_input_mesh().
| void psys_make_temp_pointcache | ( | Object * | ob, |
| ParticleSystem * | psys ) |
Definition at line 1288 of file particle_system.cc.
References BKE_ptcache_disk_to_mem(), BKE_ptcache_id_from_particles(), BLI_listbase_is_empty(), PointCache::flag, PointCache::mem_cache, ParticleSystem::pointcache, and PTCACHE_DISK_CACHE.
|
static |
Definition at line 4741 of file particle_system.cc.
References BKE_ptcache_id_clear(), BKE_ptcache_id_from_particles(), BLI_assert, ELEM, ParticleSystem::flag, free_keyed_keys(), ParticleSimulationData::ob, ParticleSystem::part, PART_PHYS_BOIDS, PART_PHYS_FLUID, PART_PHYS_KEYED, PART_PHYS_NO, ParticleSimulationData::psys, psys_check_boid_data(), and PTCACHE_CLEAR_ALL.
Referenced by particle_system_update().
| void psys_reset | ( | ParticleSystem * | psys, |
| int | mode ) |
Definition at line 118 of file particle_system.cc.
References ParticleSystem::alloc_fluidsprings, BKE_ptcache_invalidate(), ParticleSystem::child, ParticleSystem::edit, ELEM, ParticleSystem::flag, ParticleSystem::fluid_springs, ParticleSystem::free_edit, LOOP_PARTICLES, MEM_SAFE_FREE, PARS_NO_DISP, PARTICLE_P, ParticleSystem::pointcache, PSYS_EDITED, psys_free_particles(), psys_free_path_cache(), PSYS_HAIR_DONE, PSYS_KEYED, PSYS_RESET_ALL, PSYS_RESET_CACHE_MISS, PSYS_RESET_DEPSGRAPH, ParticleSystem::tot_fluidsprings, tot_particles(), ParticleSystem::totchild, ParticleSystem::totkeyed, and ParticleSystem::totpart.
Referenced by BKE_ptcache_id_reset(), clear_edited_exec(), particle_system_update(), psys_changed_type(), and system_step().
Sample the density field at a point in space.
Definition at line 2177 of file particle_system.cc.
References SPHRangeData::data, SPHData::density_cb, SPHFluidSettings::flag, ParticleSettings::fluid, SPHRangeData::h, SPHData::hfac, SPHData::mass, SPHRangeData::mass, ParticleSystem::part, SPHData::psys, SPHFluidSettings::radius, ParticleSettings::size, sph_evaluate_func(), SPH_FAC_RADIUS, and tree.
| void psys_sph_finalize | ( | SPHData * | sphdata | ) |
Definition at line 2172 of file particle_system.cc.
References psys_sph_flush_springs().
Referenced by dynamics_step().
|
static |
Definition at line 2162 of file particle_system.cc.
References BLI_buffer_at, BLI_buffer_field_free, BLI_Buffer::count, SPHData::new_springs, SPHData::psys, and sph_spring_add().
Referenced by psys_sph_finalize().
| void psys_sph_init | ( | ParticleSimulationData * | sim, |
| SPHData * | sphdata ) |
Definition at line 2121 of file particle_system.cc.
References BLI_buffer_field_init, SPHData::density_cb, SPHData::eh, ListBase::first, ParticleSettings::fluid, SPHData::force_cb, PhysicsSettings::gravity, SPHData::gravity, SPHData::hfac, SPHData::mass, SPHData::new_springs, ParticleTarget::next, ParticleSimulationData::ob, SPHData::pa, ParticleSystem::part, Scene::physics_settings, ParticleSimulationData::psys, SPHData::psys, psys_get_target_system(), psys_uses_gravity(), ParticleSimulationData::scene, SPHFluidSettings::solver, sph_density_accum_cb(), sph_force_cb(), SPH_SOLVER_DDR, sph_springhash_build(), sphclassical_density_accum_cb(), sphclassical_force_cb(), and ParticleSystem::targets.
Referenced by dynamics_step().
| void psys_tasks_create | ( | ParticleThreadContext * | ctx, |
| int | startpart, | ||
| int | endpart, | ||
| ParticleTask ** | r_tasks, | ||
| int * | r_numtasks ) |
Definition at line 448 of file particle_system.cc.
References ParticleTask::begin, BLI_assert, BLI_system_thread_count(), ParticleTask::ctx, ParticleTask::end, MEM_callocN, and min_ii().
Referenced by distribute_particles_on_dm(), and psys_cache_child_paths().
| void psys_tasks_free | ( | ParticleTask * | tasks, |
| int | numtasks ) |
Definition at line 478 of file particle_system.cc.
References BLI_rng_free(), and MEM_freeN().
Referenced by distribute_particles_on_dm(), and psys_cache_child_paths().
| void psys_thread_context_free | ( | ParticleThreadContext * | ctx | ) |
Definition at line 495 of file particle_system.cc.
References BKE_curvemapping_free(), ParticleThreadContext::clumpcurve, ParticleThreadContext::index, ParticleThreadContext::jit, ParticleThreadContext::jitoff, MEM_freeN(), psys_sim_data_free(), ParticleThreadContext::roughcurve, ParticleThreadContext::seams, ParticleThreadContext::sim, ParticleThreadContext::tree, ParticleThreadContext::twistcurve, ParticleThreadContext::vg_clump, ParticleThreadContext::vg_kink, ParticleThreadContext::vg_length, ParticleThreadContext::vg_rough1, ParticleThreadContext::vg_rough2, ParticleThreadContext::vg_roughe, ParticleThreadContext::vg_twist, and ParticleThreadContext::weight.
Referenced by distribute_particles_on_dm(), and psys_cache_child_paths().
| void psys_thread_context_init | ( | struct ParticleThreadContext * | ctx, |
| struct ParticleSimulationData * | sim ) |
Threaded child particle distribution and path caching.
Definition at line 440 of file particle_system.cc.
References BKE_object_material_get(), ParticleThreadContext::ma, ParticleThreadContext::mesh, ParticleSystemModifierData::mesh_final, ParticleSimulationData::ob, ParticleSettings::omat, ParticleSystem::part, ParticleSimulationData::psmd, ParticleSimulationData::psys, and ParticleThreadContext::sim.
Referenced by psys_thread_context_init_distribute(), and psys_thread_context_init_path().
| void psys_unique_name | ( | Object * | object, |
| ParticleSystem * | psys, | ||
| const char * | defname ) |
Definition at line 164 of file particle_system.cc.
References BLI_uniquename(), ParticleSystem::name, and offsetof.
|
static |
Definition at line 1399 of file particle_system.cc.
References BKE_effectors_create(), BKE_effectors_free(), ParticleSimulationData::depsgraph, ParticleSettings::effector_weights, ParticleSystem::effectors, ParticleSettings::flag, ParticleSimulationData::ob, ParticleSystem::part, PART_ROT_DYN, precalc_guides(), and ParticleSimulationData::psys.
Referenced by cached_step(), dynamics_step(), and hair_step().
|
static |
Definition at line 1326 of file particle_system.cc.
References BLI_bvhtree_free(), BLI_bvhtree_insert(), BLI_bvhtree_new(), BLI_rw_mutex_lock(), BLI_rw_mutex_unlock(), BLI_task_isolate(), ParticleSystem::bvhtree, bvhtree_balance_isolated(), ParticleSystem::bvhtree_frame, LOOP_SHOWN_PARTICLES, PARS_ALIVE, PARTICLE_P, psys_bvhtree_rwlock, THREAD_LOCK_READ, and THREAD_LOCK_WRITE.
Referenced by dynamics_step().
| void psys_update_particle_tree | ( | ParticleSystem * | psys, |
| float | cfra ) |
Definition at line 1368 of file particle_system.cc.
References LOOP_SHOWN_PARTICLES, PARS_ALIVE, PARTICLE_P, ParticleSystem::tree, and ParticleSystem::tree_frame.
Referenced by dynamics_step(), and precalculate_effector().
|
static |
Check if path cache or children need updating and do it if needed.
Definition at line 3190 of file particle_system.cc.
References ParticleSettings::childtype, DAG_EVAL_RENDER, DEG_get_mode(), ParticleSimulationData::depsgraph, distribute_particles(), ELEM, ParticleEditSettings::flag, ParticleSystem::flag, PointCache::flag, ID_RECALC_PSYS_CHILD, ID_RECALC_PSYS_RESET, Object::mode, ParticleSimulationData::ob, OB_MODE_WEIGHT_PAINT, ParticleSystem::part, PART_CHILD_FACES, PART_DRAW_GR, PART_DRAW_OB, PART_DRAW_PATH, PART_DRAW_REND, PART_FROM_CHILD, PART_HAIR, ToolSettings::particle, ParticleSystem::pathcache, PE_DRAW_PART, ParticleSystem::pointcache, ParticleSimulationData::psys, psys_cache_child_paths(), psys_cache_paths(), psys_find_parents(), psys_free_children(), psys_free_path_cache(), psys_get_tot_child(), PSYS_HAIR_DONE, PSYS_HAIR_DYNAMICS, psys_in_edit_mode(), PSYS_KEYED, PSYS_VG_DENSITY, PTCACHE_BAKED, PTCACHE_BAKING, realloc_particles(), ParticleSystem::recalc, ParticleSimulationData::scene, Scene::toolsettings, ParticleSystem::totchild, ParticleSystem::totpart, ParticleSettings::type, and ParticleSystem::vgroup.
Referenced by hair_step(), particle_system_update(), and system_step().
|
static |
Definition at line 174 of file particle_system.cc.
References ParticleData::boid, ParticleSystem::child, ParticleSystem::edit, ParticleSystem::free_edit, ParticleData::keys, LOOP_PARTICLES, MEM_callocN, MEM_freeN(), ParticleSystem::part, PART_DISTR_GRID, PART_FROM_VERT, PART_PHYS_BOIDS, PARTICLE_P, ParticleSystem::particles, ParticleSettings::phystype, ParticleSimulationData::psys, psys_free_pdd(), ParticleSystem::totchild, and ParticleSystem::totpart.
Referenced by emit_particles(), particles_fluid_step(), and psys_update_path_cache().
|
static |
Definition at line 1141 of file particle_system.cc.
References ParticleSystem::particles, ParticleSimulationData::psys, reset_particle(), and ParticleSystem::totpart.
Referenced by system_step().
| void reset_particle | ( | struct ParticleSimulationData * | sim, |
| struct ParticleData * | pa, | ||
| float | dtime, | ||
| float | cfra ) |
Sets particle to the emitter surface with initial velocity & rotation.
Definition at line 1058 of file particle_system.cc.
References BoidData::acc, ParticleData::alive, ParticleData::boid, ParticleSystem::cfra, BoidParticle::data, ParticleSimulationData::depsgraph, ParticleData::dietime, eBoidMode_InAir, evaluate_emitter_anim(), ListBase::first, ParticleSystem::flag, PhysicsSettings::flag, PointCache::flag, BoidParticle::gravity, PhysicsSettings::gravity, BoidData::health, init_particle_texture(), ParticleTexture::life, ParticleData::lifetime, PointCache::mem_cache, BoidData::mode, ParticleSimulationData::ob, PAMAP_LIFE, PARS_ALIVE, PARS_DEAD, PARS_UNBORN, ParticleSystem::part, PART_HAIR, PART_PHYS_BOIDS, ParticleSystem::particles, PHYS_GLOBAL_GRAVITY, Scene::physics_settings, ParticleSystem::pointcache, ParticleSimulationData::psys, psys_frand(), psys_get_birth_coords(), psys_get_dietime_from_cache(), psys_get_texture(), PSYS_OB_ANIM_RESTORE, PTCACHE_BAKED, ParticleSimulationData::scene, ParticleData::state, BoidData::state_id, ParticleData::time, and ParticleKey::time.
Referenced by brush_add(), cached_step(), dynamics_step(), particle_system_update(), and reset_all_particles().
|
static |
Definition at line 3576 of file particle_system.cc.
References HairKey::co, ParticleKey::co, copy_v3_v3(), ParticleData::hair, ParticleSettings::hair_step, invert_m4_m4(), LOOP_PARTICLES, MEM_callocN, ParticleSystemModifierData::mesh_final, mul_m4_v3(), ParticleSimulationData::ob, ParticleSystem::part, PARTICLE_P, ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_sim_data_free(), psys_sim_data_init(), psys_vec_rot_to_face(), Object::runtime, ParticleData::state, sub_v3_v3(), HairKey::time, ParticleKey::time, ParticleData::totkey, ParticleSystem::totpart, HairKey::weight, and zero_v3().
Referenced by particle_system_update().
|
static |
Definition at line 1204 of file particle_system.cc.
References BLI_findlink(), copy_particle_key(), ParticleSimulationData::depsgraph, ParticleTarget::duration, ListBase::first, ParticleSystem::flag, ParticleTarget::flag, float, free_keyed_keys(), LOOP_PARTICLES, MEM_callocN, ParticleTarget::next, ParticleSimulationData::ob, ParticleTarget::ob, PARTICLE_P, ParticleSystem::particles, Object::particlesystem, ParticleSimulationData::psys, ParticleTarget::psys, psys_get_particle_state(), PSYS_KEYED, PSYS_KEYED_TIMING, PTARGET_VALID, ParticleSimulationData::scene, ParticleSystem::targets, ParticleKey::time, ParticleTarget::time, ParticleData::totkey, ParticleSystem::totkeyed, and ParticleSystem::totpart.
Referenced by particle_system_update().
|
static |
Definition at line 1722 of file particle_system.cc.
References SPHRangeData::data, SPHRangeData::h, SPHNeighbor::index, SPHRangeData::massfac, SPHRangeData::neighbors, SPHRangeData::npsys, SPHRangeData::pa, ParticleSystem::particles, SPHNeighbor::psys, ParticleData::size, SPH_NEIGHBORS, sqrtf, SPHRangeData::tot_neighbors, UNUSED_VARS, and SPHRangeData::use_size.
Referenced by psys_sph_init(), and sph_force_cb().
|
static |
Definition at line 1694 of file particle_system.cc.
References BLI_bvhtree_range_query(), BLI_rw_mutex_lock(), BLI_rw_mutex_unlock(), callback, ParticleSettings::flag, ParticleSettings::mass, SPHRangeData::mass, SPHRangeData::massfac, SPHRangeData::npsys, ParticleSystem::part, PART_SIZEMASS, psys_bvhtree_rwlock, THREAD_LOCK_READ, SPHRangeData::tot_neighbors, tree, and SPHRangeData::use_size.
Referenced by psys_sph_density(), sph_force_cb(), sphclassical_calc_dens(), and sphclassical_force_cb().
|
static |
Definition at line 1789 of file particle_system.cc.
References BLI_buffer_append, SPHFluidSettings::buoyancy, ParticleKey::co, copy_v3_v3(), data, SPHRangeData::data, ParticleSpring::delete_flag, dot_v3v3(), SPHData::eh, ParticleSettings::flag, SPHFluidSettings::flag, ParticleSettings::fluid, ParticleSystem::fluid_springs, SPHData::gravity, SPHRangeData::h, SPHData::hfac, SPHNeighbor::index, madd_v3_v3fl(), madd_v3_v3v3fl(), ParticleSettings::mass, SPHData::mass, SPHRangeData::mass, SPHRangeData::neighbors, SPHData::new_springs, normalize_v3(), SPHData::pa, SPHRangeData::pa, ParticleSystem::part, PART_SIZEMASS, PART_TIME_AUTOSF, ParticleSpring::particle_index, ParticleSystem::particles, SPHData::pass, ParticleData::prev_state, SPHData::psys, SPHNeighbor::psys, SPHFluidSettings::radius, SPHFluidSettings::rest_density, ParticleSpring::rest_length, SPHFluidSettings::rest_length, ParticleData::size, SPH_CURRENT_REST_LENGTH, sph_density_accum_cb(), sph_evaluate_func(), SPH_FAC_DENSITY, SPH_FAC_RADIUS, SPH_FAC_REPULSION, SPH_FAC_REST_LENGTH, SPH_FAC_VISCOSITY, sph_particle_courant(), SPH_VISCOELASTIC_SPRINGS, SPHFluidSettings::spring_frames, SPHFluidSettings::spring_k, state, SPHFluidSettings::stiffness_k, SPHFluidSettings::stiffness_knear, sub_v3_v3v3(), ParticleData::time, ParticleKey::time, ParticleSettings::time_flag, SPHRangeData::tot_neighbors, ParticleKey::vel, SPHFluidSettings::viscosity_beta, and SPHFluidSettings::viscosity_omega.
Referenced by psys_sph_init().
|
static |
Definition at line 2198 of file particle_system.cc.
References copy_particle_key(), SPHData::force_cb, integrate_particle(), ParticleSettings::mass, SPHData::mass, mul_v3_fl(), SPHData::pa, ParticleSystem::part, PART_SIZEMASS, SPHData::pass, ParticleData::prev_state, ParticleSimulationData::psys, psys_get_timestep(), ParticleData::size, ParticleData::state, sub_v3_v3v3(), and ParticleKey::vel.
Referenced by dynamics_step_sph_classical_integrate_task_cb_ex(), and dynamics_step_sph_ddr_task_cb_ex().
|
static |
Definition at line 1763 of file particle_system.cc.
References add_v3_v3(), ParticleKey::co, copy_v3_v3(), SPHData::element_size, SPHData::flow, FLT_MAX, ParticleSettings::fluid, SPHNeighbor::index, len_v3(), mul_v3_v3fl(), SPHRangeData::neighbors, SPHRangeData::pa, ParticleSystem::part, ParticleSystem::particles, ParticleData::prev_state, SPHData::psys, SPHNeighbor::psys, SPHFluidSettings::radius, sub_v3_v3v3(), SPHRangeData::tot_neighbors, ParticleKey::vel, and zero_v3().
Referenced by sph_force_cb(), and sphclassical_force_cb().
|
static |
Definition at line 1571 of file particle_system.cc.
References ParticleSystem::alloc_fluidsprings, ParticleSystem::fluid_springs, MEM_callocN, MEM_reallocN, PSYS_FLUID_SPRINGS_INITIAL_SIZE, and ParticleSystem::tot_fluidsprings.
Referenced by psys_sph_flush_springs().
|
static |
Definition at line 1591 of file particle_system.cc.
References ParticleSystem::alloc_fluidsprings, ParticleSystem::fluid_springs, MEM_reallocN, PSYS_FLUID_SPRINGS_INITIAL_SIZE, and ParticleSystem::tot_fluidsprings.
Referenced by sph_springs_modify().
|
static |
Definition at line 1658 of file particle_system.cc.
References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), ParticleSystem::fluid_springs, ParticleSpring::particle_index, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), and ParticleSystem::tot_fluidsprings.
Referenced by psys_sph_init().
|
static |
Definition at line 1607 of file particle_system.cc.
References ParticleKey::co, ParticleSpring::delete_flag, SPHFluidSettings::flag, ParticleSettings::fluid, ParticleSystem::fluid_springs, normalize_v3(), ParticleSystem::part, ParticleSpring::particle_index, ParticleSystem::particles, SPHFluidSettings::plasticity_constant, ParticleData::prev_state, ParticleSpring::rest_length, ParticleData::size, sph_spring_delete(), SPH_VISCOELASTIC_SPRINGS, SPHFluidSettings::spring_k, sub_v3_v3v3(), ParticleSystem::tot_fluidsprings, and SPHFluidSettings::yield_ratio.
Referenced by dynamics_step().
|
static |
Definition at line 2099 of file particle_system.cc.
References ParticleKey::co, data, SPHRangeData::data, SPHFluidSettings::flag, ParticleSettings::fluid, SPHRangeData::h, SPHData::hfac, SPHData::mass, SPHRangeData::mass, max_ff(), min_ff(), SPHRangeData::pa, ParticleSystem::part, SPHData::psys, SPHFluidSettings::radius, SPHFluidSettings::rest_density, ParticleSettings::size, sph_evaluate_func(), SPH_FAC_RADIUS, sphclassical_density_accum_cb(), ParticleData::sphdensity, and ParticleData::state.
Referenced by dynamics_step_sph_classical_calc_density_task_cb_ex().
|
static |
Definition at line 1924 of file particle_system.cc.
References ParticleKey::co, SPHRangeData::data, float, SPHRangeData::h, len_v3(), M_PI, ParticleSettings::mass, SPHRangeData::npsys, SPHRangeData::pa, ParticleSystem::part, ParticleSystem::particles, pow3f(), pow4f(), ParticleData::size, ParticleData::sphdensity, ParticleData::state, sub_v3_v3v3(), and SPHRangeData::use_size.
Referenced by psys_sph_init(), and sphclassical_calc_dens().
|
static |
Definition at line 1988 of file particle_system.cc.
References SPHFluidSettings::buoyancy, ParticleKey::co, dot_v3v3(), ParticleSettings::flag, SPHFluidSettings::flag, float, ParticleSettings::fluid, SPHData::gravity, SPHRangeData::h, SPHData::hfac, SPHNeighbor::index, M_PI, madd_v3_v3fl(), madd_v3_v3v3fl(), SPHData::mass, SPHRangeData::neighbors, normalize_v3(), SPHData::pa, SPHRangeData::pa, ParticleSystem::part, PART_SIZEMASS, PART_TIME_AUTOSF, ParticleSystem::particles, SPHData::pass, pow2f(), pow3f(), pow4f(), pow7f(), ParticleData::prev_state, SPHData::psys, SPHNeighbor::psys, SPHFluidSettings::radius, SPHFluidSettings::rest_density, ParticleData::size, sph_evaluate_func(), SPH_FAC_DENSITY, SPH_FAC_RADIUS, sph_particle_courant(), sphclassical_neighbor_accum_cb(), ParticleData::sphdensity, state, SPHFluidSettings::stiffness_k, sub_v3_v3v3(), ParticleSettings::time_flag, SPHRangeData::tot_neighbors, ParticleKey::vel, and SPHFluidSettings::viscosity_omega.
Referenced by psys_sph_init().
|
static |
Definition at line 1960 of file particle_system.cc.
References ParticleKey::co, SPHRangeData::h, SPHNeighbor::index, len_v3(), SPHRangeData::neighbors, SPHRangeData::npsys, ParticleSystem::particles, SPHNeighbor::psys, SPH_NEIGHBORS, ParticleData::state, sub_v3_v3v3(), and SPHRangeData::tot_neighbors.
Referenced by sphclassical_force_cb().
|
static |
Definition at line 3693 of file particle_system.cc.
References ParticleSystem::dt_frac, and TIMESTEP_EXPANSION_TOLERANCE.
Referenced by system_step().
|
static |
Calculates the next state for all particles of the system. In particles code most 'cfra - ending' are frames, 'time - ending' are 'cfra * timestep' (seconds).
Definition at line 4496 of file particle_system.cc.
References ParticleSystem::alloc_fluidsprings, BKE_ptcache_id_clear(), BKE_ptcache_id_from_particles(), BKE_ptcache_id_reset(), BKE_ptcache_id_time(), BKE_ptcache_invalidate(), BKE_ptcache_read(), BKE_ptcache_validate(), BKE_ptcache_write(), cached_step(), ParticleSystem::cfra, CLAMP, ParticleSimulationData::courant_num, distribute_particles(), ParticleSystem::dt_frac, dynamics_step(), ELEM, emit_particles(), PointCache::endframe, eParticleSystemFlag_Pars, ParticleData::flag, ParticleSystemModifierData::flag, PointCache::flag, float, ParticleSystem::fluid_springs, free_unexisting_particles(), get_base_time_step(), ID_RECALC_PSYS_RESET, initialize_all_particles(), int, PointCache::last_exact, LOOP_PARTICLES, MEM_SAFE_FREE, MIN_TIMESTEP, ParticleSimulationData::ob, PARS_NO_DISP, ParticleSystem::part, PART_HAIR, PART_TIME_AUTOSF, PARTICLE_P, ParticleSystem::pointcache, ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_clear_temp_pointcache(), psys_frand(), psys_get_current_display_percentage(), psys_get_pointcache_start_end(), psys_reset(), PSYS_RESET_CACHE_MISS, psys_sim_data_free(), psys_update_path_cache(), PTCACHE_BAKED, PTCACHE_BAKING, PTCACHE_CLEAR_AFTER, PTCACHE_OUTDATED, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED, PTCACHE_READ_OLD, PTCACHE_REDO_NEEDED, PTCACHE_RESET_OUTDATED, ParticleSystem::recalc, reset_all_particles(), ParticleSimulationData::scene, PointCache::simframe, PointCache::startframe, sync_timestep(), ParticleSystem::tot_fluidsprings, ParticleSystem::totpart, update_children(), and update_timestep().
Referenced by particle_system_update().
|
static |
Definition at line 106 of file particle_system.cc.
References PTCacheID::cache, ParticleSettings::distr, PointCache::flag, ParticleSettings::from, ParticleSettings::grid_res, ParticleSystem::part, PART_DISTR_GRID, PART_FROM_VERT, ParticleSystem::pointcache, PTCACHE_EXTERNAL, ParticleSettings::totpart, PointCache::totpoint, and ParticleSystem::totunexist.
Referenced by emit_particles(), and psys_reset().
|
static |
Definition at line 4103 of file particle_system.cc.
References ParticleSettings::childtype, distribute_particles(), ParticleSystem::flag, ParticleSystem::part, PART_FROM_CHILD, PART_HAIR, ParticleSimulationData::psys, psys_free_children(), psys_get_tot_child(), PSYS_HAIR_DONE, ParticleSimulationData::scene, ParticleSystem::totchild, and ParticleSettings::type.
Referenced by system_step().
|
static |
Calculate the speed of the particle relative to the local scale of the simulation. This should be called once per particle during a simulation step, after the velocity has been updated. element_size defines the scale of the simulation, and is typically the distance to neighboring particles.
Definition at line 3644 of file particle_system.cc.
References BLI_spin_lock(), BLI_spin_unlock(), ParticleSimulationData::courant_num, SPHData::element_size, SPHData::flow, len_v3(), ParticleData::prev_state, spin, sub_v3_v3v3(), and ParticleKey::vel.
Referenced by dynamics_step_sph_classical_integrate_task_cb_ex(), and dynamics_step_sph_ddr_task_cb_ex().
|
static |
Definition at line 3665 of file particle_system.cc.
References ParticleSimulationData::courant_num, ParticleSettings::courant_target, ParticleSystem::dt_frac, get_base_time_step(), interpf(), MIN_TIMESTEP, ParticleSystem::part, and TIMESTEP_EXPANSION_FACTOR.
Referenced by system_step().
|
static |
Code for an adaptive time step based on the Courant-Friedrichs-Lewy condition.
Definition at line 3630 of file particle_system.cc.
Referenced by system_step(), and update_timestep().
|
static |
Definition at line 72 of file particle_system.cc.
Referenced by psys_update_particle_bvhtree(), and sph_evaluate_func().
|
static |
Tolerance of 1.5 means the last sub-frame neither favors growing nor shrinking (e.g if it were 1.3, the last sub-frame would tend to be too small).
Definition at line 3635 of file particle_system.cc.
Referenced by update_timestep().
|
static |
Definition at line 3636 of file particle_system.cc.
Referenced by sync_timestep().