95 if ((use_render_params &&
97 (part->child_percent && part->childtype) ||
135 psys->
edit =
nullptr;
181 int totpart, totsaved = 0;
183 if (new_totpart < 0) {
185 totpart = part->grid_res;
186 totpart *= totpart * totpart;
189 totpart = part->totpart;
193 totpart = new_totpart;
196 if (totpart != psys->
totpart) {
199 psys->
edit =
nullptr;
206 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) {
321 int totdmelem, totelem, i;
322 const int *origindex;
323 const int *origindex_poly =
nullptr;
327 if (use_modifier_stack) {
332 totelem = mesh->verts_num;
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) {
359 nodedmelem =
static_cast<LinkNode *
>(
361 nodearray =
static_cast<LinkNode **
>(
364 for (i = 0, node = nodedmelem; i < totdmelem; i++, node++) {
369 if (use_modifier_stack) {
377 origindex_final = origindex_poly[origindex_final];
381 if (origindex_final !=
ORIGINDEX_NONE && origindex_final < totelem) {
382 if (nodearray[origindex_final]) {
384 node->next = nodearray[origindex_final];
385 nodearray[origindex_final] =
node;
388 nodearray[origindex_final] =
node;
401 if (use_modifier_stack) {
402 if (pa->num < totelem) {
411 if (pa->num < totelem && nodearray[pa->num]) {
420 mesh_final, mesh_original, pa->num, pa->fuv, nodearray);
456 int particles_per_task = numtasks > 0 ? (endpart - startpart) / numtasks : 0;
457 int remainder = numtasks > 0 ? (endpart - startpart) - particles_per_task * numtasks : 0;
461 *r_numtasks = numtasks;
465 for (
int i = 0; i < numtasks; i++) {
468 p = p + particles_per_task + (i < remainder ? 1 : 0);
474 BLI_assert(tasks[numtasks - 1].end == endpart);
483 for (i = 0; i < numtasks; i++) {
487 if (tasks[i].rng_path) {
539 BLI_kdtree_3d_free(ctx->
tree);
560 switch (part->type) {
565 pa->
time = part->sta + (part->end - part->sta) * ptex.
time;
581 pa->
flag &= ~PARS_UNEXIST;
582 pa->
time = part->sta + (part->end - part->sta) * birth_time;
609 if (!(emit_from_volume_grid && (pa->flag &
PARS_UNEXIST) != 0)) {
646 for (p = 0, pa = psys->
particles; p < newtotpart; p++, pa++, npa++) {
667 pa->boid = newboids++;
681 zvec[0] = zvec[1] = 0;
687 float zvec[3], temp[3];
688 zvec[0] = zvec[1] = 0;
716 float fac, phasefac,
nor[3] = {0, 0, 0}, loc[3], vel[3] = {0.0, 0.0, 0.0},
rot[4], q2[4];
717 float r_vel[3], r_ave[3], r_rot[4], vec[3], p_vel[3] = {0.0, 0.0, 0.0};
718 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},
719 rot_vec[3] = {0.0, 0.0, 0.0};
723 const bool use_tangents = ((use_boids ==
false) &&
762 mul_m4_v3(ob->object_to_world().ptr(), loc);
771 float phase = vg_rot ?
780 fac = -
sinf(
float(
M_PI) * (part->tanphase + phase));
794 r_vel[0] = 2.0f * (
psys_frand(psys, p + 10) - 0.5f);
795 r_vel[1] = 2.0f * (
psys_frand(psys, p + 11) - 0.5f);
796 r_vel[2] = 2.0f * (
psys_frand(psys, p + 12) - 0.5f);
804 r_ave[0] = 2.0f * (
psys_frand(psys, p + 13) - 0.5f);
805 r_ave[1] = 2.0f * (
psys_frand(psys, p + 14) - 0.5f);
806 r_ave[2] = 2.0f * (
psys_frand(psys, p + 15) - 0.5f);
813 if (part->randrotfac != 0.0f) {
814 r_rot[0] = 2.0f * (
psys_frand(psys, p + 16) - 0.5f);
815 r_rot[1] = 2.0f * (
psys_frand(psys, p + 17) - 0.5f);
816 r_rot[2] = 2.0f * (
psys_frand(psys, p + 18) - 0.5f);
817 r_rot[3] = 2.0f * (
psys_frand(psys, p + 19) - 0.5f);
825 float dvec[3], q[4], mat[3][3];
863 if (dtime != 0.0f && part->obfac != 0.0f) {
869 if (part->normfac != 0.0f) {
874 if (sim->
psmd && part->tanfac != 0.0f) {
879 if (part->ob_vel[0] != 0.0f) {
883 if (part->ob_vel[1] != 0.0f) {
887 if (part->ob_vel[2] != 0.0f) {
896 if (part->randfac != 0.0f) {
901 if (part->partfac != 0.0f) {
914 bool use_global_space;
917 switch (part->rotmode) {
921 use_global_space =
false;
925 use_global_space =
true;
931 use_global_space =
true;
937 use_global_space =
false;
940 use_global_space =
true;
946 if (use_global_space) {
951 if (part->randrotfac != 0.0f) {
967 float rot_vec_local[3];
984 float *rot_vec_local = tmat[0];
985 float *vtan_local = tmat[1];
986 float *utan_local = tmat[2];
1008 if (part->randrotfac != 0.0f) {
1020 phasefac = part->phasefac;
1021 if (part->randphasefac != 0.0f) {
1022 phasefac += part->randphasefac *
psys_frand(psys, p + 20);
1034 if (part->avemode) {
1115 if (part->randlife != 0.0f) {
1129 if (pa->
time > cfra) {
1132 else if (pa->
dietime <= cfra) {
1146 for (p = from, pa = sim->
psys->
particles + from; p < totpart; p++, pa++) {
1159 if (
ELEM(pt->
ob,
nullptr, ob)) {
1170 pt->
flag &= ~PTARGET_VALID;
1187 for (; pt; pt = pt->
next) {
1190 if (kpsys && kpsys->totpart) {
1220 psys->
flag &= ~PSYS_KEYED;
1233 pa->totkey = totkeys;
1238 psys->
flag &= ~PSYS_KEYED;
1241 for (k = 0; k < totkeys; k++) {
1242 ksim.
ob = pt->
ob ? pt->
ob : sim->
ob;
1258 if (pt->
duration != 0.0f && k + 1 < totkeys) {
1263 else if (totkeys > 1) {
1264 key->
time = pa->time +
float(k) /
float(totkeys - 1) * pa->lifetime;
1267 key->
time = pa->time;
1295 cache->
flag &= ~PTCACHE_DISK_CACHE;
1310 *sfra =
max_ii(1,
int(part->sta));
1311 *efra =
min_ii(
int(part->end + part->lifetime + 1.0f),
max_ii(scene->r.pefra, scene->r.efra));
1351 if (pa->state.time == cfra) {
1382 BLI_kdtree_3d_free(psys->
tree);
1383 psys->
tree = BLI_kdtree_3d_new(totpart);
1388 const float *co = (pa->state.time == cfra) ? pa->prev_state.co : pa->state.co;
1389 BLI_kdtree_3d_insert(psys->
tree, p, co);
1392 BLI_kdtree_3d_balance(psys->
tree);
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}, \
1425 float force[3], acceleration[3], impulse[3], dx[4][3] =
ZERO_F43, dv[4][3] =
ZERO_F43, oldpos[3];
1426 float pa_mass = (part->flag &
PART_SIZEMASS) ? (part->mass * pa->
size) : part->mass;
1428 int integrator = part->integrator;
1439 switch (integrator) {
1454 for (i = 0; i <
steps; i++) {
1458 states->
time = 0.0f;
1460 for (i = 0; i <
steps; i++) {
1464 force_func(forcedata, states + i, force, impulse);
1469 if (external_acceleration) {
1470 add_v3_v3(acceleration, external_acceleration);
1476 switch (integrator) {
1485 states[1].
time = dtime * 0.5f;
1503 states[1].
time = dtime * 0.5f;
1514 states[2].
time = dtime * 0.5f;
1524 states[3].
time = dtime;
1570#define PSYS_FLUID_SPRINGS_INITIAL_SIZE 256
1613 float h, d, Rij[3], rij, Lij;
1619 float timefix = 25.0f * dtime;
1635 d = yield_ratio * timefix * Lij;
1637 if (rij > Lij + d) {
1638 spring->
rest_length += plasticity * (rij - Lij - d) * timefix;
1640 else if (rij < Lij - d) {
1641 spring->
rest_length -= plasticity * (Lij - d - rij) * timefix;
1644 h = 4.0f * pa1->
size;
1673#define SPH_NEIGHBORS 512
1698 float interaction_radius,
1705 for (i = 0; i < 10 && psys[i]; i++) {
1706 pfr->
npsys = psys[i];
1731 if (npa == pfr->
pa || squared_dist < FLT_EPSILON) {
1749 dist =
sqrtf(squared_dist);
1750 q = (1.0f - dist / pfr->
h) * pfr->
massfac;
1756 pfr->
data[0] += q * q;
1757 pfr->
data[1] += q * q * q;
1767 float flow[3], offset[3], dist;
1798 float *gravity = sphdata->
gravity;
1799 const std::optional<blender::Map<blender::OrderedEdge, int>> &springhash = sphdata->
eh;
1801 float q, u, rij, dv[3];
1802 float pressure, near_pressure;
1808 float inv_mass = 1.0f / sphdata->
mass;
1809 float spring_constant = fluid->
spring_k;
1812 float interaction_radius = fluid->
radius *
1814 float h = interaction_radius * sphdata->
hfac;
1829 float density, near_density;
1831 int i, spring_index, index = pa - psys[0]->
particles;
1833 data[0] = data[1] = 0;
1842 near_density = data[1];
1844 pressure = stiffness * (density - rest_density);
1845 near_pressure = stiffness_near_fac * near_density;
1856 q = (1.0f - rij / h) * pfn->
psys->
part->
mass * inv_mass;
1865 madd_v3_v3fl(force, vec, -(pressure + near_pressure * q) * q);
1868 if (visc > 0.0f || stiff_visc > 0.0f) {
1872 if (u < 0.0f && visc > 0.0f) {
1876 if (u > 0.0f && stiff_visc > 0.0f) {
1881 if (spring_constant > 0.0f) {
1885 spring_index = springhash->lookup_default({index, pfn->
index}, 0);
1892 -10.0f * spring_constant * (1.0f - rij / h) * (spring->
rest_length - rij));
1908 force, vec, -10.0f * spring_constant * (1.0f - rij / h) * (rest_length - rij));
1914 if (fluid->
buoyancy > 0.0f && gravity) {
1932 float qfac = 21.0f / (256.0f *
float(
M_PI));
1941 rij_h = rij / pfr->
h;
1949 q = qfac /
pow3f(pfr->
h) *
pow4f(2.0f - rij_h) * (1.0f + 2.0f * rij_h);
1979 rij_h = rij / pfr->
h;
1999 float *gravity = sphdata->
gravity;
2001 float dq, u, rij, dv[3];
2002 float pressure, npressure;
2006 float interaction_radius;
2021 float qfac2 = 42.0f / (256.0f *
float(
M_PI));
2026 h = interaction_radius * sphdata->
hfac;
2054 rij_h = rij / pfr.
h;
2059 npressure = stiffness * (
pow7f(npa->
sphdensity / rest_density) - 1.0f);
2066 dq = qfac2 * (2.0f *
pow4f(2.0f - rij_h) - 4.0f *
pow3f(2.0f - rij_h) * (1.0f + 2.0f * rij_h));
2089 if (fluid->
buoyancy > 0.0f && gravity) {
2104 float interaction_radius = fluid->
radius *
2112 pfr.
h = interaction_radius * sphdata->
hfac;
2131 i++, pt = (pt ? pt->
next :
nullptr))
2146 sphdata->
pa =
nullptr;
2147 sphdata->
mass = 1.0f;
2152 sphdata->
hfac = 1.0f;
2158 sphdata->
hfac = 0.5f;
2182 float interaction_radius = fluid->
radius *
2187 density[0] = density[1] = 0.0f;
2189 pfr.
h = interaction_radius * sphdata->
hfac;
2194 vars[0] = pfr.
data[0];
2195 vars[1] = pfr.
data[1];
2208 float effector_acceleration[3];
2211 sphdata->
mass = pa_mass;
2217 mul_v3_fl(effector_acceleration, 1.0f / dtime);
2249 part->effector_weights,
2260 if (part->dragfac != 0.0f) {
2265 if (part->brownfac != 0.0f) {
2282 float *gravity =
nullptr, gr[3];
2298 part->effector_weights->global_gravity * efdata.
ptex.
gravity);
2308 if (part->dampfac != 0.0f) {
2316 CLAMP(time, 0.0f, 1.0f);
2334 float rotfac, rot1[4], rot2[4] = {1.0, 0.0, 0.0, 0.0}, dtime = dfra * timestep, extrotfac;
2356 if (len1 == 0.0f || len2 == 0.0f) {
2371 if (rotfac == 0.0f || (part->flag &
PART_ROT_DYN) == 0 || extrotfac == 0.0f) {
2393#define COLLISION_MIN_RADIUS 0.001f
2394#define COLLISION_MIN_DISTANCE 0.0001f
2395#define COLLISION_ZERO 0.00001f
2396#define COLLISION_INIT_STEP 0.00008f
2406 float p0[3], e1[3], e2[3], d;
2438 float v0[3], v1[3],
v2[3], c[3];
2466 float f = fac + t * (1.0f - fac);
2509 float u,
e[3], vec[3];
2535 float u,
e[3], vec[3],
nor[3];
2548 float p0[3], e1[3], e2[3],
nor[3];
2574 float t0, t1, dt_init, d0, d1, dd, n[3];
2579 if (
col->inv_total_time > 0.0f) {
2591 d0 = distance_func(
col->co1, radius, pce, n);
2595 for (iter = 0; iter < 10; iter++) {
2600 d1 = distance_func(pce->
p, radius, pce, n);
2603 if (iter == 0 && d0 < 0.0f && d0 > -radius) {
2618 d0 = distance_func(
col->co2, radius, pce, n);
2619 t1 = 1.0f - dt_init;
2627 dd = (t1 - t0) / (d1 - d0);
2636 if (iter == 0 && t1 < 0.0f) {
2639 d0 = distance_func(
col->co2, radius, pce, n);
2640 t1 = 1.0f - dt_init;
2644 if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.0f)) {
2654 CLAMP(t1, 0.0f, 1.0f);
2677 if (ct >= 0.0f && ct < *t && (result->inside == 0 || pce->
inside == 1)) {
2678 float e1[3], e2[3], p0[3];
2679 float e1e1, e1e2, e1p0, e2e2, e2p0, inv;
2692 inv = 1.0f / (e1e1 * e2e2 - e1e2 * e1e2);
2693 u = (e2e2 * e1p0 - e1e2 * e2p0) * inv;
2694 v = (e1e1 * e2p0 - e1e2 * e1p0) * inv;
2696 if (u >= 0.0f && u <= 1.0f && v >= 0.0f && u +
v <= 1.0f) {
2721 for (i = 0; i < 3; i++) {
2723 cur->
x[0] = pce->
x[i];
2724 cur->
x[1] = pce->
x[(i + 1) % 3];
2725 cur->
v[0] = pce->
v[i];
2726 cur->
v[1] = pce->
v[(i + 1) % 3];
2732 if (ct >= 0.0f && ct < *t) {
2733 float u,
e[3], vec[3];
2739 if (u < 0.0f || u > 1.0f) {
2755 return hit !=
nullptr;
2768 for (i = 0; i < 3; i++) {
2770 cur->
x[0] = pce->
x[i];
2771 cur->
v[0] = pce->
v[i];
2777 if (ct >= 0.0f && ct < *t) {
2788 return hit !=
nullptr;
2800 float t = hit->dist /
col->original_ray_length;
2803 pce.
x[0] = x[vert_tri[0]];
2804 pce.
x[1] = x[vert_tri[1]];
2805 pce.
x[2] = x[vert_tri[2]];
2807 pce.
v[0] =
v[vert_tri[0]];
2808 pce.
v[1] =
v[vert_tri[1]];
2809 pce.
v[2] =
v[vert_tri[2]];
2816 if (
col->pce.inside == 0) {
2822 hit->dist =
col->original_ray_length * t;
2845 col->pce.inside = 0;
2849 if (hit->dist == 0.0f) {
2850 hit->dist =
col->original_ray_length = 0.000001f;
2857 for (
int i = 0; i <
col->skip_count; i++) {
2858 if (coll->ob ==
col->skip[i]) {
2869 if (coll->ob ==
col->emitter && pa->
time <
col->cfra && pa->
time >=
col->old_cfra) {
2873 col->current = coll->ob;
2874 col->md = coll->collmd;
2875 col->fac1 = (
col->old_cfra - coll->collmd->time_x) /
2876 (coll->collmd->time_xnew - coll->collmd->time_x);
2877 col->fac2 = (
col->cfra - coll->collmd->time_x) /
2878 (coll->collmd->time_xnew - coll->collmd->time_x);
2880 if (
col->md &&
col->md->bvhtree) {
2892 return hit->index >= 0;
2899 int dynamic_rotation)
2907 float x = hit->dist /
col->original_ray_length;
2909 float f =
col->f + x * (1.0f -
col->f);
2911 float dt1 = (f -
col->f) *
col->total_time;
2913 float dt2 = (1.0f - f) *
col->total_time;
2943 float v0_dot, vc_dot;
2948 CLAMP(damp, 0.0f, 1.0f);
2949 CLAMP(frict, 0.0f, 1.0f);
2969 if (dynamic_rotation) {
2970 float vr_tan[3], v1_tan[3], ave[3];
2988 mul_v3_fl(v1_tan, 1.0f - 0.01f * frict);
3014 if (v0_dot < 0.0f) {
3016 if (v0_dot > 0.0f) {
3022 v0_dot *= 1.0f - damp;
3023 vc_dot *= through ? damp : 1.0f;
3027 if (through == 0 && ((vc_dot > 0.0f && v0_dot > 0.0f && vc_dot > v0_dot) ||
3028 (vc_dot < 0.0f && v0_dot < 0.0f && vc_dot < v0_dot)))
3032 else if (v0_dot > 0.0f) {
3036 mul_v3_v3fl(v0_nor, pce->
nor, vc_dot + (through ? 1.0f : -1.0f) * v0_dot);
3046 co[2] =
col->boid_z;
3095 col->skip[
col->skip_count++] =
col->hit;
3126 int collision_count = 0;
3132 col.total_time = timestep * dfra;
3133 col.inv_total_time = 1.0f /
col.total_time;
3134 col.inv_timestep = 1.0f / timestep;
3192 const bool use_render_params)
3197 int distr = 0, alloc = 0, skip = 0;
3253 else if (part->childtype == 0 &&
3265 if (part->childtype) {
3291 const float min_length = 0.1f * max_length;
3300 for (k = 1, key = pa->
hair + 1; k < pa->
totkey; k++, key++) {
3301 float length =
len_v3v3(key->
co, (key - 1)->co);
3302 if (length < min_length) {
3336 float hairmat[4][4];
3346 dvert = mesh->deform_verts_for_write().data();
3358 for (k = 1, key = pa->
hair + 1; k < pa->
totkey; k++, key++) {
3359 float length =
len_v3v3(key->
co, (key - 1)->co);
3360 if (max_length < length) {
3372 hair_radius = part->size;
3379 float root_mat[4][4];
3380 float bending_stiffness;
3387 mul_m4_m4m4(root_mat, sim->
ob->object_to_world().ptr(), hairmat);
3390 bending_stiffness = std::clamp(
3391 1.0f - part->bending_random *
psys_frand(psys, p + 666), 0.0f, 1.0f);
3393 for (k = 0, key = pa->
hair; k < pa->
totkey; k++, key++) {
3395 float *co, *co_next;
3398 co_next = (key + 1)->co;
3406 hair->radius = hair_radius;
3407 hair->bending_stiffness = bending_stiffness;
3410 sub_v3_v3(positions[vert_index], co_next);
3411 mul_m4_v3(hairmat, positions[vert_index]);
3427 hair->radius = hair_radius;
3428 hair->bending_stiffness = bending_stiffness;
3431 mul_m4_v3(hairmat, positions[vert_index]);
3452 hair_index += pa->
totkey + 1;
3481 totpoint += pa->
totkey + 1;
3486 realloc_roots =
false;
3489 if (totpoint != mesh->verts_num || totedge != mesh->edges_num) {
3492 realloc_roots =
true;
3527 reinterpret_cast<float(*)[3]
>(psys->
hair_out_mesh->vert_positions_for_write().data()));
3542 pa->
size = part->size;
3543 if (part->randsize > 0.0f) {
3551 pa->
flag &= ~PARS_NO_DISP;
3595 if (pa->
totkey == 0 || pa->
hair ==
nullptr) {
3601 key = root = pa->
hair;
3647 float relative_vel[3];
3662 return 1.0f /
float(part->subframes + 1);
3685 if (dt_target > psys->
dt_frac) {
3696 if (t_frac == 1.0f) {
3700 return 1.0f - t_frac;
3721 void *__restrict join_v,
3722 void *__restrict chunk_v)
3750 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3774 void *__restrict userdata,
const int p,
const TaskParallelTLS *__restrict )
3782 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3790 void *__restrict userdata,
const int p,
const TaskParallelTLS *__restrict tls)
3800 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3820 if ((pa = psys->
particles + p)->state.time <= 0.0f) {
3851 float birthtime, dietime;
3854 dfra = cfra - psys->
cfra;
3857 dtime = dfra * timestep;
3864 if (part->randsize > 0.0f) {
3883 switch (part->phystype) {
3897 for (; pt; pt = pt->
next) {
3899 if (psys_target && psys_target != psys) {
3910 for (; pt; pt = pt->
next) {
3928 if (part->randsize > 0.0f) {
3932 birthtime = pa->
time;
3938 if (dietime <= cfra && psys->cfra < dietime) {
3943 else if (birthtime <= cfra && birthtime >= psys->
cfra) {
3949 else if (dietime < cfra) {
3969 switch (part->phystype) {
4009 task_data.
sim = sim;
4010 task_data.cfra = cfra;
4011 task_data.timestep = timestep;
4012 task_data.dtime = dtime;
4022 settings.use_threading = (psys->
totpart > 100);
4023 settings.userdata_chunk = &sphdata;
4024 settings.userdata_chunk_size =
sizeof(sphdata);
4040 settings.use_threading = (psys->
totpart > 100);
4054 settings.use_threading = (psys->
totpart > 100);
4055 settings.userdata_chunk = &sphdata;
4056 settings.userdata_chunk_size =
sizeof(sphdata);
4068 settings.use_threading = (psys->
totpart > 100);
4069 settings.userdata_chunk = &sphdata;
4070 settings.userdata_chunk_size =
sizeof(sphdata);
4128 float disp, dietime;
4140 if (part->randsize > 0.0f) {
4147 if (pa->
time > cfra) {
4153 else if (dietime <= cfra) {
4164 pa->
flag &= ~PARS_NO_DISP;
4198 const bool use_render_params)
4221 int p, totpart = 0, tottypepart = 0;
4222 int flagActivePart, activeParts = 0;
4223 float posX, posY, posZ, velX, velY, velZ;
4224 float resX, resY, resZ;
4226 char debugStrBuffer[256];
4227 float tmp[3] = {0}, tmp2[3] = {0};
4230 float min[3], max[3], size[3], cell_size_scaled[3], max_size;
4245 sizeof(debugStrBuffer),
4246 "particles_fluid_step::error - found particle system that is not enabled in "
4261 for (p = 0; p < totpart; p++) {
4278 if (!totpart || !tottypepart) {
4283 tottypepart = (use_render_params) ? tottypepart : (part->disp * tottypepart) / 100;
4285 part->totpart = tottypepart;
4286 part->sta = part->end = 1.0f;
4294 double r, dispProb =
double(part->disp) / 100.0;
4297 for (p = 0, pa = psys->
particles; p < totpart; p++) {
4344 sizeof(debugStrBuffer),
4345 "particles_fluid_step::error - unknown particle system type\n");
4351 printf(
"system type is %d and particle type is %d\n", part->type, flagActivePart);
4370 printf(
"system type is %d and particle type is %d\n", part->type, flagActivePart);
4374 if (activeParts >= tottypepart) {
4384 pa->
size = part->size;
4385 if (part->randsize > 0.0f) {
4397 max_size = std::max(
4398 {size[0] /
float(upres), size[1] /
float(upres), size[2] /
float(upres)});
4401 const float posParticle[3] = {posX, posY, posZ};
4405 float resDomain[3] = {resX, resY, resZ};
4411 float scaleAbs[3] = {
4430 printf(
"pa->state.co[0]: %f, pa->state.co[1]: %f, pa->state.co[2]: %f\n",
4436 const float velParticle[3] = {velX, velY, velZ};
4441 printf(
"pa->state.vel[0]: %f, pa->state.vel[1]: %f, pa->state.vel[2]: %f\n",
4461 printf(
"active parts: %d\n", activeParts);
4463 totpart = psys->
totpart = part->totpart = activeParts;
4476 int oldtotpart = psys->
totpart;
4479 if (totpart != oldtotpart) {
4483 return totpart - oldtotpart;
4503 float disp, cache_cfra = cfra;
4504 int startframe = 0, endframe = 100, oldtotpart = 0;
4524 cache->
flag &= ~PTCACHE_REDO_NEEDED;
4527 CLAMP(cache_cfra, startframe, endframe);
4595 pa->
flag &= ~PARS_NO_DISP;
4600 int dframe, totframesback = 0;
4601 float t_frac, dt_frac;
4605 if (
int(cfra) == startframe && part->sta < startframe) {
4606 totframesback = startframe -
int(part->sta);
4613 else if (
int(cfra) == startframe) {
4622 for (dframe = -totframesback; dframe <= 0; dframe++) {
4625 for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) {
4628 psys->
cfra = cfra + dframe + t_frac - 1.0f;
4642 if (
int(cache_cfra) != startframe) {
4661 psys->
flag &= ~PSYS_KEYED;
4677 CLAMP(part->path_start, 0.0f, 100.0f);
4678 CLAMP(part->path_end, 0.0f, 100.0f);
4685 CLAMP(part->path_start, 0.0f, std::max(100.0f, part->end + part->lifetime));
4686 CLAMP(part->path_end, 0.0f, std::max(100.0f, part->end + part->lifetime));
4713 else if (pa->
boid) {
4781 return particle_settings_local;
4796 const bool use_render_params)
4806 psys->
pdd->
flag &= ~PARTICLE_DRAW_DATA_UPDATED;
4823 sim.
psmd->
flag &= ~eParticleSystemFlag_psys_updated;
4825 if (psys->
cfra == cfra) {
4839 psys->
flag &= ~PSYS_OB_ANIM_RESTORE;
4850 if (psys->
totpart == 0 && part->totpart == 0) {
4858 int i, recalc = psys->
recalc;
4864 psys_orig->
edit =
nullptr;
4874 psys->
part = part_local;
4877 for (i = 0; i <= part->hair_step; i++) {
4891 if (part_local != part) {
4904 hair_step(&sim, cfra, use_render_params);
4914 switch (part->phystype) {
4919 bool free_unexisting =
false;
4930 free_unexisting =
true;
4942 if (part->randsize > 0.0f) {
4952 pa->
flag &= ~PARS_NO_DISP;
4957 if (free_unexisting) {
4979 psys->
flag &= ~PSYS_OB_ANIM_RESTORE;
4982 if (psys_orig->
edit) {
4990 if (psys_orig != psys) {
4991 if (psys_orig->
edit !=
nullptr && psys_orig->
edit->
psys == psys_orig) {
4995 psys_orig->
flag = (psys->
flag & ~PSYS_SHARED_CACHES);
5026 data->
func(data->psys, id_pointer, data->userdata, cb_flag);
5038 if (psys->
clmd !=
nullptr) {
5045 data.userdata = userdata;
5065 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, 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)
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_NO_ORIG_POINTERS_ACCESS
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct 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)
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
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)
float psys_get_timestep(struct ParticleSimulationData *sim)
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
void(* ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, int cb_flag)
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)
@ BKE_PARTICLE_BATCH_DIRTY_ALL
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
@ PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL
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)
#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)
#define BLI_buffer_append(buffer_, type_, val_)
#define BLI_buffer_field_init(name_, type_)
#define BLI_buffer_append_array(buffer_, type_, data_, count_)
#define BLI_buffer_at(buffer_, type_, index_)
#define BLI_buffer_field_free(name_)
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)
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)
void(* BVHTree_RangeQuery)(void *userdata, int index, const float co[3], float dist_sq)
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.
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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)
typedef double(DMatrix)[4][4]
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_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.
@ PART_FLUID_SPRAYFOAMBUBBLE
@ SPH_CURRENT_REST_LENGTH
@ SPH_VISCOELASTIC_SPRINGS
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
static void mul(btAlignedObjectArray< T > &items, const Q &value)
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
bool add(const Key &key, const Value &value)
additional_info("compositor_sum_squared_difference_float_shared") .push_constant(Type output_img float dot(value.rgb, luminance_coefficients)") .define("LOAD(value)"
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
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)
float distance(float a, float b)
Frequency::GEOMETRY nor[]
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)
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)
float(*)(float *p, float radius, ParticleCollisionElement *pce, float *nor) NRDistanceFunc
static void collision_point_on_surface(const float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co)
static void dynamics_step_sphdata_reduce(const void *__restrict, void *__restrict join_v, void *__restrict chunk_v)
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 dynamics_step_sph_ddr_task_cb_ex(void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls)
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)
void psys_sph_init(ParticleSimulationData *sim, SPHData *sphdata)
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)
void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, ParticleTask **r_tasks, int *r_numtasks)
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])
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 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
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)
static void particlesystem_modifiersForeachIDLink(void *user_data, Object *, ID **id_pointer, int cb_flag)
#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 psys_tasks_free(ParticleTask *tasks, int numtasks)
void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, float cfra)
void BKE_particlesystem_reset_all(Object *object)
#define COLLISION_MIN_DISTANCE
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
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 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 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
ParticleThreadContext * ctx
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct CurveMapping * clumpcurve
struct ParticleSeam * seams
struct ParticleSimulationData sim
struct ListBase mem_cache
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)
std::optional< blender::Map< blender::OrderedEdge, int > > eh
float plasticity_constant
SPHNeighbor neighbors[SPH_NEIGHBORS]
struct PhysicsSettings physics_settings
struct ToolSettings * toolsettings