97 if ((use_render_params &&
137 psys->
edit =
nullptr;
183 int totpart, totsaved = 0;
185 if (new_totpart < 0) {
188 totpart *= totpart * totpart;
195 totpart = new_totpart;
198 if (totpart != psys->
totpart) {
201 psys->
edit =
nullptr;
207 if (newpars ==
nullptr) {
214 if (newboids ==
nullptr) {
225 totsaved = std::min(psys->
totpart, totpart);
243 for (p = 0, pa = newpars; p < totsaved; p++, pa++) {
250 for (p = totsaved, pa = psys->
particles + totsaved; p < psys->totpart; p++, pa++) {
266 pa->boid = newboids++;
273 psys->
child =
nullptr;
286 if (use_render_params) {
318 if (!mesh_final->
runtime->deformed_only) {
320 LinkNode *node, *nodedmelem, **nodearray;
321 int totdmelem, totelem,
i;
322 const int *origindex;
323 const int *origindex_poly =
nullptr;
327 if (use_modifier_stack) {
333 origindex =
static_cast<const int *
>(
340 if (use_modifier_stack) {
343 origindex_poly =
nullptr;
347 origindex =
static_cast<const int *
>(
351 origindex_poly =
static_cast<const int *
>(
353 if (origindex_poly ==
nullptr) {
362 for (
i = 0, node = nodedmelem;
i < totdmelem;
i++, node++) {
367 if (use_modifier_stack) {
375 origindex_final = origindex_poly[origindex_final];
379 if (origindex_final !=
ORIGINDEX_NONE && origindex_final < totelem) {
380 if (nodearray[origindex_final]) {
382 node->
next = nodearray[origindex_final];
383 nodearray[origindex_final] = node;
386 nodearray[origindex_final] = node;
399 if (use_modifier_stack) {
400 if (pa->num < totelem) {
409 if (pa->num < totelem && nodearray[pa->num]) {
418 mesh_final, mesh_original, pa->num, pa->fuv, nodearray);
451 int particles_per_task = numtasks > 0 ? (endpart - startpart) / numtasks : 0;
452 int remainder = numtasks > 0 ? (endpart - startpart) - particles_per_task * numtasks : 0;
457 for (
int i = 0;
i < numtasks;
i++) {
460 p = p + particles_per_task + (
i < remainder ? 1 : 0);
466 BLI_assert(tasks[numtasks - 1].end == endpart);
531 BLI_kdtree_3d_free(ctx->
tree);
552 switch (part->
type) {
601 if (!(emit_from_volume_grid && (pa->flag &
PARS_UNEXIST) != 0)) {
637 for (p = 0, pa = psys->
particles; p < newtotpart; p++, pa++, npa++) {
657 pa->boid = newboids++;
671 zvec[0] = zvec[1] = 0;
677 float zvec[3], temp[3];
678 zvec[0] = zvec[1] = 0;
706 float fac, phasefac,
nor[3] = {0, 0, 0}, loc[3], vel[3] = {0.0, 0.0, 0.0},
rot[4], q2[4];
707 float r_vel[3], r_ave[3], r_rot[4], vec[3], p_vel[3] = {0.0, 0.0, 0.0};
708 float x_vec[3] = {1.0, 0.0, 0.0}, utan[3] = {0.0, 1.0, 0.0}, vtan[3] = {0.0, 0.0, 1.0},
709 rot_vec[3] = {0.0, 0.0, 0.0};
713 const bool use_tangents = ((use_boids ==
false) &&
752 mul_m4_v3(ob->object_to_world().ptr(), loc);
761 float phase = vg_rot ?
784 r_vel[0] = 2.0f * (
psys_frand(psys, p + 10) - 0.5f);
785 r_vel[1] = 2.0f * (
psys_frand(psys, p + 11) - 0.5f);
786 r_vel[2] = 2.0f * (
psys_frand(psys, p + 12) - 0.5f);
794 r_ave[0] = 2.0f * (
psys_frand(psys, p + 13) - 0.5f);
795 r_ave[1] = 2.0f * (
psys_frand(psys, p + 14) - 0.5f);
796 r_ave[2] = 2.0f * (
psys_frand(psys, p + 15) - 0.5f);
804 r_rot[0] = 2.0f * (
psys_frand(psys, p + 16) - 0.5f);
805 r_rot[1] = 2.0f * (
psys_frand(psys, p + 17) - 0.5f);
806 r_rot[2] = 2.0f * (
psys_frand(psys, p + 18) - 0.5f);
807 r_rot[3] = 2.0f * (
psys_frand(psys, p + 19) - 0.5f);
815 float dvec[3], q[4], mat[3][3];
853 if (dtime != 0.0f && part->
obfac != 0.0f) {
869 if (part->
ob_vel[0] != 0.0f) {
873 if (part->
ob_vel[1] != 0.0f) {
877 if (part->
ob_vel[2] != 0.0f) {
904 bool use_global_space;
911 use_global_space =
false;
915 use_global_space =
true;
921 use_global_space =
true;
927 use_global_space =
false;
930 use_global_space =
true;
936 if (use_global_space) {
957 float rot_vec_local[3];
974 float *rot_vec_local = tmat[0];
975 float *vtan_local = tmat[1];
976 float *utan_local = tmat[2];
1119 if (pa->
time > cfra) {
1122 else if (pa->
dietime <= cfra) {
1136 for (p = from, pa = sim->
psys->
particles + from; p < totpart; p++, pa++) {
1149 if (
ELEM(pt->
ob,
nullptr, ob)) {
1177 for (; pt; pt = pt->
next) {
1180 if (kpsys && kpsys->totpart) {
1222 pa->totkey = totkeys;
1230 for (k = 0; k < totkeys; k++) {
1231 ksim.
ob = pt->
ob ? pt->
ob : sim->
ob;
1247 if (pt->
duration != 0.0f && k + 1 < totkeys) {
1252 else if (totkeys > 1) {
1253 key->
time = pa->time +
float(k) /
float(totkeys - 1) * pa->lifetime;
1256 key->
time = pa->time;
1340 if (pa->state.time == cfra) {
1371 BLI_kdtree_3d_free(psys->
tree);
1372 psys->
tree = BLI_kdtree_3d_new(totpart);
1377 const float *co = (pa->state.time == cfra) ? pa->prev_state.co : pa->state.co;
1378 BLI_kdtree_3d_insert(psys->
tree, p, co);
1381 BLI_kdtree_3d_balance(psys->
tree);
1401 float *external_acceleration,
1402 void (*force_func)(
void *forcedata,
ParticleKey *
state,
float *force,
float *impulse),
1407 {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} \
1411 float force[3], acceleration[3], impulse[3], dx[4][3] =
ZERO_F43, dv[4][3] =
ZERO_F43, oldpos[3];
1425 switch (integrator) {
1440 for (
i = 0;
i < steps;
i++) {
1444 states->
time = 0.0f;
1446 for (
i = 0;
i < steps;
i++) {
1450 force_func(forcedata, states +
i, force, impulse);
1455 if (external_acceleration) {
1456 add_v3_v3(acceleration, external_acceleration);
1462 switch (integrator) {
1471 states[1].
time = dtime * 0.5f;
1489 states[1].
time = dtime * 0.5f;
1500 states[2].
time = dtime * 0.5f;
1510 states[3].
time = dtime;
1556#define PSYS_FLUID_SPRINGS_INITIAL_SIZE 256
1563 "Particle Fluid Springs");
1599 float h, d, Rij[3], rij, Lij;
1605 float timefix = 25.0f * dtime;
1621 d = yield_ratio * timefix * Lij;
1623 if (rij > Lij + d) {
1624 spring->
rest_length += plasticity * (rij - Lij - d) * timefix;
1626 else if (rij < Lij - d) {
1627 spring->
rest_length -= plasticity * (Lij - d - rij) * timefix;
1630 h = 4.0f * pa1->
size;
1659#define SPH_NEIGHBORS 512
1684 float interaction_radius,
1691 for (
i = 0;
i < 10 && psys[
i];
i++) {
1717 if (npa == pfr->
pa || squared_dist < FLT_EPSILON) {
1735 dist =
sqrtf(squared_dist);
1736 q = (1.0f - dist / pfr->
h) * pfr->
massfac;
1742 pfr->
data[0] += q * q;
1743 pfr->
data[1] += q * q * q;
1753 float flow[3], offset[3], dist;
1784 const float *gravity = sphdata->
gravity;
1787 float q, u, rij, dv[3];
1788 float pressure, near_pressure;
1794 float inv_mass = 1.0f / sphdata->
mass;
1795 float spring_constant = fluid->
spring_k;
1798 float interaction_radius = fluid->
radius *
1800 float h = interaction_radius * sphdata->
hfac;
1815 float density, near_density;
1817 int i, spring_index, index = pa - psys[0]->
particles;
1828 near_density =
data[1];
1830 pressure = stiffness * (density - rest_density);
1831 near_pressure = stiffness_near_fac * near_density;
1842 q = (1.0f - rij / h) * pfn->
psys->
part->
mass * inv_mass;
1851 madd_v3_v3fl(force, vec, -(pressure + near_pressure * q) * q);
1854 if (visc > 0.0f || stiff_visc > 0.0f) {
1858 if (u < 0.0f && visc > 0.0f) {
1862 if (u > 0.0f && stiff_visc > 0.0f) {
1867 if (spring_constant > 0.0f) {
1877 -10.0f * spring_constant * (1.0f - rij / h) * (spring->
rest_length - rij));
1893 force, vec, -10.0f * spring_constant * (1.0f - rij / h) * (rest_length - rij));
1899 if (fluid->
buoyancy > 0.0f && gravity) {
1917 float qfac = 21.0f / (256.0f *
float(
M_PI));
1926 rij_h = rij / pfr->
h;
1934 q = qfac /
pow3f(pfr->
h) *
pow4f(2.0f - rij_h) * (1.0f + 2.0f * rij_h);
1964 rij_h = rij / pfr->
h;
1984 const float *gravity = sphdata->
gravity;
1986 float dq, u, rij, dv[3];
1987 float pressure, npressure;
1991 float interaction_radius;
2006 float qfac2 = 42.0f / (256.0f *
float(
M_PI));
2011 h = interaction_radius * sphdata->
hfac;
2039 rij_h = rij / pfr.
h;
2044 npressure = stiffness * (
pow7f(npa->
sphdensity / rest_density) - 1.0f);
2051 dq = qfac2 * (2.0f *
pow4f(2.0f - rij_h) - 4.0f *
pow3f(2.0f - rij_h) * (1.0f + 2.0f * rij_h));
2074 if (fluid->
buoyancy > 0.0f && gravity) {
2089 float interaction_radius = fluid->
radius *
2097 pfr.
h = interaction_radius * sphdata->
hfac;
2116 i++, pt = (pt ? pt->
next :
nullptr))
2128 sphdata->
eh = &r_eh;
2132 sphdata->
pa =
nullptr;
2133 sphdata->
mass = 1.0f;
2138 sphdata->
hfac = 1.0f;
2144 sphdata->
hfac = 0.5f;
2168 float interaction_radius = fluid->
radius *
2173 density[0] = density[1] = 0.0f;
2175 pfr.
h = interaction_radius * sphdata->
hfac;
2180 vars[0] = pfr.
data[0];
2181 vars[1] = pfr.
data[1];
2194 float effector_acceleration[3];
2197 sphdata->
mass = pa_mass;
2203 mul_v3_fl(effector_acceleration, 1.0f / dtime);
2268 float *gravity =
nullptr, gr[3];
2302 CLAMP(time, 0.0f, 1.0f);
2320 float rotfac, rot1[4], rot2[4] = {1.0, 0.0, 0.0, 0.0}, dtime = dfra * timestep, extrotfac;
2342 if (len1 == 0.0f || len2 == 0.0f) {
2357 if (rotfac == 0.0f || (part->
flag &
PART_ROT_DYN) == 0 || extrotfac == 0.0f) {
2379#define COLLISION_MIN_RADIUS 0.001f
2380#define COLLISION_MIN_DISTANCE 0.0001f
2381#define COLLISION_ZERO 0.00001f
2382#define COLLISION_INIT_STEP 0.00008f
2392 float p0[3], e1[3], e2[3], d;
2424 float v0[3], v1[3],
v2[3], c[3];
2452 float f = fac + t * (1.0f - fac);
2495 float u,
e[3], vec[3];
2521 float u,
e[3], vec[3],
nor[3];
2534 float p0[3], e1[3], e2[3],
nor[3];
2560 float t0, t1, dt_init, d0, d1, dd, n[3];
2565 if (
col->inv_total_time > 0.0f) {
2577 d0 = distance_func(
col->co1, radius, pce, n);
2581 for (iter = 0; iter < 10; iter++) {
2586 d1 = distance_func(pce->
p, radius, pce, n);
2589 if (iter == 0 && d0 < 0.0f && d0 > -radius) {
2604 d0 = distance_func(
col->co2, radius, pce, n);
2605 t1 = 1.0f - dt_init;
2613 dd = (t1 - t0) / (d1 - d0);
2622 if (iter == 0 && t1 < 0.0f) {
2625 d0 = distance_func(
col->co2, radius, pce, n);
2626 t1 = 1.0f - dt_init;
2630 if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.0f)) {
2640 CLAMP(t1, 0.0f, 1.0f);
2663 if (ct >= 0.0f && ct < *t && (
result->inside == 0 || pce->
inside == 1)) {
2664 float e1[3], e2[3], p0[3];
2665 float e1e1, e1e2, e1p0, e2e2, e2p0, inv;
2678 inv = 1.0f / (e1e1 * e2e2 - e1e2 * e1e2);
2679 u = (e2e2 * e1p0 - e1e2 * e2p0) * inv;
2680 v = (e1e1 * e2p0 - e1e2 * e1p0) * inv;
2682 if (u >= 0.0f && u <= 1.0f && v >= 0.0f && u +
v <= 1.0f) {
2707 for (
i = 0;
i < 3;
i++) {
2709 cur->
x[0] = pce->
x[
i];
2710 cur->
x[1] = pce->
x[(
i + 1) % 3];
2711 cur->
v[0] = pce->
v[
i];
2712 cur->
v[1] = pce->
v[(
i + 1) % 3];
2718 if (ct >= 0.0f && ct < *t) {
2719 float u,
e[3], vec[3];
2725 if (u < 0.0f || u > 1.0f) {
2741 return hit !=
nullptr;
2754 for (
i = 0;
i < 3;
i++) {
2756 cur->
x[0] = pce->
x[
i];
2757 cur->
v[0] = pce->
v[
i];
2763 if (ct >= 0.0f && ct < *t) {
2774 return hit !=
nullptr;
2786 float t = hit->
dist /
col->original_ray_length;
2789 pce.
x[0] =
x[vert_tri[0]];
2790 pce.
x[1] =
x[vert_tri[1]];
2791 pce.
x[2] =
x[vert_tri[2]];
2793 pce.
v[0] =
v[vert_tri[0]];
2794 pce.
v[1] =
v[vert_tri[1]];
2795 pce.
v[2] =
v[vert_tri[2]];
2802 if (
col->pce.inside == 0) {
2808 hit->
dist =
col->original_ray_length * t;
2831 col->pce.inside = 0;
2835 if (hit->
dist == 0.0f) {
2836 hit->
dist =
col->original_ray_length = 0.000001f;
2843 for (
int i = 0;
i <
col->skip_count;
i++) {
2844 if (coll->ob ==
col->skip[
i]) {
2855 if (coll->ob ==
col->emitter && pa->
time <
col->cfra && pa->
time >=
col->old_cfra) {
2859 col->current = coll->ob;
2860 col->md = coll->collmd;
2861 col->fac1 = (
col->old_cfra - coll->collmd->time_x) /
2862 (coll->collmd->time_xnew - coll->collmd->time_x);
2863 col->fac2 = (
col->cfra - coll->collmd->time_x) /
2864 (coll->collmd->time_xnew - coll->collmd->time_x);
2866 if (
col->md &&
col->md->bvhtree) {
2878 return hit->
index >= 0;
2885 int dynamic_rotation)
2893 float x = hit->
dist /
col->original_ray_length;
2895 float f =
col->f +
x * (1.0f -
col->f);
2897 float dt1 = (f -
col->f) *
col->total_time;
2899 float dt2 = (1.0f - f) *
col->total_time;
2929 float v0_dot, vc_dot;
2934 CLAMP(damp, 0.0f, 1.0f);
2935 CLAMP(frict, 0.0f, 1.0f);
2955 if (dynamic_rotation) {
2956 float vr_tan[3], v1_tan[3], ave[3];
2974 mul_v3_fl(v1_tan, 1.0f - 0.01f * frict);
3000 if (v0_dot < 0.0f) {
3002 v0_dot = std::min(v0_dot, 0.0f);
3006 v0_dot *= 1.0f - damp;
3007 vc_dot *= through ? damp : 1.0f;
3011 if (through == 0 && ((vc_dot > 0.0f && v0_dot > 0.0f && vc_dot > v0_dot) ||
3012 (vc_dot < 0.0f && v0_dot < 0.0f && vc_dot < v0_dot)))
3016 else if (v0_dot > 0.0f) {
3020 mul_v3_v3fl(v0_nor, pce->
nor, vc_dot + (through ? 1.0f : -1.0f) * v0_dot);
3030 co[2] =
col->boid_z;
3079 col->skip[
col->skip_count++] =
col->hit;
3110 int collision_count = 0;
3116 col.total_time = timestep * dfra;
3117 col.inv_total_time = 1.0f /
col.total_time;
3118 col.inv_timestep = 1.0f / timestep;
3176 const bool use_render_params)
3181 int distr = 0, alloc = 0, skip = 0;
3275 const float min_length = 0.1f * max_length;
3284 for (k = 1, key = pa->
hair + 1; k < pa->totkey; k++, key++) {
3286 if (
length < min_length) {
3320 float hairmat[4][4];
3330 dvert = mesh->deform_verts_for_write().data();
3341 for (k = 1, key = pa->
hair + 1; k < pa->totkey; k++, key++) {
3343 max_length = std::max(max_length,
length);
3353 hair_radius = part->
size;
3360 float root_mat[4][4];
3361 float bending_stiffness;
3368 mul_m4_m4m4(root_mat, sim->
ob->object_to_world().ptr(), hairmat);
3371 bending_stiffness = std::clamp(
3374 for (k = 0, key = pa->
hair; k < pa->totkey; k++, key++) {
3376 float *co, *co_next;
3379 co_next = (key + 1)->co;
3387 hair->
radius = hair_radius;
3391 sub_v3_v3(positions[vert_index], co_next);
3392 mul_m4_v3(hairmat, positions[vert_index]);
3408 hair->
radius = hair_radius;
3412 mul_m4_v3(hairmat, positions[vert_index]);
3433 hair_index += pa->
totkey + 1;
3462 totpoint += pa->
totkey + 1;
3467 realloc_roots =
false;
3473 realloc_roots =
true;
3508 reinterpret_cast<float (*)[3]
>(psys->
hair_out_mesh->vert_positions_for_write().data()));
3576 if (pa->
totkey == 0 || pa->
hair ==
nullptr) {
3581 key = root = pa->
hair;
3627 float relative_vel[3];
3663 if (dt_target > psys->
dt_frac) {
3674 if (t_frac == 1.0f) {
3678 return 1.0f - t_frac;
3715 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3739 void *__restrict userdata,
const int p,
const TaskParallelTLS *__restrict )
3747 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3755 void *__restrict userdata,
const int p,
const TaskParallelTLS *__restrict tls)
3765 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3785 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3817 float birthtime, dietime;
3820 dfra = cfra - psys->
cfra;
3823 dtime = dfra * timestep;
3863 for (; pt; pt = pt->
next) {
3865 if (psys_target && psys_target != psys) {
3876 for (; pt; pt = pt->
next) {
3898 birthtime = pa->
time;
3904 if (dietime <= cfra && psys->cfra < dietime) {
3909 else if (birthtime <= cfra && birthtime >= psys->
cfra) {
3915 else if (dietime < cfra) {
3976 task_data.
sim = sim;
3977 task_data.
cfra = cfra;
3979 task_data.
dtime = dtime;
3991 for (const int i : range) {
3992 dynamics_step_sph_ddr_task_cb_ex(&task_data, i, &data);
4097 float disp, dietime;
4116 if (pa->
time > cfra) {
4122 else if (dietime <= cfra) {
4167 const bool use_render_params)
4190 int p, totpart = 0, tottypepart = 0;
4191 int flagActivePart, activeParts = 0;
4192 float posX, posY, posZ, velX, velY, velZ;
4193 float resX, resY, resZ;
4195 char debugStrBuffer[256];
4196 float tmp[3] = {0}, tmp2[3] = {0};
4199 float min[3],
max[3],
size[3], cell_size_scaled[3], max_size;
4214 sizeof(debugStrBuffer),
4215 "particles_fluid_step::error - found particle system that is not enabled in "
4230 for (p = 0; p < totpart; p++) {
4247 if (!totpart || !tottypepart) {
4252 tottypepart = (use_render_params) ? tottypepart : (part->
disp * tottypepart) / 100;
4255 part->
sta = part->
end = 1.0f;
4263 double r, dispProb = double(part->
disp) / 100.0;
4266 for (p = 0, pa = psys->
particles; p < totpart; p++) {
4313 sizeof(debugStrBuffer),
4314 "particles_fluid_step::error - unknown particle system type\n");
4320 printf(
"system type is %d and particle type is %d\n", part->
type, flagActivePart);
4339 printf(
"system type is %d and particle type is %d\n", part->
type, flagActivePart);
4343 if (activeParts >= tottypepart) {
4366 max_size = std::max(
4370 const float posParticle[3] = {posX, posY, posZ};
4374 float resDomain[3] = {resX, resY, resZ};
4380 float scaleAbs[3] = {
4399 printf(
"pa->state.co[0]: %f, pa->state.co[1]: %f, pa->state.co[2]: %f\n",
4405 const float velParticle[3] = {velX, velY, velZ};
4410 printf(
"pa->state.vel[0]: %f, pa->state.vel[1]: %f, pa->state.vel[2]: %f\n",
4430 printf(
"active parts: %d\n", activeParts);
4445 int oldtotpart = psys->
totpart;
4448 if (totpart != oldtotpart) {
4452 return totpart - oldtotpart;
4472 float disp, cache_cfra = cfra;
4473 int startframe = 0, endframe = 100, oldtotpart = 0;
4496 CLAMP(cache_cfra, startframe, endframe);
4569 int dframe, totframesback = 0;
4570 float t_frac, dt_frac;
4574 if (
int(cfra) == startframe && part->
sta < startframe) {
4575 totframesback = startframe - int(part->
sta);
4582 else if (
int(cfra) == startframe) {
4591 for (dframe = -totframesback; dframe <= 0; dframe++) {
4594 for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) {
4597 psys->
cfra = cfra + dframe + t_frac - 1.0f;
4611 if (
int(cache_cfra) != startframe) {
4681 else if (pa->
boid) {
4749 return particle_settings_local;
4764 const bool use_render_params)
4793 if (psys->
cfra == cfra) {
4832 psys_orig->
edit =
nullptr;
4842 psys->
part = part_local;
4859 if (part_local != part) {
4872 hair_step(&sim, cfra, use_render_params);
4887 bool free_unexisting =
false;
4898 free_unexisting =
true;
4925 if (free_unexisting) {
4950 if (psys_orig->
edit) {
4958 if (psys_orig != psys) {
4959 if (psys_orig->
edit !=
nullptr && psys_orig->
edit->
psys == psys_orig) {
4994 data->func(
data->psys, id_pointer,
data->userdata, cb_flag);
5006 if (psys->
clmd !=
nullptr) {
5013 data.userdata = userdata;
5032 for (p = 0, pa = psys->
particles; p < psys->totpart; p++, pa++) {
5033 if (pa->
boid !=
nullptr) {
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
void BKE_animsys_evaluate_animdata(struct ID *id, struct AnimData *adt, const struct AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, bool flush_to_original)
void boid_brain(BoidBrainData *bbd, int p, struct ParticleData *pa)
void boid_body(BoidBrainData *bbd, struct ParticleData *pa)
void boids_precalc_rules(struct ParticleSettings *part, float cfra)
void clothModifier_do(ClothModifierData *clmd, Depsgraph *depsgraph, Scene *scene, Object *ob, const Mesh *mesh, float(*vertexCos)[3])
void cloth_free_modifier(ClothModifierData *clmd)
void BKE_collider_cache_free(struct ListBase **colliders)
struct ListBase * BKE_collider_cache_create(struct Depsgraph *depsgraph, struct Object *self, struct Collection *collection)
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
void BKE_effectors_free(struct ListBase *lb)
void BKE_effectors_apply(struct ListBase *effectors, struct ListBase *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *wind_force, float *impulse)
struct ListBase * BKE_effectors_create(struct Depsgraph *depsgraph, struct Object *ob_src, struct ParticleSystem *psys_src, struct EffectorWeights *weights, bool use_rotation)
void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point)
void BKE_libblock_free_datablock(ID *id, int flag) ATTR_NONNULL()
void BKE_id_free(Main *bmain, void *idv)
void BKE_libblock_free_data(ID *id, bool do_id_user) ATTR_NONNULL()
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
LibraryForeachIDCallbackFlag
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_NO_ORIG_POINTERS_ACCESS
General operations, lookup, etc. for materials.
Material * BKE_object_material_get(Object *ob, short act)
Mesh * BKE_mesh_new_nomain(int verts_num, int edges_num, int faces_num, int corners_num)
void BKE_mesh_tessface_ensure(Mesh *mesh)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
ModifierData * BKE_modifier_new(int type)
General operations, lookup, etc. for blender objects.
void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
void distribute_particles(struct ParticleSimulationData *sim, int from)
bool do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int index, float time)
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
#define PARTICLE_DRAW_DATA_UPDATED
void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3])
void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors)
struct ParticleSystem * psys_orig_get(struct ParticleSystem *psys)
#define LOOP_SHOWN_PARTICLES
void(* ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, LibraryForeachIDCallbackFlag cb_flag)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time)
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys)
int psys_get_tot_child(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params)
float psys_get_timestep(struct ParticleSimulationData *sim)
void BKE_psys_collision_neartest_cb(void *userdata, int index, const struct BVHTreeRay *ray, struct BVHTreeRayHit *hit)
void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float fuv[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
float psys_get_dietime_from_cache(struct PointCache *cache, int index)
void psys_free_particles(struct ParticleSystem *psys)
void psys_free_children(struct ParticleSystem *psys)
void free_keyed_keys(struct ParticleSystem *psys)
void void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params)
#define PSYS_RESET_CACHE_MISS
int psys_uses_gravity(struct ParticleSimulationData *sim)
float psys_particle_value_from_verts(struct Mesh *mesh, short from, struct ParticleData *pa, float *values)
void psys_sim_data_free(struct ParticleSimulationData *sim)
#define LOOP_DYNAMIC_PARTICLES
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
void psys_free_pdd(struct ParticleSystem *psys)
#define PARTICLE_COLLISION_MAX_COLLISIONS
int psys_particle_dm_face_lookup(struct Mesh *mesh_final, struct Mesh *mesh_original, int findex_orig, const float fw[4], struct LinkNode **poly_nodes)
void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra)
#define LOOP_EXISTING_PARTICLES
void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics)
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
#define PSYS_RESET_DEPSGRAPH
@ BKE_PARTICLE_BATCH_DIRTY_ALL
void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params)
void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, bool editupdate, bool use_render_params)
void psys_sim_data_init(struct ParticleSimulationData *sim)
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
void BKE_ptcache_free_mem(struct ListBase *mem_cache)
void BKE_ptcache_id_time(PTCacheID *pid, struct Scene *scene, float cfra, int *startframe, int *endframe, float *timescale)
#define PTCACHE_CLEAR_AFTER
void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys)
void BKE_ptcache_validate(struct PointCache *cache, int framenr)
void BKE_ptcache_disk_to_mem(struct PTCacheID *pid)
#define PTCACHE_CLEAR_ALL
#define PTCACHE_READ_INTERPOLATED
int BKE_ptcache_read(PTCacheID *pid, float cfra, bool no_extrapolate_old)
void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
@ PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL
#define PTCACHE_RESET_OUTDATED
int BKE_ptcache_id_reset(struct Scene *scene, PTCacheID *pid, int mode)
void BKE_ptcache_invalidate(struct PointCache *cache)
#define PTCACHE_READ_EXACT
int get_render_child_particle_number(const RenderData *r, int child_num, bool for_render)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
#define BVH_RAYCAST_DEFAULT
void BLI_bvhtree_balance(BVHTree *tree)
void BLI_bvhtree_free(BVHTree *tree)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
void(*)(void *userdata, int index, const float co[3], float dist_sq) BVHTree_RangeQuery
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_range_query(const BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata)
A KD-tree for nearest neighbor search.
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE float pow2f(float x)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
MINLINE float pow3f(float x)
MINLINE float interpf(float target, float origin, float t)
MINLINE float pow4f(float x)
MINLINE float pow7f(float x)
MINLINE float safe_acosf(float a)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void normalize_m4(float R[4][4]) ATTR_NONNULL()
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void mat3_to_quat(float q[4], const float mat[3][3])
void vec_to_quat(float q[4], const float vec[3], short axis, short upflag)
float normalize_qt(float q[4])
void mul_qt_v3(const float q[4], float r[3])
void mat3_to_quat_legacy(float q[4], const float wmat[3][3])
void invert_qt_qt_normalized(float q1[4], const float q2[4])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void mat4_to_quat(float q[4], const float mat[4][4])
void copy_qt_qt(float q[4], const float a[4])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void madd_v3fl_v3fl_v3fl_v3i(float r[3], const float a[3], const float b[3], const int c[3])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
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
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
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 void negate_v3(float r[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 mul_v3_v3fl(float r[3], const float a[3], float f)
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
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
struct RNG * BLI_rng_new_srandom(unsigned int seed)
double BLI_rng_get_double(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
void BLI_task_isolate(void(*func)(void *userdata), void *userdata)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
pthread_spinlock_t SpinLock
pthread_rwlock_t ThreadRWMutex
#define THREAD_LOCK_WRITE
#define BLI_RWLOCK_INITIALIZER
int BLI_system_thread_count(void)
void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode)
void BLI_spin_init(SpinLock *spin)
void BLI_spin_unlock(SpinLock *spin)
void BLI_spin_lock(SpinLock *spin)
void BLI_rw_mutex_unlock(ThreadRWMutex *mutex)
void BLI_spin_end(SpinLock *spin)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
bool DEG_is_active(const Depsgraph *depsgraph)
void DEG_debug_print_eval(Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
float DEG_get_ctime(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
@ CLOTH_COLLSETTINGS_FLAG_SELF
@ CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS
@ FLUID_DOMAIN_PARTICLE_SPRAY
@ FLUID_DOMAIN_PARTICLE_FOAM
@ FLUID_DOMAIN_PARTICLE_TRACER
@ FLUID_DOMAIN_PARTICLE_FLIP
@ FLUID_DOMAIN_PARTICLE_BUBBLE
These structs are the foundation for all linked lists in the library system.
@ eParticleSystemFlag_Pars
@ eParticleSystemFlag_psys_updated
@ eModifierType_ParticleSystem
Object is a sort of wrapper for general info.
@ SPH_CURRENT_REST_LENGTH
@ SPH_VISCOELASTIC_SPRINGS
@ PART_FLUID_SPRAYFOAMBUBBLE
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static void mul(btAlignedObjectArray< T > &items, const Q &value)
void append(const T &value)
bool add(const Key &key, const Value &value)
Value lookup_default(const Key &key, const Value &default_value) const
dot(value.rgb, luminance_coefficients)") DEFINE_VALUE("REDUCE(lhs
float length(VecOp< float, D >) RET
float distance(VecOp< float, D >, VecOp< float, D >) RET
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
int manta_liquid_get_flip_particle_flag_at(struct MANTA *liquid, int i)
int manta_liquid_get_snd_particle_flag_at(struct MANTA *liquid, int i)
float manta_liquid_get_flip_particle_velocity_z_at(struct MANTA *liquid, int i)
float manta_liquid_get_snd_particle_velocity_z_at(struct MANTA *liquid, int i)
float manta_liquid_get_flip_particle_velocity_y_at(struct MANTA *liquid, int i)
float manta_liquid_get_flip_particle_position_y_at(struct MANTA *liquid, int i)
int manta_liquid_get_particle_res_y(struct MANTA *liquid)
int manta_liquid_get_particle_upres(struct MANTA *liquid)
float manta_liquid_get_flip_particle_position_z_at(struct MANTA *liquid, int i)
int manta_get_res_x(struct MANTA *fluid)
int manta_get_res_z(struct MANTA *fluid)
int manta_get_res_y(struct MANTA *fluid)
float manta_liquid_get_snd_particle_position_z_at(struct MANTA *liquid, int i)
float manta_liquid_get_snd_particle_velocity_y_at(struct MANTA *liquid, int i)
int manta_liquid_get_num_flip_particles(struct MANTA *liquid)
int manta_liquid_get_particle_res_x(struct MANTA *liquid)
float manta_liquid_get_flip_particle_position_x_at(struct MANTA *liquid, int i)
float manta_liquid_get_snd_particle_position_x_at(struct MANTA *liquid, int i)
float manta_liquid_get_snd_particle_position_y_at(struct MANTA *liquid, int i)
float manta_liquid_get_snd_particle_velocity_x_at(struct MANTA *liquid, int i)
int manta_liquid_get_particle_res_z(struct MANTA *liquid)
int manta_liquid_get_num_snd_particles(struct MANTA *liquid)
float manta_liquid_get_flip_particle_velocity_x_at(struct MANTA *liquid, int i)
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
VecBase< int32_t, 2 > int2
VecBase< int32_t, 3 > int3
void BKE_particlesettings_fluid_default_settings(ParticleSettings *part)
static void dynamics_step_sph_classical_calc_density_task_cb_ex(void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls)
static void get_angular_velocity_vector(short avemode, ParticleKey *state, float vec[3])
static void sphclassical_neighbor_accum_cb(void *userdata, int index, const float co[3], float)
static float collision_point_distance_with_normal(float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *nor)
static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float)
static void psys_sph_init(ParticleSimulationData *sim, SPHData *sphdata, blender::Map< blender::OrderedEdge, int > &r_eh)
static void particlesystem_modifiersForeachIDLink(void *user_data, Object *, ID **id_pointer, const LibraryForeachIDCallbackFlag cb_flag)
void psys_calc_dmcache(Object *ob, Mesh *mesh_final, Mesh *mesh_original, ParticleSystem *psys)
static float collision_newton_rhapson(ParticleCollision *col, float radius, ParticleCollisionElement *pce, NRDistanceFunc distance_func)
void BKE_particle_settings_eval_reset(Depsgraph *depsgraph, ParticleSettings *particle_settings)
static void dynamics_step(ParticleSimulationData *sim, float cfra)
static ParticleSpring * sph_spring_add(ParticleSystem *psys, ParticleSpring *spring)
static ThreadRWMutex psys_bvhtree_rwlock
ParticleSystem * psys_get_target_system(Object *ob, ParticleTarget *pt)
static void collision_point_on_surface(const float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co)
static void sphclassical_density_accum_cb(void *userdata, int index, const float co[3], float)
static const float MIN_TIMESTEP
static void psys_prepare_physics(ParticleSimulationData *sim)
static bool particles_has_bubble(short parttype)
void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
static int collision_response(ParticleSimulationData *sim, ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, int kill, int dynamic_rotation)
static void sph_evaluate_func(BVHTree *tree, ParticleSystem **psys, const float co[3], SPHRangeData *pfr, float interaction_radius, BVHTree_RangeQuery callback)
static float nr_distance_to_edge(float *p, float radius, ParticleCollisionElement *pce, float *)
static void update_timestep(ParticleSystem *psys, ParticleSimulationData *sim)
static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, float cfra)
static void init_particle_texture(ParticleSimulationData *sim, ParticleData *pa, int p)
static float sync_timestep(ParticleSystem *psys, float t_frac)
static void save_hair(ParticleSimulationData *sim, float)
static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr)
static void psys_sph_flush_springs(SPHData *sphdata)
static void integrate_particle(ParticleSettings *part, ParticleData *pa, float dtime, float *external_acceleration, void(*force_func)(void *forcedata, ParticleKey *state, float *force, float *impulse), void *forcedata)
static int tot_particles(ParticleSystem *psys, PTCacheID *pid)
static const float TIMESTEP_EXPANSION_FACTOR
static void bvhtree_balance_isolated(void *userdata)
float psys_get_current_display_percentage(ParticleSystem *psys, const bool use_render_params)
static bool particles_has_tracer(short parttype)
void psys_count_keyed_targets(ParticleSimulationData *sim)
void psys_unique_name(Object *object, ParticleSystem *psys, const char *defname)
static void collision_interpolate_element(ParticleCollisionElement *pce, float t, float fac, ParticleCollision *col)
static bool particles_has_foam(short parttype)
void particle_system_update(Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, const bool use_render_params)
static void dynamics_step_sph_classical_basic_integrate_task_cb_ex(void *__restrict userdata, const int p, const TaskParallelTLS *__restrict)
void psys_thread_context_init(ParticleThreadContext *ctx, ParticleSimulationData *sim)
void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
static void sph_spring_delete(ParticleSystem *psys, int j)
static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep)
static void free_unexisting_particles(ParticleSimulationData *sim)
static void sph_density_accum_cb(void *userdata, int index, const float co[3], float squared_dist)
void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, ParticleKey *state, float dtime, float cfra)
static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisionElement *pce, float *nor)
void BKE_particle_system_eval_init(Depsgraph *depsgraph, Object *object)
static void cached_step(ParticleSimulationData *sim, float cfra, const bool use_render_params)
int psys_get_tot_child(Scene *scene, ParticleSystem *psys, const bool use_render_params)
static bool particles_has_flip(short parttype)
static const float TIMESTEP_EXPANSION_TOLERANCE
static void evaluate_emitter_anim(Depsgraph *depsgraph, Scene *scene, Object *ob, float cfra)
static bool particles_has_spray(short parttype)
static void dynamics_step_sph_ddr_task_cb_ex(DynamicStepSolverTaskData *data, const int p, SPHData *sphdata)
void psys_reset(ParticleSystem *psys, int mode)
static MDeformVert * hair_set_pinning(MDeformVert *dvert, float weight)
static void system_step(ParticleSimulationData *sim, float cfra, const bool use_render_params)
static void hair_step(ParticleSimulationData *sim, float cfra, const bool use_render_params)
static ParticleSettings * particle_settings_localize(ParticleSettings *particle_settings)
static void collision_check(ParticleSimulationData *sim, int p, float dfra, float cfra)
#define PSYS_FLUID_SPRINGS_INITIAL_SIZE
void psys_changed_type(Object *ob, ParticleSystem *psys)
void psys_sph_finalize(SPHData *sphdata)
static void set_keyed_keys(ParticleSimulationData *sim)
static void sph_springs_modify(ParticleSystem *psys, float dtime)
static float get_base_time_step(ParticleSettings *part)
static void update_courant_num(ParticleSimulationData *sim, ParticleData *pa, float dtime, SPHData *sphdata, SpinLock *spin)
static void psys_update_effectors(ParticleSimulationData *sim)
static void collision_fail(ParticleData *pa, ParticleCollision *col)
static void reset_all_particles(ParticleSimulationData *sim, float dtime, float cfra, int from)
static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, float *impulse)
static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata)
int psys_get_child_number(Scene *scene, ParticleSystem *psys, const bool use_render_params)
void psys_update_particle_tree(ParticleSystem *psys, float cfra)
static void sphclassical_calc_dens(ParticleData *pa, float, SPHData *sphdata)
static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, float *)
static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
static int particles_are_dynamic(ParticleSystem *psys)
static int collision_sphere_to_verts(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t)
static void particle_settings_free_local(ParticleSettings *particle_settings)
void init_particle(ParticleSimulationData *sim, ParticleData *pa)
void psys_sph_density(BVHTree *tree, SPHData *sphdata, float co[3], float vars[2])
blender::Vector< ParticleTask > psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart)
static void particles_fluid_step(ParticleSimulationData *sim, int cfra, const bool use_render_params)
static void do_hair_dynamics(ParticleSimulationData *sim)
static float nr_distance_to_vert(float *p, float radius, ParticleCollisionElement *pce, float *)
void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
static void sphclassical_force_cb(void *sphdata_v, ParticleKey *state, float *force, float *)
static blender::Map< blender::OrderedEdge, int > sph_springhash_build(ParticleSystem *psys)
static SPHData dynamics_step_sphdata_reduce(const SPHData &sphdata_to, const SPHData &sphdata_from)
static void psys_clear_temp_pointcache(ParticleSystem *psys)
static int collision_sphere_to_edges(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t)
#define COLLISION_MIN_RADIUS
void psys_tasks_free(blender::Vector< ParticleTask > &tasks)
static void initialize_all_particles(ParticleSimulationData *sim)
static int hair_needs_recalc(ParticleSystem *psys)
static void update_children(ParticleSimulationData *sim, const bool use_render_params)
static int collision_sphere_to_tri(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t)
static void collision_point_velocity(ParticleCollisionElement *pce)
void BKE_psys_collision_neartest_cb(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
static void dynamics_step_sph_classical_integrate_task_cb_ex(void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls)
void psys_check_boid_data(ParticleSystem *psys)
#define COLLISION_INIT_STEP
void psys_thread_context_free(ParticleThreadContext *ctx)
static void psys_update_path_cache(ParticleSimulationData *sim, float cfra, const bool use_render_params)
static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, ListBase *colliders)
static bool psys_hair_use_simulation(ParticleData *pa, float max_length)
static void hair_create_input_mesh(ParticleSimulationData *sim, int totpoint, int totedge, Mesh **r_mesh)
void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, float cfra)
void BKE_particlesystem_reset_all(Object *object)
#define COLLISION_MIN_DISTANCE
float(*)(float *p, float radius, ParticleCollisionElement *pce, float *nor) NRDistanceFunc
struct ParticleSettings * part
struct ParticleSimulationData * sim
struct ClothHairData * hairdata
struct PointCache * point_cache
struct ClothSimSettings * sim_parms
struct ClothCollSettings * coll_parms
struct EffectorWeights * effector_weights
ParticleSimulationData * sim
ParticleSimulationData * sim
struct FluidDomainSettings * domain
MeshRuntimeHandle * runtime
struct ModifierData * next
void(* foreach_ID_link)(ModifierData *md, Object *ob, IDWalkFunc walk, void *user_data)
ObjectRuntimeHandle * runtime
struct ParticleSystem * psys
struct ParticleSystemModifierData * psmd_eval
struct ParticleSystem * psys_eval
struct PointCache * cache
struct Collection * collision_group
struct BoidSettings * boids
struct EffectorWeights * effector_weights
struct SPHFluidSettings * fluid
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ListBase * colliders
unsigned int particle_index[2]
ParticleSystemIDFunc func
struct ParticleSystem * psys
struct Mesh * mesh_original
ParticleSpring * fluid_springs
struct PTCacheEdit * edit
struct ListBase * effectors
struct ParticleSystem * next
struct PointCache * pointcache
struct ClothModifierData * clmd
struct Object * target_ob
struct Mesh * hair_in_mesh
struct Mesh * hair_out_mesh
struct ParticleDrawData * pdd
struct ParticleCacheKey ** pathcache
void(* free_edit)(struct PTCacheEdit *edit)
struct ParticleTarget * next
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct CurveMapping * clumpcurve
struct ParticleSeam * seams
struct ParticleSimulationData sim
struct ListBase mem_cache
blender::Vector< ParticleSpring > new_springs
void(* force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse)
ParticleSystem * psys[10]
void(* density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist)
const blender::Map< blender::OrderedEdge, int > * eh
float plasticity_constant
SPHNeighbor neighbors[SPH_NEIGHBORS]
struct PhysicsSettings physics_settings
struct ToolSettings * toolsettings
size_t userdata_chunk_size