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:
authorJacques Lucke <jacques@blender.org>2021-10-30 17:45:04 +0300
committerJacques Lucke <jacques@blender.org>2021-10-30 17:45:04 +0300
commit03a962d8cab44221650f59eb223cb0a767e05b2b (patch)
tree7ce0a7916fac15afc696f6efa60f704fbc265697
parent02a9377da0da185685896138316c3bdb0623e021 (diff)
parent945a99386b8c86ee45bac83329c98c9034a23ff7 (diff)
Merge branch 'blender-v3.0-release'
-rw-r--r--intern/cycles/session/buffers.cpp2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc41
3 files changed, 33 insertions, 12 deletions
diff --git a/intern/cycles/session/buffers.cpp b/intern/cycles/session/buffers.cpp
index 51d9c1e5d8f..5c9e097e5b1 100644
--- a/intern/cycles/session/buffers.cpp
+++ b/intern/cycles/session/buffers.cpp
@@ -257,7 +257,7 @@ bool BufferParams::modified(const BufferParams &other) const
}
if (layer != other.layer || view != other.view) {
- return false;
+ return true;
}
if (exposure != other.exposure ||
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 fcd82170a8a..312ea7df919 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
@@ -32,7 +32,7 @@ namespace blender::nodes {
static void geo_node_points_to_volume_declare(NodeDeclarationBuilder &b)
{
- b.add_input<decl::Geometry>(N_("Points")).supported_type(GEO_COMPONENT_TYPE_POINT_CLOUD);
+ b.add_input<decl::Geometry>(N_("Points"));
b.add_input<decl::Float>(N_("Density")).default_value(1.0f).min(0.0f);
b.add_input<decl::Float>(N_("Voxel Size")).default_value(0.3f).min(0.01f).subtype(PROP_DISTANCE);
b.add_input<decl::Float>(N_("Voxel Amount")).default_value(64.0f).min(0.0f);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc
index 26814e27d33..abf44b1aaf8 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc
@@ -55,22 +55,43 @@ static void rotate_instances(GeoNodeExecParams &params, InstancesComponent &inst
for (const int i_selection : range) {
const int i = selection[i_selection];
const float3 pivot = pivots[i];
+ const float3 euler = rotations[i];
float4x4 &instance_transform = instance_transforms[i];
- const float4x4 rotation_matrix = float4x4::from_loc_eul_scale(
- {0, 0, 0}, rotations[i], {1, 1, 1});
+
+ float4x4 rotation_matrix;
+ float3 used_pivot;
if (local_spaces[i]) {
- instance_transform *= float4x4::from_location(pivot);
- instance_transform *= rotation_matrix;
- instance_transform *= float4x4::from_location(-pivot);
+ /* Find rotation axis from the matrix. This should work even if the instance is skewed. */
+ const float3 rotation_axis_x = instance_transform.values[0];
+ const float3 rotation_axis_y = instance_transform.values[1];
+ const float3 rotation_axis_z = instance_transform.values[2];
+
+ /* Create rotations around the individual axis. This could be optimized to skip some axis
+ * when the angle is zero. */
+ float rotation_x[3][3], rotation_y[3][3], rotation_z[3][3];
+ axis_angle_to_mat3(rotation_x, rotation_axis_x, euler.x);
+ axis_angle_to_mat3(rotation_y, rotation_axis_y, euler.y);
+ axis_angle_to_mat3(rotation_z, rotation_axis_z, euler.z);
+
+ /* Combine the previously computed rotations into the final rotation matrix. */
+ float rotation[3][3];
+ mul_m3_series(rotation, rotation_z, rotation_y, rotation_x);
+ copy_m4_m3(rotation_matrix.values, rotation);
+
+ /* Transform the passed in pivot into the local space of the instance. */
+ used_pivot = instance_transform * pivot;
}
else {
- const float4x4 orgiginal_transform = instance_transform;
- instance_transform = float4x4::from_location(pivot);
- instance_transform *= rotation_matrix;
- instance_transform *= float4x4::from_location(-pivot);
- instance_transform *= orgiginal_transform;
+ used_pivot = pivot;
+ eul_to_mat4(rotation_matrix.values, euler);
}
+ /* Move the pivot to the origin so that we can rotate around it. */
+ sub_v3_v3(instance_transform.values[3], used_pivot);
+ /* Perform the actual rotation. */
+ mul_m4_m4_pre(instance_transform.values, rotation_matrix.values);
+ /* Undo the pivot shifting done before. */
+ add_v3_v3(instance_transform.values[3], used_pivot);
}
});
}