36# include "eltopo-capi.h"
63 const bool moving_bvh)
98 for (
int i = 0; i < tri_num; i++) {
101 copy_v3_v3(co[0], positions[vert_tris[i][0]]);
102 copy_v3_v3(co[1], positions[vert_tris[i][1]]);
103 copy_v3_v3(co[2], positions[vert_tris[i][2]]);
115 const float (*positions)[3],
116 const float (*positions_moving)[3],
122 if ((bvhtree ==
nullptr) || (positions ==
nullptr)) {
126 if (positions_moving ==
nullptr) {
130 for (
int i = 0; i < tri_num; i++) {
134 copy_v3_v3(co[0], positions[vert_tris[i][0]]);
135 copy_v3_v3(co[1], positions[vert_tris[i][1]]);
136 copy_v3_v3(co[2], positions[vert_tris[i][2]]);
140 float co_moving[3][3];
142 copy_v3_v3(co_moving[0], positions_moving[vert_tris[i][0]]);
143 copy_v3_v3(co_moving[1], positions_moving[vert_tris[i][1]]);
144 copy_v3_v3(co_moving[2], positions_moving[vert_tris[i][2]]);
167 return (++i < 3) ? i : 0;
185 float tmp_co1[3], tmp_co2[3];
186 float isect_a[3], isect_b[3];
187 float tmp, tmp_vec[3];
188 float normal[3], cent[3];
189 bool backside =
false;
200 int tri_a_edge_isect_count;
202 a,
b, isect_a, isect_b, &tri_a_edge_isect_count);
209 if (!is_intersecting) {
210 for (
int i = 0; i < 3; i++) {
212 if (
dot_v3v3(tmp_vec, normal) < 0.0f) {
218 else if (tri_a_edge_isect_count != 1) {
223 else if (use_normal) {
227 if (tri_a_edge_isect_count == 1) {
243 float maxdist = 0.0f;
247 for (
int i = 0; i < 3; i++) {
260 for (
int i = 0; i < 3; i++) {
274 for (
int i = 0; i < 3; i++) {
280 for (
int j = 0; j < 3; j++) {
289 if ((tmp > maxdist) && (
dot_v3v3(tmp_vec, normal) < 0.0f)) {
304 if (
dot_v3v3(normal, r_vec) >= 0.0f) {
317 for (
int i = 0; i < 3; i++) {
328 for (
int i = 0; i < 3; i++) {
340 if (!is_intersecting) {
341 for (
int i = 0; i < 3; i++) {
342 for (
int j = 0; j < 3; j++) {
355 if (!is_intersecting) {
364 if (culling && use_normal) {
367 else if (use_normal) {
368 if (
dot_v3v3(normal, r_vec) >= 0.0f) {
375 else if (culling && (
dot_v3v3(r_vec, normal) < 0.0f)) {
396 float tmp_co1[3], tmp_co2[3];
399 float tmp, tmp_vec[3];
400 float normal[3], cent[3];
401 bool backside =
false;
426 for (
int i = 0; i < 2; i++) {
428 if (
dot_v3v3(tmp_vec, normal) < 0.0f) {
447 float maxdist = 0.0f;
451 for (
int i = 0; i < 2; i++) {
463 for (
int i = 0; i < 3; i++) {
477 if ((tmp > maxdist) && (
dot_v3v3(tmp_vec, normal) < 0.0f)) {
491 if (
dot_v3v3(normal, r_vec) >= 0.0f) {
504 for (
int i = 0; i < 2; i++) {
517 for (
int j = 0; j < 3; j++) {
538 if (culling && use_normal) {
541 else if (use_normal) {
542 if (
dot_v3v3(normal, r_vec) >= 0.0f) {
549 else if (culling && (
dot_v3v3(r_vec, normal) < 0.0f)) {
566#define INPR(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2])
568 double tempV1[3], tempV2[3], tempV4[3];
569 double a,
b, c, d,
e, f;
575 a =
INPR(tempV1, tempV1);
576 b =
INPR(tempV1, tempV2);
577 c =
INPR(tempV2, tempV2);
578 e =
INPR(tempV1, tempV4);
579 f =
INPR(tempV2, tempV4);
584 *w1 = *w2 = *w3 = 1.0 / 3.0;
588 w1[0] =
float((
e * c -
b * f) / d);
594 w2[0] =
float((f -
b *
double(w1[0])) / c);
600 w3[0] = 1.0f - w1[0] - w2[0];
606# pragma GCC diagnostic push
607# pragma GCC diagnostic ignored "-Wdouble-promotion"
625 const float impulse[3],
630 if ((clamp_sq > 0.0f) && (impulse_len_sq > clamp_sq)) {
653 uint collision_count,
661 const float min_distance = (clmd->
coll_parms->
epsilon + epsilon2) * (8.0f / 9.0f);
663 const bool is_hair = (clmd->
hairdata !=
nullptr);
664 for (
int i = 0; i < collision_count; i++, collpair++) {
665 float i1[3], i2[3], i3[3];
666 float v1[3],
v2[3], relativeVelocity[3];
677 float w1 = collpair->
aw1, w2 = collpair->
aw2, w3 = collpair->
aw3;
678 float u1 = collpair->
bw1, u2 = collpair->
bw2, u3 = collpair->
bw3;
685 cloth->verts[collpair->
ap1].tv,
686 cloth->verts[collpair->
ap2].tv,
687 cloth->verts[collpair->
ap3].tv,
705 const float magrelVel =
dot_v3v3(relativeVelocity, collpair->
normal);
706 const float d = min_distance - collpair->
distance;
709 if (magrelVel > 0.0f) {
711 float magtangent = 0, repulse = 0;
712 double impulse = 0.0;
730 impulse = magtangent / 1.5;
732 VECADDMUL(i1, vrel_t_pre,
double(w1) * impulse);
733 VECADDMUL(i2, vrel_t_pre,
double(w2) * impulse);
736 VECADDMUL(i3, vrel_t_pre,
double(w3) * impulse);
741 impulse = magrelVel / 1.5f;
749 if ((magrelVel < 0.1f * d * time_multiplier) && (d >
ALMOST_ZERO)) {
750 repulse = std::min(d / time_multiplier, 0.1f * d * time_multiplier - magrelVel);
754 repulse =
min_ff(repulse, 5.0f * impulse);
757 repulse =
max_ff(impulse, repulse);
759 impulse = repulse / 1.5f;
772 float repulse = d / time_multiplier;
773 float impulse = repulse / 4.5f;
799 uint collision_count,
808 for (
int i = 0; i < collision_count; i++, collpair++) {
809 float ia[3][3] = {{0.0f}};
810 float ib[3][3] = {{0.0f}};
811 float v1[3],
v2[3], relativeVelocity[3];
819 float w1 = collpair->
aw1, w2 = collpair->
aw2, w3 = collpair->
aw3;
820 float u1 = collpair->
bw1, u2 = collpair->
bw2, u3 = collpair->
bw3;
824 cloth->verts[collpair->
ap1].tv,
825 cloth->verts[collpair->
ap2].tv,
826 cloth->verts[collpair->
ap3].tv,
832 cloth->verts[collpair->
bp1].tv,
833 cloth->verts[collpair->
bp2].tv,
834 cloth->verts[collpair->
bp3].tv,
843 const float magrelVel =
dot_v3v3(relativeVelocity, collpair->
normal);
844 const float d = min_distance - collpair->
distance;
850 if (magrelVel > 0.0f) {
852 float magtangent = 0, repulse = 0;
853 double impulse = 0.0;
871 impulse = magtangent / 1.5;
873 VECADDMUL(ia[0], vrel_t_pre,
double(w1) * impulse);
874 VECADDMUL(ia[1], vrel_t_pre,
double(w2) * impulse);
875 VECADDMUL(ia[2], vrel_t_pre,
double(w3) * impulse);
877 VECADDMUL(ib[0], vrel_t_pre,
double(u1) * -impulse);
878 VECADDMUL(ib[1], vrel_t_pre,
double(u2) * -impulse);
879 VECADDMUL(ib[2], vrel_t_pre,
double(u3) * -impulse);
883 impulse = magrelVel / 3.0f;
893 if ((magrelVel < 0.1f * d * time_multiplier) && (d >
ALMOST_ZERO)) {
894 repulse = std::min(d / time_multiplier, 0.1f * d * time_multiplier - magrelVel);
897 repulse =
min_ff(repulse, 5.0 * impulse);
900 repulse =
max_ff(impulse, repulse);
901 impulse = repulse / 1.5f;
916 float repulse = d * 1.0f / time_multiplier;
917 float impulse = repulse / 9.0f;
945# pragma GCC diagnostic pop
955 const int flags_a =
verts[vert_tri_a[0]].
flags &
verts[vert_tri_a[1]].flags &
956 verts[vert_tri_a[2]].flags;
973 CollPair *collpair = data->collisions;
975 float distance = 0.0f;
978 float pa[3], pb[3], vect[3];
985 verts1[vert_tri_a[1]].tx,
986 verts1[vert_tri_a[2]].tx,
997 collpair[index].
ap1 = vert_tri_a[0];
998 collpair[index].
ap2 = vert_tri_a[1];
999 collpair[index].
ap3 = vert_tri_a[2];
1001 collpair[index].
bp1 = vert_tri_b[0];
1002 collpair[index].
bp2 = vert_tri_b[1];
1003 collpair[index].
bp3 = vert_tri_b[2];
1012 collpair[index].
flag = 0;
1014 data->collided =
true;
1018 verts1[vert_tri_a[0]].tx,
1019 verts1[vert_tri_a[1]].tx,
1020 verts1[vert_tri_a[2]].tx,
1021 &collpair[index].aw1,
1022 &collpair[index].aw2,
1023 &collpair[index].aw3);
1029 &collpair[index].
bw1,
1030 &collpair[index].
bw2,
1031 &collpair[index].
bw3);
1046 const int flags_a =
verts[vert_tri_a[0]].
flags &
verts[vert_tri_a[1]].flags &
1047 verts[vert_tri_a[2]].flags;
1048 const int flags_b =
verts[vert_tri_b[0]].flags &
verts[vert_tri_b[1]].flags &
1049 verts[vert_tri_b[2]].flags;
1063 for (
uint i = 0; i < 3; i++) {
1064 for (
uint j = 0; j < 3; j++) {
1065 if (vert_tri_a[i] == vert_tri_b[j]) {
1069 if (sewing_active) {
1070 if (cloth->sew_edge_graph.contains({vert_tri_a[i], vert_tri_b[j]})) {
1087 CollPair *collpair = data->collisions;
1089 float distance = 0.0f;
1091 float pa[3], pb[3], vect[3];
1094 int indexA = data->overlap[index].indexA, indexB = data->overlap[index].indexB;
1096 if (indexA > indexB) {
1097 std::swap(indexA, indexB);
1107 verts1[vert_tri_a[1]].tx,
1108 verts1[vert_tri_a[2]].tx,
1109 verts1[vert_tri_b[0]].tx,
1110 verts1[vert_tri_b[1]].tx,
1111 verts1[vert_tri_b[2]].tx,
1119 collpair[index].
ap1 = vert_tri_a[0];
1120 collpair[index].
ap2 = vert_tri_a[1];
1121 collpair[index].
ap3 = vert_tri_a[2];
1123 collpair[index].
bp1 = vert_tri_b[0];
1124 collpair[index].
bp2 = vert_tri_b[1];
1125 collpair[index].
bp3 = vert_tri_b[2];
1134 collpair[index].
flag = 0;
1136 data->collided =
true;
1140 verts1[vert_tri_a[0]].tx,
1141 verts1[vert_tri_a[1]].tx,
1142 verts1[vert_tri_a[2]].tx,
1143 &collpair[index].aw1,
1144 &collpair[index].aw2,
1145 &collpair[index].aw3);
1148 verts1[vert_tri_b[0]].tx,
1149 verts1[vert_tri_b[1]].tx,
1150 verts1[vert_tri_b[2]].tx,
1151 &collpair[index].bw1,
1152 &collpair[index].bw2,
1153 &collpair[index].bw3);
1168 CollPair *collpair = data->collisions;
1170 float distance = 0.0f;
1173 float pa[3], pb[3], vect[3];
1183 verts1[edge_coll[1]].tx,
1194 collpair[index].
ap1 = edge_coll[0];
1195 collpair[index].
ap2 = edge_coll[1];
1197 collpair[index].
bp1 = tri_coll[0];
1198 collpair[index].
bp2 = tri_coll[1];
1199 collpair[index].
bp3 = tri_coll[2];
1208 collpair[index].
flag = 0;
1210 data->collided =
true;
1214 pa, verts1[edge_coll[0]].tx, verts1[edge_coll[1]].tx);
1216 collpair[index].
aw1 = 1.0f - collpair[index].
aw2;
1222 &collpair[index].
bw1,
1223 &collpair[index].
bw2,
1224 &collpair[index].
bw3);
1269 ListBase *relations = MEM_cnew<ListBase>(__func__);
1271 for (; base; base = base->
next) {
1272 if (base->
flag & base_flag) {
1303 Object **objects = MEM_cnew_array<Object *>(maxnum, __func__);
1356 if (cache ==
nullptr) {
1357 cache = MEM_cnew<ListBase>(__func__);
1377 *colliders =
nullptr;
1389 const bool is_hair = (clmd->
hairdata !=
nullptr);
1394 data.collmd = collmd;
1395 data.overlap = overlap;
1396 data.collisions = *collisions;
1397 data.culling = culling;
1398 data.use_normal = use_normal;
1399 data.collided =
false;
1403 settings.use_threading =
true;
1407 return data.collided;
1417 data.overlap = overlap;
1418 data.collisions = collisions;
1419 data.collided =
false;
1423 settings.use_threading =
true;
1426 return data.collided;
1432 uint *collision_counts,
1433 const uint numcollobj,
1437 int i = 0, j = 0, mvert_num = 0;
1443 verts = cloth->verts;
1447 for (j = 0; j < 2; j++) {
1450 for (i = 0; i < numcollobj; i++) {
1451 Object *collob = collobjs[i];
1457 clmd, collmd, collob, collisions[i], collision_counts[i], dt);
1463 for (i = 0; i < mvert_num; i++) {
1465 if (
verts[i].impulse_count) {
1469 verts[i].impulse_count = 0;
1484 int collision_count,
1488 int i = 0, j = 0, mvert_num = 0;
1494 verts = cloth->verts;
1496 for (j = 0; j < 2; j++) {
1503 for (i = 0; i < mvert_num; i++) {
1504 if (
verts[i].impulse_count) {
1509 verts[i].impulse_count = 0;
1536 if (index_a != index_b) {
1553 BVHTree *cloth_bvh = cloth->bvhtree;
1554 uint i = 0, mvert_num = 0;
1557 int ret = 0, ret2 = 0;
1558 Object **collobjs =
nullptr;
1559 uint numcollobj = 0;
1560 uint *coll_counts_obj =
nullptr;
1562 uint coll_count_self = 0;
1564 bool bvh_updated =
false;
1570 verts = cloth->verts;
1571 mvert_num = cloth->mvert_num;
1578 const bool is_hair = (clmd->
hairdata !=
nullptr);
1581 is_hair ?
nullptr : ob,
1587 coll_counts_obj = MEM_cnew_array<uint>(numcollobj,
"CollCounts");
1588 overlap_obj = MEM_cnew_array<BVHTreeOverlap *>(numcollobj,
"BVHOverlap");
1590 for (i = 0; i < numcollobj; i++) {
1591 Object *collob = collobjs[i];
1604 &coll_counts_obj[i],
1612 if (cloth->bvhselftree != cloth->bvhtree || !bvh_updated) {
1626 bool collided =
false;
1628 collisions = MEM_cnew_array<CollPair *>(numcollobj,
"CollPair");
1630 for (i = 0; i < numcollobj; i++) {
1631 Object *collob = collobjs[i];
1639 if (coll_counts_obj[i] && overlap_obj[i]) {
1654 clmd, collobjs, collisions, coll_counts_obj, numcollobj, dt);
1658 for (i = 0; i < numcollobj; i++) {
1669 verts = cloth->verts;
1670 mvert_num = cloth->mvert_num;
1672 if (cloth->bvhselftree) {
1673 if (coll_count_self && overlap_self) {
1690 for (i = 0; i < mvert_num; i++) {
1705 for (i = 0; i < numcollobj; i++) {
1718 return std::min(
ret, 1);
@ CLOTH_VERT_FLAG_NOSELFCOLL
@ CLOTH_VERT_FLAG_NOOBJCOLL
void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving, bool self)
#define VECADDMUL(v1, v2, aS)
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
Base * BKE_collection_or_layer_objects(const Scene *scene, ViewLayer *view_layer, Collection *collection)
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_balance(BVHTree *tree)
void BLI_bvhtree_update_tree(BVHTree *tree)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
BVHTreeOverlap * BLI_bvhtree_overlap_self(const BVHTree *tree, unsigned int *r_overlap_num, BVHTree_OverlapCallback callback, void *userdata)
bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints)
float BLI_bvhtree_get_epsilon(const BVHTree *tree)
BVHTreeOverlap * BLI_bvhtree_overlap(const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_num, BVHTree_OverlapCallback callback, void *userdata)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE float square_f(float a)
bool isect_ray_tri_v3(const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2])
void isect_seg_seg_v3(const float a0[3], const float a1[3], const float b0[3], const float b1[3], float r_a[3], float r_b[3])
bool point_in_slice_seg(float p[3], float l1[3], float l2[3])
void closest_on_tri_to_point_v3(float r[3], const float p[3], const float v1[3], const float v2[3], const float v3[3])
bool isect_tri_tri_v3_ex(const float tri_a[3][3], const float tri_b[3][3], float r_i1[3], float r_i2[3], int *r_tri_a_edge_isect_count)
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
float closest_to_line_v3(float r_close[3], const float p[3], const float l1[3], const float l2[3])
bool isect_line_plane_v3(float r_isect_co[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3]) ATTR_WARN_UNUSED_RESULT
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
bool isect_line_segment_tri_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2])
MINLINE void sub_v3db_v3fl_v3fl(double r[3], const float a[3], const float b[3])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
typedef double(DMatrix)[4][4]
ListBase * DEG_get_collision_relations(const Depsgraph *depsgraph, Collection *collection, unsigned int modifier_type)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
Scene * DEG_get_input_scene(const Depsgraph *graph)
ID * DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
@ CLOTH_COLLSETTINGS_FLAG_ENABLED
@ CLOTH_COLLSETTINGS_FLAG_SELF
@ CLOTH_SIMSETTINGS_FLAG_SEW
@ CLOTH_SIMSETTINGS_FLAG_COLLOBJ
@ eModifierType_Collision
@ PFIELD_CLOTH_USE_NORMAL
@ PFIELD_CLOTH_USE_CULLING
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void BKE_collider_cache_free(ListBase **colliders)
Object ** BKE_collision_objects_create(Depsgraph *depsgraph, Object *self, Collection *collection, uint *numcollobj, uint modifier_type)
static void add_collision_object(ListBase *relations, Object *ob, int level, const ModifierType modifier_type)
static int cloth_collision_response_static(ClothModifierData *clmd, CollisionModifierData *collmd, Object *collob, CollPair *collpair, uint collision_count, const float dt)
static void cloth_collision(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict)
static bool cloth_bvh_selfcollisions_nearcheck(ClothModifierData *clmd, CollPair *collisions, int numresult, BVHTreeOverlap *overlap)
static float compute_collision_point_tri_tri(const float a1[3], const float a2[3], const float a3[3], const float b1[3], const float b2[3], const float b3[3], bool culling, bool use_normal, float r_a[3], float r_b[3], float r_vec[3])
BLI_INLINE void max_v3_v3v3(float r[3], const float a[3], const float b[3])
static int cloth_bvh_objcollisions_resolve(ClothModifierData *clmd, Object **collobjs, CollPair **collisions, uint *collision_counts, const uint numcollobj, const float dt)
static bool cloth_bvh_collision_is_active(const ClothModifierData *, const Cloth *cloth, const blender::int3 vert_tri_a)
static int cloth_bvh_selfcollisions_resolve(ClothModifierData *clmd, CollPair *collisions, int collision_count, const float dt)
DO_INLINE void collision_interpolateOnTriangle(float to[3], const float v1[3], const float v2[3], const float v3[3], const double w1, const double w2, const double w3)
BVHTree * bvhtree_build_from_mvert(const float(*positions)[3], const blender::int3 *vert_tris, int tri_num, float epsilon)
static void collision_compute_barycentric(const float pv[3], const float p1[3], const float p2[3], const float p3[3], float *w1, float *w2, float *w3)
void BKE_collision_relations_free(ListBase *relations)
ListBase * BKE_collision_relations_create(Depsgraph *depsgraph, Collection *collection, uint modifier_type)
static void cloth_selfcollision(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict)
static void hair_collision(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict)
static bool cloth_bvh_objcollisions_nearcheck(ClothModifierData *clmd, CollisionModifierData *collmd, CollPair **collisions, int numresult, BVHTreeOverlap *overlap, bool culling, bool use_normal)
void collision_get_collider_velocity(float vel_old[3], float vel_new[3], CollisionModifierData *collmd, CollPair *collpair)
void BKE_collision_objects_free(Object **objects)
BLI_INLINE int next_ind(int i)
static bool cloth_bvh_obj_overlap_cb(void *userdata, int index_a, int, int)
int cloth_bvh_collision(Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, float step, float dt)
ListBase * BKE_collider_cache_create(Depsgraph *depsgraph, Object *self, Collection *collection)
static float compute_collision_point_edge_tri(const float a1[3], const float a2[3], const float b1[3], const float b2[3], const float b3[3], bool culling, bool use_normal, float r_a[3], float r_b[3], float r_vec[3])
void bvhtree_update_from_mvert(BVHTree *bvhtree, const float(*positions)[3], const float(*positions_moving)[3], const blender::int3 *vert_tris, int tri_num, bool moving)
void collision_move_object(CollisionModifierData *collmd, const float step, const float prevstep, const bool moving_bvh)
static int cloth_selfcollision_response_static(ClothModifierData *clmd, CollPair *collpair, uint collision_count, const float dt)
static bool cloth_bvh_self_overlap_cb(void *userdata, int index_a, int index_b, int)
static void cloth_collision_impulse_vert(const float clamp_sq, const float impulse[3], ClothVertex *vert)
static bool cloth_bvh_selfcollision_is_active(const ClothModifierData *clmd, const Cloth *cloth, const blender::int3 vert_tri_a, const blender::int3 vert_tri_b)
local_group_size(16, 16) .push_constant(Type b
const Depsgraph * depsgraph
draw_view in_light_buf[] float
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
ccl_device_inline float2 fabs(const float2 a)
float distance(float a, float b)
struct Collection * group
struct ClothHairData * hairdata
struct Cloth * clothObject
struct ClothSimSettings * sim_parms
struct ClothCollSettings * coll_parms
unsigned int impulse_count
const blender::int2 * edges
blender::int3 * vert_tris
CollisionModifierData * collmd
struct Collection * instance_collection