|
Blender V5.0
|
#include "MEM_guardedalloc.h"#include "DNA_cloth_types.h"#include "DNA_modifier_types.h"#include "DNA_object_force_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BLI_linklist.h"#include "BLI_math_geom.h"#include "BLI_math_vector.h"#include "BLI_math_vector.hh"#include "BLI_utildefines.h"#include "BKE_cloth.hh"#include "BKE_collision.h"#include "BKE_effect.h"#include "SIM_mass_spring.h"#include "implicit.h"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_query.hh"Go to the source code of this file.
Variables | |
| static float | I3 [3][3] = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}} |
|
static |
Definition at line 1145 of file SIM_mass_spring.cc.
References add_v3_v3(), Cloth::average_acceleration, ClothModifierData::clothObject, data, i, Cloth::implicit, interp_v3_v3v3(), mul_v3_fl(), Cloth::mvert_num, powf, SIM_mass_spring_get_new_velocity(), SIM_mass_spring_get_velocity(), sub_v3_v3(), and v.
Referenced by SIM_cloth_solve().
|
static |
Definition at line 155 of file SIM_mass_spring.cc.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, data, i, Cloth::implicit, Cloth::primitive_num, SIM_tri_area(), and Cloth::vert_tris.
Referenced by cloth_calc_force().
|
static |
Definition at line 566 of file SIM_mass_spring.cc.
References Cloth::average_acceleration, ClothSimSettings::avg_spring_len, BKE_effectors_apply(), CLAMP_MAX, cloth_calc_average_pressure(), cloth_calc_pressure_gradient(), cloth_calc_spring_force(), cloth_calc_volume(), cloth_get_pressure_weights(), CLOTH_SIMSETTINGS_FLAG_PRESSURE, CLOTH_SIMSETTINGS_FLAG_PRESSURE_VOL, CLOTH_SPRING_FLAG_DEACTIVATE, CLOTH_SPRING_TYPE_STRUCTURAL, CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, copy_v3_v3(), ClothSimSettings::Cvi, data, ClothSimSettings::effector_weights, fabs(), PhysicsSettings::flag, ClothSimSettings::flags, ClothSpring::flags, ClothVertex::flags, float, ClothSimSettings::fluid_density, EffectorWeights::global_gravity, ClothVertex::goal, ClothSimSettings::goalfrict, ClothSimSettings::goalspring, PhysicsSettings::gravity, ClothModifierData::hairdata, i, ClothSpring::ij, Cloth::implicit, Cloth::initial_mesh_volume, interp_v3_v3v3(), is_zero_v3(), ClothSpring::kl, ClothVertex::mass, MEM_calloc_arrayN(), MEM_freeN(), MEM_malloc_arrayN(), mul_v3_fl(), mul_v3_v3fl(), Cloth::mvert_num, LinkNode::next, pd_point_from_loc(), PHYS_GLOBAL_GRAVITY, Scene::physics_settings, ClothSimSettings::pressure_factor, Cloth::primitive_num, ClothHairData::radius, SIM_mass_spring_force_drag(), SIM_mass_spring_force_edge_wind(), SIM_mass_spring_force_face_extern(), SIM_mass_spring_force_face_wind(), SIM_mass_spring_force_gravity(), SIM_mass_spring_force_pressure(), SIM_mass_spring_force_spring_goal(), SIM_mass_spring_force_vertex_wind(), SIM_mass_spring_get_motion_state(), ClothModifierData::sim_parms, Cloth::springs, sub_v3_v3(), sub_v3_v3v3(), ClothSimSettings::target_volume, ClothSimSettings::time_scale, ClothSpring::type, ClothSimSettings::uniform_pressure_force, v, Cloth::vert_tris, Cloth::verts, x, ClothVertex::xconst, and ClothVertex::xold.
Referenced by SIM_cloth_solve().
|
static |
Computes where the cloth would be if it were subject to perfectly stiff edges (edge distance constraints) in a lagrangian solver. Then add forces to help guide the implicit solver to that state. This function is called after collisions.
Definition at line 276 of file SIM_mass_spring.cc.
References add_v3_v3(), cloth_calc_helper_forces(), CLOTH_SPRING_TYPE_SHEAR, CLOTH_SPRING_TYPE_STRUCTURAL, copy_v3_v3(), cos, e, ELEM, float, ClothVertex::goal, i, ClothSpring::ij, ClothSpring::kl, l, len, len_squared_v3v3(), len_v3v3(), LinkNode::link, ClothVertex::mass, MEM_calloc_arrayN(), MEM_freeN(), mul_v3_fl(), Cloth::mvert_num, LinkNode::next, normalize_v3(), ClothSpring::restlen, Cloth::springs, sub_v3_v3v3(), ClothVertex::tv, ClothVertex::tx, ClothSpring::type, v2, and Cloth::verts.
Referenced by cloth_calc_helper_forces().
|
static |
Definition at line 83 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, data, dot_v3v3(), i, Cloth::implicit, Cloth::mvert_num, and SIM_mass_spring_get_position().
Referenced by cloth_calc_force().
|
static |
Definition at line 126 of file SIM_mass_spring.cc.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, ClothModifierData::hairdata, i, Cloth::primitive_num, v, Cloth::vert_tris, Cloth::verts, and volume_tri_tetrahedron_signed_v3_6x().
Referenced by SIM_cloth_solver_set_volume().
| BLI_INLINE void cloth_calc_spring_force | ( | ClothModifierData * | clmd, |
| ClothSpring * | s ) |
Definition at line 355 of file SIM_mass_spring.cc.
References ClothSpring::ang_stiffness, ClothSimSettings::avg_spring_len, ClothSimSettings::bending, ClothSimSettings::bending_damping, ClothSimSettings::bending_model, BKE_sim_debug_data_add_dot, BKE_sim_debug_data_add_line, BKE_sim_debug_data_add_vector, BLI_assert, BLI_INLINE, CLOTH_BENDING_ANGULAR, CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS, CLOTH_SPRING_FLAG_NEEDED, CLOTH_SPRING_TYPE_BENDING, CLOTH_SPRING_TYPE_BENDING_HAIR, CLOTH_SPRING_TYPE_INTERNAL, CLOTH_SPRING_TYPE_SEWING, CLOTH_SPRING_TYPE_SHEAR, CLOTH_SPRING_TYPE_STRUCTURAL, ClothModifierData::clothObject, ClothSimSettings::compression, ClothSimSettings::compression_damp, copy_v3_v3(), data, fabsf, ClothSimSettings::flags, ClothSpring::flags, ClothSpring::ij, Cloth::implicit, ClothSimSettings::internal_compression, ClothSimSettings::internal_tension, ClothSpring::kl, ClothSpring::la, ClothSpring::lb, ClothSpring::lin_stiffness, ClothSimSettings::max_bend, ClothSimSettings::max_compression, ClothSimSettings::max_internal_compression, ClothSimSettings::max_internal_tension, ClothSimSettings::max_sewing, ClothSimSettings::max_shear, ClothSimSettings::max_tension, ClothSpring::mn, ClothSpring::pa, ClothSpring::pb, ClothSpring::restang, ClothSpring::restlen, ClothSimSettings::shear, ClothSimSettings::shear_damp, SIM_mass_spring_force_spring_angular(), SIM_mass_spring_force_spring_bending(), SIM_mass_spring_force_spring_bending_hair(), SIM_mass_spring_force_spring_linear(), SIM_mass_spring_get_motion_state(), ClothModifierData::sim_parms, ClothSpring::target, ClothSimSettings::tension, ClothSimSettings::tension_damp, ClothSpring::type, and v.
Referenced by cloth_calc_force().
|
static |
Definition at line 98 of file SIM_mass_spring.cc.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, data, ClothModifierData::hairdata, i, Cloth::implicit, Cloth::primitive_num, SIM_tri_tetra_volume_signed_6x(), and Cloth::vert_tris.
Referenced by cloth_calc_force().
|
static |
Definition at line 1214 of file SIM_mass_spring.cc.
References ClothSolverResult::avg_error, ClothSolverResult::avg_iterations, ClothSolverResult::max_error, ClothSolverResult::max_iterations, ClothSolverResult::min_error, ClothSolverResult::min_iterations, ClothModifierData::solver_result, and ClothSolverResult::status.
Referenced by SIM_cloth_solve().
|
static |
Definition at line 819 of file SIM_mass_spring.cc.
References cloth_get_grid_location(), copy_v3_v3(), data, hair_spring_next(), ClothSpring::ij, Cloth::implicit, ClothSpring::kl, LinkNode::link, LinkNode::next, normalize_v3(), SIM_hair_volume_add_segment(), sub_v3_v3v3(), v2, and zero_v3().
Referenced by cloth_continuum_fill_grid().
Definition at line 904 of file SIM_mass_spring.cc.
References cloth_continuum_add_hair_segments(), CLOTH_SPRING_TYPE_STRUCTURAL, data, i, Cloth::implicit, LinkNode::link, mul_v3_v3fl(), Cloth::mvert_num, negate_v3(), LinkNode::next, SIM_hair_volume_add_vertex(), SIM_hair_volume_grid_geometry(), SIM_hair_volume_normalize_vertex_grid(), Cloth::springs, ClothSpring::type, v, Cloth::verts, and x.
Referenced by cloth_continuum_step().
|
static |
Definition at line 944 of file SIM_mass_spring.cc.
References b, BKE_sim_debug_data_add_circle, BKE_sim_debug_data_add_dot, BKE_sim_debug_data_add_vector, BKE_sim_debug_data_clear_category(), cloth_continuum_fill_grid(), ClothModifierData::clothObject, col, copy_v3_v3(), data, ClothSimSettings::density_strength, ClothSimSettings::density_target, hair_get_boundbox(), ClothModifierData::hair_grid_cellsize, ClothModifierData::hair_grid_max, ClothModifierData::hair_grid_min, ClothModifierData::hair_grid_res, i, Cloth::implicit, interp_v3_v3v3(), is_zero_v3(), madd_v3_v3fl(), madd_v3_v3v3fl(), Cloth::mvert_num, SIM_hair_volume_create_vertex_grid(), SIM_hair_volume_free_vertex_grid(), SIM_hair_volume_grid_geometry(), SIM_hair_volume_grid_interpolate(), SIM_hair_volume_grid_velocity(), SIM_hair_volume_solve_divergence(), SIM_mass_spring_get_new_velocity(), SIM_mass_spring_get_position(), SIM_mass_spring_set_new_velocity(), ClothModifierData::sim_parms, size(), sub_v3_v3v3(), v, ClothSimSettings::velocity_smooth, Cloth::verts, ClothSimSettings::voxel_cell_size, x, zero_v3(), and zero_v3_int().
Referenced by SIM_cloth_solve().
|
static |
Definition at line 38 of file SIM_mass_spring.cc.
References CLOTH_SPRING_TYPE_BENDING_HAIR, LinkNode::link, LinkNode::next, Cloth::springs, and ClothSpring::type.
Referenced by SIM_cloth_solver_init().
| BLI_INLINE void cloth_get_grid_location | ( | Implicit_Data * | data, |
| float | cell_scale, | ||
| const float | cell_offset[3], | ||
| int | index, | ||
| float | x[3], | ||
| float | v[3] ) |
Definition at line 784 of file SIM_mass_spring.cc.
References add_v3_v3(), BLI_INLINE, data, mul_v3_fl(), SIM_mass_spring_get_new_velocity(), SIM_mass_spring_get_position(), v, and x.
Referenced by cloth_continuum_add_hair_segments().
|
static |
Definition at line 61 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, ClothModifierData::sim_parms, Cloth::verts, verts, and ClothSimSettings::vgroup_pressure.
Referenced by cloth_calc_average_pressure(), cloth_calc_force(), cloth_calc_rest_volume(), and cloth_calc_volume().
|
static |
Definition at line 1224 of file SIM_mass_spring.cc.
References ClothSolverResult::avg_error, ClothSolverResult::avg_iterations, float, ClothSolverResult::max_error, max_ff(), max_ii(), ClothSolverResult::max_iterations, ClothSolverResult::min_error, min_ff(), min_ii(), ClothSolverResult::min_iterations, result, SIM_SOLVER_SUCCESS, ClothModifierData::solver_result, and ClothSolverResult::status.
Referenced by SIM_cloth_solve().
|
static |
Definition at line 249 of file SIM_mass_spring.cc.
References CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, data, Cloth::implicit, Cloth::mvert_num, SIM_mass_spring_add_constraint_ndof0(), SIM_mass_spring_clear_constraints(), v, Cloth::verts, verts, and ZERO.
Referenced by SIM_cloth_solve().
|
static |
Definition at line 1169 of file SIM_mass_spring.cc.
References Cloth::bvhtree, cloth_bvh_collision(), CLOTH_COLLSETTINGS_FLAG_ENABLED, CLOTH_COLLSETTINGS_FLAG_SELF, CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, ClothModifierData::coll_parms, depsgraph, ClothSimSettings::dt, ClothCollSettings::flags, i, Cloth::implicit, madd_v3_v3fl(), Cloth::mvert_num, SIM_mass_spring_get_new_position(), SIM_mass_spring_get_new_velocity(), SIM_mass_spring_set_new_velocity(), SIM_mass_spring_solve_positions(), ClothModifierData::sim_parms, step, sub_v3_v3v3(), ClothSimSettings::timescale, Cloth::verts, verts, ClothSimSettings::vgroup_mass, and zero_v3().
Referenced by SIM_cloth_solve().
|
static |
Definition at line 549 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, data, i, Cloth::implicit, INIT_MINMAX, blender::math::min_max(), Cloth::mvert_num, SIM_mass_spring_get_motion_state(), and x.
Referenced by cloth_continuum_step().
| BLI_INLINE LinkNode * hair_spring_next | ( | LinkNode * | spring_link | ) |
Definition at line 799 of file SIM_mass_spring.cc.
References BLI_INLINE, CLOTH_SPRING_TYPE_STRUCTURAL, ClothSpring::ij, ClothSpring::kl, LinkNode::link, LinkNode::next, next, and ClothSpring::type.
Referenced by cloth_continuum_add_hair_segments().
| int SIM_cloth_solve | ( | Depsgraph * | depsgraph, |
| Object * | ob, | ||
| float | frame, | ||
| ClothModifierData * | clmd, | ||
| ListBase * | effectors ) |
Definition at line 1254 of file SIM_mass_spring.cc.
References Cloth::average_acceleration, BKE_sim_debug_data_clear_category(), cloth_calc_average_acceleration(), cloth_calc_force(), cloth_clear_result(), cloth_continuum_step(), cloth_record_result(), cloth_setup_constraints(), CLOTH_SIMSETTINGS_FLAG_PRESSURE, cloth_solve_collisions(), CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, copy_v3_v3(), DEG_get_evaluated_scene(), depsgraph, ClothSimSettings::dt, ClothSimSettings::flags, ClothSimSettings::fluid_density, ClothModifierData::hairdata, i, Cloth::implicit, interp_v3_v3v3(), MEM_callocN(), mul_v3_fl(), Cloth::mvert_num, result, SIM_mass_spring_apply_result(), SIM_mass_spring_clear_forces(), SIM_mass_spring_get_motion_state(), SIM_mass_spring_set_position(), SIM_mass_spring_set_velocity(), SIM_mass_spring_solve_positions(), SIM_mass_spring_solve_velocities(), ClothModifierData::sim_parms, ClothModifierData::solver_result, step, sub_v3_v3v3(), ClothSimSettings::time_scale, ClothSimSettings::timescale, v, Cloth::verts, verts, ClothSimSettings::vgroup_mass, x, and zero_v3().
Referenced by do_step_cloth().
| void SIM_cloth_solver_free | ( | ClothModifierData * | clmd | ) |
Definition at line 207 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, Cloth::implicit, and SIM_mass_spring_solver_free().
Referenced by cloth_free_modifier(), and cloth_free_modifier_extern().
| int SIM_cloth_solver_init | ( | Object * | ob, |
| ClothModifierData * | clmd ) |
Definition at line 180 of file SIM_mass_spring.cc.
References cloth_count_nondiag_blocks(), ClothModifierData::clothObject, i, Cloth::implicit, Cloth::mvert_num, SIM_mass_spring_set_implicit_vertex_mass(), SIM_mass_spring_set_motion_state(), SIM_mass_spring_solver_create(), Cloth::verts, verts, x, and ZERO.
Referenced by cloth_from_object().
| void SIM_cloth_solver_set_positions | ( | ClothModifierData * | clmd | ) |
Definition at line 217 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, ClothModifierData::hairdata, i, I3, Cloth::implicit, Cloth::mvert_num, ClothHairData::rot, SIM_mass_spring_set_motion_state(), SIM_mass_spring_set_rest_transform(), v, Cloth::verts, verts, and x.
Referenced by cloth_from_object(), clothModifier_do(), and do_init_cloth().
| void SIM_cloth_solver_set_volume | ( | ClothModifierData * | clmd | ) |
Definition at line 238 of file SIM_mass_spring.cc.
References cloth_calc_rest_volume(), ClothModifierData::clothObject, and Cloth::initial_mesh_volume.
Referenced by do_init_cloth().
| void SIM_mass_spring_set_implicit_vertex_mass | ( | Implicit_Data * | data, |
| int | index, | ||
| float | mass ) |
Definition at line 202 of file SIM_mass_spring.cc.
References data, and SIM_mass_spring_set_vertex_mass().
Referenced by do_step_cloth(), and SIM_cloth_solver_init().
|
static |
Definition at line 33 of file SIM_mass_spring.cc.
Referenced by SIM_cloth_solver_set_positions().