99 if ((use_render_params &&
139 psys->
edit =
nullptr;
153 MEM_SAFE_DELETE(psys->
child);
185 int totpart, totsaved = 0;
187 if (new_totpart < 0) {
190 totpart *= totpart * totpart;
197 totpart = new_totpart;
200 if (totpart != psys->
totpart) {
203 psys->
edit =
nullptr;
208 newpars = MEM_new_array<ParticleData>(totpart,
"particles");
209 if (newpars ==
nullptr) {
214 newboids = MEM_new_array<BoidParticle>(totpart,
"boid particles");
216 if (newboids ==
nullptr) {
227 totsaved = std::min(psys->
totpart, totpart);
245 for (p = 0, pa = newpars; p < totsaved; p++, pa++) {
252 for (p = totsaved, pa = psys->
particles + totsaved; p < psys->totpart; p++, pa++) {
254 MEM_delete(pa->hair);
268 pa->boid = newboids++;
274 MEM_delete(psys->
child);
275 psys->
child =
nullptr;
288 if (use_render_params) {
325 int totdmelem, totelem, i;
326 const int *origindex;
327 const int *origindex_poly =
nullptr;
331 if (use_modifier_stack) {
336 totelem =
mesh->verts_num;
337 origindex =
static_cast<const int *
>(
344 if (use_modifier_stack) {
347 origindex_poly =
nullptr;
351 origindex =
static_cast<const int *
>(
355 origindex_poly =
static_cast<const int *
>(
357 if (origindex_poly ==
nullptr) {
366 for (i = 0,
node = nodedmelem; i < totdmelem; i++,
node++) {
371 if (use_modifier_stack) {
379 origindex_final = origindex_poly[origindex_final];
383 if (origindex_final !=
ORIGINDEX_NONE && origindex_final < totelem) {
384 if (nodearray[origindex_final]) {
386 node->next = nodearray[origindex_final];
387 nodearray[origindex_final] =
node;
390 nodearray[origindex_final] =
node;
403 if (use_modifier_stack) {
404 if (pa->num < totelem) {
413 if (pa->num < totelem && nodearray[pa->num]) {
422 mesh_final, mesh_original, pa->num, pa->fuv, nodearray);
427 MEM_delete(nodearray);
428 MEM_delete(nodedmelem);
453 int particles_per_task = numtasks > 0 ? (endpart - startpart) / numtasks : 0;
454 int remainder = numtasks > 0 ? (endpart - startpart) - particles_per_task * numtasks : 0;
459 for (
int i = 0; i < numtasks; i++) {
462 p = p + particles_per_task + (i < remainder ? 1 : 0);
468 BLI_assert(tasks[numtasks - 1].end == endpart);
518 MEM_delete(ctx->
jit);
527 MEM_delete(ctx->
index);
530 MEM_delete(ctx->
seams);
554 switch (part->
type) {
605 if (!(emit_from_volume_grid && (pa->flag &
PARS_UNEXIST) != 0)) {
639 npa = newpars = MEM_new_array<ParticleData>(newtotpart,
"particles");
641 for (p = 0, pa = psys->
particles; p < newtotpart; p++, pa++, npa++) {
661 pa->boid = newboids++;
675 zvec[0] = zvec[1] = 0;
681 float zvec[3], temp[3];
682 zvec[0] = zvec[1] = 0;
710 float fac, phasefac, nor[3] = {0, 0, 0}, loc[3], vel[3] = {0.0, 0.0, 0.0},
rot[4], q2[4];
711 float r_vel[3], r_ave[3], r_rot[4], vec[3], p_vel[3] = {0.0, 0.0, 0.0};
712 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},
713 rot_vec[3] = {0.0, 0.0, 0.0};
717 const bool use_tangents = ((use_boids ==
false) &&
756 mul_m4_v3(ob->object_to_world().ptr(), loc);
765 float phase = vg_rot ?
788 r_vel[0] = 2.0f * (
psys_frand(psys, p + 10) - 0.5f);
789 r_vel[1] = 2.0f * (
psys_frand(psys, p + 11) - 0.5f);
790 r_vel[2] = 2.0f * (
psys_frand(psys, p + 12) - 0.5f);
798 r_ave[0] = 2.0f * (
psys_frand(psys, p + 13) - 0.5f);
799 r_ave[1] = 2.0f * (
psys_frand(psys, p + 14) - 0.5f);
800 r_ave[2] = 2.0f * (
psys_frand(psys, p + 15) - 0.5f);
808 r_rot[0] = 2.0f * (
psys_frand(psys, p + 16) - 0.5f);
809 r_rot[1] = 2.0f * (
psys_frand(psys, p + 17) - 0.5f);
810 r_rot[2] = 2.0f * (
psys_frand(psys, p + 18) - 0.5f);
811 r_rot[3] = 2.0f * (
psys_frand(psys, p + 19) - 0.5f);
819 float dvec[3], q[4], mat[3][3];
827 if (
fabsf(nor[2]) == 1.0f) {
857 if (dtime != 0.0f && part->
obfac != 0.0f) {
873 if (part->
ob_vel[0] != 0.0f) {
877 if (part->
ob_vel[1] != 0.0f) {
881 if (part->
ob_vel[2] != 0.0f) {
908 bool use_global_space;
915 use_global_space =
false;
919 use_global_space =
true;
925 use_global_space =
true;
931 use_global_space =
false;
934 use_global_space =
true;
940 if (use_global_space) {
961 float rot_vec_local[3];
978 float *rot_vec_local = tmat[0];
979 float *vtan_local = tmat[1];
980 float *utan_local = tmat[2];
1123 if (pa->
time > cfra) {
1126 else if (pa->
dietime <= cfra) {
1140 for (p = from, pa = sim->
psys->
particles + from; p < totpart; p++, pa++) {
1155 if (
ELEM(pt->
ob,
nullptr, ob)) {
1185 for (; pt; pt = pt->
next) {
1188 if (kpsys && kpsys->totpart) {
1230 pa->totkey = totkeys;
1238 for (k = 0; k < totkeys; k++) {
1239 ksim.
ob = pt->
ob ? pt->
ob : sim->
ob;
1255 if (pt->
duration != 0.0f && k + 1 < totkeys) {
1260 else if (totkeys > 1) {
1261 key->
time = pa->time +
float(k) /
float(totkeys - 1) * pa->lifetime;
1264 key->
time = pa->time;
1351 if (pa->state.time == cfra) {
1388 const float *co = (pa->state.time == cfra) ? pa->prev_state.co : pa->state.co;
1412 float *external_acceleration,
1413 void (*force_func)(
void *forcedata,
ParticleKey *
state,
float *force,
float *impulse),
1418 {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f} \
1422 float force[3], acceleration[3], impulse[3], dx[4][3] =
ZERO_F43, dv[4][3] =
ZERO_F43, oldpos[3];
1436 switch (integrator) {
1451 for (i = 0; i < steps; i++) {
1455 states->
time = 0.0f;
1457 for (i = 0; i < steps; i++) {
1461 force_func(forcedata, states + i, force, impulse);
1466 if (external_acceleration) {
1467 add_v3_v3(acceleration, external_acceleration);
1473 switch (integrator) {
1482 states[1].
time = dtime * 0.5f;
1500 states[1].
time = dtime * 0.5f;
1511 states[2].
time = dtime * 0.5f;
1521 states[3].
time = dtime;
1569#define PSYS_FLUID_SPRINGS_INITIAL_SIZE 256
1576 "Particle Fluid Springs");
1612 float h, d, Rij[3], rij, Lij;
1618 float timefix = 25.0f * dtime;
1634 d = yield_ratio * timefix * Lij;
1636 if (rij > Lij + d) {
1637 spring->
rest_length += plasticity * (rij - Lij - d) * timefix;
1639 else if (rij < Lij - d) {
1640 spring->
rest_length -= plasticity * (Lij - d - rij) * timefix;
1643 h = 4.0f * pa1->
size;
1665 for (i = 0, spring = psys->
fluid_springs; i < psys->tot_fluidsprings; i++, spring++) {
1672#define SPH_NEIGHBORS 512
1697 float interaction_radius,
1704 for (i = 0; i < 10 && psys[i]; i++) {
1705 pfr->
npsys = psys[i];
1748 dist =
sqrtf(squared_dist);
1749 q = (1.0f - dist / pfr->
h) * pfr->
massfac;
1755 pfr->
data[0] += q * q;
1756 pfr->
data[1] += q * q * q;
1766 float flow[3], offset[3], dist;
1797 const float *gravity = sphdata->
gravity;
1800 float q, u, rij, dv[3];
1801 float pressure, near_pressure;
1807 float inv_mass = 1.0f / sphdata->
mass;
1808 float spring_constant = fluid->
spring_k;
1811 float interaction_radius = fluid->
radius *
1813 float h = interaction_radius * sphdata->
hfac;
1828 float density, near_density;
1841 near_density =
data[1];
1843 pressure = stiffness * (density - rest_density);
1844 near_pressure = stiffness_near_fac * near_density;
1855 q = (1.0f - rij / h) * pfn->
psys->
part->
mass * inv_mass;
1864 madd_v3_v3fl(force, vec, -(pressure + near_pressure * q) * q);
1867 if (visc > 0.0f || stiff_visc > 0.0f) {
1871 if (u < 0.0f && visc > 0.0f) {
1875 if (u > 0.0f && stiff_visc > 0.0f) {
1880 if (spring_constant > 0.0f) {
1890 -10.0f * spring_constant * (1.0f - rij / h) * (spring->
rest_length - rij));
1906 force, vec, -10.0f * spring_constant * (1.0f - rij / h) * (rest_length - rij));
1912 if (fluid->
buoyancy > 0.0f && gravity) {
1930 float qfac = 21.0f / (256.0f *
float(
M_PI));
1939 rij_h = rij / pfr->
h;
1947 q = qfac /
pow3f(pfr->
h) *
pow4f(2.0f - rij_h) * (1.0f + 2.0f * rij_h);
1977 rij_h = rij / pfr->
h;
1997 const float *gravity = sphdata->
gravity;
1999 float dq, u, rij, dv[3];
2000 float pressure, npressure;
2004 float interaction_radius;
2019 float qfac2 = 42.0f / (256.0f *
float(
M_PI));
2024 h = interaction_radius * sphdata->
hfac;
2052 rij_h = rij / pfr.
h;
2057 npressure = stiffness * (
pow7f(npa->
sphdensity / rest_density) - 1.0f);
2064 dq = qfac2 * (2.0f *
pow4f(2.0f - rij_h) - 4.0f *
pow3f(2.0f - rij_h) * (1.0f + 2.0f * rij_h));
2087 if (fluid->
buoyancy > 0.0f && gravity) {
2102 float interaction_radius = fluid->
radius *
2110 pfr.
h = interaction_radius * sphdata->
hfac;
2128 for (i = 1, pt = sim->
psys->
targets.first(); i < 10; i++, pt = (pt ? pt->
next :
nullptr)) {
2139 sphdata->
eh = &r_eh;
2143 sphdata->
pa =
nullptr;
2144 sphdata->
mass = 1.0f;
2149 sphdata->
hfac = 1.0f;
2155 sphdata->
hfac = 0.5f;
2161 for (
int i = 0; i < sphdata->
new_springs.size(); i++) {
2179 float interaction_radius = fluid->
radius *
2184 density[0] = density[1] = 0.0f;
2186 pfr.
h = interaction_radius * sphdata->
hfac;
2191 vars[0] = pfr.
data[0];
2192 vars[1] = pfr.
data[1];
2205 float effector_acceleration[3];
2208 sphdata->
mass = pa_mass;
2214 mul_v3_fl(effector_acceleration, 1.0f / dtime);
2279 float *gravity =
nullptr, gr[3];
2313 CLAMP(time, 0.0f, 1.0f);
2331 float rotfac, rot1[4], rot2[4] = {1.0, 0.0, 0.0, 0.0}, dtime = dfra * timestep, extrotfac;
2353 if (len1 == 0.0f || len2 == 0.0f) {
2368 if (rotfac == 0.0f || (part->
flag &
PART_ROT_DYN) == 0 || extrotfac == 0.0f) {
2392#define COLLISION_MIN_RADIUS 0.001f
2393#define COLLISION_MIN_DISTANCE 0.0001f
2394#define COLLISION_ZERO 0.00001f
2395#define COLLISION_INIT_STEP 0.00008f
2405 float p0[3], e1[3], e2[3], d;
2437 float v0[3], v1[3],
v2[3], c[3];
2465 float f = fac + t * (1.0f - fac);
2508 float u,
e[3], vec[3];
2534 float u,
e[3], vec[3], nor[3];
2547 float p0[3], e1[3], e2[3], nor[3];
2573 float t0, t1, dt_init, d0, d1, dd, n[3];
2590 d0 = distance_func(col->
co1, radius, pce, n);
2594 for (iter = 0; iter < 10; iter++) {
2599 d1 = distance_func(pce->
p, radius, pce, n);
2602 if (iter == 0 && d0 < 0.0f && d0 > -radius) {
2617 d0 = distance_func(col->
co2, radius, pce, n);
2618 t1 = 1.0f - dt_init;
2626 dd = (t1 - t0) / (d1 - d0);
2635 if (iter == 0 && t1 < 0.0f) {
2638 d0 = distance_func(col->
co2, radius, pce, n);
2639 t1 = 1.0f - dt_init;
2643 if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.0f)) {
2653 CLAMP(t1, 0.0f, 1.0f);
2676 if (ct >= 0.0f && ct < *t && (
result->inside == 0 || pce->
inside == 1)) {
2677 float e1[3], e2[3], p0[3];
2678 float e1e1, e1e2, e1p0, e2e2, e2p0, inv;
2691 inv = 1.0f / (e1e1 * e2e2 - e1e2 * e1e2);
2692 u = (e2e2 * e1p0 - e1e2 * e2p0) * inv;
2693 v = (e1e1 * e2p0 - e1e2 * e1p0) * inv;
2695 if (u >= 0.0f && u <= 1.0f && v >= 0.0f && u +
v <= 1.0f) {
2720 for (i = 0; i < 3; i++) {
2722 cur->
x[0] = pce->
x[i];
2723 cur->
x[1] = pce->
x[(i + 1) % 3];
2724 cur->
v[0] = pce->
v[i];
2725 cur->
v[1] = pce->
v[(i + 1) % 3];
2731 if (ct >= 0.0f && ct < *t) {
2732 float u,
e[3], vec[3];
2738 if (u < 0.0f || u > 1.0f) {
2754 return hit !=
nullptr;
2767 for (i = 0; i < 3; i++) {
2769 cur->
x[0] = pce->
x[i];
2770 cur->
v[0] = pce->
v[i];
2776 if (ct >= 0.0f && ct < *t) {
2787 return hit !=
nullptr;
2802 pce.
x[0] =
x[vert_tri[0]];
2803 pce.
x[1] =
x[vert_tri[1]];
2804 pce.
x[2] =
x[vert_tri[2]];
2806 pce.
v[0] =
v[vert_tri[0]];
2807 pce.
v[1] =
v[vert_tri[1]];
2808 pce.
v[2] =
v[vert_tri[2]];
2832 ListBaseT<ColliderCache> *colliders)
2837 if (colliders->is_empty()) {
2848 if (hit->
dist == 0.0f) {
2857 if (coll.ob == col->
skip[i]) {
2873 col->
md = coll.collmd;
2875 (coll.collmd->time_xnew - coll.collmd->time_x);
2876 col->
fac2 = (col->
cfra - coll.collmd->time_x) / (coll.collmd->time_xnew - coll.collmd->time_x);
2890 return hit->
index >= 0;
2897 int dynamic_rotation)
2907 float f = col->
f +
x * (1.0f - col->
f);
2941 float v0_dot, vc_dot;
2946 CLAMP(damp, 0.0f, 1.0f);
2947 CLAMP(frict, 0.0f, 1.0f);
2967 if (dynamic_rotation) {
2968 float vr_tan[3], v1_tan[3], ave[3];
2986 mul_v3_fl(v1_tan, 1.0f - 0.01f * frict);
3012 if (v0_dot < 0.0f) {
3014 v0_dot = std::min(v0_dot, 0.0f);
3018 v0_dot *= 1.0f - damp;
3019 vc_dot *= through ? damp : 1.0f;
3023 if (through == 0 && ((vc_dot > 0.0f && v0_dot > 0.0f && vc_dot > v0_dot) ||
3024 (vc_dot < 0.0f && v0_dot < 0.0f && vc_dot < v0_dot)))
3028 else if (v0_dot > 0.0f) {
3032 mul_v3_v3fl(v0_nor, pce->
nor, vc_dot + (through ? 1.0f : -1.0f) * v0_dot);
3123 int collision_count = 0;
3191 const bool use_render_params)
3196 int distr = 0, alloc = 0, skip = 0;
3290 const float min_length = 0.1f * max_length;
3299 for (k = 1, key = pa->
hair + 1; k < pa->totkey; k++, key++) {
3301 if (
length < min_length) {
3335 float hairmat[4][4];
3344 int2 *edge =
mesh->edges_for_write().data();
3345 dvert =
mesh->deform_verts_for_write().data();
3357 for (k = 1, key = pa->
hair + 1; k < pa->totkey; k++, key++) {
3359 max_length = std::max(max_length,
length);
3369 hair_radius = part->
size;
3376 float root_mat[4][4];
3377 float bending_stiffness;
3384 mul_m4_m4m4(root_mat, sim->
ob->object_to_world().ptr(), hairmat);
3387 bending_stiffness = std::clamp(
3390 for (k = 0, key = pa->
hair; k < pa->totkey; k++, key++) {
3392 float *co, *co_next;
3395 co_next = (key + 1)->co;
3403 hair->
radius = hair_radius;
3407 sub_v3_v3(positions[vert_index], co_next);
3408 mul_m4_v3(hairmat, positions[vert_index]);
3424 hair->
radius = hair_radius;
3428 mul_m4_v3(hairmat, positions[vert_index]);
3449 hair_index += pa->
totkey + 1;
3478 totpoint += pa->
totkey + 1;
3483 realloc_roots =
false;
3486 if (totpoint !=
mesh->verts_num || totedge !=
mesh->edges_num) {
3489 realloc_roots =
true;
3526 reinterpret_cast<float (*)[3]
>(psys->
hair_out_mesh->vert_positions_for_write().data()));
3594 if (pa->
totkey == 0 || pa->
hair ==
nullptr) {
3599 key = root = pa->
hair;
3645 float relative_vel[3];
3681 if (dt_target > psys->
dt_frac) {
3692 if (t_frac == 1.0f) {
3696 return 1.0f - t_frac;
3735 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3759 void *__restrict userdata,
const int p,
const TaskParallelTLS *__restrict )
3767 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3775 void *__restrict userdata,
const int p,
const TaskParallelTLS *__restrict tls)
3785 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3805 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3836 float birthtime, dietime;
3839 dfra = cfra - psys->
cfra;
3842 dtime = dfra * timestep;
3882 for (; pt; pt = pt->
next) {
3884 if (psys_target && psys_target != psys) {
3895 for (; pt; pt = pt->
next) {
3921 birthtime = pa->
time;
3927 if (dietime <= cfra && psys->cfra < dietime) {
3932 else if (birthtime <= cfra && birthtime >= psys->
cfra) {
3938 else if (dietime < cfra) {
3999 task_data.
sim = sim;
4000 task_data.
cfra = cfra;
4002 task_data.
dtime = dtime;
4014 for (const int i : range) {
4015 dynamics_step_sph_ddr_task_cb_ex(&task_data, i, &data);
4123 float disp, dietime;
4142 if (pa->
time > cfra) {
4148 else if (dietime <= cfra) {
4193 const bool use_render_params)
4216 int p, totpart = 0, tottypepart = 0;
4217 int flagActivePart, activeParts = 0;
4218 float posX, posY, posZ, velX, velY, velZ;
4219 float resX, resY, resZ;
4221 char debugStrBuffer[256];
4222 float tmp[3] = {0}, tmp2[3] = {0};
4225 float min[3],
max[3], size[3], cell_size_scaled[3], max_size;
4240 sizeof(debugStrBuffer),
4241 "particles_fluid_step::error - found particle system that is not enabled in "
4256 for (p = 0; p < totpart; p++) {
4273 if (!totpart || !tottypepart) {
4278 tottypepart = (use_render_params) ? tottypepart : (part->
disp * tottypepart) / 100;
4281 part->
sta = part->
end = 1.0f;
4289 double r, dispProb = double(part->
disp) / 100.0;
4292 for (p = 0, pa = psys->
particles; p < totpart; p++) {
4339 sizeof(debugStrBuffer),
4340 "particles_fluid_step::error - unknown particle system type\n");
4346 printf(
"system type is %d and particle type is %d\n", part->
type, flagActivePart);
4365 printf(
"system type is %d and particle type is %d\n", part->
type, flagActivePart);
4369 if (activeParts >= tottypepart) {
4392 max_size = std::max(
4393 {size[0] /
float(upres), size[1] /
float(upres), size[2] /
float(upres)});
4396 const float posParticle[3] = {posX, posY, posZ};
4400 float resDomain[3] = {resX, resY, resZ};
4406 float scaleAbs[3] = {
4425 printf(
"pa->state.co[0]: %f, pa->state.co[1]: %f, pa->state.co[2]: %f\n",
4431 const float velParticle[3] = {velX, velY, velZ};
4436 printf(
"pa->state.vel[0]: %f, pa->state.vel[1]: %f, pa->state.vel[2]: %f\n",
4456 printf(
"active parts: %d\n", activeParts);
4471 int oldtotpart = psys->
totpart;
4474 if (totpart != oldtotpart) {
4478 return totpart - oldtotpart;
4498 float disp, cache_cfra = cfra;
4499 int startframe = 0, endframe = 100, oldtotpart = 0;
4522 CLAMP(cache_cfra, startframe, endframe);
4595 int dframe, totframesback = 0;
4596 float t_frac, dt_frac;
4600 if (
int(cfra) == startframe && part->
sta < startframe) {
4601 totframesback = startframe - int(part->
sta);
4608 else if (
int(cfra) == startframe) {
4617 for (dframe = -totframesback; dframe <= 0; dframe++) {
4620 for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) {
4623 psys->
cfra = cfra + dframe + t_frac - 1.0f;
4637 if (
int(cache_cfra) != startframe) {
4699 bpa = MEM_new_array<BoidParticle>(psys->
totpart,
"Boid Data");
4707 else if (pa->
boid) {
4708 MEM_delete(pa->
boid);
4775 return particle_settings_local;
4783 MEM_delete(particle_settings);
4790 const bool use_render_params)
4819 if (psys->
cfra == cfra) {
4852 int i, recalc = psys->
recalc;
4858 psys_orig->
edit =
nullptr;
4868 psys->
part = part_local;
4871 for (i = 0; i <= part->
hair_step; i++) {
4885 if (part_local != part) {
4898 hair_step(&sim, cfra, use_render_params);
4913 bool free_unexisting =
false;
4924 free_unexisting =
true;
4951 if (free_unexisting) {
4976 if (psys_orig->
edit) {
4984 if (psys_orig != psys) {
4985 if (psys_orig->
edit !=
nullptr && psys_orig->
edit->
psys == psys_orig) {
5021 data->func(
data->psys, id_pointer,
data->userdata, cb_flag);
5034 if (psys->
clmd !=
nullptr) {
5041 data.userdata = userdata;
5060 for (p = 0, pa = psys->
particles; p < psys->totpart; p++, pa++) {
5061 if (pa->
boid !=
nullptr) {
5095 for (
ParticleSystem *psys =
object->particlesystem.first(); psys !=
nullptr; psys = psys->next) {
CustomData interface, see also DNA_customdata_types.h.
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define PARTICLE_DRAW_DATA_UPDATED
#define LOOP_SHOWN_PARTICLES
#define PSYS_RESET_CACHE_MISS
#define LOOP_DYNAMIC_PARTICLES
#define PARTICLE_COLLISION_MAX_COLLISIONS
#define LOOP_EXISTING_PARTICLES
#define PSYS_RESET_DEPSGRAPH
#define PTCACHE_CLEAR_AFTER
#define PTCACHE_CLEAR_ALL
#define PTCACHE_READ_INTERPOLATED
#define PTCACHE_RESET_OUTDATED
#define PTCACHE_READ_EXACT
#define BVH_RAYCAST_DEFAULT
A KD-tree for nearest neighbor search.
#define THREAD_LOCK_WRITE
#define BLI_RWLOCK_INITIALIZER
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define MEM_realloc_uninitialized(vmemh, len)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
constexpr IndexRange()=default
bool add(const Key &key, const Value &value)
Value lookup_default(const Key &key, const Value &default_value) const
float dot(VecOp< float, D >, VecOp< float, D >) RET
float distance(float, float) RET
float length(VecOp< float, D >) RET
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
MINLINE float min_ff(float a, float b)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
int manta_liquid_get_snd_particle_flag_at(struct MANTA *liquid, int i)
void BKE_object_where_is_calc_time(Depsgraph *depsgraph, Scene *scene, Object *ob, float ctime)
void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Object *object)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int BKE_ptcache_read(PTCacheID *pid, float cfra, bool no_extrapolate_old)
MINLINE void negate_v3_v3(float r[3], const float a[3])
int manta_liquid_get_particle_res_z(struct MANTA *liquid)
void kdtree_balance(KDTree< CoordT > *tree)
static void dynamics_step_sph_ddr_task_cb_ex(DynamicStepSolverTaskData *data, const int p, SPHData *sphdata)
void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
void(*) ParticleSystemIDFunc(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, LibraryForeachIDCallbackFlag cb_flag)
static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
static Map< OrderedEdge, int > sph_springhash_build(ParticleSystem *psys)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
static void sphclassical_force_cb(void *sphdata_v, ParticleKey *state, float *force, float *)
static void dynamics_step_sph_classical_calc_density_task_cb_ex(void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls)
static int collision_sphere_to_edges(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t)
int manta_liquid_get_flip_particle_flag_at(struct MANTA *liquid, int i)
static void collision_point_on_surface(const float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co)
float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params)
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
static bool particles_has_bubble(short parttype)
struct ParticleSystem * psys_get_target_system(struct Object *ob, struct ParticleTarget *pt)
static void set_keyed_keys(ParticleSimulationData *sim)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void(*)(void *userdata, int index, const float co[3], float dist_sq) BVHTree_RangeQuery
void psys_sph_finalize(struct SPHData *sphdata)
int manta_liquid_get_particle_res_y(struct MANTA *liquid)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void mat4_to_quat(float q[4], const float mat[4][4])
pthread_spinlock_t SpinLock
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
Vector< ParticleTask > psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart)
static void collision_fail(ParticleData *pa, ParticleCollision *col)
void copy_m3_m4(float m1[3][3], const float m2[4][4])
float manta_liquid_get_flip_particle_position_y_at(struct MANTA *liquid, int i)
@ eParticleSystemFlag_Pars
@ eParticleSystemFlag_psys_updated
bool DEG_is_active(const Depsgraph *depsgraph)
void BKE_collider_cache_free(ListBaseT< ColliderCache > **colliders)
void psys_sim_data_init(struct ParticleSimulationData *sim)
double BLI_rng_get_double(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static ParticleSettings * particle_settings_localize(ParticleSettings *particle_settings)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void psys_get_birth_coords(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra)
void BKE_ptcache_disk_to_mem(struct PTCacheID *pid)
void vec_to_quat(float q[4], const float vec[3], short axis, short upflag)
float manta_liquid_get_flip_particle_velocity_y_at(struct MANTA *liquid, int i)
int manta_get_res_y(struct MANTA *fluid)
Material * BKE_object_material_get(Object *ob, short act)
static void psys_sph_flush_springs(SPHData *sphdata)
@ IDWALK_NO_ORIG_POINTERS_ACCESS
struct RNG * BLI_rng_new_srandom(unsigned int seed)
void BLI_bvhtree_free(BVHTree *tree)
float manta_liquid_get_snd_particle_position_z_at(struct MANTA *liquid, int i)
static bool particles_has_spray(short parttype)
int manta_liquid_get_particle_res_x(struct MANTA *liquid)
int BKE_ptcache_id_reset(struct Scene *scene, PTCacheID *pid, int mode)
static void do_hair_dynamics(ParticleSimulationData *sim)
static float nr_distance_to_vert(float *p, float radius, ParticleCollisionElement *pce, float *)
void cloth_free_modifier(ClothModifierData *clmd)
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)
static ParticleSpring * sph_spring_add(ParticleSystem *psys, ParticleSpring *spring)
float normalize_qt(float q[4])
void void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params)
void boid_brain(BoidBrainData *bbd, int p, struct ParticleData *pa)
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
@ eModifierType_ParticleSystem
MINLINE float safe_acosf(float a)
static void update_timestep(ParticleSystem *psys, ParticleSimulationData *sim)
void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point)
void BLI_bvhtree_balance(BVHTree *tree)
void DEG_debug_print_eval(Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
float manta_liquid_get_snd_particle_position_y_at(struct MANTA *liquid, int i)
void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params)
void reset_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra)
void psys_thread_context_init(struct ParticleThreadContext *ctx, struct ParticleSimulationData *sim)
static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
static void sph_density_accum_cb(void *userdata, int index, const float co[3], float squared_dist)
void BKE_effectors_apply(ListBaseT< EffectorCache > *effectors, ListBaseT< ColliderCache > *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *wind_force, float *impulse)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
static int hair_needs_recalc(ParticleSystem *psys)
static void dynamics_step(ParticleSimulationData *sim, float cfra)
static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, float cfra)
void BKE_particlesystem_id_loop(struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
MINLINE int max_ii(int a, int b)
float manta_liquid_get_flip_particle_position_z_at(struct MANTA *liquid, int i)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
MINLINE void madd_v3fl_v3fl_v3fl_v3i(float r[3], const float a[3], const float b[3], const int c[3])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
ATTR_WARN_UNUSED_RESULT const BMVert * v
struct ParticleSystem * psys_orig_get(struct ParticleSystem *psys)
@ PART_FLUID_SPRAYFOAMBUBBLE
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
static ThreadRWMutex psys_bvhtree_rwlock
void BKE_curvemapping_free(CurveMapping *cumap)
static void update_courant_num(ParticleSimulationData *sim, ParticleData *pa, float dtime, SPHData *sphdata, SpinLock *spin)
static bool particles_has_flip(short parttype)
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
void psys_free_particles(struct ParticleSystem *psys)
float psys_get_timestep(struct ParticleSimulationData *sim)
void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode)
static void particlesystem_modifiersForeachIDLink(void *user_data, Object *, ID **id_pointer, const LibraryForeachIDCallbackFlag cb_flag)
static void collision_point_velocity(ParticleCollisionElement *pce)
void boids_precalc_rules(struct ParticleSettings *part, float cfra)
static void free_unexisting_particles(ParticleSimulationData *sim)
static void hair_step(ParticleSimulationData *sim, float cfra, const bool use_render_params)
int manta_liquid_get_num_snd_particles(struct MANTA *liquid)
static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, ListBaseT< ColliderCache > *colliders)
void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa)
MINLINE float pow3f(float x)
static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
MINLINE float pow4f(float x)
static void dynamics_step_sph_classical_integrate_task_cb_ex(void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls)
static bool psys_hair_use_simulation(ParticleData *pa, float max_length)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE float pow2f(float x)
AnimationEvalContext BKE_animsys_eval_context_construct(Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
void normalize_m4(float R[4][4]) ATTR_NONNULL()
static float collision_point_distance_with_normal(float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *nor)
void BKE_libblock_free_data(ID *id, bool do_id_user) ATTR_NONNULL()
static void evaluate_emitter_anim(Depsgraph *depsgraph, Scene *scene, Object *ob, float cfra)
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
static void psys_sph_init(ParticleSimulationData *sim, SPHData *sphdata, Map< OrderedEdge, int > &r_eh)
MINLINE void sub_v3_v3(float r[3], const float a[3])
void mul_qt_v3(const float q[4], float r[3])
void clothModifier_do(ClothModifierData *clmd, Depsgraph *depsgraph, Scene *scene, Object *ob, const Mesh *mesh, float(*vertexCos)[3])
void psys_count_keyed_targets(struct ParticleSimulationData *sim)
KDTree< CoordT > * kdtree_new(uint nodes_len_capacity)
bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys)
void mul_m4_v3(const float M[4][4], float r[3])
int BLI_system_thread_count()
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
float manta_liquid_get_flip_particle_velocity_z_at(struct MANTA *liquid, int i)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_uniquename(const ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
void BLI_spin_end(SpinLock *spin)
static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, float *impulse)
static void hair_create_input_mesh(ParticleSimulationData *sim, int totpoint, int totedge, Mesh **r_mesh)
VecBase< int32_t, 2 > int2
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
VecBase< int32_t, 3 > int3
static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr)
MINLINE void mul_v3_v3(float r[3], const float a[3])
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static void bvhtree_balance_isolated(void *userdata)
static float sync_timestep(ParticleSystem *psys, float t_frac)
void BKE_particle_settings_eval_reset(struct Depsgraph *depsgraph, struct ParticleSettings *particle_settings)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
void BLI_rw_mutex_unlock(ThreadRWMutex *mutex)
ListBaseT< ColliderCache > * BKE_collider_cache_create(struct Depsgraph *depsgraph, struct Object *self, struct Collection *collection)
void copy_qt_qt(float q[4], const float a[4])
void precalc_guides(struct ParticleSimulationData *sim, ListBaseT< EffectorCache > *effectors)
static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisionElement *pce, float *nor)
float manta_liquid_get_flip_particle_position_x_at(struct MANTA *liquid, int i)
BMesh const char void * data
void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics)
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
static void sphclassical_density_accum_cb(void *userdata, int index, const float co[3], float)
void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys)
ModifierData * BKE_modifier_new(int type)
int BLI_bvhtree_range_query(const BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata)
void BKE_psys_collision_neartest_cb(void *userdata, int index, const struct BVHTreeRay *ray, struct BVHTreeRayHit *hit)
static void save_hair(ParticleSimulationData *sim, float)
void kdtree_insert(KDTree< CoordT > *tree, int index, const CoordT &co)
void mat3_to_quat_legacy(float q[4], const float wmat[3][3])
void free_keyed_keys(struct ParticleSystem *psys)
@ PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL
Mesh * BKE_mesh_new_nomain(int verts_num, int edges_num, int faces_num, int corners_num)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
float psys_get_dietime_from_cache(struct PointCache *cache, int index)
static void psys_update_effectors(ParticleSimulationData *sim)
static void psys_update_path_cache(ParticleSimulationData *sim, float cfra, const bool use_render_params)
static MDeformVert * hair_set_pinning(MDeformVert *dvert, float weight)
MINLINE void negate_v3(float r[3])
static void system_step(ParticleSimulationData *sim, float cfra, const bool use_render_params)
void BKE_ptcache_id_time(PTCacheID *pid, struct Scene *scene, float cfra, int *startframe, int *endframe, float *timescale)
float manta_liquid_get_snd_particle_position_x_at(struct MANTA *liquid, int i)
static void dynamics_step_sph_classical_basic_integrate_task_cb_ex(void *__restrict userdata, const int p, const TaskParallelTLS *__restrict)
void psys_sph_density(struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
static bool particles_has_tracer(short parttype)
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
static void initialize_all_particles(ParticleSimulationData *sim)
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
static void init_particle_texture(ParticleSimulationData *sim, ParticleData *pa, int p)
static void psys_prepare_physics(ParticleSimulationData *sim)
void BKE_particlesystem_reset_all(struct Object *object)
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)
void psys_free_children(struct ParticleSystem *psys)
MINLINE void zero_v3(float r[3])
void BKE_id_free(Main *bmain, void *idv)
MINLINE float pow7f(float x)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
static void particles_fluid_step(ParticleSimulationData *sim, int cfra, const bool use_render_params)
float manta_liquid_get_snd_particle_velocity_x_at(struct MANTA *liquid, int i)
static void update_children(ParticleSimulationData *sim, const bool use_render_params)
void distribute_particles(struct ParticleSimulationData *sim, int from)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
void BKE_ptcache_validate(struct PointCache *cache, int framenr)
static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, float *)
void psys_calc_dmcache(struct Object *ob, struct Mesh *mesh_final, struct Mesh *mesh_original, struct ParticleSystem *psys)
static const float MIN_TIMESTEP
void particle_system_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
void BKE_animsys_evaluate_animdata(ID *id, AnimData *adt, const AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, bool flush_to_original)
void BKE_ptcache_free_mem(ListBaseT< PTCacheMem > *mem_cache)
void BLI_spin_unlock(SpinLock *spin)
MINLINE float normalize_v3(float n[3])
static void sphclassical_neighbor_accum_cb(void *userdata, int index, const float co[3], float)
void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
int manta_get_res_z(struct MANTA *fluid)
MINLINE void add_v3_v3(float r[3], const float a[3])
void kdtree_free(KDTree< CoordT > *tree)
static void sph_springs_modify(ParticleSystem *psys, float dtime)
static void reset_all_particles(ParticleSimulationData *sim, float dtime, float cfra, int from)
@ CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void BLI_spin_init(SpinLock *spin)
void psys_free_pdd(struct ParticleSystem *psys)
int psys_get_tot_child(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params)
void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3])
void BLI_task_isolate(void(*func)(void *userdata), void *userdata)
static void sph_spring_delete(ParticleSystem *psys, int j)
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)
static void get_angular_velocity_vector(short avemode, ParticleKey *state, float vec[3])
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void psys_update_particle_tree(struct ParticleSystem *psys, float cfra)
static void collision_interpolate_element(ParticleCollisionElement *pce, float t, float fac, ParticleCollision *col)
MINLINE float max_ff(float a, float b)
float psys_particle_value_from_verts(struct Mesh *mesh, short from, struct ParticleData *pa, float *values)
static const float TIMESTEP_EXPANSION_FACTOR
static const float TIMESTEP_EXPANSION_TOLERANCE
ListBaseT< EffectorCache > * BKE_effectors_create(struct Depsgraph *depsgraph, struct Object *ob_src, struct ParticleSystem *psys_src, struct EffectorWeights *weights, bool use_rotation)
void psys_thread_context_free(struct ParticleThreadContext *ctx)
void BKE_mesh_tessface_ensure(Mesh *mesh)
int manta_liquid_get_num_flip_particles(struct MANTA *liquid)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
static float collision_newton_rhapson(ParticleCollision *col, float radius, ParticleCollisionElement *pce, NRDistanceFunc distance_func)
static float get_base_time_step(ParticleSettings *part)
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])
MINLINE float interpf(float target, float origin, float t)
void psys_tasks_free(Vector< ParticleTask > &tasks)
float(*)(float *p, float radius, ParticleCollisionElement *pce, float *nor) NRDistanceFunc
float manta_liquid_get_snd_particle_velocity_y_at(struct MANTA *liquid, int i)
static void particle_settings_free_local(ParticleSettings *particle_settings)
void psys_reset(struct ParticleSystem *psys, int mode)
void invert_qt_qt_normalized(float q1[4], const float q2[4])
void boid_body(BoidBrainData *bbd, struct ParticleData *pa)
static void cached_step(ParticleSimulationData *sim, float cfra, const bool use_render_params)
void BKE_libblock_free_datablock(ID *id, int flag) ATTR_NONNULL()
void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, bool editupdate, bool use_render_params)
int manta_liquid_get_particle_upres(struct MANTA *liquid)
static int collision_sphere_to_verts(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t)
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
void psys_get_pointcache_start_end(struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
bool do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, ListBaseT< EffectorCache > *effectors, ParticleKey *state, int index, float time)
LibraryForeachIDCallbackFlag
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
static int collision_sphere_to_tri(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
static void collision_check(ParticleSimulationData *sim, int p, float dfra, float cfra)
int psys_uses_gravity(struct ParticleSimulationData *sim)
static void sph_evaluate_func(BVHTree *tree, ParticleSystem **psys, const float co[3], SPHRangeData *pfr, float interaction_radius, BVHTree_RangeQuery callback)
static int particles_are_dynamic(ParticleSystem *psys)
void psys_changed_type(struct Object *ob, struct ParticleSystem *psys)
@ CLOTH_COLLSETTINGS_FLAG_SELF
static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata)
static SPHData dynamics_step_sphdata_reduce(const SPHData &sphdata_to, const SPHData &sphdata_from)
MINLINE int min_ii(int a, int b)
pthread_rwlock_t ThreadRWMutex
@ SPH_CURRENT_REST_LENGTH
@ SPH_VISCOELASTIC_SPRINGS
void BLI_spin_lock(SpinLock *spin)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float DEG_get_ctime(const Depsgraph *graph)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
void BKE_ptcache_invalidate(struct PointCache *cache)
void BKE_particlesettings_fluid_default_settings(struct ParticleSettings *part)
static float nr_distance_to_edge(float *p, float radius, ParticleCollisionElement *pce, float *)
static bool particles_has_foam(short parttype)
void psys_check_boid_data(struct ParticleSystem *psys)
void mat3_to_quat(float q[4], const float mat[3][3])
int manta_get_res_x(struct MANTA *fluid)
static void sphclassical_calc_dens(ParticleData *pa, float, SPHData *sphdata)
static int tot_particles(ParticleSystem *psys, PTCacheID *pid)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void psys_sim_data_free(struct ParticleSimulationData *sim)
static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep)
static int collision_response(ParticleSimulationData *sim, ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, int kill, int dynamic_rotation)
float manta_liquid_get_flip_particle_velocity_x_at(struct MANTA *liquid, int i)
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time)
void BKE_effectors_free(ListBaseT< EffectorCache > *lb)
int psys_get_child_number(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params)
static void psys_clear_temp_pointcache(ParticleSystem *psys)
@ BKE_PARTICLE_BATCH_DIRTY_ALL
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
int get_render_child_particle_number(const RenderData *r, int child_num, bool for_render)
@ FLUID_DOMAIN_PARTICLE_FLIP
@ FLUID_DOMAIN_PARTICLE_TRACER
@ FLUID_DOMAIN_PARTICLE_FOAM
@ FLUID_DOMAIN_PARTICLE_SPRAY
@ FLUID_DOMAIN_PARTICLE_BUBBLE
float manta_liquid_get_snd_particle_velocity_z_at(struct MANTA *liquid, int i)
void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname) ATTR_NONNULL(1
#define PSYS_FLUID_SPRINGS_INITIAL_SIZE
#define COLLISION_MIN_RADIUS
#define COLLISION_INIT_STEP
#define COLLISION_MIN_DISTANCE
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct ParticleSimulationData * sim
struct ParticleSettings * part
ListBaseT< BoidState > states
CLOTH_COLLISIONSETTINGS_FLAGS flags
struct ClothHairData * hairdata
struct ClothSimSettings * sim_parms
struct PointCache * point_cache
struct ClothCollSettings * coll_parms
struct EffectorWeights * effector_weights
CLOTH_SIMSETTINGS_FLAGS flags
ParticleSimulationData * sim
ParticleSimulationData * sim
eEffectorWeight_Flag flag
eFluidDomain_ParticleTypes particle_type
struct FluidDomainSettings * domain
const c_style_mat & ptr() const
bke::MeshRuntime * runtime
void(*) foreach_ID_link(ModifierData *md, Object *ob, IDWalkFunc walk, void *user_data)
bke::ObjectRuntime * runtime
ListBaseT< struct ParticleSystem > particlesystem
struct ParticleSystem * psys
struct ParticleSystem * psys_eval
struct ParticleSystemModifierData * psmd_eval
struct PointCache * cache
ParticleCollisionElement pce
struct Object * skip[PARTICLE_COLLISION_MAX_COLLISIONS+1]
struct CollisionModifierData * md
float original_ray_length
eParticle_AliveState alive
struct Collection * collision_group
struct BoidSettings * boids
struct SPHFluidSettings * fluid
eParticleDistribution distr
eParticleChildType childtype
eParticleTimeFlag time_flag
eParticleRotationMode rotmode
eParticlePhysicsType phystype
eParticleAngularVelocityMode avemode
struct EffectorWeights * effector_weights
eParticleIntegrator integrator
ListBaseT< ColliderCache > * colliders
struct Depsgraph * depsgraph
struct ParticleSystem * psys
struct ParticleSystemModifierData * psmd
unsigned int particle_index[2]
ParticleSystemIDFunc func
struct ParticleSystem * psys
ParticleSystemModifierFlag flag
struct Mesh * mesh_original
struct ParticleDrawData * pdd
struct Mesh * hair_in_mesh
struct ClothModifierData * clmd
struct Mesh * hair_out_mesh
struct PTCacheEdit * edit
ListBaseT< ParticleTarget > targets
void(*) free_edit(struct PTCacheEdit *edit)
struct ListBaseT< struct EffectorCache > * effectors
struct ParticleCacheKey ** pathcache
eParticleSystem_Flag flag
struct PointCache * pointcache
ParticleSpring * fluid_springs
struct Object * target_ob
eParticleTarget_Flag flag
struct ParticleTarget * next
struct CurveMapping * clumpcurve
struct CurveMapping * roughcurve
struct ParticleSeam * seams
struct CurveMapping * twistcurve
struct ParticleSimulationData sim
ListBaseT< PTCacheMem > mem_cache
void(*) density_cb(void *rangedata_v, int index, const float co[3], float squared_dist)
Vector< ParticleSpring > new_springs
const Map< OrderedEdge, int > * eh
ParticleSystem * psys[10]
void(*) force_cb(void *sphdata_v, ParticleKey *state, float *force, float *impulse)
float plasticity_constant
SPHNeighbor neighbors[SPH_NEIGHBORS]
struct PhysicsSettings physics_settings
struct ToolSettings * toolsettings
size_t userdata_chunk_size