10#define DNA_DEPRECATED_ALLOW
103 std::optional<Library *> ,
130 for (
int a = 0; a <
MAX_MTEX; a++) {
131 if (partticle_settings_src->
mtex[a]) {
132 particle_settings_dst->
mtex[a] =
static_cast<MTex *
>(
145 for (
int a = 0; a <
MAX_MTEX; a++) {
180 for (
int i = 0; i <
MAX_MTEX; i++) {
181 if (psett->
mtex[i]) {
229 switch (rule->type) {
252 BoidCondition *cond =
state->conditions.first;
253 for (; cond; cond = cond->next) {
271 if (part->clumpcurve) {
274 if (part->roughcurve) {
277 if (part->twistcurve) {
283 if (dw->ob !=
nullptr) {
285 if (part->instance_collection) {
287 if (
object == dw->ob) {
309 for (
int a = 0; a <
MAX_MTEX; a++) {
330 if (part->clumpcurve) {
334 if (part->roughcurve) {
338 if (part->twistcurve) {
343 if (!part->effector_weights) {
364 for (
int a = 0; a <
MAX_MTEX; a++) {
369 CLAMP(part->trail_count, 1, 100000);
376 if (part->instance_weights.first && !part->instance_collection) {
476 else if (p % totgr == cur) {
485#define PATH_CACHE_BUF_SIZE 1024
496 int i, totkey, totbufkey;
498 tot = std::max(tot, 1);
502 while (totkey < tot) {
507 for (i = 0; i < totbufkey; i++) {
558 psys = psys->
next, i++)
577 psys = psys->
next, i++)
583 psys->
flag &= ~PSYS_CURRENT;
601 for (; md; md = md->
next) {
603 if (md->
mode & mode) {
643 for (; psys; psys = psys->
next) {
651 for (; psys; psys = psys->
next) {
652 psys->
flag &= ~PSYS_DISABLED;
667 if (object_eval ==
object) {
671 while (psys_eval !=
nullptr) {
675 psys_eval = psys_eval->
next;
694 if (
object ==
nullptr) {
720 if (use_render_params) {
746 ListBase instance_collection_objects = {
nullptr,
nullptr};
748 if (part->instance_collection) {
753 if (dw->ob ==
nullptr) {
755 if (base !=
nullptr) {
766 if (part->ren_as !=
PART_DRAW_GR || !part->instance_collection) {
777 if (dw->
ob ==
nullptr ||
793 while (dw && dw->
ob !=
object) {
853 psys->
flag &= ~PSYS_HAIR_DONE;
858 psys->
clmd =
nullptr;
923 psys->
child =
nullptr;
994 if (psys->
clmd !=
nullptr) {
1006 psys->
child =
nullptr;
1024 psys->
part =
nullptr;
1034 BLI_kdtree_3d_free(psys->
tree);
1100 if (key !=
nullptr) {
1103 if (boid !=
nullptr) {
1107 if (boid !=
nullptr) {
1110 if (key !=
nullptr) {
1123 float v1,
float v2,
float v3,
float v4,
const float w[4],
int four)
1127 value =
w[0] * v1 +
w[1] *
v2 +
w[2] * v3;
1132 CLAMP(value, 0.0f, 1.0f);
1208 *cur = (*cur)->
next;
1213 while (*cur && (*cur)->
next &&
float((*cur)->frame) < t) {
1214 *cur = (*cur)->
next;
1253 *r_start = pm->frame;
1262 *r_dietime = pm->frame + 1;
1273 int dietime = 10000000;
1278 dietime = pm->frame + 1;
1283 return float(dietime);
1295 pind->
ekey[0] = point->keys;
1296 pind->
ekey[1] = point->totkey > 1 ? point->keys + 1 :
nullptr;
1299 pind->
dietime = *((point->keys + point->totkey - 1)->time);
1301 else if (pind->
keyed) {
1303 pind->
kkey[0] = key;
1304 pind->
kkey[1] = pa->
totkey > 1 ? key + 1 :
nullptr;
1309 else if (pind->
cache) {
1310 float start = 0.0f, dietime = 0.0f;
1322 pind->
hkey[0] = key;
1323 pind->
hkey[1] = key + 1;
1329 float3 *positions = pind->
mesh->vert_positions_for_write().data();
1364 int point_vel = (point && point->keys->vel);
1365 float real_t, dfra, keytime, invdt = 1.0f;
1368 memset(keys, 0,
sizeof(keys));
1372 if (result->time < 0.0f) {
1373 real_t = -result->time;
1380 while (*(pind->
ekey[1]->
time) < real_t) {
1386 else if (pind->
keyed) {
1388 if (pind->
kkey[1] ==
nullptr) {
1393 if (result->time < 0.0f) {
1394 real_t = -result->time;
1406 while (pt && pa->
time + pt->
time < real_t) {
1424 while (pind->
kkey[1]->
time < real_t) {
1430 else if (pind->
cache) {
1431 if (result->time < 0.0f) {
1432 real_t = -result->
time;
1439 if (result->time < 0.0f) {
1440 real_t = -result->time;
1447 while (pind->
hkey[1]->
time < real_t) {
1460 else if (pind->
mesh) {
1465 else if (pind->
keyed) {
1469 else if (pind->
cache) {
1478 if (!pind->
keyed && !pind->
cache && !point_vel) {
1480 if (pind->
ekey[0] != point->keys) {
1487 else if (pind->
mesh) {
1505 if (pind->
ekey[1] != point->keys + point->totkey - 1) {
1512 else if (pind->
mesh) {
1530 dfra = keys[2].
time - keys[1].
time;
1531 keytime = (real_t - keys[1].
time) / dfra;
1534 if (pind->
keyed || pind->
cache || point_vel) {
1535 invdt = dfra * 0.04f * (psys ? psys->
part->
timetweak : 1.0f);
1553 if (pind->
keyed || pind->
cache || point_vel) {
1564 t *= (first + first->
segments)->time;
1566 while (i < first->segments && cur->
time < t) {
1570 if (cur->
time == t) {
1574 float dt = (t - (cur - 1)->time) / (cur->
time - (cur - 1)->time);
1582 if (cur == first || cur - 1 == first) {
1595 const float (*vert_positions)[3],
1596 const float (*vert_normals)[3],
1599 const float (*orcodata)[3],
1607 const float *v1 =
nullptr, *
v2 =
nullptr, *v3 =
nullptr, *v4 =
nullptr;
1608 float e1[3], e2[3], s1, s2, t1, t2;
1609 float *uv1, *uv2, *uv3, *uv4;
1610 float n1[3], n2[3], n3[3], n4[3];
1612 const float *o1, *o2, *o3, *o4;
1614 v1 = vert_positions[mface->
v1];
1615 v2 = vert_positions[mface->
v2];
1616 v3 = vert_positions[mface->
v3];
1623 v4 = vert_positions[mface->
v4];
1629 if (mface->
flag & ME_SMOOTH) {
1641 if (mface->
flag & ME_SMOOTH) {
1672 s1 = uv3[0] - uv1[0];
1673 s2 = uv4[0] - uv1[0];
1675 t1 = uv3[1] - uv1[1];
1676 t2 = uv4[1] - uv1[1];
1682 s1 = uv2[0] - uv1[0];
1683 s2 = uv3[0] - uv1[0];
1685 t1 = uv2[1] - uv1[1];
1686 t2 = uv3[1] - uv1[1];
1692 vtan[0] = (s1 * e2[0] - s2 * e1[0]);
1693 vtan[1] = (s1 * e2[1] - s2 * e1[1]);
1694 vtan[2] = (s1 * e2[2] - s2 * e1[2]);
1696 utan[0] = (t1 * e2[0] - t2 * e1[0]);
1697 utan[1] = (t1 * e2[1] - t2 * e1[1]);
1698 utan[2] = (t1 * e2[2] - t2 * e1[2]);
1703 o1 = orcodata[mface->
v1];
1704 o2 = orcodata[mface->
v2];
1705 o3 = orcodata[mface->
v3];
1708 o4 = orcodata[mface->
v4];
1724 float v10 = tface->
uv[0][0];
1725 float v11 = tface->
uv[0][1];
1726 float v20 = tface->
uv[1][0];
1727 float v21 = tface->
uv[1][1];
1728 float v30 = tface->
uv[2][0];
1729 float v31 = tface->
uv[2][1];
1733 v40 = tface->
uv[3][0];
1734 v41 = tface->
uv[3][1];
1736 uvco[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30 +
w[3] * v40;
1737 uvco[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31 +
w[3] * v41;
1740 uvco[0] =
w[0] * v10 +
w[1] * v20 +
w[2] * v30;
1741 uvco[1] =
w[0] * v11 +
w[1] * v21 +
w[2] * v31;
1747 const char *cp1, *cp2, *cp3, *cp4;
1751 cp1 = (
const char *)&mcol[0];
1752 cp2 = (
const char *)&mcol[1];
1753 cp3 = (
const char *)&mcol[2];
1756 cp4 = (
char *)&mcol[3];
1758 cp[0] =
int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0] +
w[3] * cp4[0]);
1759 cp[1] =
int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1] +
w[3] * cp4[1]);
1760 cp[2] =
int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2] +
w[3] * cp4[2]);
1761 cp[3] =
int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3] +
w[3] * cp4[3]);
1764 cp[0] =
int(
w[0] * cp1[0] +
w[1] * cp2[0] +
w[2] * cp3[0]);
1765 cp[1] =
int(
w[0] * cp1[1] +
w[1] * cp2[1] +
w[2] * cp3[1]);
1766 cp[2] =
int(
w[0] * cp1[2] +
w[1] * cp2[2] +
w[2] * cp3[2]);
1767 cp[3] =
int(
w[0] * cp1[3] +
w[1] * cp2[3] +
w[2] * cp3[3]);
1772 Mesh *mesh,
short from,
int index,
const float fw[4],
const float *values)
1774 if (values ==
nullptr || index == -1) {
1780 return values[index];
1785 MFace *mf = &mfaces[index];
1787 values[mf->
v1], values[mf->
v2], values[mf->
v3], values[mf->
v4], fw, mf->
v4);
1796 uv[0] =
w[1] +
w[2];
1797 uv[1] =
w[2] +
w[3];
1803 float v[4][3], co[3];
1805 v[0][0] = osface->
uv[0][0];
1806 v[0][1] = osface->
uv[0][1];
1808 v[1][0] = osface->
uv[1][0];
1809 v[1][1] = osface->
uv[1][1];
1811 v[2][0] = osface->
uv[2][0];
1812 v[2][1] = osface->
uv[2][1];
1819 v[3][0] = osface->
uv[3][0];
1820 v[3][1] = osface->
uv[3][1];
1831 Mesh *mesh_original,
1836 MFace *mtessface_final;
1840 const float(*faceuv)[2];
1842 const int *index_mf_to_mpoly_deformed =
nullptr;
1843 const int *index_mf_to_mpoly =
nullptr;
1844 const int *index_mp_to_orig =
nullptr;
1847 const int totface_deformed = mesh_original ? mesh_original->
totface_legacy : totface_final;
1849 if (
ELEM(0, totface_final, totface_deformed)) {
1853 index_mf_to_mpoly =
static_cast<const int *
>(
1855 index_mp_to_orig =
static_cast<const int *
>(
1859 if (mesh_original) {
1860 index_mf_to_mpoly_deformed =
static_cast<const int *
>(
1865 index_mf_to_mpoly_deformed = index_mf_to_mpoly;
1869 pindex_orig = index_mf_to_mpoly_deformed[findex_orig];
1871 if (mesh_original ==
nullptr) {
1872 mesh_original = mesh_final;
1875 index_mf_to_mpoly_deformed =
nullptr;
1882 if (osface_final ==
nullptr) {
1884 if (findex_orig < totface_final) {
1889 printf(
"\tNO CD_ORIGSPACE, error out of range\n");
1900 LinkNode *tessface_node = poly_nodes[pindex_orig];
1902 for (; tessface_node; tessface_node = tessface_node->
next) {
1904 faceuv = osface_final[findex_dst].
uv;
1908 if (mtessface_final[findex_dst].v4) {
1919 for (
int findex_dst = 0; findex_dst < totface_final; findex_dst++) {
1925 faceuv = osface_final[findex_dst].
uv;
1929 if (mtessface_final[findex_dst].v4) {
1957 if (mesh->runtime->deformed_only || index_dmcache ==
DMCACHE_ISCHILD) {
1961 if (index >= mesh->verts_num) {
1968 if (index >= mesh->totface_legacy) {
1981 if (index_dmcache ==
DMCACHE_NOTFOUND || index_dmcache >= mesh->verts_num) {
1985 *mapindex = index_dmcache;
1989 int i = index_dmcache;
2001 const MFace *mfaces =
static_cast<const MFace *
>(
2003 const MFace *mface = &mfaces[i];
2005 if (osface ==
nullptr) {
2006 mapfw[0] = mapfw[1] = mapfw[2] = mapfw[3] = 0.0f;
2029 float tmpnor[3], mapfw[4];
2030 const float(*orcodata)[3];
2033 if (!
psys_map_index_on_dm(mesh_final, from, index, index_dmcache, fw, foffset, &mapindex, mapfw))
2036 vec[0] = vec[1] = vec[2] = 0.0;
2043 orco[0] = orco[1] = orco[2] = 0.0;
2046 utan[0] = utan[1] = utan[2] = 0.0;
2049 vtan[0] = vtan[1] = vtan[2] = 0.0;
2077 utan[0] = utan[1] = utan[2] = 0.0f;
2078 vtan[0] = vtan[1] = vtan[2] = 0.0f;
2087 mface = &mfaces[mapindex];
2098 reinterpret_cast<const float(*)[3]
>(vert_positions.
data()),
2099 reinterpret_cast<const float(*)[3]
>(vert_normals.
data()),
2121 reinterpret_cast<const float(*)[3]
>(vert_positions.
data()),
2122 reinterpret_cast<const float(*)[3]
>(vert_normals.
data()),
2157 if (psmd->
psys == psys) {
2180 const float zerovec[3] = {0.0f, 0.0f, 0.0f};
2266 psmd->
mesh_final, from, index, index_dmcache, fuv, foffset, vec,
nor, utan, vtan, orco);
2315 if (!eff->guide_data) {
2320 data = eff->guide_data + p;
2347 float effect[3] = {0.0f, 0.0f, 0.0f}, veffect[3] = {0.0f, 0.0f, 0.0f};
2348 float guidevec[4], guidedir[3], rot2[4], temp[3];
2349 float guidetime, radius, weight,
angle, totstrength = 0.0f;
2350 float vec_to_point[3];
2360 data = eff->guide_data + index;
2362 if (data->strength <= 0.0f) {
2366 guidetime = time / (1.0f - pd->
free_end);
2368 if (guidetime > 1.0f) {
2372 cu = (
Curve *)eff->ob->data;
2376 data->strength * guidetime,
2387 if (
BKE_where_on_path(eff->ob, guidetime, guidevec, guidedir,
nullptr, &radius, &weight) ==
2394 mul_m4_v3(eff->ob->object_to_world().ptr(), guidevec);
2399 copy_v3_v3(vec_to_point, data->vec_to_point);
2401 if (guidetime != 0.0f) {
2404 angle =
dot_v3v3(eff->guide_dir, guidedir) /
len_v3(eff->guide_dir);
2420 int(data->strength * guidetime * 100.0f),
2438 const float par_co[3] = {0.0f, 0.0f, 0.0f};
2439 const float par_vel[3] = {0.0f, 0.0f, 0.0f};
2440 const float par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
2441 const float orco_offset[3] = {0.0f, 0.0f, 0.0f};
2465 part->clump_noise_size,
2475 totstrength += data->strength;
2478 totstrength *= weight;
2483 if (totstrength != 0.0f) {
2484 if (totstrength > 1.0f) {
2487 CLAMP(totstrength, 0.0f, 1.0f);
2511 float force[3] = {0.0f, 0.0f, 0.0f};
2577 float *vg =
nullptr;
2582 else if (psys->
vgroup[vgroup]) {
2583 const MDeformVert *dvert = mesh->deform_verts().data();
2585 int totvert = mesh->verts_num, i;
2586 vg =
static_cast<float *
>(
MEM_callocN(
sizeof(
float) * totvert,
"vg_cache"));
2587 if (psys->
vg_neg & (1 << vgroup)) {
2588 for (i = 0; i < totvert; i++) {
2593 for (i = 0; i < totvert; i++) {
2609 float co[3], orco[3];
2611 totparent =
int(totchild * part->parents * 0.3f);
2613 if (use_render_params && part->child_percent && part->child_render_percent) {
2614 totparent *=
float(part->child_percent) /
float(part->child_render_percent);
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);
2707 if (use_render_params && part->child_percent && part->child_render_percent) {
2708 totparent *=
float(part->child_percent) /
float(part->child_render_percent);
2715 if (use_render_params) {
2716 segments = 1 << part->ren_step;
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;
2823 float p_min = part->parting_min;
2824 float p_max = part->parting_max;
2826 float p_fac = part->parents > 0.0f ? 0.0f : part->parting_fac;
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);
3127 if (i < ctx->totparent) {
3141 cpa = psys->
child + task->begin;
3142 for (i = task->begin; i < task->end; i++, cpa++) {
3150 const bool editupdate,
3151 const bool use_render_params)
3156 int numtasks_parent, numtasks_child;
3157 int i, totchild, totparent;
3187 for (i = 0; i < numtasks_parent; i++) {
3198 for (i = 0; i < numtasks_child; i++) {
3218 float *prev_tangent,
3221 float cosangle,
angle, tangent[3], normal[3], q[4];
3237 cosangle =
dot_v3v3(tangent, prev_tangent);
3242 if (cosangle > 0.999999f) {
3276 float birthtime = 0.0, dietime = 0.0;
3277 float t, time = 0.0, dfra = 1.0;
3278 float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
3279 float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
3282 int segments =
int(
pow(2.0,
double((use_render_params) ? part->ren_step : part->draw_step)));
3285 float *vg_effector =
nullptr;
3286 float *vg_length =
nullptr, pa_length = 1.0f;
3344 pind.
mesh = hair_mesh;
3346 memset(cache[p], 0,
sizeof(*cache[p]) * (segments + 1));
3360 birthtime = std::max(pind.
birthtime, part->path_start);
3361 dietime = std::min(pind.
dietime, part->path_end);
3365 birthtime = tb + part->path_start * (pind.
dietime - tb);
3366 dietime = tb + part->path_end * (pind.
dietime - tb);
3369 if (birthtime >= dietime) {
3374 dietime = birthtime + pa_length * (dietime - birthtime);
3377 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3379 t = birthtime + time * (dietime - birthtime);
3399 for (k = 0, hkey = pa->hair; k < pa->totkey; k++, hkey++) {
3409 float effector = 1.0f;
3412 psmd->mesh_final, psys->
part->
from, pa, vg_effector);
3415 sub_v3_v3v3(vec, (cache[p] + 1)->co, cache[p]->co);
3418 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3420 sim, p, ca, k, segments, cache[p]->co, effector, dfra, cfra, &length, vec);
3426 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3433 float(k) /
float(segments));
3440 for (k = 0, ca = cache[p]; k <= segments; k++, ca++) {
3448 for (k = 1, ca = cache[p] + 1; k <= segments; k++, ca++) {
3451 if (k == segments) {
3506 if (point->totkey == 0) {
3515 const int segments = iter_data->
segments;
3516 const bool use_weight = iter_data->
use_weight;
3518 float birthtime = 0.0f, dietime = 0.0f;
3519 float hairmat[4][4], rotmat[3][3], prev_tangent[3] = {0.0f, 0.0f, 0.0f};
3523 pind.
cache =
nullptr;
3526 pind.
mesh =
nullptr;
3530 pind.
hkey[0] =
nullptr;
3536 memset(cache[iter], 0,
sizeof(*cache[iter]) * (segments + 1));
3553 if (birthtime >= dietime) {
3561 float t, time = 0.0f, keytime = 0.0f;
3562 for (k = 0, ca = cache[iter]; k <= segments; k++, ca++) {
3564 t = birthtime + time * (dietime - birthtime);
3577 if (k == segments) {
3590 ca->
vel[0] = ca->
vel[1] = 0.0f;
3602 if (result.time < 0.0f) {
3603 real_t = -result.time;
3610 while (pind.
hkey[1]->
time < real_t) {
3634 ca->
col[0] = 1.0f - keytime;
3640 ca->
col[0] = keytime;
3667 const bool use_render_params)
3677 int totpart = edit->
totpoint, recalc_set = 0;
3683 segments = std::max(segments, 4);
3693 for (i = 0, point = edit->
points; i < totpart; i++, point++) {
3704 iter_data.
edit = edit;
3731 for (i = 0, point = edit->
points; i < totpart; i++, point++) {
3732 point->flag &= ~PEP_EDIT_RECALC;
3747 float to_time = to->time;
3768static void triatomat(
float *v1,
float *
v2,
float *v3,
const float (*uv)[2],
float mat[4][4])
3770 float det, w1, w2, d1[2], d2[2];
3772 memset(mat, 0,
sizeof(
float[4][4]));
3780 d1[0] = uv[1][0] - uv[0][0];
3781 d1[1] = uv[1][1] - uv[0][1];
3782 d2[0] = uv[2][0] - uv[0][0];
3783 d2[1] = uv[2][1] - uv[0][1];
3785 det = d2[0] * d1[1] - d2[1] * d1[0];
3792 mat[1][0] = w1 * (
v2[0] - v1[0]) + w2 * (v3[0] - v1[0]);
3793 mat[1][1] = w1 * (
v2[1] - v1[1]) + w2 * (v3[1] - v1[1]);
3794 mat[1][2] = w1 * (
v2[2] - v1[2]) + w2 * (v3[2] - v1[2]);
3798 mat[1][0] = mat[1][1] = mat[1][2] = 0.0f;
3814 const float(*orcodata)[3];
3817 if (i == -1 || i >= mesh->totface_legacy) {
3848 triatomat(
v[0],
v[1],
v[2], (osface) ? osface->
uv :
nullptr, mat);
3880 float vec[3], orco[3];
3910 float facemat[4][4];
3914 mul_m4_m4m4(hairmat, ob->object_to_world().ptr(), facemat);
3932 if (name ==
nullptr) {
3933 name = (psys_orig !=
nullptr) ? psys_orig->
name :
DATA_(
"ParticleSystem");
3937 for (; psys; psys = psys->
next) {
3938 psys->
flag &= ~PSYS_CURRENT;
3946 if (psys_orig !=
nullptr) {
3965 if (scene !=
nullptr) {
4085 ob->
mode &= ~OB_MODE_PARTICLE_EDIT;
4115 part->clumpcurve = cumap;
4129 part->roughcurve = cumap;
4143 part->twistcurve = cumap;
4159 &mesh->fdata_legacy,
CD_MFACE, mesh->totface_legacy);
4164 tf =
static_cast<const MTFace *
>(
4166 if (tf ==
nullptr) {
4169 if (tf ==
nullptr) {
4175 if ((!from_vert && i >= mesh->totface_legacy) || (from_vert && i >= mesh->verts_num)) {
4195 for (
int j = 0; j < mesh->totface_legacy; j++, mf++) {
4208 texco[0] = texco[0] * 2.0f - 1.0f;
4209 texco[1] = texco[1] * 2.0f - 1.0f;
4216#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
4217 if ((event & mtex->mapto) & type) { \
4218 pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
4222#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
4223 if (event & type) { \
4224 CLAMP(pvalue, 0.0f, 1.0f); \
4228#define CLAMP_WARP_PARTICLE_TEXTURE_POS(type, pvalue) \
4229 if (event & type) { \
4230 if (pvalue < 0.0f) { \
4231 pvalue = 1.0f + pvalue; \
4233 CLAMP(pvalue, 0.0f, 1.0f); \
4237#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
4238 if (event & type) { \
4239 CLAMP(pvalue, -1.0f, 1.0f); \
4255 MTex *mtex, **mtexp = part->mtex;
4257 float value, rgba[4], texvec[3];
4264 ptex->
length = 1.0f - part->randlength *
psys_frand(psys, child_index + 26);
4265 ptex->
length *= part->clength_thres <
psys_frand(psys, child_index + 27) ? part->clength : 1.0f;
4267 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4269 if (mtex && mtex->
tex && mtex->
mapto) {
4272 short texco = mtex->
texco;
4309 texvec[0] = 2.0f * (cfra - par->
time) / (par->
dietime - par->
time) - 1.0f;
4344 MTex **mtexp = part->mtex;
4347 float value, rgba[4], co[3], texvec[3];
4358 for (m = 0; m <
MAX_MTEX; m++, mtexp++) {
4360 if (mtex && mtex->
tex && mtex->
mapto) {
4363 short texco = mtex->
texco;
4408 sub_v3_v3(texvec, mesh->texspace_location);
4409 if (mesh->texspace_size[0] != 0.0f) {
4410 texvec[0] /= mesh->texspace_size[0];
4412 if (mesh->texspace_size[1] != 0.0f) {
4413 texvec[1] /= mesh->texspace_size[1];
4415 if (mesh->texspace_size[2] != 0.0f) {
4416 texvec[2] /= mesh->texspace_size[2];
4421 texvec[0] = 2.0f * (cfra - pa->
time) / (pa->
dietime - pa->
time) - 1.0f;
4437 int flip = (mtex->
timefac < 0.0f);
4439 ptex->
time *= 1.0f - timefac;
4440 ptex->
time += timefac * ((flip) ? 1.0f - value : value);
4492 life = part->lifetime * (1.0f - part->randlife *
psys_frand(psys, cpa - psys->
child + 25));
4505 *dietime = time + life;
4508 return (cfra - time) / life;
4530 size *= part->childsize;
4532 if (part->childrandsize != 0.0f) {
4533 size *= 1.0f - part->childrandsize *
psys_frand(psys, cpa - psys->
child + 26);
4548 int i = cpa - psys->
child;
4576 ctx->
mesh, cpa_from, cpa_num, cpa_fuv, ctx->
vg_kink);
4616 float co[3], orco[3];
4617 float hairmat[4][4];
4620 short between = 0, edit = 0;
4623 int cached = !keyed && part->type !=
PART_HAIR;
4633 CLAMP(t, 0.0f, 1.0f);
4684 else if (totchild) {
4696 float par_co[3], par_orco[3];
4698 cpa = psys->
child + p - totpart;
4700 if (
state->time < 0.0f) {
4714 keys[
w].time =
state->time;
4774 cpa_from = part->from;
4812 ctx.
mesh = psmd->mesh_final;
4825 state->co[0] += cpa->
w[
w] * keys[
w].co[0];
4826 state->co[1] += cpa->
w[
w] * keys[
w].co[1];
4827 state->co[2] += cpa->
w[
w] * keys[
w].co[2];
4829 state->vel[0] += cpa->
w[
w] * keys[
w].vel[0];
4830 state->vel[1] += cpa->
w[
w] * keys[
w].vel[1];
4831 state->vel[2] += cpa->
w[
w] * keys[
w].vel[2];
4851 modifier_ctx.
sim = sim;
4852 modifier_ctx.
ptex = &ptex;
4853 modifier_ctx.
cpa = cpa;
4854 modifier_ctx.
orco = orco;
4868 tstate_tmp.
time = t - 0.001f;
4874 tstate_tmp.
time = t + 0.001f;
4912 cpa = psys->
child + p - totpart;
4924 state->time = (cfra - (part->sta + (part->end - part->sta) *
psys_frand(psys, p + 23))) /
4940 if ((cfra < pa->time && (part->flag &
PART_UNBORN) == 0) ||
4947 cfra = std::min(cfra, pa->
dietime);
4951 state->time = -cfra;
4960 const float par_orco[3] = {0.0f, 0.0f, 0.0f};
4965 CLAMP(t, 0.0f, 1.0f);
4970 modifier_ctx.
sim = sim;
4971 modifier_ctx.
ptex =
nullptr;
4972 modifier_ctx.
cpa = cpa;
5014 dfra = keys[2].
time - keys[1].
time;
5016 keytime = (
state->time - keys[1].
time) / dfra;
5019 mul_v3_fl(keys[1].vel, dfra * timestep);
5020 mul_v3_fl(keys[2].vel, dfra * timestep);
5075 uv[0] = uv[1] = 0.0f;
5089 if (mtface !=
nullptr) {
5090 const MFace *mface =
static_cast<const MFace *
>(
5169 float loc[3],
nor[3], vec[3], side[3],
len;
5170 float xvec[3] = {-1.0, 0.0, 0.0}, nmat[3][3];
5268 float hairmat[4][4], imat[4][4];
5270 for (p = 0; p < psys->
totpart; p++, pa++) {
5275 for (h = 0; h < pa->
totkey; h++, hkey++) {
5319 for (
int a = 0; a < psys->
totpart; a++, pa++) {
5373 psys->
flag &= ~PSYS_KEYED;
5383 for (a = 1, pa++; a < psys->
totpart; a++, pa++) {
5384 pa->
boid = (pa - 1)->boid + 1;
5401 psys->
edit =
nullptr;
5407 psys->
pdd =
nullptr;
5433 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], int 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_)
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_DO_DEPRECATED_POINTERS
General operations, lookup, etc. for materials.
struct Material * BKE_object_material_get(struct 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)
void psys_tasks_free(struct ParticleTask *tasks, int numtasks)
#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])
void psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart, struct ParticleTask **r_tasks, int *r_numtasks)
void psys_thread_context_free(struct ParticleThreadContext *ctx)
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
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.
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) 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 unit_m4(float m[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 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
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(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)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
@ 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
@ eModifierType_ParticleSystem
@ eModifierType_DynamicPaint
@ PFIELD_GUIDE_PATH_WEIGHT
@ PART_FLUID_SPRAYFOAMBUBBLE
struct ParticleSettings ParticleSettings
@ SPH_VISCOELASTIC_SPRINGS
@ 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.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static unsigned long seed
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
constexpr const T * data() const
pow(value.r - subtrahend, 2.0)") .do_static_compilation(true)
const Depsgraph * depsgraph
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
smooth(Type::FLOAT, "radius") .smooth(Type flat(Type::INT, "id")
blender::gpu::Batch * quad
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
Frequency::GEOMETRY nor[]
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 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)
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
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 int get_particle_uv(Mesh *mesh, ParticleData *pa, int index, const float fuv[4], char *name, float *texco, bool from_vert)
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)
uint PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
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)
uint PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
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
struct ModifierData * next
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
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])
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype)