45 const float max_dist_sq,
49 if (nearest->
index != -1) {
51 if (nearest->
dist_sq > max_dist_sq) {
63 if ((nearest->
index != -1) && (nearest->
dist_sq <= max_dist_sq)) {
83 rayhit->
dist = max_dist;
92 if (rayhit_tmp.
dist < rayhit->
dist) {
96 if ((rayhit->
index != -1) && (rayhit->
dist <= max_dist)) {
97 *r_hit_dist = rayhit->
dist;
113 const MVert *verts_dst,
114 const int numverts_dst,
127 for (i = 0; i < numverts_dst; i++) {
133 if (space_transform) {
138 result += 1.0f / (hit_dist + 1.0f);
149 printf(
"%s: Computed difference between meshes (the lower the better): %f\n", __func__,
result);
168 const float (*vcos)[3],
172 float center[3], covmat[3][3];
173 float eigen_val[3], eigen_vec[3][3];
184 for (i = 0, co =
cos,
mv =
verts; i < numverts; i++, co++,
mv++) {
231 for (i = 0; i < 3; i++) {
232 float evi = eigen_val[i];
239 evi = (evi < 1e-6f && evi > -1e-6f) ? ((evi < 0.0f) ? -1e-3f : 1e-3f) :
sqrtf_signed(evi);
248 const int numverts_dst,
254 const float mirrors[][3] = {
264 const float(*mirr)[3];
266 float mat_src[4][4], mat_dst[4][4], best_mat_dst[4][4];
267 float best_match = FLT_MAX, match;
269 const int numverts_src = me_src->
totvert;
277 r_space_transform, verts_dst, numverts_dst, me_src);
282 for (mirr = mirrors; (*mirr)[0]; mirr++) {
289 r_space_transform, verts_dst, numverts_dst, me_src);
290 if (match < best_match) {
308 const int UNUSED(edge_mode),
310 const int UNUSED(poly_mode),
315 const bool need_pnors_src = need_lnors_src ||
318 if (need_lnors_src) {
321 if (need_pnors_src) {
333 map->items_num = items_num;
351 const float UNUSED(hit_dist),
353 const int sources_num,
354 const int *indices_src,
355 const float *weights_src)
363 sizeof(*mapit->
indices_src) * (
size_t)sources_num);
366 sizeof(*mapit->
weights_src) * (
size_t)sources_num);
386 const float (*vcos_src)[3],
387 const float point[3],
390 const bool use_loops,
393 const bool do_weights,
394 int *r_closest_index)
398 float ref_dist_sq = FLT_MAX;
400 const int sources_num = mp->
totloop;
403 if ((
size_t)sources_num > *buff_size) {
404 *buff_size = (size_t)sources_num;
405 *vcos =
MEM_reallocN(*vcos,
sizeof(**vcos) * *buff_size);
408 *weights =
MEM_reallocN(*weights,
sizeof(**weights) * *buff_size);
412 for (i = 0, ml = &mloops[mp->
loopstart], vco = *vcos, index = *
indices; i < sources_num;
413 i++, ml++, vco++, index++) {
414 *index = use_loops ? (int)mp->
loopstart + i : (
int)ml->
v;
416 if (r_closest_index) {
419 if (dist_sq < ref_dist_sq) {
420 ref_dist_sq = dist_sq;
421 *r_closest_index = *index;
462 #define MREMAP_RAYCAST_APPROXIMATE_NR 3
464 #define MREMAP_RAYCAST_APPROXIMATE_FAC 5.0f
467 #define MREMAP_RAYCAST_TRI_SAMPLES_MIN 4
468 #define MREMAP_RAYCAST_TRI_SAMPLES_MAX 20
471 #define MREMAP_DEFAULT_BUFSIZE 32
475 const float max_dist,
476 const float ray_radius,
477 const MVert *verts_dst,
478 const int numverts_dst,
479 const bool UNUSED(dirty_nors_dst),
484 const float full_weight = 1.0f;
485 const float max_dist_sq = max_dist * max_dist;
494 for (i = 0; i < numverts_dst; i++) {
503 float tmp_co[3], tmp_no[3];
509 for (i = 0; i < numverts_dst; i++) {
513 if (space_transform) {
518 &treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
534 for (i = 0; i < numverts_dst; i++) {
538 if (space_transform) {
543 &treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
545 const float *v1cos = vcos_src[me->
v1];
546 const float *v2cos = vcos_src[me->
v2];
551 const int index = (int)((dist_v1 > dist_v2) ? me->
v2 : me->
v1);
563 CLAMP(weights[0], 0.0f, 1.0f);
564 weights[1] = 1.0f - weights[0];
589 float *weights =
MEM_mallocN(
sizeof(*weights) * tmp_buff_size, __func__);
594 for (i = 0; i < numverts_dst; i++) {
599 if (space_transform) {
605 &treedata, &rayhit, tmp_co, tmp_no, ray_radius, max_dist, &hit_dist)) {
610 (
const float(*)[3])vcos_src,
631 for (i = 0; i < numverts_dst; i++) {
635 if (space_transform) {
640 &treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
648 (
const float(*)[3])vcos_src,
663 (
const float(*)[3])vcos_src,
689 CLOG_WARN(&
LOG,
"Unsupported mesh-to-mesh vertex mapping mode (%d)!", mode);
690 memset(r_map->
items, 0,
sizeof(*r_map->
items) * (
size_t)numverts_dst);
699 const float max_dist,
700 const float ray_radius,
701 const MVert *verts_dst,
702 const int numverts_dst,
703 const MEdge *edges_dst,
704 const int numedges_dst,
705 const bool UNUSED(dirty_nors_dst),
710 const float full_weight = 1.0f;
711 const float max_dist_sq = max_dist * max_dist;
720 for (i = 0; i < numedges_dst; i++) {
729 float tmp_co[3], tmp_no[3];
732 const int num_verts_src = me_src->
totvert;
733 const int num_edges_src = me_src->
totedge;
738 int *vert_to_edge_src_map_mem;
743 } *v_dst_to_src_map =
MEM_mallocN(
sizeof(*v_dst_to_src_map) * (
size_t)numverts_dst,
746 for (i = 0; i < numverts_dst; i++) {
747 v_dst_to_src_map[i].hit_dist = -1.0f;
751 &vert_to_edge_src_map_mem,
759 for (i = 0; i < numedges_dst; i++) {
760 const MEdge *e_dst = &edges_dst[i];
761 float best_totdist = FLT_MAX;
762 int best_eidx_src = -1;
766 const uint vidx_dst = j ? e_dst->
v1 : e_dst->
v2;
769 if (v_dst_to_src_map[vidx_dst].hit_dist == -1.0f) {
773 if (space_transform) {
778 &treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
779 v_dst_to_src_map[vidx_dst].hit_dist = hit_dist;
780 v_dst_to_src_map[vidx_dst].index = nearest.
index;
784 v_dst_to_src_map[vidx_dst].hit_dist = FLT_MAX;
792 const uint vidx_dst = j ? e_dst->
v1 : e_dst->
v2;
793 const float first_dist = v_dst_to_src_map[vidx_dst].hit_dist;
794 const int vidx_src = v_dst_to_src_map[vidx_dst].index;
801 eidx_src = vert_to_edge_src_map[vidx_src].
indices;
802 k = vert_to_edge_src_map[vidx_src].
count;
804 for (; k--; eidx_src++) {
805 MEdge *e_src = &edges_src[*eidx_src];
807 const float *other_co_dst =
809 const float totdist = first_dist +
len_v3v3(other_co_src, other_co_dst);
811 if (totdist < best_totdist) {
812 best_totdist = totdist;
813 best_eidx_src = *eidx_src;
818 if (best_eidx_src >= 0) {
819 const float *co1_src = vcos_src[edges_src[best_eidx_src].
v1];
820 const float *co2_src = vcos_src[edges_src[best_eidx_src].v2];
821 const float *co1_dst = verts_dst[e_dst->
v1].
co;
822 const float *co2_dst = verts_dst[e_dst->
v2].
co;
823 float co_src[3], co_dst[3];
827 co1_src, co2_src, co1_dst, co2_dst, co_src, co_dst);
828 if (isect_type != 0) {
831 if (fac_src < 0.0f) {
834 else if (fac_src > 1.0f) {
837 if (fac_dst < 0.0f) {
840 else if (fac_dst > 1.0f) {
844 hit_dist =
len_v3v3(co_dst, co_src);
862 for (i = 0; i < numedges_dst; i++) {
863 interp_v3_v3v3(tmp_co, verts_dst[edges_dst[i].
v1].co, verts_dst[edges_dst[i].
v2].co, 0.5f);
866 if (space_transform) {
871 &treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
888 for (i = 0; i < numedges_dst; i++) {
889 interp_v3_v3v3(tmp_co, verts_dst[edges_dst[i].
v1].co, verts_dst[edges_dst[i].
v2].co, 0.5f);
892 if (space_transform) {
897 &treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
902 float best_dist_sq = FLT_MAX;
903 int best_eidx_src = -1;
905 for (; nloops--; ml_src++) {
906 MEdge *med_src = &edges_src[ml_src->
e];
907 float *co1_src = vcos_src[med_src->
v1];
908 float *co2_src = vcos_src[med_src->
v2];
914 if (dist_sq < best_dist_sq) {
915 best_dist_sq = dist_sq;
916 best_eidx_src = (int)ml_src->
e;
919 if (best_eidx_src >= 0) {
932 const int num_rays_min = 5, num_rays_max = 100;
933 const int numedges_src = me_src->
totedge;
939 float *weights =
MEM_mallocN(
sizeof(*weights) * (
size_t)numedges_src, __func__);
945 for (i = 0; i < numedges_dst; i++) {
948 const MEdge *me = &edges_dst[i];
949 float v1_co[3], v2_co[3];
950 float v1_no[3], v2_no[3];
956 float totweights = 0.0f;
957 float hit_dist_accum = 0.0f;
968 if (space_transform) {
979 edge_dst_len =
len_v3v3(v1_co, v2_co);
981 grid_size = (int)((edge_dst_len / ray_radius) + 0.5f);
982 CLAMP(grid_size, num_rays_min, num_rays_max);
988 for (j = 0; j < grid_size; j++) {
989 const float fac = grid_step * (
float)j;
999 &treedata, &rayhit, tmp_co, tmp_no, ray_radius /
w, max_dist, &hit_dist)) {
1000 weights[rayhit.
index] +=
w;
1002 hit_dist_accum += hit_dist;
1011 if (totweights > ((
float)grid_size / 2.0f)) {
1012 for (j = 0; j < (int)numedges_src; j++) {
1017 weights[sources_num] = weights[j] / totweights;
1022 r_map, i, hit_dist_accum / totweights, 0, sources_num,
indices, weights);
1034 CLOG_WARN(&
LOG,
"Unsupported mesh-to-mesh edge mapping mode (%d)!", mode);
1035 memset(r_map->
items, 0,
sizeof(*r_map->
items) * (
size_t)numedges_dst);
1042 #define POLY_UNSET 0
1043 #define POLY_CENTER_INIT 1
1044 #define POLY_COMPLETE 2
1047 const int island_index,
1055 const bool is_edge_innercut,
1056 const int *poly_island_index_map,
1057 float (*poly_centers)[3],
1058 unsigned char *poly_status)
1061 (
size_t)edge_to_poly_map[edge_idx].
count);
1064 for (i = 0; i < edge_to_poly_map[edge_idx].
count; i++) {
1065 const int pidx = edge_to_poly_map[edge_idx].
indices[i];
1066 MPoly *mp = &polys[pidx];
1067 const int pidx_isld = islands ? poly_island_index_map[pidx] : pidx;
1072 poly_island_indices[i] = -1;
1077 poly_island_indices[i] = pidx_isld;
1089 const int pidx_isld_other = poly_island_indices[j];
1091 if (pidx_isld_other == -1 || poly_status[pidx_isld_other] ==
POLY_COMPLETE) {
1095 dist_cost =
len_v3v3(poly_centers[pidx_isld_other], poly_centers[pidx_isld]);
1099 poly_island_indices[i] = pidx_isld;
1106 const int island_index,
1118 int *poly_island_index_map =
NULL;
1121 const int node_num = islands ? island_poly_map->
count : numpolys;
1122 unsigned char *poly_status =
MEM_callocN(
sizeof(*poly_status) * (
size_t)node_num, __func__);
1123 float(*poly_centers)[3];
1135 sizeof(*poly_island_index_map) * (
size_t)numpolys);
1136 for (i = island_poly_map->
count; i--;) {
1137 poly_island_index_map[island_poly_map->
indices[i]] = i;
1142 for (i = island_einnercut_map->
count; i--;) {
1149 island_einnercut_map->
indices[i],
1153 poly_island_index_map,
1159 for (pidx_isld = node_num; pidx_isld--;) {
1160 const int pidx = islands ? island_poly_map->
indices[pidx_isld] : pidx_isld;
1161 MPoly *mp = &polys[pidx];
1168 for (pl_idx = 0, l_idx = mp->
loopstart; pl_idx < mp->totloop; pl_idx++, l_idx++) {
1169 MLoop *ml = &loops[l_idx];
1185 poly_island_index_map,
1197 #undef POLY_CENTER_INIT
1198 #undef POLY_COMPLETE
1206 const int node_idx_curr,
1207 const int node_idx_next,
1208 const int node_idx_dst)
1210 float *co_next, *co_dest;
1226 return (link ? (as_solution->
g_costs[node_idx_curr] + link->
cost) : 0.0f) +
1230 #define ASTAR_STEPS_MAX 64
1234 const float max_dist,
1235 const float ray_radius,
1238 const int numverts_dst,
1240 const int numedges_dst,
1242 const int numloops_dst,
1244 const int numpolys_dst,
1246 const bool use_split_nors_dst,
1247 const float split_angle_dst,
1248 const bool dirty_nors_dst,
1251 const float islands_precision_src,
1254 const float full_weight = 1.0f;
1255 const float max_dist_sq = max_dist * max_dist;
1260 BLI_assert((islands_precision_src >= 0.0f) && (islands_precision_src <= 1.0f));
1267 for (i = 0; i < numloops_dst; i++) {
1277 float tmp_co[3], tmp_no[3];
1282 bool use_islands =
false;
1286 const int isld_steps_src = (islands_precision_src ?
1299 int *vert_to_loop_map_src_buff =
NULL;
1301 int *vert_to_poly_map_src_buff =
NULL;
1303 int *edge_to_poly_map_src_buff =
NULL;
1305 int *poly_to_looptri_map_src_buff =
NULL;
1308 int *loop_to_poly_map_src =
NULL;
1311 const int num_verts_src = me_src->
totvert;
1314 const int num_edges_src = me_src->
totedge;
1316 const int num_loops_src = me_src->
totloop;
1318 const int num_polys_src = me_src->
totpoly;
1320 int num_looptri_src = 0;
1324 int *indices_interp =
NULL;
1325 float *weights_interp =
NULL;
1327 MLoop *ml_src, *ml_dst;
1328 MPoly *mp_src, *mp_dst;
1329 int tindex, pidx_dst, lidx_dst, plidx_dst, pidx_src, lidx_src, plidx_src;
1334 if (!use_from_vert) {
1337 vcos_interp =
MEM_mallocN(
sizeof(*vcos_interp) * buff_size_interp, __func__);
1338 indices_interp =
MEM_mallocN(
sizeof(*indices_interp) * buff_size_interp, __func__);
1339 weights_interp =
MEM_mallocN(
sizeof(*weights_interp) * buff_size_interp, __func__);
1345 const bool need_pnors_src = need_lnors_src ||
1347 const bool need_pnors_dst = need_lnors_dst || need_pnors_src;
1349 if (need_pnors_dst) {
1352 if (need_lnors_dst) {
1357 const bool do_loop_nors_dst = (loop_nors_dst ==
NULL);
1358 if (!loop_nors_dst) {
1363 if (dirty_nors_dst || do_loop_nors_dst) {
1382 if (need_pnors_src || need_lnors_src) {
1383 if (need_pnors_src) {
1386 if (need_lnors_src) {
1393 if (use_from_vert) {
1395 &vert_to_loop_map_src_buff,
1403 &vert_to_poly_map_src_buff,
1414 &edge_to_poly_map_src_buff,
1421 if (use_from_vert) {
1422 loop_to_poly_map_src =
MEM_mallocN(
sizeof(*loop_to_poly_map_src) * (
size_t)num_loops_src,
1424 poly_cents_src =
MEM_mallocN(
sizeof(*poly_cents_src) * (
size_t)num_polys_src, __func__);
1425 for (pidx_src = 0, mp_src = polys_src; pidx_src < num_polys_src; pidx_src++, mp_src++) {
1427 for (plidx_src = 0, lidx_src = mp_src->
loopstart; plidx_src < mp_src->totloop;
1428 plidx_src++, lidx_src++) {
1429 loop_to_poly_map_src[lidx_src] = pidx_src;
1443 if (gen_islands_src) {
1444 use_islands = gen_islands_src(verts_src,
1454 num_trees = use_islands ? island_store.
islands_num : 1;
1455 treedata =
MEM_callocN(
sizeof(*treedata) * (
size_t)num_trees, __func__);
1456 if (isld_steps_src) {
1457 as_graphdata =
MEM_callocN(
sizeof(*as_graphdata) * (
size_t)num_trees, __func__);
1471 treedata =
MEM_callocN(
sizeof(*treedata), __func__);
1472 if (isld_steps_src) {
1473 as_graphdata =
MEM_callocN(
sizeof(*as_graphdata), __func__);
1478 if (isld_steps_src) {
1479 for (tindex = 0; tindex < num_trees; tindex++) {
1483 edge_to_poly_map_src,
1488 &as_graphdata[tindex]);
1493 if (use_from_vert) {
1497 for (tindex = 0; tindex < num_trees; tindex++) {
1499 int num_verts_active = 0;
1501 for (i = 0; i < isld->
count; i++) {
1502 mp_src = &polys_src[isld->
indices[i]];
1503 for (lidx_src = mp_src->
loopstart; lidx_src < mp_src->loopstart + mp_src->
totloop;
1505 const uint vidx_src = loops_src[lidx_src].
v;
1536 looptri_active =
BLI_BITMAP_NEW((
size_t)num_looptri_src, __func__);
1538 for (tindex = 0; tindex < num_trees; tindex++) {
1539 int num_looptri_active = 0;
1541 for (i = 0; i < num_looptri_src; i++) {
1542 mp_src = &polys_src[looptri_src[i].
poly];
1545 num_looptri_active++;
1569 islands_res =
MEM_mallocN(
sizeof(*islands_res) * (
size_t)num_trees, __func__);
1570 for (tindex = 0; tindex < num_trees; tindex++) {
1571 islands_res[tindex] =
MEM_mallocN(
sizeof(**islands_res) * islands_res_buff_size, __func__);
1574 for (pidx_dst = 0, mp_dst = polys_dst; pidx_dst < numpolys_dst; pidx_dst++, mp_dst++) {
1580 bool pcent_dst_valid =
false;
1583 copy_v3_v3(pnor_dst, poly_nors_dst[pidx_dst]);
1584 if (space_transform) {
1589 if ((
size_t)mp_dst->
totloop > islands_res_buff_size) {
1591 for (tindex = 0; tindex < num_trees; tindex++) {
1592 islands_res[tindex] =
MEM_reallocN(islands_res[tindex],
1593 sizeof(**islands_res) * islands_res_buff_size);
1597 for (tindex = 0; tindex < num_trees; tindex++) {
1601 for (plidx_dst = 0; plidx_dst < mp_dst->
totloop; plidx_dst++, ml_dst++) {
1602 if (use_from_vert) {
1609 if (space_transform) {
1614 tdata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
1616 const float(*nors_src)[3];
1617 float best_nor_dot = -2.0f;
1618 float best_sqdist_fallback = FLT_MAX;
1619 int best_index_src = -1;
1623 if (space_transform) {
1627 nors_src = loop_nors_src;
1628 vert_to_refelem_map_src = vert_to_loop_map_src;
1631 nor_dst = &pnor_dst;
1632 nors_src = poly_nors_src;
1633 vert_to_refelem_map_src = vert_to_poly_map_src;
1636 for (i = vert_to_refelem_map_src[nearest.
index].
count; i--;) {
1637 const int index_src = vert_to_refelem_map_src[nearest.
index].
indices[i];
1639 const float dot =
dot_v3v3(nors_src[index_src], *nor_dst);
1642 loop_to_poly_map_src[index_src] :
1649 polys_src[pidx_src].loopstart);
1657 if (
dot > best_nor_dot - 1e-6f) {
1663 mp_src = &polys_src[pidx_src];
1666 if (!pcent_dst_valid) {
1668 mp_dst, &loops_dst[mp_dst->
loopstart], verts_dst, pcent_dst);
1669 pcent_dst_valid =
true;
1671 pcent_src = poly_cents_src[pidx_src];
1674 if ((
dot > best_nor_dot + 1e-6f) || (sqdist < best_sqdist_fallback)) {
1676 best_sqdist_fallback = sqdist;
1677 best_index_src = index_src;
1681 if (best_index_src == -1) {
1683 best_nor_dot = -1.0f;
1689 mp_src = &polys_src[best_index_src];
1691 for (plidx_src = 0; plidx_src < mp_src->
totloop; plidx_src++, ml_src++) {
1692 if ((
int)ml_src->
v == nearest.
index) {
1693 best_index_src = plidx_src + mp_src->
loopstart;
1698 best_nor_dot = (best_nor_dot + 1.0f) * 0.5f;
1699 islands_res[tindex][plidx_dst].
factor = hit_dist ? (best_nor_dot / hit_dist) : 1e18f;
1700 islands_res[tindex][plidx_dst].
hit_dist = hit_dist;
1701 islands_res[tindex][plidx_dst].
index_src = best_index_src;
1705 islands_res[tindex][plidx_dst].
factor = 0.0f;
1706 islands_res[tindex][plidx_dst].
hit_dist = FLT_MAX;
1707 islands_res[tindex][plidx_dst].
index_src = -1;
1718 if (space_transform) {
1725 tdata, &rayhit, tmp_co, tmp_no, ray_radius /
w, max_dist, &hit_dist)) {
1726 islands_res[tindex][plidx_dst].
factor = (hit_dist ? (1.0f / hit_dist) : 1e18f) *
w;
1727 islands_res[tindex][plidx_dst].
hit_dist = hit_dist;
1729 copy_v3_v3(islands_res[tindex][plidx_dst].hit_point, rayhit.
co);
1746 if (space_transform) {
1752 islands_res[tindex][plidx_dst].
factor = 0.0f;
1755 tdata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
1756 islands_res[tindex][plidx_dst].
hit_dist = hit_dist;
1758 copy_v3_v3(islands_res[tindex][plidx_dst].hit_point, nearest.
co);
1762 islands_res[tindex][plidx_dst].
hit_dist = FLT_MAX;
1763 islands_res[tindex][plidx_dst].
index_src = -1;
1772 if (space_transform) {
1777 tdata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
1778 islands_res[tindex][plidx_dst].
factor = hit_dist ? (1.0f / hit_dist) : 1e18f;
1779 islands_res[tindex][plidx_dst].
hit_dist = hit_dist;
1781 copy_v3_v3(islands_res[tindex][plidx_dst].hit_point, nearest.
co);
1785 islands_res[tindex][plidx_dst].
factor = 0.0f;
1786 islands_res[tindex][plidx_dst].
hit_dist = FLT_MAX;
1787 islands_res[tindex][plidx_dst].
index_src = -1;
1807 int *poly_island_index_map =
NULL;
1808 int pidx_src_prev = -1;
1811 float best_island_fac = 0.0f;
1812 int best_island_index = -1;
1814 for (tindex = 0; tindex < num_trees; tindex++) {
1815 float island_fac = 0.0f;
1817 for (plidx_dst = 0; plidx_dst < mp_dst->
totloop; plidx_dst++) {
1818 island_fac += islands_res[tindex][plidx_dst].
factor;
1822 if (island_fac > best_island_fac) {
1823 best_island_fac = island_fac;
1824 best_island_index = tindex;
1828 if (best_island_index != -1 && isld_steps_src) {
1829 best_island = use_islands ? island_store.
islands[best_island_index] :
NULL;
1830 as_graph = &as_graphdata[best_island_index];
1831 poly_island_index_map = (
int *)as_graph->
custom_data;
1835 for (plidx_dst = 0; plidx_dst < mp_dst->
totloop; plidx_dst++) {
1837 lidx_dst = plidx_dst + mp_dst->
loopstart;
1839 if (best_island_index == -1) {
1847 isld_res = &islands_res[best_island_index][plidx_dst];
1848 if (use_from_vert) {
1851 if (lidx_src >= 0) {
1852 pidx_src = loop_to_poly_map_src[lidx_src];
1854 if (!
ELEM(pidx_src_prev, -1, pidx_src) && isld_steps_src) {
1855 int pidx_isld_src, pidx_isld_src_prev;
1856 if (poly_island_index_map) {
1857 pidx_isld_src = poly_island_index_map[pidx_src];
1858 pidx_isld_src_prev = poly_island_index_map[pidx_src_prev];
1861 pidx_isld_src = pidx_src;
1862 pidx_isld_src_prev = pidx_src_prev;
1879 int last_valid_pidx_isld_src = -1;
1881 for (i = as_solution.
steps - 1; i--;) {
1884 pidx_isld_src = as_solution.
prev_nodes[pidx_isld_src];
1888 last_valid_pidx_isld_src = pidx_isld_src;
1891 if (last_valid_pidx_isld_src != -1) {
1895 float best_dist_sq = FLT_MAX;
1897 ml_dst = &loops_dst[lidx_dst];
1902 if (space_transform) {
1906 pidx_src = (use_islands ? best_island->
indices[last_valid_pidx_isld_src] :
1907 last_valid_pidx_isld_src);
1908 mp_src = &polys_src[pidx_src];
1910 for (j = 0; j < mp_src->
totloop; j++, ml_src++) {
1912 if (dist_sq < best_dist_sq) {
1913 best_dist_sq = dist_sq;
1927 pidx_src_prev = pidx_src;
1939 if (pidx_src >= 0) {
1941 int best_loop_index_src;
1943 mp_src = &polys_src[pidx_src];
1945 if (!
ELEM(pidx_src_prev, -1, pidx_src) && isld_steps_src) {
1946 int pidx_isld_src, pidx_isld_src_prev;
1947 if (poly_island_index_map) {
1948 pidx_isld_src = poly_island_index_map[pidx_src];
1949 pidx_isld_src_prev = poly_island_index_map[pidx_src_prev];
1952 pidx_isld_src = pidx_src;
1953 pidx_isld_src_prev = pidx_src_prev;
1970 int last_valid_pidx_isld_src = -1;
1972 for (i = as_solution.
steps - 1; i--;) {
1976 pidx_isld_src = as_solution.
prev_nodes[pidx_isld_src];
1980 last_valid_pidx_isld_src = pidx_isld_src;
1983 if (last_valid_pidx_isld_src != -1) {
1986 float best_dist_sq = FLT_MAX;
1989 ml_dst = &loops_dst[lidx_dst];
1994 if (space_transform) {
1998 pidx_src = (use_islands ? best_island->
indices[last_valid_pidx_isld_src] :
1999 last_valid_pidx_isld_src);
2000 mp_src = &polys_src[pidx_src];
2003 if (poly_to_looptri_map_src ==
NULL) {
2005 &poly_to_looptri_map_src_buff,
2012 for (j = poly_to_looptri_map_src[pidx_src].
count; j--;) {
2015 &looptri_src[poly_to_looptri_map_src[pidx_src].
indices[j]];
2020 vcos_src[loops_src[lt->
tri[0]].
v],
2021 vcos_src[loops_src[lt->
tri[1]].v],
2022 vcos_src[loops_src[lt->
tri[2]].v]);
2024 if (dist_sq < best_dist_sq) {
2026 best_dist_sq = dist_sq;
2036 (
const float(*)[3])vcos_src,
2044 &best_loop_index_src);
2051 &best_loop_index_src,
2058 (
const float(*)[3])vcos_src,
2077 pidx_src_prev = pidx_src;
2092 for (tindex = 0; tindex < num_trees; tindex++) {
2095 if (isld_steps_src) {
2102 if (isld_steps_src) {
2110 if (vert_to_loop_map_src) {
2113 if (vert_to_loop_map_src_buff) {
2116 if (vert_to_poly_map_src) {
2119 if (vert_to_poly_map_src_buff) {
2122 if (edge_to_poly_map_src) {
2125 if (edge_to_poly_map_src_buff) {
2128 if (poly_to_looptri_map_src) {
2131 if (poly_to_looptri_map_src_buff) {
2132 MEM_freeN(poly_to_looptri_map_src_buff);
2134 if (loop_to_poly_map_src) {
2137 if (poly_cents_src) {
2143 if (indices_interp) {
2146 if (weights_interp) {
2154 const float max_dist,
2155 const float ray_radius,
2160 const int numpolys_dst,
2164 const float full_weight = 1.0f;
2165 const float max_dist_sq = max_dist * max_dist;
2167 float tmp_co[3], tmp_no[3];
2180 for (i = 0; i < numpolys_dst; i++) {
2195 for (i = 0; i < numpolys_dst; i++) {
2196 MPoly *mp = &polys_dst[i];
2201 if (space_transform) {
2206 &treedata, &nearest, tmp_co, max_dist_sq, &hit_dist)) {
2208 const int poly_index = (int)lt->
poly;
2220 for (i = 0; i < numpolys_dst; i++) {
2221 MPoly *mp = &polys_dst[i];
2227 if (space_transform) {
2233 &treedata, &rayhit, tmp_co, tmp_no, ray_radius, max_dist, &hit_dist)) {
2235 const int poly_index = (int)lt->
poly;
2252 const size_t numpolys_src = (size_t)me_src->
totpoly;
2256 float *weights =
MEM_mallocN(
sizeof(*weights) * numpolys_src, __func__);
2259 float(*poly_vcos_2d)[2] =
MEM_mallocN(
sizeof(*poly_vcos_2d) * tmp_poly_size, __func__);
2261 int(*tri_vidx_2d)[3] =
MEM_mallocN(
sizeof(*tri_vidx_2d) * (tmp_poly_size - 2), __func__);
2263 for (i = 0; i < numpolys_dst; i++) {
2267 MPoly *mp = &polys_dst[i];
2269 int tot_rays, done_rays = 0;
2270 float poly_area_2d_inv, done_area = 0.0f;
2273 float to_pnor_2d_mat[3][3], from_pnor_2d_mat[3][3];
2274 float poly_dst_2d_min[2], poly_dst_2d_max[2], poly_dst_2d_z;
2275 float poly_dst_2d_size[2];
2277 float totweights = 0.0f;
2278 float hit_dist_accum = 0.0f;
2279 int sources_num = 0;
2280 const int tris_num = mp->
totloop - 2;
2287 if (space_transform) {
2292 copy_vn_fl(weights, (
int)numpolys_src, 0.0f);
2295 tmp_poly_size = (size_t)mp->
totloop;
2296 poly_vcos_2d =
MEM_reallocN(poly_vcos_2d,
sizeof(*poly_vcos_2d) * tmp_poly_size);
2297 tri_vidx_2d =
MEM_reallocN(tri_vidx_2d,
sizeof(*tri_vidx_2d) * (tmp_poly_size - 2));
2304 poly_dst_2d_z = pcent_dst[2];
2309 for (j = 0; j < mp->
totloop; j++) {
2312 if (space_transform) {
2315 mul_v2_m3v3(poly_vcos_2d[j], to_pnor_2d_mat, tmp_co);
2316 minmax_v2v2_v2(poly_dst_2d_min, poly_dst_2d_max, poly_vcos_2d[j]);
2321 sub_v2_v2v2(poly_dst_2d_size, poly_dst_2d_max, poly_dst_2d_min);
2324 tot_rays = (int)((
max_ff(poly_dst_2d_size[0], poly_dst_2d_size[1]) / ray_radius) + 0.5f);
2331 tot_rays *= tot_rays;
2335 poly_area_2d_inv = 1.0f /
max_ff(poly_area_2d_inv, 1e-9f);
2339 tri_vidx_2d[0][0] = 0;
2340 tri_vidx_2d[0][1] = 1;
2341 tri_vidx_2d[0][2] = 2;
2344 tri_vidx_2d[0][0] = 0;
2345 tri_vidx_2d[0][1] = 1;
2346 tri_vidx_2d[0][2] = 2;
2347 tri_vidx_2d[1][0] = 0;
2348 tri_vidx_2d[1][1] = 2;
2349 tri_vidx_2d[1][2] = 3;
2355 for (j = 0; j < tris_num; j++) {
2356 float *
v1 = poly_vcos_2d[tri_vidx_2d[j][0]];
2357 float *
v2 = poly_vcos_2d[tri_vidx_2d[j][1]];
2358 float *v3 = poly_vcos_2d[tri_vidx_2d[j][2]];
2365 (
int)((
float)tot_rays * done_area * poly_area_2d_inv + 0.5f) - done_rays, 0);
2366 done_rays += rays_num;
2368 while (rays_num--) {
2374 tmp_co[2] = poly_dst_2d_z;
2380 &treedata, &rayhit, tmp_co, tmp_no, ray_radius /
w, max_dist, &hit_dist)) {
2383 weights[lt->
poly] +=
w;
2385 hit_dist_accum += hit_dist;
2394 if (totweights > 0.0f) {
2395 for (j = 0; j < (int)numpolys_src; j++) {
2400 weights[sources_num] = weights[j] / totweights;
2405 r_map, i, hit_dist_accum / totweights, 0, sources_num,
indices, weights);
2420 CLOG_WARN(&
LOG,
"Unsupported mesh-to-mesh poly mapping mode (%d)!", mode);
2421 memset(r_map->
items, 0,
sizeof(*r_map->
items) * (
size_t)numpolys_dst);
2428 #undef MREMAP_RAYCAST_APPROXIMATE_NR
2429 #undef MREMAP_RAYCAST_APPROXIMATE_FAC
2430 #undef MREMAP_RAYCAST_TRI_SAMPLES_MIN
2431 #undef MREMAP_RAYCAST_TRI_SAMPLES_MAX
2432 #undef MREMAP_DEFAULT_BUFSIZE
typedef float(TangentPoint)[2]
BVHTree * bvhtree_from_mesh_looptri_ex(struct BVHTreeFromMesh *data, const struct MVert *vert, const struct MLoop *mloop, const struct MLoopTri *looptri, int looptri_num, const BLI_bitmap *mask, int looptri_num_active, float epsilon, int tree_type, int axis)
void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
BVHTree * BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, const struct Mesh *mesh, BVHCacheType bvh_cache_type, int tree_type)
BVHTree * bvhtree_from_mesh_verts_ex(struct BVHTreeFromMesh *data, const struct MVert *vert, int verts_num, const BLI_bitmap *verts_mask, int verts_num_active, float epsilon, int tree_type, int axis)
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_get_layer(const struct CustomData *data, int type)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
int BKE_mesh_edge_other_vert(const struct MEdge *e, int v)
const float(* BKE_mesh_poly_normals_ensure(const struct Mesh *mesh))[3]
void BKE_mesh_calc_poly_center(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, float r_cent[3])
const float(* BKE_mesh_vertex_normals_ensure(const struct Mesh *mesh))[3]
void BKE_mesh_normals_loop_split(const struct MVert *mverts, const float(*vert_normals)[3], int numVerts, struct MEdge *medges, int numEdges, struct MLoop *mloops, float(*r_loopnors)[3], int numLoops, struct MPoly *mpolys, const float(*polynors)[3], int numPolys, bool use_split_normals, float split_angle, MLoopNorSpaceArray *r_lnors_spacearr, short(*clnors_data)[2], int *r_loop_to_poly)
float(* BKE_mesh_vert_coords_alloc(const struct Mesh *mesh, int *r_vert_len))[3]
void BKE_mesh_vert_loop_map_create(MeshElemMap **r_map, int **r_mem, const struct MPoly *mpoly, const struct MLoop *mloop, int totvert, int totpoly, int totloop)
void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem, const struct MPoly *mpoly, const struct MLoop *mloop, int totvert, int totpoly, int totloop)
void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem, const struct MEdge *medge, int totvert, int totedge)
bool(* MeshRemapIslandsCalc)(struct MVert *verts, int totvert, struct MEdge *edges, int totedge, struct MPoly *polys, int totpoly, struct MLoop *loops, int totloop, struct MeshIslandStore *r_island_store)
void BKE_mesh_origindex_map_create_looptri(MeshElemMap **r_map, int **r_mem, const struct MPoly *mpoly, int mpoly_num, const struct MLoopTri *looptri, int looptri_num)
void BKE_mesh_loop_islands_free(MeshIslandStore *island_store)
void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map, int **r_mem, const struct MEdge *medge, int totedge, const struct MPoly *mpoly, int totpoly, const struct MLoop *mloop, int totloop)
@ MREMAP_MODE_VERT_EDGE_NEAREST
@ MREMAP_MODE_VERT_POLYINTERP_VNORPROJ
@ MREMAP_MODE_EDGE_POLY_NEAREST
@ MREMAP_MODE_VERT_EDGEINTERP_NEAREST
@ MREMAP_MODE_VERT_NEAREST
@ MREMAP_MODE_LOOP_NEAREST_POLYNOR
@ MREMAP_MODE_EDGE_VERT_NEAREST
@ MREMAP_MODE_EDGE_NEAREST
@ MREMAP_MODE_LOOP_NEAREST_LOOPNOR
@ MREMAP_MODE_LOOP_POLY_NEAREST
@ MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ
@ MREMAP_MODE_POLY_POLYINTERP_PNORPROJ
@ MREMAP_MODE_VERT_POLY_NEAREST
@ MREMAP_MODE_POLY_NEAREST
@ MREMAP_MODE_VERT_POLYINTERP_NEAREST
const struct MLoopTri * BKE_mesh_runtime_looptri_ensure(const struct Mesh *mesh)
#define BLI_array_alloca(arr, realsize)
An implementation of the A* (AStar) algorithm to solve shortest path problem.
bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph, int node_index_src, int node_index_dst, astar_f_cost f_cost_cb, BLI_AStarSolution *r_solution, int max_steps)
void BLI_astar_solution_clear(BLI_AStarSolution *as_solution)
void BLI_astar_node_init(BLI_AStarGraph *as_graph, int node_index, void *custom_data)
void BLI_astar_node_link_add(BLI_AStarGraph *as_graph, int node1_index, int node2_index, float cost, void *custom_data)
void BLI_astar_solution_init(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, void *custom_data)
void BLI_astar_graph_init(BLI_AStarGraph *as_graph, int node_num, void *custom_data)
void BLI_astar_solution_free(BLI_AStarSolution *as_solution)
void BLI_astar_graph_free(BLI_AStarGraph *as_graph)
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_TEST(_bitmap, _index)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits)
int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
MINLINE float sqrtf_signed(float f)
MINLINE int compare_ff_relative(float a, float b, float max_diff, int max_ulps)
int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float r_i1[3], float r_i2[3])
MINLINE float area_tri_v2(const float v1[2], const float v2[2], const float v3[2])
void closest_on_tri_to_point_v3(float r[3], const float p[3], const float v1[3], const float v2[3], const float v3[3])
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
float area_poly_v2(const float verts[][2], unsigned int nr)
void interp_weights_poly_v3(float w[], float v[][3], int n, const float co[3])
void mul_m3_v3(const float M[3][3], float r[3])
void BLI_space_transform_apply_normal(const struct SpaceTransform *data, float no[3])
void BLI_space_transform_apply(const struct SpaceTransform *data, float co[3])
void unit_m3(float m[3][3])
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
void unit_m4(float m[4][4])
void copy_m4_m3(float m1[4][4], const float m2[3][3])
void BLI_space_transform_global_from_matrices(struct SpaceTransform *data, const float local[4][4], const float target[4][4])
bool invert_m3_m3(float R[3][3], const float A[3][3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool BLI_eigen_solve_selfadjoint_m3(const float m3[3][3], float r_eigen_values[3], float r_eigen_vectors[3][3])
Compute the eigen values and/or vectors of given 3D symmetric (aka adjoint) matrix.
void BLI_covariance_m3_v3n(const float(*cos_v3)[3], int cos_v3_num, bool use_sample_correction, float r_covmat[3][3], float r_center[3])
Compute the covariance matrix of given set of 3D coordinates.
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void copy_vn_fl(float *array_tar, int size, float val)
void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], float t)
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
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 sub_v2_v2v2(float r[2], const float a[2], const float b[2])
void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
#define BLI_MEMARENA_STD_BUFSIZE
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void * BLI_memarena_calloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void BLI_polyfill_calc(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3])
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
struct RNG * BLI_rng_new(unsigned int seed)
void void void BLI_rng_get_tri_sample_float_v2(struct RNG *rng, const float v1[2], const float v2[2], const float v3[2], float r_pt[2]) ATTR_NONNULL()
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
#define INIT_MINMAX2(min, max)
#define POINTER_FROM_INT(i)
#define UNUSED_VARS_NDEBUG(...)
#define POINTER_AS_INT(i)
#define CLOG_WARN(clg_ref,...)
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
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 Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise 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
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
ccl_gpu_kernel_postfix int ccl_global int * indices
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
#define MREMAP_RAYCAST_TRI_SAMPLES_MIN
static int mesh_remap_interp_poly_data_get(const MPoly *mp, MLoop *mloops, const float(*vcos_src)[3], const float point[3], size_t *buff_size, float(**vcos)[3], const bool use_loops, int **indices, float **weights, const bool do_weights, int *r_closest_index)
void BKE_mesh_remap_find_best_match_from_mesh(const MVert *verts_dst, const int numverts_dst, Mesh *me_src, SpaceTransform *r_space_transform)
#define MREMAP_RAYCAST_TRI_SAMPLES_MAX
void BKE_mesh_remap_calc_source_cddata_masks_from_map_modes(const int UNUSED(vert_mode), const int UNUSED(edge_mode), const int loop_mode, const int UNUSED(poly_mode), CustomData_MeshMasks *r_cddata_mask)
void BKE_mesh_remap_calc_loops_from_mesh(const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius, Mesh *mesh_dst, MVert *verts_dst, const int numverts_dst, MEdge *edges_dst, const int numedges_dst, MLoop *loops_dst, const int numloops_dst, MPoly *polys_dst, const int numpolys_dst, CustomData *ldata_dst, const bool use_split_nors_dst, const float split_angle_dst, const bool dirty_nors_dst, Mesh *me_src, MeshRemapIslandsCalc gen_islands_src, const float islands_precision_src, MeshPairRemap *r_map)
void BKE_mesh_remap_free(MeshPairRemap *map)
#define MREMAP_RAYCAST_APPROXIMATE_NR
void BKE_mesh_remap_item_define_invalid(MeshPairRemap *map, const int index)
struct IslandResult IslandResult
static void mesh_calc_eigen_matrix(const MVert *verts, const float(*vcos)[3], const int numverts, float r_mat[4][4])
void BKE_mesh_remap_calc_polys_from_mesh(const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius, Mesh *mesh_dst, MVert *verts_dst, MLoop *loops_dst, MPoly *polys_dst, const int numpolys_dst, Mesh *me_src, MeshPairRemap *r_map)
#define MREMAP_RAYCAST_APPROXIMATE_FAC
static void mesh_island_to_astar_graph_edge_process(MeshIslandStore *islands, const int island_index, BLI_AStarGraph *as_graph, MVert *verts, MPoly *polys, MLoop *loops, const int edge_idx, BLI_bitmap *done_edges, MeshElemMap *edge_to_poly_map, const bool is_edge_innercut, const int *poly_island_index_map, float(*poly_centers)[3], unsigned char *poly_status)
static float mesh_remap_calc_loops_astar_f_cost(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, BLI_AStarGNLink *link, const int node_idx_curr, const int node_idx_next, const int node_idx_dst)
float BKE_mesh_remap_calc_difference_from_mesh(const SpaceTransform *space_transform, const MVert *verts_dst, const int numverts_dst, Mesh *me_src)
static void mesh_remap_item_define(MeshPairRemap *map, const int index, const float UNUSED(hit_dist), const int island, const int sources_num, const int *indices_src, const float *weights_src)
void BKE_mesh_remap_calc_edges_from_mesh(const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius, const MVert *verts_dst, const int numverts_dst, const MEdge *edges_dst, const int numedges_dst, const bool UNUSED(dirty_nors_dst), Mesh *me_src, Mesh *me_dst, MeshPairRemap *r_map)
#define MREMAP_DEFAULT_BUFSIZE
static bool mesh_remap_bvhtree_query_nearest(BVHTreeFromMesh *treedata, BVHTreeNearest *nearest, const float co[3], const float max_dist_sq, float *r_hit_dist)
static bool mesh_remap_bvhtree_query_raycast(BVHTreeFromMesh *treedata, BVHTreeRayHit *rayhit, const float co[3], const float no[3], const float radius, const float max_dist, float *r_hit_dist)
static void mesh_island_to_astar_graph(MeshIslandStore *islands, const int island_index, MVert *verts, MeshElemMap *edge_to_poly_map, const int numedges, MLoop *loops, MPoly *polys, const int numpolys, BLI_AStarGraph *r_as_graph)
void BKE_mesh_remap_init(MeshPairRemap *map, const int items_num)
void BKE_mesh_remap_calc_verts_from_mesh(const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius, const MVert *verts_dst, const int numverts_dst, const bool UNUSED(dirty_nors_dst), Mesh *me_src, Mesh *me_dst, MeshPairRemap *r_map)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
SocketIndexByIdentifierMap * map
BLI_AStarGNLink ** prev_links
BVHTree_RayCastCallback raycast_callback
BVHTree_NearestPointCallback nearest_callback
const struct MLoopTri * looptri
struct MeshElemMap ** innercuts
struct MeshElemMap ** islands
MeshPairRemapItem * items
struct MLoopTri_Store looptris