Blender  V3.3
extract_mesh_ibo_edituv.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2021 Blender Foundation. All rights reserved. */
3 
8 #include "BLI_bitmap.h"
9 
10 #include "extract_mesh.hh"
11 
12 #include "draw_subdivision.h"
13 
14 namespace blender::draw {
15 /* ---------------------------------------------------------------------- */
22 };
23 
25  MeshBatchCache *UNUSED(cache),
26  void *UNUSED(ibo),
27  void *tls_data)
28 {
31  data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
32 }
33 
35  MeshExtract_EditUvElem_Data *data, bool hidden, bool selected, int v1, int v2, int v3)
36 {
37  if (!hidden && (data->sync_selection || selected)) {
38  GPU_indexbuf_add_tri_verts(&data->elb, v1, v2, v3);
39  }
40 }
41 
43  BMLoop **elt,
44  const int UNUSED(elt_index),
45  void *_data)
46 {
51  BM_elem_index_get(elt[0]),
52  BM_elem_index_get(elt[1]),
53  BM_elem_index_get(elt[2]));
54 }
55 
57  const MLoopTri *mlt,
58  const int UNUSED(elt_index),
59  void *_data)
60 {
62  const BMFace *efa = bm_original_face_get(mr, mlt->poly);
63  const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
64  const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
65 
66  edituv_tri_add(data, mp_hidden, mp_select, mlt->tri[0], mlt->tri[1], mlt->tri[2]);
67 }
68 
70  MeshBatchCache *UNUSED(cache),
71  void *buf,
72  void *_data)
73 {
75  GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
77 }
78 
79 static void extract_edituv_tris_init_subdiv(const DRWSubdivCache *subdiv_cache,
80  const MeshRenderData *mr,
81  MeshBatchCache *UNUSED(cache),
82  void *UNUSED(buf),
83  void *tls_data)
84 {
86  GPU_indexbuf_init(&data->elb,
88  subdiv_cache->num_subdiv_triangles,
89  subdiv_cache->num_subdiv_loops);
90  data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
91 }
92 
93 static void extract_edituv_tris_iter_subdiv_bm(const DRWSubdivCache *UNUSED(subdiv_cache),
94  const MeshRenderData *UNUSED(mr),
95  void *_data,
96  uint subdiv_quad_index,
97  const BMFace *coarse_quad)
98 {
100  const uint loop_idx = subdiv_quad_index * 4;
101 
103  BM_elem_flag_test(coarse_quad, BM_ELEM_HIDDEN) != 0,
104  BM_elem_flag_test(coarse_quad, BM_ELEM_SELECT) != 0,
105  loop_idx,
106  loop_idx + 1,
107  loop_idx + 2);
108 
110  BM_elem_flag_test(coarse_quad, BM_ELEM_HIDDEN) != 0,
111  BM_elem_flag_test(coarse_quad, BM_ELEM_SELECT) != 0,
112  loop_idx,
113  loop_idx + 2,
114  loop_idx + 3);
115 }
116 
118  const MeshRenderData *mr,
119  void *_data,
120  uint subdiv_quad_index,
121  const MPoly *coarse_quad)
122 {
124  const uint loop_idx = subdiv_quad_index * 4;
125 
126  const BMFace *efa = bm_original_face_get(mr, coarse_quad - mr->mpoly);
127  const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
128  const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
129 
130  edituv_tri_add(data, mp_hidden, mp_select, loop_idx, loop_idx + 1, loop_idx + 2);
131  edituv_tri_add(data, mp_hidden, mp_select, loop_idx, loop_idx + 2, loop_idx + 3);
132 }
133 
134 static void extract_edituv_tris_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
135  const MeshRenderData *UNUSED(mr),
136  MeshBatchCache *UNUSED(cache),
137  void *buf,
138  void *_data)
139 {
141  GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
142  GPU_indexbuf_build_in_place(&data->elb, ibo);
143 }
144 
146 {
147  MeshExtract extractor = {nullptr};
148  extractor.init = extract_edituv_tris_init;
156  extractor.data_type = MR_DATA_NONE;
157  extractor.data_size = sizeof(MeshExtract_EditUvElem_Data);
158  extractor.use_threading = false;
159  extractor.mesh_buffer_offset = offsetof(MeshBufferList, ibo.edituv_tris);
160  return extractor;
161 }
162 
165 /* ---------------------------------------------------------------------- */
170  MeshBatchCache *UNUSED(cache),
171  void *UNUSED(ibo),
172  void *tls_data)
173 {
176  data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
177 }
178 
180  MeshExtract_EditUvElem_Data *data, bool hidden, bool selected, int v1, int v2)
181 {
182  if (!hidden && (data->sync_selection || selected)) {
184  }
185 }
186 
188  const BMFace *f,
189  const int UNUSED(f_index),
190  void *_data)
191 {
193  BMLoop *l_iter, *l_first;
194  l_iter = l_first = BM_FACE_FIRST_LOOP(f);
195  do {
196  const int l_index = BM_elem_index_get(l_iter);
197 
201  l_index,
202  BM_elem_index_get(l_iter->next));
203  } while ((l_iter = l_iter->next) != l_first);
204 }
205 
207  const MPoly *mp,
208  const int mp_index,
209  void *_data)
210 {
212  const MLoop *mloop = mr->mloop;
213  const int ml_index_end = mp->loopstart + mp->totloop;
214 
215  bool mp_hidden, mp_select;
216  if (mr->bm) {
217  const BMFace *efa = bm_original_face_get(mr, mp_index);
218  mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
219  mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
220  }
221  else {
222  mp_hidden = (mp->flag & ME_HIDE) != 0;
223  mp_select = (mp->flag & ME_FACE_SEL) != 0;
224  }
225 
226  for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
227  const MLoop *ml = &mloop[ml_index];
228 
229  const int ml_index_last = mp->totloop + mp->loopstart - 1;
230  const int ml_index_next = (ml_index == ml_index_last) ? mp->loopstart : (ml_index + 1);
231  const bool real_edge = (mr->e_origindex == nullptr ||
232  mr->e_origindex[ml->e] != ORIGINDEX_NONE);
233  edituv_edge_add(data, mp_hidden || !real_edge, mp_select, ml_index, ml_index_next);
234  }
235 }
236 
238  MeshBatchCache *UNUSED(cache),
239  void *buf,
240  void *_data)
241 {
243  GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
244  GPU_indexbuf_build_in_place(&data->elb, ibo);
245 }
246 
247 static void extract_edituv_lines_init_subdiv(const DRWSubdivCache *subdiv_cache,
248  const MeshRenderData *mr,
249  MeshBatchCache *UNUSED(cache),
250  void *UNUSED(buf),
251  void *tls_data)
252 {
255  &data->elb, GPU_PRIM_LINES, subdiv_cache->num_subdiv_loops, subdiv_cache->num_subdiv_loops);
256  data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
257 }
258 
259 static void extract_edituv_lines_iter_subdiv_bm(const DRWSubdivCache *subdiv_cache,
260  const MeshRenderData *mr,
261  void *_data,
262  uint subdiv_quad_index,
263  const BMFace *coarse_poly)
264 {
266  int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index);
267 
268  const bool mp_hidden = BM_elem_flag_test_bool(coarse_poly, BM_ELEM_HIDDEN);
269  const bool mp_select = BM_elem_flag_test_bool(coarse_poly, BM_ELEM_SELECT);
270 
271  uint start_loop_idx = subdiv_quad_index * 4;
272  uint end_loop_idx = (subdiv_quad_index + 1) * 4;
273  for (uint loop_idx = start_loop_idx; loop_idx < end_loop_idx; loop_idx++) {
274  const int edge_origindex = subdiv_loop_edge_index[loop_idx];
275  const bool real_edge = (edge_origindex != -1 &&
276  (mr->e_origindex == nullptr ||
277  mr->e_origindex[edge_origindex] != ORIGINDEX_NONE));
279  mp_hidden || !real_edge,
280  mp_select,
281  loop_idx,
282  (loop_idx + 1 == end_loop_idx) ? start_loop_idx : (loop_idx + 1));
283  }
284 }
285 
287  const MeshRenderData *mr,
288  void *_data,
289  uint subdiv_quad_index,
290  const MPoly *coarse_poly)
291 {
293  int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index);
294 
295  bool mp_hidden, mp_select;
296  if (mr->bm) {
297  const BMFace *efa = bm_original_face_get(mr, coarse_poly - mr->mpoly);
298  mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
299  mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
300  }
301  else {
302  mp_hidden = (coarse_poly->flag & ME_HIDE) != 0;
303  mp_select = (coarse_poly->flag & ME_FACE_SEL) != 0;
304  }
305 
306  uint start_loop_idx = subdiv_quad_index * 4;
307  uint end_loop_idx = (subdiv_quad_index + 1) * 4;
308  for (uint loop_idx = start_loop_idx; loop_idx < end_loop_idx; loop_idx++) {
309  const int edge_origindex = subdiv_loop_edge_index[loop_idx];
310  const bool real_edge = (edge_origindex != -1 &&
311  (mr->e_origindex == nullptr ||
312  mr->e_origindex[edge_origindex] != ORIGINDEX_NONE));
314  mp_hidden || !real_edge,
315  mp_select,
316  loop_idx,
317  (loop_idx + 1 == end_loop_idx) ? start_loop_idx : (loop_idx + 1));
318  }
319 }
320 
321 static void extract_edituv_lines_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
322  const MeshRenderData *UNUSED(mr),
323  MeshBatchCache *UNUSED(cache),
324  void *buf,
325  void *_data)
326 {
328  GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
329  GPU_indexbuf_build_in_place(&data->elb, ibo);
330 }
331 
333 {
334  MeshExtract extractor = {nullptr};
335  extractor.init = extract_edituv_lines_init;
343  extractor.data_type = MR_DATA_NONE;
344  extractor.data_size = sizeof(MeshExtract_EditUvElem_Data);
345  extractor.use_threading = false;
346  extractor.mesh_buffer_offset = offsetof(MeshBufferList, ibo.edituv_lines);
347  return extractor;
348 }
349 
352 /* ---------------------------------------------------------------------- */
357  MeshBatchCache *UNUSED(cache),
358  void *UNUSED(ibo),
359  void *tls_data)
360 {
363  data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
364 }
365 
367  bool hidden,
368  bool selected,
369  int v1)
370 {
371  if (!hidden && (data->sync_selection || selected)) {
373  }
374 }
375 
377  const BMFace *f,
378  const int UNUSED(f_index),
379  void *_data)
380 {
382  BMLoop *l_iter, *l_first;
383  l_iter = l_first = BM_FACE_FIRST_LOOP(f);
384  do {
385  const int l_index = BM_elem_index_get(l_iter);
386 
389  } while ((l_iter = l_iter->next) != l_first);
390 }
391 
393  const MPoly *mp,
394  const int mp_index,
395  void *_data)
396 {
398 
399  const BMFace *efa = bm_original_face_get(mr, mp_index);
400  const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
401  const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
402 
403  const MLoop *mloop = mr->mloop;
404  const int ml_index_end = mp->loopstart + mp->totloop;
405  for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
406  const MLoop *ml = &mloop[ml_index];
407 
408  const bool real_vert = !mr->v_origindex || mr->v_origindex[ml->v] != ORIGINDEX_NONE;
409  edituv_point_add(data, mp_hidden || !real_vert, mp_select, ml_index);
410  }
411 }
412 
414  MeshBatchCache *UNUSED(cache),
415  void *buf,
416  void *_data)
417 {
419  GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
420  GPU_indexbuf_build_in_place(&data->elb, ibo);
421 }
422 
423 static void extract_edituv_points_init_subdiv(const DRWSubdivCache *subdiv_cache,
424  const MeshRenderData *mr,
425  MeshBatchCache *UNUSED(cache),
426  void *UNUSED(buf),
427  void *tls_data)
428 {
431  &data->elb, GPU_PRIM_POINTS, subdiv_cache->num_subdiv_loops, subdiv_cache->num_subdiv_loops);
432  data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
433 }
434 
435 static void extract_edituv_points_iter_subdiv_bm(const DRWSubdivCache *subdiv_cache,
436  const MeshRenderData *UNUSED(mr),
437  void *_data,
438  uint subdiv_quad_index,
439  const BMFace *coarse_quad)
440 {
442  int *subdiv_loop_vert_index = (int *)GPU_vertbuf_get_data(subdiv_cache->verts_orig_index);
443 
444  uint start_loop_idx = subdiv_quad_index * 4;
445  uint end_loop_idx = (subdiv_quad_index + 1) * 4;
446  for (uint i = start_loop_idx; i < end_loop_idx; i++) {
447  const int vert_origindex = subdiv_loop_vert_index[i];
449  (BM_elem_flag_test(coarse_quad, BM_ELEM_HIDDEN) || vert_origindex == -1),
450  BM_elem_flag_test(coarse_quad, BM_ELEM_SELECT) != 0,
451  i);
452  }
453 }
454 
456  const MeshRenderData *mr,
457  void *_data,
458  uint subdiv_quad_index,
459  const MPoly *coarse_quad)
460 {
462  int *subdiv_loop_vert_index = (int *)GPU_vertbuf_get_data(subdiv_cache->verts_orig_index);
463 
464  const BMFace *efa = bm_original_face_get(mr, coarse_quad - mr->mpoly);
465  const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
466  const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
467 
468  uint start_loop_idx = subdiv_quad_index * 4;
469  uint end_loop_idx = (subdiv_quad_index + 1) * 4;
470  for (uint i = start_loop_idx; i < end_loop_idx; i++) {
471  const int vert_origindex = subdiv_loop_vert_index[i];
472  const bool real_vert = !mr->v_origindex || (vert_origindex != -1 &&
473  mr->v_origindex[vert_origindex] != ORIGINDEX_NONE);
474  edituv_point_add(data, mp_hidden || !real_vert, mp_select, i);
475  }
476 }
477 
478 static void extract_edituv_points_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
479  const MeshRenderData *UNUSED(mr),
480  MeshBatchCache *UNUSED(cache),
481  void *buf,
482  void *_data)
483 {
485  GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
486  GPU_indexbuf_build_in_place(&data->elb, ibo);
487 }
488 
490 {
491  MeshExtract extractor = {nullptr};
492  extractor.init = extract_edituv_points_init;
500  extractor.data_type = MR_DATA_NONE;
501  extractor.data_size = sizeof(MeshExtract_EditUvElem_Data);
502  extractor.use_threading = false;
503  extractor.mesh_buffer_offset = offsetof(MeshBufferList, ibo.edituv_points);
504  return extractor;
505 }
506 
509 /* ---------------------------------------------------------------------- */
514  MeshBatchCache *UNUSED(cache),
515  void *UNUSED(ibo),
516  void *tls_data)
517 {
520  data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
521 }
522 
524  bool hidden,
525  bool selected,
526  int face_index)
527 {
528  if (!hidden && (data->sync_selection || selected)) {
529  GPU_indexbuf_set_point_vert(&data->elb, face_index, face_index);
530  }
531  else {
532  GPU_indexbuf_set_point_restart(&data->elb, face_index);
533  }
534 }
535 
537  const BMFace *f,
538  const int f_index,
539  void *_data)
540 {
545  f_index);
546 }
547 
549  const MPoly *mp,
550  const int mp_index,
551  void *_data)
552 {
554  const BMFace *efa = bm_original_face_get(mr, mp_index);
555  const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
556  const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
557 
558  if (mr->use_subsurf_fdots) {
559  const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
560 
561  const MLoop *mloop = mr->mloop;
562  const int ml_index_end = mp->loopstart + mp->totloop;
563  for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
564  const MLoop *ml = &mloop[ml_index];
565 
566  const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE);
567  const bool subd_fdot = BLI_BITMAP_TEST(facedot_tags, ml->v);
568  edituv_facedot_add(data, mp_hidden || !real_fdot || !subd_fdot, mp_select, mp_index);
569  }
570  }
571  else {
572  const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE);
573  edituv_facedot_add(data, mp_hidden || !real_fdot, mp_select, mp_index);
574  }
575 }
576 
578  MeshBatchCache *UNUSED(cache),
579  void *buf,
580  void *_data)
581 {
583  GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf);
584  GPU_indexbuf_build_in_place(&data->elb, ibo);
585 }
586 
588 {
589  MeshExtract extractor = {nullptr};
590  extractor.init = extract_edituv_fdots_init;
594  extractor.data_type = MR_DATA_NONE;
595  extractor.data_size = sizeof(MeshExtract_EditUvElem_Data);
596  extractor.use_threading = false;
597  extractor.mesh_buffer_offset = offsetof(MeshBufferList, ibo.edituv_fdots);
598  return extractor;
599 }
600 
603 } // namespace blender::draw
604 
#define ORIGINDEX_NONE
#define BLI_BITMAP_TEST(_bitmap, _index)
Definition: BLI_bitmap.h:64
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:16
#define BLI_INLINE
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNUSED(x)
@ ME_HIDE
@ ME_FACE_SEL
#define UV_SYNC_SELECTION
struct GPUIndexBuf GPUIndexBuf
void GPU_indexbuf_set_point_vert(GPUIndexBufBuilder *builder, uint elem, uint v1)
void GPU_indexbuf_set_point_restart(GPUIndexBufBuilder *builder, uint elem)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
void GPU_indexbuf_add_point_vert(GPUIndexBufBuilder *, uint v)
void GPU_indexbuf_add_line_verts(GPUIndexBufBuilder *, uint v1, uint v2)
void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, GPUIndexBuf *)
void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3)
_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
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_PRIM_POINTS
Definition: GPU_primitive.h:19
@ GPU_PRIM_TRIS
Definition: GPU_primitive.h:21
void * GPU_vertbuf_get_data(const GPUVertBuf *verts)
#define BM_FACE_FIRST_LOOP(p)
Definition: bmesh_class.h:622
@ BM_ELEM_HIDDEN
Definition: bmesh_class.h:472
@ BM_ELEM_SELECT
Definition: bmesh_class.h:471
#define BM_elem_index_get(ele)
Definition: bmesh_inline.h:110
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:12
#define BM_elem_flag_test_bool(ele, hflag)
Definition: bmesh_inline.h:13
ATTR_WARN_UNUSED_RESULT const BMVert * v2
@ MR_DATA_NONE
Extraction of Mesh data into VBO to feed to GPU.
BLI_INLINE BMFace * bm_original_face_get(const MeshRenderData *mr, int idx)
const MeshExtract extract_edituv_fdots
const MeshExtract extract_edituv_points
const MeshExtract extract_edituv_tris
const MeshExtract extract_edituv_lines
static void extract_edituv_points_iter_poly_mesh(const MeshRenderData *mr, const MPoly *mp, const int mp_index, void *_data)
BLI_INLINE void edituv_facedot_add(MeshExtract_EditUvElem_Data *data, bool hidden, bool selected, int face_index)
static void extract_edituv_points_iter_poly_bm(const MeshRenderData *UNUSED(mr), const BMFace *f, const int UNUSED(f_index), void *_data)
static void extract_edituv_fdots_init(const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *UNUSED(ibo), void *tls_data)
static void extract_edituv_lines_init_subdiv(const DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *UNUSED(buf), void *tls_data)
constexpr MeshExtract create_extractor_edituv_fdots()
static void extract_edituv_fdots_finish(const MeshRenderData *UNUSED(mr), MeshBatchCache *UNUSED(cache), void *buf, void *_data)
static void extract_edituv_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, void *_data, uint subdiv_quad_index, const MPoly *coarse_quad)
BLI_INLINE void edituv_point_add(MeshExtract_EditUvElem_Data *data, bool hidden, bool selected, int v1)
static void extract_edituv_points_init_subdiv(const DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *UNUSED(buf), void *tls_data)
static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, void *_data, uint subdiv_quad_index, const MPoly *coarse_poly)
static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr, const MPoly *mp, const int mp_index, void *_data)
constexpr MeshExtract create_extractor_edituv_tris()
static void extract_edituv_lines_finish(const MeshRenderData *UNUSED(mr), MeshBatchCache *UNUSED(cache), void *buf, void *_data)
static void extract_edituv_tris_init_subdiv(const DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *UNUSED(buf), void *tls_data)
constexpr MeshExtract create_extractor_edituv_lines()
static void extract_edituv_tris_init(const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *UNUSED(ibo), void *tls_data)
static void extract_edituv_tris_iter_subdiv_mesh(const DRWSubdivCache *UNUSED(subdiv_cache), const MeshRenderData *mr, void *_data, uint subdiv_quad_index, const MPoly *coarse_quad)
static void extract_edituv_tris_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache), const MeshRenderData *UNUSED(mr), MeshBatchCache *UNUSED(cache), void *buf, void *_data)
static void extract_edituv_points_iter_subdiv_bm(const DRWSubdivCache *subdiv_cache, const MeshRenderData *UNUSED(mr), void *_data, uint subdiv_quad_index, const BMFace *coarse_quad)
static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr, const MPoly *mp, const int mp_index, void *_data)
BLI_INLINE void edituv_tri_add(MeshExtract_EditUvElem_Data *data, bool hidden, bool selected, int v1, int v2, int v3)
static void extract_edituv_tris_iter_looptri_bm(const MeshRenderData *UNUSED(mr), BMLoop **elt, const int UNUSED(elt_index), void *_data)
static void extract_edituv_lines_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache), const MeshRenderData *UNUSED(mr), MeshBatchCache *UNUSED(cache), void *buf, void *_data)
static void extract_edituv_points_init(const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *UNUSED(ibo), void *tls_data)
static void extract_edituv_fdots_iter_poly_bm(const MeshRenderData *UNUSED(mr), const BMFace *f, const int f_index, void *_data)
static void extract_edituv_lines_init(const MeshRenderData *mr, MeshBatchCache *UNUSED(cache), void *UNUSED(ibo), void *tls_data)
BLI_INLINE void edituv_edge_add(MeshExtract_EditUvElem_Data *data, bool hidden, bool selected, int v1, int v2)
static void extract_edituv_tris_iter_looptri_mesh(const MeshRenderData *mr, const MLoopTri *mlt, const int UNUSED(elt_index), void *_data)
static void extract_edituv_points_finish(const MeshRenderData *UNUSED(mr), MeshBatchCache *UNUSED(cache), void *buf, void *_data)
static void extract_edituv_lines_iter_subdiv_bm(const DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, void *_data, uint subdiv_quad_index, const BMFace *coarse_poly)
static void extract_edituv_tris_finish(const MeshRenderData *UNUSED(mr), MeshBatchCache *UNUSED(cache), void *buf, void *_data)
constexpr MeshExtract create_extractor_edituv_points()
static void extract_edituv_lines_iter_poly_bm(const MeshRenderData *UNUSED(mr), const BMFace *f, const int UNUSED(f_index), void *_data)
static void extract_edituv_tris_iter_subdiv_bm(const DRWSubdivCache *UNUSED(subdiv_cache), const MeshRenderData *UNUSED(mr), void *_data, uint subdiv_quad_index, const BMFace *coarse_quad)
static void extract_edituv_points_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache), const MeshRenderData *UNUSED(mr), MeshBatchCache *UNUSED(cache), void *buf, void *_data)
struct BMLoop * next
Definition: bmesh_class.h:233
struct GPUVertBuf * edges_orig_index
struct GPUVertBuf * verts_orig_index
unsigned int poly
unsigned int tri[3]
unsigned int e
unsigned int v
GPUIndexBuf * edituv_points
GPUIndexBuf * edituv_fdots
GPUIndexBuf * edituv_tris
GPUIndexBuf * edituv_lines
ExtractIterSubdivBMeshFn * iter_subdiv_bm
size_t mesh_buffer_offset
eMRDataType data_type
ExtractFinishFn * finish
ExtractIterSubdivMeshFn * iter_subdiv_mesh
ExtractInitSubdivFn * init_subdiv
size_t data_size
ExtractTriBMeshFn * iter_looptri_bm
ExtractPolyBMeshFn * iter_poly_bm
ExtractFinishSubdivFn * finish_subdiv
ExtractPolyMeshFn * iter_poly_mesh
ExtractTriMeshFn * iter_looptri_mesh
bool use_threading
ExtractInitFn * init
const MLoop * mloop
Definition: extract_mesh.hh:76
const int * v_origindex
Definition: extract_mesh.hh:66
bool use_subsurf_fdots
Definition: extract_mesh.hh:47
const ToolSettings * toolsettings
Definition: extract_mesh.hh:53
const MPoly * mpoly
Definition: extract_mesh.hh:77
const int * p_origindex
Definition: extract_mesh.hh:66
const int * e_origindex
Definition: extract_mesh.hh:66
uint32_t * subsurf_face_dot_tags
Mesh_Runtime runtime