Blender V5.0
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_compiler_attrs.h"
15#include "BLI_map.hh"
16#include "BLI_ordered_edge.hh"
17#include "BLI_vector.hh"
18
19#include "BKE_lib_query.hh" /* For LibraryForeachIDCallbackFlag. */
20
21#include "DNA_particle_types.h"
22
23struct ParticleKey;
24struct ParticleSettings;
25struct ParticleSystem;
27
28struct BVHTreeRay;
29struct BVHTreeRayHit;
30struct BlendDataReader;
31struct BlendLibReader;
32struct BlendWriter;
34struct Depsgraph;
35struct KDTree_3d;
36struct LinkNode;
37struct MCol;
38struct MFace;
39struct MTFace;
40struct Main;
41struct ModifierData;
42struct Object;
43struct RNG;
44struct 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#define LOOP_DYNAMIC_PARTICLES \
59 for (p = 0; p < psys->totpart; p++) \
60 if ((pa = psys->particles + p)->state.time > 0.0f)
61
62/* Fast but sure way to get the modifier. */
63#define PARTICLE_PSMD \
64 ParticleSystemModifierData *psmd = sim->psmd ? sim->psmd : psys_get_modifier(sim->ob, sim->psys)
65
66/* common stuff that many particle functions need */
67typedef struct ParticleSimulationData {
68 struct Depsgraph *depsgraph;
69 struct Scene *scene;
70 struct Object *ob;
74 /* Courant number. This is used to implement an adaptive time step. Only the
75 * maximum value per time step is important. Only sph_integrate makes use of
76 * this at the moment. Other solvers could, too. */
78 /* Only valid during dynamics_step(). */
79 struct RNG *rng;
81
82typedef struct SPHData {
85 float mass;
87
89 const float *gravity;
90
91 float hfac;
92 /* Average distance to neighbors (other particles in the support domain),
93 * for calculating the Courant number (adaptive time step). */
94 int pass;
96 float flow[3];
97
98 /* Temporary thread-local buffer for springs created during this step. */
100
101 /* Integrator callbacks. This allows different SPH implementations. */
102 void (*force_cb)(void *sphdata_v, ParticleKey *state, float *force, float *impulse);
103 void (*density_cb)(void *rangedata_v, int index, const float co[3], float squared_dist);
105
106typedef struct ParticleTexture {
107 float ivel; /* used in reset */
108 float time, life, exist, size; /* used in init */
109 float damp, gravity, field; /* used in physics */
110 float length, clump, kink_freq, kink_amp, effector; /* used in path caching */
111 float rough1, rough2, roughe; /* used in path caching */
112 float twist; /* used in path caching */
114
115typedef struct ParticleSeam {
116 float v0[3], v1[3];
117 float nor[3], dir[3], tan[3];
118 float length2;
120
121typedef struct ParticleCacheKey {
122 float co[3];
123 float vel[3];
124 float rot[4];
125 float col[3];
126 float time;
129
130typedef struct ParticleThreadContext {
131 /* shared */
133 struct Mesh *mesh;
134 struct Material *ma;
135
136 /* distribution */
137 struct KDTree_3d *tree;
138
141
142 float *jit, *jitoff, *weight;
145
147
149
150 /* path caching */
154
155 float cfra;
156
160 float *vg_twist;
161
166
167typedef struct ParticleTask {
169 struct RNG *rng = nullptr, *rng_path = nullptr;
170 int begin = 0, end = 0;
172
174 /* pointers to original data */
175 float *x[3], *v[3];
176
177 /* Values interpolated from original data. */
178 float x0[3], x1[3], x2[3], p[3];
179
180 /* results for found intersection point */
181 float nor[3], vel[3], uv[2];
182
183 /* count of original data (1-4) */
184 int tot;
185
186 /* index of the collision face */
187 int index;
188
189 /* flags for inversed normal / particle already inside element at start */
192
194typedef struct ParticleCollision {
196 struct Object *hit;
199
202
204 float f;
205 float fac1, fac2;
206
208
211
213
215
222
223 float radius;
224 float co1[3], co2[3];
225 float ve1[3], ve2[3];
226
227 float acc[3], boid_z;
228
229 int boid;
231
232typedef struct ParticleDrawData {
233 float *vdata, *vd; /* vertex data */
234 float *ndata, *nd; /* normal data */
235 float *cdata, *cd; /* color data */
236 float *vedata, *ved; /* velocity data */
237 float *ma_col;
239 int flag;
242
243#define PARTICLE_DRAW_DATA_UPDATED 1
244
245#define PSYS_FRAND_COUNT 1024
246extern unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT];
249
250void BKE_particle_init_rng(void);
251
252BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
253{
254 /* XXX far from ideal, this simply scrambles particle random numbers a bit
255 * to avoid obvious correlations.
256 * Can't use previous psys->frand arrays because these require initialization
257 * inside psys_check_enabled, which wreaks havoc in multi-threaded depsgraph updates.
258 */
259 unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
260 unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
261 return PSYS_FRAND_BASE[(offset + seed * multiplier) % PSYS_FRAND_COUNT];
262}
263
264BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float vec[3])
265{
266 unsigned int offset = PSYS_FRAND_SEED_OFFSET[psys->seed % PSYS_FRAND_COUNT];
267 unsigned int multiplier = PSYS_FRAND_SEED_MULTIPLIER[psys->seed % PSYS_FRAND_COUNT];
268 vec[0] = PSYS_FRAND_BASE[(offset + (seed + 0) * multiplier) % PSYS_FRAND_COUNT];
269 vec[1] = PSYS_FRAND_BASE[(offset + (seed + 1) * multiplier) % PSYS_FRAND_COUNT];
270 vec[2] = PSYS_FRAND_BASE[(offset + (seed + 2) * multiplier) % PSYS_FRAND_COUNT];
271}
272
273/* ----------- functions needed outside particlesystem ---------------- */
274/* particle.cc */
275
276/* Few helpers for count-all etc. */
277
278int count_particles(struct ParticleSystem *psys);
279int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur);
280
281int psys_get_child_number(struct Scene *scene,
282 struct ParticleSystem *psys,
283 bool use_render_params);
284int psys_get_tot_child(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params);
285
289struct ParticleSystem *psys_get_current(struct Object *ob);
290
291/* For RNA API. */
292
293short psys_get_current_num(struct Object *ob);
294void psys_set_current_num(struct Object *ob, int index);
295/* UNUSED */
296// struct Object *psys_find_object(struct Scene *scene, struct ParticleSystem *psys);
297
303
309struct ParticleSystem *psys_orig_get(struct ParticleSystem *psys);
310
315struct ParticleSystem *psys_eval_get(struct Depsgraph *depsgraph,
316 struct Object *object,
317 struct ParticleSystem *psys);
318
319bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys);
320bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params);
321bool psys_check_edited(struct ParticleSystem *psys);
322
327
331void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit);
335void psys_free(struct Object *ob, struct ParticleSystem *psys);
339void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src);
340
342 struct ChildParticle *cpa,
343 float *params);
344
345void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float r_uv[2]);
346void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc);
347
348void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
349
351 struct CustomData_MeshMasks *r_cddata_masks);
353 int from,
354 int index,
355 int index_dmcache,
356 float fuv[4],
357 float foffset,
358 float vec[3],
359 float nor[3],
360 float utan[3],
361 float vtan[3],
362 float orco[3]);
364 struct ParticleSystem *psys);
365
367 const struct Scene *scene,
368 struct Object *ob,
369 const char *name);
371 const struct Scene *scene,
372 struct Object *ob,
373 const struct ParticleSystem *psys_orig);
374void object_remove_particle_system(struct Main *bmain,
375 struct Scene *scene,
376 struct Object *ob,
377 struct ParticleSystem *psys);
378struct ParticleSettings *BKE_particlesettings_add(struct Main *bmain, const char *name);
379void psys_reset(struct ParticleSystem *psys, int mode);
380
381void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params);
382
383void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname)
384 ATTR_NONNULL(1, 2, 3);
385
392void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params);
393void psys_cache_edit_paths(struct Depsgraph *depsgraph,
394 struct Scene *scene,
395 struct Object *ob,
396 struct PTCacheEdit *edit,
397 float cfra,
398 bool use_render_params);
400 float cfra,
401 bool editupdate,
402 bool use_render_params);
403bool do_guides(struct Depsgraph *depsgraph,
404 struct ParticleSettings *part,
405 struct ListBase *effectors,
407 int index,
408 float time);
409void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors);
411float psys_get_child_time(struct ParticleSystem *psys,
412 struct ChildParticle *cpa,
413 float cfra,
414 float *birthtime,
415 float *dietime);
416float psys_get_child_size(struct ParticleSystem *psys,
417 struct ChildParticle *cpa,
418 float cfra,
419 float *pa_time);
424 int pa_num,
425 struct ParticleKey *state,
426 bool vel);
432 int p,
433 struct ParticleKey *state,
434 bool always);
435
436/* Child paths. */
437
442 struct ListBase *modifiers,
443 struct ChildParticle *cpa,
444 struct ParticleTexture *ptex,
445 const float orco[3],
446 float hairmat[4][4],
447 struct ParticleCacheKey *keys,
448 struct ParticleCacheKey *parent_keys,
449 const float parent_orco[3]);
450
451void psys_sph_finalize(struct SPHData *sphdata);
455void psys_sph_density(struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2]);
456
457/* For anim.c */
458
459void psys_get_dupli_texture(struct ParticleSystem *psys,
460 struct ParticleSettings *part,
461 struct ParticleSystemModifierData *psmd,
462 struct ParticleData *pa,
463 struct ChildParticle *cpa,
464 float uv[2],
465 float orco[3]);
467 struct ParticleData *pa,
468 struct ChildParticle *cpa,
469 struct ParticleCacheKey *cache,
470 float mat[4][4],
471 float *scale);
472
477 struct ParticleSimulationData *sim);
480 int startpart,
481 int endpart);
483
484void psys_apply_hair_lattice(struct Depsgraph *depsgraph,
485 struct Scene *scene,
486 struct Object *ob,
487 struct ParticleSystem *psys);
488
489/* `particle_system.cc` */
490
491struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
496void psys_update_particle_tree(struct ParticleSystem *psys, float cfra);
500void psys_changed_type(struct Object *ob, struct ParticleSystem *psys);
501
502void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys);
503void psys_get_pointcache_start_end(struct Scene *scene,
504 ParticleSystem *psys,
505 int *sfra,
506 int *efra);
507
508void psys_check_boid_data(struct ParticleSystem *psys);
509
511 struct ParticleData *pa,
512 struct ParticleKey *state,
513 float dtime,
514 float cfra);
515
520void particle_system_update(struct Depsgraph *depsgraph,
521 struct Scene *scene,
522 struct Object *ob,
523 struct ParticleSystem *psys,
524 bool use_render_params);
525
529typedef void (*ParticleSystemIDFunc)(struct ParticleSystem *psys,
530 struct ID **idpoin,
531 void *userdata,
533
536 void *userdata);
537
541void BKE_particlesystem_reset_all(struct Object *object);
542
543/* ----------- functions needed only inside particlesystem ------------ */
544
545/* particle.cc */
546
547void psys_disable_all(struct Object *ob);
548void psys_enable_all(struct Object *ob);
549
550void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics);
551void free_keyed_keys(struct ParticleSystem *psys);
552void psys_free_particles(struct ParticleSystem *psys);
553void psys_free_children(struct ParticleSystem *psys);
554
556 short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity);
557void psys_vec_rot_to_face(struct Mesh *mesh, struct ParticleData *pa, float vec[3]);
558void psys_mat_hair_to_object(struct Object *ob,
559 struct Mesh *mesh,
560 short from,
561 struct ParticleData *pa,
562 float hairmat[4][4]);
563void psys_mat_hair_to_global(struct Object *ob,
564 struct Mesh *mesh,
565 short from,
566 struct ParticleData *pa,
567 float hairmat[4][4]);
568void psys_mat_hair_to_orco(struct Object *ob,
569 struct Mesh *mesh,
570 short from,
571 struct ParticleData *pa,
572 float hairmat[4][4]);
573
574float psys_get_dietime_from_cache(struct PointCache *cache, int index);
575
576void psys_free_pdd(struct ParticleSystem *psys);
577
578float *psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup);
580 struct ParticleData *pa,
581 struct ParticleTexture *ptex,
582 int event,
583 float cfra);
587void psys_interpolate_face(struct Mesh *mesh,
588 const float (*vert_positions)[3],
589 const float (*vert_normals)[3],
590 const struct MFace *mface,
591 struct MTFace *tface,
592 const float (*orcodata)[3],
593 float w[4],
594 float vec[3],
595 float nor[3],
596 float utan[3],
597 float vtan[3],
598 float orco[3]);
599float psys_particle_value_from_verts(struct Mesh *mesh,
600 short from,
601 struct ParticleData *pa,
602 float *values);
604 struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time);
605
610 int index,
611 const struct BVHTreeRay *ray,
612 struct BVHTreeRayHit *hit);
616void psys_particle_on_dm(struct Mesh *mesh_final,
617 int from,
618 int index,
619 int index_dmcache,
620 const float fw[4],
621 float foffset,
622 float vec[3],
623 float nor[3],
624 float utan[3],
625 float vtan[3],
626 float orco[3]);
627
628/* `particle_system.cc` */
629
630void distribute_particles(struct ParticleSimulationData *sim, int from);
634void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa);
635void psys_calc_dmcache(struct Object *ob,
636 struct Mesh *mesh_final,
637 struct Mesh *mesh_original,
638 struct ParticleSystem *psys);
651int psys_particle_dm_face_lookup(struct Mesh *mesh_final,
652 struct Mesh *mesh_original,
653 int findex_orig,
654 const float fw[4],
655 struct LinkNode **poly_nodes);
656
661 struct ParticleData *pa,
662 float dtime,
663 float cfra);
664
665float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params);
666
667/* psys_reset */
668#define PSYS_RESET_ALL 1
669#define PSYS_RESET_DEPSGRAPH 2
670// #define PSYS_RESET_CHILDREN 3 /*UNUSED*/
671#define PSYS_RESET_CACHE_MISS 4
672
673/* index_dmcache */
674#define DMCACHE_NOTFOUND -1
675#define DMCACHE_ISCHILD -2
676
677/* **** Depsgraph evaluation **** */
678
679struct Depsgraph;
680
681void BKE_particle_settings_eval_reset(struct Depsgraph *depsgraph,
682 struct ParticleSettings *particle_settings);
683
684void BKE_particle_system_eval_init(struct Depsgraph *depsgraph, struct Object *object);
685
686/* Draw Cache */
687enum {
689};
690void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
692
693extern void (*BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode);
694extern void (*BKE_particle_batch_cache_free_cb)(struct ParticleSystem *psys);
695
696/* .blend file I/O */
697
699 struct PartDeflect *pd);
702 struct ListBase *particles);
704 struct Object *ob,
705 struct ID *id,
706 struct ListBase *particles);
LibraryForeachIDCallbackFlag
void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, bool vel)
Definition particle.cc:4592
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:5152
void psys_get_from_key(struct ParticleKey *key, float loc[3], float vel[3], float rot[4], float *time)
Definition particle.cc:3745
bool do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int index, float time)
Definition particle.cc:2336
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:2155
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:3891
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:5049
void precalc_guides(struct ParticleSimulationData *sim, struct ListBase *effectors)
Definition particle.cc:2282
float * psys_cache_vgroup(struct Mesh *mesh, struct ParticleSystem *psys, int vgroup)
Definition particle.cc:2579
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:3870
struct ParticleSystem * psys_orig_get(struct ParticleSystem *psys)
Definition particle.cc:660
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:4111
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:643
void psys_mat_hair_to_global(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3900
float PSYS_FRAND_BASE[PSYS_FRAND_COUNT]
Definition particle.cc:416
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:710
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:3655
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:571
bool psys_check_edited(struct ParticleSystem *psys)
Definition particle.cc:736
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time)
Definition particle.cc:3734
short psys_get_current_num(struct Object *ob)
Definition particle.cc:552
void BKE_particlesettings_twist_curve_init(struct ParticleSettings *part)
Definition particle.cc:4125
void psys_check_group_weights(struct ParticleSettings *part)
Definition particle.cc:766
void(* BKE_particle_batch_cache_dirty_tag_cb)(struct ParticleSystem *psys, int mode)
Definition particle.cc:5285
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:1140
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:4097
void psys_mat_hair_to_object(struct Object *ob, struct Mesh *mesh, short from, struct ParticleData *pa, float hairmat[4][4])
Definition particle.cc:3844
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:4467
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:2246
void BKE_particle_system_blend_read_data(struct BlendDataReader *reader, struct ListBase *particles)
Definition particle.cc:5346
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:2021
float psys_get_dietime_from_cache(struct PointCache *cache, int index)
Definition particle.cc:1274
void BKE_particlesystem_reset_all(struct Object *object)
void psys_free_particles(struct ParticleSystem *psys)
Definition particle.cc:932
unsigned int PSYS_FRAND_SEED_MULTIPLIER[PSYS_FRAND_COUNT]
Definition particle.cc:415
float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
Definition particle.cc:4471
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:922
void free_keyed_keys(struct ParticleSystem *psys)
Definition particle.cc:881
void void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params)
Definition particle.cc:3249
void BKE_particle_system_blend_read_after_liblink(struct BlendLibReader *reader, struct Object *ob, struct ID *id, struct ListBase *particles)
Definition particle.cc:5434
int psys_uses_gravity(struct ParticleSimulationData *sim)
Definition particle.cc:829
void psys_enable_all(struct Object *ob)
Definition particle.cc:651
void psys_emitter_customdata_mask(struct ParticleSystem *psys, struct CustomData_MeshMasks *r_cddata_masks)
Definition particle.cc:2207
float psys_particle_value_from_verts(struct Mesh *mesh, short from, struct ParticleData *pa, float *values)
Definition particle.cc:2141
int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur)
Definition particle.cc:467
void psys_sph_density(struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2])
void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float r_uv[2])
void psys_sim_data_free(struct ParticleSimulationData *sim)
Definition particle.cc:633
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:3984
void init_particle(struct ParticleSimulationData *sim, struct ParticleData *pa)
unsigned int PSYS_FRAND_SEED_OFFSET[PSYS_FRAND_COUNT]
Definition particle.cc:414
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 BKE_particle_init_rng(void)
Definition particle.cc:418
struct ParticleSystem * psys_get_current(struct Object *ob)
Definition particle.cc:538
struct ParticleSystem * psys_eval_get(struct Depsgraph *depsgraph, struct Object *object, struct ParticleSystem *psys)
Definition particle.cc:668
void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit)
Definition particle.cc:907
blender::Vector< ParticleTask > psys_tasks_create(struct ParticleThreadContext *ctx, int startpart, int endpart)
void psys_free_pdd(struct ParticleSystem *psys)
Definition particle.cc:962
void psys_find_group_weights(struct ParticleSettings *part)
Definition particle.cc:745
#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:1834
int count_particles(struct ParticleSystem *psys)
Definition particle.cc:449
float psys_get_child_size(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *pa_time)
Definition particle.cc:4503
void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra)
Definition particle.cc:4331
void free_hair(struct Object *ob, struct ParticleSystem *psys, int dynamics)
Definition particle.cc:846
void BKE_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode)
Definition particle.cc:5288
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)
@ BKE_PARTICLE_BATCH_DIRTY_ALL
void BKE_particle_system_blend_write(struct BlendWriter *writer, struct ListBase *particles)
Definition particle.cc:5301
void psys_free(struct Object *ob, struct ParticleSystem *psys)
Definition particle.cc:978
void psys_tasks_free(blender::Vector< ParticleTask > &tasks)
void BKE_particle_batch_cache_free(struct ParticleSystem *psys)
Definition particle.cc:5294
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:5246
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:2605
void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, bool editupdate, bool use_render_params)
Definition particle.cc:3150
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:4088
void BKE_particlesystem_id_loop(struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata)
void psys_sim_data_init(struct ParticleSimulationData *sim)
Definition particle.cc:592
void psys_copy_particles(struct ParticleSystem *psys_dst, struct ParticleSystem *psys_src)
Definition particle.cc:1056
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:5286
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
Definition particle.cc:4879
#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]
const char * name
Definition DNA_ID.h:414
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
blender::Vector< ParticleSpring > 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)
const blender::Map< blender::OrderedEdge, int > * eh
float element_size
float flow[3]
float mass
float hfac
const float * gravity