55 #define MAX_CLIPPLANE_LEN 3
79 for (
int i = 0; i <
ARRAY_SIZE(this->bvhtree); i++) {
80 if (!this->cached[i]) {
83 this->bvhtree[i] =
nullptr;
93 #ifdef WITH_CXX_GUARDEDALLOC
94 MEM_CXX_CLASS_ALLOC_FUNCS(
"SnapData_Mesh")
112 for (
int i = 0; i <
ARRAY_SIZE(this->bvhtree); i++) {
113 if (!this->cached[i]) {
116 this->bvhtree[i] =
nullptr;
126 #ifdef WITH_CXX_GUARDEDALLOC
127 MEM_CXX_CLASS_ALLOC_FUNCS(
"SnapData_EditMesh")
181 bool use_hide =
false;
194 me_eval = editmesh_eval_final;
197 else if ((edit_mode_type ==
SNAP_GEOM_CAGE) && editmesh_eval_cage) {
201 me_eval = editmesh_eval_cage;
206 *r_use_hide = use_hide;
248 bool is_dirty =
false;
291 std::unique_ptr<SnapData_Mesh> sod_ptr = std::make_unique<SnapData_Mesh>();
330 if (editmesh_eval_final) {
331 return &editmesh_eval_final->
runtime;
335 if (editmesh_eval_cage) {
336 return &editmesh_eval_cage->
runtime;
339 return &((
Mesh *)ob_eval->
data)->runtime;
354 bool is_dirty =
false;
393 std::unique_ptr<SnapData_EditMesh> sod_ptr = std::make_unique<SnapData_EditMesh>();
425 if (treedata->
tree ==
nullptr) {
457 if (treedata ==
nullptr || treedata->
tree ==
nullptr) {
473 const float obmat[4][4],
474 bool is_object_active,
479 const Base *base_act,
496 const bool is_active = (base_act == base);
503 if (is_in_object_mode) {
548 const bool is_object_active = (base == base_act);
554 sob_callback(sctx,
params, dupli_ob->ob, dupli_ob->mat, is_object_active,
data);
559 sob_callback(sctx,
params, obj_eval, obj_eval->
obmat, is_object_active,
data);
597 const float obmat[4][4],
633 data->raycast_callback(
data->bvhdata, index, ray, hit);
634 if (hit->
index != -1) {
636 float location[3],
normal[3];
641 depth = (hit->
dist +
data->len_diff) /
data->local_scale;
655 const float dir[3],
const float v0[3],
const float v1[3],
const float v2[3],
float no[3])
670 const float *vtri_co[3] = {
677 if (dist >= 0 && dist < hit->dist) {
698 const float *t0, *t1, *t2;
706 if (dist >= 0 && dist < hit->dist) {
720 const float ray_start[3],
721 const float ray_dir[3],
724 const float obmat[4][4],
742 float ray_start_local[3], ray_normal_local[3];
743 float local_scale, local_depth, len_diff = 0.0f;
755 local_depth = *ray_depth;
757 local_depth *= local_scale;
765 ray_start_local, ray_normal_local, bb->
vec[0], bb->
vec[6], &len_diff,
nullptr)) {
772 if (len_diff > 400.0f) {
773 len_diff -= local_scale;
774 madd_v3_v3fl(ray_start_local, ray_normal_local, len_diff);
775 local_depth -= len_diff;
785 if (treedata->
tree ==
nullptr) {
796 data.bvhdata = treedata;
800 data.len_diff = len_diff;
801 data.local_scale = local_scale;
802 data.ob_eval = ob_eval;
803 data.ob_uuid = ob_index;
804 data.hit_list = r_hit_list;
805 data.retval = retval;
815 retval =
data.retval;
820 hit.dist = local_depth;
827 params->use_backface_culling ?
831 hit.dist += len_diff;
832 hit.dist /= local_scale;
833 if (hit.dist <= *ray_depth) {
834 *ray_depth = hit.dist;
860 const float ray_start[3],
861 const float ray_dir[3],
864 const float obmat[4][4],
880 float ray_start_local[3], ray_normal_local[3];
881 float local_scale, local_depth, len_diff = 0.0f;
893 local_depth = *ray_depth;
895 local_depth *= local_scale;
904 ray_start_local, ray_normal_local, sod->
min, sod->
max, &len_diff,
nullptr)) {
911 if (len_diff > 400.0f) {
912 len_diff -= local_scale;
913 madd_v3_v3fl(ray_start_local, ray_normal_local, len_diff);
914 local_depth -= len_diff;
921 if (treedata ==
nullptr) {
931 data.bvhdata = treedata;
935 data.len_diff = len_diff;
936 data.local_scale = local_scale;
937 data.ob_eval = ob_eval;
938 data.ob_uuid = ob_index;
939 data.hit_list = r_hit_list;
940 data.retval = retval;
950 retval =
data.retval;
955 hit.dist = local_depth;
962 params->use_backface_culling ?
966 hit.dist += len_diff;
967 hit.dist /= local_scale;
968 if (hit.dist <= *ray_depth) {
969 *ray_depth = hit.dist;
1018 const float obmat[4][4],
1019 bool is_object_active,
1028 bool retval =
false;
1029 if (use_occlusion_test) {
1037 switch (ob_eval->
type) {
1040 bool use_hide =
false;
1042 if (me_eval ==
nullptr) {
1048 "Make sure there is only one pointer for looptris");
1083 if (!is_object_active) {
1108 *dt->
r_ob = ob_eval;
1144 const float ray_start[3],
1145 const float ray_dir[3],
1155 float r_obmat[4][4],
1168 data.ray_start = ray_start;
1169 data.ray_dir = ray_dir;
1171 data.ray_depth = ray_depth;
1174 data.r_index = r_index;
1176 data.r_obmat = r_obmat;
1177 data.r_hit_list = r_hit_list;
1178 data.use_occlusion_test =
params->use_occlusion_test;
1229 *r_index = nearest.
index;
1243 const float (*obmat)[4],
1244 const float init_co[3],
1245 const float curr_co[3],
1251 if (curr_co ==
nullptr || init_co ==
nullptr) {
1263 float init_co_local[3], curr_co_local[3];
1264 float delta_local[3];
1267 sub_v3_v3v3(delta_local, curr_co_local, init_co_local);
1270 if (
params->keep_on_same_target) {
1272 tree, nearest_cb, treedata, init_co_local,
nullptr,
nullptr,
nullptr, &dist_sq);
1279 tree, nearest_cb, treedata, curr_co_local,
nullptr,
nullptr,
nullptr, &dist_sq);
1281 if (*r_dist_sq <= dist_sq) {
1284 *r_dist_sq = dist_sq;
1287 float step_scale_factor = 1.0f /
max_ff(1.0f, (
float)
params->face_nearest_steps);
1288 mul_v3_fl(delta_local, step_scale_factor);
1296 for (
int i = 0; i <
params->face_nearest_steps; i++) {
1299 tree, nearest_cb, treedata, co_local, co_local, no_local, &index,
nullptr);
1319 const Mesh *me_eval,
1320 const float (*obmat)[4],
1322 const float init_co[3],
1323 const float curr_co[3],
1330 if (treedata ==
nullptr || treedata->
tree ==
nullptr) {
1352 const float (*obmat)[4],
1353 const float init_co[3],
1354 const float curr_co[3],
1361 if (treedata ==
nullptr || treedata->
tree ==
nullptr) {
1381 const float obmat[4][4],
1382 bool is_object_active,
1387 bool retval =
false;
1388 switch (ob_eval->
type) {
1391 bool use_hide =
false;
1410 "Make sure there is only one pointer for looptris");
1428 if (!is_object_active) {
1450 *dt->
r_ob = ob_eval;
1495 data.r_dist_sq = FLT_MAX;
1513 const float lpmat[4][4],
1514 const float win_size[2],
1515 const float mval[2],
1527 if (bb_dist_px_sq > dist_px_sq) {
1543 const float **r_co);
1584 *r_co =
data->vert[index].co;
1609 r_v_index[0] = edge->v1;
1610 r_v_index[1] = edge->v2;
1626 for (
int j = 2, j_next = 0; j_next < 3; j = j_next++) {
1627 const MEdge *ed = &medge[mloop[lt->
tri[j]].
e];
1628 const uint tri_edge[2] = {mloop[lt->
tri[j]].
v, mloop[lt->
tri[j_next]].
v};
1629 if (
ELEM(ed->
v1, tri_edge[0], tri_edge[1]) &&
ELEM(ed->
v2, tri_edge[0], tri_edge[1])) {
1631 r_v_index[j] = mloop[lt->
tri[j]].
e;
1644 r_v_index[0] = loop[looptri->
tri[0]].
v;
1645 r_v_index[1] = loop[looptri->
tri[1]].
v;
1646 r_v_index[2] = loop[looptri->
tri[2]].
v;
1650 const float (*clip_plane)[4],
1651 const int clip_plane_len,
1652 const bool is_persp,
1672 if (dist_sq < *dist_px_sq) {
1674 *dist_px_sq = dist_sq;
1681 const float (*clip_plane)[4],
1682 const int clip_plane_len,
1683 const bool is_persp,
1689 float near_co[3], lambda;
1694 if (lambda <= 0.0f) {
1697 else if (lambda >= 1.0f) {
1706 precalc, clip_plane, clip_plane_len, is_persp, near_co, dist_px_sq, r_co);
1712 const float (*clip_plane)[4],
1713 const int clip_plane_len,
1719 data->get_vert_co(index,
data, &co);
1728 data->copy_vert_no(index,
data, nearest->
no);
1729 nearest->
index = index;
1736 const float (*clip_plane)[4],
1737 const int clip_plane_len,
1743 data->get_edge_verts_index(index,
data, vindex);
1745 const float *v_pair[2];
1746 data->get_vert_co(vindex[0],
data, &v_pair[0]);
1747 data->get_vert_co(vindex[1],
data, &v_pair[1]);
1758 nearest->
index = index;
1765 const float (*clip_plane)[4],
1766 const int clip_plane_len,
1772 data->get_edge_verts_index(index,
data, vindex);
1774 for (
int i = 2; i--;) {
1775 if (vindex[i] == nearest->
index) {
1778 cb_snap_vert(userdata, vindex[i], precalc, clip_plane, clip_plane_len, nearest);
1785 const float (*clip_plane)[4],
1786 const int clip_plane_len,
1791 if (
data->use_backface_culling) {
1793 data->get_tri_verts_index(index,
data, vindex);
1795 const float *t0, *t1, *t2;
1796 data->get_vert_co(vindex[0],
data, &t0);
1797 data->get_vert_co(vindex[1],
data, &t1);
1798 data->get_vert_co(vindex[2],
data, &t2);
1806 data->get_tri_edges_index(index,
data, eindex);
1807 for (
int i = 3; i--;) {
1808 if (eindex[i] != -1) {
1809 if (eindex[i] == nearest->
index) {
1812 cb_snap_edge(userdata, eindex[i], precalc, clip_plane, clip_plane_len, nearest);
1820 const float (*clip_plane)[4],
1821 const int clip_plane_len,
1827 data->get_tri_verts_index(index,
data, vindex);
1829 if (
data->use_backface_culling) {
1830 const float *t0, *t1, *t2;
1831 data->get_vert_co(vindex[0],
data, &t0);
1832 data->get_vert_co(vindex[1],
data, &t1);
1833 data->get_vert_co(vindex[2],
data, &t2);
1840 for (
int i = 3; i--;) {
1841 if (vindex[i] == nearest->
index) {
1844 cb_snap_vert(userdata, vindex[i], precalc, clip_plane, clip_plane_len, nearest);
1850 bool use_backface_culling,
1871 bool use_backface_culling,
1895 const float obmat[4][4],
1920 nearest.dist_sq =
square_f(*dist_px);
1927 params->use_backface_culling,
1932 const MPoly *mp = &sod_mesh->get()->poly[*r_index];
1937 for (
int i = mp->
totloop; i--; ml++) {
1948 for (
int i = mp->
totloop; i--; ml++) {
1966 params->use_backface_culling,
1969 BMEditMesh *em = sod_editmesh->treedata_editmesh.em;
1973 BMLoop *l_iter, *l_first;
1986 }
while ((l_iter = l_iter->
next) != l_first);
1999 }
while ((l_iter = l_iter->
next) != l_first);
2003 if (nearest.index != -1) {
2004 *dist_px =
sqrtf(nearest.dist_sq);
2018 *r_index = nearest.index;
2028 const float obmat[4][4],
2029 float original_dist_px,
2030 const float prev_co[3],
2050 params->use_backface_culling,
2059 params->use_backface_culling,
2067 const float *v_pair[2];
2068 nearest2d.
get_vert_co(vindex[0], &nearest2d, &v_pair[0]);
2069 nearest2d.
get_vert_co(vindex[1], &nearest2d, &v_pair[1]);
2082 nearest.dist_sq =
square_f(original_dist_px);
2098 float range = 1.0f / (2 * e_mode_len - 1);
2100 if (lambda < (range) || (1.0f - range) < lambda) {
2101 int v_id = lambda < 0.5f ? 0 : 1;
2110 nearest.index = vindex[v_id];
2115 nearest2d.
copy_vert_no(vindex[v_id], &nearest2d, r_no);
2124 range *= e_mode_len - 1;
2125 if ((range) < lambda && lambda < (1.0f - range)) {
2136 nearest.index = *r_index;
2143 float v_near[3], va_g[3], vb_g[3];
2149 if (
IN_RANGE(lambda, 0.0f, 1.0f)) {
2163 nearest.index = *r_index;
2171 if (nearest.index != -1) {
2172 *dist_px =
sqrtf(nearest.dist_sq);
2179 *r_index = nearest.index;
2188 const float obmat[4][4],
2189 bool is_object_active,
2204 float lpmat[4][4], dist_px_sq =
square_f(*dist_px);
2212 const bool is_editmode = arm->
edbo !=
nullptr;
2214 if (is_editmode ==
false) {
2233 const bool is_posemode = is_object_active && (ob_eval->
mode &
OB_MODE_POSE);
2234 const bool skip_selected = (is_editmode || is_posemode) &&
2240 if (eBone->layer & arm->
layer) {
2247 if (is_selected && skip_selected) {
2250 bool has_vert_snap =
false;
2269 if (has_vert_snap) {
2290 Bone *bone = pchan->bone;
2297 if (is_selected && skip_selected) {
2301 bool has_vert_snap =
false;
2302 const float *head_vec = pchan->pose_head;
2303 const float *tail_vec = pchan->pose_tail;
2321 if (has_vert_snap) {
2341 *dist_px =
sqrtf(dist_px_sq);
2356 const float obmat[4][4],
2364 bool has_snap =
false;
2372 float dist_px_sq =
square_f(*dist_px);
2383 if (use_obedit ==
false) {
2409 for (
int i = clip_plane_len; i--;) {
2410 mul_v4_m4v4(clip_planes_local[i], tobmat, clip_planes[i]);
2417 for (
int u = 0; u < nu->pntsu; u++) {
2421 if (nu->bezt[u].hide) {
2426 bool is_selected = (nu->bezt[u].f2 &
SELECT) != 0;
2427 if (is_selected && skip_selected) {
2440 bool is_selected_h1 = (nu->bezt[u].f1 &
SELECT) != 0;
2441 bool is_selected_h2 = (nu->bezt[u].f3 &
SELECT) != 0;
2442 bool is_autoalign_h1 = (nu->bezt[u].h1 &
HD_ALIGN) != 0;
2443 bool is_autoalign_h2 = (nu->bezt[u].h2 &
HD_ALIGN) != 0;
2444 if (!skip_selected || !(is_selected_h1 || (is_autoalign_h1 && is_selected_h2))) {
2454 if (!skip_selected || !(is_selected_h2 || (is_autoalign_h2 && is_selected_h1))) {
2465 if (nu->bp[u].hide) {
2470 bool is_selected = (nu->bp[u].f1 &
SELECT) != 0;
2471 if (is_selected && skip_selected) {
2486 if (nu->pntsu > 1) {
2511 *dist_px =
sqrtf(dist_px_sq);
2526 const float obmat[4][4],
2550 float dist_px_sq =
square_f(*dist_px);
2559 *dist_px =
sqrtf(dist_px_sq);
2576 const float obmat[4][4],
2589 float dist_px_sq =
square_f(*dist_px);
2591 float orig_camera_mat[4][4], orig_camera_imat[4][4], imat[4][4];
2595 if (clip ==
nullptr) {
2616 float reconstructed_camera_mat[4][4], reconstructed_camera_imat[4][4];
2617 const float(*vertex_obmat)[4];
2621 tracking, tracking_object,
scene->
r.
cfra, reconstructed_camera_mat);
2623 invert_m4_m4(reconstructed_camera_imat, reconstructed_camera_mat);
2627 float bundle_pos[3];
2635 vertex_obmat = orig_camera_mat;
2638 mul_m4_v3(reconstructed_camera_imat, bundle_pos);
2639 vertex_obmat = obmat;
2657 *dist_px =
sqrtf(dist_px_sq);
2671 const Mesh *me_eval,
2672 const float obmat[4][4],
2692 float dist_px_sq =
square_f(*dist_px);
2710 if (sod->
bvhtree[0] ==
nullptr) {
2720 if (sod->
bvhtree[1] ==
nullptr) {
2737 nearest.dist_sq = dist_px_sq;
2739 int last_index = nearest.index;
2760 last_index = nearest.index;
2777 if (treedata->
tree) {
2790 if (last_index != nearest.index) {
2809 if (treedata->
tree) {
2823 if (nearest.index != -1) {
2824 *dist_px =
sqrtf(nearest.dist_sq);
2838 *r_index = nearest.index;
2851 const float obmat[4][4],
2875 float dist_px_sq =
square_f(*dist_px);
2891 if (treedata.tree ==
nullptr) {
2893 int verts_num_active = -1;
2914 sod->
bvhtree[0] = treedata.tree;
2915 sod->
cached[0] = treedata.cached;
2923 if (treedata.tree ==
nullptr) {
2925 int edges_num_active = -1;
2946 sod->
bvhtree[1] = treedata.tree;
2947 sod->
cached[1] = treedata.cached;
2957 nearest.dist_sq = dist_px_sq;
2983 int last_index = nearest.index;
2997 if (nearest.index != -1) {
3001 nearest.index = last_index;
3005 if (nearest.index != -1) {
3006 *dist_px =
sqrtf(nearest.dist_sq);
3019 *r_index = nearest.index;
3046 const float obmat[4][4],
3047 bool is_object_active,
3053 switch (ob_eval->
type) {
3058 if (me_eval ==
nullptr) {
3064 "Make sure there is only one pointer for looptris");
3136 *dt->
r_ob = ob_eval;
3179 float r_obmat[4][4])
3182 data.dist_px = dist_px;
3186 data.r_index = r_index;
3187 data.r_obmat = r_obmat;
3235 const float ray_start[3],
3236 const float ray_normal[3],
3242 float r_obmat[4][4])
3264 const float ray_start[3],
3265 const float ray_normal[3],
3273 if (ray_depth == -1.0f) {
3278 float ray_depth_prev = ray_depth;
3316 const float ray_start[3],
3317 const float ray_normal[3],
3345 const float ray_origin[3],
3346 const float ray_direction[3],
3351 float ray_depth_fallback;
3352 if (ray_depth ==
nullptr) {
3354 ray_depth = &ray_depth_fallback;
3358 sctx,
depsgraph, v3d,
params, ray_origin, ray_direction, ray_depth, r_co, r_no);
3367 const float init_co[3],
3368 const float mval[2],
3369 const float prev_co[3],
3375 float r_obmat[4][4],
3376 float r_face_nor[3])
3386 bool has_hit =
false;
3387 Object *ob_eval =
nullptr;
3391 float no[3] = {0.0f, 0.0f, 0.0f};
3403 sctx,
params, init_co, prev_co, loc, no, &index, &ob_eval, obmat);
3425 float ray_start[3], ray_normal[3];
3427 depsgraph, region, v3d, mval,
nullptr, ray_normal, ray_start,
true)) {
3473 float dist_px_tmp = *dist_px;
3503 float new_clipplane[4];
3512 new_clipplane[3] += 0.01f;
3539 sctx,
params, ob_eval, obmat, *dist_px, prev_co, &dist_px_tmp, loc, no, &index);
3542 if (elem & snap_to_flag) {
3559 *dist_px = dist_px_tmp;
3572 const float init_co[3],
3573 const float mval[2],
3574 const float prev_co[3],
3580 float r_obmat[4][4],
3581 float r_face_nor[3])
3607 const float init_co[3],
3608 const float mval[2],
3609 const float prev_co[3],
3637 const float mval[2],
3642 float ray_start[3], ray_normal[3];
3645 depsgraph, region, v3d, mval,
nullptr, ray_normal, ray_start,
true)) {
typedef float(TangentPoint)[2]
struct BoundBox * BKE_armature_boundbox_get(struct Object *ob)
BVHTree * bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data, struct BMEditMesh *em, const BLI_bitmap *edges_mask, int edges_num_active, float epsilon, int tree_type, int axis)
void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
BVHTree * bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data, struct BMEditMesh *em, const BLI_bitmap *mask, int verts_num_active, float epsilon, int tree_type, int axis)
BVHTree * BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data, struct BMEditMesh *em, int tree_type, BVHCacheType bvh_cache_type, struct BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex)
BVHTree * bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data, struct BMEditMesh *em, const BLI_bitmap *mask, int looptri_num_active, float epsilon, int tree_type, int axis)
@ BVHTREE_FROM_LOOSEEDGES
@ BVHTREE_FROM_LOOSEVERTS
@ BVHTREE_FROM_EM_LOOPTRI
@ BVHTREE_FROM_LOOPTRI_NO_HIDDEN
float bvhtree_ray_tri_intersection(const BVHTreeRay *ray, float m_dist, const float v0[3], const float v1[3], const float v2[3])
BVHTree * BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, const struct Mesh *mesh, BVHCacheType bvh_cache_type, int tree_type)
bool bvhcache_has_tree(const struct BVHCache *bvh_cache, const BVHTree *tree)
void free_bvhtree_from_editmesh(struct BVHTreeFromEditMesh *data)
struct BoundBox * BKE_curve_boundbox_get(struct Object *ob)
struct ListBase * object_duplilist(struct Depsgraph *depsgraph, struct Scene *sce, struct Object *ob)
void free_object_duplilist(struct ListBase *lb)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
bool BKE_object_has_geometry_set_instances(const struct Object *ob)
General operations, lookup, etc. for blender objects.
struct MovieClip * BKE_object_movieclip_get(struct Scene *scene, struct Object *ob, bool use_default)
struct Mesh * BKE_object_get_editmesh_eval_final(const struct Object *object)
struct Mesh * BKE_object_get_evaluated_mesh(const struct Object *object)
const struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
struct Mesh * BKE_object_get_editmesh_eval_cage(const struct Object *object)
bool BKE_object_is_in_editmode(const struct Object *ob)
void BKE_tracking_get_camera_object_matrix(struct Object *camera_object, float mat[4][4])
void BKE_tracking_camera_get_reconstructed_interpolate(struct MovieTracking *tracking, struct MovieTrackingObject *object, float framenr, float mat[4][4])
struct ListBase * BKE_tracking_object_get_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object)
#define BLI_assert_msg(a, msg)
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BVH_RAYCAST_DIST_MAX
int BLI_bvhtree_find_nearest_projected(BVHTree *tree, float projmat[4][4], float winsize[2], float mval[2], float clip_planes[6][4], int clip_plane_len, BVHTreeNearest *nearest, BVHTree_NearestProjectedCallback callback, void *userdata)
void BLI_bvhtree_free(BVHTree *tree)
void(* BVHTree_RayCastCallback)(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
void(* BVHTree_NearestPointCallback)(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
void BLI_bvhtree_ray_cast_all(BVHTree *tree, const float co[3], const float dir[3], float radius, float hit_dist, BVHTree_RayCastCallback callback, void *userdata)
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)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_listbase_sort(struct ListBase *listbase, int(*cmp)(const void *, const void *)) ATTR_NONNULL(1
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE float square_f(float a)
#define BLI_ASSERT_UNIT_V3(v)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
float dist_squared_to_projected_aabb(struct DistProjectedAABBPrecalc *data, const float bbmin[3], const float bbmax[3], bool r_axis_closest[3])
bool isect_ray_line_v3(const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], float *r_lambda)
bool isect_point_planes_v3_negated(const float(*planes)[4], int totplane, const float p[3])
void cross_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
bool isect_ray_aabb_v3_simple(const float orig[3], const float dir[3], const float bb_min[3], const float bb_max[3], float *tmin, float *tmax)
void dist_squared_to_projected_aabb_precalc(struct DistProjectedAABBPrecalc *precalc, const float projmat[4][4], const float winsize[2], const float mval[2])
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
void planes_from_projmat(const float mat[4][4], float left[4], float right[4], float bottom[4], float top[4], float near[4], float far[4])
void mul_v4_m4v4(float r[4], const float M[4][4], const float v[4])
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 transpose_m4_m4(float R[4][4], const float M[4][4])
void mul_mat3_m4_v3(const float M[4][4], float r[3])
bool invert_m4_m4(float R[4][4], const float A[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 copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_transposed_mat3_m4_v3(const float M[4][4], float r[3])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[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 float normalize_v3_v3(float r[3], const float a[3])
MINLINE float mul_project_m4_v3_zfac(const float mat[4][4], const float co[3]) ATTR_WARN_UNUSED_RESULT
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE float dot_m4_v3_row_x(const float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float dot_m4_v3_row_y(const float M[4][4], const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v4(float r[4])
pthread_mutex_t ThreadMutex
#define INIT_MINMAX(min, max)
#define IN_RANGE(a, b, c)
struct Depsgraph Depsgraph
struct Object * DEG_get_original_object(struct Object *object)
bool DEG_is_evaluated_object(const struct Object *object)
struct ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
Object is a sort of wrapper for general info.
@ BA_SNAP_FIX_DEPS_FIASCO
#define BA_TRANSFORM_LOCKED_IN_PLACE
@ SCE_SNAP_TARGET_NOT_ACTIVE
@ SCE_SNAP_TARGET_NOT_NONEDITED
@ SCE_SNAP_TARGET_ONLY_SELECTABLE
@ SCE_SNAP_TARGET_NOT_SELECTED
@ SCE_SNAP_TARGET_NOT_EDITED
@ SCE_SNAP_MODE_FACE_NEAREST
@ SCE_SNAP_MODE_EDGE_MIDPOINT
@ SCE_SNAP_MODE_FACE_RAYCAST
@ SCE_SNAP_MODE_EDGE_PERPENDICULAR
#define BASE_VISIBLE(v3d, base)
#define XRAY_ENABLED(v3d)
bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph, const struct ARegion *region, const struct View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip_planes)
#define XRAY_FLAG_ENABLED(v3d)
_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.
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 Map
#define BM_FACE_FIRST_LOOP(p)
#define BM_elem_index_get(ele)
int BM_iter_mesh_bitmap_from_filter_tessface(BMesh *bm, BLI_bitmap *bitmap, bool(*test_fn)(BMFace *, void *user_data), void *user_data)
int BM_iter_mesh_bitmap_from_filter(const char itype, BMesh *bm, BLI_bitmap *bitmap, bool(*test_fn)(BMElem *, void *user_data), void *user_data)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
void sort(btMatrix3x3 &U, btVector3 &sigma, btMatrix3x3 &V, int t)
Helper function of 3X3 SVD for sorting singular values.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
const Value & lookup(const Key &key) const
void add_new(const Key &key, const Value &value)
bool remove(const Key &key)
const Value * lookup_ptr(const Key &key) const
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
IconTextureDrawCall normal
void(* MEM_freeN)(void *vmemh)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
vec_base< float, 3 > float3
struct BMLoop *(* looptris)[3]
BVHTree_NearestPointCallback nearest_callback
BVHTree_RayCastCallback raycast_callback
BVHTree_RayCastCallback raycast_callback
const struct MEdge * edge
const float(* vert_normals)[3]
const struct MLoop * loop
const struct MVert * vert
BVHTree_NearestPointCallback nearest_callback
const struct MLoopTri * looptri
struct BVHCache * bvh_cache
struct MLoopTri_Store looptris
struct MovieTracking tracking
Nearest2DCopyVertNoCallback copy_vert_no
const float(* vert_normals)[3]
bool use_backface_culling
Nearest2DGetTriVertsCallback get_tri_verts_index
Nearest2DGetTriEdgesCallback get_tri_edges_index
Nearest2DGetEdgeVertsCallback get_edge_verts_index
Nearest2DGetVertCoCallback get_vert_co
BVHTree_RayCastCallback raycast_callback
struct Mesh_Runtime * mesh_runtime
BVHTreeFromEditMesh treedata_editmesh
BVHTreeFromMesh treedata_mesh
struct SnapObjectContext::@620 callbacks
Map< const Object *, std::unique_ptr< SnapData_Mesh > > mesh_caches
struct SnapObjectContext::@621 runtime
float clip_plane[MAX_CLIPPLANE_LEN][4]
bool(* test_face_fn)(BMFace *, void *user_data)
bool(* test_edge_fn)(BMEdge *, void *user_data)
bool(* test_vert_fn)(BMVert *, void *user_data)
Map< const BMEditMesh *, std::unique_ptr< SnapData_EditMesh > > editmesh_caches
struct SnapObjectContext::@620::@622 edit_mesh