54 iter->
key = keys + index;
56 iter->
time = (
float)index / (
float)(totkeys - 1);
88 const float spiral_start[3])
104 const float b = shape * (1.0f +
sqrtf(5.0f)) / (
float)
M_PI * 0.25f;
106 const float start_angle = ((b != 0.0f) ?
atanf(1.0f / b) : (
float)-
M_PI_2) +
109 float spiral_axis[3],
rot[3][3];
113 float radius = amplitude *
expf(b * theta);
116 if (amplitude < 0.0f) {
141 const float parent_orco[3],
152 const int totkeys = ctx->
segments + 1;
170 float spiral_start[3] = {0.0f, 0.0f, 0.0f};
171 float spiral_start_time = 0.0f;
172 float spiral_par_co[3] = {0.0f, 0.0f, 0.0f};
173 float spiral_par_vel[3] = {0.0f, 0.0f, 0.0f};
174 float spiral_par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f};
177 int start_index = 0, end_index = 0;
188 cut_time = (totkeys - 1) * ptex->
length;
191 for (k = 0, key = keys; k < totkeys - 1; k++, key++) {
192 if ((
float)(k + 1) >= cut_time) {
193 float fac = cut_time - (
float)k;
197 end_index = start_index + extrakeys;
199 spiral_start_time = ((
float)k + fac) / (
float)(totkeys - 1);
219 modifier_ctx.
sim = &ctx->
sim;
220 modifier_ctx.
ptex = ptex;
221 modifier_ctx.
cpa = cpa;
222 modifier_ctx.
orco = orco;
225 for (k = 0, key = keys; k < end_index; k++, key++) {
227 float *par_co, *par_vel, *par_rot;
230 if (k < start_index) {
234 par_time = (
float)k / (
float)(totkeys - 1);
235 par_co = parent_keys[k].
co;
236 par_vel = parent_keys[k].
vel;
237 par_rot = parent_keys[k].
rot;
240 float spiral_time = (
float)(k - start_index) / (
float)(extrakeys - 1);
241 float kink[3], tmp[3];
244 par_time = spiral_start_time;
245 par_co = spiral_par_co;
246 par_vel = spiral_par_vel;
247 par_rot = spiral_par_rot;
273 modifier_ctx.
par_co = par_co;
274 modifier_ctx.
par_vel = par_vel;
275 modifier_ctx.
par_rot = par_rot;
276 modifier_ctx.
par_orco = parent_orco;
283 for (k = 0, key = keys; k < end_index - 1; k++, key++) {
287 *r_totkeys = end_index;
288 *r_max_length = totlen;
301 if (*cur_length + step_length > max_length) {
303 mul_v3_fl(dvec, (max_length - *cur_length) / step_length);
310 *cur_length += step_length;
322 const float parent_orco[3])
341 ctx, ptex, parent_orco, cpa, orco, hairmat, keys, parent_keys, &totkeys, &max_length);
348 modifier_ctx.
sim = &ctx->
sim;
349 modifier_ctx.
ptex = ptex;
350 modifier_ctx.
cpa = cpa;
351 modifier_ctx.
orco = orco;
355 max_length = ptex->
length;
357 for (k = 0, key = keys; k < totkeys; k++, key++) {
367 modifier_ctx.
par_orco = parent_orco;
375 const float step_length = 1.0f / (
float)(totkeys - 1);
376 float cur_length = 0.0f;
378 if (max_length <= 0.0f) {
384 for (k = 0, key = keys; k < totkeys; k++, key++) {
390 if (use_length_check && k > 0) {
393 if (!
check_path_length(k, keys, key, max_length, step_length, &cur_length, dvec)) {
396 if (ma && draw_col_ma) {
402 if (k == totkeys - 1) {
407 if (ma && draw_col_ma) {
417 const float par_co[3],
418 const float par_vel[3],
419 const float par_rot[4],
430 float kink[3] = {1.0f, 0.0f, 0.0f}, par_vec[3],
q1[4] = {1.0f, 0.0f, 0.0f, 0.0f};
454 dt =
sinf(dt / 2.0f);
479 float curl_offset[3];
517 float y_vec[3] = {0.0f, 1.0f, 0.0f};
518 float z_vec[3] = {0.0f, 0.0f, 1.0f};
519 float vec_one[3], state_co[3];
520 float inp_y, inp_z,
length;
539 else if (inp_z > 0.0f) {
565 shape = 2.0f * (
float)
M_PI * (1.0f + shape);
590 const float par_co[3],
605 else if (clumpfac != 0.0f) {
608 if (clumppow < 0.0f) {
609 cpow = 1.0f + clumppow;
612 cpow = 1.0f + 9.0f * clumppow;
615 if (clumpfac < 0.0f) {
629 const float par_co[3],
631 const float orco_offset[3],
635 bool use_clump_noise,
636 float clump_noise_size,
641 if (use_clump_noise && clump_noise_size != 0.0f) {
642 float center[3], noisevec[3];
645 mul_v3_v3fl(noisevec, orco_offset, 1.0f / clump_noise_size);
654 state->co,
state->co, par_co,
time, clumpfac, clumppow, pa_clump, clumpcurve);
660 const float mat[4][4],
671 if (
fabsf((
float)(-1.5f + loc[0] + loc[1] + loc[2])) < 1.5f * thres) {
688 const float loc[3],
const float mat[4][4],
float t,
float fac,
float shape,
ParticleKey *
state)
693 roughfac = fac * (
float)
pow((
double)
t, shape);
695 rough[0] = -1.0f + 2.0f * rough[0];
696 rough[1] = -1.0f + 2.0f * rough[1];
704 const float mat[4][4],
758 float integral = 0.0f;
764 integral +=
y * step;
787 if (part->
twist == 0.0f) {
806 if (twist_curve !=
NULL) {
844 float rough1 = part->
rough1;
845 float rough2 = part->
rough2;
854 rough_end *= ptex->
roughe;
870 float orco_offset[3];
880 ptex ? ptex->
clump : 1.0f,
885 if (kink_freq != 0.0f) {
886 kink_amp *= (1.0f - kink_amp_clump * clump);
918 if (rough_end > 0.0f) {
typedef float(TangentPoint)[2]
int do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, ParticleKey *state, int index, float time)
BLI_INLINE void psys_frand_vec(ParticleSystem *psys, unsigned int seed, float vec[3])
BLI_INLINE float psys_frand(ParticleSystem *psys, unsigned int seed)
MINLINE float clamp_f(float value, float min, float max)
MINLINE int clamp_i(int value, int min, int max)
void mul_m3_v3(const float M[3][3], float r[3])
void mul_mat3_m4_v3(const float M[4][4], float r[3])
void axis_angle_to_quat(float r[4], const float axis[3], const float angle)
void mul_qt_v3(const float q[4], float r[3])
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], const float angle)
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t)
void copy_qt_qt(float q[4], const float a[4])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[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_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle)
MINLINE void negate_v3(float r[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
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])
void BLI_noise_voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype)
float BLI_noise_generic_turbulence(float noisesize, float x, float y, float z, int oct, bool hard, int noisebasis)
typedef double(DMatrix)[4][4]
Object is a sort of wrapper for general info.
#define PART_DRAW_COL_MAT
#define PART_CHILD_EFFECT
#define PART_CHILD_PARTICLES
@ PART_CHILD_USE_TWIST_CURVE
@ PART_CHILD_USE_CLUMP_CURVE
@ PART_CHILD_USE_CLUMP_NOISE
@ PART_CHILD_USE_ROUGH_CURVE
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
Group RGB to Bright Vector Camera CLAMP
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
static unsigned long seed
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
static float do_clump_level(float result[3], const float co[3], const float par_co[3], float time, float clumpfac, float clumppow, float pa_clump, CurveMapping *clumpcurve)
struct ParticlePathIterator ParticlePathIterator
static void do_twist(const ParticleChildModifierContext *modifier_ctx, ParticleKey *state, const float time)
static bool check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *key, float max_length, float step_length, float *cur_length, float dvec[3])
static void do_kink_spiral_deform(ParticleKey *state, const float dir[3], const float kink[3], float time, float freq, float shape, float amplitude, const float spiral_start[3])
void do_kink(ParticleKey *state, const float par_co[3], const float par_vel[3], const float par_rot[4], float time, float freq, float shape, float amplitude, float flat, short type, short axis, float obmat[4][4], int smooth_start)
float do_clump(ParticleKey *state, const float par_co[3], float time, const float orco_offset[3], float clumpfac, float clumppow, float pa_clump, bool use_clump_noise, float clump_noise_size, CurveMapping *clumpcurve)
static void do_kink_spiral(ParticleThreadContext *ctx, ParticleTexture *ptex, const float parent_orco[3], ChildParticle *cpa, const float orco[3], float hairmat[4][4], ParticleCacheKey *keys, ParticleCacheKey *parent_keys, int *r_totkeys, float *r_max_length)
void psys_apply_child_modifiers(ParticleThreadContext *ctx, struct ListBase *modifiers, ChildParticle *cpa, ParticleTexture *ptex, const float orco[3], float hairmat[4][4], ParticleCacheKey *keys, ParticleCacheKey *parent_keys, const float parent_orco[3])
static void do_rough_end(const float loc[3], const float mat[4][4], float t, float fac, float shape, ParticleKey *state)
static void twist_get_axis(const ParticleChildModifierContext *modifier_ctx, const float time, float r_axis[3])
static void do_rough(const float loc[3], const float mat[4][4], float t, float fac, float size, float thres, ParticleKey *state)
static float BKE_curvemapping_integrate_clamped(CurveMapping *curve, float start, float end, float step)
struct ParticlePathModifier ParticlePathModifier
static void psys_path_iter_get(ParticlePathIterator *iter, ParticleCacheKey *keys, int totkeys, ParticleCacheKey *parent, int index)
static int twist_num_segments(const ParticleChildModifierContext *modifier_ctx)
void do_child_modifiers(const ParticleChildModifierContext *modifier_ctx, float mat[4][4], ParticleKey *state, float t)
static void do_rough_curve(const float loc[3], const float mat[4][4], float time, float fac, float size, CurveMapping *roughcurve, ParticleKey *state)
ParticleThreadContext * thread_ctx
ParticleCacheKey * parent_keys
ParticleSimulationData * sim
ParticleCacheKey * parent_key
struct ParticlePathModifier * next
struct ParticlePathModifier * prev
void(* apply)(ParticleCacheKey *keys, int totkeys, ParticleCacheKey *parent_keys)
struct CurveMapping * clumpcurve
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct Depsgraph * depsgraph
struct ParticleSystem * psys
struct ListBase * effectors
struct CurveMapping * roughcurve
struct CurveMapping * twistcurve
struct CurveMapping * clumpcurve
struct ParticleSimulationData sim
ccl_device_inline int mod(int x, int m)