diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_cloth.h')
-rw-r--r-- | source/blender/blenkernel/BKE_cloth.h | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 757d63e6ec1..beb4f226aea 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -41,7 +41,10 @@ struct Scene; struct MFace; struct DerivedMesh; struct ClothModifierData; +struct CollisionModifierData; struct CollisionTree; +struct VoxelData; +struct PartDeflect; #define DO_INLINE MALWAYS_INLINE @@ -53,8 +56,26 @@ struct CollisionTree; #define ALMOST_ZERO FLT_EPSILON /* Bits to or into the ClothVertex.flags. */ -#define CLOTH_VERT_FLAG_PINNED 1 -#define CLOTH_VERT_FLAG_NOSELFCOLL 2 /* vertex NOT used for self collisions */ +typedef enum eClothVertexFlag { + CLOTH_VERT_FLAG_PINNED = 1, + CLOTH_VERT_FLAG_NOSELFCOLL = 2, /* vertex NOT used for self collisions */ +} eClothVertexFlag; + +typedef struct ClothHairData { + float loc[3]; + float rot[3][3]; + float rest_target[3]; /* rest target direction for each segment */ + float radius; + float bending_stiffness; +} ClothHairData; + +typedef struct ClothSolverResult { + int status; + + int max_iterations, min_iterations; + float avg_iterations; + float max_error, min_error, avg_error; +} ClothSolverResult; /** * This structure describes a cloth object against which the @@ -79,7 +100,6 @@ typedef struct Cloth { struct BVHTree *bvhselftree; /* collision tree for this cloth object */ struct MFace *mfaces; struct Implicit_Data *implicit; /* our implicit solver connects to this pointer */ - struct Implicit_Data *implicitEM; /* our implicit solver connects to this pointer */ struct EdgeSet *edgeset; /* used for selfcollisions */ int last_frame, pad4; } Cloth; @@ -116,8 +136,8 @@ ClothVertex; typedef struct ClothSpring { int ij; /* Pij from the paper, one end of the spring. */ int kl; /* Pkl from the paper, one end of the spring. */ + int mn; float restlen; /* The original length of the spring. */ - int matrix_index; /* needed for implicit solver (fast lookup) */ int type; /* types defined in BKE_cloth.h ("springType") */ int flags; /* defined in BKE_cloth.h, e.g. deactivated due to tearing */ float dfdx[3][3]; @@ -125,6 +145,9 @@ typedef struct ClothSpring { float f[3]; float stiffness; /* stiffness factor from the vertex groups */ float editrestlen; + + /* angular bending spring target and derivatives */ + float target[3]; } ClothSpring; @@ -158,6 +181,7 @@ typedef enum { typedef enum { CLOTH_COLLSETTINGS_FLAG_ENABLED = ( 1 << 1 ), /* enables cloth - object collisions */ CLOTH_COLLSETTINGS_FLAG_SELF = ( 1 << 2 ), /* enables selfcollisions */ + CLOTH_COLLSETTINGS_FLAG_POINTS = ( 1 << 3 ), /* enables point collisions (hair) */ } CLOTH_COLLISIONSETTINGS_FLAGS; /* Spring types as defined in the paper.*/ @@ -166,7 +190,8 @@ typedef enum { CLOTH_SPRING_TYPE_SHEAR = (1 << 2), CLOTH_SPRING_TYPE_BENDING = (1 << 3), CLOTH_SPRING_TYPE_GOAL = (1 << 4), - CLOTH_SPRING_TYPE_SEWING = (1 << 5) + CLOTH_SPRING_TYPE_SEWING = (1 << 5), + CLOTH_SPRING_TYPE_BENDING_ANG = (1 << 6), } CLOTH_SPRING_TYPES; /* SPRING FLAGS */ @@ -180,21 +205,25 @@ typedef enum { // collision.c //////////////////////////////////////////////// +struct CollPair; + +typedef struct ColliderContacts { + struct Object *ob; + struct CollisionModifierData *collmd; + + struct CollPair *collisions; + int totcollisions; +} ColliderContacts; + // needed for implicit.c int cloth_bvh_objcollision (struct Object *ob, struct ClothModifierData *clmd, float step, float dt ); +int cloth_points_objcollision(struct Object *ob, struct ClothModifierData *clmd, float step, float dt); -//////////////////////////////////////////////// - +void cloth_find_point_contacts(struct Object *ob, struct ClothModifierData *clmd, float step, float dt, + ColliderContacts **r_collider_contacts, int *r_totcolliders); +void cloth_free_contacts(ColliderContacts *collider_contacts, int totcolliders); //////////////////////////////////////////////// -// implicit.c -//////////////////////////////////////////////// - -// needed for cloth.c -int implicit_init (struct Object *ob, struct ClothModifierData *clmd ); -int implicit_free (struct ClothModifierData *clmd ); -int implicit_solver (struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors ); -void implicit_set_positions (struct ClothModifierData *clmd ); ///////////////////////////////////////////////// // cloth.c @@ -218,27 +247,9 @@ void cloth_clear_cache (struct Object *ob, struct ClothModifierData *clmd, float // needed for cloth.c int cloth_add_spring (struct ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type); -//////////////////////////////////////////////// - - -/* This enum provides the IDs for our solvers. */ -// only one available in the moment -typedef enum { - CM_IMPLICIT = 0, -} CM_SOLVER_ID; - - -/* This structure defines how to call the solver. - */ -typedef struct { - const char *name; - CM_SOLVER_ID id; - int ( *init ) (struct Object *ob, struct ClothModifierData *clmd ); - int ( *solver ) (struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors ); - int ( *free ) (struct ClothModifierData *clmd ); -} -CM_SOLVER_DEF; +void cloth_parallel_transport_hair_frame(float mat[3][3], const float dir_old[3], const float dir_new[3]); +//////////////////////////////////////////////// #endif |