34 }
while ((
l =
l->radial_next) != l_first);
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) {
139 }
while ((
l =
l->radial_next) != l_first);
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;
173 const int totvert_orig =
bm->totvert;
185 use_boundary ?
MEM_mallocN(
sizeof(
BMVert *) * totvert_orig, __func__) :
nullptr);
187 float *verts_relfac =
static_cast<float *
>(
188 (use_relative_offset || (cd_dvert_offset != -1)) ?
189 MEM_mallocN(
sizeof(
float) * totvert_orig, __func__) :
194 int verts_loop_tot = 0;
202 float fac, fac_shell;
206 if (use_crease && cd_edge_crease_offset == -1) {
214 verts_src[
i] = v_src;
233 verts_loop_tot += f_src->
len;
244 for (
i = 0;
i < totvert_orig;
i++) {
245 v_src = verts_src[
i];
250 if (use_relative_offset) {
254 verts_relfac[
i] = 1.0f;
257 if (cd_dvert_offset != -1) {
263 defgrp_fac = 1.0f - defgrp_fac;
266 if (offset_fac_vg > 0.0f) {
267 defgrp_fac = (offset_fac_vg + (defgrp_fac * offset_fac_vg_inv));
270 verts_relfac[
i] *= defgrp_fac;
273 fac *= verts_relfac[
i];
279 if (offset == 0.0f) {
292 verts_neg[
i] =
nullptr;
293 verts_pos[
i] =
nullptr;
297 if (use_relative_offset ==
false) {
302 if (use_relative_offset) {
329 if (use_even_offset) {
334 if (offset != 0.0f) {
341 BMVert *v_pair[2] = {
l->v,
l->next->v};
343 for (
i = 0;
i < 2;
i++) {
344 BMVert *v_boundary = v_pair[
i];
360 fac *= verts_relfac[v_boundary_index];
364 if (use_even_offset) {
368 va_other->
co, v_boundary->
co, vb_other->
co, no_face)) *
374 if (offset != 0.0f) {
415 BMVert *v_neg1 = verts_neg[i_1];
416 BMVert *v_neg2 = verts_neg[i_2];
418 BMVert *v_pos1 = verts_pos[i_1];
419 BMVert *v_pos2 = verts_pos[i_2];
423 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
436 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
450 BMVert *v_b1 = verts_boundary[i_1];
451 BMVert *v_b2 = verts_boundary[i_2];
455 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
467 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
526#define VERT_DUPE_TEST_ORIG(v) (verts_neg[BM_elem_index_get(v)] != nullptr)
527#define VERT_DUPE_TEST(v) (verts_pos[BM_elem_index_get(v)] != nullptr)
528#define VERT_DUPE_CLEAR(v) \
530 verts_pos[BM_elem_index_get(v)] = nullptr; \
548 if (mix_flag == (1 | 2)) {
551 }
while ((l_iter = l_iter->
next) != l_first);
553 if (mix_flag == (1 | 2)) {
557 }
while ((l_iter = l_iter->
next) != l_first);
562 for (
i = 0;
i < totvert_orig;
i++) {
563 v_src = verts_src[
i];
570#undef VERT_DUPE_TEST_ORIG
572#undef VERT_DUPE_CLEAR
576 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 StringRef 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)
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_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
struct BMLoop * radial_next