Blender V5.0
BKE_collision.h File Reference

Go to the source code of this file.

Classes

struct  CollPair
struct  EdgeCollPair
struct  FaceCollPair
struct  CollisionRelation
struct  ColliderCache

Functions

BVH Tree Utilities

Used in modifier.cc from collision.cc.

struct BVHTreebvhtree_build_from_mvert (const float(*positions)[3], const blender::int3 *vert_tris, int tri_num, float epsilon)
void bvhtree_update_from_mvert (struct BVHTree *bvhtree, const float(*positions)[3], const float(*positions_moving)[3], const blender::int3 *vert_tris, int tri_num, bool moving)
Collision Modifier Data
void collision_move_object (struct CollisionModifierData *collmd, float step, float prevstep, bool moving_bvh)
void collision_get_collider_velocity (float vel_old[3], float vel_new[3], struct CollisionModifierData *collmd, struct CollPair *collpair)

Collision Data Types

Used for collisions in collision.cc.

enum  COLLISION_FLAGS { COLLISION_IN_FUTURE = (1 << 1) , COLLISION_INACTIVE = (1 << 4) }
typedef struct CollPair CollPair
typedef struct EdgeCollPair EdgeCollPair
typedef struct FaceCollPair FaceCollPair

Collision Relations

Collision relations for dependency graph build.

typedef struct CollisionRelation CollisionRelation
struct ListBaseBKE_collision_relations_create (struct Depsgraph *depsgraph, struct Collection *collection, unsigned int modifier_type)
void BKE_collision_relations_free (struct ListBase *relations)
struct Object ** BKE_collision_objects_create (struct Depsgraph *depsgraph, struct Object *self, struct Collection *collection, unsigned int *numcollobj, unsigned int modifier_type)
void BKE_collision_objects_free (struct Object **objects)

Collision Cache

typedef struct ColliderCache ColliderCache
struct ListBaseBKE_collider_cache_create (struct Depsgraph *depsgraph, struct Object *self, struct Collection *collection)
void BKE_collider_cache_free (struct ListBase **colliders)

Typedef Documentation

◆ ColliderCache

typedef struct ColliderCache ColliderCache

◆ CollisionRelation

typedef struct CollisionRelation CollisionRelation

◆ CollPair

typedef struct CollPair CollPair

◆ EdgeCollPair

typedef struct EdgeCollPair EdgeCollPair

◆ FaceCollPair

typedef struct FaceCollPair FaceCollPair

Enumeration Type Documentation

◆ COLLISION_FLAGS

Enumerator
COLLISION_IN_FUTURE 
COLLISION_INACTIVE 

Definition at line 25 of file BKE_collision.h.

Function Documentation

◆ BKE_collider_cache_create()

struct ListBase * BKE_collider_cache_create ( struct Depsgraph * depsgraph,
struct Object * self,
struct Collection * collection )

Create effective list of colliders from relations built beforehand. Self will be excluded.

Definition at line 1328 of file collision.cc.

References BKE_modifiers_findby_type(), BLI_addtail(), CollisionModifierData::bvhtree, col, collision_move_object(), DEG_get_collision_relations(), DEG_get_evaluated(), depsgraph, eModifierType_Collision, LISTBASE_FOREACH, MEM_callocN(), and self.

Referenced by dynamics_step(), and eff_calc_visibility().

◆ BKE_collider_cache_free()

void BKE_collider_cache_free ( struct ListBase ** colliders)

Definition at line 1365 of file collision.cc.

References BLI_freelistN(), and MEM_freeN().

Referenced by eff_calc_visibility().

◆ BKE_collision_objects_create()

struct Object ** BKE_collision_objects_create ( struct Depsgraph * depsgraph,
struct Object * self,
struct Collection * collection,
unsigned int * numcollobj,
unsigned int modifier_type )

◆ BKE_collision_objects_free()

void BKE_collision_objects_free ( struct Object ** objects)

◆ BKE_collision_relations_create()

struct ListBase * BKE_collision_relations_create ( struct Depsgraph * depsgraph,
struct Collection * collection,
unsigned int modifier_type )

Create list of collision relations in the collection or entire scene. This is used by the depsgraph to build relations, as well as faster lookup of colliders during evaluation.

Definition at line 1252 of file collision.cc.

References add_collision_object(), BASE_ENABLED_RENDER, BASE_ENABLED_VIEWPORT, BKE_collection_or_layer_objects(), DAG_EVAL_RENDER, DEG_get_input_scene(), DEG_get_input_view_layer(), DEG_get_mode(), depsgraph, Base::flag, MEM_callocN(), Base::next, and Base::object.

Referenced by blender::deg::build_collision_relations().

◆ BKE_collision_relations_free()

void BKE_collision_relations_free ( struct ListBase * relations)

Definition at line 1273 of file collision.cc.

References BLI_freelistN(), and MEM_freeN().

Referenced by blender::deg::clear_physics_relations().

◆ bvhtree_build_from_mvert()

struct BVHTree * bvhtree_build_from_mvert ( const float(*) positions[3],
const blender::int3 * vert_tris,
int tri_num,
float epsilon )

Definition at line 89 of file collision.cc.

References BLI_bvhtree_balance(), BLI_bvhtree_insert(), BLI_bvhtree_new(), copy_v3_v3(), i, and tree.

Referenced by deform_verts().

◆ bvhtree_update_from_mvert()

void bvhtree_update_from_mvert ( struct BVHTree * bvhtree,
const float(*) positions[3],
const float(*) positions_moving[3],
const blender::int3 * vert_tris,
int tri_num,
bool moving )

◆ collision_get_collider_velocity()

void collision_get_collider_velocity ( float vel_old[3],
float vel_new[3],
struct CollisionModifierData * collmd,
struct CollPair * collpair )

◆ collision_move_object()