diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc index a8dc28a82e0..4e589abddb9 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc @@ -122,7 +122,7 @@ static void mesh_render_data_loose_edges_bm(const MeshRenderData &mr, static void mesh_render_data_loose_geom_build(const MeshRenderData &mr, MeshBufferCache &cache) { - if (mr.extract_type != MR_EXTRACT_BMESH) { + if (mr.extract_type != MeshExtractType::BMesh) { /* Mesh */ mesh_render_data_loose_geom_mesh(mr, cache); } @@ -233,7 +233,7 @@ static Array mesh_render_data_mat_tri_len_build(const MeshRenderData &mr) threading::EnumerableThreadSpecific> all_tri_counts( [&]() { return Array(mr.materials_num, 0); }); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { accumululate_material_counts_bm(*mr.bm, all_tri_counts); } else { @@ -339,7 +339,7 @@ static SortedFaceData mesh_render_data_faces_sorted_build(const MeshRenderData & cache.visible_tris_num = material_tri_starts.last(); /* Sort per material. */ - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { cache.face_tri_offsets = calc_face_tri_starts_bmesh(mr, material_tri_starts); } else { @@ -489,7 +489,7 @@ static bke::MeshNormalDomain bmesh_normals_domain(BMesh *bm) void mesh_render_data_update_corner_normals(MeshRenderData &mr) { - if (mr.extract_type != MR_EXTRACT_BMESH) { + if (mr.extract_type != MeshExtractType::BMesh) { mr.corner_normals = mr.mesh->corner_normals(); } else { @@ -510,7 +510,7 @@ void mesh_render_data_update_corner_normals(MeshRenderData &mr) void mesh_render_data_update_face_normals(MeshRenderData &mr) { - if (mr.extract_type != MR_EXTRACT_BMESH) { + if (mr.extract_type != MeshExtractType::BMesh) { /* Eager calculation of face normals can reduce waiting on the lazy cache's lock. */ mr.face_normals = mr.mesh->face_normals(); } @@ -595,10 +595,10 @@ std::unique_ptr mesh_render_data_create(Object &object, mr->mesh->runtime->wrapper_type == ME_WRAPPER_TYPE_BMESH) || (do_uvedit && !do_final)) { - mr->extract_type = MR_EXTRACT_BMESH; + mr->extract_type = MeshExtractType::BMesh; } else { - mr->extract_type = MR_EXTRACT_MESH; + mr->extract_type = MeshExtractType::Mesh; /* Use mapping from final to original mesh when the object is in edit mode. */ if (is_editmode && do_final) { @@ -619,7 +619,7 @@ std::unique_ptr mesh_render_data_create(Object &object, else { mr->mesh = &mesh; mr->edit_bmesh = nullptr; - mr->extract_type = MR_EXTRACT_MESH; + mr->extract_type = MeshExtractType::Mesh; mr->hide_unmapped_edges = false; if (is_paint_mode && mr->mesh) { @@ -637,7 +637,7 @@ std::unique_ptr mesh_render_data_create(Object &object, } } - if (mr->extract_type != MR_EXTRACT_BMESH) { + if (mr->extract_type != MeshExtractType::BMesh) { /* Mesh */ mr->verts_num = mr->mesh->verts_num; mr->edges_num = mr->mesh->edges_num; diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index 4cc48044f55..73859f9d44d 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -820,13 +820,13 @@ static void draw_subdiv_cache_update_extra_coarse_face_data(DRWSubdivCache &cach } GPU_vertbuf_init_with_format_ex(*cache.extra_coarse_face_data, format, GPU_USAGE_DYNAMIC); GPU_vertbuf_data_alloc(*cache.extra_coarse_face_data, - mr.extract_type == MR_EXTRACT_BMESH ? cache.bm->totface : - mesh->faces_num); + mr.extract_type == MeshExtractType::BMesh ? cache.bm->totface : + mesh->faces_num); } MutableSpan flags_data = cache.extra_coarse_face_data->data(); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { draw_subdiv_cache_extra_coarse_face_data_bm(cache.bm, mr.efa_act, flags_data); } else if (mr.orig_index_face != nullptr) { diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh index b020342fa91..5889231f9f0 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh.hh +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.hh @@ -41,13 +41,13 @@ namespace blender::draw { /** \name Mesh Render Data * \{ */ -enum eMRExtractType { - MR_EXTRACT_BMESH, - MR_EXTRACT_MESH, +enum class MeshExtractType { + BMesh, + Mesh, }; struct MeshRenderData { - eMRExtractType extract_type; + MeshExtractType extract_type; int verts_num; int edges_num; 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 fb18e01fb15..feb69ae0468 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 @@ -75,7 +75,7 @@ void extract_edituv_tris(const MeshRenderData &mr, gpu::IndexBuf &ibo) GPUIndexBufBuilder builder; GPU_indexbuf_init(&builder, GPU_PRIM_TRIS, mr.corner_tris_num, mr.corners_num); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_tris_bm(mr, sync_selection, builder); } else { @@ -136,7 +136,7 @@ void extract_edituv_tris_subdiv(const MeshRenderData &mr, GPUIndexBufBuilder builder; GPU_indexbuf_init( &builder, GPU_PRIM_TRIS, subdiv_cache.num_subdiv_triangles, subdiv_cache.num_subdiv_loops); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_tris_subdiv_bm(mr, subdiv_cache, sync_selection, builder); } else { @@ -235,7 +235,7 @@ void extract_edituv_lines(const MeshRenderData &mr, gpu::IndexBuf &ibo) GPUIndexBufBuilder builder; GPU_indexbuf_init(&builder, GPU_PRIM_LINES, mr.corners_num, mr.corners_num); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_lines_bm(mr, sync_selection, builder); } else { @@ -322,7 +322,7 @@ void extract_edituv_lines_subdiv(const MeshRenderData &mr, GPUIndexBufBuilder builder; GPU_indexbuf_init( &builder, GPU_PRIM_LINES, subdiv_cache.num_subdiv_loops, subdiv_cache.num_subdiv_loops); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_lines_subdiv_bm(mr, subdiv_cache, sync_selection, builder); } else { @@ -390,7 +390,7 @@ void extract_edituv_points(const MeshRenderData &mr, gpu::IndexBuf &ibo) GPUIndexBufBuilder builder; GPU_indexbuf_init(&builder, GPU_PRIM_POINTS, mr.corners_num, mr.corners_num); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_points_bm(mr, sync_selection, builder); } else { @@ -462,7 +462,7 @@ void extract_edituv_points_subdiv(const MeshRenderData &mr, GPUIndexBufBuilder builder; GPU_indexbuf_init( &builder, GPU_PRIM_POINTS, subdiv_cache.num_subdiv_loops, subdiv_cache.num_subdiv_loops); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_points_subdiv_bm(mr, subdiv_cache, sync_selection, builder); } else { @@ -531,7 +531,7 @@ static void extract_edituv_face_dots_mesh(const MeshRenderData &mr, void extract_edituv_face_dots(const MeshRenderData &mr, gpu::IndexBuf &ibo) { const bool sync_selection = (mr.toolsettings->uv_flag & UV_SYNC_SELECTION) != 0; - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_face_dots_bm(mr, sync_selection, ibo); } else { 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 5eb54b1c4e0..10c33d88341 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 @@ -62,7 +62,7 @@ static void extract_face_dots_bm(const MeshRenderData &mr, gpu::IndexBuf &face_d void extract_face_dots(const MeshRenderData &mr, gpu::IndexBuf &face_dots) { - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_face_dots_mesh(mr, face_dots); } else { 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 02b2a45d791..b99c5040432 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 @@ -239,7 +239,7 @@ void extract_lines(const MeshRenderData &mr, gpu::IndexBuf *lines_loose, bool &no_loose_wire) { - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_lines_mesh(mr, lines, lines_loose, no_loose_wire); } else { @@ -273,7 +273,7 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache &subdiv_cache, MutableSpan flags_data = flags->data(); switch (mr.extract_type) { - case MR_EXTRACT_MESH: { + case MeshExtractType::Mesh: { const int *orig_index_edge = (mr.hide_unmapped_edges) ? mr.orig_index_edge : nullptr; if (orig_index_edge == nullptr) { const Span hide_edge = mr.hide_edge; @@ -312,7 +312,7 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache &subdiv_cache, } break; } - case MR_EXTRACT_BMESH: { + case MeshExtractType::BMesh: { BMesh *bm = mr.bm; for (const int i : loose_edges.index_range()) { const BMEdge *bm_edge = BM_edge_at_index(bm, loose_edges[i]); 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 88dd5611f2e..fddc24efd8b 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 @@ -174,7 +174,7 @@ void extract_lines_adjacency(const MeshRenderData &mr, gpu::IndexBuf &ibo, bool GPUIndexBufBuilder builder; GPU_indexbuf_init(&builder, GPU_PRIM_LINES_ADJ, tess_edge_len, mr.corners_num); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { calc_adjacency_mesh(mr, vert_to_corner, edge_hash, builder, is_manifold); } else { 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 dbbf2d90909..7cc1fe7862a 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 @@ -187,7 +187,7 @@ static void extract_points_bm(const MeshRenderData &mr, gpu::IndexBuf &points) void extract_points(const MeshRenderData &mr, gpu::IndexBuf &points) { - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_points_mesh(mr, points); } else { @@ -334,7 +334,7 @@ void extract_points_subdiv(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache, gpu::IndexBuf &points) { - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_points_subdiv_mesh(mr, subdiv_cache, points); } else { 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 717ae294cf5..6f486c213db 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 @@ -118,7 +118,7 @@ void extract_tris(const MeshRenderData &mr, MeshBatchCache &cache, gpu::IndexBuf &ibo) { - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_tris_mesh(mr, face_sorted, ibo); } else { 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 659a29eed05..04daab3e41d 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 @@ -193,7 +193,7 @@ static void extract_attribute(const MeshRenderData &mr, const DRW_AttributeRequest &request, gpu::VertBuf &vbo) { - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { const CustomData &custom_data = *get_custom_data_for_domain(*mr.bm, request.domain); const char *name = request.attribute_name; const int cd_offset = CustomData_get_offset_named(&custom_data, request.cd_type, name); 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 35f67ce8daa..86a92a6b884 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 @@ -146,7 +146,7 @@ void extract_edge_factor(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_init_with_format(vbo, format); GPU_vertbuf_data_alloc(vbo, mr.corners_num + mr.loose_indices_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_edge_factor_mesh(mr, vbo_data); } else { @@ -162,7 +162,7 @@ void extract_edge_factor(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_init_with_format(vbo, format); GPU_vertbuf_data_alloc(vbo, mr.corners_num + mr.loose_indices_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_edge_factor_mesh(mr, vbo_data); } else { 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 2ddeafaee3d..57a18c3e75e 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 @@ -227,7 +227,7 @@ void extract_edit_data(const MeshRenderData &mr, gpu::VertBuf &vbo) const int size = mr.corners_num + mr.loose_indices_num; GPU_vertbuf_data_alloc(vbo, size); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_edit_data_mesh(mr, vbo_data); } else { @@ -385,7 +385,7 @@ void extract_edit_data_subdiv(const MeshRenderData &mr, const int size = subdiv_full_vbo_size(mr, subdiv_cache); GPU_vertbuf_data_alloc(vbo, size); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_edit_subdiv_data_mesh(mr, subdiv_cache, vbo_data); } else { 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 1b6d4f507b8..2bfd3baccb2 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 @@ -102,7 +102,7 @@ void extract_edituv_data(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_data_alloc(vbo, mr.corners_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_data_bm(mr, vbo_data); } else { @@ -213,7 +213,7 @@ void extract_edituv_data_subdiv(const MeshRenderData &mr, GPU_vertbuf_data_alloc(vbo, size); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_edituv_subdiv_data_bm(mr, subdiv_cache, vbo_data); } else { 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 41e04651d0b..f880f9206fe 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 @@ -204,7 +204,7 @@ void extract_edituv_stretch_angle(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_data_alloc(vbo, mr.corners_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { extract_uv_stretch_angle_bm(mr, vbo_data); } else { @@ -249,12 +249,12 @@ void extract_edituv_stretch_angle_subdiv(const MeshRenderData &mr, /* UVs are stored contiguously so we need to compute the offset in the UVs buffer for the active * UV layer. */ - const CustomData *cd_ldata = (mr.extract_type == MR_EXTRACT_MESH) ? &mr.mesh->corner_data : - &mr.bm->ldata; + const CustomData *cd_ldata = (mr.extract_type == MeshExtractType::Mesh) ? &mr.mesh->corner_data : + &mr.bm->ldata; uint32_t uv_layers = cache.cd_used.uv; /* HACK to fix #68857 */ - if (mr.extract_type == MR_EXTRACT_BMESH && cache.cd_used.edit_uv == 1) { + if (mr.extract_type == MeshExtractType::BMesh && cache.cd_used.edit_uv == 1) { int layer = CustomData_get_active_layer(cd_ldata, CD_PROP_FLOAT2); if (layer != -1 && !CustomData_layer_is_anonymous(cd_ldata, CD_PROP_FLOAT2, layer)) { uv_layers |= (1 << layer); 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 3a607a43d0a..84f406187bc 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 @@ -39,7 +39,7 @@ struct AreaInfo { }; static AreaInfo compute_area_ratio(const MeshRenderData &mr, MutableSpan r_area_ratio) { - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { const BMesh &bm = *mr.bm; const int uv_offset = CustomData_get_offset(&bm.ldata, CD_PROP_FLOAT2); return threading::parallel_reduce( @@ -111,7 +111,7 @@ void extract_edituv_stretch_area(const MeshRenderData &mr, const int64_t bytes = area_ratio.as_span().size_in_bytes() + vbo_data.size_in_bytes(); threading::memory_bandwidth_bound_task(bytes, [&]() { - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { const BMesh &bm = *mr.bm; threading::parallel_for(IndexRange(bm.totface), 2048, [&](const IndexRange range) { for (const int face_index : range) { @@ -122,7 +122,7 @@ void extract_edituv_stretch_area(const MeshRenderData &mr, }); } else { - BLI_assert(mr.extract_type == MR_EXTRACT_MESH); + BLI_assert(mr.extract_type == MeshExtractType::Mesh); const OffsetIndices faces = mr.faces; threading::parallel_for(faces.index_range(), 2048, [&](const IndexRange range) { for (const int face : range) { 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 253b2bb6688..be9dd8a46a9 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 @@ -24,7 +24,7 @@ void extract_face_dots_edituv_data(const MeshRenderData &mr, gpu::VertBuf &vbo) MutableSpan vbo_data = vbo.data(); const BMesh &bm = *mr.bm; const BMUVOffsets offsets = BM_uv_map_get_offsets(&bm); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { threading::parallel_for(IndexRange(bm.totface), 2048, [&](const IndexRange range) { for (const int face_index : range) { const BMFace &face = *BM_face_at_index(&const_cast(bm), face_index); 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 624d4d65cc3..b7b8f8f61ad 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 @@ -66,7 +66,7 @@ void extract_face_dot_normals(const MeshRenderData &mr, const bool use_hq, gpu:: GPU_vertbuf_data_alloc(vbo, mr.faces_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_face_dot_normals_mesh(mr, vbo_data); } else { @@ -82,7 +82,7 @@ void extract_face_dot_normals(const MeshRenderData &mr, const bool use_hq, gpu:: GPU_vertbuf_data_alloc(vbo, mr.faces_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_face_dot_normals_mesh(mr, vbo_data); } else { 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 85bbfc7b08a..61826ea160b 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 @@ -85,7 +85,7 @@ void extract_face_dots_position(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_data_alloc(vbo, mr.corners_num + mr.loose_indices_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_face_dot_positions_mesh(mr, vbo_data); } else { 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 7ed02188c64..9e54a9354a3 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 @@ -75,7 +75,7 @@ void extract_face_dots_uv(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_data_alloc(vbo, mr.faces_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_face_dots_uv_mesh(mr, vbo_data); } else { 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 11592c0286d..0633e2e926b 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 @@ -214,7 +214,7 @@ void extract_normals(const MeshRenderData &mr, const bool use_hq, gpu::VertBuf & MutableSpan corners_data = vbo_data.take_front(mr.corners_num); MutableSpan loose_data = vbo_data.take_back(mr.loose_indices_num); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_normals_mesh(mr, corners_data); extract_paint_overlay_flags(mr, corners_data); } @@ -236,7 +236,7 @@ void extract_normals(const MeshRenderData &mr, const bool use_hq, gpu::VertBuf & MutableSpan corners_data = vbo_data.take_front(mr.corners_num); MutableSpan loose_data = vbo_data.take_back(mr.loose_indices_num); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_normals_mesh(mr, corners_data); extract_paint_overlay_flags(mr, corners_data); } 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 e343780cbb9..3f1b2bf2f68 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 @@ -70,7 +70,7 @@ static void statvis_calc_overhang(const MeshRenderData &mr, MutableSpan r mul_transposed_mat3_m4_v3(mr.object_to_world.ptr(), dir); normalize_v3(dir); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::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); @@ -143,7 +143,7 @@ static void statvis_calc_thickness(const MeshRenderData &mr, MutableSpan uv_from_jitter_v2(jit_ofs[j]); } - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { BMesh *bm = em->bm; BM_mesh_elem_index_ensure(bm, BM_FACE); @@ -296,7 +296,7 @@ static void statvis_calc_intersect(const MeshRenderData &mr, MutableSpan r_intersect[l_index] = -1.0f; } - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { uint overlap_len; BMesh *bm = em->bm; @@ -380,7 +380,7 @@ static void statvis_calc_distort(const MeshRenderData &mr, MutableSpan r_ const float max = statvis->distort_max; const float minmax_irange = 1.0f / (max - min); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { BMIter iter; BMesh *bm = em->bm; BMFace *f; @@ -487,7 +487,7 @@ static void statvis_calc_sharp(const MeshRenderData &mr, MutableSpan r_sh float *vert_angles = (float *)MEM_mallocN(sizeof(float) * mr.verts_num, __func__); copy_vn_fl(vert_angles, mr.verts_num, -M_PI); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { BMIter iter; BMesh *bm = em->bm; BMFace *efa; 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 feb458c3110..1b4eacf45c1 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 @@ -30,7 +30,7 @@ void extract_orco(const MeshRenderData &mr, gpu::VertBuf &vbo) const int64_t bytes = orco_data.size_in_bytes() + vbo_data.size_in_bytes(); threading::memory_bandwidth_bound_task(bytes, [&]() { - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { const BMesh &bm = *mr.bm; threading::parallel_for(IndexRange(bm.totface), 2048, [&](const IndexRange range) { for (const int face_index : range) { diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos.cc index 05f2385da64..3e5e718246c 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos.cc @@ -77,7 +77,7 @@ void extract_positions(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_data_alloc(vbo, mr.corners_num + mr.loose_indices_num); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_positions_mesh(mr, vbo_data); } else { 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 5338094afd7..1919347f673 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 @@ -44,7 +44,7 @@ void extract_sculpt_data(const MeshRenderData &mr, gpu::VertBuf &vbo) const int default_face_set = mr.mesh->face_sets_color_default; const int face_set_seed = mr.mesh->face_sets_color_seed; - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { const BMesh &bm = *mr.bm; const int mask_offset = CustomData_get_offset_named( &mr.bm->vdata, CD_PROP_FLOAT, ".sculpt_mask"); 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 19b8314c74b..787472f1625 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 @@ -89,7 +89,7 @@ static void extract_vert_index_bm(const MeshRenderData &mr, MutableSpan vbo void extract_vert_index(const MeshRenderData &mr, gpu::VertBuf &vbo) { MutableSpan vbo_data = init_vbo_data(vbo, mr.corners_num + mr.loose_indices_num); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_vert_index_mesh(mr, vbo_data); } else { @@ -154,7 +154,7 @@ static void extract_edge_index_bm(const MeshRenderData &mr, MutableSpan vbo void extract_edge_index(const MeshRenderData &mr, gpu::VertBuf &vbo) { MutableSpan vbo_data = init_vbo_data(vbo, mr.corners_num + mr.loose_edges.size() * 2); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_edge_index_mesh(mr, vbo_data); } else { @@ -193,7 +193,7 @@ static void extract_face_index_bm(const MeshRenderData &mr, MutableSpan vbo void extract_face_index(const MeshRenderData &mr, gpu::VertBuf &vbo) { MutableSpan vbo_data = init_vbo_data(vbo, mr.corners_num); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_face_index_mesh(mr, vbo_data); } else { @@ -314,7 +314,7 @@ void extract_face_index_subdiv(const DRWSubdivCache &subdiv_cache, void extract_face_dot_index(const MeshRenderData &mr, gpu::VertBuf &vbo) { MutableSpan vbo_data = init_vbo_data(vbo, mr.faces_num); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { if (mr.orig_index_face) { const Span orig_index_face(mr.orig_index_face, mr.faces_num); array_utils::copy(orig_index_face, vbo_data); 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 6fc5593fdf3..14fd5c267cb 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 @@ -34,10 +34,10 @@ static void extract_tan_init_common(const MeshRenderData &mr, { GPU_vertformat_deinterleave(format); - const CustomData *cd_ldata = (mr.extract_type == MR_EXTRACT_BMESH) ? &mr.bm->ldata : - &mr.mesh->corner_data; - const CustomData *cd_vdata = (mr.extract_type == MR_EXTRACT_BMESH) ? &mr.bm->vdata : - &mr.mesh->vert_data; + const CustomData *cd_ldata = (mr.extract_type == MeshExtractType::BMesh) ? &mr.bm->ldata : + &mr.mesh->corner_data; + const CustomData *cd_vdata = (mr.extract_type == MeshExtractType::BMesh) ? &mr.bm->vdata : + &mr.mesh->vert_data; uint32_t tan_layers = cache.cd_used.tan; const float3 *orco_ptr = static_cast(CustomData_get_layer(cd_vdata, CD_ORCO)); Span orco = orco_ptr ? Span(orco_ptr, mr.verts_num) : Span(); @@ -83,7 +83,7 @@ static void extract_tan_init_common(const MeshRenderData &mr, /* If `orco` is not available compute it ourselves */ orco_allocated.reinitialize(mr.verts_num); - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { BMesh *bm = mr.bm; for (int v = 0; v < mr.verts_num; v++) { const BMVert *eve = BM_vert_at_index(bm, v); @@ -107,7 +107,7 @@ static void extract_tan_init_common(const MeshRenderData &mr, if (tan_len != 0 || use_orco_tan) { short tangent_mask = 0; bool calc_active_tangent = false; - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { BKE_editmesh_loop_tangent_calc(mr.edit_bmesh, calc_active_tangent, r_tangent_names, 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 5ddc94dafb9..15c13f91b81 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 @@ -22,14 +22,14 @@ namespace blender::draw { static bool mesh_extract_uv_format_init(GPUVertFormat *format, const MeshBatchCache &cache, const CustomData *cd_ldata, - const eMRExtractType extract_type, + const MeshExtractType extract_type, uint32_t &r_uv_layers) { GPU_vertformat_deinterleave(format); uint32_t uv_layers = cache.cd_used.uv; /* HACK to fix #68857 */ - if (extract_type == MR_EXTRACT_BMESH && cache.cd_used.edit_uv == 1) { + if (extract_type == MeshExtractType::BMesh && cache.cd_used.edit_uv == 1) { int layer = CustomData_get_active_layer(cd_ldata, CD_PROP_FLOAT2); if (layer != -1 && !CustomData_layer_is_anonymous(cd_ldata, CD_PROP_FLOAT2, layer)) { uv_layers |= (1 << layer); @@ -83,8 +83,8 @@ void extract_uv_maps(const MeshRenderData &mr, const MeshBatchCache &cache, gpu: { GPUVertFormat format = {0}; - const CustomData *cd_ldata = (mr.extract_type == MR_EXTRACT_BMESH) ? &mr.bm->ldata : - &mr.mesh->corner_data; + const CustomData *cd_ldata = (mr.extract_type == MeshExtractType::BMesh) ? &mr.bm->ldata : + &mr.mesh->corner_data; int v_len = mr.corners_num; uint32_t uv_layers = cache.cd_used.uv; if (!mesh_extract_uv_format_init(&format, cache, cd_ldata, mr.extract_type, uv_layers)) { @@ -104,7 +104,7 @@ void extract_uv_maps(const MeshRenderData &mr, const MeshBatchCache &cache, gpu: MutableSpan uv_data = vbo.data(); threading::memory_bandwidth_bound_task(uv_data.size_in_bytes() * 2, [&]() { - if (mr.extract_type == MR_EXTRACT_BMESH) { + if (mr.extract_type == MeshExtractType::BMesh) { const BMesh &bm = *mr.bm; for (const int i : uv_indices.index_range()) { MutableSpan data = uv_data.slice(i * bm.totloop, bm.totloop); @@ -144,7 +144,7 @@ void extract_uv_maps_subdiv(const DRWSubdivCache &subdiv_cache, uint v_len = subdiv_cache.num_subdiv_loops; uint uv_layers; if (!mesh_extract_uv_format_init( - &format, cache, &coarse_mesh->corner_data, MR_EXTRACT_MESH, uv_layers)) + &format, cache, &coarse_mesh->corner_data, MeshExtractType::Mesh, uv_layers)) { /* TODO(kevindietrich): handle this more gracefully. */ v_len = 1; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vnor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vnor.cc index 91e5d7f1f0a..944a5dbc3f9 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vnor.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vnor.cc @@ -77,7 +77,7 @@ void extract_vert_normals(const MeshRenderData &mr, gpu::VertBuf &vbo) GPU_vertbuf_data_alloc(vbo, size); MutableSpan vbo_data = vbo.data(); - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_vert_normals_mesh(mr, vbo_data); } else { 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 5a70ffb87f4..a8b87bf4780 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 @@ -130,7 +130,7 @@ void extract_weights(const MeshRenderData &mr, const MeshBatchCache &cache, gpu: return; } - if (mr.extract_type == MR_EXTRACT_MESH) { + if (mr.extract_type == MeshExtractType::Mesh) { extract_weights_mesh(mr, weight_state, vbo_data); } else {