Blender  V2.93
Macros | Functions | Variables
effect.c File Reference
#include <stdarg.h>
#include <stddef.h>
#include <math.h>
#include <stdlib.h>
#include "MEM_guardedalloc.h"
#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
#include "DNA_listBase.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math.h"
#include "BLI_noise.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include "BKE_anim_path.h"
#include "BKE_bvhutils.h"
#include "BKE_collection.h"
#include "BKE_collision.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_fluid.h"
#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_physics.h"
#include "DEG_depsgraph_query.h"
#include "RE_texture.h"

Go to the source code of this file.

Macros

#define rot(x, k)   (((x) << (k)) | ((x) >> (32 - (k))))
 

Functions

EffectorWeightsBKE_effector_add_weights (Collection *collection)
 
PartDeflectBKE_partdeflect_new (int type)
 
PartDeflectBKE_partdeflect_copy (const struct PartDeflect *pd_src)
 
void BKE_partdeflect_free (PartDeflect *pd)
 
static void precalculate_effector (struct Depsgraph *depsgraph, EffectorCache *eff)
 
static void add_effector_relation (ListBase *relations, Object *ob, ParticleSystem *psys, PartDeflect *pd)
 
static void add_effector_evaluation (ListBase **effectors, Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd)
 
ListBaseBKE_effector_relations_create (Depsgraph *depsgraph, ViewLayer *view_layer, Collection *collection)
 
void BKE_effector_relations_free (ListBase *lb)
 
static bool is_effector_enabled (PartDeflect *pd, bool use_rotation)
 
static bool is_effector_nonzero_strength (PartDeflect *pd)
 
static bool is_effector_relevant (PartDeflect *pd, EffectorWeights *weights, bool use_rotation)
 
ListBaseBKE_effectors_create (Depsgraph *depsgraph, Object *ob_src, ParticleSystem *psys_src, EffectorWeights *weights, bool use_rotation)
 
void BKE_effectors_free (ListBase *lb)
 
void pd_point_from_particle (ParticleSimulationData *sim, ParticleData *pa, ParticleKey *state, EffectedPoint *point)
 
void pd_point_from_loc (Scene *scene, float *loc, float *vel, int index, EffectedPoint *point)
 
void pd_point_from_soft (Scene *scene, float *loc, float *vel, int index, EffectedPoint *point)
 
static void eff_tri_ray_hit (void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit)
 
static float eff_calc_visibility (ListBase *colliders, EffectorCache *eff, EffectorData *efd, EffectedPoint *point)
 
static float wind_func (struct RNG *rng, float strength)
 
static float falloff_func (float fac, int usemin, float mindist, int usemax, float maxdist, float power)
 
static float falloff_func_dist (PartDeflect *pd, float fac)
 
static float falloff_func_rad (PartDeflect *pd, float fac)
 
float effector_falloff (EffectorCache *eff, EffectorData *efd, EffectedPoint *UNUSED(point), EffectorWeights *weights)
 
int closest_point_on_surface (SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3])
 
int get_effector_data (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int real_velocity)
 
static void get_effector_tot (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
 
static void do_texture_effector (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force)
 
static void do_physical_effector (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force)
 
void BKE_effectors_apply (ListBase *effectors, ListBase *colliders, EffectorWeights *weights, EffectedPoint *point, float *force, float *wind_force, float *impulse)
 
uint BKE_sim_debug_data_hash (int i)
 
uint BKE_sim_debug_data_hash_combine (uint kx, uint ky)
 
static uint debug_element_hash (const void *key)
 
static bool debug_element_compare (const void *a, const void *b)
 
static void debug_element_free (void *val)
 
void BKE_sim_debug_data_set_enabled (bool enable)
 
bool BKE_sim_debug_data_get_enabled (void)
 
void BKE_sim_debug_data_free (void)
 
static void debug_data_insert (SimDebugData *debug_data, SimDebugElement *elem)
 
void BKE_sim_debug_data_add_element (int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, uint hash)
 
void BKE_sim_debug_data_remove_element (uint hash)
 
void BKE_sim_debug_data_clear (void)
 
void BKE_sim_debug_data_clear_category (const char *category)
 

Variables

SimDebugData_sim_debug_data = NULL
 

Macro Definition Documentation

◆ rot

#define rot (   x,
 
)    (((x) << (k)) | ((x) >> (32 - (k))))

Function Documentation

◆ add_effector_evaluation()

static void add_effector_evaluation ( ListBase **  effectors,
Depsgraph depsgraph,
Scene scene,
Object ob,
ParticleSystem psys,
PartDeflect pd 
)
static

◆ add_effector_relation()

static void add_effector_relation ( ListBase relations,
Object ob,
ParticleSystem psys,
PartDeflect pd 
)
static

◆ BKE_effector_add_weights()

EffectorWeights* BKE_effector_add_weights ( Collection collection)

◆ BKE_effector_relations_create()

ListBase* BKE_effector_relations_create ( Depsgraph depsgraph,
ViewLayer view_layer,
Collection collection 
)

◆ BKE_effector_relations_free()

void BKE_effector_relations_free ( ListBase lb)

Definition at line 265 of file effect.c.

References BLI_freelistN(), and MEM_freeN.

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

◆ BKE_effectors_apply()

void BKE_effectors_apply ( ListBase effectors,
ListBase colliders,
EffectorWeights weights,
EffectedPoint point,
float force,
float wind_force,
float impulse 
)

◆ BKE_effectors_create()

ListBase* BKE_effectors_create ( Depsgraph depsgraph,
Object ob_src,
ParticleSystem psys_src,
EffectorWeights weights,
bool  use_rotation 
)

◆ BKE_effectors_free()

void BKE_effectors_free ( ListBase lb)

◆ BKE_partdeflect_copy()

PartDeflect* BKE_partdeflect_copy ( const struct PartDeflect pd_src)

Definition at line 125 of file effect.c.

References BLI_rng_copy(), MEM_dupallocN, NULL, and PartDeflect::rng.

Referenced by particle_settings_copy_data().

◆ BKE_partdeflect_free()

void BKE_partdeflect_free ( PartDeflect pd)

Definition at line 137 of file effect.c.

References BLI_rng_free(), MEM_freeN, and PartDeflect::rng.

Referenced by object_free_data(), and particle_settings_free_data().

◆ BKE_partdeflect_new()

PartDeflect* BKE_partdeflect_new ( int  type)

◆ BKE_sim_debug_data_add_element()

void BKE_sim_debug_data_add_element ( int  type,
const float  v1[3],
const float  v2[3],
const char *  str,
float  r,
float  g,
float  b,
const char *  category,
uint  hash 
)

◆ BKE_sim_debug_data_clear()

void BKE_sim_debug_data_clear ( void  )

Definition at line 1383 of file effect.c.

References _sim_debug_data, BLI_ghash_clear(), debug_element_free(), SimDebugData::gh, and NULL.

◆ BKE_sim_debug_data_clear_category()

void BKE_sim_debug_data_clear_category ( const char *  category)

◆ BKE_sim_debug_data_free()

void BKE_sim_debug_data_free ( void  )

◆ BKE_sim_debug_data_get_enabled()

bool BKE_sim_debug_data_get_enabled ( void  )

Definition at line 1295 of file effect.c.

References _sim_debug_data, and NULL.

◆ BKE_sim_debug_data_hash()

uint BKE_sim_debug_data_hash ( int  i)

Definition at line 1223 of file effect.c.

References BLI_ghashutil_uinthash().

◆ BKE_sim_debug_data_hash_combine()

uint BKE_sim_debug_data_hash_combine ( uint  kx,
uint  ky 
)

Definition at line 1228 of file effect.c.

References Freestyle::a, Freestyle::c, and rot.

◆ BKE_sim_debug_data_remove_element()

void BKE_sim_debug_data_remove_element ( uint  hash)

◆ BKE_sim_debug_data_set_enabled()

void BKE_sim_debug_data_set_enabled ( bool  enable)

◆ closest_point_on_surface()

int closest_point_on_surface ( SurfaceModifierData surmd,
const float  co[3],
float  surface_co[3],
float  surface_nor[3],
float  surface_vel[3] 
)

◆ debug_data_insert()

static void debug_data_insert ( SimDebugData debug_data,
SimDebugElement elem 
)
static

Definition at line 1310 of file effect.c.

References BLI_ghash_insert(), BLI_ghash_lookup(), SimDebugData::gh, and MEM_freeN.

Referenced by BKE_sim_debug_data_add_element().

◆ debug_element_compare()

static bool debug_element_compare ( const void *  a,
const void *  b 
)
static

Definition at line 1264 of file effect.c.

References Freestyle::a, and SimDebugElement::hash.

Referenced by BKE_sim_debug_data_set_enabled().

◆ debug_element_free()

static void debug_element_free ( void *  val)
static

◆ debug_element_hash()

static uint debug_element_hash ( const void *  key)
static

Definition at line 1258 of file effect.c.

References SimDebugElement::hash.

Referenced by BKE_sim_debug_data_set_enabled().

◆ do_physical_effector()

static void do_physical_effector ( EffectorCache eff,
EffectorData efd,
EffectedPoint point,
float total_force 
)
static

◆ do_texture_effector()

static void do_texture_effector ( EffectorCache eff,
EffectorData efd,
EffectedPoint point,
float total_force 
)
static

◆ eff_calc_visibility()

static float eff_calc_visibility ( ListBase colliders,
EffectorCache eff,
EffectorData efd,
EffectedPoint point 
)
static

◆ eff_tri_ray_hit()

static void eff_tri_ray_hit ( void *  UNUSEDuserData,
int   UNUSEDindex,
const BVHTreeRay UNUSEDray,
BVHTreeRayHit hit 
)
static

Definition at line 474 of file effect.c.

References BVHTreeRayHit::dist, and BVHTreeRayHit::index.

Referenced by eff_calc_visibility().

◆ effector_falloff()

float effector_falloff ( EffectorCache eff,
EffectorData efd,
EffectedPoint UNUSEDpoint,
EffectorWeights weights 
)

◆ falloff_func()

static float falloff_func ( float  fac,
int  usemin,
float  mindist,
int  usemax,
float  maxdist,
float  power 
)
static

Definition at line 569 of file effect.c.

References KDL::pow().

Referenced by falloff_func_dist(), and falloff_func_rad().

◆ falloff_func_dist()

static float falloff_func_dist ( PartDeflect pd,
float  fac 
)
static

◆ falloff_func_rad()

static float falloff_func_rad ( PartDeflect pd,
float  fac 
)
static

◆ get_effector_data()

int get_effector_data ( EffectorCache eff,
EffectorData efd,
EffectedPoint point,
int  real_velocity 
)

◆ get_effector_tot()

static void get_effector_tot ( EffectorCache eff,
EffectorData efd,
EffectedPoint point,
int *  tot,
int *  p,
int *  step 
)
static

◆ is_effector_enabled()

static bool is_effector_enabled ( PartDeflect pd,
bool  use_rotation 
)
static

◆ is_effector_nonzero_strength()

static bool is_effector_nonzero_strength ( PartDeflect pd)
static

◆ is_effector_relevant()

static bool is_effector_relevant ( PartDeflect pd,
EffectorWeights weights,
bool  use_rotation 
)
static

◆ pd_point_from_loc()

void pd_point_from_loc ( Scene scene,
float loc,
float vel,
int  index,
EffectedPoint point 
)

◆ pd_point_from_particle()

void pd_point_from_particle ( ParticleSimulationData sim,
ParticleData pa,
ParticleKey state,
EffectedPoint point 
)

◆ pd_point_from_soft()

void pd_point_from_soft ( Scene scene,
float loc,
float vel,
int  index,
EffectedPoint point 
)

◆ precalculate_effector()

static void precalculate_effector ( struct Depsgraph depsgraph,
EffectorCache eff 
)
static

◆ wind_func()

static float wind_func ( struct RNG rng,
float  strength 
)
static

Definition at line 551 of file effect.c.

References BLI_rng_get_float(), BLI_rng_get_int(), float(), random(), ret, and KDL::sign().

Referenced by do_physical_effector().

Variable Documentation

◆ _sim_debug_data

SimDebugData* _sim_debug_data = NULL