Mesh: Reduce custom normal calculation memory usage #107592

Merged
Hans Goudey merged 32 commits from HooglyBoogly/blender:corner-normals-refactor-storage into main 2023-05-10 14:41:16 +02:00
1 changed files with 12 additions and 5 deletions
Showing only changes of commit ec4ebb8691 - Show all commits

View File

@ -1408,17 +1408,24 @@ void normals_calc_loop(const Span<float3> vert_positions,
}
});
for (const int i : corner_verts.index_range()) {
std::cout << "Corner " << i << '\n';
std::cout << " Vert: " << corner_verts[i] << '\n';
std::cout << " Normal: " << r_loop_normals[i] << '\n';
for (const int corner : corner_verts.index_range()) {

It's not obvious what r_offsets & r_reverse_indices represent, which should be stated in plan text (in this doc-string).

Or, wrap reverse_index_array in a function which takes lnors_spacearr and include a description of what the values represent there.

Either way noting that fan_corners_data & fan_corner_offset_indices represent inline isn't practical as they're declared twice.

It's not obvious what `r_offsets` & `r_reverse_indices` represent, which should be stated in plan text (in this doc-string). Or, wrap `reverse_index_array` in a function which takes `lnors_spacearr` and include a description of what the values represent there. Either way noting that `fan_corners_data` & `fan_corner_offset_indices` represent inline isn't practical as they're declared twice.
std::cout << "Corner " << corner << '\n';
std::cout << " Vert: " << corner_verts[corner] << '\n';
std::cout << " Normal: " << r_loop_normals[corner] << '\n';
if (r_lnors_spacearr) {
const NormalFanSpace &space =
r_lnors_spacearr->spaces[r_lnors_spacearr->corner_space_indices[i]];
r_lnors_spacearr->spaces[r_lnors_spacearr->corner_space_indices[corner]];
std::cout << " vec_ref: " << space.vec_ref << '\n';
std::cout << " vec_ortho: " << space.vec_ortho << '\n';
std::cout << " ref_alpha: " << space.ref_alpha << '\n';
std::cout << " ref_beta: " << space.ref_beta << '\n';
std::cout << " fan indices: (";
int iter = r_lnors_spacearr->corner_group_lists[corner];
while (iter != -1) {
std::cout << iter << ", ";
iter = r_lnors_spacearr->corner_group_lists[iter];
}
std::cout << ")\n";
}
}
}