diff options
Diffstat (limited to 'source/blender/nodes/geometry')
26 files changed, 58 insertions, 59 deletions
diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh index e063be62987..1c2a8f521c0 100644 --- a/source/blender/nodes/geometry/node_geometry_util.hh +++ b/source/blender/nodes/geometry/node_geometry_util.hh @@ -18,7 +18,7 @@ #include <string.h> -#include "BLI_math_vec_types.hh" +#include "BLI_float3.hh" #include "BLI_utildefines.h" #include "MEM_guardedalloc.h" @@ -83,7 +83,7 @@ Mesh *create_cylinder_or_cone_mesh(float radius_top, int circle_segments, int side_segments, int fill_segments, - const GeometryNodeMeshCircleFillType fill_type, + GeometryNodeMeshCircleFillType fill_type, ConeAttributeOutputs &attribute_outputs); Mesh *create_cuboid_mesh(float3 size, int verts_x, int verts_y, int verts_z); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc index 1d064586238..36ad4605a4b 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc @@ -90,14 +90,14 @@ static void align_rotations_auto_pivot(const VArray<float3> &vectors, float3 old_axis; mul_v3_m3v3(old_axis, old_rotation, local_main_axis); - const float3 new_axis = math::normalize(vector); - float3 rotation_axis = math::cross_high_precision(old_axis, new_axis); + const float3 new_axis = vector.normalized(); + float3 rotation_axis = float3::cross_high_precision(old_axis, new_axis); if (is_zero_v3(rotation_axis)) { /* The vectors are linearly dependent, so we fall back to another axis. */ - rotation_axis = math::cross_high_precision(old_axis, float3(1, 0, 0)); + rotation_axis = float3::cross_high_precision(old_axis, float3(1, 0, 0)); if (is_zero_v3(rotation_axis)) { /* This is now guaranteed to not be zero. */ - rotation_axis = math::cross_high_precision(old_axis, float3(0, 1, 0)); + rotation_axis = float3::cross_high_precision(old_axis, float3(0, 1, 0)); } } diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc index 20f500b1bd8..74dac73f255 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc @@ -81,7 +81,7 @@ static void calculate_mesh_proximity(const VArray<float3> &positions, for (int i : range) { /* Use the distance to the last found point as upper bound to speedup the bvh lookup. */ - nearest.dist_sq = math::distance_squared(float3(nearest.co), positions[i]); + nearest.dist_sq = float3::distance_squared(nearest.co, positions[i]); BLI_bvhtree_find_nearest( bvh_data.tree, positions[i], &nearest, bvh_data.nearest_callback, &bvh_data); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc index a85a7c56cb9..b0210f2eb94 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc @@ -229,7 +229,7 @@ static void get_closest_mesh_corners(const Mesh &mesh, const MLoop &loop = mesh.mloop[loop_index]; const int vertex_index = loop.v; const MVert &mvert = mesh.mvert[vertex_index]; - const float distance_sq = math::distance_squared(position, float3(mvert.co)); + const float distance_sq = float3::distance_squared(position, mvert.co); if (distance_sq < min_distance_sq) { min_distance_sq = distance_sq; closest_loop_index = loop_index; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc index 1e6b7f92a77..8555d7cc8a3 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc @@ -241,13 +241,13 @@ static void copy_uniform_sample_point_attributes(Span<SplinePtr> splines, spline.sample_with_index_factors<float3>( spline.evaluated_tangents(), uniform_samples, data.tangents.slice(offset, size)); for (float3 &tangent : data.tangents) { - tangent = math::normalize(tangent); + tangent.normalize(); } spline.sample_with_index_factors<float3>( spline.evaluated_normals(), uniform_samples, data.normals.slice(offset, size)); for (float3 &normals : data.normals) { - normals = math::normalize(normals); + normals.normalize(); } } }); diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc index c712e82ca18..29eff373d15 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc @@ -321,7 +321,7 @@ BLI_NOINLINE static void interpolate_existing_attributes( continue; } - for (const int UNUSED(i_set_instance) : set_group.transforms.index_range()) { + for ([[maybe_unused]] const int i_set_instance : set_group.transforms.index_range()) { const int offset = instance_start_offsets[i_instance]; Span<float3> bary_coords = bary_coords_array[i_instance]; Span<int> looptri_indices = looptri_indices_array[i_instance]; @@ -516,7 +516,7 @@ static void distribute_points_poisson_disk(Span<GeometryInstanceGroup> set_group const VArray<float> density_factors = component.attribute_get_for_read<float>( density_attribute_name, ATTR_DOMAIN_CORNER, use_one_default ? 1.0f : 0.0f); - for (const int UNUSED(i_set_instance) : set_group.transforms.index_range()) { + for ([[maybe_unused]] const int i_set_instance : set_group.transforms.index_range()) { Vector<float3> &positions = positions_all[i_instance]; Vector<float3> &bary_coords = bary_coords_all[i_instance]; Vector<int> &looptri_indices = looptri_indices_all[i_instance]; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc index f54ffc53a6e..7b1bbed8ae4 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc @@ -161,7 +161,7 @@ static float compute_voxel_size(const GeoNodeExecParams ¶ms, } /* The voxel size adapts to the final size of the volume. */ - const float diagonal = math::distance(min, max); + const float diagonal = float3::distance(min, max); const float extended_diagonal = diagonal + 2.0f * radius; const float voxel_size = extended_diagonal / voxel_amount; return voxel_size; diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc index cfae88e0625..dd03092a594 100644 --- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc +++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc @@ -107,7 +107,7 @@ static void raycast_to_mesh(const Mesh &mesh, for (const int i : ray_origins.index_range()) { const float ray_length = ray_lengths[i]; const float3 ray_origin = ray_origins[i]; - const float3 ray_direction = math::normalize(ray_directions[i]); + const float3 ray_direction = ray_directions[i].normalized(); BVHTreeRayHit hit; hit.index = -1; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc index 929d9046f98..7e09721273a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc @@ -16,7 +16,7 @@ #include "BLI_array.hh" #include "BLI_delaunay_2d.h" -#include "BLI_math_vec_types.hh" +#include "BLI_double2.hh" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc index 68b609f8045..1a44fce86a6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc @@ -122,9 +122,9 @@ static Array<float3> calculate_directions(const Span<float3> positions) Array<float3> directions(size); for (const int i : IndexRange(size - 1)) { - directions[i] = math::normalize(positions[i + 1] - positions[i]); + directions[i] = (positions[i + 1] - positions[i]).normalized(); } - directions[size - 1] = math::normalize(positions[0] - positions[size - 1]); + directions[size - 1] = (positions[0] - positions[size - 1]).normalized(); return directions; } @@ -135,9 +135,9 @@ static Array<float3> calculate_axes(const Span<float3> directions) const int size = directions.size(); Array<float3> axes(size); - axes[0] = math::normalize(math::cross(-directions[size - 1], directions[0])); + axes[0] = float3::cross(-directions[size - 1], directions[0]).normalized(); for (const int i : IndexRange(1, size - 1)) { - axes[i] = math::normalize(math::cross(-directions[i - 1], directions[i])); + axes[i] = float3::cross(-directions[i - 1], directions[i]).normalized(); } return axes; @@ -248,8 +248,8 @@ static void limit_radii(FilletData &fd, const bool cyclic) if (cyclic) { /* Calculate lengths between adjacent control points. */ - const float len_prev = math::distance(positions[0], positions[size - 1]); - const float len_next = math::distance(positions[0], positions[1]); + const float len_prev = float3::distance(positions[0], positions[size - 1]); + const float len_next = float3::distance(positions[0], positions[1]); /* Calculate tangent lengths of fillets in control points. */ const float tan_len = radii[0] * tan(angles[0] / 2.0f); @@ -271,16 +271,16 @@ static void limit_radii(FilletData &fd, const bool cyclic) } /* Initialize max_radii to largest possible radii. */ - float prev_dist = math::distance(positions[1], positions[0]); + float prev_dist = float3::distance(positions[1], positions[0]); for (const int i : IndexRange(1, size - 2)) { - const float temp_dist = math::distance(positions[i], positions[i + 1]); + const float temp_dist = float3::distance(positions[i], positions[i + 1]); max_radii[i] = std::min(prev_dist, temp_dist) / tan(angles[i] / 2.0f); prev_dist = temp_dist; } /* Max radii calculations for each index. */ for (const int i : IndexRange(start, fillet_count - 1)) { - const float len_next = math::distance(positions[i], positions[i + 1]); + const float len_next = float3::distance(positions[i], positions[i + 1]); const float tan_len = radii[i] * tan(angles[i] / 2.0f); const float tan_len_next = radii[i + 1] * tan(angles[i + 1] / 2.0f); @@ -415,8 +415,7 @@ static void update_bezier_positions(const FilletData &fd, const float3 center = get_center(dst_spline.positions()[i_dst] - positions[i_src], fd, i_src); /* Calculate the vector of the radius formed by the first vertex. */ float3 radius_vec = dst_spline.positions()[i_dst] - center; - float radius; - radius_vec = math::normalize_and_get_length(radius_vec, radius); + const float radius = radius_vec.normalize_and_get_length(); dst_spline.handle_types_right().slice(1, count - 2).fill(BezierSpline::HandleType::Align); dst_spline.handle_types_left().slice(1, count - 2).fill(BezierSpline::HandleType::Align); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc index 7b5d1a1dc80..a7fb493c7d7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc @@ -101,8 +101,8 @@ static void node_update(bNodeTree *ntree, bNode *node) static bool colinear_f3_f3_f3(const float3 p1, const float3 p2, const float3 p3) { - const float3 a = math::normalize(p2 - p1); - const float3 b = math::normalize(p3 - p1); + const float3 a = (p2 - p1).normalized(); + const float3 b = (p3 - p1).normalized(); return (ELEM(a, b, b * -1.0f)); } @@ -122,18 +122,18 @@ static std::unique_ptr<CurveEval> create_point_circle_curve( float3 center; /* Midpoints of `P1->P2` and `P2->P3`. */ - const float3 q1 = math::interpolate(p1, p2, 0.5f); - const float3 q2 = math::interpolate(p2, p3, 0.5f); + const float3 q1 = float3::interpolate(p1, p2, 0.5f); + const float3 q2 = float3::interpolate(p2, p3, 0.5f); /* Normal Vectors of `P1->P2` and `P2->P3` */ - const float3 v1 = math::normalize(p2 - p1); - const float3 v2 = math::normalize(p3 - p2); + const float3 v1 = (p2 - p1).normalized(); + const float3 v2 = (p3 - p2).normalized(); /* Normal of plane of main 2 segments P1->P2 and `P2->P3`. */ - const float3 v3 = math::normalize(math::cross(v1, v2)); + const float3 v3 = float3::cross(v1, v2).normalized(); /* Normal of plane of first perpendicular bisector and `P1->P2`. */ - const float3 v4 = math::normalize(math::cross(v3, v1)); + const float3 v4 = float3::cross(v3, v1).normalized(); /* Determine Center-point from the intersection of 3 planes. */ float plane_1[4], plane_2[4], plane_3[4]; @@ -148,7 +148,7 @@ static std::unique_ptr<CurveEval> create_point_circle_curve( } /* Get the radius from the center-point to p1. */ - const float r = math::distance(p1, center); + const float r = float3::distance(p1, center); const float theta_step = ((2 * M_PI) / (float)resolution); for (const int i : IndexRange(resolution)) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc index d35fa0a2fdc..ff9218b1ac2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc @@ -100,7 +100,7 @@ static std::unique_ptr<CurveEval> create_direction_line_curve(const float3 start spline->resize(2); MutableSpan<float3> positions = spline->positions(); positions[0] = start; - positions[1] = math::normalize(direction) * length + start; + positions[1] = direction.normalized() * length + start; spline->radii().fill(1.0f); spline->tilts().fill(0.0f); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc index 885d92a111b..084d27e9d24 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc @@ -58,9 +58,9 @@ static std::unique_ptr<CurveEval> create_quadratic_bezier_curve(const float3 p1, const float step = 1.0f / resolution; for (const int i : IndexRange(resolution + 1)) { const float factor = step * i; - const float3 q1 = math::interpolate(p1, p2, factor); - const float3 q2 = math::interpolate(p2, p3, factor); - positions[i] = math::interpolate(q1, q2, factor); + const float3 q1 = float3::interpolate(p1, p2, factor); + const float3 q2 = float3::interpolate(p2, p3, factor); + positions[i] = float3::interpolate(q1, q2, factor); } curve->add_spline(std::move(spline)); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc index 56fbc50f033..038f7625825 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc @@ -185,7 +185,7 @@ class SampleCurveFunction : public fn::MultiFunction { for (const int i : mask) { const Spline::LookupResult &lookup = lookups[i]; const Span<float3> evaluated_tangents = splines[spline_indices[i]]->evaluated_tangents(); - sampled_tangents[i] = math::normalize(sample_with_lookup(lookup, evaluated_tangents)); + sampled_tangents[i] = sample_with_lookup(lookup, evaluated_tangents).normalized(); } } @@ -193,7 +193,7 @@ class SampleCurveFunction : public fn::MultiFunction { for (const int i : mask) { const Spline::LookupResult &lookup = lookups[i]; const Span<float3> evaluated_normals = splines[spline_indices[i]]->evaluated_normals(); - sampled_normals[i] = math::normalize(sample_with_lookup(lookup, evaluated_normals)); + sampled_normals[i] = sample_with_lookup(lookup, evaluated_normals).normalized(); } } } diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc index 257a5b8df00..40dde645756 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc @@ -96,7 +96,7 @@ static void calculate_nurbs_lengths(const NURBSpline &spline, MutableSpan<float> float length = 0.0f; for (const int i : IndexRange(positions.size() - 1)) { lengths[i] = length; - length += math::distance(positions[i], positions[i + 1]); + length += float3::distance(positions[i], positions[i + 1]); } lengths.last() = length; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc index 19efd4b7508..a8553b636a4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc @@ -285,7 +285,7 @@ static void copy_uniform_sample_point_attributes(const Span<SplinePtr> splines, spline.sample_with_index_factors<float3>( spline.evaluated_tangents(), uniform_samples, data.tangents.slice(offset, size)); for (float3 &tangent : data.tangents) { - tangent = math::normalize(tangent); + tangent.normalize(); } } @@ -293,7 +293,7 @@ static void copy_uniform_sample_point_attributes(const Span<SplinePtr> splines, spline.sample_with_index_factors<float3>( spline.evaluated_normals(), uniform_samples, data.normals.slice(offset, size)); for (float3 &normals : data.normals) { - normals = math::normalize(normals); + normals.normalize(); } } } diff --git a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc index 624a8b6b0f6..28a8fb80294 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc @@ -21,7 +21,7 @@ #include "BKE_image.h" -#include "BLI_math_vec_types.hh" +#include "BLI_float4.hh" #include "BLI_threads.h" #include "BLI_timeit.hh" diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc index e90a9eb393b..5b67258a947 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc @@ -155,7 +155,7 @@ static void calculate_polys(const CuboidConfig &config, /* Calculate polys for Bottom faces. */ int vert_1_start = 0; - for (const int UNUSED(y) : IndexRange(config.edges_y)) { + for ([[maybe_unused]] const int y : IndexRange(config.edges_y)) { for (const int x : IndexRange(config.edges_x)) { const int vert_1 = vert_1_start + x; const int vert_2 = vert_1_start + config.verts_x + x; @@ -173,7 +173,7 @@ static void calculate_polys(const CuboidConfig &config, vert_1_start = 0; int vert_2_start = config.verts_x * config.verts_y; - for (const int UNUSED(z) : IndexRange(config.edges_z)) { + for ([[maybe_unused]] const int z : IndexRange(config.edges_z)) { for (const int x : IndexRange(config.edges_x)) { define_quad(polys, loops, @@ -196,7 +196,7 @@ static void calculate_polys(const CuboidConfig &config, (config.verts_x - 2) * (config.verts_y - 2)); vert_2_start = vert_1_start + config.verts_x; - for (const int UNUSED(y) : IndexRange(config.edges_y)) { + for ([[maybe_unused]] const int y : IndexRange(config.edges_y)) { for (const int x : IndexRange(config.edges_x)) { define_quad(polys, loops, diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc index 8a2b054ece0..5116e78fdda 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc @@ -155,8 +155,8 @@ static void node_geo_exec(GeoNodeExecParams params) if (count_mode == GEO_NODE_MESH_LINE_COUNT_RESOLUTION) { /* Don't allow asymptotic count increase for low resolution values. */ const float resolution = std::max(params.extract_input<float>("Resolution"), 0.0001f); - const int count = math::length(total_delta) / resolution + 1; - const float3 delta = math::normalize(total_delta) * resolution; + const int count = total_delta.length() / resolution + 1; + const float3 delta = total_delta.normalized() * resolution; mesh = create_line_mesh(start, delta, count); } else if (count_mode == GEO_NODE_MESH_LINE_COUNT_TOTAL) { @@ -204,7 +204,7 @@ Mesh *create_line_mesh(const float3 start, const float3 delta, const int count) MutableSpan<MEdge> edges{mesh->medge, mesh->totedge}; short normal[3]; - normal_float_to_short_v3(normal, math::normalize(delta)); + normal_float_to_short_v3(normal, delta.normalized()); for (const int i : verts.index_range()) { copy_v3_v3(verts[i].co, start + delta * i); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc index 373e6bfdd18..41178d5c4e6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc @@ -178,7 +178,7 @@ static void calculate_sphere_faces(MutableSpan<MLoop> loops, int ring_vert_index_start = 1; int ring_edge_index_start = segments; - for (const int UNUSED(ring) : IndexRange(1, rings - 2)) { + for ([[maybe_unused]] const int ring : IndexRange(1, rings - 2)) { const int next_ring_vert_index_start = ring_vert_index_start + segments; const int next_ring_edge_index_start = ring_edge_index_start + segments * 2; const int ring_vertical_edge_index_start = ring_edge_index_start + segments; diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc index c165bcf8e35..dda4543d5e1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc @@ -166,7 +166,7 @@ static float compute_voxel_size(const GeoNodeExecParams ¶ms, } /* The voxel size adapts to the final size of the volume. */ - const float diagonal = math::distance(min, max); + const float diagonal = float3::distance(min, max); const float extended_diagonal = diagonal + 2.0f * radius; const float voxel_size = extended_diagonal / voxel_amount; return voxel_size; diff --git a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc index 772638ef240..e0117c4726d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc @@ -85,7 +85,7 @@ static bool calculate_mesh_proximity(const VArray<float3> &positions, for (int i : range) { const int index = mask[i]; /* Use the distance to the last found point as upper bound to speedup the bvh lookup. */ - nearest.dist_sq = math::distance_squared(float3(nearest.co), positions[index]); + nearest.dist_sq = float3::distance_squared(nearest.co, positions[index]); BLI_bvhtree_find_nearest( bvh_data.tree, positions[index], &nearest, bvh_data.nearest_callback, &bvh_data); diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc index c38503f688c..2c35ca0afc9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc @@ -163,7 +163,7 @@ static void raycast_to_mesh(IndexMask mask, for (const int i : mask) { const float ray_length = ray_lengths[i]; const float3 ray_origin = ray_origins[i]; - const float3 ray_direction = math::normalize(ray_directions[i]); + const float3 ray_direction = ray_directions[i].normalized(); BVHTreeRayHit hit; hit.index = -1; diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc index feab0a6743f..82d09bbc208 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc @@ -106,7 +106,7 @@ static void set_position_in_component(const GeometryNodeCurveHandleMode mode, } } else { - for (int UNUSED(i) : spline->positions().index_range()) { + for ([[maybe_unused]] int i : spline->positions().index_range()) { if (current_mask < selection.size() && selection[current_mask] == current_point) { current_mask++; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc index 6867051ecfe..331460296a6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc @@ -296,7 +296,7 @@ static void get_closest_mesh_corners(const Mesh &mesh, const MLoop &loop = mesh.mloop[loop_index]; const int vertex_index = loop.v; const MVert &mvert = mesh.mvert[vertex_index]; - const float distance_sq = math::distance_squared(position, float3(mvert.co)); + const float distance_sq = float3::distance_squared(position, mvert.co); if (distance_sq < min_distance_sq) { min_distance_sq = distance_sq; closest_loop_index = loop_index; diff --git a/source/blender/nodes/geometry/nodes/node_geo_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_transform.cc index 6187a2eacf9..7f866ea6f4a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_transform.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_transform.cc @@ -37,7 +37,7 @@ namespace blender::nodes { static bool use_translate(const float3 rotation, const float3 scale) { - if (compare_ff(math::length_squared(rotation), 0.0f, 1e-9f) != 1) { + if (compare_ff(rotation.length_squared(), 0.0f, 1e-9f) != 1) { return false; } if (compare_ff(scale.x, 1.0f, 1e-9f) != 1 || compare_ff(scale.y, 1.0f, 1e-9f) != 1 || @@ -49,7 +49,7 @@ static bool use_translate(const float3 rotation, const float3 scale) static void translate_mesh(Mesh &mesh, const float3 translation) { - if (!math::is_zero(translation)) { + if (!translation.is_zero()) { BKE_mesh_translate(&mesh, translation, false); } } |