57 # include "eltopo-capi.h"
85 const bool moving_bvh)
122 for (i = 0, vt = tri; i < tri_num; i++, vt++) {
140 const MVert *mvert_moving,
146 if ((bvhtree ==
NULL) || (mvert ==
NULL)) {
150 if (mvert_moving ==
NULL) {
156 for (i = 0, vt = tri; i < tri_num; i++, vt++) {
166 float co_moving[3][3];
193 return (++i < 3) ? i : 0;
210 float dist = FLT_MAX;
211 float tmp_co1[3], tmp_co2[3];
212 float isect_a[3], isect_b[3];
213 float tmp, tmp_vec[3];
215 bool backside =
false;
226 int tri_a_edge_isect_count;
228 a, b, isect_a, isect_b, &tri_a_edge_isect_count);
235 if (!is_intersecting) {
236 for (
int i = 0; i < 3; i++) {
244 else if (tri_a_edge_isect_count != 1) {
249 else if (use_normal) {
253 if (tri_a_edge_isect_count == 1) {
269 float maxdist = 0.0f;
273 for (
int i = 0; i < 3; i++) {
286 for (
int i = 0; i < 3; i++) {
300 for (
int i = 0; i < 3; i++) {
306 for (
int j = 0; j < 3; j++) {
342 for (
int i = 0; i < 3; i++) {
353 for (
int i = 0; i < 3; i++) {
365 if (!is_intersecting) {
366 for (
int i = 0; i < 3; i++) {
367 for (
int j = 0; j < 3; j++) {
380 if (!is_intersecting) {
389 if (culling && use_normal) {
392 else if (use_normal) {
420 float dist = FLT_MAX;
421 float tmp_co1[3], tmp_co2[3];
424 float tmp, tmp_vec[3];
426 bool backside =
false;
451 for (
int i = 0; i < 2; i++) {
472 float maxdist = 0.0f;
476 for (
int i = 0; i < 2; i++) {
488 for (
int i = 0; i < 3; i++) {
528 for (
int i = 0; i < 2; i++) {
541 for (
int j = 0; j < 3; j++) {
562 if (culling && use_normal) {
565 else if (use_normal) {
590 #define INPR(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2])
592 double tempV1[3], tempV2[3], tempV4[3];
593 double a, b,
c, d,
e, f;
599 a =
INPR(tempV1, tempV1);
600 b =
INPR(tempV1, tempV2);
601 c =
INPR(tempV2, tempV2);
602 e =
INPR(tempV1, tempV4);
603 f =
INPR(tempV2, tempV4);
608 *w1 = *w2 = *w3 = 1.0 / 3.0;
612 w1[0] = (
float)((
e *
c - b * f) / d);
618 w2[0] = (
float)((f - b * (
double)w1[0]) /
c);
624 w3[0] = 1.0f - w1[0] - w2[0];
630 # pragma GCC diagnostic push
631 # pragma GCC diagnostic ignored "-Wdouble-promotion"
649 const float impulse[3],
654 if ((clamp_sq > 0.0f) && (impulse_len_sq > clamp_sq)) {
677 uint collision_count,
688 for (
int i = 0; i < collision_count; i++, collpair++) {
689 float i1[3], i2[3], i3[3];
690 float w1, w2, w3,
u1,
u2, u3;
691 float v1[3],
v2[3], relativeVelocity[3];
748 const float magrelVel =
dot_v3v3(relativeVelocity, collpair->
normal);
749 const float d = min_distance - collpair->
distance;
752 if (magrelVel > 0.0f) {
754 float magtangent = 0, repulse = 0;
755 double impulse = 0.0;
773 impulse = magtangent / 1.5;
776 VECADDMUL(i2, vrel_t_pre, (
double)w2 * impulse);
779 VECADDMUL(i3, vrel_t_pre, (
double)w3 * impulse);
784 impulse = magrelVel / 1.5f;
792 if ((magrelVel < 0.1f * d * time_multiplier) && (d >
ALMOST_ZERO)) {
793 repulse =
MIN2(d / time_multiplier, 0.1f * d * time_multiplier - magrelVel);
797 repulse =
min_ff(repulse, 5.0f * impulse);
800 repulse =
max_ff(impulse, repulse);
802 impulse = repulse / 1.5f;
815 float repulse = d / time_multiplier;
816 float impulse = repulse / 4.5f;
842 uint collision_count,
851 for (
int i = 0; i < collision_count; i++, collpair++) {
852 float ia[3][3] = {{0.0f}};
853 float ib[3][3] = {{0.0f}};
854 float w1, w2, w3,
u1,
u2, u3;
855 float v1[3],
v2[3], relativeVelocity[3];
900 const float magrelVel =
dot_v3v3(relativeVelocity, collpair->
normal);
901 const float d = min_distance - collpair->
distance;
907 if (magrelVel > 0.0f) {
909 float magtangent = 0, repulse = 0;
910 double impulse = 0.0;
928 impulse = magtangent / 1.5;
930 VECADDMUL(ia[0], vrel_t_pre, (
double)w1 * impulse);
931 VECADDMUL(ia[1], vrel_t_pre, (
double)w2 * impulse);
932 VECADDMUL(ia[2], vrel_t_pre, (
double)w3 * impulse);
934 VECADDMUL(ib[0], vrel_t_pre, (
double)
u1 * -impulse);
935 VECADDMUL(ib[1], vrel_t_pre, (
double)
u2 * -impulse);
936 VECADDMUL(ib[2], vrel_t_pre, (
double)u3 * -impulse);
940 impulse = magrelVel / 3.0f;
950 if ((magrelVel < 0.1f * d * time_multiplier) && (d >
ALMOST_ZERO)) {
951 repulse =
MIN2(d / time_multiplier, 0.1f * d * time_multiplier - magrelVel);
954 repulse =
min_ff(repulse, 5.0 * impulse);
957 repulse =
max_ff(impulse, repulse);
958 impulse = repulse / 1.5f;
973 float repulse = d * 1.0f / time_multiplier;
974 float impulse = repulse / 9.0f;
1002 # pragma GCC diagnostic pop
1012 const int flags_a =
verts[tri_a->
tri[0]].flags &
verts[tri_a->
tri[1]].flags &
1036 float pa[3], pb[3], vect[3];
1039 tri_b = &collmd->
tri[
data->overlap[index].indexB];
1043 verts1[tri_a->
tri[1]].
tx,
1044 verts1[tri_a->
tri[2]].
tx,
1055 collpair[index].
ap1 = tri_a->
tri[0];
1056 collpair[index].
ap2 = tri_a->
tri[1];
1057 collpair[index].
ap3 = tri_a->
tri[2];
1059 collpair[index].
bp1 = tri_b->
tri[0];
1060 collpair[index].
bp2 = tri_b->
tri[1];
1061 collpair[index].
bp3 = tri_b->
tri[2];
1070 collpair[index].
flag = 0;
1072 data->collided =
true;
1087 const int flags_a =
verts[tri_a->
tri[0]].flags &
verts[tri_a->
tri[1]].flags &
1089 const int flags_b =
verts[tri_b->
tri[0]].flags &
verts[tri_b->
tri[1]].flags &
1104 for (
uint i = 0; i < 3; i++) {
1105 for (
uint j = 0; j < 3; j++) {
1106 if (tri_a->
tri[i] == tri_b->
tri[j]) {
1110 if (sewing_active) {
1133 float pa[3], pb[3], vect[3];
1142 verts1[tri_a->
tri[1]].
tx,
1143 verts1[tri_a->
tri[2]].
tx,
1144 verts1[tri_b->
tri[0]].
tx,
1145 verts1[tri_b->
tri[1]].
tx,
1146 verts1[tri_b->
tri[2]].
tx,
1154 collpair[index].
ap1 = tri_a->
tri[0];
1155 collpair[index].
ap2 = tri_a->
tri[1];
1156 collpair[index].
ap3 = tri_a->
tri[2];
1158 collpair[index].
bp1 = tri_b->
tri[0];
1159 collpair[index].
bp2 = tri_b->
tri[1];
1160 collpair[index].
bp3 = tri_b->
tri[2];
1169 collpair[index].
flag = 0;
1171 data->collided =
true;
1188 const MEdge *edge_coll;
1193 float pa[3], pb[3], vect[3];
1198 tri_coll = &collmd->
tri[
data->overlap[index].indexB];
1202 verts1[edge_coll->
v2].
tx,
1213 collpair[index].
ap1 = edge_coll->
v1;
1214 collpair[index].
ap2 = edge_coll->
v2;
1216 collpair[index].
bp1 = tri_coll->
tri[0];
1217 collpair[index].
bp2 = tri_coll->
tri[1];
1218 collpair[index].
bp3 = tri_coll->
tri[2];
1227 collpair[index].
flag = 0;
1229 data->collided =
true;
1239 unsigned int modifier_type)
1269 unsigned int modifier_type)
1278 for (; base; base = base->
next) {
1279 if (base->
flag & base_flag) {
1300 unsigned int *numcollobj,
1301 unsigned int modifier_type)
1367 if (cache ==
NULL) {
1407 .collisions = *collisions,
1409 .use_normal = use_normal,
1419 return data.collided;
1430 .collisions = collisions,
1439 return data.collided;
1445 uint *collision_counts,
1446 const uint numcollobj,
1450 int i = 0, j = 0, mvert_num = 0;
1460 for (j = 0; j < 2; j++) {
1463 for (i = 0; i < numcollobj; i++) {
1464 Object *collob = collobjs[i];
1470 clmd, collmd, collob, collisions[i], collision_counts[i], dt);
1476 for (i = 0; i < mvert_num; i++) {
1478 if (
verts[i].impulse_count) {
1482 verts[i].impulse_count = 0;
1497 int collision_count,
1501 int i = 0, j = 0, mvert_num = 0;
1509 for (j = 0; j < 2; j++) {
1516 for (i = 0; i < mvert_num; i++) {
1517 if (
verts[i].impulse_count) {
1522 verts[i].impulse_count = 0;
1543 const MVertTri *tri_a = &clothObject->
tri[index_a];
1551 if (index_a < index_b) {
1555 tri_a = &clothObject->
tri[index_a];
1556 tri_b = &clothObject->
tri[index_b];
1573 int ret = 0, ret2 = 0;
1575 unsigned int numcollobj = 0;
1578 uint coll_count_self = 0;
1595 is_hair ?
NULL : ob,
1601 coll_counts_obj =
MEM_callocN(
sizeof(
uint) * numcollobj,
"CollCounts");
1602 overlap_obj =
MEM_callocN(
sizeof(*overlap_obj) * numcollobj,
"BVHOverlap");
1604 for (i = 0; i < numcollobj; i++) {
1605 Object *collob = collobjs[i];
1618 &coll_counts_obj[i],
1638 bool collided =
false;
1642 for (i = 0; i < numcollobj; i++) {
1643 Object *collob = collobjs[i];
1651 if (coll_counts_obj[i] && overlap_obj[i]) {
1666 clmd, collobjs, collisions, coll_counts_obj, numcollobj, dt);
1670 for (i = 0; i < numcollobj; i++) {
1685 if (coll_count_self && overlap_self) {
1690 clmd, collisions, coll_count_self, overlap_self)) {
1717 for (i = 0; i < numcollobj; i++) {
typedef float(TangentPoint)[2]
void bvhtree_update_from_cloth(struct ClothModifierData *clmd, bool moving, bool self)
@ CLOTH_VERT_FLAG_NOSELFCOLL
@ CLOTH_VERT_FLAG_NOOBJCOLL
#define VECADDMUL(v1, v2, aS)
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
struct Base * BKE_collection_or_layer_objects(const struct ViewLayer *view_layer, struct Collection *collection)
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
bool BLI_edgeset_haskey(EdgeSet *es, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT
BVHTreeOverlap * BLI_bvhtree_overlap(const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot, BVHTree_OverlapCallback callback, void *userdata)
void BLI_bvhtree_balance(BVHTree *tree)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_update_tree(BVHTree *tree)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
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)
#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])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
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
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])
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(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
typedef double(DMatrix)[4][4]
struct Depsgraph Depsgraph
struct ListBase * DEG_get_collision_relations(const struct Depsgraph *depsgraph, struct Collection *collection, unsigned int modifier_type)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
struct ViewLayer * DEG_get_input_view_layer(const Depsgraph *graph)
@ CLOTH_COLLSETTINGS_FLAG_ENABLED
@ CLOTH_COLLSETTINGS_FLAG_SELF
@ CLOTH_SIMSETTINGS_FLAG_SEW
@ CLOTH_SIMSETTINGS_FLAG_COLLOBJ
Object groups, one object can be in many groups at once.
@ eModifierType_Collision
#define PFIELD_CLOTH_USE_NORMAL
#define PFIELD_CLOTH_USE_CULLING
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble u2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble u1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint i1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static void cloth_selfcollision(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict UNUSED(tls))
struct SelfColDetectData SelfColDetectData
ListBase * BKE_collider_cache_create(Depsgraph *depsgraph, Object *self, Collection *collection)
void BKE_collider_cache_free(ListBase **colliders)
static bool cloth_bvh_collision_is_active(const ClothModifierData *UNUSED(clmd), const Cloth *cloth, const MVertTri *tri_a)
static int cloth_collision_response_static(ClothModifierData *clmd, CollisionModifierData *collmd, Object *collob, CollPair *collpair, uint collision_count, const float dt)
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 int cloth_bvh_selfcollisions_resolve(ClothModifierData *clmd, CollPair *collisions, int collision_count, const float dt)
static bool cloth_bvh_selfcollision_is_active(const ClothModifierData *clmd, const Cloth *cloth, const MVertTri *tri_a, const MVertTri *tri_b)
Object ** BKE_collision_objects_create(Depsgraph *depsgraph, Object *self, Collection *collection, unsigned int *numcollobj, unsigned int modifier_type)
static bool cloth_bvh_self_overlap_cb(void *userdata, int index_a, int index_b, int UNUSED(thread))
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)
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)
static void cloth_collision(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict UNUSED(tls))
static void hair_collision(void *__restrict userdata, const int index, const TaskParallelTLS *__restrict UNUSED(tls))
BVHTree * bvhtree_build_from_mvert(const MVert *mvert, const struct MVertTri *tri, int tri_num, float epsilon)
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 UNUSED(index_b), int UNUSED(thread))
ListBase * BKE_collision_relations_create(Depsgraph *depsgraph, Collection *collection, unsigned int modifier_type)
void bvhtree_update_from_mvert(BVHTree *bvhtree, const MVert *mvert, const MVert *mvert_moving, const MVertTri *tri, int tri_num, bool moving)
int cloth_bvh_collision(Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, float step, float dt)
static void cloth_collision_impulse_vert(const float clamp_sq, const float impulse[3], struct ClothVertex *vert)
static void add_collision_object(ListBase *relations, Object *ob, int level, unsigned int modifier_type)
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 collision_move_object(CollisionModifierData *collmd, const float step, const float prevstep, const bool moving_bvh)
struct ColDetectData ColDetectData
static int cloth_selfcollision_response_static(ClothModifierData *clmd, CollPair *collpair, uint collision_count, const float dt)
const Depsgraph * depsgraph
IconTextureDrawCall normal
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
double epsilon2
power or 2 of epsilon
struct Collection * group
struct ClothHairData * hairdata
struct Cloth * clothObject
struct ClothSimSettings * sim_parms
struct ClothCollSettings * coll_parms
unsigned int impulse_count
struct EdgeSet * sew_edge_graph
struct BVHTree * bvhselftree
struct ClothVertex * verts
CollisionModifierData * collmd
struct MVert * current_xnew
struct Collection * instance_collection
ccl_device_inline float distance(const float2 &a, const float2 &b)
ccl_device_inline float2 fabs(const float2 &a)