|
Blender V4.3
|
#include <algorithm>#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 1151 of file SIM_mass_spring.cc.
References add_v3_v3(), ClothModifierData::clothObject, interp_v3_v3v3(), mul_v3_fl(), 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 157 of file SIM_mass_spring.cc.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, and SIM_tri_area().
Referenced by cloth_calc_force().
|
static |
Definition at line 570 of file SIM_mass_spring.cc.
References 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, ClothSimSettings::effector_weights, fabs(), ClothSimSettings::flags, ClothSpring::flags, ClothVertex::flags, float, ClothSimSettings::fluid_density, EffectorWeights::global_gravity, ClothVertex::goal, ClothSimSettings::goalfrict, ClothSimSettings::goalspring, ClothModifierData::hairdata, ClothSpring::ij, interp_v3_v3v3(), is_zero_v3(), ClothSpring::kl, ClothVertex::mass, MEM_callocN, MEM_freeN(), MEM_mallocN, mul_v3_fl(), mul_v3_v3fl(), pd_point_from_loc(), PHYS_GLOBAL_GRAVITY, ClothSimSettings::pressure_factor, 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, sub_v3_v3(), sub_v3_v3v3(), ClothSimSettings::target_volume, ClothSimSettings::time_scale, ClothSpring::type, ClothSimSettings::uniform_pressure_force, v, 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 278 of file SIM_mass_spring.cc.
References add_v3_v3(), CLOTH_SPRING_TYPE_SHEAR, CLOTH_SPRING_TYPE_STRUCTURAL, copy_v3_v3(), cos(), e, ELEM, float, ClothVertex::goal, ClothSpring::ij, ClothSpring::kl, l, len, len_squared_v3v3(), len_v3v3(), ClothVertex::mass, MEM_callocN, MEM_freeN(), mul_v3_fl(), node, normalize_v3(), ClothSpring::restlen, steps, sub_v3_v3v3(), ClothVertex::tv, ClothVertex::tx, ClothSpring::type, and v2.
|
static |
Definition at line 85 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, dot_v3v3(), and SIM_mass_spring_get_position().
Referenced by cloth_calc_force().
|
static |
Definition at line 128 of file SIM_mass_spring.cc.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, ClothModifierData::hairdata, v, 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 359 of file SIM_mass_spring.cc.
References 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, 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(), fabsf, ClothSimSettings::flags, ClothSimSettings::internal_compression, ClothSimSettings::internal_tension, ClothSimSettings::max_bend, ClothSimSettings::max_compression, ClothSimSettings::max_internal_compression, ClothSimSettings::max_internal_tension, ClothSimSettings::max_sewing, ClothSimSettings::max_shear, ClothSimSettings::max_tension, 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, ClothSimSettings::tension, ClothSimSettings::tension_damp, and v.
Referenced by cloth_calc_force().
|
static |
Definition at line 100 of file SIM_mass_spring.cc.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, ClothModifierData::hairdata, and SIM_tri_tetra_volume_signed_6x().
Referenced by cloth_calc_force().
|
static |
Definition at line 1220 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 825 of file SIM_mass_spring.cc.
References cloth_get_grid_location(), copy_v3_v3(), hair_spring_next(), ClothSpring::ij, 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 910 of file SIM_mass_spring.cc.
References cloth_continuum_add_hair_segments(), CLOTH_SPRING_TYPE_STRUCTURAL, LinkNode::link, mul_v3_v3fl(), negate_v3(), LinkNode::next, SIM_hair_volume_add_vertex(), SIM_hair_volume_grid_geometry(), SIM_hair_volume_normalize_vertex_grid(), ClothSpring::type, and v.
Referenced by cloth_continuum_step().
|
static |
Definition at line 950 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(), 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, interp_v3_v3v3(), is_zero_v3(), madd_v3_v3fl(), madd_v3_v3v3fl(), 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, ClothSimSettings::voxel_cell_size, zero_v3(), and zero_v3_int().
Referenced by SIM_cloth_solve().
Definition at line 40 of file SIM_mass_spring.cc.
References CLOTH_SPRING_TYPE_BENDING_HAIR, LinkNode::link, LinkNode::next, 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 790 of file SIM_mass_spring.cc.
References add_v3_v3(), mul_v3_fl(), SIM_mass_spring_get_new_velocity(), SIM_mass_spring_get_position(), and v.
Referenced by cloth_continuum_add_hair_segments().
|
static |
Definition at line 63 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, ClothVertex::pressure_factor, ClothModifierData::sim_parms, 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 1230 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, SIM_SOLVER_SUCCESS, ClothModifierData::solver_result, and ClothSolverResult::status.
Referenced by SIM_cloth_solve().
|
static |
Definition at line 251 of file SIM_mass_spring.cc.
References CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, SIM_mass_spring_add_constraint_ndof0(), SIM_mass_spring_clear_constraints(), v, verts, and ZERO.
Referenced by SIM_cloth_solve().
|
static |
Definition at line 1175 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, madd_v3_v3fl(), 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, sub_v3_v3v3(), ClothSimSettings::timescale, verts, ClothSimSettings::vgroup_mass, and zero_v3().
Referenced by SIM_cloth_solve().
|
static |
Definition at line 553 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, INIT_MINMAX, blender::math::min_max(), 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 805 of file SIM_mass_spring.cc.
References 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 1260 of file SIM_mass_spring.cc.
References 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, interp_v3_v3v3(), mul_v3_fl(), 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, sub_v3_v3v3(), ClothSimSettings::time_scale, ClothSimSettings::timescale, v, verts, ClothSimSettings::vgroup_mass, and zero_v3().
Referenced by do_step_cloth().
| void SIM_cloth_solver_free | ( | ClothModifierData * | clmd | ) |
Definition at line 209 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, 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 182 of file SIM_mass_spring.cc.
References cloth_count_nondiag_blocks(), ClothModifierData::clothObject, SIM_mass_spring_set_implicit_vertex_mass(), SIM_mass_spring_set_motion_state(), SIM_mass_spring_solver_create(), verts, and ZERO.
Referenced by cloth_from_object().
| void SIM_cloth_solver_set_positions | ( | ClothModifierData * | clmd | ) |
Definition at line 219 of file SIM_mass_spring.cc.
References ClothModifierData::clothObject, ClothModifierData::hairdata, I3, ClothHairData::rot, SIM_mass_spring_set_motion_state(), SIM_mass_spring_set_rest_transform(), v, and verts.
Referenced by cloth_from_object(), clothModifier_do(), and do_init_cloth().
| void SIM_cloth_solver_set_volume | ( | ClothModifierData * | clmd | ) |
Definition at line 240 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 204 of file SIM_mass_spring.cc.
References SIM_mass_spring_set_vertex_mass().
Referenced by do_step_cloth(), and SIM_cloth_solver_init().
|
static |
Definition at line 35 of file SIM_mass_spring.cc.
Referenced by SIM_cloth_solver_set_positions().