Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2021-07-14 22:51:59 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-07-16 16:12:00 +0300
commit1ab6d5c1dcbeebc0794999d358d483f0b6cac67f (patch)
treed5e8f4dc7415a5fa21365482970f55ab0153251c /source/blender/makesdna/DNA_modifier_types.h
parenta770faa811ee62837eb540b0bd83ca0770f16663 (diff)
Surface Deform: support sparse binding mode for improving performance.
When a vertex group is used to limit the influence of the modifier to a subset of vertices, binding data for vertices with zero weight is not needed. This wastes memory, disk space and CPU cycles. If the vertex group contents is known to be final and constant, it is reasonable to optimize by only storing data group vertices. This has to be an option in case the group can change. Supporting this requires adding a vertex index field and spliting the vertex count into mesh and bind variants, but both happen to fit in available padding. The old numverts field is renamed to the new bound vertex count field to maintain the array length invariant. Versioning is used to initialize the other new fields. If a file with sparse binding is opened in an old blender version, it is corrupted into a non-sparse bind with vertex count mismatch, preventing the modifier from working until rebind. Differential Revision: https://developer.blender.org/D11924
Diffstat (limited to 'source/blender/makesdna/DNA_modifier_types.h')
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 1c765d19ce2..401b49f2ee8 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -2180,7 +2180,7 @@ typedef struct SDefBind {
typedef struct SDefVert {
SDefBind *binds;
unsigned int numbinds;
- char _pad[4];
+ unsigned int vertex_idx;
} SDefVert;
typedef struct SurfaceDeformModifierData {
@@ -2192,11 +2192,10 @@ typedef struct SurfaceDeformModifierData {
/** Vertex bind data. */
SDefVert *verts;
float falloff;
- unsigned int numverts, numpoly;
+ unsigned int num_mesh_verts, num_bind_verts, numpoly;
int flags;
float mat[4][4];
float strength;
- char _pad[4];
char defgrp_name[64];
} SurfaceDeformModifierData;
@@ -2204,10 +2203,9 @@ typedef struct SurfaceDeformModifierData {
enum {
/* This indicates "do bind on next modifier evaluation" as well as "is bound". */
MOD_SDEF_BIND = (1 << 0),
- MOD_SDEF_INVERT_VGROUP = (1 << 1)
-
- /* MOD_SDEF_USES_LOOPTRI = (1 << 1), */ /* UNUSED */
- /* MOD_SDEF_HAS_CONCAVE = (1 << 2), */ /* UNUSED */
+ MOD_SDEF_INVERT_VGROUP = (1 << 1),
+ /* Only store bind data for nonzero vgroup weights at the time of bind. */
+ MOD_SDEF_SPARSE_BIND = (1 << 2),
};
/* Surface Deform vertex bind modes */