Blender V4.3
bmesh_wireframe.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
11#include <algorithm>
12
13#include "MEM_guardedalloc.h"
14
15#include "bmesh.hh"
16
17#include "BLI_math_geom.h"
18#include "BLI_math_vector.h"
19
20#include "BKE_customdata.hh"
21#include "BKE_deform.hh"
22
23#include "bmesh_wireframe.hh"
24
26{
27 BMLoop *l, *l_first;
28
29 l = l_first = e->l;
30 do {
32 return l;
33 }
34 } while ((l = l->radial_next) != l_first);
35
36 /* in the case this is used, we know this will never happen */
37 return nullptr;
38}
39
41 BMVert *v, float r_no[3], float r_no_face[3], BMVert **r_va_other, BMVert **r_vb_other)
42{
43 BMIter iter;
44 BMEdge *e_iter;
45
46 BMEdge *e_a = nullptr, *e_b = nullptr;
47 BMVert *v_a, *v_b;
48
49 BMLoop *l_a, *l_b;
50
51 float no_face[3], no_edge[3];
52 float tvec_a[3], tvec_b[3];
53
54 /* get 2 boundary edges, there should only _be_ 2,
55 * in case there are more - results won't be valid of course */
56 BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) {
57 if (BM_elem_flag_test(e_iter, BM_ELEM_TAG)) {
58 if (e_a == nullptr) {
59 e_a = e_iter;
60 }
61 else {
62 e_b = e_iter;
63 break;
64 }
65 }
66 }
67
68 if (e_a && e_b) {
69 /* NOTE: with an incorrectly flushed selection this can crash. */
70 l_a = bm_edge_tag_faceloop(e_a);
72
73 /* average edge face normal */
74 add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
75 normalize_v3(no_face);
76
77 /* average edge direction */
78 v_a = BM_edge_other_vert(e_a, v);
79 v_b = BM_edge_other_vert(e_b, v);
80
81 sub_v3_v3v3(tvec_a, v->co, v_a->co);
82 sub_v3_v3v3(tvec_b, v_b->co, v->co);
83 normalize_v3(tvec_a);
84 normalize_v3(tvec_b);
85 add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
86
87 /* check are we flipped the right way */
88 BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
89 BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
90 add_v3_v3(tvec_a, tvec_b);
91
92 *r_va_other = v_a;
93 *r_vb_other = v_b;
94 }
95 else {
96 /* degenerate case - vertex connects a boundary edged face to other faces,
97 * so we have only one boundary face - only use it for calculations */
98 l_a = bm_edge_tag_faceloop(e_a);
99
100 copy_v3_v3(no_face, l_a->f->no);
101
102 /* edge direction */
103 v_a = BM_edge_other_vert(e_a, v);
104 v_b = nullptr;
105
106 sub_v3_v3v3(no_edge, v->co, v_a->co);
107
108 /* check are we flipped the right way */
109 BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
110
111 *r_va_other = nullptr;
112 *r_vb_other = nullptr;
113 }
114
115 /* find the normal */
116 cross_v3_v3v3(r_no, no_edge, no_face);
117 normalize_v3(r_no);
118
119 if (dot_v3v3(r_no, tvec_a) > 0.0f) {
120 negate_v3(r_no);
121 }
122
123 copy_v3_v3(r_no_face, no_face);
124}
125
126/* check if we are the only tagged loop-face around this edge */
128{
129 BMLoop *l = l_first->radial_next;
130
131 if (l == l_first) {
132 return true; /* a real boundary */
133 }
134
135 do {
137 return false;
138 }
139 } while ((l = l->radial_next) != l_first);
140
141 return true;
142}
143
145 const float offset,
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,
157 const int mat_max,
158 /* for operators */
159 const bool use_tag)
160{
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;
165 int cd_edge_crease_offset = use_crease ? CustomData_get_offset_named(
166 &bm->edata, CD_PROP_FLOAT, "crease_edge") :
167 -1;
168 const int cd_dvert_offset = (defgrp_index != -1) ?
170 -1;
171 const float offset_fac_vg_inv = 1.0f - offset_fac_vg;
172
173 const int totvert_orig = bm->totvert;
174
175 BMIter iter;
176 BMIter itersub;
177
178 /* filled only with boundary verts */
179 BMVert **verts_src = static_cast<BMVert **>(
180 MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__));
181 BMVert **verts_neg = static_cast<BMVert **>(
182 MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__));
183 BMVert **verts_pos = static_cast<BMVert **>(
184 MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__));
185
186 /* Will over-allocate, but makes for easy lookups by index to keep aligned. */
187 BMVert **verts_boundary = static_cast<BMVert **>(
188 use_boundary ? MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__) : nullptr);
189
190 float *verts_relfac = static_cast<float *>(
191 (use_relative_offset || (cd_dvert_offset != -1)) ?
192 MEM_mallocN(sizeof(float) * totvert_orig, __func__) :
193 nullptr);
194
195 /* May over-allocate if not all faces have wire. */
196 BMVert **verts_loop;
197 int verts_loop_tot = 0;
198
199 BMVert *v_src;
200
201 BMFace *f_src;
202 BMLoop *l;
203
204 float tvec[3];
205 float fac, fac_shell;
206
207 int i;
208
209 if (use_crease && cd_edge_crease_offset == -1) {
210 BM_data_layer_add_named(bm, &bm->edata, CD_PROP_FLOAT, "crease_edge");
211 cd_edge_crease_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "crease_edge");
212 }
213
214 BM_ITER_MESH_INDEX (v_src, &iter, bm, BM_VERTS_OF_MESH, i) {
215 BM_elem_index_set(v_src, i); /* set_inline */
216
217 verts_src[i] = v_src;
219 }
220 bm->elem_index_dirty &= ~BM_VERT;
221
222 /* setup tags, all faces and verts will be tagged which will be duplicated */
223
224 BM_ITER_MESH_INDEX (f_src, &iter, bm, BM_FACES_OF_MESH, i) {
225 BM_elem_index_set(f_src, i); /* set_inline */
226
227 if (use_tag) {
228 if (!BM_elem_flag_test(f_src, BM_ELEM_TAG)) {
229 continue;
230 }
231 }
232 else {
234 }
235
236 verts_loop_tot += f_src->len;
237 BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
239
240 /* also tag boundary edges */
242 }
243 }
244 bm->elem_index_dirty &= ~BM_FACE;
245
246 /* duplicate tagged verts */
247 for (i = 0; i < totvert_orig; i++) {
248 v_src = verts_src[i];
249 if (BM_elem_flag_test(v_src, BM_ELEM_TAG)) {
250 fac = 1.0f;
251
252 if (verts_relfac) {
253 if (use_relative_offset) {
254 verts_relfac[i] = BM_vert_calc_median_tagged_edge_length(v_src);
255 }
256 else {
257 verts_relfac[i] = 1.0f;
258 }
259
260 if (cd_dvert_offset != -1) {
261 MDeformVert *dvert = static_cast<MDeformVert *>(
262 BM_ELEM_CD_GET_VOID_P(v_src, cd_dvert_offset));
263 float defgrp_fac = BKE_defvert_find_weight(dvert, defgrp_index);
264
265 if (defgrp_invert) {
266 defgrp_fac = 1.0f - defgrp_fac;
267 }
268
269 if (offset_fac_vg > 0.0f) {
270 defgrp_fac = (offset_fac_vg + (defgrp_fac * offset_fac_vg_inv));
271 }
272
273 verts_relfac[i] *= defgrp_fac;
274 }
275
276 fac *= verts_relfac[i];
277 }
278
279 verts_neg[i] = BM_vert_create(bm, nullptr, v_src, BM_CREATE_NOP);
280 verts_pos[i] = BM_vert_create(bm, nullptr, v_src, BM_CREATE_NOP);
281
282 if (offset == 0.0f) {
283 madd_v3_v3v3fl(verts_neg[i]->co, v_src->co, v_src->no, ofs_orig * fac);
284 madd_v3_v3v3fl(verts_pos[i]->co, v_src->co, v_src->no, ofs_new * fac);
285 }
286 else {
287 madd_v3_v3v3fl(tvec, v_src->co, v_src->no, ofs_mid * fac);
288
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);
291 }
292 }
293 else {
294 /* could skip this */
295 verts_neg[i] = nullptr;
296 verts_pos[i] = nullptr;
297 }
298
299 /* conflicts with BM_vert_calc_median_tagged_edge_length */
300 if (use_relative_offset == false) {
302 }
303 }
304
305 if (use_relative_offset) {
307 }
308
309 verts_loop = static_cast<BMVert **>(MEM_mallocN(sizeof(BMVert *) * verts_loop_tot, __func__));
310 verts_loop_tot = 0; /* count up again */
311
312 BM_ITER_MESH (f_src, &iter, bm, BM_FACES_OF_MESH) {
313
314 if (use_tag && !BM_elem_flag_test(f_src, BM_ELEM_TAG)) {
315 continue;
316 }
317
318 BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
319 /* Because some faces might be skipped! */
320 BM_elem_index_set(l, verts_loop_tot); /* set_dirty */
321
323
324 /* create offset vert */
325 fac = 1.0f;
326
327 if (verts_relfac) {
328 fac *= verts_relfac[BM_elem_index_get(l->v)];
329 }
330
331 fac_shell = fac;
332 if (use_even_offset) {
333 fac_shell *= shell_angle_to_dist((float(M_PI) - BM_loop_calc_face_angle(l)) * 0.5f);
334 }
335
336 madd_v3_v3v3fl(tvec, l->v->co, tvec, inset * fac_shell);
337 if (offset != 0.0f) {
338 madd_v3_v3fl(tvec, l->v->no, ofs_mid * fac);
339 }
340 verts_loop[verts_loop_tot] = BM_vert_create(bm, tvec, l->v, BM_CREATE_NOP);
341
342 if (use_boundary) {
343 if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) { /* is this a boundary? */
344 BMVert *v_pair[2] = {l->v, l->next->v};
345
346 for (i = 0; i < 2; i++) {
347 BMVert *v_boundary = v_pair[i];
348 if (!BM_elem_flag_test(v_boundary, BM_ELEM_TAG)) {
349 const int v_boundary_index = BM_elem_index_get(v_boundary);
350 float no_face[3];
351 BMVert *va_other;
352 BMVert *vb_other;
353
354 BM_elem_flag_enable(v_boundary, BM_ELEM_TAG);
355
356 bm_vert_boundary_tangent(v_boundary, tvec, no_face, &va_other, &vb_other);
357
358 /* create offset vert */
359 /* similar to code above but different angle calc */
360 fac = 1.0f;
361
362 if (verts_relfac) {
363 fac *= verts_relfac[v_boundary_index];
364 }
365
366 fac_shell = fac;
367 if (use_even_offset) {
368 if (va_other) { /* for verts with only one boundary edge - this will be nullptr */
369 fac_shell *= shell_angle_to_dist(
371 va_other->co, v_boundary->co, vb_other->co, no_face)) *
372 0.5f);
373 }
374 }
375
376 madd_v3_v3v3fl(tvec, v_boundary->co, tvec, inset * fac_shell);
377 if (offset != 0.0f) {
378 madd_v3_v3fl(tvec, v_boundary->no, ofs_mid * fac);
379 }
380 verts_boundary[v_boundary_index] = BM_vert_create(
381 bm, tvec, v_boundary, BM_CREATE_NOP);
382 }
383 }
384 }
385 }
386
387 verts_loop_tot++;
388 }
389 }
391
392 BM_ITER_MESH (f_src, &iter, bm, BM_FACES_OF_MESH) {
393
394 /* skip recently added faces */
395 if (BM_elem_index_get(f_src) == -1) {
396 continue;
397 }
398
399 if (use_tag && !BM_elem_flag_test(f_src, BM_ELEM_TAG)) {
400 continue;
401 }
402
404
405 BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
406 BMFace *f_new;
407 BMLoop *l_new;
408 BMLoop *l_next = l->next;
409 BMVert *v_l1 = verts_loop[BM_elem_index_get(l)];
410 BMVert *v_l2 = verts_loop[BM_elem_index_get(l_next)];
411
412 BMVert *v_src_l1 = l->v;
413 BMVert *v_src_l2 = l_next->v;
414
415 const int i_1 = BM_elem_index_get(v_src_l1);
416 const int i_2 = BM_elem_index_get(v_src_l2);
417
418 BMVert *v_neg1 = verts_neg[i_1];
419 BMVert *v_neg2 = verts_neg[i_2];
420
421 BMVert *v_pos1 = verts_pos[i_1];
422 BMVert *v_pos2 = verts_pos[i_2];
423
424 f_new = BM_face_create_quad_tri(bm, v_l1, v_l2, v_neg2, v_neg1, f_src, BM_CREATE_NOP);
425 if (mat_offset) {
426 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
427 }
429 l_new = BM_FACE_FIRST_LOOP(f_new);
430
431 BM_elem_attrs_copy(bm, l, l_new);
432 BM_elem_attrs_copy(bm, l, l_new->prev);
433 BM_elem_attrs_copy(bm, l_next, l_new->next);
434 BM_elem_attrs_copy(bm, l_next, l_new->next->next);
435
436 f_new = BM_face_create_quad_tri(bm, v_l2, v_l1, v_pos1, v_pos2, f_src, BM_CREATE_NOP);
437
438 if (mat_offset) {
439 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
440 }
442 l_new = BM_FACE_FIRST_LOOP(f_new);
443
444 BM_elem_attrs_copy(bm, l_next, l_new);
445 BM_elem_attrs_copy(bm, l_next, l_new->prev);
446 BM_elem_attrs_copy(bm, l, l_new->next);
447 BM_elem_attrs_copy(bm, l, l_new->next->next);
448
449 if (use_boundary) {
451 /* we know its a boundary and this is the only face user (which is being wire'd) */
452 /* we know we only touch this edge/face once */
453 BMVert *v_b1 = verts_boundary[i_1];
454 BMVert *v_b2 = verts_boundary[i_2];
455
456 f_new = BM_face_create_quad_tri(bm, v_b2, v_b1, v_neg1, v_neg2, f_src, BM_CREATE_NOP);
457 if (mat_offset) {
458 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
459 }
461 l_new = BM_FACE_FIRST_LOOP(f_new);
462
463 BM_elem_attrs_copy(bm, l_next, l_new);
464 BM_elem_attrs_copy(bm, l_next, l_new->prev);
465 BM_elem_attrs_copy(bm, l, l_new->next);
466 BM_elem_attrs_copy(bm, l, l_new->next->next);
467
468 f_new = BM_face_create_quad_tri(bm, v_b1, v_b2, v_pos2, v_pos1, f_src, BM_CREATE_NOP);
469 if (mat_offset) {
470 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
471 }
473 l_new = BM_FACE_FIRST_LOOP(f_new);
474
475 BM_elem_attrs_copy(bm, l, l_new);
476 BM_elem_attrs_copy(bm, l, l_new->prev);
477 BM_elem_attrs_copy(bm, l_next, l_new->next);
478 BM_elem_attrs_copy(bm, l_next, l_new->next->next);
479
480 if (use_crease) {
481 BMEdge *e_new;
482 e_new = BM_edge_exists(v_pos1, v_b1);
483 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
484
485 e_new = BM_edge_exists(v_pos2, v_b2);
486 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
487
488 e_new = BM_edge_exists(v_neg1, v_b1);
489 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
490
491 e_new = BM_edge_exists(v_neg2, v_b2);
492 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
493 }
494 }
495 }
496
497 if (use_crease) {
498 BMEdge *e_new;
499 e_new = BM_edge_exists(v_pos1, v_l1);
500 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
501
502 e_new = BM_edge_exists(v_pos2, v_l2);
503 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
504
505 e_new = BM_edge_exists(v_neg1, v_l1);
506 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
507
508 e_new = BM_edge_exists(v_neg2, v_l2);
509 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
510 }
511 }
512 }
513
514 if (use_boundary) {
515 MEM_freeN(verts_boundary);
516 }
517
518 if (verts_relfac) {
519 MEM_freeN(verts_relfac);
520 }
521
522 if (use_replace) {
523
524 if (use_tag) {
525/* only remove faces which are original and used to make wire,
526 * use 'verts_pos' and 'verts_neg' to avoid a feedback loop. */
527
528/* vertex must be from 'verts_src' */
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) \
532 { \
533 verts_pos[BM_elem_index_get(v)] = nullptr; \
534 } \
535 (void)0
536
537 /* first ensure we keep all verts which are used in faces that weren't
538 * entirely made into wire. */
539 BM_ITER_MESH (f_src, &iter, bm, BM_FACES_OF_MESH) {
540 int mix_flag = 0;
541 BMLoop *l_iter, *l_first;
542
543 /* skip new faces */
544 if (BM_elem_index_get(f_src) == -1) {
545 continue;
546 }
547
548 l_iter = l_first = BM_FACE_FIRST_LOOP(f_src);
549 do {
550 mix_flag |= (VERT_DUPE_TEST_ORIG(l_iter->v) ? 1 : 2);
551 if (mix_flag == (1 | 2)) {
552 break;
553 }
554 } while ((l_iter = l_iter->next) != l_first);
555
556 if (mix_flag == (1 | 2)) {
557 l_iter = l_first = BM_FACE_FIRST_LOOP(f_src);
558 do {
559 VERT_DUPE_CLEAR(l_iter->v);
560 } while ((l_iter = l_iter->next) != l_first);
561 }
562 }
563
564 /* now remove any verts which were made into wire by all faces */
565 for (i = 0; i < totvert_orig; i++) {
566 v_src = verts_src[i];
567 BLI_assert(i == BM_elem_index_get(v_src));
568 if (VERT_DUPE_TEST(v_src)) {
569 BM_vert_kill(bm, v_src);
570 }
571 }
572
573#undef VERT_DUPE_TEST_ORIG
574#undef VERT_DUPE_TEST
575#undef VERT_DUPE_CLEAR
576 }
577 else {
578 /* simple case, no tags - replace all */
579 for (i = 0; i < totvert_orig; i++) {
580 BM_vert_kill(bm, verts_src[i]);
581 }
582 }
583 }
584
585 MEM_freeN(verts_src);
586 MEM_freeN(verts_neg);
587 MEM_freeN(verts_pos);
588 MEM_freeN(verts_loop);
589}
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)
support for deformation groups and hooks.
float BKE_defvert_find_weight(const MDeformVert *dvert, int defgroup)
Definition deform.cc:770
#define BLI_assert(a)
Definition BLI_assert.h:50
#define M_PI
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])
@ CD_PROP_FLOAT
@ CD_MDEFORMVERT
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f)
@ BM_LOOP
@ BM_ELEM_TAG
#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.
Definition bmesh_core.cc:43
@ BM_CREATE_NOP
Definition bmesh_core.hh:24
#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)
@ BM_VERTS_OF_MESH
@ BM_FACES_OF_MESH
@ BM_EDGES_OF_VERT
@ BM_LOOPS_OF_FACE
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
#define BM_VERT
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)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
short mat_nr
float no[3]
struct BMVert * v
struct BMEdge * e
struct BMLoop * radial_next
struct BMLoop * prev
struct BMFace * f
struct BMLoop * next
float co[3]
float no[3]
int totvert
char elem_index_dirty
CustomData vdata
CustomData edata