Fix #109599: Setting custom normals can skip marking some edges sharp

Caused by a subtle logic change in 17d161f565 and follow ups.

Because they used to be stored in a singly-linked list, the old storage
for `corners_by_space` was backwards compared to the order each corner
was discovered in `split_loop_nor_fan_do`. I don't fully understand how
yet, but the logic when setting edges sharp based on divergence between
neighboring corner normals in a space relied on the iteration direction,
so as a fix, just iterate backwards over the corners in each space.
This commit is contained in:
Hans Goudey
2023-09-27 13:47:25 -04:00
parent 8774b20477
commit 7449f0e14c

View File

@@ -1450,7 +1450,8 @@ static void mesh_normals_loop_custom_set(Span<float3> positions,
int prev_corner = -1;
const float *org_nor = nullptr;
for (const int lidx : fan_corners) {
for (int i = fan_corners.index_range().last(); i >= 0; i--) {
const int lidx = fan_corners[i];
float *nor = r_custom_loop_normals[lidx];
if (!org_nor) {