Blender V4.3
BKE_particle.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2007 Janne Karhu. All rights reserved.
2 * SPDX-FileCopyrightText: 2011-2012 AutoCRC (adaptive time step, Classical SPH).
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later */
5
6#pragma once
7
12#include <optional>
13
14#include "BLI_buffer.h"
15#include "BLI_compiler_attrs.h"
16#include "BLI_map.hh"
17#include "BLI_ordered_edge.hh"
18#include "BLI_utildefines.h"
19
20#include "DNA_particle_types.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26struct ParticleKey;
27struct ParticleSettings;
28struct ParticleSystem;
30
31struct BVHTreeRay;
32struct BVHTreeRayHit;
33struct BlendDataReader;
34struct BlendLibReader;
35struct BlendWriter;
37struct Depsgraph;
38struct KDTree_3d;
39struct LinkNode;
40struct MCol;
41struct MFace;
42struct MTFace;
43struct Main;
44struct ModifierData;
45struct Object;
46struct RNG;
47struct Scene;
48
49#define PARTICLE_COLLISION_MAX_COLLISIONS 10
50
51#define PARTICLE_P \
52 ParticleData *pa; \
53 int p
54#define LOOP_PARTICLES for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++)
55#define LOOP_EXISTING_PARTICLES \
56 for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
57 if (!(pa->flag & PARS_UNEXIST))
58#define LOOP_SHOWN_PARTICLES \
59 for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
60 if (!(pa->flag & (PARS_UNEXIST | PARS_NO_DISP)))
61/* OpenMP: Can only advance one variable within loop definition. */
62#define LOOP_DYNAMIC_PARTICLES \
63 for (p = 0; p < psys->totpart; p++) \
64 if ((pa = psys->particles + p)->state.time > 0.0f)
65
66/* Fast but sure way to get the modifier. */
67#define PARTICLE_PSMD \
68 ParticleSystemModifierData *psmd = sim->psmd ? sim->psmd : psys_get_modifier(sim->ob, sim->psys)
69
70/* common stuff that many particle functions need */
71typedef struct ParticleSimulationData {
72 struct Depsgraph *depsgraph;
73 struct Scene *scene;
74 struct Object *ob;
78 /* Courant number. This is used to implement an adaptive time step. Only the
79 * maximum value per time step is important. Only sph_integrate makes use of
80 * this at the moment. Other solvers could, too. */
82 /* Only valid during dynamics_step(). */
83 struct RNG *rng;
85
86typedef struct SPHData {
89 float mass;
90 std::optional<blender::Map<blender::OrderedEdge, int>> eh;
91 float *gravity;
92 float hfac;
93 /* Average distance to neighbors (other particles in the support domain),
94 * for calculating the Courant number (adaptive time step). */
95 int pass;
97 float flow[3];
98
99 /* Temporary thread-local buffer for springs created during this step. */
101
102 /* Integrator callbacks. This allows different SPH implementations. */
103 void (*force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse);
104 void (*density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist);
106
107typedef struct ParticleTexture {
108 float ivel; /* used in reset */
109 float time, life, exist, size; /* used in init */
110 float damp, gravity, field; /* used in physics */
111 float length, clump, kink_freq, kink_amp, effector; /* used in path caching */
112 float rough1, rough2, roughe; /* used in path caching */
113 float twist; /* used in path caching */
115
116typedef struct ParticleSeam {
117 float v0[3], v1[3];
118 float nor[3], dir[3], tan[3];
119 float length2;
121
122typedef struct ParticleCacheKey {
123 float co[3];
124 float vel[3];
125 float rot[4];
126 float col[3];
127 float time;
130
131typedef struct ParticleThreadContext {
132 /* shared */
134 struct Mesh *mesh;
135 struct Material *ma;
136
137 /* distribution */
138 struct KDTree_3d *tree;
139
142
143 float *jit, *jitoff, *weight;
146
148
150
151 /* path caching */
155
156 float cfra;
157
161 float *vg_twist;
162
167
173
175 /* pointers to original data */
176 float *x[3], *v[3];
177
178 /* Values interpolated from original data. */
179 float x0[3], x1[3], x2[3], p[3];
180
181 /* results for found intersection point */
182 float nor[3], vel[3], uv[2];
183
184 /* count of original data (1-4) */
185 int tot;
186
187 /* index of the collision face */
188 int index;
189
190 /* flags for inversed normal / particle already inside element at start */
193
195typedef struct ParticleCollision {
197 struct Object *hit;
200
203
205 float f;
206 float fac1, fac2;
207
209
212
214
216
223
224 float radius;
225 float co1[3], co2[3];
226 float ve1[3], ve2[3];
227
228 float acc[3], boid_z;
229
230 int boid;
232
233typedef struct ParticleDrawData {
234 float *vdata, *vd; /* vertex data */
235 float *ndata, *nd; /* normal data */
236 float *cdata, *cd; /* color data */
237 float *vedata, *ved; /* velocity data */
238 float *ma_col;
240 int flag;
243
244#define PARTICLE_DRAW_DATA_UPDATED 1
245
246#define PSYS_FRAND_COUNT 1024
247extern unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
250
251void BKE_particle_init_rng(void);
252
253BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
254{
255 /* XXX far from ideal, this simply scrambles particle random numbers a bit
256 * to avoid obvious correlations.
257 * Can't use previous psys->frand arrays because these require initialization
258 * inside psys_check_enabled, which wreaks havoc in multi-threaded depsgraph updates.
259 */
260 unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
261 unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
262 return PSYS_FRAND_BASE[(offset + seed * multiplier) % PSYS_FRAND_COUNT];
263}
264
265BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float vec[3])
266{
267 unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
268 unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
269 vec[0] = PSYS_FRAND_BASE[(offset + (seed + 0) * multiplier) % PSYS_FRAND_COUNT];
270 vec[1] = PSYS_FRAND_BASE[(offset + (seed + 1) * multiplier) % PSYS_FRAND_COUNT];
271 vec[2] = PSYS_FRAND_BASE[(offset + (seed + 2) * multiplier) % PSYS_FRAND_COUNT];
272}
273
274/* ----------- functions needed outside particlesystem ---------------- */
275/* particle.cc */
276
277/* Few helpers for count-all etc. */
278
279int count_particles(struct ParticleSystem *psys);
280int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur);
281
282int psys_get_child_number(struct Scene *scene,
283 struct ParticleSystem *psys,
284 bool use_render_params);
285int psys_get_tot_child(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params);
286
290struct ParticleSystem *psys_get_current(struct Object *ob);
291
292/* For RNA API. */
293
294short psys_get_current_num(struct Object *ob);
295void psys_set_current_num(struct Object *ob, int index);
296/* UNUSED */
297// struct Object *psys_find_object(struct Scene *scene, struct ParticleSystem *psys);
298
304
310struct ParticleSystem *psys_orig_get(struct ParticleSystem *psys);
311
316struct ParticleSystem *psys_eval_get(struct Depsgraph *depsgraph,
317 struct Object *object,
318 struct ParticleSystem *psys);
319
320bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys);
321bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params);
322bool psys_check_edited(struct ParticleSystem *psys);
323
328
332void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit);
336void psys_free(struct Object *ob, struct ParticleSystem *psys);
340void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src);
341
343 struct ChildParticle *cpa,
344 float *params);
345
346void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2]);
347void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc);
348
349void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
350
352 struct CustomData_MeshMasks *r_cddata_masks);
354 int from,
355 int index,
356 int index_dmcache,
357 float fuv[4],
358 float foffset,
359 float vec[3],
360 float nor[3],
361 float utan[3],
362 float vtan[3],
363 float orco[3]);
365 struct ParticleSystem *psys);
366
368 const struct Scene *scene,
369 struct Object *ob,
370 const char *name);
372 const struct Scene *scene,
373 struct Object *ob,
374 const struct ParticleSystem *psys_orig);
375void object_remove_particle_system(struct Main *bmain,
376 struct Scene *scene,
377 struct Object *ob,
378 struct ParticleSystem *psys);
379struct ParticleSettings *BKE_particlesettings_add(struct Main *bmain, const char *name);
380void psys_reset(struct ParticleSystem *psys, int mode);
381
382void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params);
383
384void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname)
385 ATTR_NONNULL(1, 2, 3);
386
393void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params);
394void psys_cache_edit_paths(struct Depsgraph *depsgraph,
395 struct Scene *scene,
396 struct Object *ob,
397 struct PTCacheEdit *edit,
398 float cfra,
399 bool use_render_params);
401 float cfra,
402 bool editupdate,
403 bool use_render_params);
404bool do_guides(struct Depsgraph *depsgraph,
405 struct ParticleSettings *part,
406 struct ListBase *effectors,
408 int index,
409 float time);
410void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors);
412float psys_get_child_time(struct ParticleSystem *psys,
413 struct ChildParticle *cpa,
414 float cfra,
415 float *birthtime,
416 float *dietime);
417float psys_get_child_size(struct ParticleSystem *psys,
418 struct ChildParticle *cpa,
419 float cfra,
420 float *pa_time);
425 int pa_num,
426 struct ParticleKey *state,
427 bool vel);
433 int p,
434 struct ParticleKey *state,
435 bool always);
436
437/* Child paths. */
438
443 struct ListBase *modifiers,
444 struct ChildParticle *cpa,
445 struct ParticleTexture *ptex,
446 const float orco[3],
447 float hairmat[4][4],
448 struct ParticleCacheKey *keys,
449 struct ParticleCacheKey *parent_keys,
450 const float parent_orco[3]);
451
452void psys_sph_init(struct ParticleSimulationData *sim, struct SPHData *sphdata);
453void psys_sph_finalize(struct SPHData *sphdata);
457void psys_sph_density(struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2]);
458
459/* For anim.c */
460
461void psys_get_dupli_texture(struct ParticleSystem *psys,
462 struct ParticleSettings *part,
463 struct ParticleSystemModifierData *psmd,
464 struct ParticleData *pa,
465 struct ChildParticle *cpa,
466 float uv[2],
467 float orco[3]);
469 struct ParticleData *pa,
470 struct ChildParticle *cpa,
471 struct ParticleCacheKey *cache,
472 float mat[4][4],
473 float *scale);
474
479 struct ParticleSimulationData *sim);
482 int startpart,
483 int endpart,
484 struct ParticleTask **r_tasks,
485 int *r_numtasks);
486void psys_tasks_free(struct ParticleTask *tasks, int numtasks);
487
488void psys_apply_hair_lattice(struct Depsgraph *depsgraph,
489 struct Scene *scene,
490 struct Object *ob,
491 struct ParticleSystem *psys);
492
493/* `particle_system.cc` */
494
495struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
500void psys_update_particle_tree(struct ParticleSystem *psys, float cfra);
504void psys_changed_type(struct Object *ob, struct ParticleSystem *psys);
505
506void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys);
507void psys_get_pointcache_start_end(struct Scene *scene,
508 ParticleSystem *psys,
509 int *sfra,
510 int *efra);
511
512void psys_check_boid_data(struct ParticleSystem *psys);
513
515 struct ParticleData *pa,
516 struct ParticleKey *state,
517 float dtime,
518 float cfra);
519
524void particle_system_update(struct Depsgraph *depsgraph,
525 struct Scene *scene,
526 struct Object *ob,
527 struct ParticleSystem *psys,
528 bool use_render_params);
529
533typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys,
534 struct ID **idpoin,
535 void *userdata,
536 int cb_flag);
537
540 void *userdata);
541
545void BKE_particlesystem_reset_all(struct Object *object);
546
547/* ----------- functions needed only inside particlesystem ------------ */
548
549/* particle.cc */
550
551void psys_disable_all(struct Object *ob);
552void psys_enable_all(struct Object *ob);
553
554void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics);
555void free_keyed_keys(struct ParticleSystem *psys);
556void psys_free_particles(struct ParticleSystem *psys);
557void psys_free_children(struct ParticleSystem *psys);
558
560 short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity);
561void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3]);
562void psys_mat_hair_to_object(struct Object *ob,
563 struct Mesh *mesh,
564 short from,
565 struct ParticleData *pa,
566 float hairmat[4][4]);
567void psys_mat_hair_to_global(struct Object *ob,
568 struct Mesh *mesh,
569 short from,
570 struct ParticleData *pa,
571 float hairmat[4][4]);
572void psys_mat_hair_to_orco(struct Object *ob,
573 struct Mesh *mesh,
574 short from,
575 struct ParticleData *pa,
576 float hairmat[4][4]);
577
578float psys_get_dietime_from_cache(struct PointCache *cache, int index);
579
580void psys_free_pdd(struct ParticleSystem *psys);
581
582float *psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup);
584 struct ParticleData *pa,
585 struct ParticleTexture *ptex,
586 int event,
587 float cfra);
591void psys_interpolate_face(struct Mesh *mesh,
592 const float (*vert_positions)[3],
593 const float (*vert_normals)[3],
594 const struct MFace *mface,
595 struct MTFace *tface,
596 const float (*orcodata)[3],
597 float w[4],
598 float vec[3],
599 float nor[3],
600 float utan[3],
601 float vtan[3],
602 float orco[3]);
603float psys_particle_value_from_verts(struct Mesh *mesh,
604 short from,
605 struct ParticleData *pa,
606 float *values);
608 struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time);
609
614 int index,
615 const struct BVHTreeRay *ray,
616 struct BVHTreeRayHit *hit);
620void psys_particle_on_dm(struct Mesh *mesh_final,
621 int from,
622 int index,
623 int index_dmcache,
624 const float fw[4],
625 float foffset,
626 float vec[3],
627 float nor[3],
628 float utan[3],
629 float vtan[3],
630 float orco[3]);
631
632/* `particle_system.cc` */
633
634void distribute_particles(struct ParticleSimulationData *sim, int from);
638void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa);
639void psys_calc_dmcache(struct Object *ob,
640 struct Mesh *mesh_final,
641 struct Mesh *mesh_original,
642 struct ParticleSystem *psys);
655int psys_particle_dm_face_lookup(struct Mesh *mesh_final,
656 struct Mesh *mesh_original,
657 int findex_orig,
658 const float fw[4],
659 struct LinkNode **poly_nodes);
660
665 struct ParticleData *pa,
666 float dtime,
667 float cfra);
668
669float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params);
670
671/* psys_reset */
672#define PSYS_RESET_ALL 1
673#define PSYS_RESET_DEPSGRAPH 2
674// #define PSYS_RESET_CHILDREN 3 /*UNUSED*/
675#define PSYS_RESET_CACHE_MISS 4
676
677/* index_dmcache */
678#define DMCACHE_NOTFOUND -1
679#define DMCACHE_ISCHILD -2
680
681/* **** Depsgraph evaluation **** */
682
683struct Depsgraph;
684
685void BKE_particle_settings_eval_reset(struct Depsgraph *depsgraph,
686 struct ParticleSettings *particle_settings);
687
688void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Object *object);
689
690/* Draw Cache */
691enum {
693};
694void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
696
697extern void (*BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode);
698extern void (*BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys);
699
700/* .blend file I/O */
701
703 struct PartDeflect *pd);
706 struct ListBase *particles);
708 struct Object *ob,
709 struct ID *id,
710 struct ListBase *particles);
711
712#ifdef __cplusplus
713}
714#endif
void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, bool vel)
Definition particle.cc:4599
void BKE_particlesettings_fluid_default_settings(struct ParticleSettings *part)
void distribute_particles(struct ParticleSimulationData *sim, int from)
#define PSYS_FRAND_COUNT
struct ModifierData * object_add_particle_system(struct Main *bmain, const struct Scene *scene, struct Object *ob, const char *name)
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.cc:5159
void psys_get_from_key(struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
Definition particle.cc:3752
bool do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int index, float time)
Definition particle.cc:2332
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:2150
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.cc:3898
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.cc:5056
void psys_tasks_free(struct ParticleTask *tasks, int numtasks)
void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors)
Definition particle.cc:2277
float * psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup)
Definition particle.cc:2575
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.cc:3877
struct ParticleSystem * psys_orig_get(struct ParticleSystem *psys)
Definition particle.cc:656
void psys_sph_finalize(struct SPHData *sphdata)
float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params)
void BKE_particlesettings_rough_curve_init(struct ParticleSettings *part)
Definition particle.cc:4118
void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname) ATTR_NONNULL(1
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 psys_disable_all(struct Object *ob)
Definition particle.cc:639
void psys_mat_hair_to_global(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3907
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
Definition particle.cc:413
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.cc:706
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.cc:3662
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.cc:567
void psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart, struct ParticleTask **r_tasks, int *r_numtasks)
struct ParticleDrawData ParticleDrawData
bool psys_check_edited(struct ParticleSystem *psys)
Definition particle.cc:732
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time)
Definition particle.cc:3741
short psys_get_current_num(struct Object *ob)
Definition particle.cc:548
void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part)
Definition particle.cc:4132
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.cc:762
void(* BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode)
Definition particle.cc:5292
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.cc:1137
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.cc:4104
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3851
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.cc:4474
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.cc:2241
void BKE_particle_system_blend_read_data(struct BlendDataReader *reader, struct ListBase *particles)
Definition particle.cc:5353
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.cc:2017
float psys_get_dietime_from_cache(struct PointCache *cache, int index)
Definition particle.cc:1271
void BKE_particlesystem_reset_all(struct Object *object)
void psys_free_particles(struct ParticleSystem *psys)
Definition particle.cc:929
unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
Definition particle.cc:412
float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
Definition particle.cc:4478
void psys_interpolate_face(struct Mesh *mesh, const float(*vert_positions)[3], const float(*vert_normals)[3], const 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])
void psys_free_children(struct ParticleSystem *psys)
Definition particle.cc:919
void free_keyed_keys(struct ParticleSystem *psys)
Definition particle.cc:878
void void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params)
Definition particle.cc:3256
void BKE_particle_system_blend_read_after_liblink(struct BlendLibReader *reader, struct Object *ob, struct ID *id, struct ListBase *particles)
Definition particle.cc:5441
int psys_uses_gravity(struct ParticleSimulationData *sim)
Definition particle.cc:826
void psys_enable_all(struct Object *ob)
Definition particle.cc:647
void psys_emitter_customdata_mask(struct ParticleSystem *psys, struct CustomData_MeshMasks *r_cddata_masks)
Definition particle.cc:2202
float psys_particle_value_from_verts(struct Mesh *mesh, short from, struct ParticleData *pa, float *values)
Definition particle.cc:2136
int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur)
Definition particle.cc:464
struct ParticleSeam ParticleSeam
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.cc:629
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)
Definition particle.cc:3991
void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa)
unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
Definition particle.cc:411
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.cc:415
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition particle.cc:534
struct ParticleSystem * psys_eval_get(struct Depsgraph *depsgraph, struct Object *object, struct ParticleSystem *psys)
Definition particle.cc:664
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
Definition particle.cc:904
void psys_free_pdd(struct ParticleSystem *psys)
Definition particle.cc:959
void psys_find_group_weights(struct ParticleSettings *part)
Definition particle.cc:741
#define PARTICLE_COLLISION_MAX_COLLISIONS
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.cc:1830
int count_particles(struct ParticleSystem *psys)
Definition particle.cc:446
float psys_get_child_size(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *pa_time)
Definition particle.cc:4510
void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra)
Definition particle.cc:4338
struct SPHData SPHData
void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics)
Definition particle.cc:843
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
Definition particle.cc:5295
struct ParticleSimulationData ParticleSimulationData
void BKE_particle_partdeflect_blend_read_data(struct BlendDataReader *reader, struct PartDeflect *pd)
Definition particle.cc:316
struct ParticleSystem * psys_get_target_system(struct Object *ob, struct ParticleTarget *pt)
void BKE_particle_system_blend_write(struct BlendWriter *writer, struct ListBase *particles)
Definition particle.cc:5308
void psys_free(struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:975
void BKE_particle_batch_cache_free(struct ParticleSystem *psys)
Definition particle.cc:5301
BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float vec[3])
void psys_apply_hair_lattice(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:5253
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)
void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params)
Definition particle.cc:2601
struct ParticleTexture ParticleTexture
void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, bool editupdate, bool use_render_params)
Definition particle.cc:3148
struct ModifierData * object_copy_particle_system(struct Main *bmain, const struct Scene *scene, struct Object *ob, const struct ParticleSystem *psys_orig)
struct ParticleCacheKey ParticleCacheKey
struct ParticleSettings * BKE_particlesettings_add(struct Main *bmain, const char *name)
Definition particle.cc:4095
void BKE_particlesystem_id_loop(struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
void psys_sim_data_init(struct ParticleSimulationData *sim)
Definition particle.cc:588
void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src)
Definition particle.cc:1053
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
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.cc:5293
@ BKE_PARTICLE_BATCH_DIRTY_ALL
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
Definition particle.cc:4886
#define ATTR_NONNULL(...)
#define BLI_INLINE
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
static unsigned long seed
Definition btSoftBody.h:39
const Depsgraph * depsgraph
KDTree_3d * tree
#define rot(x, k)
blender::gpu::Batch * quad
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static ulong state[N]
Frequency::GEOMETRY nor[]
Definition DNA_ID.h:413
struct Object * current
ParticleCollisionElement pce
struct CollisionModifierData * md
struct Object * skip[PARTICLE_COLLISION_MAX_COLLISIONS+1]
struct Object * emitter
struct Object * hit
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct Scene * scene
struct ParticleSystem * psys
struct Object * ob
struct ListBase * colliders
struct ParticleSystem * psys
struct PTCacheEdit * edit
ParticleData * particles
struct RNG * rng_path
ParticleThreadContext * ctx
struct RNG * rng
struct ParticleData * tpars
struct CurveMapping * roughcurve
struct Material * ma
struct CurveMapping * twistcurve
struct CurveMapping * clumpcurve
struct ParticleSeam * seams
struct ParticleSimulationData sim
struct KDTree_3d * tree
Definition rand.cc:33
BLI_Buffer new_springs
void(* force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse)
ParticleData * pa
ParticleSystem * psys[10]
void(* density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist)
std::optional< blender::Map< blender::OrderedEdge, int > > eh
float * gravity
float element_size
float flow[3]
float mass
float hfac