41 # include "eltopo-capi.h"
68 const bool moving_bvh)
105 for (i = 0, vt = tri; i < tri_num; i++, vt++) {
123 const MVert *mvert_moving,
129 if ((bvhtree ==
NULL) || (mvert ==
NULL)) {
133 if (mvert_moving ==
NULL) {
139 for (i = 0, vt = tri; i < tri_num; i++, vt++) {
149 float co_moving[3][3];
176 return (++i < 3) ? i : 0;
193 float dist = FLT_MAX;
194 float tmp_co1[3], tmp_co2[3];
195 float isect_a[3], isect_b[3];
196 float tmp, tmp_vec[3];
198 bool backside =
false;
209 int tri_a_edge_isect_count;
211 a,
b, isect_a, isect_b, &tri_a_edge_isect_count);
218 if (!is_intersecting) {
219 for (
int i = 0; i < 3; i++) {
227 else if (tri_a_edge_isect_count != 1) {
232 else if (use_normal) {
236 if (tri_a_edge_isect_count == 1) {
252 float maxdist = 0.0f;
256 for (
int i = 0; i < 3; i++) {
269 for (
int i = 0; i < 3; i++) {
283 for (
int i = 0; i < 3; i++) {
289 for (
int j = 0; j < 3; j++) {
325 for (
int i = 0; i < 3; i++) {
336 for (
int i = 0; i < 3; i++) {
348 if (!is_intersecting) {
349 for (
int i = 0; i < 3; i++) {
350 for (
int j = 0; j < 3; j++) {
363 if (!is_intersecting) {
372 if (culling && use_normal) {
375 else if (use_normal) {
403 float dist = FLT_MAX;
404 float tmp_co1[3], tmp_co2[3];
407 float tmp, tmp_vec[3];
409 bool backside =
false;
434 for (
int i = 0; i < 2; i++) {
455 float maxdist = 0.0f;
459 for (
int i = 0; i < 2; i++) {
471 for (
int i = 0; i < 3; i++) {
511 for (
int i = 0; i < 2; i++) {
524 for (
int j = 0; j < 3; j++) {
545 if (culling && use_normal) {
548 else if (use_normal) {
573 #define INPR(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2])
575 double tempV1[3], tempV2[3], tempV4[3];
576 double a,
b,
c, d,
e, f;
582 a =
INPR(tempV1, tempV1);
583 b =
INPR(tempV1, tempV2);
584 c =
INPR(tempV2, tempV2);
585 e =
INPR(tempV1, tempV4);
586 f =
INPR(tempV2, tempV4);
591 *w1 = *w2 = *w3 = 1.0 / 3.0;
595 w1[0] = (
float)((
e *
c -
b * f) / d);
601 w2[0] = (
float)((f -
b * (
double)w1[0]) /
c);
607 w3[0] = 1.0f - w1[0] - w2[0];
613 # pragma GCC diagnostic push
614 # pragma GCC diagnostic ignored "-Wdouble-promotion"
632 const float impulse[3],
637 if ((clamp_sq > 0.0f) && (impulse_len_sq > clamp_sq)) {
660 uint collision_count,
671 for (
int i = 0; i < collision_count; i++, collpair++) {
672 float i1[3], i2[3], i3[3];
673 float w1, w2, w3,
u1,
u2, u3;
674 float v1[3],
v2[3], relativeVelocity[3];
731 const float magrelVel =
dot_v3v3(relativeVelocity, collpair->
normal);
732 const float d = min_distance - collpair->
distance;
735 if (magrelVel > 0.0f) {
737 float magtangent = 0, repulse = 0;
738 double impulse = 0.0;
756 impulse = magtangent / 1.5;
759 VECADDMUL(i2, vrel_t_pre, (
double)w2 * impulse);
762 VECADDMUL(i3, vrel_t_pre, (
double)w3 * impulse);
767 impulse = magrelVel / 1.5f;
775 if ((magrelVel < 0.1f * d * time_multiplier) && (d >
ALMOST_ZERO)) {
776 repulse =
MIN2(d / time_multiplier, 0.1f * d * time_multiplier - magrelVel);
780 repulse =
min_ff(repulse, 5.0f * impulse);
783 repulse =
max_ff(impulse, repulse);
785 impulse = repulse / 1.5f;
798 float repulse = d / time_multiplier;
799 float impulse = repulse / 4.5f;
825 uint collision_count,
834 for (
int i = 0; i < collision_count; i++, collpair++) {
835 float ia[3][3] = {{0.0f}};
836 float ib[3][3] = {{0.0f}};
837 float w1, w2, w3,
u1,
u2, u3;
838 float v1[3],
v2[3], relativeVelocity[3];
883 const float magrelVel =
dot_v3v3(relativeVelocity, collpair->
normal);
884 const float d = min_distance - collpair->
distance;
890 if (magrelVel > 0.0f) {
892 float magtangent = 0, repulse = 0;
893 double impulse = 0.0;
911 impulse = magtangent / 1.5;
913 VECADDMUL(ia[0], vrel_t_pre, (
double)w1 * impulse);
914 VECADDMUL(ia[1], vrel_t_pre, (
double)w2 * impulse);
915 VECADDMUL(ia[2], vrel_t_pre, (
double)w3 * impulse);
917 VECADDMUL(ib[0], vrel_t_pre, (
double)
u1 * -impulse);
918 VECADDMUL(ib[1], vrel_t_pre, (
double)
u2 * -impulse);
919 VECADDMUL(ib[2], vrel_t_pre, (
double)u3 * -impulse);
923 impulse = magrelVel / 3.0f;
933 if ((magrelVel < 0.1f * d * time_multiplier) && (d >
ALMOST_ZERO)) {
934 repulse =
MIN2(d / time_multiplier, 0.1f * d * time_multiplier - magrelVel);
937 repulse =
min_ff(repulse, 5.0 * impulse);
940 repulse =
max_ff(impulse, repulse);
941 impulse = repulse / 1.5f;
956 float repulse = d * 1.0f / time_multiplier;
957 float impulse = repulse / 9.0f;
985 # pragma GCC diagnostic pop
995 const int flags_a =
verts[tri_a->
tri[0]].flags &
verts[tri_a->
tri[1]].flags &
1019 float pa[3], pb[3], vect[3];
1022 tri_b = &collmd->
tri[
data->overlap[index].indexB];
1026 verts1[tri_a->
tri[1]].
tx,
1027 verts1[tri_a->
tri[2]].
tx,
1038 collpair[index].
ap1 = tri_a->
tri[0];
1039 collpair[index].
ap2 = tri_a->
tri[1];
1040 collpair[index].
ap3 = tri_a->
tri[2];
1042 collpair[index].
bp1 = tri_b->
tri[0];
1043 collpair[index].
bp2 = tri_b->
tri[1];
1044 collpair[index].
bp3 = tri_b->
tri[2];
1053 collpair[index].
flag = 0;
1055 data->collided =
true;
1070 const int flags_a =
verts[tri_a->
tri[0]].flags &
verts[tri_a->
tri[1]].flags &
1072 const int flags_b =
verts[tri_b->
tri[0]].flags &
verts[tri_b->
tri[1]].flags &
1087 for (
uint i = 0; i < 3; i++) {
1088 for (
uint j = 0; j < 3; j++) {
1089 if (tri_a->
tri[i] == tri_b->
tri[j]) {
1093 if (sewing_active) {
1116 float pa[3], pb[3], vect[3];
1125 verts1[tri_a->
tri[1]].
tx,
1126 verts1[tri_a->
tri[2]].
tx,
1127 verts1[tri_b->
tri[0]].
tx,
1128 verts1[tri_b->
tri[1]].
tx,
1129 verts1[tri_b->
tri[2]].
tx,
1137 collpair[index].
ap1 = tri_a->
tri[0];
1138 collpair[index].
ap2 = tri_a->
tri[1];
1139 collpair[index].
ap3 = tri_a->
tri[2];
1141 collpair[index].
bp1 = tri_b->
tri[0];
1142 collpair[index].
bp2 = tri_b->
tri[1];
1143 collpair[index].
bp3 = tri_b->
tri[2];
1152 collpair[index].
flag = 0;
1154 data->collided =
true;
1171 const MEdge *edge_coll;
1176 float pa[3], pb[3], vect[3];
1181 tri_coll = &collmd->
tri[
data->overlap[index].indexB];
1185 verts1[edge_coll->
v2].
tx,
1196 collpair[index].
ap1 = edge_coll->
v1;
1197 collpair[index].
ap2 = edge_coll->
v2;
1199 collpair[index].
bp1 = tri_coll->
tri[0];
1200 collpair[index].
bp2 = tri_coll->
tri[1];
1201 collpair[index].
bp3 = tri_coll->
tri[2];
1210 collpair[index].
flag = 0;
1212 data->collided =
true;
1222 unsigned int modifier_type)
1249 unsigned int modifier_type)
1258 for (; base; base = base->
next) {
1259 if (base->
flag & base_flag) {
1278 unsigned int *numcollobj,
1279 unsigned int modifier_type)
1343 if (cache ==
NULL) {
1383 .collisions = *collisions,
1385 .use_normal = use_normal,
1395 return data.collided;
1406 .collisions = collisions,
1415 return data.collided;
1421 uint *collision_counts,
1422 const uint numcollobj,
1426 int i = 0, j = 0, mvert_num = 0;
1436 for (j = 0; j < 2; j++) {
1439 for (i = 0; i < numcollobj; i++) {
1440 Object *collob = collobjs[i];
1446 clmd, collmd, collob, collisions[i], collision_counts[i], dt);
1452 for (i = 0; i < mvert_num; i++) {
1454 if (
verts[i].impulse_count) {
1458 verts[i].impulse_count = 0;
1473 int collision_count,
1477 int i = 0, j = 0, mvert_num = 0;
1485 for (j = 0; j < 2; j++) {
1492 for (i = 0; i < mvert_num; i++) {
1493 if (
verts[i].impulse_count) {
1498 verts[i].impulse_count = 0;
1519 const MVertTri *tri_a = &clothObject->
tri[index_a];
1527 if (index_a < index_b) {
1531 tri_a = &clothObject->
tri[index_a];
1532 tri_b = &clothObject->
tri[index_b];
1549 int ret = 0, ret2 = 0;
1551 unsigned int numcollobj = 0;
1554 uint coll_count_self = 0;
1571 is_hair ?
NULL : ob,
1577 coll_counts_obj =
MEM_callocN(
sizeof(
uint) * numcollobj,
"CollCounts");
1578 overlap_obj =
MEM_callocN(
sizeof(*overlap_obj) * numcollobj,
"BVHOverlap");
1580 for (i = 0; i < numcollobj; i++) {
1581 Object *collob = collobjs[i];
1594 &coll_counts_obj[i],
1614 bool collided =
false;
1618 for (i = 0; i < numcollobj; i++) {
1619 Object *collob = collobjs[i];
1627 if (coll_counts_obj[i] && overlap_obj[i]) {
1642 clmd, collobjs, collisions, coll_counts_obj, numcollobj, dt);
1646 for (i = 0; i < numcollobj; i++) {
1661 if (coll_count_self && overlap_self) {
1666 clmd, collisions, coll_count_self, overlap_self)) {
1693 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(const 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_num, 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])
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
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])
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]
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)
ccl_device_inline float2 fabs(const float2 &a)
double epsilon2
power or 2 of epsilon
T distance(const T &a, const T &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
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