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/nodes/geometry')
-rw-r--r--source/blender/nodes/geometry/node_geometry_util.hh4
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc8
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_distribute.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_fill.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc21
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc18
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_line.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_spline_parameter.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_image_texture.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_proximity.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_raycast.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transform.cc4
26 files changed, 59 insertions, 58 deletions
diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh
index 1c2a8f521c0..e063be62987 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_float3.hh"
+#include "BLI_math_vec_types.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,
- GeometryNodeMeshCircleFillType fill_type,
+ const 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 36ad4605a4b..1d064586238 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 = vector.normalized();
- float3 rotation_axis = float3::cross_high_precision(old_axis, new_axis);
+ const float3 new_axis = math::normalize(vector);
+ float3 rotation_axis = math::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 = float3::cross_high_precision(old_axis, float3(1, 0, 0));
+ rotation_axis = math::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 = float3::cross_high_precision(old_axis, float3(0, 1, 0));
+ rotation_axis = math::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 74dac73f255..20f500b1bd8 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 = float3::distance_squared(nearest.co, positions[i]);
+ nearest.dist_sq = math::distance_squared(float3(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 b0210f2eb94..a85a7c56cb9 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 = float3::distance_squared(position, mvert.co);
+ const float distance_sq = math::distance_squared(position, float3(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 8555d7cc8a3..1e6b7f92a77 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.normalize();
+ tangent = math::normalize(tangent);
}
spline.sample_with_index_factors<float3>(
spline.evaluated_normals(), uniform_samples, data.normals.slice(offset, size));
for (float3 &normals : data.normals) {
- normals.normalize();
+ normals = math::normalize(normals);
}
}
});
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 29eff373d15..c712e82ca18 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 ([[maybe_unused]] const int i_set_instance : set_group.transforms.index_range()) {
+ for (const int UNUSED(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 ([[maybe_unused]] const int i_set_instance : set_group.transforms.index_range()) {
+ for (const int UNUSED(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 7b1bbed8ae4..f54ffc53a6e 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 &params,
}
/* The voxel size adapts to the final size of the volume. */
- const float diagonal = float3::distance(min, max);
+ const float diagonal = math::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 dd03092a594..cfae88e0625 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 = ray_directions[i].normalized();
+ const float3 ray_direction = math::normalize(ray_directions[i]);
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 7e09721273a..929d9046f98 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_double2.hh"
+#include "BLI_math_vec_types.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 1a44fce86a6..68b609f8045 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] = (positions[i + 1] - positions[i]).normalized();
+ directions[i] = math::normalize(positions[i + 1] - positions[i]);
}
- directions[size - 1] = (positions[0] - positions[size - 1]).normalized();
+ directions[size - 1] = math::normalize(positions[0] - positions[size - 1]);
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] = float3::cross(-directions[size - 1], directions[0]).normalized();
+ axes[0] = math::normalize(math::cross(-directions[size - 1], directions[0]));
for (const int i : IndexRange(1, size - 1)) {
- axes[i] = float3::cross(-directions[i - 1], directions[i]).normalized();
+ axes[i] = math::normalize(math::cross(-directions[i - 1], directions[i]));
}
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 = float3::distance(positions[0], positions[size - 1]);
- const float len_next = float3::distance(positions[0], positions[1]);
+ const float len_prev = math::distance(positions[0], positions[size - 1]);
+ const float len_next = math::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 = float3::distance(positions[1], positions[0]);
+ float prev_dist = math::distance(positions[1], positions[0]);
for (const int i : IndexRange(1, size - 2)) {
- const float temp_dist = float3::distance(positions[i], positions[i + 1]);
+ const float temp_dist = math::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 = float3::distance(positions[i], positions[i + 1]);
+ const float len_next = math::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,7 +415,8 @@ 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;
- const float radius = radius_vec.normalize_and_get_length();
+ float radius;
+ radius_vec = math::normalize_and_get_length(radius_vec, radius);
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 a7fb493c7d7..7b5d1a1dc80 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 = (p2 - p1).normalized();
- const float3 b = (p3 - p1).normalized();
+ const float3 a = math::normalize(p2 - p1);
+ const float3 b = math::normalize(p3 - p1);
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 = float3::interpolate(p1, p2, 0.5f);
- const float3 q2 = float3::interpolate(p2, p3, 0.5f);
+ const float3 q1 = math::interpolate(p1, p2, 0.5f);
+ const float3 q2 = math::interpolate(p2, p3, 0.5f);
/* Normal Vectors of `P1->P2` and `P2->P3` */
- const float3 v1 = (p2 - p1).normalized();
- const float3 v2 = (p3 - p2).normalized();
+ const float3 v1 = math::normalize(p2 - p1);
+ const float3 v2 = math::normalize(p3 - p2);
/* Normal of plane of main 2 segments P1->P2 and `P2->P3`. */
- const float3 v3 = float3::cross(v1, v2).normalized();
+ const float3 v3 = math::normalize(math::cross(v1, v2));
/* Normal of plane of first perpendicular bisector and `P1->P2`. */
- const float3 v4 = float3::cross(v3, v1).normalized();
+ const float3 v4 = math::normalize(math::cross(v3, v1));
/* 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 = float3::distance(p1, center);
+ const float r = math::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 ff9218b1ac2..d35fa0a2fdc 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] = direction.normalized() * length + start;
+ positions[1] = math::normalize(direction) * 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 084d27e9d24..885d92a111b 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 = float3::interpolate(p1, p2, factor);
- const float3 q2 = float3::interpolate(p2, p3, factor);
- positions[i] = float3::interpolate(q1, q2, factor);
+ const float3 q1 = math::interpolate(p1, p2, factor);
+ const float3 q2 = math::interpolate(p2, p3, factor);
+ positions[i] = math::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 038f7625825..56fbc50f033 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] = sample_with_lookup(lookup, evaluated_tangents).normalized();
+ sampled_tangents[i] = math::normalize(sample_with_lookup(lookup, evaluated_tangents));
}
}
@@ -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] = sample_with_lookup(lookup, evaluated_normals).normalized();
+ sampled_normals[i] = math::normalize(sample_with_lookup(lookup, evaluated_normals));
}
}
}
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 40dde645756..257a5b8df00 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 += float3::distance(positions[i], positions[i + 1]);
+ length += math::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 a8553b636a4..19efd4b7508 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.normalize();
+ tangent = math::normalize(tangent);
}
}
@@ -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.normalize();
+ normals = math::normalize(normals);
}
}
}
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 28a8fb80294..624a8b6b0f6 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_float4.hh"
+#include "BLI_math_vec_types.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 5b67258a947..e90a9eb393b 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 ([[maybe_unused]] const int y : IndexRange(config.edges_y)) {
+ for (const int UNUSED(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 ([[maybe_unused]] const int z : IndexRange(config.edges_z)) {
+ for (const int UNUSED(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 ([[maybe_unused]] const int y : IndexRange(config.edges_y)) {
+ for (const int UNUSED(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 5116e78fdda..8a2b054ece0 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 = total_delta.length() / resolution + 1;
- const float3 delta = total_delta.normalized() * resolution;
+ const int count = math::length(total_delta) / resolution + 1;
+ const float3 delta = math::normalize(total_delta) * 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, delta.normalized());
+ normal_float_to_short_v3(normal, math::normalize(delta));
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 41178d5c4e6..373e6bfdd18 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 ([[maybe_unused]] const int ring : IndexRange(1, rings - 2)) {
+ for (const int UNUSED(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 dda4543d5e1..c165bcf8e35 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 &params,
}
/* The voxel size adapts to the final size of the volume. */
- const float diagonal = float3::distance(min, max);
+ const float diagonal = math::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 e0117c4726d..772638ef240 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 = float3::distance_squared(nearest.co, positions[index]);
+ nearest.dist_sq = math::distance_squared(float3(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 2c35ca0afc9..c38503f688c 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 = ray_directions[i].normalized();
+ const float3 ray_direction = math::normalize(ray_directions[i]);
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 82d09bbc208..feab0a6743f 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 ([[maybe_unused]] int i : spline->positions().index_range()) {
+ for (int UNUSED(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 331460296a6..6867051ecfe 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 = float3::distance_squared(position, mvert.co);
+ const float distance_sq = math::distance_squared(position, float3(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 7f866ea6f4a..6187a2eacf9 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(rotation.length_squared(), 0.0f, 1e-9f) != 1) {
+ if (compare_ff(math::length_squared(rotation), 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 (!translation.is_zero()) {
+ if (!math::is_zero(translation)) {
BKE_mesh_translate(&mesh, translation, false);
}
}