c539ea792c39436187a0cf373612edd651802238
During the painting operation, the `GreasePencilDrawing` is updated in-place. Previously, we simply tagged the whole drawing for a topology update. This meant that the triangulation and curve normals were recomputed for (pretty much) every new input sample. Since the draw tool only creates one new stroke, we can copy the triangulation of all the other strokes and only recompute the triangulation of the newly drawn stroke(s). First, a new `triangle_offsets_cache` is added that is lazily computed. The computation for this should be pretty cheap. Then, a new function `Drawing::tag_topology_changed(const IndexMask &curves_to_update)` is added. This function takes an index mask of curves and only updates their triangle cache. The cache for the other curves is copied. In a test file with around 400k points, recomputing the triangle cache (every input sample) took around 45ms. This meant that there was a noticable drop in frame rate. With this patch, the time for each sample goes down to less than 0.1ms. The frame rate feels much better. But, drawing a longer and longer stroke still makes this time go up, because the triangulation for the single stroke becomes more and more expensive. This will have to be improved further. Part of #124149. Pull Request: https://projects.blender.org/blender/blender/pulls/129115
…
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%
