diff options
author | Jacques Lucke <jacques@blender.org> | 2021-06-14 12:07:31 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-06-14 12:07:42 +0300 |
commit | a19c9e9351cacdc9a7ab4e4177c2e3ae83166cd8 (patch) | |
tree | f0cdfb7147a4968eb29c3b07757ec03e207e73d3 /source | |
parent | 2db09f67a4f1129579e311c359aa0ea844fde5e5 (diff) |
Fix T88947: invalid normals when converting point cloud to mesh
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/geometry_set_instances.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc index 69840ba1612..847df75c8cb 100644 --- a/source/blender/blenkernel/intern/geometry_set_instances.cc +++ b/source/blender/blenkernel/intern/geometry_set_instances.cc @@ -472,6 +472,11 @@ static Mesh *join_mesh_topology_and_builtin_attributes(Span<GeometryInstanceGrou poly_offset += mesh.totpoly; } } + + const float3 point_normal{0.0f, 0.0f, 1.0f}; + short point_normal_short[3]; + normal_float_to_short_v3(point_normal_short, point_normal); + if (convert_points_to_vertices && set.has_pointcloud()) { const PointCloud &pointcloud = *set.get_pointcloud_for_read(); for (const float4x4 &transform : set_group.transforms) { @@ -480,6 +485,7 @@ static Mesh *join_mesh_topology_and_builtin_attributes(Span<GeometryInstanceGrou const float3 old_position = pointcloud.co[i]; const float3 new_position = transform * old_position; copy_v3_v3(new_vert.co, new_position); + memcpy(&new_vert.no, point_normal_short, sizeof(point_normal_short)); } vert_offset += pointcloud.totpoint; } |