diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-09-29 02:39:21 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-10-03 15:59:16 +0300 |
commit | 88610fe5f67a774f5f82d739554b4a3a01abc582 (patch) | |
tree | 423509c0a876c182f05803a566673282988230e8 | |
parent | fa100b14af29f4b30b3e9fac5c6a63bd94c76f2e (diff) |
Cleanup: fix unused variable warnings in draw_pbvh.cc
-rw-r--r-- | source/blender/draw/intern/draw_pbvh.cc | 106 |
1 files changed, 59 insertions, 47 deletions
diff --git a/source/blender/draw/intern/draw_pbvh.cc b/source/blender/draw/intern/draw_pbvh.cc index 11788e3d044..2e92598a955 100644 --- a/source/blender/draw/intern/draw_pbvh.cc +++ b/source/blender/draw/intern/draw_pbvh.cc @@ -289,10 +289,8 @@ struct PBVHBatches { } void fill_vbo_normal_faces( - PBVHVbo &vbo, PBVH_GPU_Args *args, - std::function<void(std::function<void(int, int, int, const MLoopTri *)> callback)> - foreach_faces, + std::function<void(std::function<void(int, int, const MLoopTri *)> callback)> foreach_faces, GPUVertBufRaw *access) { float fno[3]; @@ -300,7 +298,7 @@ struct PBVHBatches { int last_poly = -1; bool smooth = false; - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int UNUSED(tri_i), int vertex_i, const MLoopTri *tri) { const MPoly *mp = args->mpoly + tri->poly; if (tri->poly != last_poly) { @@ -347,44 +345,48 @@ struct PBVHBatches { switch (vbo.type) { case CD_PBVH_CO_TYPE: - foreach_grids([&](int x, int y, int grid_index, CCGElem *elems[4], int i) { - float *co = CCG_elem_co(&args->ccg_key, elems[i]); + foreach_grids( + [&](int UNUSED(x), int UNUSED(y), int UNUSED(grid_index), CCGElem *elems[4], int i) { + float *co = CCG_elem_co(&args->ccg_key, elems[i]); - *static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = co; - }); + *static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = co; + }); break; case CD_PBVH_NO_TYPE: - foreach_grids([&](int x, int y, int grid_index, CCGElem *elems[4], int i) { - float3 no(0.0f, 0.0f, 0.0f); + foreach_grids( + [&](int UNUSED(x), int UNUSED(y), int grid_index, CCGElem *elems[4], int UNUSED(i)) { + float3 no(0.0f, 0.0f, 0.0f); - const bool smooth = args->grid_flag_mats[grid_index].flag & ME_SMOOTH; + const bool smooth = args->grid_flag_mats[grid_index].flag & ME_SMOOTH; - if (smooth) { - no = CCG_elem_no(&args->ccg_key, elems[0]); - } - else { - for (int j = 0; j < 4; j++) { - no += CCG_elem_no(&args->ccg_key, elems[j]); - } - } + if (smooth) { + no = CCG_elem_no(&args->ccg_key, elems[0]); + } + else { + for (int j = 0; j < 4; j++) { + no += CCG_elem_no(&args->ccg_key, elems[j]); + } + } - normalize_v3(no); - short sno[3]; + normalize_v3(no); + short sno[3]; - normal_float_to_short_v3(sno, no); + normal_float_to_short_v3(sno, no); - *static_cast<short3 *>(GPU_vertbuf_raw_step(&access)) = sno; - }); + *static_cast<short3 *>(GPU_vertbuf_raw_step(&access)) = sno; + }); break; case CD_PBVH_MASK_TYPE: - foreach_grids([&](int x, int y, int grid_index, CCGElem *elems[4], int i) { - float *mask = CCG_elem_mask(&args->ccg_key, elems[i]); - - *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = mask ? (uchar)(*mask * 255.0f) : - 255; - }); + foreach_grids( + [&](int UNUSED(x), int UNUSED(y), int UNUSED(grid_index), CCGElem *elems[4], int i) { + float *mask = CCG_elem_mask(&args->ccg_key, elems[i]); + + *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = mask ? + (uchar)(*mask * 255.0f) : + 255; + }); break; case CD_PBVH_FSET_TYPE: { @@ -393,12 +395,20 @@ struct PBVHBatches { if (!face_sets) { uchar white[3] = {UCHAR_MAX, UCHAR_MAX, UCHAR_MAX}; - foreach_grids([&](int x, int y, int grid_index, CCGElem *elems[4], int i) { + foreach_grids([&](int UNUSED(x), + int UNUSED(y), + int UNUSED(grid_index), + CCGElem *UNUSED(elems)[4], + int UNUSED(i)) { *static_cast<uchar4 *>(GPU_vertbuf_raw_step(&access)) = white; }); } else { - foreach_grids([&](int x, int y, int grid_index, CCGElem *elems[4], int i) { + foreach_grids([&](int UNUSED(x), + int UNUSED(y), + int grid_index, + CCGElem *UNUSED(elems)[4], + int UNUSED(i)) { uchar face_set_color[3] = {UCHAR_MAX, UCHAR_MAX, UCHAR_MAX}; if (face_sets) { @@ -487,7 +497,7 @@ struct PBVHBatches { int totvert = args->totprim * 3; auto foreach_faces = - [&](std::function<void(int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri)> func) { + [&](std::function<void(int tri_i, int vertex_i, const MLoopTri *tri)> func) { int buffer_i = 0; const MLoop *mloop = args->mloop; @@ -501,7 +511,7 @@ struct PBVHBatches { const MLoopTri *tri = args->mlooptri + args->prim_indices[i]; for (int j : IndexRange(3)) { - func(buffer_i, j, mloop[tri->tri[j]].v, tri); + func(j, mloop[tri->tri[j]].v, tri); buffer_i++; } } @@ -520,17 +530,17 @@ struct PBVHBatches { switch (vbo.type) { case CD_PBVH_CO_TYPE: - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int UNUSED(tri_i), int vertex_i, const MLoopTri *UNUSED(tri)) { *static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = args->mvert[vertex_i].co; }); break; case CD_PBVH_NO_TYPE: - fill_vbo_normal_faces(vbo, args, foreach_faces, &access); + fill_vbo_normal_faces(args, foreach_faces, &access); break; case CD_PBVH_MASK_TYPE: { float *mask = static_cast<float *>(CustomData_get_layer(args->vdata, CD_PAINT_MASK)); - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int UNUSED(tri_i), int vertex_i, const MLoopTri *UNUSED(tri)) { *static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = (uchar)(mask[vertex_i] * 255.0f); }); @@ -542,7 +552,7 @@ struct PBVHBatches { int last_poly = -1; uchar fset_color[3] = {255, 255, 255}; - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int UNUSED(tri_i), int UNUSED(vertex_i), const MLoopTri *tri) { if (last_poly != tri->poly && args->face_sets) { last_poly = tri->poly; @@ -566,7 +576,7 @@ struct PBVHBatches { MLoopUV *mloopuv = static_cast<MLoopUV *>( CustomData_get_layer_named(args->ldata, CD_MLOOPUV, vbo.name.c_str())); - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int tri_i, int vertex_i, const MLoopTri *tri) { *static_cast<float2 *>(GPU_vertbuf_raw_step(&access)) = mloopuv[tri->tri[tri_i]].uv; }); break; @@ -576,7 +586,7 @@ struct PBVHBatches { MPropCol *mpropcol = static_cast<MPropCol *>( CustomData_get_layer_named(args->vdata, CD_PROP_COLOR, vbo.name.c_str())); - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int UNUSED(tri_i), int vertex_i, const MLoopTri *UNUSED(tri)) { ushort color[4]; MPropCol *col = mpropcol + vertex_i; @@ -592,7 +602,7 @@ struct PBVHBatches { MPropCol *mpropcol = static_cast<MPropCol *>( CustomData_get_layer_named(args->ldata, CD_PROP_COLOR, vbo.name.c_str())); - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int tri_i, int UNUSED(vertex_i), const MLoopTri *tri) { ushort color[4]; MPropCol *col = mpropcol + tri->tri[tri_i]; @@ -610,7 +620,7 @@ struct PBVHBatches { MLoopCol *mbytecol = static_cast<MLoopCol *>( CustomData_get_layer_named(args->vdata, CD_PROP_BYTE_COLOR, vbo.name.c_str())); - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int UNUSED(tri_i), int vertex_i, const MLoopTri *UNUSED(tri)) { ushort color[4]; MLoopCol *col = mbytecol + vertex_i; @@ -626,7 +636,7 @@ struct PBVHBatches { MLoopCol *mbytecol = static_cast<MLoopCol *>( CustomData_get_layer_named(args->ldata, CD_PROP_BYTE_COLOR, vbo.name.c_str())); - foreach_faces([&](int buffer_i, int tri_i, int vertex_i, const MLoopTri *tri) { + foreach_faces([&](int tri_i, int vertex_i, const MLoopTri *tri) { ushort color[4]; MLoopCol *col = mbytecol + tri->tri[tri_i]; @@ -723,8 +733,9 @@ struct PBVHBatches { int cd_mask = args->cd_mask_layer; if (cd_mask == -1) { - foreach_bmesh( - [&](BMLoop *l) { *static_cast<float *>(GPU_vertbuf_raw_step(&access)) = 255; }); + foreach_bmesh([&](BMLoop *UNUSED(l)) { + *static_cast<float *>(GPU_vertbuf_raw_step(&access)) = 255; + }); } else { foreach_bmesh([&](BMLoop *l) { @@ -738,8 +749,9 @@ struct PBVHBatches { case CD_PBVH_FSET_TYPE: { uchar3 white(255, 255, 255); - foreach_bmesh( - [&](BMLoop *l) { *static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = white; }); + foreach_bmesh([&](BMLoop *UNUSED(l)) { + *static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = white; + }); } } } |