Blender V4.5
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
11
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_vector.hh"
19
20#include "BKE_lib_query.hh" /* For LibraryForeachIDCallbackFlag. */
21
22#include "DNA_particle_types.h"
23
24struct ParticleKey;
25struct ParticleSettings;
26struct ParticleSystem;
28
29struct BVHTreeRay;
30struct BVHTreeRayHit;
31struct BlendDataReader;
32struct BlendLibReader;
33struct BlendWriter;
35struct Depsgraph;
36struct KDTree_3d;
37struct LinkNode;
38struct MCol;
39struct MFace;
40struct MTFace;
41struct Main;
42struct ModifierData;
43struct Object;
44struct RNG;
45struct Scene;
46
47#define PARTICLE_COLLISION_MAX_COLLISIONS 10
48
49#define PARTICLE_P \
50 ParticleData *pa; \
51 int p
52#define LOOP_PARTICLES for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++)
53#define LOOP_EXISTING_PARTICLES \
54 for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
55 if (!(pa->flag & PARS_UNEXIST))
56#define LOOP_SHOWN_PARTICLES \
57 for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) \
58 if (!(pa->flag & (PARS_UNEXIST | PARS_NO_DISP)))
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 */
68typedef struct ParticleSimulationData {
69 struct Depsgraph *depsgraph;
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. */
79 /* Only valid during dynamics_step(). */
80 struct RNG *rng;
82
83typedef struct SPHData {
86 float mass;
87 std::optional<blender::Map<blender::OrderedEdge, int>> eh;
88
90 const float *gravity;
91
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
168typedef struct ParticleTask {
170 struct RNG *rng = nullptr, *rng_path = nullptr;
171 int begin = 0, end = 0;
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);
485
486void psys_apply_hair_lattice(struct Depsgraph *depsgraph,
487 struct Scene *scene,
488 struct Object *ob,
489 struct ParticleSystem *psys);
490
491/* `particle_system.cc` */
492
493struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
498void psys_update_particle_tree(struct ParticleSystem *psys, float cfra);
502void psys_changed_type(struct Object *ob, struct ParticleSystem *psys);
503
504void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys);
505void psys_get_pointcache_start_end(struct Scene *scene,
506 ParticleSystem *psys,
507 int *sfra,
508 int *efra);
509
510void psys_check_boid_data(struct ParticleSystem *psys);
511
513 struct ParticleData *pa,
514 struct ParticleKey *state,
515 float dtime,
516 float cfra);
517
522void particle_system_update(struct Depsgraph *depsgraph,
523 struct Scene *scene,
524 struct Object *ob,
525 struct ParticleSystem *psys,
526 bool use_render_params);
527
531typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys,
532 struct ID **idpoin,
533 void *userdata,
535
538 void *userdata);
539
543void BKE_particlesystem_reset_all(struct Object *object);
544
545/* ----------- functions needed only inside particlesystem ------------ */
546
547/* particle.cc */
548
549void psys_disable_all(struct Object *ob);
550void psys_enable_all(struct Object *ob);
551
552void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics);
553void free_keyed_keys(struct ParticleSystem *psys);
554void psys_free_particles(struct ParticleSystem *psys);
555void psys_free_children(struct ParticleSystem *psys);
556
558 short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity);
559void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3]);
560void psys_mat_hair_to_object(struct Object *ob,
561 struct Mesh *mesh,
562 short from,
563 struct ParticleData *pa,
564 float hairmat[4][4]);
565void psys_mat_hair_to_global(struct Object *ob,
566 struct Mesh *mesh,
567 short from,
568 struct ParticleData *pa,
569 float hairmat[4][4]);
570void psys_mat_hair_to_orco(struct Object *ob,
571 struct Mesh *mesh,
572 short from,
573 struct ParticleData *pa,
574 float hairmat[4][4]);
575
576float psys_get_dietime_from_cache(struct PointCache *cache, int index);
577
578void psys_free_pdd(struct ParticleSystem *psys);
579
580float *psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup);
582 struct ParticleData *pa,
583 struct ParticleTexture *ptex,
584 int event,
585 float cfra);
589void psys_interpolate_face(struct Mesh *mesh,
590 const float (*vert_positions)[3],
591 const float (*vert_normals)[3],
592 const struct MFace *mface,
593 struct MTFace *tface,
594 const float (*orcodata)[3],
595 float w[4],
596 float vec[3],
597 float nor[3],
598 float utan[3],
599 float vtan[3],
600 float orco[3]);
601float psys_particle_value_from_verts(struct Mesh *mesh,
602 short from,
603 struct ParticleData *pa,
604 float *values);
606 struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time);
607
612 int index,
613 const struct BVHTreeRay *ray,
614 struct BVHTreeRayHit *hit);
618void psys_particle_on_dm(struct Mesh *mesh_final,
619 int from,
620 int index,
621 int index_dmcache,
622 const float fw[4],
623 float foffset,
624 float vec[3],
625 float nor[3],
626 float utan[3],
627 float vtan[3],
628 float orco[3]);
629
630/* `particle_system.cc` */
631
632void distribute_particles(struct ParticleSimulationData *sim, int from);
636void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa);
637void psys_calc_dmcache(struct Object *ob,
638 struct Mesh *mesh_final,
639 struct Mesh *mesh_original,
640 struct ParticleSystem *psys);
653int psys_particle_dm_face_lookup(struct Mesh *mesh_final,
654 struct Mesh *mesh_original,
655 int findex_orig,
656 const float fw[4],
657 struct LinkNode **poly_nodes);
658
663 struct ParticleData *pa,
664 float dtime,
665 float cfra);
666
667float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params);
668
669/* psys_reset */
670#define PSYS_RESET_ALL 1
671#define PSYS_RESET_DEPSGRAPH 2
672// #define PSYS_RESET_CHILDREN 3 /*UNUSED*/
673#define PSYS_RESET_CACHE_MISS 4
674
675/* index_dmcache */
676#define DMCACHE_NOTFOUND -1
677#define DMCACHE_ISCHILD -2
678
679/* **** Depsgraph evaluation **** */
680
681struct Depsgraph;
682
683void BKE_particle_settings_eval_reset(struct Depsgraph *depsgraph,
684 struct ParticleSettings *particle_settings);
685
686void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Object *object);
687
688/* Draw Cache */
689enum {
691};
692void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
694
695extern void (*BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode);
696extern void (*BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys);
697
698/* .blend file I/O */
699
701 struct PartDeflect *pd);
704 struct ListBase *particles);
706 struct Object *ob,
707 struct ID *id,
708 struct ListBase *particles);
LibraryForeachIDCallbackFlag
void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, bool vel)
Definition particle.cc:4590
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:5150
void psys_get_from_key(struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
Definition particle.cc:3743
bool do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int index, float time)
Definition particle.cc:2334
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:2153
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:3889
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:5047
void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors)
Definition particle.cc:2280
float * psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup)
Definition particle.cc:2577
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:3868
struct ParticleSystem * psys_orig_get(struct ParticleSystem *psys)
Definition particle.cc:659
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:4109
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:642
void psys_mat_hair_to_global(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3898
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
Definition particle.cc:415
void reset_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra)
void(* ParticleSystemIDFunc)(struct ParticleSystem *psys, struct ID **idpoin, void *userdata, LibraryForeachIDCallbackFlag cb_flag)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
Definition particle.cc:709
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:3653
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:570
bool psys_check_edited(struct ParticleSystem *psys)
Definition particle.cc:735
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time)
Definition particle.cc:3732
short psys_get_current_num(struct Object *ob)
Definition particle.cc:551
void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part)
Definition particle.cc:4123
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:765
void(* BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode)
Definition particle.cc:5283
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:1139
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:4095
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3842
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:4465
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:2244
void BKE_particle_system_blend_read_data(struct BlendDataReader *reader, struct ListBase *particles)
Definition particle.cc:5344
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:2020
float psys_get_dietime_from_cache(struct PointCache *cache, int index)
Definition particle.cc:1273
void BKE_particlesystem_reset_all(struct Object *object)
void psys_free_particles(struct ParticleSystem *psys)
Definition particle.cc:931
unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
Definition particle.cc:414
float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
Definition particle.cc:4469
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:921
void free_keyed_keys(struct ParticleSystem *psys)
Definition particle.cc:880
void void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params)
Definition particle.cc:3247
void BKE_particle_system_blend_read_after_liblink(struct BlendLibReader *reader, struct Object *ob, struct ID *id, struct ListBase *particles)
Definition particle.cc:5432
int psys_uses_gravity(struct ParticleSimulationData *sim)
Definition particle.cc:828
void psys_enable_all(struct Object *ob)
Definition particle.cc:650
void psys_emitter_customdata_mask(struct ParticleSystem *psys, struct CustomData_MeshMasks *r_cddata_masks)
Definition particle.cc:2205
float psys_particle_value_from_verts(struct Mesh *mesh, short from, struct ParticleData *pa, float *values)
Definition particle.cc:2139
int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur)
Definition particle.cc:466
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:632
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)
void object_remove_particle_system(struct Main *bmain, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:3982
void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa)
unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
Definition particle.cc:413
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:417
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition particle.cc:537
struct ParticleSystem * psys_eval_get(struct Depsgraph *depsgraph, struct Object *object, struct ParticleSystem *psys)
Definition particle.cc:667
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
Definition particle.cc:906
blender::Vector< ParticleTask > psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart)
void psys_free_pdd(struct ParticleSystem *psys)
Definition particle.cc:961
void psys_find_group_weights(struct ParticleSettings *part)
Definition particle.cc:744
#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:1833
int count_particles(struct ParticleSystem *psys)
Definition particle.cc:448
float psys_get_child_size(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *pa_time)
Definition particle.cc:4501
void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra)
Definition particle.cc:4329
void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics)
Definition particle.cc:845
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
Definition particle.cc:5286
void BKE_particle_partdeflect_blend_read_data(struct BlendDataReader *reader, struct PartDeflect *pd)
Definition particle.cc:318
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:5299
void psys_free(struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:977
void psys_tasks_free(blender::Vector< ParticleTask > &tasks)
void BKE_particle_batch_cache_free(struct ParticleSystem *psys)
Definition particle.cc:5292
@ BKE_PARTICLE_BATCH_DIRTY_ALL
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:5244
void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc)
void BKE_particle_settings_eval_reset(struct Depsgraph *depsgraph, struct ParticleSettings *particle_settings)
void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params)
Definition particle.cc:2603
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 ParticleSettings * BKE_particlesettings_add(struct Main *bmain, const char *name)
Definition particle.cc:4086
void BKE_particlesystem_id_loop(struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
void psys_sim_data_init(struct ParticleSimulationData *sim)
Definition particle.cc:591
void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src)
Definition particle.cc:1055
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:5284
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
Definition particle.cc:4877
#define ATTR_NONNULL(...)
#define BLI_INLINE
BMesh const char void * data
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
static unsigned long seed
Definition btSoftBody.h:39
KDTree_3d * tree
#define rot(x, k)
blender::gpu::Batch * quad
uint nor
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static ulong state[N]
Definition DNA_ID.h:404
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
ParticleSettings * part
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 element_size
float flow[3]
float mass
float hfac
const float * gravity