Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "DNA_cloth_types.h"
#include "DNA_meshdata_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.h"
#include "BLI_utildefines.h"
#include "BKE_cloth.h"
#include "BKE_collision.h"
#include "BKE_effect.h"
#include "SIM_mass_spring.h"
#include "implicit.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
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 1146 of file SIM_mass_spring.cpp.
References add_v3_v3(), Cloth::average_acceleration, ClothModifierData::clothObject, data, 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 153 of file SIM_mass_spring.cpp.
References blender::compositor::area(), cloth_get_pressure_weights(), ClothModifierData::clothObject, data, Cloth::implicit, Cloth::primitive_num, SIM_tri_area(), Cloth::tri, and MVertTri::tri.
Referenced by cloth_calc_force().
|
static |
Definition at line 566 of file SIM_mass_spring.cpp.
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, ClothVertex::flags, ClothSpring::flags, ClothSimSettings::flags, float(), ClothSimSettings::fluid_density, EffectorWeights::global_gravity, ClothVertex::goal, ClothSimSettings::goalfrict, ClothSimSettings::goalspring, PhysicsSettings::gravity, ClothModifierData::hairdata, if(), ClothSpring::ij, Cloth::implicit, Cloth::initial_mesh_volume, interp_v3_v3v3(), is_zero_v3(), ClothSpring::kl, ClothVertex::mass, MEM_callocN, MEM_freeN, MEM_mallocN, 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, scene, 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, time, ClothSimSettings::time_scale, Cloth::tri, MVertTri::tri, ClothSpring::type, ClothSimSettings::uniform_pressure_force, v, 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 274 of file SIM_mass_spring.cpp.
References add_v3_v3(), Freestyle::c, CLOTH_SPRING_TYPE_SHEAR, CLOTH_SPRING_TYPE_STRUCTURAL, copy_v3_v3(), KDL::cos(), e, ELEM, float(), ClothVertex::goal, if(), ClothSpring::ij, ClothSpring::kl, l, len, len_squared_v3v3(), len_v3v3(), ClothVertex::mass, MEM_callocN, MEM_freeN, mul_v3_fl(), Cloth::mvert_num, node, normalize_v3(), ClothSpring::restlen, Cloth::springs, steps, sub_v3_v3v3(), ClothVertex::tv, ClothVertex::tx, ClothSpring::type, v1, v2, and Cloth::verts.
|
static |
Definition at line 81 of file SIM_mass_spring.cpp.
References ClothModifierData::clothObject, data, dot_v3v3(), Cloth::implicit, Cloth::mvert_num, and SIM_mass_spring_get_position().
Referenced by cloth_calc_force().
|
static |
Definition at line 124 of file SIM_mass_spring.cpp.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, ClothModifierData::hairdata, Cloth::primitive_num, Cloth::tri, MVertTri::tri, v, 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 358 of file SIM_mass_spring.cpp.
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, 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, ClothSpring::flags, ClothSimSettings::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 96 of file SIM_mass_spring.cpp.
References cloth_get_pressure_weights(), ClothModifierData::clothObject, data, ClothModifierData::hairdata, Cloth::implicit, Cloth::primitive_num, SIM_tri_tetra_volume_signed_6x(), Cloth::tri, and MVertTri::tri.
Referenced by cloth_calc_force().
|
static |
Definition at line 1216 of file SIM_mass_spring.cpp.
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 826 of file SIM_mass_spring.cpp.
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(), v1, v2, x2, and zero_v3().
Referenced by cloth_continuum_fill_grid().
Definition at line 911 of file SIM_mass_spring.cpp.
References cloth_continuum_add_hair_segments(), CLOTH_SPRING_TYPE_STRUCTURAL, data, if(), 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 951 of file SIM_mass_spring.cpp.
References Freestyle::a, usdtokens::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(), CLAMPIS, 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, Cloth::implicit, interp_v3_v3v3(), is_zero_v3(), madd_v3_v3fl(), madd_v3_v3v3fl(), Cloth::mvert_num, NULL, offset, 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 36 of file SIM_mass_spring.cpp.
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 791 of file SIM_mass_spring.cpp.
References add_v3_v3(), 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 59 of file SIM_mass_spring.cpp.
References ClothModifierData::clothObject, ClothModifierData::sim_parms, MVertTri::tri, 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 1226 of file SIM_mass_spring.cpp.
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 247 of file SIM_mass_spring.cpp.
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 1170 of file SIM_mass_spring.cpp.
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, 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, sub_v3_v3v3(), ClothSimSettings::timescale, Cloth::verts, verts, ClothSimSettings::vgroup_mass, and zero_v3().
Referenced by SIM_cloth_solve().
|
static |
Definition at line 551 of file SIM_mass_spring.cpp.
References ClothModifierData::clothObject, data, DO_MINMAX, Cloth::implicit, INIT_MINMAX, 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 806 of file SIM_mass_spring.cpp.
References CLOTH_SPRING_TYPE_STRUCTURAL, if(), 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 1256 of file SIM_mass_spring.cpp.
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, Cloth::implicit, interp_v3_v3v3(), mul_v3_fl(), Cloth::mvert_num, result, scene, 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, 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 205 of file SIM_mass_spring.cpp.
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 * | UNUSEDob, |
ClothModifierData * | clmd | ||
) |
Definition at line 178 of file SIM_mass_spring.cpp.
References cloth_count_nondiag_blocks(), ClothModifierData::clothObject, id, 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 215 of file SIM_mass_spring.cpp.
References ClothModifierData::clothObject, ClothModifierData::hairdata, 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 236 of file SIM_mass_spring.cpp.
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 200 of file SIM_mass_spring.cpp.
References data, and SIM_mass_spring_set_vertex_mass().
Referenced by do_step_cloth(), and SIM_cloth_solver_init().
|
static |
Definition at line 31 of file SIM_mass_spring.cpp.
Referenced by SIM_cloth_solver_set_positions().