Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw/intern/mesh_extractors')
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh.hh18
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc98
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc12
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc37
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc32
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc35
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc32
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc14
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc48
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc22
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc20
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_data.cc8
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc12
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_area.cc8
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_edituv_data.cc6
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_nor.cc16
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc12
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc12
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc16
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc22
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_orco.cc8
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc34
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc16
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_select_idx.cc48
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_skin_roots.cc4
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc10
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc8
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_weights.cc6
28 files changed, 330 insertions, 284 deletions
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh
index 10b94291e35..c6230e2695e 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh
@@ -16,6 +16,8 @@
#include "BKE_customdata.h"
#include "BKE_editmesh.h"
+#include "BKE_editmesh_cache.h"
+#include "BKE_mesh.h"
#include "draw_cache_extract.hh"
@@ -78,14 +80,17 @@ struct MeshRenderData {
BMEdge *eed_act;
BMFace *efa_act;
BMFace *efa_act_uv;
- /* Data created on-demand (usually not for #BMesh based data). */
- MLoopTri *mlooptri;
+ /* The triangulation of #Mesh polygons, owned by the mesh. */
+ const MLoopTri *mlooptri;
const int *material_indices;
const float (*vert_normals)[3];
const float (*poly_normals)[3];
const bool *hide_vert;
const bool *hide_edge;
const bool *hide_poly;
+ const bool *select_vert;
+ const bool *select_edge;
+ const bool *select_poly;
float (*loop_normals)[3];
int *lverts, *ledges;
@@ -113,7 +118,7 @@ BLI_INLINE const Mesh *editmesh_final_or_this(const Object *object, const Mesh *
BLI_INLINE const CustomData *mesh_cd_ldata_get_from_mesh(const Mesh *me)
{
- switch ((eMeshWrapperType)me->runtime.wrapper_type) {
+ switch (me->runtime->wrapper_type) {
case ME_WRAPPER_TYPE_SUBD:
case ME_WRAPPER_TYPE_MDATA:
return &me->ldata;
@@ -129,7 +134,7 @@ BLI_INLINE const CustomData *mesh_cd_ldata_get_from_mesh(const Mesh *me)
BLI_INLINE const CustomData *mesh_cd_pdata_get_from_mesh(const Mesh *me)
{
- switch ((eMeshWrapperType)me->runtime.wrapper_type) {
+ switch (me->runtime->wrapper_type) {
case ME_WRAPPER_TYPE_SUBD:
case ME_WRAPPER_TYPE_MDATA:
return &me->pdata;
@@ -145,7 +150,7 @@ BLI_INLINE const CustomData *mesh_cd_pdata_get_from_mesh(const Mesh *me)
BLI_INLINE const CustomData *mesh_cd_edata_get_from_mesh(const Mesh *me)
{
- switch ((eMeshWrapperType)me->runtime.wrapper_type) {
+ switch (me->runtime->wrapper_type) {
case ME_WRAPPER_TYPE_SUBD:
case ME_WRAPPER_TYPE_MDATA:
return &me->edata;
@@ -161,7 +166,7 @@ BLI_INLINE const CustomData *mesh_cd_edata_get_from_mesh(const Mesh *me)
BLI_INLINE const CustomData *mesh_cd_vdata_get_from_mesh(const Mesh *me)
{
- switch ((eMeshWrapperType)me->runtime.wrapper_type) {
+ switch (me->runtime->wrapper_type) {
case ME_WRAPPER_TYPE_SUBD:
case ME_WRAPPER_TYPE_MDATA:
return &me->vdata;
@@ -437,3 +442,4 @@ extern const MeshExtract extract_edge_idx;
extern const MeshExtract extract_vert_idx;
extern const MeshExtract extract_fdot_idx;
extern const MeshExtract extract_attr[GPU_MAX_ATTR];
+extern const MeshExtract extract_attr_viewer;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
index 2f2e59c8c3b..e40503a9707 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
@@ -22,8 +22,8 @@ struct MeshExtract_EditUvElem_Data {
};
static void extract_edituv_tris_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(ibo),
+ MeshBatchCache * /*cache*/,
+ void * /*ibo*/,
void *tls_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(tls_data);
@@ -39,9 +39,9 @@ BLI_INLINE void edituv_tri_add(
}
}
-static void extract_edituv_tris_iter_looptri_bm(const MeshRenderData *UNUSED(mr),
+static void extract_edituv_tris_iter_looptri_bm(const MeshRenderData * /*mr*/,
BMLoop **elt,
- const int UNUSED(elt_index),
+ const int /*elt_index*/,
void *_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
@@ -55,7 +55,7 @@ static void extract_edituv_tris_iter_looptri_bm(const MeshRenderData *UNUSED(mr)
static void extract_edituv_tris_iter_looptri_mesh(const MeshRenderData *mr,
const MLoopTri *mlt,
- const int UNUSED(elt_index),
+ const int /*elt_index*/,
void *_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
@@ -66,8 +66,8 @@ static void extract_edituv_tris_iter_looptri_mesh(const MeshRenderData *mr,
edituv_tri_add(data, mp_hidden, mp_select, mlt->tri[0], mlt->tri[1], mlt->tri[2]);
}
-static void extract_edituv_tris_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_edituv_tris_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -78,8 +78,8 @@ static void extract_edituv_tris_finish(const MeshRenderData *UNUSED(mr),
static void extract_edituv_tris_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(tls_data);
@@ -90,8 +90,8 @@ static void extract_edituv_tris_init_subdiv(const DRWSubdivCache *subdiv_cache,
data->sync_selection = (mr->toolsettings->uv_flag & UV_SYNC_SELECTION) != 0;
}
-static void extract_edituv_tris_iter_subdiv_bm(const DRWSubdivCache *UNUSED(subdiv_cache),
- const MeshRenderData *UNUSED(mr),
+static void extract_edituv_tris_iter_subdiv_bm(const DRWSubdivCache * /*subdiv_cache*/,
+ const MeshRenderData * /*mr*/,
void *_data,
uint subdiv_quad_index,
const BMFace *coarse_quad)
@@ -114,7 +114,7 @@ static void extract_edituv_tris_iter_subdiv_bm(const DRWSubdivCache *UNUSED(subd
loop_idx + 3);
}
-static void extract_edituv_tris_iter_subdiv_mesh(const DRWSubdivCache *UNUSED(subdiv_cache),
+static void extract_edituv_tris_iter_subdiv_mesh(const DRWSubdivCache * /*subdiv_cache*/,
const MeshRenderData *mr,
void *_data,
uint subdiv_quad_index,
@@ -131,9 +131,9 @@ static void extract_edituv_tris_iter_subdiv_mesh(const DRWSubdivCache *UNUSED(su
edituv_tri_add(data, mp_hidden, mp_select, loop_idx, loop_idx + 2, loop_idx + 3);
}
-static void extract_edituv_tris_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_edituv_tris_finish_subdiv(const struct DRWSubdivCache * /*subdiv_cache*/,
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -167,8 +167,8 @@ constexpr MeshExtract create_extractor_edituv_tris()
* \{ */
static void extract_edituv_lines_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(ibo),
+ MeshBatchCache * /*cache*/,
+ void * /*ibo*/,
void *tls_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(tls_data);
@@ -184,9 +184,9 @@ BLI_INLINE void edituv_edge_add(
}
}
-static void extract_edituv_lines_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_edituv_lines_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
@@ -220,7 +220,7 @@ static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr,
}
else {
mp_hidden = (mr->hide_poly) ? mr->hide_poly[mp_index] : false;
- mp_select = (mp->flag & ME_FACE_SEL) != 0;
+ mp_select = mr->select_poly && mr->select_poly[mp_index];
}
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
@@ -234,8 +234,8 @@ static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr,
}
}
-static void extract_edituv_lines_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_edituv_lines_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -246,8 +246,8 @@ static void extract_edituv_lines_finish(const MeshRenderData *UNUSED(mr),
static void extract_edituv_lines_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(tls_data);
@@ -291,16 +291,16 @@ static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_c
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index);
-
+ const int coarse_poly_index = coarse_poly - mr->mpoly;
bool mp_hidden, mp_select;
if (mr->bm) {
- const BMFace *efa = bm_original_face_get(mr, coarse_poly - mr->mpoly);
+ const BMFace *efa = bm_original_face_get(mr, coarse_poly_index);
mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true;
mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
}
else {
- mp_hidden = (mr->hide_poly) ? mr->hide_poly[coarse_poly - mr->mpoly] : false;
- mp_select = (coarse_poly->flag & ME_FACE_SEL) != 0;
+ mp_hidden = (mr->hide_poly) ? mr->hide_poly[coarse_poly_index] : false;
+ mp_select = mr->select_poly && mr->select_poly[coarse_poly_index];
}
uint start_loop_idx = subdiv_quad_index * 4;
@@ -318,9 +318,9 @@ static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_c
}
}
-static void extract_edituv_lines_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_edituv_lines_finish_subdiv(const struct DRWSubdivCache * /*subdiv_cache*/,
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -354,8 +354,8 @@ constexpr MeshExtract create_extractor_edituv_lines()
* \{ */
static void extract_edituv_points_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(ibo),
+ MeshBatchCache * /*cache*/,
+ void * /*ibo*/,
void *tls_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(tls_data);
@@ -373,9 +373,9 @@ BLI_INLINE void edituv_point_add(MeshExtract_EditUvElem_Data *data,
}
}
-static void extract_edituv_points_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_edituv_points_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data);
@@ -410,8 +410,8 @@ static void extract_edituv_points_iter_poly_mesh(const MeshRenderData *mr,
}
}
-static void extract_edituv_points_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_edituv_points_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -422,8 +422,8 @@ static void extract_edituv_points_finish(const MeshRenderData *UNUSED(mr),
static void extract_edituv_points_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(tls_data);
@@ -433,7 +433,7 @@ static void extract_edituv_points_init_subdiv(const DRWSubdivCache *subdiv_cache
}
static void extract_edituv_points_iter_subdiv_bm(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
void *_data,
uint subdiv_quad_index,
const BMFace *coarse_quad)
@@ -475,9 +475,9 @@ static void extract_edituv_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_
}
}
-static void extract_edituv_points_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache),
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_edituv_points_finish_subdiv(const struct DRWSubdivCache * /*subdiv_cache*/,
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -511,8 +511,8 @@ constexpr MeshExtract create_extractor_edituv_points()
* \{ */
static void extract_edituv_fdots_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(ibo),
+ MeshBatchCache * /*cache*/,
+ void * /*ibo*/,
void *tls_data)
{
MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(tls_data);
@@ -533,7 +533,7 @@ BLI_INLINE void edituv_facedot_add(MeshExtract_EditUvElem_Data *data,
}
}
-static void extract_edituv_fdots_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_edituv_fdots_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
const int f_index,
void *_data)
@@ -557,7 +557,7 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr,
const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false;
if (mr->use_subsurf_fdots) {
- const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+ const BLI_bitmap *facedot_tags = mr->me->runtime->subsurf_face_dot_tags;
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
@@ -575,8 +575,8 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr,
}
}
-static void extract_edituv_fdots_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_edituv_fdots_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
index 8dc00617039..1b552b01d6b 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
@@ -15,15 +15,15 @@ namespace blender::draw {
* \{ */
static void extract_fdots_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(tls_data);
GPU_indexbuf_init(elb, GPU_PRIM_POINTS, mr->poly_len, mr->poly_len);
}
-static void extract_fdots_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_fdots_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
const int f_index,
void *_userdata)
@@ -46,7 +46,7 @@ static void extract_fdots_iter_poly_mesh(const MeshRenderData *mr,
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_userdata);
if (mr->use_subsurf_fdots) {
- const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+ const BLI_bitmap *facedot_tags = mr->me->runtime->subsurf_face_dot_tags;
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
@@ -69,8 +69,8 @@ static void extract_fdots_iter_poly_mesh(const MeshRenderData *mr,
}
}
-static void extract_fdots_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_fdots_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_userdata)
{
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
index 9c564c2cdda..56e8baaca22 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
@@ -18,8 +18,8 @@ namespace blender::draw {
* \{ */
static void extract_lines_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(tls_data);
@@ -28,9 +28,9 @@ static void extract_lines_init(const MeshRenderData *mr,
elb, GPU_PRIM_LINES, mr->edge_len + mr->edge_loose_len, mr->loop_len + mr->loop_loose_len);
}
-static void extract_lines_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_lines_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data);
@@ -52,7 +52,7 @@ static void extract_lines_iter_poly_bm(const MeshRenderData *UNUSED(mr),
static void extract_lines_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data);
@@ -127,8 +127,8 @@ static void extract_lines_task_reduce(void *_userdata_to, void *_userdata_from)
GPU_indexbuf_join(elb_to, elb_from);
}
-static void extract_lines_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_lines_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *data)
{
@@ -138,10 +138,10 @@ static void extract_lines_finish(const MeshRenderData *UNUSED(mr),
}
static void extract_lines_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buffer);
@@ -158,7 +158,7 @@ static void extract_lines_init_subdiv(const DRWSubdivCache *subdiv_cache,
static void extract_lines_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
if (loose_geom.edge_len == 0) {
@@ -231,8 +231,7 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
}
GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buffer);
- draw_subdiv_build_lines_loose_buffer(
- subdiv_cache, ibo, flags, static_cast<uint>(loose_geom.edge_len));
+ draw_subdiv_build_lines_loose_buffer(subdiv_cache, ibo, flags, uint(loose_geom.edge_len));
GPU_vertbuf_discard(flags);
}
@@ -285,10 +284,10 @@ static void extract_lines_with_lines_loose_finish(const MeshRenderData *mr,
}
static void extract_lines_with_lines_loose_finish_subdiv(const struct DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
- void *UNUSED(buf),
- void *UNUSED(_data))
+ void * /*buf*/,
+ void * /*_data*/)
{
/* Multiply by 2 because these are edges indices. */
const int start = subdiv_cache->num_subdiv_loops * 2;
@@ -327,18 +326,18 @@ constexpr MeshExtract create_extractor_lines_with_lines_loose()
static void extract_lines_loose_only_init(const MeshRenderData *mr,
MeshBatchCache *cache,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
BLI_assert(buf == cache->final.buff.ibo.lines_loose);
UNUSED_VARS_NDEBUG(buf);
extract_lines_loose_subbuffer(mr, cache);
}
-static void extract_lines_loose_only_init_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache),
+static void extract_lines_loose_only_init_subdiv(const DRWSubdivCache * /*subdiv_cache*/,
const MeshRenderData *mr,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
BLI_assert(buffer == cache->final.buff.ibo.lines_loose);
UNUSED_VARS_NDEBUG(buffer);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
index d6c246c51a9..3124a35608d 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
@@ -42,8 +42,8 @@ static void line_adjacency_data_init(MeshExtract_LineAdjacency_Data *data,
}
static void extract_lines_adjacency_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
/* Similar to poly_to_tri_count().
@@ -71,7 +71,7 @@ BLI_INLINE void lines_adjacency_triangle(
if (!value_is_init || v_data == NO_EDGE) {
/* Save the winding order inside the sign bit. Because the
* Edge-hash sort the keys and we need to compare winding later. */
- int value = (int)l1 + 1; /* 0 cannot be signed so add one. */
+ int value = int(l1) + 1; /* 0 cannot be signed so add one. */
*pval = POINTER_FROM_INT((inv_indices) ? -value : value);
/* Store loop indices for remaining non-manifold edges. */
data->vert_to_loop[v2] = l2;
@@ -81,7 +81,7 @@ BLI_INLINE void lines_adjacency_triangle(
/* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */
*pval = POINTER_FROM_INT(NO_EDGE);
bool inv_opposite = (v_data < 0);
- uint l_opposite = (uint)abs(v_data) - 1;
+ uint l_opposite = uint(abs(v_data)) - 1;
/* TODO: Make this part thread-safe. */
if (inv_opposite == inv_indices) {
/* Don't share edge if triangles have non matching winding. */
@@ -96,9 +96,9 @@ BLI_INLINE void lines_adjacency_triangle(
}
}
-static void extract_lines_adjacency_iter_looptri_bm(const MeshRenderData *UNUSED(mr),
+static void extract_lines_adjacency_iter_looptri_bm(const MeshRenderData * /*mr*/,
BMLoop **elt,
- const int UNUSED(elt_index),
+ const int /*elt_index*/,
void *_data)
{
MeshExtract_LineAdjacency_Data *data = static_cast<MeshExtract_LineAdjacency_Data *>(_data);
@@ -115,7 +115,7 @@ static void extract_lines_adjacency_iter_looptri_bm(const MeshRenderData *UNUSED
static void extract_lines_adjacency_iter_looptri_mesh(const MeshRenderData *mr,
const MLoopTri *mlt,
- const int UNUSED(elt_index),
+ const int /*elt_index*/,
void *_data)
{
MeshExtract_LineAdjacency_Data *data = static_cast<MeshExtract_LineAdjacency_Data *>(_data);
@@ -132,7 +132,7 @@ static void extract_lines_adjacency_iter_looptri_mesh(const MeshRenderData *mr,
data);
}
-static void extract_lines_adjacency_finish(const MeshRenderData *UNUSED(mr),
+static void extract_lines_adjacency_finish(const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
void *buf,
void *_data)
@@ -146,7 +146,7 @@ static void extract_lines_adjacency_finish(const MeshRenderData *UNUSED(mr),
int v_data = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi));
if (v_data != NO_EDGE) {
BLI_edgehashIterator_getKey(ehi, &v2, &v3);
- l1 = (uint)abs(v_data) - 1;
+ l1 = uint(abs(v_data)) - 1;
if (v_data < 0) { /* `inv_opposite`. */
SWAP(uint, v2, v3);
}
@@ -166,9 +166,9 @@ static void extract_lines_adjacency_finish(const MeshRenderData *UNUSED(mr),
}
static void extract_lines_adjacency_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *_data)
{
MeshExtract_LineAdjacency_Data *data = static_cast<MeshExtract_LineAdjacency_Data *>(_data);
@@ -182,7 +182,7 @@ static void extract_lines_adjacency_init_subdiv(const DRWSubdivCache *subdiv_cac
}
static void extract_lines_adjacency_iter_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
void *_data,
uint subdiv_quad_index)
{
@@ -207,7 +207,7 @@ static void extract_lines_adjacency_iter_subdiv_bm(const DRWSubdivCache *subdiv_
const MeshRenderData *mr,
void *_data,
uint subdiv_quad_index,
- const BMFace *UNUSED(coarse_quad))
+ const BMFace * /*coarse_quad*/)
{
extract_lines_adjacency_iter_subdiv(subdiv_cache, mr, _data, subdiv_quad_index);
}
@@ -216,12 +216,12 @@ static void extract_lines_adjacency_iter_subdiv_mesh(const DRWSubdivCache *subdi
const MeshRenderData *mr,
void *_data,
uint subdiv_quad_index,
- const MPoly *UNUSED(coarse_quad))
+ const MPoly * /*coarse_quad*/)
{
extract_lines_adjacency_iter_subdiv(subdiv_cache, mr, _data, subdiv_quad_index);
}
-static void extract_lines_adjacency_finish_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache),
+static void extract_lines_adjacency_finish_subdiv(const DRWSubdivCache * /*subdiv_cache*/,
const MeshRenderData *mr,
MeshBatchCache *cache,
void *buf,
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
index 31e5c515129..572eb5b28f8 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
@@ -26,8 +26,8 @@ struct MeshExtract_LinePaintMask_Data {
};
static void extract_lines_paint_mask_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(ibo),
+ MeshBatchCache * /*cache*/,
+ void * /*ibo*/,
void *tls_data)
{
MeshExtract_LinePaintMask_Data *data = static_cast<MeshExtract_LinePaintMask_Data *>(tls_data);
@@ -37,7 +37,7 @@ static void extract_lines_paint_mask_init(const MeshRenderData *mr,
static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int mp_index,
void *_data)
{
MeshExtract_LinePaintMask_Data *data = static_cast<MeshExtract_LinePaintMask_Data *>(_data);
@@ -52,7 +52,7 @@ static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr,
const int ml_index_last = mp->totloop + mp->loopstart - 1;
const int ml_index_other = (ml_index == ml_index_last) ? mp->loopstart : (ml_index + 1);
- if (mp->flag & ME_FACE_SEL) {
+ if (mr->select_poly && mr->select_poly[mp_index]) {
if (BLI_BITMAP_TEST_AND_SET_ATOMIC(data->select_map, e_index)) {
/* Hide edge as it has more than 2 selected loop. */
GPU_indexbuf_set_line_restart(&data->elb, e_index);
@@ -75,8 +75,8 @@ static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr,
}
}
-static void extract_lines_paint_mask_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_lines_paint_mask_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -88,8 +88,8 @@ static void extract_lines_paint_mask_finish(const MeshRenderData *UNUSED(mr),
static void extract_lines_paint_mask_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
MeshExtract_LinePaintMask_Data *data = static_cast<MeshExtract_LinePaintMask_Data *>(tls_data);
@@ -110,11 +110,13 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd
int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index);
int *subdiv_loop_subdiv_edge_index = subdiv_cache->subdiv_loop_subdiv_edge_index;
+ const int coarse_quad_index = coarse_quad - mr->mpoly;
+
uint start_loop_idx = subdiv_quad_index * 4;
uint end_loop_idx = (subdiv_quad_index + 1) * 4;
for (uint loop_idx = start_loop_idx; loop_idx < end_loop_idx; loop_idx++) {
- const uint coarse_edge_index = (uint)subdiv_loop_edge_index[loop_idx];
- const uint subdiv_edge_index = (uint)subdiv_loop_subdiv_edge_index[loop_idx];
+ const uint coarse_edge_index = uint(subdiv_loop_edge_index[loop_idx]);
+ const uint subdiv_edge_index = uint(subdiv_loop_subdiv_edge_index[loop_idx]);
if (coarse_edge_index == -1u) {
GPU_indexbuf_set_line_restart(&data->elb, subdiv_edge_index);
@@ -124,7 +126,7 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd
((mr->e_origindex) && (mr->e_origindex[coarse_edge_index] == ORIGINDEX_NONE)))) {
const uint ml_index_other = (loop_idx == (end_loop_idx - 1)) ? start_loop_idx :
loop_idx + 1;
- if (coarse_quad->flag & ME_FACE_SEL) {
+ if (mr->select_poly && mr->select_poly[coarse_quad_index]) {
if (BLI_BITMAP_TEST_AND_SET_ATOMIC(data->select_map, coarse_edge_index)) {
/* Hide edge as it has more than 2 selected loop. */
GPU_indexbuf_set_line_restart(&data->elb, subdiv_edge_index);
@@ -148,12 +150,11 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd
}
}
-static void extract_lines_paint_mask_finish_subdiv(
- const struct DRWSubdivCache *UNUSED(subdiv_cache),
- const MeshRenderData *mr,
- MeshBatchCache *cache,
- void *buf,
- void *_data)
+static void extract_lines_paint_mask_finish_subdiv(const struct DRWSubdivCache * /*subdiv_cache*/,
+ const MeshRenderData *mr,
+ MeshBatchCache *cache,
+ void *buf,
+ void *_data)
{
extract_lines_paint_mask_finish(mr, cache, buf, _data);
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
index 48eeb86e5ee..e84f122d03e 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
@@ -19,8 +19,8 @@ namespace blender::draw {
* \{ */
static void extract_points_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *tls_data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(tls_data);
@@ -53,9 +53,9 @@ BLI_INLINE void vert_set_mesh(GPUIndexBufBuilder *elb,
}
}
-static void extract_points_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_points_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_userdata)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_userdata);
@@ -70,7 +70,7 @@ static void extract_points_iter_poly_bm(const MeshRenderData *UNUSED(mr),
static void extract_points_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *_userdata)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_userdata);
@@ -113,7 +113,7 @@ static void extract_points_iter_lvert_bm(const MeshRenderData *mr,
}
static void extract_points_iter_lvert_mesh(const MeshRenderData *mr,
- const MVert *UNUSED(mv),
+ const MVert * /*mv*/,
const int lvert_index,
void *_userdata)
{
@@ -129,8 +129,8 @@ static void extract_points_task_reduce(void *_userdata_to, void *_userdata_from)
GPU_indexbuf_join(elb_to, elb_from);
}
-static void extract_points_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_points_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_userdata)
{
@@ -141,8 +141,8 @@ static void extract_points_finish(const MeshRenderData *UNUSED(mr),
static void extract_points_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buffer),
+ MeshBatchCache * /*cache*/,
+ void * /*buffer*/,
void *data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data);
@@ -194,7 +194,7 @@ static void extract_points_iter_subdiv_bm(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
void *_data,
uint subdiv_quad_index,
- const BMFace *UNUSED(coarse_quad))
+ const BMFace * /*coarse_quad*/)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_data);
extract_points_iter_subdiv_common(elb, mr, subdiv_cache, subdiv_quad_index, true);
@@ -204,7 +204,7 @@ static void extract_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
void *_data,
uint subdiv_quad_index,
- const MPoly *UNUSED(coarse_quad))
+ const MPoly * /*coarse_quad*/)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(_data);
extract_points_iter_subdiv_common(elb, mr, subdiv_cache, subdiv_quad_index, false);
@@ -212,7 +212,7 @@ static void extract_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_cache,
static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- void *UNUSED(buffer),
+ void * /*buffer*/,
void *data)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
@@ -281,9 +281,9 @@ static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
}
}
-static void extract_points_finish_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache),
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+static void extract_points_finish_subdiv(const DRWSubdivCache * /*subdiv_cache*/,
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *_userdata)
{
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc
index 2e3e6c7b6b1..da3560389e4 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc
@@ -25,8 +25,8 @@ static void extract_tris_mat_task_reduce(void *_userdata_to, void *_userdata_fro
* \{ */
static void extract_tris_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(ibo),
+ MeshBatchCache * /*cache*/,
+ void * /*ibo*/,
void *tls_data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(tls_data);
@@ -110,10 +110,10 @@ static void extract_tris_finish(const MeshRenderData *mr,
}
static void extract_tris_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buffer);
/* Initialize the index buffer, it was already allocated, it will be filled on the device. */
@@ -157,15 +157,15 @@ constexpr MeshExtract create_extractor_tris()
* \{ */
static void extract_tris_single_mat_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(ibo),
+ MeshBatchCache * /*cache*/,
+ void * /*ibo*/,
void *tls_data)
{
GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(tls_data);
GPU_indexbuf_init(elb, GPU_PRIM_TRIS, mr->tri_len, mr->loop_len);
}
-static void extract_tris_single_mat_iter_looptri_bm(const MeshRenderData *UNUSED(mr),
+static void extract_tris_single_mat_iter_looptri_bm(const MeshRenderData * /*mr*/,
BMLoop **elt,
const int elt_index,
void *_data)
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
index 64ade020418..1817591b6a3 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
@@ -14,6 +14,8 @@
#include "BLI_string.h"
#include "BKE_attribute.h"
+#include "BKE_attribute.hh"
+#include "BKE_mesh.h"
#include "draw_attributes.h"
#include "draw_subdivision.h"
@@ -278,14 +280,14 @@ static void extract_attr_generic(const MeshRenderData *mr,
}
static void extract_attr_init(
- const MeshRenderData *mr, MeshBatchCache *cache, void *buf, void *UNUSED(tls_data), int index)
+ const MeshRenderData *mr, MeshBatchCache *cache, void *buf, void * /*tls_data*/, int index)
{
const DRW_Attributes *attrs_used = &cache->attr_used;
const DRW_AttributeRequest &request = attrs_used->requests[index];
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
- init_vbo_for_attribute(*mr, vbo, request, false, static_cast<uint32_t>(mr->loop_len));
+ init_vbo_for_attribute(*mr, vbo, request, false, uint32_t(mr->loop_len));
/* TODO(@kevindietrich): float3 is used for scalar attributes as the implicit conversion done by
* OpenGL to vec4 for a scalar `s` will produce a `vec4(s, 0, 0, 1)`. However, following the
@@ -325,7 +327,7 @@ static void extract_attr_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(tls_data),
+ void * /*tls_data*/,
int index)
{
const DRW_Attributes *attrs_used = &cache->attr_used;
@@ -340,7 +342,7 @@ static void extract_attr_init_subdiv(const DRWSubdivCache *subdiv_cache,
GPUVertFormat coarse_format = {0};
GPU_vertformat_attr_add(&coarse_format, "data", GPU_COMP_F32, dimensions, GPU_FETCH_FLOAT);
GPU_vertbuf_init_with_format_ex(src_data, &coarse_format, GPU_USAGE_STATIC);
- GPU_vertbuf_data_alloc(src_data, static_cast<uint32_t>(coarse_mesh->totloop));
+ GPU_vertbuf_data_alloc(src_data, uint32_t(coarse_mesh->totloop));
switch (request.cd_type) {
case CD_PROP_BOOL:
@@ -379,7 +381,7 @@ static void extract_attr_init_subdiv(const DRWSubdivCache *subdiv_cache,
draw_subdiv_interp_custom_data(subdiv_cache,
src_data,
dst_buffer,
- static_cast<int>(dimensions),
+ int(dimensions),
0,
ELEM(request.cd_type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR));
@@ -432,6 +434,40 @@ constexpr MeshExtract create_extractor_attr(ExtractInitFn fn, ExtractInitSubdivF
return extractor;
}
+static void extract_mesh_attr_viewer_init(const MeshRenderData *mr,
+ MeshBatchCache * /*cache*/,
+ void *buf,
+ void * /*tls_data*/)
+{
+ GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
+ static GPUVertFormat format = {0};
+ if (format.attr_len == 0) {
+ GPU_vertformat_attr_add(&format, "attribute_value", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
+ }
+
+ GPU_vertbuf_init_with_format(vbo, &format);
+ GPU_vertbuf_data_alloc(vbo, mr->loop_len);
+ MutableSpan<ColorGeometry4f> attr{static_cast<ColorGeometry4f *>(GPU_vertbuf_get_data(vbo)),
+ mr->loop_len};
+
+ const StringRefNull attr_name = ".viewer";
+ const bke::AttributeAccessor attributes = mr->me->attributes();
+ attributes
+ .lookup_or_default<ColorGeometry4f>(attr_name, ATTR_DOMAIN_CORNER, {1.0f, 0.0f, 1.0f, 1.0f})
+ .materialize(attr);
+}
+
+constexpr MeshExtract create_extractor_attr_viewer()
+{
+ MeshExtract extractor = {nullptr};
+ extractor.init = extract_mesh_attr_viewer_init;
+ extractor.data_type = MR_DATA_NONE;
+ extractor.data_size = 0;
+ extractor.use_threading = false;
+ extractor.mesh_buffer_offset = offsetof(MeshBufferList, vbo.attr_viewer);
+ return extractor;
+}
+
/** \} */
} // namespace blender::draw
@@ -457,3 +493,5 @@ const MeshExtract extract_attr[GPU_MAX_ATTR] = {
CREATE_EXTRACTOR_ATTR(13),
CREATE_EXTRACTOR_ATTR(14),
};
+
+const MeshExtract extract_attr_viewer = blender::draw::create_extractor_attr_viewer();
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
index 50c37f6397c..de1f5181ac5 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
@@ -43,7 +43,7 @@ static float loop_edge_factor_get(const float f_no[3],
}
static void extract_edge_fac_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -66,7 +66,7 @@ static void extract_edge_fac_init(const MeshRenderData *mr,
* We could have a flag in the mesh instead or check the modifier stack. */
const MEdge *med = mr->medge;
for (int e_index = 0; e_index < mr->edge_len; e_index++, med++) {
- if ((med->flag & ME_EDGERENDER) == 0) {
+ if ((med->flag & ME_EDGEDRAW) == 0) {
data->use_edge_render = true;
break;
}
@@ -82,7 +82,7 @@ static void extract_edge_fac_init(const MeshRenderData *mr,
static void extract_edge_fac_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_EdgeFac_Data *data = static_cast<MeshExtract_EdgeFac_Data *>(_data);
@@ -118,7 +118,7 @@ static void extract_edge_fac_iter_poly_mesh(const MeshRenderData *mr,
if (data->use_edge_render) {
const MEdge *med = &mr->medge[ml->e];
- data->vbo_data[ml_index] = (med->flag & ME_EDGERENDER) ? 255 : 0;
+ data->vbo_data[ml_index] = (med->flag & ME_EDGEDRAW) ? 255 : 0;
}
else {
@@ -146,7 +146,7 @@ static void extract_edge_fac_iter_poly_mesh(const MeshRenderData *mr,
}
static void extract_edge_fac_iter_ledge_bm(const MeshRenderData *mr,
- const BMEdge *UNUSED(eed),
+ const BMEdge * /*eed*/,
const int ledge_index,
void *_data)
{
@@ -156,7 +156,7 @@ static void extract_edge_fac_iter_ledge_bm(const MeshRenderData *mr,
}
static void extract_edge_fac_iter_ledge_mesh(const MeshRenderData *mr,
- const MEdge *UNUSED(med),
+ const MEdge * /*med*/,
const int ledge_index,
void *_data)
{
@@ -167,7 +167,7 @@ static void extract_edge_fac_iter_ledge_mesh(const MeshRenderData *mr,
}
static void extract_edge_fac_finish(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *_data)
{
@@ -217,10 +217,10 @@ static GPUVertFormat *get_subdiv_edge_fac_format()
}
static void extract_edge_fac_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
GPUVertBuf *edge_idx = cache->final.buff.vbo.edge_idx;
@@ -252,9 +252,9 @@ static void extract_edge_fac_init_subdiv(const DRWSubdivCache *subdiv_cache,
}
static void extract_edge_fac_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
if (loose_geom.edge_len == 0) {
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
index 27fd6546b8c..31dc2fdff6a 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
@@ -60,14 +60,14 @@ static void mesh_render_data_edge_flag(const MeshRenderData *mr,
if (mr->edge_crease_ofs != -1) {
float crease = BM_ELEM_CD_GET_FLOAT(eed, mr->edge_crease_ofs);
if (crease > 0) {
- eattr->crease = (uchar)ceil(crease * 15.0f);
+ eattr->crease = uchar(ceil(crease * 15.0f));
}
}
/* Use a byte for value range */
if (mr->bweight_ofs != -1) {
float bweight = BM_ELEM_CD_GET_FLOAT(eed, mr->bweight_ofs);
if (bweight > 0) {
- eattr->bweight = (uchar)(bweight * 255.0f);
+ eattr->bweight = uchar(bweight * 255.0f);
}
}
#ifdef WITH_FREESTYLE
@@ -95,7 +95,7 @@ static void mesh_render_data_vert_flag(const MeshRenderData *mr,
if (mr->vert_crease_ofs != -1) {
float crease = BM_ELEM_CD_GET_FLOAT(eve, mr->vert_crease_ofs);
if (crease > 0) {
- eattr->crease |= (uchar)ceil(crease * 15.0f) << 4;
+ eattr->crease |= uchar(ceil(crease * 15.0f)) << 4;
}
}
}
@@ -112,7 +112,7 @@ static GPUVertFormat *get_edit_data_format()
}
static void extract_edit_data_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -126,7 +126,7 @@ static void extract_edit_data_init(const MeshRenderData *mr,
static void extract_edit_data_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
EditLoopData *vbo_data = *(EditLoopData **)_data;
@@ -223,7 +223,7 @@ static void extract_edit_data_iter_lvert_bm(const MeshRenderData *mr,
}
static void extract_edit_data_iter_lvert_mesh(const MeshRenderData *mr,
- const MVert *UNUSED(mv),
+ const MVert * /*mv*/,
const int lvert_index,
void *_data)
{
@@ -240,8 +240,8 @@ static void extract_edit_data_iter_lvert_mesh(const MeshRenderData *mr,
}
static void extract_edit_data_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
void *data)
{
@@ -300,14 +300,14 @@ static void extract_edit_data_iter_subdiv_mesh(const DRWSubdivCache *subdiv_cach
uint subdiv_quad_index,
const MPoly *coarse_quad)
{
- const int coarse_quad_index = static_cast<int>(coarse_quad - mr->mpoly);
+ const int coarse_quad_index = int(coarse_quad - mr->mpoly);
BMFace *coarse_quad_bm = bm_original_face_get(mr, coarse_quad_index);
extract_edit_data_iter_subdiv_bm(subdiv_cache, mr, _data, subdiv_quad_index, coarse_quad_bm);
}
static void extract_edit_data_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- void *UNUSED(buffer),
+ void * /*buffer*/,
void *_data)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_data.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_data.cc
index 0b9043e3289..3ebf2daf1e9 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_data.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_data.cc
@@ -43,7 +43,7 @@ static void extract_edituv_data_init_common(const MeshRenderData *mr,
}
static void extract_edituv_data_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -54,7 +54,7 @@ static void extract_edituv_data_init(const MeshRenderData *mr,
static void extract_edituv_data_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
BMLoop *l_iter, *l_first;
@@ -114,7 +114,7 @@ static void extract_edituv_data_iter_poly_mesh(const MeshRenderData *mr,
static void extract_edituv_data_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -174,7 +174,7 @@ static void extract_edituv_data_iter_subdiv_mesh(const DRWSubdivCache *subdiv_ca
uint subdiv_quad_index,
const MPoly *coarse_quad)
{
- const int coarse_quad_index = static_cast<int>(coarse_quad - mr->mpoly);
+ const int coarse_quad_index = int(coarse_quad - mr->mpoly);
BMFace *coarse_quad_bm = bm_original_face_get(mr, coarse_quad_index);
extract_edituv_data_iter_subdiv_bm(subdiv_cache, mr, _data, subdiv_quad_index, coarse_quad_bm);
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc
index e4714aabf34..492756f30bb 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc
@@ -52,7 +52,7 @@ static void compute_normalize_edge_vectors(float auv[2][2],
static short v2_to_short_angle(const float v[2])
{
- return atan2f(v[1], v[0]) * (float)M_1_PI * SHRT_MAX;
+ return atan2f(v[1], v[0]) * float(M_1_PI) * SHRT_MAX;
}
static void edituv_get_edituv_stretch_angle(float auv[2][2],
@@ -63,7 +63,7 @@ static void edituv_get_edituv_stretch_angle(float auv[2][2],
r_stretch->uv_angles[0] = v2_to_short_angle(auv[0]);
r_stretch->uv_angles[1] = v2_to_short_angle(auv[1]);
/* Compute 3D angle here. */
- r_stretch->angle = angle_normalized_v3v3(av[0], av[1]) * (float)M_1_PI * SHRT_MAX;
+ r_stretch->angle = angle_normalized_v3v3(av[0], av[1]) * float(M_1_PI) * SHRT_MAX;
#if 0 /* here for reference, this is done in shader now. */
float uvang = angle_normalized_v2v2(auv0, auv1);
@@ -74,7 +74,7 @@ static void edituv_get_edituv_stretch_angle(float auv[2][2],
}
static void extract_edituv_stretch_angle_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -104,7 +104,7 @@ static void extract_edituv_stretch_angle_init(const MeshRenderData *mr,
static void extract_edituv_stretch_angle_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_StretchAngle_Data *data = static_cast<MeshExtract_StretchAngle_Data *>(_data);
@@ -157,7 +157,7 @@ static void extract_edituv_stretch_angle_iter_poly_bm(const MeshRenderData *mr,
static void extract_edituv_stretch_angle_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *_data)
{
MeshExtract_StretchAngle_Data *data = static_cast<MeshExtract_StretchAngle_Data *>(_data);
@@ -214,7 +214,7 @@ static void extract_edituv_stretch_angle_init_subdiv(const DRWSubdivCache *subdi
const MeshRenderData *mr,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *refined_vbo = static_cast<GPUVertBuf *>(buffer);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_area.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_area.cc
index 9679c0523f8..7c96fbd6a99 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_area.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_area.cc
@@ -20,9 +20,9 @@ namespace blender::draw {
* \{ */
static void extract_edituv_stretch_area_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
static GPUVertFormat format = {0};
@@ -90,7 +90,7 @@ static void compute_area_ratio(const MeshRenderData *mr,
static void extract_edituv_stretch_area_finish(const MeshRenderData *mr,
MeshBatchCache *cache,
void *buf,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
float *area_ratio = static_cast<float *>(MEM_mallocN(sizeof(float) * mr->poly_len, __func__));
@@ -126,7 +126,7 @@ static void extract_edituv_stretch_area_init_subdiv(const DRWSubdivCache *subdiv
const MeshRenderData *mr,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
/* Initialize final buffer. */
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_edituv_data.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_edituv_data.cc
index 27d1975d67b..55ad2e67487 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_edituv_data.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_edituv_data.cc
@@ -21,7 +21,7 @@ struct MeshExtract_EditUVFdotData_Data {
};
static void extract_fdots_edituv_data_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -41,7 +41,7 @@ static void extract_fdots_edituv_data_init(const MeshRenderData *mr,
static void extract_fdots_edituv_data_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_EditUVFdotData_Data *data = static_cast<MeshExtract_EditUVFdotData_Data *>(_data);
@@ -51,7 +51,7 @@ static void extract_fdots_edituv_data_iter_poly_bm(const MeshRenderData *mr,
}
static void extract_fdots_edituv_data_iter_poly_mesh(const MeshRenderData *mr,
- const MPoly *UNUSED(mp),
+ const MPoly * /*mp*/,
const int mp_index,
void *_data)
{
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_nor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_nor.cc
index c47cde63630..02e4b877562 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_nor.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_nor.cc
@@ -19,9 +19,9 @@ namespace blender::draw {
#define NOR_AND_FLAG_HIDDEN -2
static void extract_fdots_nor_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
static GPUVertFormat format = {0};
@@ -34,9 +34,9 @@ static void extract_fdots_nor_init(const MeshRenderData *mr,
}
static void extract_fdots_nor_finish(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
static float invalid_normal[3] = {0.0f, 0.0f, 0.0f};
@@ -99,9 +99,9 @@ constexpr MeshExtract create_extractor_fdots_nor()
* \{ */
static void extract_fdots_nor_hq_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
static GPUVertFormat format = {0};
@@ -114,9 +114,9 @@ static void extract_fdots_nor_hq_init(const MeshRenderData *mr,
}
static void extract_fdots_nor_hq_finish(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
static float invalid_normal[3] = {0.0f, 0.0f, 0.0f};
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
index c391cb6ca5a..d43eb6117df 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
@@ -36,7 +36,7 @@ static GPUVertFormat *get_fdots_nor_format_subdiv()
}
static void extract_fdots_pos_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -63,7 +63,7 @@ static void extract_fdots_pos_iter_poly_bm(const MeshRenderData *mr,
do {
add_v3_v3(co, bm_vert_co_get(mr, l_iter->v));
} while ((l_iter = l_iter->next) != l_first);
- mul_v3_fl(co, 1.0f / (float)f->len);
+ mul_v3_fl(co, 1.0f / float(f->len));
}
static void extract_fdots_pos_iter_poly_mesh(const MeshRenderData *mr,
@@ -77,7 +77,7 @@ static void extract_fdots_pos_iter_poly_mesh(const MeshRenderData *mr,
const MVert *mvert = mr->mvert;
const MLoop *mloop = mr->mloop;
- const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+ const BLI_bitmap *facedot_tags = mr->me->runtime->subsurf_face_dot_tags;
const int ml_index_end = mp->loopstart + mp->totloop;
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
@@ -95,15 +95,15 @@ static void extract_fdots_pos_iter_poly_mesh(const MeshRenderData *mr,
}
if (!mr->use_subsurf_fdots) {
- mul_v3_fl(co, 1.0f / (float)mp->totloop);
+ mul_v3_fl(co, 1.0f / float(mp->totloop));
}
}
static void extract_fdots_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
/* We "extract" positions, normals, and indices at once. */
GPUVertBuf *fdots_pos_vbo = static_cast<GPUVertBuf *>(buffer);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
index b0403cf7c4c..802f000cb43 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
@@ -22,7 +22,7 @@ struct MeshExtract_FdotUV_Data {
};
static void extract_fdots_uv_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -53,16 +53,16 @@ static void extract_fdots_uv_init(const MeshRenderData *mr,
}
}
-static void extract_fdots_uv_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_fdots_uv_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_FdotUV_Data *data = static_cast<MeshExtract_FdotUV_Data *>(_data);
BMLoop *l_iter, *l_first;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
- float w = 1.0f / (float)f->len;
+ float w = 1.0f / float(f->len);
const MLoopUV *luv = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, data->cd_ofs);
madd_v2_v2fl(data->vbo_data[BM_elem_index_get(f)], luv->uv, w);
} while ((l_iter = l_iter->next) != l_first);
@@ -74,7 +74,7 @@ static void extract_fdots_uv_iter_poly_mesh(const MeshRenderData *mr,
void *_data)
{
MeshExtract_FdotUV_Data *data = static_cast<MeshExtract_FdotUV_Data *>(_data);
- const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+ const BLI_bitmap *facedot_tags = mr->me->runtime->subsurf_face_dot_tags;
const MLoop *mloop = mr->mloop;
const int ml_index_end = mp->loopstart + mp->totloop;
@@ -86,7 +86,7 @@ static void extract_fdots_uv_iter_poly_mesh(const MeshRenderData *mr,
}
}
else {
- float w = 1.0f / (float)mp->totloop;
+ float w = 1.0f / float(mp->totloop);
madd_v2_v2fl(data->vbo_data[mp_index], data->uv_data[ml_index].uv, w);
}
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
index 01d07fa5f83..ff0d502ea1e 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
@@ -16,7 +16,7 @@ namespace blender::draw {
* \{ */
static void extract_lnor_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -34,7 +34,7 @@ static void extract_lnor_init(const MeshRenderData *mr,
static void extract_lnor_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *data)
{
BMLoop *l_iter, *l_first;
@@ -86,7 +86,7 @@ static void extract_lnor_iter_poly_mesh(const MeshRenderData *mr,
(mr->edit_bmesh && (mr->v_origindex) && mr->v_origindex[ml->v] == ORIGINDEX_NONE)) {
lnor_data->w = -1;
}
- else if (mp->flag & ME_FACE_SEL) {
+ else if (mr->select_poly && mr->select_poly[mp_index]) {
lnor_data->w = 1;
}
else {
@@ -106,10 +106,10 @@ static GPUVertFormat *get_subdiv_lnor_format()
}
static void extract_lnor_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buffer);
GPUVertBuf *pos_nor = cache->final.buff.vbo.pos_nor;
@@ -143,7 +143,7 @@ struct gpuHQNor {
};
static void extract_lnor_hq_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -161,7 +161,7 @@ static void extract_lnor_hq_init(const MeshRenderData *mr,
static void extract_lnor_hq_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *data)
{
BMLoop *l_iter, *l_first;
@@ -211,7 +211,7 @@ static void extract_lnor_hq_iter_poly_mesh(const MeshRenderData *mr,
(mr->edit_bmesh && (mr->v_origindex) && mr->v_origindex[ml->v] == ORIGINDEX_NONE)) {
lnor_data->w = -1;
}
- else if (mp->flag & ME_FACE_SEL) {
+ else if (mr->select_poly && mr->select_poly[mp_index]) {
lnor_data->w = 1;
}
else {
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc
index fe2a02b6b63..d0d97054448 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc
@@ -23,9 +23,9 @@ namespace blender::draw {
* \{ */
static void extract_mesh_analysis_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
static GPUVertFormat format = {0};
@@ -67,8 +67,8 @@ BLI_INLINE float overhang_remap(float fac, float min, float max, float minmax_ir
static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang)
{
const MeshStatVis *statvis = &mr->toolsettings->statvis;
- const float min = statvis->overhang_min / (float)M_PI;
- const float max = statvis->overhang_max / (float)M_PI;
+ const float min = statvis->overhang_min / float(M_PI);
+ const float max = statvis->overhang_max / float(M_PI);
const char axis = statvis->overhang_axis;
BMEditMesh *em = mr->edit_bmesh;
BMIter iter;
@@ -88,7 +88,7 @@ static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang)
if (mr->extract_type == MR_EXTRACT_BMESH) {
int l_index = 0;
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
- float fac = angle_normalized_v3v3(bm_face_no_get(mr, f), dir) / (float)M_PI;
+ float fac = angle_normalized_v3v3(bm_face_no_get(mr, f), dir) / float(M_PI);
fac = overhang_remap(fac, min, max, minmax_irange);
for (int i = 0; i < f->len; i++, l_index++) {
r_overhang[l_index] = fac;
@@ -98,7 +98,7 @@ static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang)
else {
const MPoly *mp = mr->mpoly;
for (int mp_index = 0, l_index = 0; mp_index < mr->poly_len; mp_index++, mp++) {
- float fac = angle_normalized_v3v3(mr->poly_normals[mp_index], dir) / (float)M_PI;
+ float fac = angle_normalized_v3v3(mr->poly_normals[mp_index], dir) / float(M_PI);
fac = overhang_remap(fac, min, max, minmax_irange);
for (int i = 0; i < mp->totloop; i++, l_index++) {
r_overhang[l_index] = fac;
@@ -265,7 +265,7 @@ struct BVHTree_OverlapData {
float epsilon;
};
-static bool bvh_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED(thread))
+static bool bvh_overlap_cb(void *userdata, int index_a, int index_b, int /*thread*/)
{
struct BVHTree_OverlapData *data = static_cast<struct BVHTree_OverlapData *>(userdata);
@@ -367,7 +367,7 @@ static void statvis_calc_intersect(const MeshRenderData *mr, float *r_intersect)
}
}
-BLI_INLINE float distort_remap(float fac, float min, float UNUSED(max), float minmax_irange)
+BLI_INLINE float distort_remap(float fac, float min, float /*max*/, float minmax_irange)
{
if (fac >= min) {
fac = (fac - min) * minmax_irange;
@@ -474,7 +474,7 @@ static void statvis_calc_distort(const MeshRenderData *mr, float *r_distort)
}
}
-BLI_INLINE float sharp_remap(float fac, float min, float UNUSED(max), float minmax_irange)
+BLI_INLINE float sharp_remap(float fac, float min, float /*max*/, float minmax_irange)
{
/* important not '>=' */
if (fac > min) {
@@ -588,9 +588,9 @@ static void statvis_calc_sharp(const MeshRenderData *mr, float *r_sharp)
}
static void extract_analysis_iter_finish_mesh(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
BLI_assert(mr->edit_bmesh);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_orco.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_orco.cc
index 4fcbdb1fc7c..915495204d4 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_orco.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_orco.cc
@@ -19,7 +19,7 @@ struct MeshExtract_Orco_Data {
};
static void extract_orco_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -45,9 +45,9 @@ static void extract_orco_init(const MeshRenderData *mr,
BLI_assert(data->orco);
}
-static void extract_orco_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_orco_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *data)
{
MeshExtract_Orco_Data *orco_data = (MeshExtract_Orco_Data *)data;
@@ -63,7 +63,7 @@ static void extract_orco_iter_poly_bm(const MeshRenderData *UNUSED(mr),
static void extract_orco_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *data)
{
const MLoop *mloop = mr->mloop;
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
index a822845c688..30b4f808487 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
@@ -28,7 +28,7 @@ struct MeshExtract_PosNor_Data {
};
static void extract_pos_nor_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -66,7 +66,7 @@ static void extract_pos_nor_init(const MeshRenderData *mr,
static void extract_pos_nor_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_PosNor_Data *data = static_cast<MeshExtract_PosNor_Data *>(_data);
@@ -104,7 +104,7 @@ static void extract_pos_nor_iter_poly_mesh(const MeshRenderData *mr,
((mr->v_origindex) && (mr->v_origindex[ml->v] == ORIGINDEX_NONE))) {
vert->nor.w = -1;
}
- else if (mv->flag & SELECT) {
+ else if (mr->select_vert && mr->select_vert[ml->v]) {
vert->nor.w = 1;
}
else {
@@ -171,9 +171,9 @@ static void extract_pos_nor_iter_lvert_mesh(const MeshRenderData *mr,
vert->nor = data->normals[v_index].low;
}
-static void extract_pos_nor_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+static void extract_pos_nor_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *_data)
{
MeshExtract_PosNor_Data *data = static_cast<MeshExtract_PosNor_Data *>(_data);
@@ -201,10 +201,10 @@ static GPUVertFormat *get_custom_normals_format()
}
static void extract_pos_nor_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buffer);
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
@@ -282,9 +282,9 @@ static void extract_pos_nor_init_subdiv(const DRWSubdivCache *subdiv_cache,
}
static void extract_pos_nor_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
if (loose_geom.loop_len == 0) {
@@ -373,7 +373,7 @@ struct MeshExtract_PosNorHQ_Data {
};
static void extract_pos_nor_hq_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -411,7 +411,7 @@ static void extract_pos_nor_hq_init(const MeshRenderData *mr,
static void extract_pos_nor_hq_iter_poly_bm(const MeshRenderData *mr,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_PosNorHQ_Data *data = static_cast<MeshExtract_PosNorHQ_Data *>(_data);
@@ -429,7 +429,7 @@ static void extract_pos_nor_hq_iter_poly_bm(const MeshRenderData *mr,
static void extract_pos_nor_hq_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *_data)
{
MeshExtract_PosNorHQ_Data *data = static_cast<MeshExtract_PosNorHQ_Data *>(_data);
@@ -451,7 +451,7 @@ static void extract_pos_nor_hq_iter_poly_mesh(const MeshRenderData *mr,
((mr->v_origindex) && (mr->v_origindex[ml->v] == ORIGINDEX_NONE))) {
vert->nor[3] = -1;
}
- else if (mv->flag & SELECT) {
+ else if (mr->select_vert && mr->select_vert[ml->v]) {
vert->nor[3] = 1;
}
else {
@@ -523,9 +523,9 @@ static void extract_pos_nor_hq_iter_lvert_mesh(const MeshRenderData *mr,
vert->nor[3] = 0;
}
-static void extract_pos_nor_hq_finish(const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
- void *UNUSED(buf),
+static void extract_pos_nor_hq_finish(const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
+ void * /*buf*/,
void *_data)
{
MeshExtract_PosNorHQ_Data *data = static_cast<MeshExtract_PosNorHQ_Data *>(_data);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc
index 6202fdd312d..34b8124f872 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc
@@ -32,9 +32,9 @@ static GPUVertFormat *get_sculpt_data_format()
}
static void extract_sculpt_data_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
GPUVertFormat *format = get_sculpt_data_format();
@@ -44,7 +44,8 @@ static void extract_sculpt_data_init(const MeshRenderData *mr,
CustomData *cd_pdata = (mr->extract_type == MR_EXTRACT_BMESH) ? &mr->bm->pdata : &mr->me->pdata;
const float *cd_mask = (const float *)CustomData_get_layer(cd_vdata, CD_PAINT_MASK);
- const int *cd_face_set = (const int *)CustomData_get_layer(cd_pdata, CD_SCULPT_FACE_SETS);
+ const int *cd_face_set = (const int *)CustomData_get_layer_named(
+ cd_pdata, CD_PROP_INT32, ".sculpt_face_set");
GPU_vertbuf_init_with_format(vbo, format);
GPU_vertbuf_data_alloc(vbo, mr->loop_len);
@@ -59,7 +60,7 @@ static void extract_sculpt_data_init(const MeshRenderData *mr,
if (mr->extract_type == MR_EXTRACT_BMESH) {
int cd_mask_ofs = CustomData_get_offset(cd_vdata, CD_PAINT_MASK);
- int cd_face_set_ofs = CustomData_get_offset(cd_pdata, CD_SCULPT_FACE_SETS);
+ int cd_face_set_ofs = CustomData_get_offset_named(cd_pdata, CD_PROP_INT32, ".sculpt_face_set");
BMIter f_iter;
BMFace *efa;
BM_ITER_MESH (efa, &f_iter, mr->bm, BM_FACES_OF_MESH) {
@@ -114,9 +115,9 @@ static void extract_sculpt_data_init(const MeshRenderData *mr,
static void extract_sculpt_data_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buffer);
@@ -171,7 +172,8 @@ static void extract_sculpt_data_init_subdiv(const DRWSubdivCache *subdiv_cache,
};
gpuFaceSet *face_sets = (gpuFaceSet *)GPU_vertbuf_get_data(face_set_vbo);
- const int *cd_face_set = (const int *)CustomData_get_layer(cd_pdata, CD_SCULPT_FACE_SETS);
+ const int *cd_face_set = (const int *)CustomData_get_layer_named(
+ cd_pdata, CD_PROP_INT32, ".sculpt_face_set");
GPUVertFormat *format = get_sculpt_data_format();
GPU_vertbuf_init_build_on_device(vbo, format, subdiv_cache->num_subdiv_loops);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_select_idx.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_select_idx.cc
index 9e0d171c9e4..5c196a67d0b 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_select_idx.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_select_idx.cc
@@ -14,7 +14,7 @@ namespace blender::draw {
/** \name Extract Selection Index
* \{ */
-static void extract_select_idx_init_impl(const MeshRenderData *UNUSED(mr),
+static void extract_select_idx_init_impl(const MeshRenderData * /*mr*/,
const int len,
void *buf,
void *tls_data)
@@ -30,7 +30,7 @@ static void extract_select_idx_init_impl(const MeshRenderData *UNUSED(mr),
}
static void extract_select_idx_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
@@ -42,7 +42,7 @@ static void extract_select_idx_init(const MeshRenderData *mr,
* index VBO's. We could upload the p/e/v_origindex as a buffer texture and sample it inside the
* shader to output original index. */
-static void extract_poly_idx_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_poly_idx_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
const int f_index,
void *data)
@@ -55,9 +55,9 @@ static void extract_poly_idx_iter_poly_bm(const MeshRenderData *UNUSED(mr),
} while ((l_iter = l_iter->next) != l_first);
}
-static void extract_edge_idx_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_edge_idx_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *data)
{
BMLoop *l_iter, *l_first;
@@ -68,9 +68,9 @@ static void extract_edge_idx_iter_poly_bm(const MeshRenderData *UNUSED(mr),
} while ((l_iter = l_iter->next) != l_first);
}
-static void extract_vert_idx_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_vert_idx_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *data)
{
BMLoop *l_iter, *l_first;
@@ -122,7 +122,7 @@ static void extract_poly_idx_iter_poly_mesh(const MeshRenderData *mr,
static void extract_edge_idx_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *data)
{
const MLoop *mloop = mr->mloop;
@@ -135,7 +135,7 @@ static void extract_edge_idx_iter_poly_mesh(const MeshRenderData *mr,
static void extract_vert_idx_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *data)
{
const MLoop *mloop = mr->mloop;
@@ -147,7 +147,7 @@ static void extract_vert_idx_iter_poly_mesh(const MeshRenderData *mr,
}
static void extract_edge_idx_iter_ledge_mesh(const MeshRenderData *mr,
- const MEdge *UNUSED(med),
+ const MEdge * /*med*/,
const int ledge_index,
void *data)
{
@@ -169,7 +169,7 @@ static void extract_vert_idx_iter_ledge_mesh(const MeshRenderData *mr,
}
static void extract_vert_idx_iter_lvert_mesh(const MeshRenderData *mr,
- const MVert *UNUSED(mv),
+ const MVert * /*mv*/,
const int lvert_index,
void *data)
{
@@ -182,9 +182,9 @@ static void extract_vert_idx_iter_lvert_mesh(const MeshRenderData *mr,
static void extract_vert_idx_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
@@ -213,7 +213,7 @@ static void extract_vert_idx_init_subdiv(const DRWSubdivCache *subdiv_cache,
static void extract_vert_idx_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
if (loose_geom.loop_len == 0) {
@@ -254,10 +254,10 @@ static void extract_vert_idx_loose_geom_subdiv(const DRWSubdivCache *subdiv_cach
}
static void extract_edge_idx_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
- MeshBatchCache *UNUSED(cache),
+ const MeshRenderData * /*mr*/,
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
@@ -271,7 +271,7 @@ static void extract_edge_idx_init_subdiv(const DRWSubdivCache *subdiv_cache,
static void extract_edge_idx_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
const DRWSubdivLooseGeom &loose_geom = subdiv_cache->loose_geom;
if (loose_geom.edge_len == 0) {
@@ -294,9 +294,9 @@ static void extract_edge_idx_loose_geom_subdiv(const DRWSubdivCache *subdiv_cach
static void extract_poly_idx_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
draw_subdiv_init_origindex_buffer(
@@ -366,15 +366,15 @@ constexpr MeshExtract create_extractor_vert_idx()
}
static void extract_fdot_idx_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
void *tls_data)
{
extract_select_idx_init_impl(mr, mr->poly_len, buf, tls_data);
}
-static void extract_fdot_idx_iter_poly_bm(const MeshRenderData *UNUSED(mr),
- const BMFace *UNUSED(f),
+static void extract_fdot_idx_iter_poly_bm(const MeshRenderData * /*mr*/,
+ const BMFace * /*f*/,
const int f_index,
void *data)
{
@@ -382,7 +382,7 @@ static void extract_fdot_idx_iter_poly_bm(const MeshRenderData *UNUSED(mr),
}
static void extract_fdot_idx_iter_poly_mesh(const MeshRenderData *mr,
- const MPoly *UNUSED(mp),
+ const MPoly * /*mp*/,
const int mp_index,
void *data)
{
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_skin_roots.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_skin_roots.cc
index f7655658bdd..e8feb4bebce 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_skin_roots.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_skin_roots.cc
@@ -19,9 +19,9 @@ struct SkinRootData {
};
static void extract_skin_roots_init(const MeshRenderData *mr,
- MeshBatchCache *UNUSED(cache),
+ MeshBatchCache * /*cache*/,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
/* Exclusively for edit mode. */
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc
index 049fa416523..6f0c98c684b 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc
@@ -237,7 +237,7 @@ static void extract_tan_ex_init(const MeshRenderData *mr,
static void extract_tan_init(const MeshRenderData *mr,
MeshBatchCache *cache,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
extract_tan_ex_init(mr, cache, vbo, false);
@@ -256,7 +256,7 @@ static void extract_tan_init_subdiv(const DRWSubdivCache *subdiv_cache,
const MeshRenderData *mr,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
GPUVertCompType comp_type = GPU_COMP_F32;
GPUVertFetchMode fetch_mode = GPU_FETCH_FLOAT;
@@ -302,7 +302,7 @@ static void extract_tan_init_subdiv(const DRWSubdivCache *subdiv_cache,
/* Ensure data is uploaded properly. */
GPU_vertbuf_tag_dirty(coarse_vbo);
/* Include stride in offset. */
- const int dst_offset = (int)subdiv_cache->num_subdiv_loops * 4 * pack_layer_index++;
+ const int dst_offset = int(subdiv_cache->num_subdiv_loops) * 4 * pack_layer_index++;
draw_subdiv_interp_custom_data(subdiv_cache, coarse_vbo, dst_buffer, 4, dst_offset, false);
}
if (use_orco_tan) {
@@ -317,7 +317,7 @@ static void extract_tan_init_subdiv(const DRWSubdivCache *subdiv_cache,
/* Ensure data is uploaded properly. */
GPU_vertbuf_tag_dirty(coarse_vbo);
/* Include stride in offset. */
- const int dst_offset = (int)subdiv_cache->num_subdiv_loops * 4 * pack_layer_index++;
+ const int dst_offset = int(subdiv_cache->num_subdiv_loops) * 4 * pack_layer_index++;
draw_subdiv_interp_custom_data(subdiv_cache, coarse_vbo, dst_buffer, 4, dst_offset, false);
}
@@ -346,7 +346,7 @@ constexpr MeshExtract create_extractor_tan()
static void extract_tan_hq_init(const MeshRenderData *mr,
MeshBatchCache *cache,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
extract_tan_ex_init(mr, cache, vbo, true);
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc
index 6606912850d..fe6e31af3c2 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc
@@ -74,7 +74,7 @@ static bool mesh_extract_uv_format_init(GPUVertFormat *format,
static void extract_uv_init(const MeshRenderData *mr,
MeshBatchCache *cache,
void *buf,
- void *UNUSED(tls_data))
+ void * /*tls_data*/)
{
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buf);
GPUVertFormat format = {0};
@@ -119,10 +119,10 @@ static void extract_uv_init(const MeshRenderData *mr,
}
static void extract_uv_init_subdiv(const DRWSubdivCache *subdiv_cache,
- const MeshRenderData *UNUSED(mr),
+ const MeshRenderData * /*mr*/,
MeshBatchCache *cache,
void *buffer,
- void *UNUSED(data))
+ void * /*data*/)
{
Mesh *coarse_mesh = subdiv_cache->mesh;
GPUVertBuf *vbo = static_cast<GPUVertBuf *>(buffer);
@@ -146,7 +146,7 @@ static void extract_uv_init_subdiv(const DRWSubdivCache *subdiv_cache,
int pack_layer_index = 0;
for (int i = 0; i < MAX_MTFACE; i++) {
if (uv_layers & (1 << i)) {
- const int offset = (int)subdiv_cache->num_subdiv_loops * pack_layer_index++;
+ const int offset = int(subdiv_cache->num_subdiv_loops) * pack_layer_index++;
draw_subdiv_extract_uvs(subdiv_cache, vbo, i, offset);
}
}
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_weights.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_weights.cc
index 4db5a8c23a4..6ac498eae26 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_weights.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_weights.cc
@@ -111,9 +111,9 @@ static void extract_weights_init(const MeshRenderData *mr,
}
}
-static void extract_weights_iter_poly_bm(const MeshRenderData *UNUSED(mr),
+static void extract_weights_iter_poly_bm(const MeshRenderData * /*mr*/,
const BMFace *f,
- const int UNUSED(f_index),
+ const int /*f_index*/,
void *_data)
{
MeshExtract_Weight_Data *data = static_cast<MeshExtract_Weight_Data *>(_data);
@@ -134,7 +134,7 @@ static void extract_weights_iter_poly_bm(const MeshRenderData *UNUSED(mr),
static void extract_weights_iter_poly_mesh(const MeshRenderData *mr,
const MPoly *mp,
- const int UNUSED(mp_index),
+ const int /*mp_index*/,
void *_data)
{
MeshExtract_Weight_Data *data = static_cast<MeshExtract_Weight_Data *>(_data);