diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
9 files changed, 21 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc index bd3e452b7f2..c69a7b4b2c7 100644 --- a/source/blender/blenkernel/intern/attribute.cc +++ b/source/blender/blenkernel/intern/attribute.cc @@ -354,7 +354,7 @@ CustomDataLayer *BKE_id_attribute_search(ID *id, get_domains(id, info); for (eAttrDomain domain = ATTR_DOMAIN_POINT; domain < ATTR_DOMAIN_NUM; - domain = static_cast<eAttrDomain>((static_cast<int>(domain)) + 1)) { + domain = static_cast<eAttrDomain>((int(domain)) + 1)) { if (!(domain_mask & ATTR_DOMAIN_AS_MASK(domain))) { continue; } diff --git a/source/blender/blenkernel/intern/curve_bezier.cc b/source/blender/blenkernel/intern/curve_bezier.cc index 59b09384698..3aa87be3787 100644 --- a/source/blender/blenkernel/intern/curve_bezier.cc +++ b/source/blender/blenkernel/intern/curve_bezier.cc @@ -210,7 +210,7 @@ void evaluate_segment(const float3 &point_0, MutableSpan<float3> result) { BLI_assert(result.size() > 0); - const float inv_len = 1.0f / static_cast<float>(result.size()); + const float inv_len = 1.0f / float(result.size()); const float inv_len_squared = inv_len * inv_len; const float inv_len_cubed = inv_len_squared * inv_len; diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 86be7ba8e7c..c07b4c7964e 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -520,7 +520,7 @@ static void layerInterp_propInt(const void **sources, const float src = *static_cast<const int *>(sources[i]); result += src * weight; } - const int rounded_result = static_cast<int>(round(result)); + const int rounded_result = int(round(result)); *static_cast<int *>(dest) = rounded_result; } diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index 64f6ceba32b..b06317fa511 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -867,8 +867,8 @@ void BKE_image_get_tile_uv(const Image *ima, const int tile_number, float r_uv[2 } else { const int tile_index = tile_number - 1001; - r_uv[0] = static_cast<float>(tile_index % 10); - r_uv[1] = static_cast<float>(tile_index / 10); + r_uv[0] = float(tile_index % 10); + r_uv[1] = float(tile_index / 10); } } diff --git a/source/blender/blenkernel/intern/mesh_boolean_convert.cc b/source/blender/blenkernel/intern/mesh_boolean_convert.cc index be6c27ee6f9..360c7da2ae2 100644 --- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc +++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc @@ -114,7 +114,7 @@ class MeshesToIMeshInfo { * input `Mesh` that contained the `MVert` that it came from. */ int MeshesToIMeshInfo::input_mesh_for_imesh_vert(int imesh_v) const { - int n = static_cast<int>(mesh_vert_offset.size()); + int n = int(mesh_vert_offset.size()); for (int i = 0; i < n - 1; ++i) { if (imesh_v < mesh_vert_offset[i + 1]) { return i; @@ -127,7 +127,7 @@ int MeshesToIMeshInfo::input_mesh_for_imesh_vert(int imesh_v) const * return the index of the input `Mesh` that contained the `MVert` that it came from. */ int MeshesToIMeshInfo::input_mesh_for_imesh_edge(int imesh_e) const { - int n = static_cast<int>(mesh_edge_offset.size()); + int n = int(mesh_edge_offset.size()); for (int i = 0; i < n - 1; ++i) { if (imesh_e < mesh_edge_offset[i + 1]) { return i; @@ -140,7 +140,7 @@ int MeshesToIMeshInfo::input_mesh_for_imesh_edge(int imesh_e) const * input `Mesh` that contained the `MPoly` that it came from. */ int MeshesToIMeshInfo::input_mesh_for_imesh_face(int imesh_f) const { - int n = static_cast<int>(mesh_poly_offset.size()); + int n = int(mesh_poly_offset.size()); for (int i = 0; i < n - 1; ++i) { if (imesh_f < mesh_poly_offset[i + 1]) { return i; @@ -831,7 +831,7 @@ Mesh *direct_mesh_boolean(Span<const Mesh *> meshes, return mi; } } - return static_cast<int>(mim.mesh_poly_offset.size()) - 1; + return int(mim.mesh_poly_offset.size()) - 1; }; IMesh m_out = boolean_mesh(m_in, static_cast<BoolOpType>(boolean_mode), diff --git a/source/blender/blenkernel/intern/mesh_calc_edges.cc b/source/blender/blenkernel/intern/mesh_calc_edges.cc index 038133c33ae..5e6babdf7b4 100644 --- a/source/blender/blenkernel/intern/mesh_calc_edges.cc +++ b/source/blender/blenkernel/intern/mesh_calc_edges.cc @@ -35,8 +35,7 @@ struct OrderedEdge { } } - OrderedEdge(const uint v1, const uint v2) - : OrderedEdge(static_cast<int>(v1), static_cast<int>(v2)) + OrderedEdge(const uint v1, const uint v2) : OrderedEdge(int(v1), int(v2)) { } @@ -217,7 +216,7 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool keep_existing_edges, const bool select * Each edge is assigned to one of the hash maps based on the lower bits of a hash value. */ const int parallel_maps = get_parallel_maps_count(mesh); BLI_assert(is_power_of_2_i(parallel_maps)); - const uint32_t parallel_mask = static_cast<uint32_t>(parallel_maps) - 1; + const uint32_t parallel_mask = uint32_t(parallel_maps) - 1; Array<EdgeMap> edge_maps(parallel_maps); reserve_hash_maps(mesh, keep_existing_edges, edge_maps); diff --git a/source/blender/blenkernel/intern/subdiv_mesh.cc b/source/blender/blenkernel/intern/subdiv_mesh.cc index 6bc188fd1fc..d716a7228c0 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.cc +++ b/source/blender/blenkernel/intern/subdiv_mesh.cc @@ -267,14 +267,13 @@ static void vertex_interpolation_from_corner(const SubdivMeshContext *ctx, const int first_loop_index = loops_of_ptex.first_loop - coarse_mloop; const int last_loop_index = loops_of_ptex.last_loop - coarse_mloop; const int first_indices[2] = { - static_cast<int>(coarse_mloop[first_loop_index].v), - static_cast<int>( - coarse_mloop[coarse_poly->loopstart + + int(coarse_mloop[first_loop_index].v), + int(coarse_mloop[coarse_poly->loopstart + (first_loop_index - coarse_poly->loopstart + 1) % coarse_poly->totloop] .v)}; const int last_indices[2] = { - static_cast<int>(coarse_mloop[first_loop_index].v), - static_cast<int>(coarse_mloop[last_loop_index].v), + int(coarse_mloop[first_loop_index].v), + int(coarse_mloop[last_loop_index].v), }; CustomData_interp(vertex_data, &vertex_interpolation->vertex_data_storage, @@ -402,8 +401,8 @@ static void loop_interpolation_from_corner(const SubdivMeshContext *ctx, (first_loop_index - base_loop_index + 1) % coarse_poly->totloop; const int first_indices[2] = {first_loop_index, second_loop_index}; const int last_indices[2] = { - static_cast<int>(loops_of_ptex.last_loop - coarse_mloop), - static_cast<int>(loops_of_ptex.first_loop - coarse_mloop), + int(loops_of_ptex.last_loop - coarse_mloop), + int(loops_of_ptex.first_loop - coarse_mloop), }; CustomData_interp( loop_data, &loop_interpolation->loop_data_storage, first_indices, weights, nullptr, 2, 1); diff --git a/source/blender/blenkernel/intern/type_conversions.cc b/source/blender/blenkernel/intern/type_conversions.cc index a01f5d19088..852fe38c92f 100644 --- a/source/blender/blenkernel/intern/type_conversions.cc +++ b/source/blender/blenkernel/intern/type_conversions.cc @@ -163,7 +163,7 @@ static bool int8_to_bool(const int8_t &a) } static int int8_to_int(const int8_t &a) { - return static_cast<int>(a); + return int(a); } static float int8_to_float(const int8_t &a) { @@ -192,7 +192,7 @@ static float bool_to_float(const bool &a) } static int8_t bool_to_int8(const bool &a) { - return static_cast<int8_t>(a); + return int8_t(a); } static int32_t bool_to_int(const bool &a) { diff --git a/source/blender/blenkernel/intern/volume_render.cc b/source/blender/blenkernel/intern/volume_render.cc index e7620be6401..700bd63c9d4 100644 --- a/source/blender/blenkernel/intern/volume_render.cc +++ b/source/blender/blenkernel/intern/volume_render.cc @@ -102,9 +102,8 @@ bool BKE_volume_grid_dense_floats(const Volume *volume, } const openvdb::Vec3i resolution = bbox.dim().asVec3i(); - const int64_t num_voxels = static_cast<int64_t>(resolution[0]) * - static_cast<int64_t>(resolution[1]) * - static_cast<int64_t>(resolution[2]); + const int64_t num_voxels = int64_t(resolution[0]) * int64_t(resolution[1]) * + int64_t(resolution[2]); const int channels = BKE_volume_grid_channels(volume_grid); const int elem_size = sizeof(float) * channels; float *voxels = static_cast<float *>(MEM_malloc_arrayN(num_voxels, elem_size, __func__)); |