6a829d78fa6d1fd1e4a76474e16d00632e74a09a
Rewrite the "mesh is valid" and "validate mesh" functions to be more agnostic of the custom data storage system, align with the changes to topology storage in the last 5 years, be much clearer overall, more reusable. Each check is implemented as a separate pass over the remaining valid geometry in the mesh, producing an IndexMask of the invalid elements it finds. At the cost of some extra iteration over mesh elements, this should make each requirement clearer and make it easier to optimize and reuse each check if needed. The code is roughly twice as fast as it was before. I measured 92ms instead of 200ms for a 1 million vertex cube on a Ryzen 7950X. There's a bit of low hanging fruit for further optimization too. There are now automated tests just for the validation code as well. For now they are very basic but they could be extended in the future. Some non-obvious points: - The new face offsets storage (replacing `MPoly`) upholds more invariants by itself. Previously faces could easily overlap or leave corners unreferenced. That doesn't really happen anymore, but bad offset values are a more "global" problem. - The validation code for the old "MFace" storage was removed. It is just rebuilt when it's needed at runtime anyway, so there isn't much point in validating it. - The versioning code for 2.90.1 was calling the mesh validation code to fix an issue where the extrude manifold tool could generate bad faces. Unfortunately keeping that would mean being unable to remove the old code, so now there's a warning to open and save the file in a previous version instead. - One of the main goals of the new code is better const correctness, and working better with implicit sharing. The code now only requests mutable copies of the mesh data if it has to change. Part of #122398 Pull Request: https://projects.blender.org/blender/blender/pulls/148063
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline—modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
