10#define DNA_DEPRECATED_ALLOW
105 std::optional<Library *> ,
132 for (
int a = 0; a <
MAX_MTEX; a++) {
133 if (partticle_settings_src->
mtex[a]) {
134 particle_settings_dst->
mtex[a] =
static_cast<MTex *
>(
147 for (
int a = 0; a <
MAX_MTEX; a++) {
183 if (psett->
mtex[
i]) {
231 switch (rule->type) {
254 BoidCondition *cond =
state->conditions.first;
255 for (; cond; cond = cond->next) {
285 if (dw->ob !=
nullptr) {
289 if (
object == dw->ob) {
311 for (
int a = 0; a <
MAX_MTEX; a++) {
366 for (
int a = 0; a <
MAX_MTEX; a++) {
384 ParticleSettings::id_type,
478 else if (p % totgr == cur) {
487#define PATH_CACHE_BUF_SIZE 1024
498 int i, totkey, totbufkey;
500 tot = std::max(tot, 1);
504 while (totkey < tot) {
510 for (
i = 0;
i < totbufkey;
i++) {
561 psys = psys->
next,
i++)
580 psys = psys->
next,
i++)
599 Object *lattice =
nullptr;
604 for (; md; md = md->
next) {
606 if (md->
mode & mode) {
646 for (; psys; psys = psys->
next) {
654 for (; psys; psys = psys->
next) {
670 if (object_eval ==
object) {
674 while (psys_eval !=
nullptr) {
678 psys_eval = psys_eval->
next;
697 if (
object ==
nullptr) {
723 if (use_render_params) {
749 ListBase instance_collection_objects = {
nullptr,
nullptr};
756 if (dw->ob ==
nullptr) {
758 if (base !=
nullptr) {
780 if (dw->
ob ==
nullptr ||
796 while (dw && dw->
ob !=
object) {
860 psys->
clmd =
nullptr;
925 psys->
child =
nullptr;
996 if (psys->
clmd !=
nullptr) {
1008 psys->
child =
nullptr;
1026 psys->
part =
nullptr;
1036 BLI_kdtree_3d_free(psys->
tree);
1093 for (p = 0, pa = psys_dst->
particles; p < psys_dst->totpart; p++, pa++) {
1102 if (key !=
nullptr) {
1105 if (boid !=
nullptr) {
1108 for (p = 0, pa = psys_dst->
particles; p < psys_dst->totpart; p++, pa++) {
1109 if (boid !=
nullptr) {
1112 if (key !=
nullptr) {
1125 float v1,
float v2,
float v3,
float v4,
const float w[4],
int four)
1129 value =
w[0] * v1 +
w[1] *
v2 +
w[2] * v3;
1134 CLAMP(value, 0.0f, 1.0f);
1210 *cur = (*cur)->
next;
1215 while (*cur && (*cur)->
next &&
float((*cur)->frame) < t) {
1216 *cur = (*cur)->
next;
1255 *r_start = pm->frame;
1264 *r_dietime = pm->frame + 1;
1275 int dietime = 10000000;
1280 dietime = pm->frame + 1;
1285 return float(dietime);
1303 else if (pind->
keyed) {
1305 pind->
kkey[0] = key;
1306 pind->
kkey[1] = pa->
totkey > 1 ? key + 1 :
nullptr;
1311 else if (pind->
cache) {
1312 float start = 0.0f, dietime = 0.0f;
1324 pind->
hkey[0] = key;
1325 pind->
hkey[1] = key + 1;
1331 float3 *positions = pind->
mesh->vert_positions_for_write().data();
1365 int point_vel = (point && point->
keys->
vel);
1366 float real_t, dfra, keytime, invdt = 1.0f;
1373 if (
result->time < 0.0f) {
1381 while (*(pind->
ekey[1]->
time) < real_t) {
1387 else if (pind->
keyed) {
1389 if (pind->
kkey[1] ==
nullptr) {
1394 if (
result->time < 0.0f) {
1407 while (pt && pa->
time + pt->
time < real_t) {
1425 while (pind->
kkey[1]->
time < real_t) {
1431 else if (pind->
cache) {
1432 if (
result->time < 0.0f) {
1440 if (
result->time < 0.0f) {
1448 while (pind->
hkey[1]->
time < real_t) {
1463 else if (pind->
mesh) {
1468 else if (pind->
keyed) {
1472 else if (pind->
cache) {
1481 if (!pind->
keyed && !pind->
cache && !point_vel) {
1483 if (pind->
ekey[0] != point->
keys) {
1490 else if (pind->
mesh) {
1515 else if (pind->
mesh) {
1533 dfra = keys[2].
time - keys[1].
time;
1534 keytime = (real_t - keys[1].
time) / dfra;
1537 if (pind->
keyed || pind->
cache || point_vel) {
1538 invdt = dfra * 0.04f * (psys ? psys->
part->
timetweak : 1.0f);
1556 if (pind->
keyed || pind->
cache || point_vel) {
1567 t *= (first + first->
segments)->time;
1573 if (cur->
time == t) {
1577 float dt = (t - (cur - 1)->time) / (cur->
time - (cur - 1)->time);
1585 if (cur == first || cur - 1 == first) {
1598 const float (*vert_positions)[3],
1599 const float (*vert_normals)[3],
1602 const float (*orcodata)[3],
1610 const float *v1 =
nullptr, *
v2 =
nullptr, *v3 =
nullptr, *v4 =
nullptr;
1611 float e1[3], e2[3], s1, s2, t1, t2;
1612 float *uv1, *uv2, *uv3, *uv4;
1613 float n1[3], n2[3], n3[3], n4[3];
1615 const float *o1, *o2, *o3, *o4;
1617 v1 = vert_positions[mface->
v1];
1618 v2 = vert_positions[mface->
v2];
1619 v3 = vert_positions[mface->
v3];
1626 v4 = vert_positions[mface->
v4];
1632 if (mface->
flag & ME_SMOOTH) {
1644 if (mface->
flag & ME_SMOOTH) {
1675 s1 = uv3[0] - uv1[0];
1676 s2 = uv4[0] - uv1[0];
1678 t1 = uv3[1] - uv1[1];
1679 t2 = uv4[1] - uv1[1];
1685 s1 = uv2[0] - uv1[0];
1686 s2 = uv3[0] - uv1[0];
1688 t1 = uv2[1] - uv1[1];
1689 t2 = uv3[1] - uv1[1];
1695 vtan[0] = (s1 * e2[0] - s2 * e1[0]);
1696 vtan[1] = (s1 * e2[1] - s2 * e1[1]);
1697 vtan[2] = (s1 * e2[2] - s2 * e1[2]);
1699 utan[0] = (t1 * e2[0] - t2 * e1[0]);
1700 utan[1] = (t1 * e2[1] - t2 * e1[1]);
1701 utan[2] = (t1 * e2[2] - t2 * e1[2]);
1706 o1 = orcodata[mface->
v1];
1707 o2 = orcodata[mface->
v2];
1708 o3 = orcodata[mface->
v3];
1711 o4 = orcodata[mface->
v4];
1727 float v10 = tface->
uv[0][0];
1728 float v11 = tface->
uv[0][1];
1729 float v20 = tface->
uv[1][0];
1730 float v21 = tface->
uv[1][1];
1731 float v30 = tface->
uv[2][0];
1732 float v31 = tface->
uv[2][1];
1736 v40 = tface->
uv[3][0];
1737 v41 = tface->
uv[3][1];
1739 uvco[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30 +
w[3] * v40;
1740 uvco[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31 +
w[3] * v41;
1743 uvco[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30;
1744 uvco[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31;
1750 const char *cp1, *cp2, *cp3, *cp4;
1754 cp1 = (
const char *)&mcol[0];
1755 cp2 = (
const char *)&mcol[1];
1756 cp3 = (
const char *)&mcol[2];
1759 cp4 = (
char *)&mcol[3];
1761 cp[0] = int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0] +
w[3] * cp4[0]);
1762 cp[1] = int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1] +
w[3] * cp4[1]);
1763 cp[2] = int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2] +
w[3] * cp4[2]);
1764 cp[3] = int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3] +
w[3] * cp4[3]);
1767 cp[0] = int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0]);
1768 cp[1] = int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1]);
1769 cp[2] = int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2]);
1770 cp[3] = int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3]);
1775 Mesh *mesh,
short from,
int index,
const float fw[4],
const float *values)
1777 if (values ==
nullptr || index == -1) {
1783 return values[index];
1788 MFace *mf = &mfaces[index];
1790 values[mf->
v1], values[mf->
v2], values[mf->
v3], values[mf->
v4], fw, mf->
v4);
1799 uv[0] =
w[1] +
w[2];
1800 uv[1] =
w[2] +
w[3];
1806 float v[4][3], co[3];
1808 v[0][0] = osface->
uv[0][0];
1809 v[0][1] = osface->
uv[0][1];
1811 v[1][0] = osface->
uv[1][0];
1812 v[1][1] = osface->
uv[1][1];
1814 v[2][0] = osface->
uv[2][0];
1815 v[2][1] = osface->
uv[2][1];
1822 v[3][0] = osface->
uv[3][0];
1823 v[3][1] = osface->
uv[3][1];
1834 Mesh *mesh_original,
1839 MFace *mtessface_final;
1843 const float(*faceuv)[2];
1845 const int *index_mf_to_mpoly_deformed =
nullptr;
1846 const int *index_mf_to_mpoly =
nullptr;
1847 const int *index_mp_to_orig =
nullptr;
1850 const int totface_deformed = mesh_original ? mesh_original->
totface_legacy : totface_final;
1852 if (
ELEM(0, totface_final, totface_deformed)) {
1856 index_mf_to_mpoly =
static_cast<const int *
>(
1858 index_mp_to_orig =
static_cast<const int *
>(
1862 if (mesh_original) {
1863 index_mf_to_mpoly_deformed =
static_cast<const int *
>(
1868 index_mf_to_mpoly_deformed = index_mf_to_mpoly;
1872 pindex_orig = index_mf_to_mpoly_deformed[findex_orig];
1874 if (mesh_original ==
nullptr) {
1875 mesh_original = mesh_final;
1878 index_mf_to_mpoly_deformed =
nullptr;
1885 if (osface_final ==
nullptr) {
1887 if (findex_orig < totface_final) {
1892 printf(
"\tNO CD_ORIGSPACE, error out of range\n");
1903 LinkNode *tessface_node = poly_nodes[pindex_orig];
1905 for (; tessface_node; tessface_node = tessface_node->
next) {
1907 faceuv = osface_final[findex_dst].
uv;
1911 if (mtessface_final[findex_dst].v4) {
1922 for (
int findex_dst = 0; findex_dst < totface_final; findex_dst++) {
1928 faceuv = osface_final[findex_dst].
uv;
1932 if (mtessface_final[findex_dst].v4) {
1988 *mapindex = index_dmcache;
1992 int i = index_dmcache;
2004 const MFace *mfaces =
static_cast<const MFace *
>(
2006 const MFace *mface = &mfaces[
i];
2008 if (osface ==
nullptr) {
2009 mapfw[0] = mapfw[1] = mapfw[2] = mapfw[3] = 0.0f;
2032 float tmpnor[3], mapfw[4];
2033 const float(*orcodata)[3];
2036 if (!
psys_map_index_on_dm(mesh_final, from, index, index_dmcache, fw, foffset, &mapindex, mapfw))
2039 vec[0] = vec[1] = vec[2] = 0.0;
2046 orco[0] = orco[1] = orco[2] = 0.0;
2049 utan[0] = utan[1] = utan[2] = 0.0;
2052 vtan[0] = vtan[1] = vtan[2] = 0.0;
2080 utan[0] = utan[1] = utan[2] = 0.0f;
2081 vtan[0] = vtan[1] = vtan[2] = 0.0f;
2090 mface = &mfaces[mapindex];
2101 reinterpret_cast<const float(*)[3]
>(vert_positions.
data()),
2102 reinterpret_cast<const float(*)[3]
>(vert_normals.
data()),
2124 reinterpret_cast<const float(*)[3]
>(vert_positions.
data()),
2125 reinterpret_cast<const float(*)[3]
>(vert_normals.
data()),
2160 if (psmd->
psys == psys) {
2183 const float zerovec[3] = {0.0f, 0.0f, 0.0f};
2269 psmd->
mesh_final, from, index, index_dmcache, fuv, foffset, vec,
nor, utan, vtan, orco);
2318 if (!eff->guide_data) {
2322 data = eff->guide_data + p;
2349 float effect[3] = {0.0f, 0.0f, 0.0f}, veffect[3] = {0.0f, 0.0f, 0.0f};
2350 float guidevec[4], guidedir[3], rot2[4], temp[3];
2351 float guidetime, radius, weight,
angle, totstrength = 0.0f;
2352 float vec_to_point[3];
2362 data = eff->guide_data + index;
2364 if (
data->strength <= 0.0f) {
2368 guidetime = time / (1.0f - pd->
free_end);
2370 if (guidetime > 1.0f) {
2374 cu = (
Curve *)eff->ob->data;
2378 data->strength * guidetime,
2389 if (
BKE_where_on_path(eff->ob, guidetime, guidevec, guidedir,
nullptr, &radius, &weight) ==
2396 mul_m4_v3(eff->ob->object_to_world().ptr(), guidevec);
2403 if (guidetime != 0.0f) {
2422 int(
data->strength * guidetime * 100.0f),
2440 const float par_co[3] = {0.0f, 0.0f, 0.0f};
2441 const float par_vel[3] = {0.0f, 0.0f, 0.0f};
2442 const float par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
2443 const float orco_offset[3] = {0.0f, 0.0f, 0.0f};
2477 totstrength +=
data->strength;
2480 totstrength *= weight;
2485 if (totstrength != 0.0f) {
2486 if (totstrength > 1.0f) {
2489 CLAMP(totstrength, 0.0f, 1.0f);
2513 float force[3] = {0.0f, 0.0f, 0.0f};
2563 child->
co[0] *= flat;
2579 float *vg =
nullptr;
2584 else if (psys->
vgroup[vgroup]) {
2585 const MDeformVert *dvert = mesh->deform_verts().data();
2589 if (psys->
vg_neg & (1 << vgroup)) {
2590 for (
i = 0;
i < totvert;
i++) {
2595 for (
i = 0;
i < totvert;
i++) {
2611 float co[3], orco[3];
2613 totparent = int(totchild * part->
parents * 0.3f);
2620 totparent = std::min(sim->
psys->
totpart, totparent);
2622 tree = BLI_kdtree_3d_new(totparent);
2624 for (p = 0, cpa = sim->
psys->
child; p < totparent; p++, cpa++) {
2652 BLI_kdtree_3d_insert(
tree, p, orco);
2656 BLI_kdtree_3d_balance(
tree);
2658 for (; p < totchild; p++, cpa++) {
2670 cpa->
parent = BLI_kdtree_3d_find_nearest(
tree, orco,
nullptr);
2673 BLI_kdtree_3d_free(
tree);
2680 const bool editupdate,
2681 const bool use_render_params)
2685 int totparent = 0, between = 0;
2695 if ((use_render_params == 0) &&
2705 totparent = int(totchild * part->
parents * 0.3f);
2715 if (use_render_params) {
2719 totchild = int(
float(totchild) *
float(part->
disp) / 100.0f);
2722 totparent = std::min(totparent, totchild);
2724 if (totchild == 0) {
2808 float *cpa_fuv =
nullptr, *par_rot =
nullptr,
rot[4];
2809 float orco[3], hairmat[4][4], dvec[3], off1[4][3], off2[4][3];
2810 float eff_length, eff_vec[3], weight[4];
2821 float foffset, wsum = 0.0f;
2843 memset(child_keys, 0,
sizeof(*child_keys) * (ctx->
segments + 1));
2847 for (
w = 0;
w < 4;
w++) {
2848 if (cpa->
pa[
w] >= 0) {
2849 key[
w] = pcache[cpa->
pa[
w]];
2850 weight[
w] = cpa->
w[
w];
2861 for (
w = 0;
w < 4;
w++) {
2862 if (
w && (weight[
w] > 0.0f)) {
2868 float d1 =
len_v3v3(key[0]->co, key[
w]->co);
2871 d = d1 > 0.0f ? d2 / d1 - 1.0f : 10000.0f;
2883 if (p_max > p_min) {
2884 d = (d - p_min) / (p_max - p_min);
2887 d = (d - p_min) <= 0.0f ? 0.0f : 1.0f;
2890 CLAMP(d, 0.0f, 1.0f);
2893 weight[
w] *= (1.0f - d);
2898 for (
w = 0;
w < 4;
w++) {
2924 mul_m4_v3(ob->object_to_world().ptr(), co);
2926 for (
w = 0;
w < 4;
w++) {
2940 memset(child_keys, 0,
sizeof(*child_keys) * (ctx->
segments + 1));
2944 key[0] = pcache[cpa->
parent];
2947 cpa_from = part->
from;
2991 for (k = 0, child = child_keys; k <= ctx->
segments; k++, child++) {
2999 for (
w = 0;
w < 4;
w++) {
3033 par_rot = key[0]->
rot;
3049 for (k = 0, child = child_keys; k <= ctx->
segments; k++, child++) {
3065 eff_length =
len_v3(eff_vec);
3081 par = cache[cpa->
parent];
3084 else if (cpa->
parent >= 0) {
3086 par = pcache[cpa->
parent];
3091 if (cpa->
pa[k] >= 0) {
3093 par = pcache[cpa->
pa[k]];
3119 ctx, &modifiers, cpa, &ptex, orco, hairmat, child_keys, par, par_orco);
3150 const bool editupdate,
3151 const bool use_render_params)
3209 float *prev_tangent,
3212 float cosangle,
angle, tangent[3], normal[3], q[4];
3228 cosangle =
dot_v3v3(tangent, prev_tangent);
3233 if (cosangle > 0.999999f) {
3267 float birthtime = 0.0, dietime = 0.0;
3268 float t, time = 0.0, dfra = 1.0;
3269 float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
3270 float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
3276 float *vg_effector =
nullptr;
3277 float *vg_length =
nullptr, pa_length = 1.0f;
3335 pind.
mesh = hair_mesh;
3337 memset(cache[p], 0,
sizeof(*cache[p]) * (segments + 1));
3360 if (birthtime >= dietime) {
3365 dietime = birthtime + pa_length * (dietime - birthtime);
3368 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3369 time = float(k) / float(segments);
3370 t = birthtime + time * (dietime - birthtime);
3390 for (k = 0, hkey = pa->hair; k < pa->totkey; k++, hkey++) {
3400 float effector = 1.0f;
3403 psmd->mesh_final, psys->
part->
from, pa, vg_effector);
3406 sub_v3_v3v3(vec, (cache[p] + 1)->co, cache[p]->co);
3409 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3411 sim, p, ca, k, segments, cache[p]->co, effector, dfra, cfra, &
length, vec);
3417 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3424 float(k) /
float(segments));
3431 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3439 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3442 if (k == segments) {
3453 ca->
time = float(k) / float(segments);
3497 if (point->
totkey == 0) {
3506 const int segments = iter_data->
segments;
3507 const bool use_weight = iter_data->
use_weight;
3509 float birthtime = 0.0f, dietime = 0.0f;
3510 float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f};
3514 pind.
cache =
nullptr;
3517 pind.
mesh =
nullptr;
3521 pind.
hkey[0] =
nullptr;
3527 memset(cache[iter], 0,
sizeof(*cache[iter]) * (segments + 1));
3544 if (birthtime >= dietime) {
3552 float t, time = 0.0f, keytime = 0.0f;
3553 for (k = 0, ca = cache[iter]; k <= segments; k++, ca++) {
3554 time = float(k) / float(segments);
3555 t = birthtime + time * (dietime - birthtime);
3568 if (k == segments) {
3581 ca->
vel[0] = ca->
vel[1] = 0.0f;
3593 if (
result.time < 0.0f) {
3601 while (pind.
hkey[1]->
time < real_t) {
3625 ca->
col[0] = 1.0f - keytime;
3631 ca->
col[0] = keytime;
3658 const bool use_render_params)
3668 int totpart = edit->
totpoint, recalc_set = 0;
3674 segments = std::max(segments, 4);
3684 for (
i = 0, point = edit->
points;
i < totpart;
i++, point++) {
3695 iter_data.
edit = edit;
3722 for (
i = 0, point = edit->
points;
i < totpart;
i++, point++) {
3738 float to_time = to->
time;
3759static void triatomat(
float *v1,
float *
v2,
float *v3,
const float (*uv)[2],
float mat[4][4])
3761 float det, w1, w2, d1[2], d2[2];
3763 memset(mat, 0,
sizeof(
float[4][4]));
3771 d1[0] = uv[1][0] - uv[0][0];
3772 d1[1] = uv[1][1] - uv[0][1];
3773 d2[0] = uv[2][0] - uv[0][0];
3774 d2[1] = uv[2][1] - uv[0][1];
3776 det = d2[0] * d1[1] - d2[1] * d1[0];
3783 mat[1][0] = w1 * (
v2[0] - v1[0]) + w2 * (v3[0] - v1[0]);
3784 mat[1][1] = w1 * (
v2[1] - v1[1]) + w2 * (v3[1] - v1[1]);
3785 mat[1][2] = w1 * (
v2[2] - v1[2]) + w2 * (v3[2] - v1[2]);
3789 mat[1][0] = mat[1][1] = mat[1][2] = 0.0f;
3805 const float(*orcodata)[3];
3839 triatomat(
v[0],
v[1],
v[2], (osface) ? osface->
uv :
nullptr, mat);
3871 float vec[3], orco[3];
3901 float facemat[4][4];
3905 mul_m4_m4m4(hairmat, ob->object_to_world().ptr(), facemat);
3923 if (name ==
nullptr) {
3924 name = (psys_orig !=
nullptr) ? psys_orig->
name :
DATA_(
"ParticleSystem");
3928 for (; psys; psys = psys->
next) {
3937 if (psys_orig !=
nullptr) {
3956 if (scene !=
nullptr) {
4155 tf =
static_cast<const MTFace *
>(
4157 if (tf ==
nullptr) {
4160 if (tf ==
nullptr) {
4199 texco[0] = texco[0] * 2.0f - 1.0f;
4200 texco[1] = texco[1] * 2.0f - 1.0f;
4207#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
4208 if ((event & mtex->mapto) & type) { \
4209 pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
4213#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
4214 if (event & type) { \
4215 CLAMP(pvalue, 0.0f, 1.0f); \
4219#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue) \
4220 if (event & type) { \
4221 if (pvalue < 0.0f) { \
4222 pvalue = 1.0f + pvalue; \
4224 CLAMP(pvalue, 0.0f, 1.0f); \
4228#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
4229 if (event & type) { \
4230 CLAMP(pvalue, -1.0f, 1.0f); \
4248 float value, rgba[4], texvec[3];
4258 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4260 if (mtex && mtex->
tex && mtex->
mapto) {
4263 short texco = mtex->
texco;
4300 texvec[0] = 2.0f * (cfra - par->
time) / (par->
dietime - par->
time) - 1.0f;
4338 float value, rgba[4], co[3], texvec[3];
4349 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4351 if (mtex && mtex->
tex && mtex->
mapto) {
4354 short texco = mtex->
texco;
4412 texvec[0] = 2.0f * (cfra - pa->
time) / (pa->
dietime - pa->
time) - 1.0f;
4428 int flip = (mtex->
timefac < 0.0f);
4430 ptex->
time *= 1.0f - timefac;
4431 ptex->
time += timefac * ((flip) ? 1.0f - value : value);
4496 *dietime = time + life;
4499 return (cfra - time) / life;
4539 int i = cpa - psys->
child;
4567 ctx->
mesh, cpa_from, cpa_num, cpa_fuv, ctx->
vg_kink);
4607 float co[3], orco[3];
4608 float hairmat[4][4];
4611 short between = 0, edit = 0;
4624 CLAMP(t, 0.0f, 1.0f);
4675 else if (totchild) {
4687 float par_co[3], par_orco[3];
4689 cpa = psys->
child + p - totpart;
4691 if (
state->time < 0.0f) {
4765 cpa_from = part->
from;
4803 ctx.
mesh = psmd->mesh_final;
4842 modifier_ctx.
sim = sim;
4843 modifier_ctx.
ptex = &ptex;
4844 modifier_ctx.
cpa = cpa;
4845 modifier_ctx.
orco = orco;
4859 tstate_tmp.
time = t - 0.001f;
4865 tstate_tmp.
time = t + 0.001f;
4903 cpa = psys->
child + p - totpart;
4938 cfra = std::min(cfra, pa->
dietime);
4942 state->time = -cfra;
4951 const float par_orco[3] = {0.0f, 0.0f, 0.0f};
4956 CLAMP(t, 0.0f, 1.0f);
4961 modifier_ctx.
sim = sim;
4962 modifier_ctx.
ptex =
nullptr;
4963 modifier_ctx.
cpa = cpa;
5005 dfra = keys[2].
time - keys[1].
time;
5007 keytime = (
state->time - keys[1].
time) / dfra;
5010 mul_v3_fl(keys[1].vel, dfra * timestep);
5011 mul_v3_fl(keys[2].vel, dfra * timestep);
5066 uv[0] = uv[1] = 0.0f;
5080 if (mtface !=
nullptr) {
5081 const MFace *mface =
static_cast<const MFace *
>(
5160 float loc[3],
nor[3], vec[3], side[3],
len;
5161 float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
5259 float hairmat[4][4], imat[4][4];
5261 for (p = 0; p < psys->
totpart; p++, pa++) {
5266 for (h = 0; h < pa->
totkey; h++, hkey++) {
5310 for (
int a = 0; a < psys->
totpart; a++, pa++) {
5353 for (a = 0, pa = psys->
particles; a < psys->totpart; a++, pa++) {
5359 for (a = 0, pa = psys->
particles; a < psys->totpart; a++, pa++) {
5374 for (a = 1, pa++; a < psys->
totpart; a++, pa++) {
5375 pa->
boid = (pa - 1)->boid + 1;
5380 for (a = 0, pa = psys->
particles; a < psys->totpart; a++, pa++) {
5392 psys->
edit =
nullptr;
5398 psys->
pdd =
nullptr;
5424 psys->
tree =
nullptr;
bool BKE_where_on_path(const struct Object *ob, float ctime, float r_vec[4], float r_dir[3], float r_quat[4], float *r_radius, float *r_weight)
struct BoidSettings * boid_copy_settings(const struct BoidSettings *boids)
void boid_free_settings(struct BoidSettings *boids)
void cloth_free_modifier(ClothModifierData *clmd)
bool BKE_collection_has_object_recursive(Collection *collection, Object *ob)
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
ListBase BKE_collection_object_cache_get(Collection *collection)
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer_n(const CustomData *data, eCustomDataType type, int n)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
int CustomData_get_render_layer(const CustomData *data, eCustomDataType type)
void * CustomData_get_for_write(CustomData *data, int index, eCustomDataType type, int totelem)
display list (or rather multi purpose list) stuff.
float BKE_displist_calc_taper(struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *taperobj, int cur, int tot)
void BKE_partdeflect_free(struct PartDeflect *pd)
struct PartDeflect * BKE_partdeflect_new(int type)
struct EffectorWeights * BKE_effector_add_weights(struct Collection *collection)
float effector_falloff(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, struct EffectorWeights *weights)
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 PartDeflect * BKE_partdeflect_copy(const struct PartDeflect *pd_src)
void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point)
void key_curve_position_weights(float t, float data[4], KeyInterpolationType type)
LatticeDeformData * BKE_lattice_deform_data_create(const Object *oblatt, const Object *ob) ATTR_WARN_UNUSED_RESULT
void BKE_lattice_deform_data_destroy(LatticeDeformData *lattice_deform_data)
void BKE_lattice_deform_data_eval_co(LatticeDeformData *lattice_deform_data, float co[3], float weight)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void BKE_id_free(Main *bmain, void *idv)
void * BKE_id_new(Main *bmain, short type, const char *name)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_DO_DEPRECATED_POINTERS
General operations, lookup, etc. for materials.
Material * BKE_object_material_get(Object *ob, short act)
void BKE_mesh_orco_verts_transform(Mesh *mesh, blender::MutableSpan< blender::float3 > orco, bool invert)
void BKE_mesh_texspace_ensure(Mesh *mesh)
BLI_INLINE int BKE_mesh_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
void BKE_mesh_tessface_ensure(Mesh *mesh)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
void BKE_modifiers_persistent_uid_init(const Object &object, ModifierData &md)
void BKE_modifier_unique_name(ListBase *modifiers, ModifierData *md)
void BKE_modifier_free(ModifierData *md)
void BKE_modifier_remove_from_list(Object *ob, ModifierData *md)
ModifierData * BKE_modifier_new(int type)
General operations, lookup, etc. for blender objects.
void BKE_object_modifier_set_active(Object *ob, ModifierData *md)
void psys_thread_context_init(struct ParticleThreadContext *ctx, struct ParticleSimulationData *sim)
#define LOOP_SHOWN_PARTICLES
void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname) ATTR_NONNULL(1
void psys_apply_child_modifiers(struct ParticleThreadContext *ctx, struct ListBase *modifiers, struct ChildParticle *cpa, struct ParticleTexture *ptex, const float orco[3], float hairmat[4][4], struct ParticleCacheKey *keys, struct ParticleCacheKey *parent_keys, const float parent_orco[3])
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
void(* BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode)
void psys_thread_context_free(struct ParticleThreadContext *ctx)
unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
blender::Vector< ParticleTask > psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart)
void psys_tasks_free(blender::Vector< ParticleTask > &tasks)
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
void(* BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys)
void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys)
struct PointCache * BKE_ptcache_add(struct ListBase *ptcaches)
#define PTCACHE_CLEAR_ALL
void BKE_ptcache_blend_read_data(struct BlendDataReader *reader, struct ListBase *ptcaches, struct PointCache **ocache, int force_disk)
int BKE_ptcache_mem_index_find(struct PTCacheMem *pm, unsigned int index)
void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
void BKE_ptcache_make_particle_key(struct ParticleKey *key, int index, void **data, float time)
void BKE_ptcache_free_list(struct ListBase *ptcaches)
void BKE_ptcache_blend_write(struct BlendWriter *writer, struct ListBase *ptcaches)
float BKE_scene_frame_to_ctime(const Scene *scene, int frame)
void BKE_texture_mtex_foreach_id(struct LibraryForeachIDData *data, struct MTex *mtex)
void BLI_bvhtree_free(BVHTree *tree)
A KD-tree for nearest neighbor search.
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
MINLINE int max_ii(int a, int b)
MINLINE float safe_acosf(float a)
int isect_point_quad_v2(const float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3], const float x2[3], const float v2[3], float t)
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void interp_weights_poly_v3(float w[], float v[][3], int n, const float co[3])
bool map_to_sphere(float *r_u, float *r_v, float x, float y, float z)
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void transpose_m3_m4(float R[3][3], const float M[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void transpose_m4(float R[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void unit_m4(float m[4][4])
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 quat_to_mat4(float m[4][4], const 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 mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void copy_qt_qt(float q[4], const float a[4])
MINLINE void copy_v4_v4(float r[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 sub_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[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])
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t)
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 cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4])
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 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
ATTR_WARN_UNUSED_RESULT const size_t num
void int BLI_rng_get_int(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
struct RNG * BLI_rng_new(unsigned int seed)
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
struct RNG * BLI_rng_new_srandom(unsigned int seed)
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * STRNCPY(char(&dst)[N], const char *src)
void BLI_task_pool_work_and_wait(TaskPool *pool)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
TaskPool * BLI_task_pool_create(void *userdata, eTaskPriority priority)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void BLI_task_pool_free(TaskPool *pool)
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
#define POINTER_AS_INT(i)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct_array(reader, struct_name, array_size, ptr_p)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_PARTICLESETTINGS
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
float DEG_get_ctime(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
Scene * DEG_get_input_scene(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ eBoidRuleType_FollowLeader
@ eBoidRuleType_AvoidCollision
@ eBoidRuleType_AverageSpeed
Object groups, one object can be in many groups at once.
#define DNA_struct_default_get(struct_name)
@ SNDPARTICLE_COMBINED_EXPORT_OFF
@ FLUID_DOMAIN_PARTICLE_SPRAY
@ FLUID_DOMAIN_PARTICLE_FOAM
@ FLUID_DOMAIN_PARTICLE_TRACER
@ FLUID_DOMAIN_PARTICLE_FLIP
@ FLUID_DOMAIN_PARTICLE_BUBBLE
@ eModifierType_ParticleSystem
@ eModifierType_DynamicPaint
@ PFIELD_GUIDE_PATH_WEIGHT
@ SPH_VISCOELASTIC_SPRINGS
@ PART_FLUID_SPRAYFOAMBUBBLE
@ PART_CHILD_USE_TWIST_CURVE
@ PART_CHILD_USE_CLUMP_CURVE
@ PART_CHILD_USE_CLUMP_NOISE
@ PART_CHILD_USE_ROUGH_CURVE
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static unsigned long seed
constexpr const T * data() const
blender::gpu::Batch * quad
float length(VecOp< float, D >) RET
#define CD_MASK_ORIGINDEX
#define CD_MASK_MDEFORMVERT
#define CD_MASK_ORIGSPACE_MLOOP
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
VecBase< float, 3 > float3
void BKE_particle_batch_cache_dirty_tag(ParticleSystem *psys, int mode)
void BKE_particlesettings_clump_curve_init(ParticleSettings *part)
void BKE_particle_system_blend_read_after_liblink(BlendLibReader *, Object *ob, ID *, ListBase *particles)
static int psys_map_index_on_dm(Mesh *mesh, int from, int index, int index_dmcache, const float fw[4], float, int *mapindex, float mapfw[4])
static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *bufs)
static void particle_settings_blend_read_after_liblink(BlendLibReader *, ID *id)
ParticleSystem * psys_get_current(Object *ob)
void BKE_particle_system_blend_read_data(BlendDataReader *reader, ListBase *particles)
void psys_mat_hair_to_object(Object *, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
void psys_particle_on_emitter(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])
void free_hair(Object *object, ParticleSystem *psys, int dynamics)
void object_remove_particle_system(Main *bmain, Scene *, Object *ob, ParticleSystem *psys)
static void psys_w_to_origspace(const float w[4], float uv[2])
void psys_free_particles(ParticleSystem *psys)
float psys_get_timestep(ParticleSimulationData *sim)
float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
static void particle_settings_blend_read_data(BlendDataReader *reader, ID *id)
void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)
static void particle_settings_init(ID *id)
ParticleSettings * BKE_particlesettings_add(Main *bmain, const char *name)
void BKE_particle_system_blend_write(BlendWriter *writer, ListBase *particles)
static ParticleCacheKey ** psys_alloc_path_cache_buffers(ListBase *bufs, int tot, int totkeys)
static int get_pointcache_times_for_particle(PointCache *cache, int index, float *r_start, float *r_dietime)
ParticleSystem * psys_eval_get(Depsgraph *depsgraph, Object *object, ParticleSystem *psys)
void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, ParticleKey *result, bool velocity)
static int get_particle_uv(Mesh *mesh, ParticleData *pa, int index, const float fuv[4], const char *name, float *texco, bool from_vert)
static void psys_cache_edit_paths_iter(void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict)
void psys_sim_data_init(ParticleSimulationData *sim)
void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
void psys_free(Object *ob, ParticleSystem *psys)
void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *mc)
void psys_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float uvco[2])
void psys_enable_all(Object *ob)
ModifierData * object_add_particle_system(Main *bmain, const Scene *scene, Object *ob, const char *name)
static float interpolate_particle_value(float v1, float v2, float v3, float v4, const float w[4], int four)
static void get_pointcache_keys_for_time(Object *, PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2)
static void init_particle_interpolation(Object *ob, ParticleSystem *psys, ParticleData *pa, ParticleInterpolationData *pind)
void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *state, const bool vel)
static PTCacheEdit * psys_orig_edit_get(ParticleSystem *psys)
static void edit_to_particle(ParticleKey *key, PTCacheEditKey *ekey)
void BKE_particlesettings_rough_curve_init(ParticleSettings *part)
int psys_particle_dm_face_lookup(Mesh *mesh_final, Mesh *mesh_original, int findex_orig, const float fw[4], LinkNode **poly_nodes)
static void offset_child(ChildParticle *cpa, ParticleKey *par, float *par_rot, ParticleKey *child, float flat, float radius)
void psys_mat_hair_to_global(Object *ob, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
void psys_emitter_customdata_mask(ParticleSystem *psys, CustomData_MeshMasks *r_cddata_masks)
void BKE_particle_init_rng()
static void get_cpa_texture(Mesh *mesh, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue)
void psys_free_children(ParticleSystem *psys)
ParticleSystemModifierData * psys_get_modifier(Object *ob, ParticleSystem *psys)
static void psys_thread_create_path(ParticleTask *task, ChildParticle *cpa, ParticleCacheKey *child_keys, int i)
bool psys_check_edited(ParticleSystem *psys)
void BKE_particle_partdeflect_blend_read_data(BlendDataReader *, PartDeflect *)
void psys_sim_data_free(ParticleSimulationData *sim)
static ParticleCacheKey * pcache_key_segment_endpoint_safe(ParticleCacheKey *key)
static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCacheKey *result)
ModifierData * object_copy_particle_system(Main *bmain, const Scene *scene, Object *ob, const ParticleSystem *psys_orig)
static float psys_interpolate_value_from_verts(Mesh *mesh, short from, int index, const float fw[4], const float *values)
void psys_check_group_weights(ParticleSettings *part)
void psys_apply_hair_lattice(Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys)
void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, const bool editupdate, const bool use_render_params)
void psys_mat_hair_to_orco(Object *ob, Mesh *mesh, short from, ParticleData *pa, float hairmat[4][4])
void psys_find_parents(ParticleSimulationData *sim, const bool use_render_params)
void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit)
static void hair_to_particle(ParticleKey *key, HairKey *hkey)
static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData *pa, float t, ParticleInterpolationData *pind, ParticleKey *result)
void(* BKE_particle_batch_cache_free_cb)(ParticleSystem *psys)
float * psys_cache_vgroup(Mesh *mesh, ParticleSystem *psys, int vgroup)
static void triatomat(float *v1, float *v2, float *v3, const float(*uv)[2], float mat[4][4])
bool psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *state, const bool always)
static void particle_settings_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
void(* BKE_particle_batch_cache_dirty_tag_cb)(ParticleSystem *psys, int mode)
static void exec_child_path_cache(TaskPool *__restrict, void *taskdata)
void psys_set_current_num(Object *ob, int index)
void psys_free_pdd(ParticleSystem *psys)
int psys_uses_gravity(ParticleSimulationData *sim)
static void free_child_path_cache(ParticleSystem *psys)
static void fluid_free_settings(SPHFluidSettings *fluid)
void psys_copy_particles(ParticleSystem *psys_dst, ParticleSystem *psys_src)
static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4], float neww[4])
float psys_get_dietime_from_cache(PointCache *cache, int index)
static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCacheKey *key1, ParticleCacheKey *key2, float *prev_tangent, int i)
static void particle_settings_free_data(ID *id)
void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float uv[2], float orco[3])
short psys_get_current_num(Object *ob)
bool psys_check_enabled(Object *ob, ParticleSystem *psys, const bool use_render_params)
void psys_get_from_key(ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)
void psys_vec_rot_to_face(Mesh *mesh, ParticleData *pa, float vec[3])
static void particle_settings_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_particle_batch_cache_free(ParticleSystem *psys)
void free_keyed_keys(ParticleSystem *psys)
void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_render_params)
float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float, float *)
bool do_guides(Depsgraph *depsgraph, ParticleSettings *part, ListBase *effectors, ParticleKey *state, int index, float time)
static void get_child_modifier_parameters(ParticleSettings *part, ParticleThreadContext *ctx, ChildParticle *cpa, short cpa_from, int cpa_num, float *cpa_fuv, float *orco, ParticleTexture *ptex)
void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa, ChildParticle *cpa, ParticleCacheKey *cache, float mat[4][4], float *scale)
void psys_find_group_weights(ParticleSettings *part)
int count_particles_mod(ParticleSystem *psys, int totgr, int cur)
void psys_interpolate_face(Mesh *mesh, const float(*vert_positions)[3], const float(*vert_normals)[3], const MFace *mface, MTFace *tface, const float(*orcodata)[3], float w[4], float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
#define PATH_CACHE_BUF_SIZE
static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *, float effector, float, float, float *length, float *vec)
void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTexture *ptex, int event, float cfra)
void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCacheEdit *edit, float cfra, const bool use_render_params)
float psys_particle_value_from_verts(Mesh *mesh, short from, ParticleData *pa, float *values)
static bool psys_thread_context_init_path(ParticleThreadContext *ctx, ParticleSimulationData *sim, Scene *scene, float cfra, const bool editupdate, const bool use_render_params)
void psys_disable_all(Object *ob)
static void write_boid_state(BlendWriter *writer, BoidState *state)
static void mvert_to_particle(ParticleKey *key, float3 *position, HairKey *hkey)
void psys_particle_on_dm(Mesh *mesh_final, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
static ModifierData * object_add_or_copy_particle_system(Main *bmain, const Scene *scene, Object *ob, const char *name, const ParticleSystem *psys_orig)
static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4][4], int orco)
ParticleSystem * psys_orig_get(ParticleSystem *psys)
bool psys_in_edit_mode(Depsgraph *depsgraph, const ParticleSystem *psys)
static void particle_settings_foreach_id(ID *id, LibraryForeachIDData *data)
static void psys_particle_on_shape(int, int, float *, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)
int count_particles(ParticleSystem *psys)
void BKE_particlesettings_twist_curve_init(ParticleSettings *part)
static void psys_task_init_path(ParticleTask *task, ParticleSimulationData *sim)
float do_clump(ParticleKey *state, const float par_co[3], float time, const float orco_offset[3], float clumpfac, float clumppow, float pa_clump, bool use_clump_noise, float clump_noise_size, const CurveMapping *clumpcurve)
void do_kink(ParticleKey *state, const float par_co[3], const float par_vel[3], const float par_rot[4], float time, float freq, float shape, float amplitude, float flat, short type, short axis, const float obmat[4][4], int smooth_start)
void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, float mat[4][4], ParticleKey *state, float t)
ParticleSystemModifierData * psmd
struct ClothSolverResult * solver_result
struct ClothHairData * hairdata
struct Cloth * clothObject
struct PointCache * point_cache
struct ClothSimSettings * sim_parms
struct ClothCollSettings * coll_parms
struct EffectorWeights * effector_weights
struct ParticleSystem * psys
struct DynamicPaintBrushSettings * brush
struct Collection * group
char sndparticle_combined_export
struct ParticleSystem * psys
struct FluidDomainSettings * domain
struct FluidFlowSettings * flow
MeshRuntimeHandle * runtime
float texspace_location[3]
struct ModifierData * next
struct PTCacheEditKey * keys
struct ParticleCacheKey ** pathcache
PTCacheEditPoint * points
struct ParticleSystem * psys
struct ParticleSystemModifierData * psmd_eval
ParticleThreadContext * thread_ctx
ParticleCacheKey * parent_keys
ParticleSimulationData * sim
struct ParticleDupliWeight * next
float3 * vert_positions[2]
PTCacheEditPoint * epoint
struct CurveMapping * clumpcurve
struct Collection * collision_group
struct Collection * instance_collection
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct BoidSettings * boids
struct EffectorWeights * effector_weights
struct ListBase instance_weights
struct Object * instance_object
struct SPHFluidSettings * fluid
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ListBase * colliders
struct ParticleSystem * psys
ParticleSpring * fluid_springs
struct PTCacheEdit * edit
struct ListBase * effectors
struct ParticleSystem * next
struct PointCache * pointcache
struct ClothModifierData * clmd
struct LatticeDeformData * lattice_deform_data
struct ParticleCacheKey ** childcache
struct Mesh * hair_in_mesh
struct ParticleSystem * orig_psys
struct Mesh * hair_out_mesh
struct ParticleDrawData * pdd
struct ParticleCacheKey ** pathcache
void(* free_edit)(struct PTCacheEdit *edit)
struct ParticleTarget * prev
struct ParticleTarget * next
ParticleThreadContext * ctx
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct CurveMapping * clumpcurve
struct ParticleSimulationData sim
struct ListBase mem_cache
struct PTCacheEdit * edit
struct PhysicsSettings physics_settings
struct ToolSettings * toolsettings
bool RE_texture_evaluate(const MTex *mtex, const float vec[3], const int thread, ImagePool *pool, const bool skip_load_image, const bool texnode_preview, float *r_intensity, float r_rgba[4])
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype)