Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_cloth.c
| Show First 20 Lines • Show All 440 Lines • ▼ Show 20 Lines | for (int i = 0; i < cloth_sim->tot_length_constraints; i++) { | ||||
| sub_v3_v3v3(v1_to_v2, cloth_sim->pos[v2], cloth_sim->pos[v1]); | sub_v3_v3v3(v1_to_v2, cloth_sim->pos[v2], cloth_sim->pos[v1]); | ||||
| const float current_distance = len_v3(v1_to_v2); | const float current_distance = len_v3(v1_to_v2); | ||||
| float correction_vector[3]; | float correction_vector[3]; | ||||
| float correction_vector_half[3]; | float correction_vector_half[3]; | ||||
| const float constraint_distance = constraint->length + | const float constraint_distance = constraint->length + | ||||
| (cloth_sim->length_constraint_tweak[v1] * 0.5f) + | (cloth_sim->length_constraint_tweak[v1] * 0.5f) + | ||||
| (cloth_sim->length_constraint_tweak[v2] * 0.5f); | (cloth_sim->length_constraint_tweak[v2] * 0.5f); | ||||
| if (current_distance > 0.0f) { | |||||
| mul_v3_v3fl(correction_vector, v1_to_v2, 1.0f - (constraint_distance / current_distance)); | mul_v3_v3fl(correction_vector, v1_to_v2, 1.0f - (constraint_distance / current_distance)); | ||||
| } | |||||
| else { | |||||
| copy_v3_v3(correction_vector, v1_to_v2); | |||||
| } | |||||
| mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f); | mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f); | ||||
| const float mask_v1 = (1.0f - SCULPT_vertex_mask_get(ss, v1)) * | const float mask_v1 = (1.0f - SCULPT_vertex_mask_get(ss, v1)) * | ||||
| SCULPT_automasking_factor_get(ss, v1); | SCULPT_automasking_factor_get(ss, v1); | ||||
| const float mask_v2 = (1.0f - SCULPT_vertex_mask_get(ss, v2)) * | const float mask_v2 = (1.0f - SCULPT_vertex_mask_get(ss, v2)) * | ||||
| SCULPT_automasking_factor_get(ss, v2); | SCULPT_automasking_factor_get(ss, v2); | ||||
| const float sim_factor_v1 = cloth_brush_simulation_falloff_get( | const float sim_factor_v1 = cloth_brush_simulation_falloff_get( | ||||
| ▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines | |||||