Blender V4.3
particle_distribute.cc File Reference
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_jitter_2d.h"
#include "BLI_kdtree.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 "BKE_customdata.hh"
#include "BKE_global.hh"
#include "BKE_lib_id.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_convert.hh"
#include "BKE_particle.h"
#include "DEG_depsgraph_query.hh"

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, void *taskdata)
 
static void exec_distribute_child (TaskPool *__restrict, 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)
 
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 459 of file particle_distribute.cc.

◆ PSYS_RND_DIST_SKIP

Function Documentation

◆ alloc_child_particles()

◆ distribute_binary_search()

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

Definition at line 420 of file particle_distribute.cc.

References sum().

Referenced by psys_thread_context_init_distribute().

◆ distribute_children_exec()

◆ distribute_compare_orig_index()

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

Definition at line 827 of file particle_distribute.cc.

Referenced by psys_thread_context_init_distribute().

◆ distribute_from_faces_exec()

◆ distribute_from_verts_exec()

◆ distribute_from_volume_exec()

◆ distribute_grid()

◆ distribute_invalid()

◆ distribute_particles()

◆ distribute_particles_on_dm()

◆ distribute_particles_on_shape()

static void distribute_particles_on_shape ( ParticleSimulationData * sim,
int  )
static

Definition at line 1387 of file particle_distribute.cc.

References distribute_invalid().

Referenced by distribute_particles().

◆ distribute_simple_children()

◆ exec_distribute_child()

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

◆ exec_distribute_parent()

◆ 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 884 of file particle_distribute.cc.

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_MFACE, CD_ORCO, CD_ORIGINDEX, ParticleThreadContext::cfrom, ParticleSystem::child_seed, copy_v3_v3(), CustomData_get_layer(), CustomData_get_layer_for_write(), DAG_EVAL_RENDER, Object::data, DEG_get_mode(), ParticleSimulationData::depsgraph, ParticleThreadContext::distr, distribute_binary_search(), distribute_compare_orig_index(), distribute_grid(), distribute_invalid(), distribute_simple_children(), double(), ELEM, Mesh::fdata_legacy, float, ParticleData::foffset, ParticleData::fuv, G, G_DEBUG, hammersley_create(), ParticleThreadContext::index, init_mv_jit(), jit, ParticleThreadContext::jit, ParticleThreadContext::jitlevel, ParticleThreadContext::jitoff, LIB_ID_COPY_LOCALIZE, ParticleThreadContext::maxweight, MEM_callocN, MEM_freeN(), MEM_mallocN, mesh, ParticleThreadContext::mesh, ParticleSystemModifierData::mesh_final, ParticleSystemModifierData::mesh_original, min, nor, ParticleData::num, ParticleData::num_dmcache, ParticleSimulationData::ob, 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, printf, 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, ParticleThreadContext::seams, ParticleSystem::seed, ParticleThreadContext::sim, ParticleSystem::totpart, ParticleThreadContext::totseam, ParticleThreadContext::tpars, ParticleThreadContext::tree, tree, ParticleSettings::use_modifier_stack, MFace::v1, MFace::v2, MFace::v3, MFace::v4, 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