Blender V2.61 - r43446
|
#include "MEM_guardedalloc.h"
#include "DNA_cloth_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_utildefines.h"
#include "BLI_linklist.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_cloth.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_modifier.h"
#include "BKE_pointcache.h"
#include <sys/time.h>
Go to the source code of this file.
Definition in file cloth.c.
static BVHTree* bvhselftree_build_from_cloth | ( | ClothModifierData * | clmd, |
float | epsilon | ||
) | [static] |
Definition at line 164 of file cloth.c.
References BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), ClothModifierData::clothObject, co, copy_v3_v3(), i, NULL, Cloth::numverts, Cloth::verts, and ClothVertex::xold.
Referenced by cloth_from_object().
void bvhselftree_update_from_cloth | ( | ClothModifierData * | clmd, |
int | moving | ||
) |
Definition at line 303 of file cloth.c.
References BLI_bvhtree_update_node(), BLI_bvhtree_update_tree(), Cloth::bvhselftree, ClothModifierData::clothObject, co, copy_v3_v3(), i, Cloth::mfaces, NULL, Cloth::numverts, ClothVertex::tx, ClothVertex::txold, and Cloth::verts.
Referenced by cloth_bvh_objcollision().
static BVHTree* bvhtree_build_from_cloth | ( | ClothModifierData * | clmd, |
float | epsilon | ||
) | [static] |
Definition at line 203 of file cloth.c.
References BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), ClothModifierData::clothObject, co, copy_v3_v3(), i, Cloth::mfaces, NULL, Cloth::numfaces, MFace::v1, MFace::v2, MFace::v3, MFace::v4, Cloth::verts, and ClothVertex::xold.
Referenced by cloth_from_object().
void bvhtree_update_from_cloth | ( | ClothModifierData * | clmd, |
int | moving | ||
) |
Definition at line 249 of file cloth.c.
References BLI_bvhtree_update_node(), BLI_bvhtree_update_tree(), Cloth::bvhtree, ClothModifierData::clothObject, co, copy_v3_v3(), i, Cloth::mfaces, NULL, Cloth::numfaces, ClothVertex::tx, ClothVertex::txold, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and Cloth::verts.
Referenced by cloth_bvh_objcollision().
int cloth_add_spring | ( | ClothModifierData * | clmd, |
unsigned int | indexA, | ||
unsigned int | indexB, | ||
float | restlength, | ||
int | spring_type | ||
) |
Definition at line 988 of file cloth.c.
References BLI_linklist_prepend(), ClothModifierData::clothObject, ClothSpring::flags, ClothSpring::ij, ClothSpring::kl, MEM_callocN(), NULL, Cloth::numsprings, ClothSpring::restlen, Cloth::springs, ClothSpring::stiffness, and ClothSpring::type.
Referenced by cloth_from_object().
static void cloth_apply_vgroup | ( | ClothModifierData * | clmd, |
DerivedMesh * | dm | ||
) | [static] |
cloth_apply_vgroup - applies a vertex group as specified by type
Definition at line 746 of file cloth.c.
References ClothVertex::bend_stiff, CD_MDEFORMVERT, CLOTH_SIMSETTINGS_FLAG_GOAL, CLOTH_SIMSETTINGS_FLAG_SCALING, cloth_uses_vgroup(), CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, MDeformWeight::def_nr, MDeformVert::dw, ClothVertex::flags, ClothSimSettings::flags, DerivedMesh::getNumVerts, DerivedMesh::getVertData, ClothVertex::goal, i, NULL, pow(), ClothVertex::shear_stiff, ClothModifierData::sim_parms, SOFTGOALSNAP, ClothVertex::struct_stiff, MDeformVert::totweight, Cloth::verts, ClothSimSettings::vgroup_bend, ClothSimSettings::vgroup_mass, ClothSimSettings::vgroup_struct, and MDeformWeight::weight.
Referenced by cloth_from_object().
static int cloth_build_springs | ( | ClothModifierData * | clmd, |
DerivedMesh * | dm | ||
) | [static] |
Definition at line 1051 of file cloth.c.
References ClothVertex::avg_spring_len, ClothSimSettings::avg_spring_len, ClothVertex::bend_stiff, BLI_edgehash_haskey(), BLI_edgehash_insert(), BLI_edgehash_new(), BLI_linklist_append(), BLI_linklist_free(), BLI_linklist_prepend(), cloth_free_errorsprings(), CLOTH_SPRING_TYPE_BENDING, CLOTH_SPRING_TYPE_SHEAR, CLOTH_SPRING_TYPE_STRUCTURAL, ClothModifierData::clothObject, Cloth::edgehash, ClothSpring::flags, G, DerivedMesh::getEdgeArray, DerivedMesh::getFaceArray, DerivedMesh::getNumEdges, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, i, ClothSpring::ij, ClothSpring::kl, len_v3v3(), LinkNode::link, MAX2, MEM_callocN(), MEM_freeN(), MIN2, LinkNode::next, NULL, Cloth::numsprings, ClothSpring::restlen, ClothVertex::shear_stiff, ClothModifierData::sim_parms, ClothVertex::spring_count, Cloth::springs, ClothSpring::stiffness, ClothVertex::struct_stiff, ClothSpring::type, Cloth::verts, and ClothVertex::xrest.
Referenced by cloth_from_object().
void cloth_clear_cache | ( | Object * | ob, |
ClothModifierData * | clmd, | ||
float | framenr | ||
) |
Definition at line 347 of file cloth.c.
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 void cloth_free_errorsprings | ( | Cloth * | cloth, |
EdgeHash * | UNUSEDedgehash, | ||
LinkNode ** | edgelist | ||
) | [static] |
Definition at line 1018 of file cloth.c.
References BLI_edgehash_free(), BLI_linklist_free(), Cloth::edgehash, i, LinkNode::link, MEM_freeN(), LinkNode::next, NULL, Cloth::numverts, and Cloth::springs.
Referenced by cloth_build_springs().
void cloth_free_modifier | ( | ClothModifierData * | clmd | ) |
Definition at line 558 of file cloth.c.
References BLI_bvhtree_free(), BLI_edgehash_free(), BLI_linklist_free(), Cloth::bvhselftree, Cloth::bvhtree, ClothModifierData::clothObject, Cloth::edgehash, CM_SOLVER_DEF::free, LinkNode::link, MEM_freeN(), Cloth::mfaces, LinkNode::next, NULL, Cloth::numsprings, Cloth::numverts, ClothModifierData::sim_parms, ClothSimSettings::solver_type, Cloth::springs, and Cloth::verts.
Referenced by BKE_ptcache_id_reset(), cloth_from_mesh(), cloth_from_object(), free_hair(), and hair_step().
void cloth_free_modifier_extern | ( | ClothModifierData * | clmd | ) |
Definition at line 627 of file cloth.c.
References BLI_bvhtree_free(), BLI_edgehash_free(), BLI_linklist_free(), Cloth::bvhselftree, Cloth::bvhtree, ClothModifierData::clothObject, Cloth::edgehash, CM_SOLVER_DEF::free, G, LinkNode::link, MEM_freeN(), Cloth::mfaces, LinkNode::next, NULL, Cloth::numsprings, Cloth::numverts, ClothModifierData::sim_parms, ClothSimSettings::solver_type, Cloth::springs, and Cloth::verts.
Referenced by freeData().
static void cloth_from_mesh | ( | ClothModifierData * | clmd, |
DerivedMesh * | dm | ||
) | [static] |
Definition at line 943 of file cloth.c.
References cloth_free_modifier(), ClothModifierData::clothObject, DerivedMesh::getFaceArray, DerivedMesh::getNumFaces, DerivedMesh::getNumVerts, i, MEM_callocN(), MEM_freeN(), Cloth::mfaces, ClothModifierData::modifier, modifier_setError(), NULL, Cloth::numfaces, Cloth::numverts, Cloth::springs, and Cloth::verts.
Referenced by cloth_from_object().
static int cloth_from_object | ( | Object * | ob, |
ClothModifierData * | clmd, | ||
DerivedMesh * | dm, | ||
float | UNUSEDframenr, | ||
int | first | ||
) | [static] |
Definition at line 816 of file cloth.c.
References ALMOST_ZERO, ClothVertex::avg_spring_len, Cloth::bvhselftree, bvhselftree_build_from_cloth(), Cloth::bvhtree, bvhtree_build_from_cloth(), CD_CLOTH_ORCO, cloth_add_spring(), cloth_apply_vgroup(), cloth_build_springs(), cloth_free_modifier(), cloth_from_mesh(), CLOTH_SIMSETTINGS_FLAG_GOAL, CLOTH_SPRING_TYPE_GOAL, CLOTH_VERT_FLAG_PINNED, ClothModifierData::clothObject, MVert::co, ClothModifierData::coll_parms, copy_v3_v3(), ClothSimSettings::defgoal, ClothCollSettings::distance_repel, Cloth::edgehash, ClothCollSettings::epsilon, ClothVertex::flags, ClothSimSettings::flags, G, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, DerivedMesh::getVertDataArray, ClothVertex::goal, i, implicit_set_positions(), ClothVertex::impulse, ClothVertex::impulse_count, CM_SOLVER_DEF::init, ClothVertex::mass, ClothSimSettings::mass, MAX2, MEM_callocN(), ClothModifierData::modifier, modifier_setError(), mul_m4_v3(), mul_v3_fl(), NULL, Cloth::numsprings, Object::obmat, Cloth::old_solver_type, ClothCollSettings::selfepsilon, ClothSimSettings::shapekey_rest, ClothModifierData::sim_parms, ClothSimSettings::solver_type, Cloth::springs, ClothVertex::tx, ClothVertex::txold, ClothVertex::v, Cloth::verts, ClothVertex::x, ClothVertex::xconst, ClothVertex::xold, and ClothVertex::xrest.
static int cloth_from_object | ( | Object * | ob, |
ClothModifierData * | clmd, | ||
DerivedMesh * | dm, | ||
float | framenr, | ||
int | first | ||
) | [static] |
Referenced by do_init_cloth().
void cloth_init | ( | ClothModifierData * | clmd | ) |
cloth_init - creates a new cloth simulation.
1. create object 2. fill object with standard values or with the GUI settings if given
Definition at line 111 of file cloth.c.
References ClothSimSettings::avg_spring_len, ClothSimSettings::bending, BKE_add_effector_weights(), ClothSimSettings::Cdis, CLOTH_COLLSETTINGS_FLAG_ENABLED, ClothModifierData::coll_parms, ClothCollSettings::collision_list, ClothSimSettings::Cvi, ClothSimSettings::defgoal, ClothSimSettings::eff_force_scale, ClothSimSettings::eff_wind_scale, ClothSimSettings::effector_weights, ClothCollSettings::epsilon, ClothCollSettings::flags, ClothSimSettings::flags, ClothCollSettings::friction, ClothSimSettings::goalfrict, ClothSimSettings::goalspring, ClothSimSettings::gravity, ClothCollSettings::loop_count, ClothSimSettings::mass, ClothSimSettings::maxgoal, ClothSimSettings::maxspringlen, ClothSimSettings::mingoal, NULL, ClothModifierData::point_cache, ClothSimSettings::preroll, ClothSimSettings::presets, ClothSimSettings::reset, ClothCollSettings::self_friction, ClothCollSettings::self_loop_count, ClothCollSettings::selfepsilon, ClothSimSettings::shear, ClothModifierData::sim_parms, ClothSimSettings::solver_type, PointCache::step, ClothSimSettings::stepsPerFrame, ClothSimSettings::structural, ClothSimSettings::timescale, ClothSimSettings::velocity_smooth, and ClothSimSettings::vgroup_mass.
Referenced by initData().
static void cloth_to_object | ( | Object * | ob, |
ClothModifierData * | clmd, | ||
DerivedMesh * | dm | ||
) | [static] |
cloth_to_object - copies the deformed vertices to the object.
Definition at line 709 of file cloth.c.
References CDDM_get_verts(), ClothModifierData::clothObject, MVert::co, co, copy_v3_v3(), DerivedMesh::getNumVerts, i, Object::imat, invert_m4_m4(), mul_m4_v3(), NULL, Object::obmat, Cloth::verts, and ClothVertex::x.
Referenced by clothModifier_do().
int cloth_uses_vgroup | ( | ClothModifierData * | clmd | ) |
Definition at line 732 of file cloth.c.
References CLOTH_SIMSETTINGS_FLAG_GOAL, CLOTH_SIMSETTINGS_FLAG_SCALING, ClothSimSettings::flags, ClothModifierData::sim_parms, ClothSimSettings::vgroup_bend, ClothSimSettings::vgroup_mass, and ClothSimSettings::vgroup_struct.
Referenced by cloth_apply_vgroup(), and requiredDataMask().
DerivedMesh* clothModifier_do | ( | ClothModifierData * | clmd, |
Scene * | scene, | ||
Object * | ob, | ||
DerivedMesh * | dm | ||
) | [read] |
Definition at line 431 of file cloth.c.
References BKE_ptcache_get_continue_physics(), 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(), CDDM_copy(), RenderData::cfra, cloth_to_object(), ClothModifierData::clothObject, do_init_cloth(), do_step_cloth(), ClothSimSettings::dt, PointCache::flag, DerivedMesh::getNumVerts, implicit_set_positions(), PointCache::last_exact, Cloth::last_frame, Cloth::numverts, ClothModifierData::point_cache, ClothSimSettings::preroll, PTCACHE_BAKED, PTCACHE_OUTDATED, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED, PTCACHE_READ_OLD, PTCACHE_REDO_NEEDED, PTCACHE_RESET_OUTDATED, Scene::r, ClothSimSettings::reset, ClothModifierData::scene, ClothModifierData::sim_parms, PointCache::simframe, ClothSimSettings::stepsPerFrame, RenderData::subframe, and ClothSimSettings::timescale.
Referenced by applyModifier(), and do_hair_dynamics().
static int do_init_cloth | ( | Object * | ob, |
ClothModifierData * | clmd, | ||
DerivedMesh * | result, | ||
int | framenr | ||
) | [static] |
Definition at line 360 of file cloth.c.
References BKE_ptcache_invalidate(), cloth_from_object(), ClothModifierData::clothObject, implicit_set_positions(), Cloth::last_frame, MINFRAME, NULL, and ClothModifierData::point_cache.
Referenced by clothModifier_do().
static int do_step_cloth | ( | Object * | ob, |
ClothModifierData * | clmd, | ||
DerivedMesh * | result, | ||
int | framenr | ||
) | [static] |
Definition at line 386 of file cloth.c.
References ClothModifierData::clothObject, MVert::co, copy_v3_v3(), ClothSimSettings::effector_weights, DerivedMesh::getVertArray, i, mul_m4_v3(), NULL, Cloth::numverts, Object::obmat, pdEndEffectors(), pdInitEffectors(), ClothModifierData::scene, ClothModifierData::sim_parms, CM_SOLVER_DEF::solver, ClothSimSettings::solver_type, tend(), tstart(), ClothVertex::txold, Cloth::verts, ClothVertex::x, ClothVertex::xconst, and ClothVertex::xold.
Referenced by clothModifier_do().
void tend | ( | void | ) |
Definition at line 68 of file cloth.c.
Referenced by do_step_cloth(), draw_volume(), and TNT::operator*().
void tstart | ( | void | ) |
Definition at line 64 of file cloth.c.
References tz.
Referenced by do_step_cloth(), and draw_volume().
double tval | ( | void | ) |
Definition at line 72 of file cloth.c.
References _tend.
Referenced by BPY_driver_exec(), and pose_slide_apply_props().
struct timeval _tstart _tend [static] |
CM_SOLVER_DEF solvers[] [static] |
{ { "Implicit", CM_IMPLICIT, implicit_init, implicit_solver, implicit_free }, }
struct timezone tz [static] |
Definition at line 63 of file cloth.c.
Referenced by atHomePosition(), lensDistort(), nearHomePosition(), RE_make_stars(), tend(), and tstart().