diff options
author | Pablo Dobarro <pablodp606> | 2020-10-01 19:50:52 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-10-01 20:11:45 +0300 |
commit | 8ef353fa5061f6c393ef3bc96e3e11ae74d8435f (patch) | |
tree | 0581615e528b7482cb859260a58ef87745a6328e /source/blender/blenkernel | |
parent | cd81c38688b6d58b6e59f31a5f35f99899251104 (diff) |
Sculpt: Cloth Simulation Dynamic area mode
This simulation area mode moves the active area with the brush. When
enabled, the cloth brush has no restrictions on stroke length, area or
mesh vertex count.
In order to work, this enables PBVH nodes dynamically for simulation as
the stroke location moves and builds the constraints for new nodes
during the stroke. When a node is not inside the simulated area, all the
constraints that were created for it and vertex collisions are not
computed. The simulation limits falloff areas and constraints tweaking
control how the simulated and no simulated nodes blend.
Reviewed By: sergey, zeddb
Differential Revision: https://developer.blender.org/D8726
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 653c8a752d5..dc2a42e3988 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -256,6 +256,18 @@ typedef struct SculptPoseIKChain { /* Cloth Brush */ +/* Cloth Simulation. */ +typedef enum eSculptClothNodeSimState { + /* Constraints were not built for this node, so it can't be simulated. */ + SCULPT_CLOTH_NODE_UNINITIALIZED, + + /* There are constraints for the geometry in this node, but it should not be simulated. */ + SCULPT_CLOTH_NODE_INACTIVE, + + /* There are constraints for this node and they should be used by the solver. */ + SCULPT_CLOTH_NODE_ACTIVE, +} eSculptClothNodeSimState; + typedef enum eSculptClothConstraintType { /* Constraint that creates the structure of the cloth. */ SCULPT_CLOTH_CONSTRAINT_STRUCTURAL = 0, @@ -282,6 +294,10 @@ typedef struct SculptClothLengthConstraint { float length; float strength; + /* Index in SculptClothSimulation.node_state of the node from where this constraint was created. + * This constraints will only be used by the solver if the state is active. */ + int node; + eSculptClothConstraintType type; } SculptClothLengthConstraint; @@ -308,6 +324,11 @@ typedef struct SculptClothSimulation { float (*last_iteration_pos)[3]; struct ListBase *collider_list; + + int totnode; + /* PBVHNode pointer as a key, index in SculptClothSimulation.node_state as value. */ + struct GHash *node_state_index; + eSculptClothNodeSimState *node_state; } SculptClothSimulation; typedef struct SculptPersistentBase { |