38#define VERT_SHARED (1 << 0)
40#define EDGE_RING (1 << 0)
41#define EDGE_RIM (1 << 1)
42#define EDGE_IN_STACK (1 << 2)
44#define FACE_OUT (1 << 0)
45#define FACE_SHARED (1 << 1)
46#define FACE_IN_STACK (1 << 2)
74 float fac = 1.333333f;
79 const float t = 1.0f +
dot;
80 fac = (fac * t) + (0.75f * (1.0f - t));
101 return (
len * 0.5f) * fac;
109 }
while ((node = node->next));
120 }
while ((node = node->next));
131 }
while ((l_iter = l_iter->
next) != l_first);
159 bool has_overlap =
true;
224 }
while ((node = node->next));
245 if (el_store_other) {
246 pair_test.
first = el_store;
247 pair_test.
second = el_store_other;
266 eloop_pair_gs =
nullptr;
269 return eloop_pair_gs;
291 v_arr[cuts + 1] = v_b;
295 v_arr[cuts + 1] = v_a;
329 bool found_outer =
false, found_inner =
false, found_outer_tag =
false;
331 float no_outer[3] = {0.0f}, no_inner[3] = {0.0f};
356 found_outer_tag =
true;
366 if (found_inner && found_outer_tag) {
374 else if (found_outer) {
393 for (i = 0; i < e_arr_len; i++) {
397 l_iter = l_first =
e->l;
404 }
while ((l_iter = l_iter->
radial_next) != l_first);
415 for (i = 0; i < e_arr_len_iter; i++) {
419 l_iter = l_first =
e->l;
422 }
while ((l_iter = l_iter->
radial_next) != l_first);
447 const int interp_mode)
462 float(*nors_pair[2])[3];
463 GHash *nors_gh_pair[2];
468 lpair->
nors_a =
static_cast<float(*)[3]
>(
470 lpair->
nors_b =
static_cast<float(*)[3]
>(
473 nors_pair[0] = lpair->
nors_a;
474 nors_pair[1] = lpair->
nors_b;
493 for (side_index = 0; side_index < 2; side_index++) {
497 GHash *nors_gh_iter = nors_gh_pair[side_index];
498 float(*
nor)[3] = nors_pair[side_index];
502 for (v_iter =
static_cast<LinkData *
>(lb->
first), i = 0; v_iter; v_iter = v_iter->
next, i++)
544 const int interp_mode,
547 const float *falloff_cache)
549 const int resolu = cuts + 2;
551 bool is_a_no_valid, is_b_no_valid;
554 float el_store_a_co[3], el_store_b_co[3];
555 float el_store_a_no[3], el_store_b_no[3];
559 float(*coord_array_main)[3] =
nullptr;
578 if (is_a_no_valid ==
false) {
581 if (is_b_no_valid ==
false) {
584 (void)is_a_no_valid, (
void)is_b_no_valid;
589 if (
dot_v3v3(el_store_a_no, el_dir) > 0.0f) {
592 if (
dot_v3v3(el_store_b_no, el_dir) < 0.0f) {
600 float handle_a[3], handle_b[3];
604 el_store_a_co, el_store_a_no, el_store_b_co, el_store_b_no) *
613 coord_array_main =
static_cast<float(*)[3]
>(
614 MEM_mallocN(dims * (resolu) *
sizeof(
float), __func__));
616 for (i = 0; i < dims; i++) {
621 ((
float *)coord_array_main) + i,
623 sizeof(
float) * dims);
627 switch (interp_mode) {
630 float(*coord_array)[3] =
static_cast<float(*)[3]
>(
631 MEM_mallocN(dims * (resolu) *
sizeof(
float), __func__));
632 for (i = 0; i < resolu; i++) {
634 coord_array[i], el_store_a_co, el_store_b_co,
float(i) /
float(resolu - 1));
643 for (v_iter =
static_cast<LinkData *
>(lb_ring->
first), i = 0; v_iter;
644 v_iter = v_iter->
next, i++)
646 if (i > 0 && i < resolu - 1) {
664 float(*direction_array)[3] =
static_cast<float(*)[3]
>(
665 MEM_mallocN(dims * (resolu) *
sizeof(
float), __func__));
666 float(*quat_array)[4] =
static_cast<float(*)[4]
>(
667 MEM_mallocN(resolu *
sizeof(*quat_array), __func__));
668 float(*tri_array)[3][3] =
static_cast<float(*)[3][3]
>(
669 MEM_mallocN(resolu *
sizeof(*tri_array), __func__));
670 float(*tri_sta)[3], (*tri_end)[3], (*tri_tmp)[3];
675 copy_v3_v3(direction_array[0], el_store_a_no);
676 negate_v3_v3(direction_array[resolu - 1], el_store_b_no);
677 for (i = 1; i < resolu - 1; i++) {
679 coord_array_main[i - 1],
681 coord_array_main[i + 1]);
684 vec_to_quat(quat_array[0], direction_array[0], 5, 1);
687 for (i = 1; i < resolu; i++) {
693 cross_v3_v3v3(cross_tmp, direction_array[i - 1], direction_array[i]);
704 for (i = 0; i < resolu; i++) {
707 const float shape_size = falloff_cache ? falloff_cache[i] : 1.0f;
709 tri_tmp = tri_array[i];
712 for (j = 0; j < 3; j++) {
715 tri_tmp[j][0] = shape_size;
718 tri_tmp[j][1] = shape_size;
721 add_v3_v3(tri_tmp[j], coord_array_main[i]);
725 tri_sta = tri_array[0];
726 tri_end = tri_array[resolu - 1];
739 v_iter = v_iter->
next, i++)
741 float co_a[3], co_b[3];
743 tri_tmp = tri_array[i];
758 float(*coord_array)[3] =
static_cast<float(*)[3]
>(
759 MEM_mallocN(dims * (resolu) *
sizeof(
float), __func__));
771 float co_a[3], no_a[3], handle_a[3], co_b[3], no_b[3], handle_b[3];
802 for (i = 0; i < dims; i++) {
807 ((
float *)coord_array) + i,
809 sizeof(
float) * dims);
814 v_iter = v_iter->
next, i++)
816 if (i > 0 && i < resolu - 1) {
836 if (coord_array_main) {
850 for (i = 0; i < cuts; i++) {
853 if (l_new ==
nullptr) {
876 LinkData *v_iter_a_step = v_iter_a_first;
877 LinkData *v_iter_b_step = v_iter_b_first;
881 static_cast<BMVert *
>(v_iter_b_first->
data)));
885 v_iter_a_step = v_iter_a_step->
next;
887 static_cast<BMVert *
>(v_iter_b_first->
data)) ||
891 v_iter_b_step = v_iter_b_step->
next;
893 static_cast<BMVert *
>(v_iter_a_first->
data)) ||
897 v_iter_a_step =
static_cast<LinkData *
>(v_iter_a_step ? v_iter_a_step->
prev : lb_a->
last);
898 v_iter_b_step =
static_cast<LinkData *
>(v_iter_b_step ? v_iter_b_step->
prev : lb_b->
last);
901 static_cast<BMVert *
>(v_iter_b_step->
data)) ||
903 static_cast<BMVert *
>(v_iter_b_step->
data)) ||
946 if (node->data == v_other) {
1046 while ((f =
STACK_POP(faces_ring_arr))) {
1047 BMLoop *l_iter, *l_first;
1058 }
while ((l_iter = l_iter->
next) != l_first);
1076 const int interp_mode,
1079 const float *falloff_cache)
1085 bm, lpair, el_store_a, el_store_b, &eloops_ring, interp_mode, cuts, smooth, falloff_cache);
1103 bool changed =
false;
1108 const int resolu = cuts + 2;
1113 float *falloff_cache = (profile_shape_factor != 0.0f) ?
1159 if (falloff_cache) {
1161 for (i = 0; i < resolu; i++) {
1162 float shape_size = 1.0f;
1164 fac =
fabsf(1.0f - 2.0f *
fabsf(0.5f - fac));
1166 shape_size += fac * profile_shape_factor;
1168 falloff_cache[i] = shape_size;
1181 else if (
count == 2) {
1197 bm, lpair, el_store_a, el_store_b, interp_mode, cuts, smooth, falloff_cache);
1213 if (eloop_pairs_gs ==
nullptr) {
1233 lpair_arr[i] = lpair;
1246 bm, lpair, el_store_a, el_store_b, interp_mode, cuts, smooth, falloff_cache);
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
#define BLI_array_alloca(arr, realsize)
#define GSET_ITER_INDEX(gs_iter_, gset_, i_)
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
unsigned int BLI_gset_len(const GSet *gs) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
GHashPair * BLI_ghashutil_pairalloc(const void *first, const void *second)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
GSet * BLI_gset_pair_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
#define LISTBASE_FOREACH(type, var, list)
void BLI_listbase_rotate_first(struct ListBase *lb, void *vlink) ATTR_NONNULL(1
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
void transform_point_by_tri_v3(float pt_tar[3], float const pt_src[3], const float tri_tar_p1[3], const float tri_tar_p2[3], const float tri_tar_p3[3], const float tri_src_p1[3], const float tri_src_p2[3], const float tri_src_p3[3])
float closest_to_line_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3])
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void vec_to_quat(float q[4], const float vec[3], short axis, short upflag)
float normalize_qt(float q[4])
void mul_qt_v3(const float q[4], float r[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 float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_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 copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_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 void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3])
#define POINTER_AS_UINT(i)
#define POINTER_FROM_UINT(i)
#define STACK_PUSH(stack, val)
#define STACK_DECLARE(stack)
#define STACK_INIT(stack, stack_num)
Read Guarded memory(de)allocation.
#define BM_FACE_FIRST_LOOP(p)
void BM_mesh_edgeloops_free(ListBase *eloops)
void BM_edgeloop_flip(BMesh *, BMEdgeLoopStore *el_store)
bool BM_edgeloop_calc_normal(BMesh *, BMEdgeLoopStore *el_store)
int BM_mesh_edgeloops_find(BMesh *bm, ListBase *r_eloops, bool(*test_fn)(BMEdge *, void *user_data), void *user_data)
void BM_edgeloop_calc_center(BMesh *, BMEdgeLoopStore *el_store)
BMEdgeLoopStore * BM_edgeloop_from_verts(BMVert **v_arr, const int v_arr_tot, bool is_closed)
int BM_edgeloop_length_get(BMEdgeLoopStore *el_store)
const float * BM_edgeloop_normal_get(BMEdgeLoopStore *el_store)
bool BM_edgeloop_calc_normal_aligned(BMesh *, BMEdgeLoopStore *el_store, const float no_align[3])
bool BM_edgeloop_is_closed(BMEdgeLoopStore *el_store)
void BM_edgeloop_edges_get(BMEdgeLoopStore *el_store, BMEdge **e_arr)
const float * BM_edgeloop_center_get(BMEdgeLoopStore *el_store)
ListBase * BM_edgeloop_verts_get(BMEdgeLoopStore *el_store)
#define BM_EDGELOOP_NEXT(el_store)
void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg) ATTR_NONNULL(1
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
BMFace * BM_face_split(BMesh *bm, BMFace *f, BMLoop *l_a, BMLoop *l_b, BMLoop **r_l, BMEdge *example, const bool no_double)
Face Split.
BMVert * BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts, BMVert **r_varr)
Split an edge multiple times evenly.
#define BMO_edge_flag_test_bool(bm, e, oflag)
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, short oflag)
BMO_FLAG_BUFFER.
#define BMO_edge_flag_test(bm, e, oflag)
#define BMO_edge_flag_enable(bm, e, oflag)
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
#define BMO_vert_flag_set(bm, e, oflag, val)
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, short oflag)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
#define BMO_vert_flag_test(bm, e, oflag)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
#define BMO_face_flag_disable(bm, e, oflag)
#define BMO_edge_flag_disable(bm, e, oflag)
#define BMO_face_flag_test(bm, e, oflag)
ATTR_WARN_UNUSED_RESULT const BMFlagLayer const short oflag
@ SUBD_RING_INTERP_LINEAR
float bmesh_subd_falloff_calc(const int falloff, float val)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
BMESH EDGE/FACE TANGENT.
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
static void bm_edgering_pair_subdiv(BMesh *bm, BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b, ListBase *eloops_ring, const int cuts)
static bool bm_edgering_pair_order_is_flipped(BMesh *, BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b)
static void bm_edgeloop_vert_tag(BMEdgeLoopStore *el_store, const bool tag)
void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op)
static bool bm_edge_rim_test_cb(BMEdge *e, void *bm_v)
static float bezier_handle_calc_length_v3(const float co_a[3], const float no_a[3], const float co_b[3], const float no_b[3])
static void bm_edge_subdiv_as_loop(BMesh *bm, ListBase *eloops, BMEdge *e, BMVert *v_a, const int cuts)
static void bm_faces_share_tag_flush(BMesh *bm, BMEdge **e_arr, const uint e_arr_len)
static uint bm_verts_tag_count(BMesh *bm)
static bool bm_edgeloop_check_overlap_all(BMesh *bm, BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b)
static bool bmo_face_is_vert_tag_all(BMesh *bm, BMFace *f, short oflag)
static void bm_faces_share_tag_clear(BMesh *bm, BMEdge **e_arr_iter, const uint e_arr_len_iter)
static void bm_face_slice(BMesh *bm, BMLoop *l, const int cuts)
static void bm_edgering_pair_ringsubd(BMesh *bm, LoopPairStore *lpair, BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b, const int interp_mode, const int cuts, const float smooth, const float *falloff_cache)
static void bm_vert_calc_surface_tangent(BMesh *bm, BMVert *v, float r_no[3])
static void bm_edgering_pair_order(BMesh *bm, BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b)
static void bm_edgering_pair_interpolate(BMesh *bm, LoopPairStore *lpair, BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b, ListBase *eloops_ring, const int interp_mode, const int cuts, const float smooth, const float *falloff_cache)
static void bm_edgering_pair_store_free(LoopPairStore *lpair, const int interp_mode)
static bool bm_vert_is_tag_edge_connect(BMesh *bm, BMVert *v)
static LoopPairStore * bm_edgering_pair_store_create(BMesh *bm, BMEdgeLoopStore *el_store_a, BMEdgeLoopStore *el_store_b, const int interp_mode)
static void bmo_edgeloop_vert_tag(BMesh *bm, BMEdgeLoopStore *el_store, const short oflag, const bool tag)
static GSet * bm_edgering_pair_calc(BMesh *bm, ListBase *eloops_rim)
additional_info("compositor_sum_squared_difference_float_shared") .push_constant(Type output_img float dot(value.rgb, luminance_coefficients)") .define("LOAD(value)"
draw_view in_light_buf[] float
smooth(Type::VEC3, "P") .flat(Type out_color storage_buf(0, Qualifier::READ, "Surfel", "surfels_buf[]") .push_constant(Type smooth(Type::VEC4, "interp_color")
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
Frequency::GEOMETRY nor[]
struct BMLoop * radial_next
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]