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,
479 else if (p % totgr == cur) {
488#define PATH_CACHE_BUF_SIZE 1024
499 int i, totkey, totbufkey;
501 tot = std::max(tot, 1);
505 while (totkey < tot) {
511 for (
i = 0;
i < totbufkey;
i++) {
562 psys = psys->
next,
i++)
581 psys = psys->
next,
i++)
600 Object *lattice =
nullptr;
605 for (; md; md = md->
next) {
607 if (md->
mode & mode) {
647 for (; psys; psys = psys->
next) {
655 for (; psys; psys = psys->
next) {
671 if (object_eval ==
object) {
675 while (psys_eval !=
nullptr) {
679 psys_eval = psys_eval->
next;
698 if (
object ==
nullptr) {
724 if (use_render_params) {
750 ListBase instance_collection_objects = {
nullptr,
nullptr};
757 if (dw->ob ==
nullptr) {
759 if (base !=
nullptr) {
781 if (dw->
ob ==
nullptr ||
797 while (dw && dw->
ob !=
object) {
861 psys->
clmd =
nullptr;
926 psys->
child =
nullptr;
997 if (psys->
clmd !=
nullptr) {
1009 psys->
child =
nullptr;
1027 psys->
part =
nullptr;
1037 BLI_kdtree_3d_free(psys->
tree);
1094 for (p = 0, pa = psys_dst->
particles; p < psys_dst->totpart; p++, pa++) {
1103 if (key !=
nullptr) {
1106 if (boid !=
nullptr) {
1109 for (p = 0, pa = psys_dst->
particles; p < psys_dst->totpart; p++, pa++) {
1110 if (boid !=
nullptr) {
1113 if (key !=
nullptr) {
1126 float v1,
float v2,
float v3,
float v4,
const float w[4],
int four)
1130 value =
w[0] * v1 +
w[1] *
v2 +
w[2] * v3;
1135 CLAMP(value, 0.0f, 1.0f);
1211 *cur = (*cur)->
next;
1216 while (*cur && (*cur)->
next &&
float((*cur)->frame) < t) {
1217 *cur = (*cur)->
next;
1256 *r_start = pm->frame;
1265 *r_dietime = pm->frame + 1;
1276 int dietime = 10000000;
1281 dietime = pm->frame + 1;
1286 return float(dietime);
1304 else if (pind->
keyed) {
1306 pind->
kkey[0] = key;
1307 pind->
kkey[1] = pa->
totkey > 1 ? key + 1 :
nullptr;
1312 else if (pind->
cache) {
1313 float start = 0.0f, dietime = 0.0f;
1325 pind->
hkey[0] = key;
1326 pind->
hkey[1] = key + 1;
1332 float3 *positions = pind->
mesh->vert_positions_for_write().data();
1366 int point_vel = (point && point->
keys->
vel);
1367 float real_t, dfra, keytime, invdt = 1.0f;
1374 if (
result->time < 0.0f) {
1382 while (*(pind->
ekey[1]->
time) < real_t) {
1388 else if (pind->
keyed) {
1390 if (pind->
kkey[1] ==
nullptr) {
1395 if (
result->time < 0.0f) {
1408 while (pt && pa->
time + pt->
time < real_t) {
1426 while (pind->
kkey[1]->
time < real_t) {
1432 else if (pind->
cache) {
1433 if (
result->time < 0.0f) {
1441 if (
result->time < 0.0f) {
1449 while (pind->
hkey[1]->
time < real_t) {
1464 else if (pind->
mesh) {
1469 else if (pind->
keyed) {
1473 else if (pind->
cache) {
1482 if (!pind->
keyed && !pind->
cache && !point_vel) {
1484 if (pind->
ekey[0] != point->
keys) {
1491 else if (pind->
mesh) {
1516 else if (pind->
mesh) {
1534 dfra = keys[2].
time - keys[1].
time;
1535 keytime = (real_t - keys[1].
time) / dfra;
1538 if (pind->
keyed || pind->
cache || point_vel) {
1539 invdt = dfra * 0.04f * (psys ? psys->
part->
timetweak : 1.0f);
1557 if (pind->
keyed || pind->
cache || point_vel) {
1568 t *= (first + first->
segments)->time;
1574 if (cur->
time == t) {
1578 float dt = (t - (cur - 1)->time) / (cur->
time - (cur - 1)->time);
1586 if (cur == first || cur - 1 == first) {
1599 const float (*vert_positions)[3],
1600 const float (*vert_normals)[3],
1603 const float (*orcodata)[3],
1611 const float *v1 =
nullptr, *
v2 =
nullptr, *v3 =
nullptr, *v4 =
nullptr;
1612 float e1[3], e2[3], s1, s2, t1, t2;
1613 float *uv1, *uv2, *uv3, *uv4;
1614 float n1[3], n2[3], n3[3], n4[3];
1616 const float *o1, *o2, *o3, *o4;
1618 v1 = vert_positions[mface->
v1];
1619 v2 = vert_positions[mface->
v2];
1620 v3 = vert_positions[mface->
v3];
1627 v4 = vert_positions[mface->
v4];
1633 if (mface->
flag & ME_SMOOTH) {
1645 if (mface->
flag & ME_SMOOTH) {
1676 s1 = uv3[0] - uv1[0];
1677 s2 = uv4[0] - uv1[0];
1679 t1 = uv3[1] - uv1[1];
1680 t2 = uv4[1] - uv1[1];
1686 s1 = uv2[0] - uv1[0];
1687 s2 = uv3[0] - uv1[0];
1689 t1 = uv2[1] - uv1[1];
1690 t2 = uv3[1] - uv1[1];
1696 vtan[0] = (s1 * e2[0] - s2 * e1[0]);
1697 vtan[1] = (s1 * e2[1] - s2 * e1[1]);
1698 vtan[2] = (s1 * e2[2] - s2 * e1[2]);
1700 utan[0] = (t1 * e2[0] - t2 * e1[0]);
1701 utan[1] = (t1 * e2[1] - t2 * e1[1]);
1702 utan[2] = (t1 * e2[2] - t2 * e1[2]);
1707 o1 = orcodata[mface->
v1];
1708 o2 = orcodata[mface->
v2];
1709 o3 = orcodata[mface->
v3];
1712 o4 = orcodata[mface->
v4];
1728 float v10 = tface->
uv[0][0];
1729 float v11 = tface->
uv[0][1];
1730 float v20 = tface->
uv[1][0];
1731 float v21 = tface->
uv[1][1];
1732 float v30 = tface->
uv[2][0];
1733 float v31 = tface->
uv[2][1];
1737 v40 = tface->
uv[3][0];
1738 v41 = tface->
uv[3][1];
1740 r_uv[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30 +
w[3] * v40;
1741 r_uv[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31 +
w[3] * v41;
1744 r_uv[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30;
1745 r_uv[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31;
1751 const char *cp1, *cp2, *cp3, *cp4;
1755 cp1 = (
const char *)&mcol[0];
1756 cp2 = (
const char *)&mcol[1];
1757 cp3 = (
const char *)&mcol[2];
1760 cp4 = (
char *)&mcol[3];
1762 cp[0] = int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0] +
w[3] * cp4[0]);
1763 cp[1] = int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1] +
w[3] * cp4[1]);
1764 cp[2] = int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2] +
w[3] * cp4[2]);
1765 cp[3] = int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3] +
w[3] * cp4[3]);
1768 cp[0] = int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0]);
1769 cp[1] = int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1]);
1770 cp[2] = int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2]);
1771 cp[3] = int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3]);
1776 Mesh *mesh,
short from,
int index,
const float fw[4],
const float *values)
1778 if (values ==
nullptr || index == -1) {
1784 return values[index];
1789 MFace *mf = &mfaces[index];
1791 values[mf->
v1], values[mf->
v2], values[mf->
v3], values[mf->
v4], fw, mf->
v4);
1800 uv[0] =
w[1] +
w[2];
1801 uv[1] =
w[2] +
w[3];
1807 float v[4][3], co[3];
1809 v[0][0] = osface->
uv[0][0];
1810 v[0][1] = osface->
uv[0][1];
1812 v[1][0] = osface->
uv[1][0];
1813 v[1][1] = osface->
uv[1][1];
1815 v[2][0] = osface->
uv[2][0];
1816 v[2][1] = osface->
uv[2][1];
1823 v[3][0] = osface->
uv[3][0];
1824 v[3][1] = osface->
uv[3][1];
1835 Mesh *mesh_original,
1840 MFace *mtessface_final;
1844 const float (*faceuv)[2];
1846 const int *index_mf_to_mpoly_deformed =
nullptr;
1847 const int *index_mf_to_mpoly =
nullptr;
1848 const int *index_mp_to_orig =
nullptr;
1851 const int totface_deformed = mesh_original ? mesh_original->
totface_legacy : totface_final;
1853 if (
ELEM(0, totface_final, totface_deformed)) {
1857 index_mf_to_mpoly =
static_cast<const int *
>(
1859 index_mp_to_orig =
static_cast<const int *
>(
1863 if (mesh_original) {
1864 index_mf_to_mpoly_deformed =
static_cast<const int *
>(
1869 index_mf_to_mpoly_deformed = index_mf_to_mpoly;
1873 pindex_orig = index_mf_to_mpoly_deformed[findex_orig];
1875 if (mesh_original ==
nullptr) {
1876 mesh_original = mesh_final;
1879 index_mf_to_mpoly_deformed =
nullptr;
1886 if (osface_final ==
nullptr) {
1888 if (findex_orig < totface_final) {
1893 printf(
"\tNO CD_ORIGSPACE, error out of range\n");
1904 LinkNode *tessface_node = poly_nodes[pindex_orig];
1906 for (; tessface_node; tessface_node = tessface_node->
next) {
1908 faceuv = osface_final[findex_dst].
uv;
1912 if (mtessface_final[findex_dst].v4) {
1923 for (
int findex_dst = 0; findex_dst < totface_final; findex_dst++) {
1929 faceuv = osface_final[findex_dst].
uv;
1933 if (mtessface_final[findex_dst].v4) {
1989 *mapindex = index_dmcache;
1993 int i = index_dmcache;
2005 const MFace *mfaces =
static_cast<const MFace *
>(
2007 const MFace *mface = &mfaces[
i];
2009 if (osface ==
nullptr) {
2010 mapfw[0] = mapfw[1] = mapfw[2] = mapfw[3] = 0.0f;
2033 float tmpnor[3], mapfw[4];
2034 const float (*orcodata)[3];
2037 if (!
psys_map_index_on_dm(mesh_final, from, index, index_dmcache, fw, foffset, &mapindex, mapfw))
2040 vec[0] = vec[1] = vec[2] = 0.0;
2047 orco[0] = orco[1] = orco[2] = 0.0;
2050 utan[0] = utan[1] = utan[2] = 0.0;
2053 vtan[0] = vtan[1] = vtan[2] = 0.0;
2059 orcodata =
static_cast<const float (*)[3]
>(
2082 utan[0] = utan[1] = utan[2] = 0.0f;
2083 vtan[0] = vtan[1] = vtan[2] = 0.0f;
2092 mface = &mfaces[mapindex];
2103 reinterpret_cast<const float (*)[3]
>(vert_positions.
data()),
2104 reinterpret_cast<const float (*)[3]
>(vert_normals.
data()),
2126 reinterpret_cast<const float (*)[3]
>(vert_positions.
data()),
2127 reinterpret_cast<const float (*)[3]
>(vert_normals.
data()),
2162 if (psmd->
psys == psys) {
2185 const float zerovec[3] = {0.0f, 0.0f, 0.0f};
2271 psmd->
mesh_final, from, index, index_dmcache, fuv, foffset, vec,
nor, utan, vtan, orco);
2320 if (!eff->guide_data) {
2324 data = eff->guide_data + p;
2351 float effect[3] = {0.0f, 0.0f, 0.0f}, veffect[3] = {0.0f, 0.0f, 0.0f};
2352 float guidevec[4], guidedir[3], rot2[4], temp[3];
2353 float guidetime, radius, weight,
angle, totstrength = 0.0f;
2354 float vec_to_point[3];
2364 data = eff->guide_data + index;
2366 if (
data->strength <= 0.0f) {
2370 guidetime = time / (1.0f - pd->
free_end);
2372 if (guidetime > 1.0f) {
2376 cu = (
Curve *)eff->ob->data;
2380 data->strength * guidetime,
2391 if (
BKE_where_on_path(eff->ob, guidetime, guidevec, guidedir,
nullptr, &radius, &weight) ==
2398 mul_m4_v3(eff->ob->object_to_world().ptr(), guidevec);
2405 if (guidetime != 0.0f) {
2424 int(
data->strength * guidetime * 100.0f),
2442 const float par_co[3] = {0.0f, 0.0f, 0.0f};
2443 const float par_vel[3] = {0.0f, 0.0f, 0.0f};
2444 const float par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
2445 const float orco_offset[3] = {0.0f, 0.0f, 0.0f};
2479 totstrength +=
data->strength;
2482 totstrength *= weight;
2487 if (totstrength != 0.0f) {
2488 if (totstrength > 1.0f) {
2491 CLAMP(totstrength, 0.0f, 1.0f);
2515 float force[3] = {0.0f, 0.0f, 0.0f};
2565 child->
co[0] *= flat;
2581 float *vg =
nullptr;
2586 else if (psys->
vgroup[vgroup]) {
2587 const MDeformVert *dvert = mesh->deform_verts().data();
2591 if (psys->
vg_neg & (1 << vgroup)) {
2592 for (
i = 0;
i < totvert;
i++) {
2597 for (
i = 0;
i < totvert;
i++) {
2613 float co[3], orco[3];
2615 totparent = int(totchild * part->
parents * 0.3f);
2622 totparent = std::min(sim->
psys->
totpart, totparent);
2624 tree = BLI_kdtree_3d_new(totparent);
2626 for (p = 0, cpa = sim->
psys->
child; p < totparent; p++, cpa++) {
2654 BLI_kdtree_3d_insert(
tree, p, orco);
2658 BLI_kdtree_3d_balance(
tree);
2660 for (; p < totchild; p++, cpa++) {
2672 cpa->
parent = BLI_kdtree_3d_find_nearest(
tree, orco,
nullptr);
2675 BLI_kdtree_3d_free(
tree);
2682 const bool editupdate,
2683 const bool use_render_params)
2687 int totparent = 0, between = 0;
2697 if ((use_render_params == 0) &&
2707 totparent = int(totchild * part->
parents * 0.3f);
2717 if (use_render_params) {
2721 totchild = int(
float(totchild) *
float(part->
disp) / 100.0f);
2724 totparent = std::min(totparent, totchild);
2726 if (totchild == 0) {
2810 float *cpa_fuv =
nullptr, *par_rot =
nullptr,
rot[4];
2811 float orco[3], hairmat[4][4], dvec[3], off1[4][3], off2[4][3];
2812 float eff_length, eff_vec[3], weight[4];
2823 float foffset, wsum = 0.0f;
2845 memset(child_keys, 0,
sizeof(*child_keys) * (ctx->
segments + 1));
2849 for (
w = 0;
w < 4;
w++) {
2850 if (cpa->
pa[
w] >= 0) {
2851 key[
w] = pcache[cpa->
pa[
w]];
2852 weight[
w] = cpa->
w[
w];
2863 for (
w = 0;
w < 4;
w++) {
2864 if (
w && (weight[
w] > 0.0f)) {
2870 float d1 =
len_v3v3(key[0]->co, key[
w]->co);
2873 d = d1 > 0.0f ? d2 / d1 - 1.0f : 10000.0f;
2885 if (p_max > p_min) {
2886 d = (d - p_min) / (p_max - p_min);
2889 d = (d - p_min) <= 0.0f ? 0.0f : 1.0f;
2892 CLAMP(d, 0.0f, 1.0f);
2895 weight[
w] *= (1.0f - d);
2900 for (
w = 0;
w < 4;
w++) {
2926 mul_m4_v3(ob->object_to_world().ptr(), co);
2928 for (
w = 0;
w < 4;
w++) {
2942 memset(child_keys, 0,
sizeof(*child_keys) * (ctx->
segments + 1));
2946 key[0] = pcache[cpa->
parent];
2949 cpa_from = part->
from;
2993 for (k = 0, child = child_keys; k <= ctx->
segments; k++, child++) {
3001 for (
w = 0;
w < 4;
w++) {
3035 par_rot = key[0]->
rot;
3051 for (k = 0, child = child_keys; k <= ctx->
segments; k++, child++) {
3067 eff_length =
len_v3(eff_vec);
3083 par = cache[cpa->
parent];
3086 else if (cpa->
parent >= 0) {
3088 par = pcache[cpa->
parent];
3093 if (cpa->
pa[k] >= 0) {
3095 par = pcache[cpa->
pa[k]];
3121 ctx, &modifiers, cpa, &ptex, orco, hairmat, child_keys, par, par_orco);
3152 const bool editupdate,
3153 const bool use_render_params)
3211 float *prev_tangent,
3214 float cosangle,
angle, tangent[3], normal[3], q[4];
3230 cosangle =
dot_v3v3(tangent, prev_tangent);
3235 if (cosangle > 0.999999f) {
3269 float birthtime = 0.0, dietime = 0.0;
3270 float t, time = 0.0, dfra = 1.0;
3271 float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
3272 float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
3278 float *vg_effector =
nullptr;
3279 float *vg_length =
nullptr, pa_length = 1.0f;
3337 pind.
mesh = hair_mesh;
3339 memset(cache[p], 0,
sizeof(*cache[p]) * (segments + 1));
3362 if (birthtime >= dietime) {
3367 dietime = birthtime + pa_length * (dietime - birthtime);
3370 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3372 t = birthtime + time * (dietime - birthtime);
3392 for (k = 0, hkey = pa->hair; k < pa->totkey; k++, hkey++) {
3402 float effector = 1.0f;
3405 psmd->mesh_final, psys->
part->
from, pa, vg_effector);
3408 sub_v3_v3v3(vec, (cache[p] + 1)->co, cache[p]->co);
3411 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3413 sim, p, ca, k, segments, cache[p]->co, effector, dfra, cfra, &
length, vec);
3419 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3426 float(k) /
float(segments));
3433 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3441 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3444 if (k == segments) {
3499 if (point->
totkey == 0) {
3508 const int segments = iter_data->
segments;
3509 const bool use_weight = iter_data->
use_weight;
3511 float birthtime = 0.0f, dietime = 0.0f;
3512 float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f};
3516 pind.
cache =
nullptr;
3519 pind.
mesh =
nullptr;
3523 pind.
hkey[0] =
nullptr;
3529 memset(cache[iter], 0,
sizeof(*cache[iter]) * (segments + 1));
3546 if (birthtime >= dietime) {
3554 float t, time = 0.0f, keytime = 0.0f;
3555 for (k = 0, ca = cache[iter]; k <= segments; k++, ca++) {
3557 t = birthtime + time * (dietime - birthtime);
3570 if (k == segments) {
3583 ca->
vel[0] = ca->
vel[1] = 0.0f;
3595 if (
result.time < 0.0f) {
3603 while (pind.
hkey[1]->
time < real_t) {
3627 ca->
col[0] = 1.0f - keytime;
3633 ca->
col[0] = keytime;
3660 const bool use_render_params)
3670 int totpart = edit->
totpoint, recalc_set = 0;
3676 segments = std::max(segments, 4);
3686 for (
i = 0, point = edit->
points;
i < totpart;
i++, point++) {
3697 iter_data.
edit = edit;
3724 for (
i = 0, point = edit->
points;
i < totpart;
i++, point++) {
3740 float to_time = to->
time;
3761static void triatomat(
float *v1,
float *
v2,
float *v3,
const float (*uv)[2],
float mat[4][4])
3763 float det, w1, w2, d1[2], d2[2];
3765 memset(mat, 0,
sizeof(
float[4][4]));
3773 d1[0] = uv[1][0] - uv[0][0];
3774 d1[1] = uv[1][1] - uv[0][1];
3775 d2[0] = uv[2][0] - uv[0][0];
3776 d2[1] = uv[2][1] - uv[0][1];
3778 det = d2[0] * d1[1] - d2[1] * d1[0];
3785 mat[1][0] = w1 * (
v2[0] - v1[0]) + w2 * (v3[0] - v1[0]);
3786 mat[1][1] = w1 * (
v2[1] - v1[1]) + w2 * (v3[1] - v1[1]);
3787 mat[1][2] = w1 * (
v2[2] - v1[2]) + w2 * (v3[2] - v1[2]);
3791 mat[1][0] = mat[1][1] = mat[1][2] = 0.0f;
3807 const float (*orcodata)[3];
3821 if (orco && (orcodata =
static_cast<const float (*)[3]
>(
3841 triatomat(
v[0],
v[1],
v[2], (osface) ? osface->
uv :
nullptr, mat);
3873 float vec[3], orco[3];
3903 float facemat[4][4];
3907 mul_m4_m4m4(hairmat, ob->object_to_world().ptr(), facemat);
3925 if (
name ==
nullptr) {
3926 name = (psys_orig !=
nullptr) ? psys_orig->
name :
DATA_(
"ParticleSystem");
3930 for (; psys; psys = psys->
next) {
3939 if (psys_orig !=
nullptr) {
3958 if (scene !=
nullptr) {
4157 tf =
static_cast<const MTFace *
>(
4159 if (tf ==
nullptr) {
4162 if (tf ==
nullptr) {
4201 texco[0] = texco[0] * 2.0f - 1.0f;
4202 texco[1] = texco[1] * 2.0f - 1.0f;
4209#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
4210 if ((event & mtex->mapto) & type) { \
4211 pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
4215#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
4216 if (event & type) { \
4217 CLAMP(pvalue, 0.0f, 1.0f); \
4221#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue) \
4222 if (event & type) { \
4223 if (pvalue < 0.0f) { \
4224 pvalue = 1.0f + pvalue; \
4226 CLAMP(pvalue, 0.0f, 1.0f); \
4230#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
4231 if (event & type) { \
4232 CLAMP(pvalue, -1.0f, 1.0f); \
4250 float value, rgba[4], texvec[3];
4260 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4262 if (mtex && mtex->
tex && mtex->
mapto) {
4265 short texco = mtex->
texco;
4302 texvec[0] = 2.0f * (cfra - par->
time) / (par->
dietime - par->
time) - 1.0f;
4340 float value, rgba[4], co[3], texvec[3];
4351 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4353 if (mtex && mtex->
tex && mtex->
mapto) {
4356 short texco = mtex->
texco;
4414 texvec[0] = 2.0f * (cfra - pa->
time) / (pa->
dietime - pa->
time) - 1.0f;
4430 int flip = (mtex->
timefac < 0.0f);
4432 ptex->
time *= 1.0f - timefac;
4433 ptex->
time += timefac * ((flip) ? 1.0f - value : value);
4498 *dietime = time + life;
4501 return (cfra - time) / life;
4541 int i = cpa - psys->
child;
4569 ctx->
mesh, cpa_from, cpa_num, cpa_fuv, ctx->
vg_kink);
4609 float co[3], orco[3];
4610 float hairmat[4][4];
4613 short between = 0, edit = 0;
4626 CLAMP(t, 0.0f, 1.0f);
4677 else if (totchild) {
4689 float par_co[3], par_orco[3];
4691 cpa = psys->
child + p - totpart;
4693 if (
state->time < 0.0f) {
4767 cpa_from = part->
from;
4805 ctx.
mesh = psmd->mesh_final;
4844 modifier_ctx.
sim = sim;
4845 modifier_ctx.
ptex = &ptex;
4846 modifier_ctx.
cpa = cpa;
4847 modifier_ctx.
orco = orco;
4861 tstate_tmp.
time = t - 0.001f;
4867 tstate_tmp.
time = t + 0.001f;
4905 cpa = psys->
child + p - totpart;
4940 cfra = std::min(cfra, pa->
dietime);
4944 state->time = -cfra;
4953 const float par_orco[3] = {0.0f, 0.0f, 0.0f};
4958 CLAMP(t, 0.0f, 1.0f);
4963 modifier_ctx.
sim = sim;
4964 modifier_ctx.
ptex =
nullptr;
4965 modifier_ctx.
cpa = cpa;
5007 dfra = keys[2].
time - keys[1].
time;
5009 keytime = (
state->time - keys[1].
time) / dfra;
5012 mul_v3_fl(keys[1].vel, dfra * timestep);
5013 mul_v3_fl(keys[2].vel, dfra * timestep);
5068 uv[0] = uv[1] = 0.0f;
5082 if (mtface !=
nullptr) {
5083 const MFace *mface =
static_cast<const MFace *
>(
5162 float loc[3],
nor[3], vec[3], side[3],
len;
5163 float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
5261 float hairmat[4][4], imat[4][4];
5263 for (p = 0; p < psys->
totpart; p++, pa++) {
5268 for (h = 0; h < pa->
totkey; h++, hkey++) {
5312 for (
int a = 0; a < psys->
totpart; a++, pa++) {
5355 for (a = 0, pa = psys->
particles; a < psys->totpart; a++, pa++) {
5361 for (a = 0, pa = psys->
particles; a < psys->totpart; a++, pa++) {
5376 for (a = 1, pa++; a < psys->
totpart; a++, pa++) {
5377 pa->
boid = (pa - 1)->boid + 1;
5382 for (a = 0, pa = psys->
particles; a < psys->totpart; a++, pa++) {
5394 psys->
edit =
nullptr;
5400 psys->
pdd =
nullptr;
5426 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)
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)
#define STRNCPY_UTF8(dst, 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 CD_MASK_ORIGINDEX
#define CD_MASK_MDEFORMVERT
#define CD_MASK_ORIGSPACE_MLOOP
#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
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_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float r_uv[2])
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_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)