The official Blender project repository.
Go to file
Hans Goudey 16fbadde36 Mesh: Replace MLoop struct with generic attributes
Implements #102359.

Split the `MLoop` struct into two separate integer arrays called
`corner_verts` and `corner_edges`, referring to the vertex each corner
is attached to and the next edge around the face at each corner. These
arrays can be sliced to give access to the edges or vertices in a face.
Then they are often referred to as "poly_verts" or "poly_edges".

The main benefits are halving the necessary memory bandwidth when only
one array is used and simplifications from using regular integer indices
instead of a special-purpose struct.

The commit also starts a renaming from "loop" to "corner" in mesh code.

Like the other mesh struct of array refactors, forward compatibility is
kept by writing files with the older format. This will be done until 4.0
to ease the transition process.

Looking at a small portion of the patch should give a good impression
for the rest of the changes. I tried to make the changes as small as
possible so it's easy to tell the correctness from the diff. Though I
found Blender developers have been very inventive over the last decade
when finding different ways to loop over the corners in a face.

For performance, nearly every piece of code that deals with `Mesh` is
slightly impacted. Any algorithm that is memory bottle-necked should
see an improvement. For example, here is a comparison of interpolating
a vertex float attribute to face corners (Ryzen 3700x):

**Before** (Average: 3.7 ms, Min: 3.4 ms)
```
threading::parallel_for(loops.index_range(), 4096, [&](IndexRange range) {
  for (const int64_t i : range) {
    dst[i] = src[loops[i].v];
  }
});
```

**After** (Average: 2.9 ms, Min: 2.6 ms)
```
array_utils::gather(src, corner_verts, dst);
```

That's an improvement of 28% to the average timings, and it's also a
simplification, since an index-based routine can be used instead.
For more examples using the new arrays, see the design task.

Pull Request: blender/blender#104424
2023-03-20 15:55:13 +01:00
.gitea Merge branch 'blender-v3.5-release' into main 2023-03-07 13:23:43 +01:00
.github Docs: change Git URLs to point projects.blender.org instead of git.blender.org 2023-02-07 14:23:05 +01:00
build_files Merge branch 'blender-v3.5-release' 2023-03-17 18:12:20 +01:00
doc Merge branch 'blender-v3.5-release' 2023-03-07 20:06:05 -05:00
extern Extern: Update TinyGLTF to include fix for CVE-2022-3008 2023-03-10 14:56:35 +01:00
intern Mesh: Replace MLoop struct with generic attributes 2023-03-20 15:55:13 +01:00
locale Updated from SVN trunk (r6393). 2023-03-20 14:46:54 +01:00
release Refactor: U.dpi_fac -> U.scale_factor 2023-03-17 04:19:05 +01:00
scripts Nodes: SDF Volume nodes milestone 1 2023-03-19 11:21:08 +01:00
source Mesh: Replace MLoop struct with generic attributes 2023-03-20 15:55:13 +01:00
tests Merge branch 'blender-v3.5-release' 2023-03-20 15:30:14 +01:00
tools Cleanup: spelling in comments 2023-03-10 12:58:10 +11:00
.clang-format Cleanup: EEVEE-Next: Add LIGHT_FOREACH macros to clang-format exceptions 2023-02-12 01:41:54 +01:00
.clang-tidy Clang-tidy: Ignore variable name length and .c/.cc include warnings 2022-05-06 15:26:54 +02:00
.editorconfig pyproject: add configuration for autopep8 2022-04-22 10:13:39 +10:00
.git-blame-ignore-revs Cleanup: git-blame-ignore-revs: Update policy & commits 2021-01-29 13:20:32 +05:30
.gitignore Ignore build files for VS and VS Code 2023-03-07 17:38:34 +01:00
CMakeLists.txt Treat -Wunguarded-availability-new as an error 2023-03-17 10:45:03 +01:00
COPYING == docs == 2010-10-13 14:44:22 +00:00
GNUmakefile Re-design of submodules used in blender.git 2023-02-21 16:39:58 +01:00
make.bat make.bat: adjust for recent submodule changes 2023-03-16 17:51:12 -06:00
pyproject.toml pyproject: remove tools/pyproject.toml 2023-03-01 22:18:28 +11:00
README.md Update references to the new projects platform and main branch 2023-02-07 14:18:19 +01:00

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.

Blender screenshot

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.