Mesh: Reduce custom normal calculation memory usage #107592
|
@ -114,8 +114,8 @@ struct CornerNormalSpaceArray {
|
|||
Array<CornerNormalSpace> spaces;
|
||||
|
||||
|
||||
/**
|
||||
* The index of the data in the #spaces array for each face corner.
|
||||
* Rare -1 values define face corners without a coordinate space.
|
||||
* The index of the data in the #spaces array for each face corner (the array size is the
|
||||
* same as #Mesh::totloop). Rare -1 values define face corners without a coordinate space.
|
||||
Campbell Barton
commented
Prefer naming is based on the public function Prefer naming is based on the public function `BKE_lnor_space_custom_normal_to_data` (e.g. `lnor_space_custom_normal_to_data_impl`).
Hans Goudey
commented
Longer term the public functions would be replaced, there was just no need to expose these in Longer term the public functions would be replaced, there was just no need to expose these in `BKE_mesh.hh` yet. But that's fine with me for now.
|
||||
*/
|
||||
Array<int> corner_space_indices;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Prefer to keep the term
loop
here as a corner isn't obviously aligned with the a mesh loops. e.g.loop_space_indices
Doc-string should mention
-1
are used to references loops without a reference to a space-array.Moving away from the term "loop" in general applies here too IMO, the values here are per face corner.
In this case the doc-string should note that this array is aligned with a meshes loops (even if logically it's a face corner the index is a loop index. When reading new code with fresh eyes - lookup tables should not clearly what indexes them and what the they index into (
CornerNormalSpaceArray::spaces
in this case). The termloop index
is currently a meaningful term which communicates alignment).Noting that these values are for each face corner isn't explicitly stating this is aligned with mesh loops which I think its worth noting.
That -1 is used to define values as not yet having an entry in
spaces
(worth noting too), are there actually cases these values will be left at -1 onceCornerNormalSpaceArray
is initialized? If so mention under what condition that happens.To be honest, your use of "aligned with" is a bit confusing to me. It makes me think of memory address alignment, which is a different thing. But I'll make it more clear.
I don't know to be honest. Some existing comments mention that, but it seems a bit paranoid and maybe worth fixing if it happens? Either way, I'm still working on understanding the whole algorithm, so I'm not able to add more details yet.
It seems likely they're never -1 and this is just used to check initialization, since this is updating the existing comment, seems fine to keep as-is.
The exact working I'm not so fussed about although I think it's reasonable to say the
MDeformVert
array is aligned with thevert_positions
(for example), in this case I think it's not talking about memory alignment.Whatever the case, geometry indices might apply to vertices, edges, polygons, loops, looptris... I think it's reasonable that this is always clear if not from the name then the doc-string.
Ah, in that case removing the comment or expanding on it is outside the scope of the patch. It seems possible they're never -1 and this is just used to check initialization.