46 BMEdge *e_a =
nullptr, *e_b =
nullptr;
51 float no_face[3], no_edge[3];
52 float tvec_a[3], tvec_b[3];
111 *r_va_other =
nullptr;
112 *r_vb_other =
nullptr;
119 if (
dot_v3v3(r_no, tvec_a) > 0.0f) {
146 const float offset_fac,
147 const float offset_fac_vg,
148 const bool use_replace,
149 const bool use_boundary,
150 const bool use_even_offset,
151 const bool use_relative_offset,
152 const bool use_crease,
153 const float crease_weight,
154 const int defgrp_index,
155 const bool defgrp_invert,
156 const short mat_offset,
161 const float ofs_orig = -(((-offset_fac + 1.0f) * 0.5f) * offset);
162 const float ofs_new = offset + ofs_orig;
163 const float ofs_mid = (ofs_orig + ofs_new) / 2.0f;
164 const float inset = offset / 2.0f;
168 const int cd_dvert_offset = (defgrp_index != -1) ?
171 const float offset_fac_vg_inv = 1.0f - offset_fac_vg;
188 use_boundary ?
MEM_mallocN(
sizeof(
BMVert *) * totvert_orig, __func__) :
nullptr);
190 float *verts_relfac =
static_cast<float *
>(
191 (use_relative_offset || (cd_dvert_offset != -1)) ?
192 MEM_mallocN(
sizeof(
float) * totvert_orig, __func__) :
197 int verts_loop_tot = 0;
205 float fac, fac_shell;
209 if (use_crease && cd_edge_crease_offset == -1) {
217 verts_src[i] = v_src;
236 verts_loop_tot += f_src->
len;
247 for (i = 0; i < totvert_orig; i++) {
248 v_src = verts_src[i];
253 if (use_relative_offset) {
257 verts_relfac[i] = 1.0f;
260 if (cd_dvert_offset != -1) {
266 defgrp_fac = 1.0f - defgrp_fac;
269 if (offset_fac_vg > 0.0f) {
270 defgrp_fac = (offset_fac_vg + (defgrp_fac * offset_fac_vg_inv));
273 verts_relfac[i] *= defgrp_fac;
276 fac *= verts_relfac[i];
282 if (offset == 0.0f) {
289 madd_v3_v3v3fl(verts_neg[i]->co, tvec, v_src->
no, (ofs_orig - ofs_mid) * fac);
290 madd_v3_v3v3fl(verts_pos[i]->co, tvec, v_src->
no, (ofs_new - ofs_mid) * fac);
295 verts_neg[i] =
nullptr;
296 verts_pos[i] =
nullptr;
300 if (use_relative_offset ==
false) {
305 if (use_relative_offset) {
332 if (use_even_offset) {
337 if (offset != 0.0f) {
346 for (i = 0; i < 2; i++) {
347 BMVert *v_boundary = v_pair[i];
363 fac *= verts_relfac[v_boundary_index];
367 if (use_even_offset) {
371 va_other->
co, v_boundary->
co, vb_other->
co, no_face)) *
377 if (offset != 0.0f) {
418 BMVert *v_neg1 = verts_neg[i_1];
419 BMVert *v_neg2 = verts_neg[i_2];
421 BMVert *v_pos1 = verts_pos[i_1];
422 BMVert *v_pos2 = verts_pos[i_2];
426 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
439 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
453 BMVert *v_b1 = verts_boundary[i_1];
454 BMVert *v_b2 = verts_boundary[i_2];
458 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
470 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
529#define VERT_DUPE_TEST_ORIG(v) (verts_neg[BM_elem_index_get(v)] != nullptr)
530#define VERT_DUPE_TEST(v) (verts_pos[BM_elem_index_get(v)] != nullptr)
531#define VERT_DUPE_CLEAR(v) \
533 verts_pos[BM_elem_index_get(v)] = nullptr; \
551 if (mix_flag == (1 | 2)) {
554 }
while ((l_iter = l_iter->
next) != l_first);
556 if (mix_flag == (1 | 2)) {
560 }
while ((l_iter = l_iter->
next) != l_first);
565 for (i = 0; i < totvert_orig; i++) {
566 v_src = verts_src[i];
573#undef VERT_DUPE_TEST_ORIG
575#undef VERT_DUPE_CLEAR
579 for (i = 0; i < totvert_orig; i++) {
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
MINLINE float shell_angle_to_dist(float angle)
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
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 float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
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])
float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v3(float r[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f)
#define BM_FACE_FIRST_LOOP(p)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
BMFace * BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, const BMFace *f_example, const eBMCreateFlag create_flag)
Make Quad/Triangle.
void BM_vert_kill(BMesh *bm, BMVert *v)
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
#define BM_elem_index_get(ele)
#define BM_elem_flag_disable(ele, hflag)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
float BM_vert_calc_median_tagged_edge_length(const BMVert *v)
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3])
BM_loop_calc_face_tangent.
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
float BM_loop_calc_face_angle(const BMLoop *l)
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()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
static BMLoop * bm_edge_tag_faceloop(BMEdge *e)
void BM_mesh_wireframe(BMesh *bm, const float offset, const float offset_fac, const float offset_fac_vg, const bool use_replace, const bool use_boundary, const bool use_even_offset, const bool use_relative_offset, const bool use_crease, const float crease_weight, const int defgrp_index, const bool defgrp_invert, const short mat_offset, const int mat_max, const bool use_tag)
#define VERT_DUPE_CLEAR(v)
#define VERT_DUPE_TEST(v)
static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3], BMVert **r_va_other, BMVert **r_vb_other)
#define VERT_DUPE_TEST_ORIG(v)
static bool bm_loop_is_radial_boundary(BMLoop *l_first)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
struct BMLoop * radial_next