83 float **r_data_velocity,
93 if (r_data_velocity) {
94 *r_data_velocity =
data + offset;
96 offset += 3 * totpoint;
99 if (r_data_velocity) {
100 *r_data_velocity =
nullptr;
106 *r_data_life =
data + offset;
112 *r_data_life =
nullptr;
118 *r_data_color =
data + offset;
120 offset += 3 * totpoint;
124 *r_data_color =
nullptr;
153 "particle point data");
169 float *data_vel, *data_life;
202 for (
i = 0, pa = psys->
particles;
i < total_particles;
i++, pa++) {
236 float pa_birthtime, pa_dietime;
246 mul_m4_v3(ob->world_to_object().ptr(), partco);
258 data_vel[
i * 3 + 0] =
state.vel[0];
259 data_vel[
i * 3 + 1] =
state.vel[1];
260 data_vel[
i * 3 + 2] =
state.vel[2];
263 data_life[
i] =
state.time;
297 for (
i = 0;
i < totloop;
i++) {
298 int v = corner_verts[
i];
300 if (mcorners[
v] == 0) {
316 if (mcorners[
i] > 0) {
341 if (mdef_index < 0) {
344 if (mdef_index < 0) {
349 for (
i = 0, dv = mdef;
i < totvert;
i++, dv++, data_color += 3) {
353 for (j = 0, dw = dv->
dw; j < dv->totweight; j++, dw++) {
354 if (dw->
def_nr == mdef_index) {
407 mul_m4_v3(ob->object_to_world().ptr(), co);
412 mul_m4_v3(ob->object_to_world().ptr(), co);
449 if (!ob || !pd->
psys) {
502 float density = 0.0f;
509 density = 3.0f * dist * dist - 2.0f * dist * dist * dist;
518 density =
sqrtf(dist);
546static void accum_density(
void *userdata,
int index,
const float co[3],
float squared_dist)
549 float density = 0.0f;
594 const float texvec[3],
602 float density = 0.0f, age = 0.0f;
603 float vec[3] = {0.0f, 0.0f, 0.0f},
col[3] = {0.0f, 0.0f, 0.0f}, co[3];
604 float turb, noise_fac;
650 co[0] = texvec[0] + noise_fac *
turb;
651 co[1] = texvec[1] + noise_fac *
turb;
652 co[2] = texvec[2] + noise_fac *
turb;
664 texres->
tin = density;
665 if (r_age !=
nullptr) {
668 if (r_vec !=
nullptr) {
671 if (r_col !=
nullptr) {
692 texres->
tin *= rgba[3];
704 texres->
tin *= rgba[3];
733 texres->
tin *= rgba[3];
754 memset(values, 0,
sizeof(
float[4]) * resolution * resolution * resolution);
765 const float size[3] = {radius, radius, radius};
772 float mat[4][4], imat[4][4];
792 for (
i = 0, pa = psys->
particles;
i < total_particles;
i++, pa++) {
793 float co_object[3], co_min[3], co_max[3];
826 if (
object ==
nullptr) {
840 if (psys ==
nullptr) {
877 const int resolution =
data->resolution;
878 const int resolution2 = resolution * resolution;
881 float *values =
data->values;
887 size_t z = size_t(iter);
888 for (
size_t y = 0;
y < resolution;
y++) {
889 for (
size_t x = 0;
x < resolution;
x++) {
890 size_t index =
z * resolution2 +
y * resolution +
x;
892 float age, vec[3],
col[3];
896 texvec[0] += dim[0] * float(
x) / float(resolution);
897 texvec[1] += dim[1] * float(
y) / float(resolution);
898 texvec[2] += dim[2] * float(
z) / float(resolution);
904 values[index * 4 + 3] = texres.
tin;
911 const int resolution,
915 float min[3],
max[3], dim[3];
921 if (
object ==
nullptr) {
931 if (dim[0] <= 0.0f || dim[1] <= 0.0f || dim[2] <= 0.0f) {
938 data.resolution = resolution;
941 data.values = values;
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
CustomData interface, see also DNA_customdata_types.h.
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
const CustomData_MeshMasks CD_MASK_BAREMESH
General operations, lookup, etc. for blender objects.
std::optional< blender::Bounds< blender::float3 > > BKE_object_boundbox_get(const Object *ob)
struct ParticleSystemModifierData * psys_get_modifier(struct Object *ob, struct ParticleSystem *psys)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params)
float psys_get_child_time(struct ParticleSystem *psys, struct ChildParticle *cpa, float cfra, float *birthtime, float *dietime)
void psys_sim_data_free(struct ParticleSimulationData *sim)
void psys_sim_data_init(struct ParticleSimulationData *sim)
bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, bool always)
float BKE_scene_ctime_get(const Scene *scene)
BVHTree * BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_balance(BVHTree *tree)
void BLI_bvhtree_free(BVHTree *tree)
void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoints)
int BLI_bvhtree_range_query(const BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void unit_m4(float m[4][4])
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE void copy_v4_fl(float r[4], float f)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
ATTR_WARN_UNUSED_RESULT const size_t num
float BLI_noise_generic_turbulence(float noisesize, float x, float y, float z, int oct, bool hard, int noisebasis)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
#define INIT_MINMAX(min, max)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
Object is a sort of wrapper for general info.
@ TEX_PD_COLOR_VERTWEIGHT
@ TEX_PD_FALLOFF_PARTICLE_VEL
@ TEX_PD_FALLOFF_PARTICLE_AGE
@ TEX_PD_FALLOFF_CONSTANT
Read Guarded memory(de)allocation.
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
bool contains(StringRef attribute_id) const
GAttributeReader lookup(const StringRef attribute_id) const
static float normals[][3]
#define CD_MASK_PROP_BYTE_COLOR
#define CD_MASK_MDEFORMVERT
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static float turb(float x, float y, float z, int oct, int hard, int nb, float ampscale, float freqscale)
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
char * active_color_attribute
ObjectRuntimeHandle * runtime
struct Depsgraph * depsgraph
struct ParticleSystemModifierData * psmd
struct ParticleSystem * psys
struct ParticleCacheKey ** childcache
struct ParticleCacheKey ** pathcache
CurveMapping * density_curve
float * point_data_velocity
float falloff_speed_scale
struct CurveMapping * falloff_curve
char vertex_attribute_name[68]
static void sample_dummy_point_density(int resolution, float *values)
void RE_point_density_free(PointDensity *pd)
void RE_point_density_minmax(Depsgraph *depsgraph, PointDensity *pd, float r_min[3], float r_max[3])
void RE_point_density_sample(Depsgraph *depsgraph, PointDensity *pd, const int resolution, float *values)
void RE_point_density_fix_linking()
static void pointdensity_cache_object(PointDensity *pd, Object *ob)
static void init_pointdensityrangedata(PointDensity *pd, PointDensityRangeData *pdr, float *density, float *vec, float *age, float *col, CurveMapping *density_curve, float velscale)
static void accum_density(void *userdata, int index, const float co[3], float squared_dist)
static void pointdensity_cache_vertex_weight(PointDensity *pd, Object *ob, Mesh *mesh, float *data_color)
static void point_data_pointers(PointDensity *pd, float **r_data_velocity, float **r_data_life, float **r_data_color)
static void particle_system_minmax(Depsgraph *depsgraph, Scene *scene, Object *object, ParticleSystem *psys, float radius, float min[3], float max[3])
static int pointdensity(PointDensity *pd, const float texvec[3], TexResult *texres, float r_vec[3], float *r_age, float r_col[3])
void RE_point_density_cache(Depsgraph *depsgraph, PointDensity *pd)
static void pointdensity_cache_psys(Depsgraph *depsgraph, Scene *scene, PointDensity *pd, Object *ob, ParticleSystem *psys)
static void pointdensity_color(PointDensity *pd, TexResult *texres, float age, const float vec[3], const float col[3])
static float density_falloff(PointDensityRangeData *pdr, int index, float squared_dist)
static void alloc_point_data(PointDensity *pd)
static void pointdensity_cache_vertex_normal(Mesh *mesh, float *data_color)
static blender::Mutex sample_mutex
static void cache_pointdensity(Depsgraph *depsgraph, Scene *scene, PointDensity *pd)
static void pointdensity_cache_vertex_color(PointDensity *pd, Object *, Mesh *mesh, float *data_color)
static int point_data_used(PointDensity *pd)
static void free_pointdensity(PointDensity *pd)
static void point_density_sample_func(void *__restrict data_v, const int iter, const TaskParallelTLS *__restrict)