Cleanup: Simplify realizing of pointcloud instances

Just a small change to make the function slightly shorter.
This commit is contained in:
Hans Goudey
2021-07-16 15:29:42 -04:00
parent 0793ced8ad
commit 118803893e

View File

@@ -565,6 +565,7 @@ static PointCloud *join_pointcloud_position_attribute(Span<GeometryInstanceGroup
}
PointCloud *new_pointcloud = BKE_pointcloud_new_nomain(totpoint);
MutableSpan new_positions{(float3 *)new_pointcloud->co, new_pointcloud->totpoint};
/* Transform each instance's point locations into the new point cloud. */
int offset = 0;
@@ -576,9 +577,7 @@ static PointCloud *join_pointcloud_position_attribute(Span<GeometryInstanceGroup
}
for (const float4x4 &transform : set_group.transforms) {
for (const int i : IndexRange(pointcloud->totpoint)) {
const float3 old_position = pointcloud->co[i];
const float3 new_position = transform * old_position;
copy_v3_v3(new_pointcloud->co[offset + i], new_position);
new_positions[offset + i] = transform * float3(pointcloud->co[i]);
}
offset += pointcloud->totpoint;
}