Blender  V3.3
BKE_particle.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2007 Janne Karhu. All rights reserved.
3  * 2011-2012 AutoCRC (adaptive time step, Classical SPH). */
4 
5 #pragma once
6 
11 #include "BLI_buffer.h"
12 #include "BLI_utildefines.h"
13 
14 #include "DNA_particle_types.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 struct ParticleKey;
21 struct ParticleSettings;
22 struct ParticleSystem;
24 
25 struct BVHTreeRay;
26 struct BVHTreeRayHit;
27 struct BlendDataReader;
28 struct BlendLibReader;
29 struct BlendWriter;
31 struct Depsgraph;
32 struct EdgeHash;
33 struct KDTree_3d;
34 struct LatticeDeformData;
35 struct LinkNode;
36 struct MCol;
37 struct MFace;
38 struct MTFace;
39 struct MVert;
40 struct Main;
41 struct ModifierData;
42 struct Object;
43 struct RNG;
44 struct Scene;
45 
46 #define PARTICLE_COLLISION_MAX_COLLISIONS 10
47 
48 #define PARTICLE_P \
49  ParticleData *pa; \
50  int p
51 #define LOOP_PARTICLES for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++)
52 #define LOOP_EXISTING_PARTICLES \
53  for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
54  if (!(pa->flag & PARS_UNEXIST))
55 #define LOOP_SHOWN_PARTICLES \
56  for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
57  if (!(pa->flag & (PARS_UNEXIST | PARS_NO_DISP)))
58 /* OpenMP: Can only advance one variable within loop definition. */
59 #define LOOP_DYNAMIC_PARTICLES \
60  for (p = 0; p < psys->totpart; p++) \
61  if ((pa = psys->particles + p)->state.time > 0.0f)
62 
63 /* Fast but sure way to get the modifier. */
64 #define PARTICLE_PSMD \
65  ParticleSystemModifierData *psmd = sim->psmd ? sim->psmd : psys_get_modifier(sim->ob, sim->psys)
66 
67 /* common stuff that many particle functions need */
68 typedef struct ParticleSimulationData {
70  struct Scene *scene;
71  struct Object *ob;
75  /* Courant number. This is used to implement an adaptive time step. Only the
76  * maximum value per time step is important. Only sph_integrate makes use of
77  * this at the moment. Other solvers could, too. */
78  float courant_num;
79  /* Only valid during dynamics_step(). */
80  struct RNG *rng;
82 
83 typedef struct SPHData {
86  float mass;
87  struct EdgeHash *eh;
88  float *gravity;
89  float hfac;
90  /* Average distance to neighbors (other particles in the support domain),
91  * for calculating the Courant number (adaptive time step). */
92  int pass;
93  float element_size;
94  float flow[3];
95 
96  /* Temporary thread-local buffer for springs created during this step. */
98 
99  /* Integrator callbacks. This allows different SPH implementations. */
100  void (*force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse);
101  void (*density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist);
103 
104 typedef struct ParticleTexture {
105  float ivel; /* used in reset */
106  float time, life, exist, size; /* used in init */
107  float damp, gravity, field; /* used in physics */
108  float length, clump, kink_freq, kink_amp, effector; /* used in path caching */
109  float rough1, rough2, roughe; /* used in path caching */
110  float twist; /* used in path caching */
112 
113 typedef struct ParticleSeam {
114  float v0[3], v1[3];
115  float nor[3], dir[3], tan[3];
116  float length2;
118 
119 typedef struct ParticleCacheKey {
120  float co[3];
121  float vel[3];
122  float rot[4];
123  float col[3];
124  float time;
125  int segments;
127 
128 typedef struct ParticleThreadContext {
129  /* shared */
131  struct Mesh *mesh;
132  struct Material *ma;
133 
134  /* distribution */
135  struct KDTree_3d *tree;
136 
138  int totseam;
139 
140  float *jit, *jitoff, *weight;
141  float maxweight;
143 
144  int cfrom, distr;
145 
147 
148  /* path caching */
152 
153  float cfra;
154 
157  float *vg_effector;
158  float *vg_twist;
159 
164 
165 typedef struct ParticleTask {
167  struct RNG *rng, *rng_path;
168  int begin, end;
170 
171 typedef struct ParticleCollisionElement {
172  /* pointers to original data */
173  float *x[3], *v[3];
174 
175  /* Values interpolated from original data. */
176  float x0[3], x1[3], x2[3], p[3];
177 
178  /* results for found intersection point */
179  float nor[3], vel[3], uv[2];
180 
181  /* count of original data (1-4) */
182  int tot;
183 
184  /* index of the collision face */
185  int index;
186 
187  /* flags for inversed normal / particle already inside element at start */
188  short inv_nor, inside;
190 
192 typedef struct ParticleCollision {
193  struct Object *current;
194  struct Object *hit;
196  struct Object *emitter;
197 
200 
202  float f;
203  float fac1, fac2;
204 
205  float cfra, old_cfra;
206 
209 
211 
213 
214  /* total_time is the amount of time in this subframe
215  * inv_total_time is the opposite
216  * inv_timestep is the inverse of the amount of time in this frame */
218 
219  float radius;
220  float co1[3], co2[3];
221  float ve1[3], ve2[3];
222 
223  float acc[3], boid_z;
224 
225  int boid;
227 
228 typedef struct ParticleDrawData {
229  float *vdata, *vd; /* vertex data */
230  float *ndata, *nd; /* normal data */
231  float *cdata, *cd; /* color data */
232  float *vedata, *ved; /* velocity data */
233  float *ma_col;
235  int flag;
238 
239 #define PARTICLE_DRAW_DATA_UPDATED 1
240 
241 #define PSYS_FRAND_COUNT 1024
242 extern unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
243 extern unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT];
244 extern float PSYS_FRAND_BASE[PSYS_FRAND_COUNT];
245 
246 void BKE_particle_init_rng(void);
247 
248 BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
249 {
250  /* XXX far from ideal, this simply scrambles particle random numbers a bit
251  * to avoid obvious correlations.
252  * Can't use previous psys->frand arrays because these require initialization
253  * inside psys_check_enabled, which wreaks havoc in multi-threaded depsgraph updates.
254  */
255  unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
256  unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
257  return PSYS_FRAND_BASE[(offset + seed * multiplier) % PSYS_FRAND_COUNT];
258 }
259 
260 BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float vec[3])
261 {
262  unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
263  unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
264  vec[0] = PSYS_FRAND_BASE[(offset + (seed + 0) * multiplier) % PSYS_FRAND_COUNT];
265  vec[1] = PSYS_FRAND_BASE[(offset + (seed + 1) * multiplier) % PSYS_FRAND_COUNT];
266  vec[2] = PSYS_FRAND_BASE[(offset + (seed + 2) * multiplier) % PSYS_FRAND_COUNT];
267 }
268 
269 /* ----------- functions needed outside particlesystem ---------------- */
270 /* particle.c */
271 
272 /* Few helpers for count-all etc. */
273 
274 int count_particles(struct ParticleSystem *psys);
275 int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur);
276 
277 int psys_get_child_number(struct Scene *scene,
278  struct ParticleSystem *psys,
279  bool use_render_params);
280 int psys_get_tot_child(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params);
281 
285 struct ParticleSystem *psys_get_current(struct Object *ob);
286 
287 /* For RNA API. */
288 
289 short psys_get_current_num(struct Object *ob);
290 void psys_set_current_num(struct Object *ob, int index);
291 /* UNUSED */
292 // struct Object *psys_find_object(struct Scene *scene, struct ParticleSystem *psys);
293 
299 
305 struct ParticleSystem *psys_orig_get(struct ParticleSystem *psys);
306 
312  struct Object *object,
313  struct ParticleSystem *psys);
314 
315 bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys);
316 bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params);
317 bool psys_check_edited(struct ParticleSystem *psys);
318 
323 
327 void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit);
331 void psys_free(struct Object *ob, struct ParticleSystem *psys);
335 void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src);
336 
338  struct ChildParticle *cpa,
339  float *params);
340 
341 void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2]);
342 void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc);
343 
344 void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
345 
347  struct CustomData_MeshMasks *r_cddata_masks);
349  int from,
350  int index,
351  int index_dmcache,
352  float fuv[4],
353  float foffset,
354  float vec[3],
355  float nor[3],
356  float utan[3],
357  float vtan[3],
358  float orco[3]);
360  struct ParticleSystem *psys);
361 
362 struct ModifierData *object_add_particle_system(struct Main *bmain,
363  struct Scene *scene,
364  struct Object *ob,
365  const char *name);
367  struct Scene *scene,
368  struct Object *ob,
369  const struct ParticleSystem *psys_orig);
371  struct Scene *scene,
372  struct Object *ob,
373  struct ParticleSystem *psys);
374 struct ParticleSettings *BKE_particlesettings_add(struct Main *bmain, const char *name);
375 void psys_reset(struct ParticleSystem *psys, int mode);
376 
377 void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params);
378 
379 void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname);
380 
387 void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params);
389  struct Scene *scene,
390  struct Object *ob,
391  struct PTCacheEdit *edit,
392  float cfra,
393  bool use_render_params);
395  float cfra,
396  bool editupdate,
397  bool use_render_params);
398 bool do_guides(struct Depsgraph *depsgraph,
399  struct ParticleSettings *part,
400  struct ListBase *effectors,
402  int index,
403  float time);
404 void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors);
405 float psys_get_timestep(struct ParticleSimulationData *sim);
406 float psys_get_child_time(struct ParticleSystem *psys,
407  struct ChildParticle *cpa,
408  float cfra,
409  float *birthtime,
410  float *dietime);
412  struct ChildParticle *cpa,
413  float cfra,
414  float *pa_time);
419  int pa_num,
420  struct ParticleKey *state,
421  bool vel);
427  int p,
428  struct ParticleKey *state,
429  bool always);
430 
431 /* Child paths. */
432 
437  struct ListBase *modifiers,
438  struct ChildParticle *cpa,
439  struct ParticleTexture *ptex,
440  const float orco[3],
441  float hairmat[4][4],
442  struct ParticleCacheKey *keys,
443  struct ParticleCacheKey *parent_keys,
444  const float parent_orco[3]);
445 
446 void psys_sph_init(struct ParticleSimulationData *sim, struct SPHData *sphdata);
447 void psys_sph_finalize(struct SPHData *sphdata);
451 void psys_sph_density(struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2]);
452 
453 /* For anim.c */
454 
455 void psys_get_dupli_texture(struct ParticleSystem *psys,
456  struct ParticleSettings *part,
457  struct ParticleSystemModifierData *psmd,
458  struct ParticleData *pa,
459  struct ChildParticle *cpa,
460  float uv[2],
461  float orco[3]);
463  struct ParticleData *pa,
464  struct ChildParticle *cpa,
465  struct ParticleCacheKey *cache,
466  float mat[4][4],
467  float *scale);
468 
473  struct ParticleSimulationData *sim);
476  int startpart,
477  int endpart,
478  struct ParticleTask **r_tasks,
479  int *r_numtasks);
480 void psys_tasks_free(struct ParticleTask *tasks, int numtasks);
481 
483  struct Scene *scene,
484  struct Object *ob,
485  struct ParticleSystem *psys);
486 
487 /* particle_system.c */
488 
489 struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
494 void psys_update_particle_tree(struct ParticleSystem *psys, float cfra);
498 void psys_changed_type(struct Object *ob, struct ParticleSystem *psys);
499 
500 void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys);
502  ParticleSystem *psys,
503  int *sfra,
504  int *efra);
505 
506 void psys_check_boid_data(struct ParticleSystem *psys);
507 
509  struct ParticleData *pa,
510  struct ParticleKey *state,
511  float dtime,
512  float cfra);
513 
519  struct Scene *scene,
520  struct Object *ob,
521  struct ParticleSystem *psys,
522  bool use_render_params);
523 
527 typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys,
528  struct ID **idpoin,
529  void *userdata,
530  int cb_flag);
531 
534  void *userdata);
535 
539 void BKE_particlesystem_reset_all(struct Object *object);
540 
541 /* ----------- functions needed only inside particlesystem ------------ */
542 
543 /* particle.c */
544 
545 void psys_disable_all(struct Object *ob);
546 void psys_enable_all(struct Object *ob);
547 
548 void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics);
549 void free_keyed_keys(struct ParticleSystem *psys);
550 void psys_free_particles(struct ParticleSystem *psys);
551 void psys_free_children(struct ParticleSystem *psys);
552 
554  short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity);
555 void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3]);
557  struct Mesh *mesh,
558  short from,
559  struct ParticleData *pa,
560  float hairmat[4][4]);
561 void psys_mat_hair_to_global(struct Object *ob,
562  struct Mesh *mesh,
563  short from,
564  struct ParticleData *pa,
565  float hairmat[4][4]);
566 void psys_mat_hair_to_orco(struct Object *ob,
567  struct Mesh *mesh,
568  short from,
569  struct ParticleData *pa,
570  float hairmat[4][4]);
571 
572 float psys_get_dietime_from_cache(struct PointCache *cache, int index);
573 
574 void psys_free_pdd(struct ParticleSystem *psys);
575 
576 float *psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup);
578  struct ParticleData *pa,
579  struct ParticleTexture *ptex,
580  int event,
581  float cfra);
585 void psys_interpolate_face(struct Mesh *mesh,
586  struct MVert *mvert,
587  const float (*vert_normals)[3],
588  struct MFace *mface,
589  struct MTFace *tface,
590  const float (*orcodata)[3],
591  float w[4],
592  float vec[3],
593  float nor[3],
594  float utan[3],
595  float vtan[3],
596  float orco[3]);
598  short from,
599  struct ParticleData *pa,
600  float *values);
601 void psys_get_from_key(
602  struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time);
603 
607 void BKE_psys_collision_neartest_cb(void *userdata,
608  int index,
609  const struct BVHTreeRay *ray,
610  struct BVHTreeRayHit *hit);
614 void psys_particle_on_dm(struct Mesh *mesh_final,
615  int from,
616  int index,
617  int index_dmcache,
618  const float fw[4],
619  float foffset,
620  float vec[3],
621  float nor[3],
622  float utan[3],
623  float vtan[3],
624  float orco[3]);
625 
626 /* particle_system.c */
627 
628 void distribute_particles(struct ParticleSimulationData *sim, int from);
632 void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa);
633 void psys_calc_dmcache(struct Object *ob,
634  struct Mesh *mesh_final,
635  struct Mesh *mesh_original,
636  struct ParticleSystem *psys);
649 int psys_particle_dm_face_lookup(struct Mesh *mesh_final,
650  struct Mesh *mesh_original,
651  int findex_orig,
652  const float fw[4],
653  struct LinkNode **poly_nodes);
654 
658 void reset_particle(struct ParticleSimulationData *sim,
659  struct ParticleData *pa,
660  float dtime,
661  float cfra);
662 
663 float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params);
664 
665 /* psys_reset */
666 #define PSYS_RESET_ALL 1
667 #define PSYS_RESET_DEPSGRAPH 2
668 /* #define PSYS_RESET_CHILDREN 3 */ /*UNUSED*/
669 #define PSYS_RESET_CACHE_MISS 4
670 
671 /* index_dmcache */
672 #define DMCACHE_NOTFOUND -1
673 #define DMCACHE_ISCHILD -2
674 
675 /* **** Depsgraph evaluation **** */
676 
677 struct Depsgraph;
678 
680  struct ParticleSettings *particle_settings);
681 
682 void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Object *object);
683 
684 /* Draw Cache */
685 enum {
687 };
688 void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
690 
691 extern void (*BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode);
693 
694 /* .blend file I/O */
695 
697  struct PartDeflect *pd);
699  struct ID *id,
700  struct PartDeflect *pd);
701 void BKE_particle_system_blend_write(struct BlendWriter *writer, struct ListBase *particles);
703  struct ListBase *particles);
705  struct Object *ob,
706  struct ID *id,
707  struct ListBase *particles);
708 
709 #ifdef __cplusplus
710 }
711 #endif
void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, bool vel)
Definition: particle.c:4615
void BKE_particlesettings_fluid_default_settings(struct ParticleSettings *part)
void distribute_particles(struct ParticleSimulationData *sim, int from)
#define PSYS_FRAND_COUNT
Definition: BKE_particle.h:241
struct ParticleSystem * psys_eval_get(struct Depsgraph *depsgraph, struct Object *object, struct ParticleSystem *psys)
Definition: particle.c:761
void psys_get_dupli_path_transform(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ChildParticle *cpa, struct ParticleCacheKey *cache, float mat[4][4], float *scale)
Definition: particle.c:5139
void psys_get_from_key(struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
Definition: particle.c:3801
bool do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int index, float time)
Definition: particle.c:2414
int psys_get_child_number(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params)
void psys_thread_context_init(struct ParticleThreadContext *ctx, struct ParticleSimulationData *sim)
void psys_calc_dmcache(struct Object *ob, struct Mesh *mesh_final, struct Mesh *mesh_original, struct ParticleSystem *psys)
void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3])
Definition: particle.c:3926
void psys_get_dupli_texture(struct ParticleSystem *psys, struct ParticleSettings *part, struct ParticleSystemModifierData *psmd, struct ParticleData *pa, struct ChildParticle *cpa, float uv[2], float orco[3])
Definition: particle.c:5052
void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params)
Definition: particle.c:3306
float * psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup)
Definition: particle.c:2652
void psys_tasks_free(struct ParticleTask *tasks, int numtasks)
void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors)
Definition: particle.c:2358
void psys_count_keyed_targets(struct ParticleSimulationData *sim)
void psys_mat_hair_to_orco(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition: particle.c:3910
void psys_sph_finalize(struct SPHData *sphdata)
struct ParticleSystem * psys_get_target_system(struct Object *ob, struct ParticleTarget *pt)
float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params)
void BKE_particlesettings_rough_curve_init(struct ParticleSettings *part)
Definition: particle.c:4138
void psys_apply_child_modifiers(struct ParticleThreadContext *ctx, struct ListBase *modifiers, struct ChildParticle *cpa, struct ParticleTexture *ptex, const float orco[3], float hairmat[4][4], struct ParticleCacheKey *keys, struct ParticleCacheKey *parent_keys, const float parent_orco[3])
void BKE_particle_system_blend_read_lib(struct BlendLibReader *reader, struct Object *ob, struct ID *id, struct ListBase *particles)
Definition: particle.c:5419
void psys_disable_all(struct Object *ob)
Definition: particle.c:736
void psys_mat_hair_to_global(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition: particle.c:3935
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
Definition: particle.c:511
void reset_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
Definition: particle.c:801
void psys_cache_edit_paths(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, bool use_render_params)
Definition: particle.c:3711
bool psys_render_simplify_params(struct ParticleSystem *psys, struct ChildParticle *cpa, float *params)
void psys_get_pointcache_start_end(struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
void psys_set_current_num(struct Object *ob, int index)
Definition: particle.c:666
void psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart, struct ParticleTask **r_tasks, int *r_numtasks)
struct ParticleSystem * psys_orig_get(struct ParticleSystem *psys)
Definition: particle.c:753
struct ParticleSettings * BKE_particlesettings_add(struct Main *bmain, const char *name)
Definition: particle.c:4115
struct ParticleDrawData ParticleDrawData
bool psys_check_edited(struct ParticleSystem *psys)
Definition: particle.c:827
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time)
Definition: particle.c:3790
short psys_get_current_num(struct Object *ob)
Definition: particle.c:649
void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part)
Definition: particle.c:4152
struct ParticleThreadContext ParticleThreadContext
void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2])
void psys_check_group_weights(struct ParticleSettings *part)
Definition: particle.c:857
void(* BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode)
Definition: particle.c:5271
struct ParticleCollisionElement ParticleCollisionElement
void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Object *object)
void psys_interpolate_particle(short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity)
Definition: particle.c:1231
void psys_thread_context_free(struct ParticleThreadContext *ctx)
void psys_reset(struct ParticleSystem *psys, int mode)
void BKE_particlesettings_clump_curve_init(struct ParticleSettings *part)
Definition: particle.c:4124
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys)
int psys_get_tot_child(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params)
float psys_get_timestep(struct ParticleSimulationData *sim)
Definition: particle.c:4490
void BKE_psys_collision_neartest_cb(void *userdata, int index, const struct BVHTreeRay *ray, struct BVHTreeRayHit *hit)
void psys_particle_on_emitter(struct ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float fuv[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
Definition: particle.c:2322
void BKE_particle_system_blend_read_data(struct BlendDataReader *reader, struct ListBase *particles)
Definition: particle.c:5331
void BKE_particle_partdeflect_blend_read_lib(struct BlendLibReader *reader, struct ID *id, struct PartDeflect *pd)
Definition: particle.c:359
void psys_particle_on_dm(struct Mesh *mesh_final, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
Definition: particle.c:2101
float psys_get_dietime_from_cache(struct PointCache *cache, int index)
Definition: particle.c:1366
void BKE_particlesystem_reset_all(struct Object *object)
void psys_free_particles(struct ParticleSystem *psys)
Definition: particle.c:1022
void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname)
unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
Definition: particle.c:510
float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
Definition: particle.c:4494
void psys_free_children(struct ParticleSystem *psys)
Definition: particle.c:1012
void free_keyed_keys(struct ParticleSystem *psys)
Definition: particle.c:971
int psys_uses_gravity(struct ParticleSimulationData *sim)
Definition: particle.c:919
void psys_enable_all(struct Object *ob)
Definition: particle.c:744
void psys_emitter_customdata_mask(struct ParticleSystem *psys, struct CustomData_MeshMasks *r_cddata_masks)
Definition: particle.c:2283
float psys_particle_value_from_verts(struct Mesh *mesh, short from, struct ParticleData *pa, float *values)
Definition: particle.c:2217
int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur)
Definition: particle.c:562
struct ParticleSeam ParticleSeam
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition: particle.c:634
void psys_sph_density(struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2])
void psys_sim_data_free(struct ParticleSimulationData *sim)
Definition: particle.c:726
void psys_update_particle_tree(struct ParticleSystem *psys, float cfra)
void psys_check_boid_data(struct ParticleSystem *psys)
void psys_changed_type(struct Object *ob, struct ParticleSystem *psys)
struct ParticleTask ParticleTask
void object_remove_particle_system(struct Main *bmain, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys)
void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa)
unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
Definition: particle.c:509
void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys)
void particle_system_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
void psys_sph_init(struct ParticleSimulationData *sim, struct SPHData *sphdata)
void BKE_particle_init_rng(void)
Definition: particle.c:513
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
Definition: particle.c:2230
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
Definition: particle.c:997
void psys_free_pdd(struct ParticleSystem *psys)
Definition: particle.c:1052
void psys_find_group_weights(struct ParticleSettings *part)
Definition: particle.c:836
@ BKE_PARTICLE_BATCH_DIRTY_ALL
Definition: BKE_particle.h:686
#define PARTICLE_COLLISION_MAX_COLLISIONS
Definition: BKE_particle.h:46
int psys_particle_dm_face_lookup(struct Mesh *mesh_final, struct Mesh *mesh_original, int findex_orig, const float fw[4], struct LinkNode **poly_nodes)
Definition: particle.c:1923
int count_particles(struct ParticleSystem *psys)
Definition: particle.c:544
float psys_get_child_size(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *pa_time)
void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra)
Definition: particle.c:4355
struct ModifierData * object_add_particle_system(struct Main *bmain, struct Scene *scene, struct Object *ob, const char *name)
Definition: particle.c:4002
struct SPHData SPHData
void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics)
Definition: particle.c:936
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
Definition: particle.c:5274
struct ParticleSimulationData ParticleSimulationData
void BKE_particle_partdeflect_blend_read_data(struct BlendDataReader *reader, struct PartDeflect *pd)
void BKE_particle_system_blend_write(struct BlendWriter *writer, struct ListBase *particles)
Definition: particle.c:5287
void psys_free(struct Object *ob, struct ParticleSystem *psys)
Definition: particle.c:1068
void BKE_particle_batch_cache_free(struct ParticleSystem *psys)
Definition: particle.c:5280
BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float vec[3])
Definition: BKE_particle.h:260
void psys_apply_hair_lattice(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys)
Definition: particle.c:5233
void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc)
struct ParticleCollision ParticleCollision
void BKE_particle_settings_eval_reset(struct Depsgraph *depsgraph, struct ParticleSettings *particle_settings)
void(* ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, int cb_flag)
Definition: BKE_particle.h:527
void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params)
Definition: particle.c:2678
struct ParticleTexture ParticleTexture
void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, bool editupdate, bool use_render_params)
Definition: particle.c:3198
struct ParticleCacheKey ParticleCacheKey
void BKE_particlesystem_id_loop(struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
void psys_interpolate_face(struct Mesh *mesh, struct MVert *mvert, const float(*vert_normals)[3], struct MFace *mface, struct MTFace *tface, const float(*orcodata)[3], float w[4], float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3])
Definition: particle.c:1689
void psys_sim_data_init(struct ParticleSimulationData *sim)
Definition: particle.c:685
void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src)
Definition: particle.c:1147
struct ModifierData * object_copy_particle_system(struct Main *bmain, struct Scene *scene, struct Object *ob, const struct ParticleSystem *psys_orig)
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
Definition: BKE_particle.h:248
void psys_get_birth_coords(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra)
void(* BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys)
Definition: particle.c:5272
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
Definition: particle.c:4884
#define BLI_INLINE
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
static unsigned long seed
Definition: btSoftBody.h:39
StackEntry * from
double time
Scene scene
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
void * tree
#define rot(x, k)
uint nor
GPUBatch * quad
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
const int state
Definition: DNA_ID.h:368
Definition: BKE_main.h:121
struct Object * current
Definition: BKE_particle.h:193
ParticleCollisionElement pce
Definition: BKE_particle.h:212
struct CollisionModifierData * md
Definition: BKE_particle.h:199
struct Object * skip[PARTICLE_COLLISION_MAX_COLLISIONS+1]
Definition: BKE_particle.h:195
struct Object * emitter
Definition: BKE_particle.h:196
struct Object * hit
Definition: BKE_particle.h:194
float v0[3]
Definition: BKE_particle.h:114
float dir[3]
Definition: BKE_particle.h:115
float v1[3]
Definition: BKE_particle.h:114
float tan[3]
Definition: BKE_particle.h:115
float nor[3]
Definition: BKE_particle.h:115
struct Depsgraph * depsgraph
Definition: BKE_particle.h:69
struct ParticleSystemModifierData * psmd
Definition: BKE_particle.h:73
struct Scene * scene
Definition: BKE_particle.h:70
struct ParticleSystem * psys
Definition: BKE_particle.h:72
struct Object * ob
Definition: BKE_particle.h:71
struct ListBase * colliders
Definition: BKE_particle.h:74
struct ParticleSystem * psys
struct PTCacheEdit * edit
ParticleData * particles
ParticleSettings * part
struct RNG * rng_path
Definition: BKE_particle.h:167
ParticleThreadContext * ctx
Definition: BKE_particle.h:166
struct RNG * rng
Definition: BKE_particle.h:167
struct ParticleData * tpars
Definition: BKE_particle.h:146
struct CurveMapping * roughcurve
Definition: BKE_particle.h:161
struct Mesh * mesh
Definition: BKE_particle.h:131
struct Material * ma
Definition: BKE_particle.h:132
struct CurveMapping * twistcurve
Definition: BKE_particle.h:162
struct CurveMapping * clumpcurve
Definition: BKE_particle.h:160
struct ParticleSeam * seams
Definition: BKE_particle.h:137
struct ParticleSimulationData sim
Definition: BKE_particle.h:130
struct KDTree_3d * tree
Definition: BKE_particle.h:135
Definition: rand.cc:33
BLI_Buffer new_springs
Definition: BKE_particle.h:97
struct EdgeHash * eh
Definition: BKE_particle.h:87
void(* force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse)
Definition: BKE_particle.h:100
ParticleData * pa
Definition: BKE_particle.h:85
ParticleSystem * psys[10]
Definition: BKE_particle.h:84
void(* density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist)
Definition: BKE_particle.h:101
float * gravity
Definition: BKE_particle.h:88
float element_size
Definition: BKE_particle.h:93
float flow[3]
Definition: BKE_particle.h:94
int pass
Definition: BKE_particle.h:92
float mass
Definition: BKE_particle.h:86
float hfac
Definition: BKE_particle.h:89