|
Blender V4.3
|
#include "MEM_guardedalloc.h"#include "DNA_cloth_types.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_linklist.h"#include "BLI_math_geom.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_rand.h"#include "BLI_utildefines.h"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_query.hh"#include "BKE_bvhutils.hh"#include "BKE_cloth.hh"#include "BKE_customdata.hh"#include "BKE_effect.h"#include "BKE_global.hh"#include "BKE_lib_id.hh"#include "BKE_mesh.hh"#include "BKE_modifier.hh"#include "BKE_pointcache.h"#include "SIM_mass_spring.h"Go to the source code of this file.
Classes | |
| struct | BendSpringRef |
|
static |
Definition at line 67 of file cloth.cc.
References BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), ClothModifierData::clothObject, copy_v3_v3(), ClothModifierData::hairdata, and verts.
Referenced by cloth_from_object().
| void bvhtree_update_from_cloth | ( | ClothModifierData * | clmd, |
| bool | moving, | ||
| bool | self ) |
Definition at line 121 of file cloth.cc.
References BLI_assert, BLI_bvhtree_update_node(), BLI_bvhtree_update_tree(), ClothModifierData::clothObject, copy_v3_v3(), ClothModifierData::hairdata, ret, self, and verts.
Referenced by cloth_bvh_collision().
|
static |
Definition at line 1276 of file cloth.cc.
References ClothSpring::ang_stiffness, ClothSimSettings::bending_model, BLI_linklist_append(), BLI_linklist_prepend(), CLOTH_BENDING_ANGULAR, cloth_shrink_factor(), cloth_spring_angle(), CLOTH_SPRING_TYPE_BENDING, CLOTH_SPRING_TYPE_SHEAR, ClothModifierData::clothObject, ClothSpring::ij, ClothSpring::kl, ClothSpring::la, ClothSpring::lb, len_v3v3(), ClothSpring::lin_stiffness, MEM_callocN, MEM_mallocN, ClothSpring::mn, ClothSpring::pa, ClothSpring::pb, ClothSpring::restang, ClothSpring::restlen, ClothModifierData::sim_parms, spring_verts_ordered_set(), ClothSpring::type, x, and y.
Referenced by cloth_build_springs().
|
static |
Applies a vertex group as specified by type.
Definition at line 602 of file cloth.cc.
References cloth_uses_vgroup(), CLOTH_VERT_FLAG_NOOBJCOLL, CLOTH_VERT_FLAG_NOSELFCOLL, CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, ClothModifierData::coll_parms, MDeformWeight::def_nr, ClothSimSettings::defgoal, MDeformVert::dw, blender::Span< T >::is_empty(), pow4f(), ClothModifierData::sim_parms, SOFTGOALSNAP, MDeformVert::totweight, Cloth::verts, verts, ClothSimSettings::vgroup_bend, ClothSimSettings::vgroup_intern, ClothSimSettings::vgroup_mass, ClothCollSettings::vgroup_objcol, ClothSimSettings::vgroup_pressure, ClothCollSettings::vgroup_selfcol, ClothSimSettings::vgroup_shear, ClothSimSettings::vgroup_shrink, ClothSimSettings::vgroup_struct, and MDeformWeight::weight.
Referenced by cloth_from_object(), and do_step_cloth().
| BLI_INLINE void cloth_bend_poly_dir | ( | ClothVertex * | verts, |
| int | i, | ||
| int | j, | ||
| const int * | inds, | ||
| int | len, | ||
| float | r_dir[3] ) |
Definition at line 925 of file cloth.cc.
References len, madd_v3_v3fl(), normal_tri_v3(), and verts.
Referenced by cloth_spring_angle().
| BLI_INLINE bool cloth_bend_set_poly_vert_array | ( | int ** | poly, |
| int | len, | ||
| const int * | corner_verts ) |
Definition at line 1358 of file cloth.cc.
References len, and MEM_mallocN.
Referenced by cloth_build_springs().
|
static |
Definition at line 1452 of file cloth.cc.
References ClothSpring::ang_stiffness, ClothSimSettings::avg_spring_len, ClothSimSettings::bending_model, BKE_bvhtree_from_mesh_get(), BKE_id_free(), BLI_assert, BLI_linklist_prepend(), BLI_rng_free(), BLI_rng_new_srandom(), BVHTREE_FROM_CORNER_TRIS, cloth_add_shear_bend_spring(), cloth_bend_set_poly_vert_array(), CLOTH_BENDING_ANGULAR, CLOTH_BENDING_LINEAR, cloth_free_edgelist(), cloth_free_errorsprings(), cloth_hair_update_bending_rest_targets(), cloth_make_rest_mesh(), cloth_shrink_factor(), CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH, CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS, CLOTH_SIMSETTINGS_FLAG_INTERNAL_SPRINGS_NORMAL, CLOTH_SIMSETTINGS_FLAG_SEW, cloth_spring_angle(), CLOTH_SPRING_TYPE_BENDING, CLOTH_SPRING_TYPE_BENDING_HAIR, CLOTH_SPRING_TYPE_INTERNAL, CLOTH_SPRING_TYPE_SEWING, CLOTH_SPRING_TYPE_STRUCTURAL, ClothModifierData::clothObject, blender::bke::LooseGeomCache::count, BendSpringRef::face, find_internal_spring_target_vertex(), ClothSimSettings::flags, ClothSpring::flags, float, free_bvhtree_from_mesh(), G, Mesh::id, ClothSpring::ij, BendSpringRef::index, ClothSimSettings::internal_spring_max_diversion, ClothSimSettings::internal_spring_max_length, blender::bke::LooseGeomCache::is_loose_bits, ClothSpring::kl, ClothSpring::la, ClothSpring::lb, len_v3v3(), ClothSpring::lin_stiffness, LinkNode::link, LinkNodePair::list, MEM_callocN, MEM_freeN(), MEM_SAFE_FREE, mesh, ClothSpring::mn, LinkNode::next, ClothSpring::pa, ClothSpring::pb, printf, ClothSpring::restang, ClothSpring::restlen, ClothSimSettings::shapekey_rest, ClothModifierData::sim_parms, size(), BendSpringRef::spring, spring_verts_ordered_set(), and ClothSpring::type.
Referenced by cloth_from_object().
| void cloth_clear_cache | ( | Object * | ob, |
| ClothModifierData * | clmd, | ||
| float | framenr ) |
Definition at line 200 of file cloth.cc.
References BKE_ptcache_id_clear(), BKE_ptcache_id_from_cloth(), PTCacheID::cache, PointCache::edit, Object::mode, OB_MODE_PARTICLE_EDIT, and PTCACHE_CLEAR_AFTER.
|
static |
Definition at line 887 of file cloth.cc.
References BLI_linklist_free(), and MEM_freeN().
Referenced by cloth_build_springs(), and cloth_free_errorsprings().
|
static |
Definition at line 898 of file cloth.cc.
References BLI_linklist_free(), cloth_free_edgelist(), LinkNode::link, MEM_freeN(), MEM_SAFE_FREE, LinkNode::next, ClothSpring::pa, and ClothSpring::pb.
Referenced by cloth_build_springs().
| void cloth_free_modifier | ( | ClothModifierData * | clmd | ) |
Frees all.
Definition at line 433 of file cloth.cc.
References BLI_bvhtree_free(), BLI_linklist_free(), ClothModifierData::clothObject, LinkNode::link, MEM_freeN(), MEM_SAFE_FREE, LinkNode::next, ClothSpring::pa, ClothSpring::pb, and SIM_cloth_solver_free().
Referenced by BKE_ptcache_id_reset(), cloth_from_mesh(), cloth_from_object(), free_hair(), and hair_step().
| void cloth_free_modifier_extern | ( | ClothModifierData * | clmd | ) |
Frees all.
Definition at line 494 of file cloth.cc.
References BLI_bvhtree_free(), BLI_linklist_free(), ClothModifierData::clothObject, G, G_DEBUG_SIMDATA, LinkNode::link, MEM_freeN(), MEM_SAFE_FREE, LinkNode::next, ClothSpring::pa, ClothSpring::pb, printf, and SIM_cloth_solver_free().
Referenced by free_data().
|
static |
Definition at line 828 of file cloth.cc.
References BKE_modifier_set_error(), cloth_free_modifier(), ClothModifierData::clothObject, Cloth::edges, ClothModifierData::hairdata, MEM_freeN(), MEM_malloc_arrayN, ClothModifierData::modifier, Cloth::mvert_num, Cloth::primitive_num, blender::Span< T >::size(), Cloth::springs, Cloth::vert_tris, blender::bke::mesh::vert_tris_from_corner_tris(), and Cloth::verts.
Referenced by cloth_from_object().
|
static |
Definition at line 709 of file cloth.cc.
References BKE_modifier_set_error(), Cloth::bvhselftree, Cloth::bvhtree, bvhtree_build_from_cloth(), CD_CLOTH_ORCO, cloth_apply_vgroup(), cloth_build_springs(), cloth_free_modifier(), cloth_from_mesh(), CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH, ClothModifierData::clothObject, ClothModifierData::coll_parms, compare_ff(), copy_v3_v3(), CustomData_get_layer(), ClothSimSettings::defgoal, ClothCollSettings::epsilon, ClothSimSettings::flags, float, G, G_DEBUG_SIMDATA, ClothSimSettings::mass, ClothModifierData::modifier, mul_m4_v3(), mul_v3_fl(), Cloth::numsprings, Cloth::old_solver_type, printf, ClothCollSettings::selfepsilon, ClothSimSettings::shapekey_rest, SIM_cloth_solver_init(), SIM_cloth_solver_set_positions(), ClothModifierData::sim_parms, Cloth::springs, Cloth::verts, verts, and ClothSimSettings::vgroup_mass.
Referenced by do_init_cloth().
|
static |
Definition at line 1020 of file cloth.cc.
References cloth_parallel_transport_hair_frame(), CLOTH_SPRING_TYPE_BENDING_HAIR, ClothModifierData::clothObject, copy_m3_m3(), copy_v3_v3(), ClothModifierData::hairdata, ClothSpring::ij, ClothSpring::kl, LinkNode::link, ClothSpring::mn, mul_transposed_m3_v3(), LinkNode::next, normalize_v3(), ClothHairData::rest_target, ClothHairData::rot, sub_v3_v3v3(), and ClothSpring::type.
Referenced by cloth_build_springs().
|
static |
Definition at line 962 of file cloth.cc.
References cloth_parallel_transport_hair_frame(), CLOTH_SPRING_TYPE_BENDING_HAIR, ClothModifierData::clothObject, copy_m3_m3(), copy_v3_v3(), ClothModifierData::hairdata, ClothSpring::ij, ClothSpring::kl, LinkNode::link, ClothSpring::mn, mul_v3_fl(), mul_v3_m3v3(), LinkNode::next, normalize_v3(), ClothHairData::rest_target, ClothSpring::restlen, ClothHairData::rot, sub_v3_v3v3(), ClothSpring::target, and ClothSpring::type.
Referenced by cloth_update_springs().
|
static |
Definition at line 1162 of file cloth.cc.
References BKE_mesh_copy_for_eval(), ClothModifierData::clothObject, Cloth::verts, and verts.
Referenced by cloth_build_springs().
| void cloth_parallel_transport_hair_frame | ( | float | mat[3][3], |
| const float | dir_old[3], | ||
| const float | dir_new[3] ) |
Definition at line 1262 of file cloth.cc.
References mul_m3_m3m3(), rot, and rotation_between_vecs_to_mat3().
Referenced by cloth_hair_update_bending_rest_targets(), and cloth_hair_update_bending_targets().
|
static |
Definition at line 695 of file cloth.cc.
References ClothSimSettings::shrink_max, ClothSimSettings::shrink_min, ClothModifierData::sim_parms, sqrtf, and verts.
Referenced by cloth_add_shear_bend_spring(), cloth_build_springs(), and cloth_update_spring_lengths().
|
static |
Definition at line 938 of file cloth.cc.
References atan2f, cloth_bend_poly_dir(), cos(), cross_v3_v3v3(), dot_v3v3(), normalize_v3(), sub_v3_v3v3(), and verts.
Referenced by cloth_add_shear_bend_spring(), cloth_build_springs(), and cloth_update_spring_lengths().
|
static |
Copies the deformed vertices to the object.
Definition at line 571 of file cloth.cc.
References ClothModifierData::clothObject, copy_v3_v3(), invert_m4_m4(), mul_m4_v3(), and Object::runtime.
Referenced by clothModifier_do().
|
static |
Definition at line 1179 of file cloth.cc.
References ClothSimSettings::avg_spring_len, cloth_shrink_factor(), cloth_spring_angle(), CLOTH_SPRING_TYPE_BENDING, CLOTH_SPRING_TYPE_INTERNAL, CLOTH_SPRING_TYPE_SEWING, CLOTH_SPRING_TYPE_SHEAR, CLOTH_SPRING_TYPE_STRUCTURAL, ClothModifierData::clothObject, float, ClothSpring::ij, ClothSpring::kl, ClothSpring::la, ClothSpring::lb, len_v3v3(), LinkNode::link, LinkNode::next, ClothSpring::pa, ClothSpring::pb, ClothSpring::restang, ClothSpring::restlen, ClothModifierData::sim_parms, and ClothSpring::type.
Referenced by do_step_cloth().
|
static |
Definition at line 1076 of file cloth.cc.
References ALMOST_ZERO, ClothSpring::ang_stiffness, ClothVertex::bend_stiff, ClothSimSettings::bending_model, ClothHairData::bending_stiffness, CLOTH_BENDING_ANGULAR, cloth_hair_update_bending_targets(), CLOTH_SPRING_FLAG_DEACTIVATE, CLOTH_SPRING_TYPE_BENDING, CLOTH_SPRING_TYPE_BENDING_HAIR, CLOTH_SPRING_TYPE_GOAL, CLOTH_SPRING_TYPE_INTERNAL, CLOTH_SPRING_TYPE_SHEAR, CLOTH_SPRING_TYPE_STRUCTURAL, CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, ClothSpring::flags, ClothModifierData::hairdata, ClothSpring::ij, ClothSpring::kl, ClothSpring::lin_stiffness, LinkNode::link, LinkNode::next, ClothModifierData::sim_parms, ClothSpring::type, and v2.
Referenced by do_step_cloth().
|
static |
Definition at line 1147 of file cloth.cc.
References ClothModifierData::clothObject, copy_v3_v3(), mul_m4_v3(), Cloth::verts, and verts.
Referenced by do_step_cloth().
| int cloth_uses_vgroup | ( | ClothModifierData * | clmd | ) |
Definition at line 587 of file cloth.cc.
References CLOTH_COLLSETTINGS_FLAG_ENABLED, CLOTH_COLLSETTINGS_FLAG_SELF, ClothModifierData::coll_parms, ClothCollSettings::flags, ClothModifierData::sim_parms, ClothSimSettings::vgroup_bend, ClothSimSettings::vgroup_intern, ClothSimSettings::vgroup_mass, ClothCollSettings::vgroup_objcol, ClothSimSettings::vgroup_pressure, ClothCollSettings::vgroup_selfcol, ClothSimSettings::vgroup_shear, ClothSimSettings::vgroup_shrink, and ClothSimSettings::vgroup_struct.
Referenced by cloth_apply_vgroup(), and required_data_mask().
| void clothModifier_do | ( | ClothModifierData * | clmd, |
| Depsgraph * | depsgraph, | ||
| Scene * | scene, | ||
| Object * | ob, | ||
| Mesh * | mesh, | ||
| float(*) | vertexCos[3] ) |
Definition at line 319 of file cloth.cc.
References BKE_ptcache_id_from_cloth(), BKE_ptcache_id_reset(), BKE_ptcache_id_time(), BKE_ptcache_invalidate(), BKE_ptcache_read(), BKE_ptcache_validate(), BKE_ptcache_write(), cloth_to_object(), ClothModifierData::clothObject, DEG_get_ctime(), depsgraph, do_init_cloth(), do_step_cloth(), Cloth::edges, PointCache::flag, PointCache::last_exact, Cloth::last_frame, Cloth::mvert_num, ClothModifierData::point_cache, PTCACHE_BAKED, PTCACHE_OUTDATED, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED, PTCACHE_READ_OLD, PTCACHE_REDO_NEEDED, PTCACHE_RESET_OUTDATED, ClothSimSettings::reset, SIM_cloth_solver_set_positions(), ClothModifierData::sim_parms, PointCache::simframe, ClothSimSettings::time_scale, and ClothSimSettings::timescale.
Referenced by deform_verts(), and do_hair_dynamics().
| BLI_INLINE void cross_identity_v3 | ( | float | r[3][3], |
| const float | v[3] ) |
|
static |
Definition at line 214 of file cloth.cc.
References BKE_modifier_set_error(), BKE_ptcache_invalidate(), cloth_from_object(), CLOTH_SIMSETTINGS_FLAG_PRESSURE, CLOTH_SIMSETTINGS_FLAG_PRESSURE_VOL, ClothModifierData::clothObject, ClothSimSettings::dt, ClothSimSettings::flags, Cloth::last_frame, MINFRAME, ClothModifierData::modifier, ClothModifierData::point_cache, SIM_cloth_solver_set_positions(), SIM_cloth_solver_set_volume(), ClothModifierData::sim_parms, and ClothSimSettings::stepsPerFrame.
Referenced by clothModifier_do().
|
static |
Definition at line 250 of file cloth.cc.
References BKE_effectors_create(), BKE_effectors_free(), cloth_apply_vgroup(), CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH, cloth_update_spring_lengths(), cloth_update_springs(), cloth_update_verts(), ClothModifierData::clothObject, copy_v3_v3(), depsgraph, ClothSimSettings::effector_weights, ClothSimSettings::flags, ClothSimSettings::mass, mul_m4_v3(), Cloth::mvert_num, ret, ClothSimSettings::shrink_min, SIM_cloth_solve(), SIM_mass_spring_set_implicit_vertex_mass(), ClothModifierData::sim_parms, Cloth::verts, verts, and ClothSimSettings::vgroup_shrink.
Referenced by clothModifier_do().
|
static |
Definition at line 1375 of file cloth.cc.
References add_v3_v3(), BLI_bvhtree_ray_cast(), BLI_rng_get_float(), BVHTreeRayHit::co, copy_v3_v3(), BVHTreeFromMesh::corner_tris, BVHTreeFromMesh::corner_verts, blender::Span< T >::data(), BVHTreeRayHit::dist, dot_v3v3(), FLT_MAX, BVHTreeRayHit::index, len, len_v3v3(), mul_v3_fl(), negate_v3_v3(), BVHTreeRayHit::no, normalize_v3(), BVHTreeFromMesh::raycast_callback, BVHTreeFromMesh::tree, and BVHTreeFromMesh::vert_positions.
Referenced by cloth_build_springs().
| BLI_INLINE void madd_m3_m3fl | ( | float | r[3][3], |
| const float | m[3][3], | ||
| float | f ) |
| BLI_INLINE void spring_verts_ordered_set | ( | ClothSpring * | spring, |
| int | v0, | ||
| int | v1 ) |
Definition at line 875 of file cloth.cc.
References ClothSpring::ij, and ClothSpring::kl.
Referenced by cloth_add_shear_bend_spring(), and cloth_build_springs().