Blender  V3.3
Macros | Functions
particle_distribute.c File Reference
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_jitter_2d.h"
#include "BLI_kdtree.h"
#include "BLI_math.h"
#include "BLI_math_geom.h"
#include "BLI_rand.h"
#include "BLI_sort.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "BKE_customdata.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_mesh.h"
#include "BKE_mesh_legacy_convert.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "DEG_depsgraph_query.h"

Go to the source code of this file.

Macros

#define PSYS_RND_DIST_SKIP   3
 
#define ONLY_WORKING_WITH_PA_VERTS   0
 

Functions

static void alloc_child_particles (ParticleSystem *psys, int tot)
 
static void distribute_simple_children (Scene *scene, Object *ob, Mesh *final_mesh, Mesh *deform_mesh, ParticleSystem *psys, const bool use_render_params)
 
static void distribute_grid (Mesh *mesh, ParticleSystem *psys)
 
static void hammersley_create (float *out, int n, int seed, float amount)
 
static void init_mv_jit (float *jit, int num, int seed2, float amount)
 
static void psys_uv_to_w (float u, float v, int quad, float *w)
 
static int distribute_binary_search (const float *sum, int n, float value)
 
static void distribute_from_verts_exec (ParticleTask *thread, ParticleData *pa, int p)
 
static void distribute_from_faces_exec (ParticleTask *thread, ParticleData *pa, int p)
 
static void distribute_from_volume_exec (ParticleTask *thread, ParticleData *pa, int p)
 
static void distribute_children_exec (ParticleTask *thread, ChildParticle *cpa, int p)
 
static void exec_distribute_parent (TaskPool *__restrict UNUSED(pool), void *taskdata)
 
static void exec_distribute_child (TaskPool *__restrict UNUSED(pool), void *taskdata)
 
static int distribute_compare_orig_index (const void *p1, const void *p2, void *user_data)
 
static void distribute_invalid (ParticleSimulationData *sim, int from)
 
static int psys_thread_context_init_distribute (ParticleThreadContext *ctx, ParticleSimulationData *sim, int from)
 
static void psys_task_init_distribute (ParticleTask *task, ParticleSimulationData *sim)
 
static void distribute_particles_on_dm (ParticleSimulationData *sim, int from)
 
static void distribute_particles_on_shape (ParticleSimulationData *sim, int UNUSED(from))
 
void distribute_particles (ParticleSimulationData *sim, int from)
 

Macro Definition Documentation

◆ ONLY_WORKING_WITH_PA_VERTS

#define ONLY_WORKING_WITH_PA_VERTS   0

Definition at line 461 of file particle_distribute.c.

◆ PSYS_RND_DIST_SKIP

#define PSYS_RND_DIST_SKIP   3

Definition at line 458 of file particle_distribute.c.

Function Documentation

◆ alloc_child_particles()

static void alloc_child_particles ( ParticleSystem psys,
int  tot 
)
static

◆ distribute_binary_search()

static int distribute_binary_search ( const float sum,
int  n,
float  value 
)
static

Definition at line 422 of file particle_distribute.c.

References high(), low(), and sum().

Referenced by psys_thread_context_init_distribute().

◆ distribute_children_exec()

static void distribute_children_exec ( ParticleTask thread,
ChildParticle cpa,
int  p 
)
static

◆ distribute_compare_orig_index()

static int distribute_compare_orig_index ( const void p1,
const void p2,
void user_data 
)
static

Definition at line 810 of file particle_distribute.c.

References user_data.

Referenced by psys_thread_context_init_distribute().

◆ distribute_from_faces_exec()

static void distribute_from_faces_exec ( ParticleTask thread,
ParticleData pa,
int  p 
)
static

◆ distribute_from_verts_exec()

static void distribute_from_verts_exec ( ParticleTask thread,
ParticleData pa,
int  p 
)
static

◆ distribute_from_volume_exec()

static void distribute_from_volume_exec ( ParticleTask thread,
ParticleData pa,
int  p 
)
static

◆ distribute_grid()

static void distribute_grid ( Mesh mesh,
ParticleSystem psys 
)
static

◆ distribute_invalid()

static void distribute_invalid ( ParticleSimulationData sim,
int  from 
)
static

◆ distribute_particles()

void distribute_particles ( ParticleSimulationData sim,
int  from 
)

◆ distribute_particles_on_dm()

static void distribute_particles_on_dm ( ParticleSimulationData sim,
int  from 
)
static

◆ distribute_particles_on_shape()

static void distribute_particles_on_shape ( ParticleSimulationData sim,
int   UNUSEDfrom 
)
static

Definition at line 1351 of file particle_distribute.c.

References distribute_invalid().

Referenced by distribute_particles().

◆ distribute_simple_children()

static void distribute_simple_children ( Scene scene,
Object ob,
Mesh final_mesh,
Mesh deform_mesh,
ParticleSystem psys,
const bool  use_render_params 
)
static

◆ exec_distribute_child()

static void exec_distribute_child ( TaskPool *__restrict   UNUSEDpool,
void taskdata 
)
static

◆ exec_distribute_parent()

static void exec_distribute_parent ( TaskPool *__restrict   UNUSEDpool,
void taskdata 
)
static

◆ hammersley_create()

static void hammersley_create ( float out,
int  n,
int  seed,
float  amount 
)
static

◆ init_mv_jit()

static void init_mv_jit ( float jit,
int  num,
int  seed2,
float  amount 
)
static

◆ psys_task_init_distribute()

static void psys_task_init_distribute ( ParticleTask task,
ParticleSimulationData sim 
)
static

◆ psys_thread_context_init_distribute()

static int psys_thread_context_init_distribute ( ParticleThreadContext ctx,
ParticleSimulationData sim,
int  from 
)
static

Definition at line 867 of file particle_distribute.c.

References alloc_child_particles(), area_quad_v3(), area_tri_v3(), BKE_id_copy_ex(), BKE_id_free(), BKE_mesh_orco_ensure(), BKE_mesh_orco_verts_transform(), BKE_mesh_tessface_ensure(), BKE_mesh_texspace_ensure(), BLI_array_randomize(), BLI_assert, BLI_qsort_r(), BLI_rng_free(), BLI_rng_get_float(), BLI_rng_new_srandom(), CD_ORCO, CD_ORIGINDEX, ParticleThreadContext::cfrom, ParticleSystem::child_seed, ParticleSettings::childtype, BMVert::co, MVert::co, copy_v3_v3(), CustomData_get_layer(), DAG_EVAL_RENDER, Object::data, Mesh_Runtime::deformed_only, DEG_get_mode(), ParticleSimulationData::depsgraph, ParticleThreadContext::distr, ParticleSettings::distr, distribute_binary_search(), distribute_compare_orig_index(), distribute_grid(), distribute_invalid(), distribute_simple_children(), ELEM, Mesh::fdata, ParticleSettings::flag, float(), ParticleData::foffset, from, ParticleSettings::from, ParticleData::fuv, G, G_DEBUG, hammersley_create(), if(), ParticleThreadContext::index, init_mv_jit(), ParticleThreadContext::jit, jit, ParticleSettings::jitfac, ParticleThreadContext::jitlevel, ParticleThreadContext::jitoff, LIB_ID_COPY_LOCALIZE, ParticleThreadContext::maxweight, MEM_callocN, MEM_freeN, MEM_mallocN, ParticleThreadContext::mesh, mesh, ParticleSystemModifierData::mesh_final, ParticleSystemModifierData::mesh_original, Mesh::mface, min, MIN2, Mesh::mvert, nor, NULL, ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, ParticleSettings::parents, ParticleSystem::part, PART_CHILD_FACES, PART_DISTR_GRID, PART_DISTR_JIT, PART_DISTR_RAND, PART_EDISTR, PART_FROM_CHILD, PART_FROM_FACE, PART_FROM_VERT, PART_FROM_VOLUME, PART_HAIR, PART_TRAND, ParticleSystem::particles, pos, ParticleSimulationData::psmd, ParticleSimulationData::psys, psys_cache_vgroup(), psys_get_tot_child(), psys_particle_on_dm(), psys_thread_context_init(), PSYS_VG_DENSITY, Mesh::runtime, ParticleSimulationData::scene, scene, ParticleThreadContext::seams, ParticleSystem::seed, ParticleThreadContext::sim, Mesh::totface, ParticleSystem::totpart, ParticleThreadContext::totseam, Mesh::totvert, ParticleThreadContext::tpars, ParticleThreadContext::tree, tree, ParticleSettings::type, ParticleSettings::use_modifier_stack, ParticleSettings::userjit, v1, MFace::v1, v2, MFace::v2, MFace::v3, MFace::v4, Mesh::vdata, and ParticleThreadContext::weight.

Referenced by distribute_particles_on_dm().

◆ psys_uv_to_w()

static void psys_uv_to_w ( float  u,
float  v,
int  quad,
float w 
)
static