From d6672096fc226ad3397587a62872b063a8fbb41e Mon Sep 17 00:00:00 2001 From: QbieShay Date: Tue, 13 Jul 2021 19:46:27 +0200 Subject: moved particle parameters to minmax and split scale axis This commit adds quite a chunk of modifications to particles - particle (value + randomness) now use min and max instead - passing a curveXYZtexture is now possible and will scale particles per-axis - CPUParticle3D have an optional parameter to split the scale curve per-axis --- scene/2d/cpu_particles_2d.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'scene/2d/cpu_particles_2d.h') diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h index 0f8950375f..4990d443e3 100644 --- a/scene/2d/cpu_particles_2d.h +++ b/scene/2d/cpu_particles_2d.h @@ -150,8 +150,8 @@ private: Vector2 direction = Vector2(1, 0); real_t spread = 45.0; - real_t parameters[PARAM_MAX]; - real_t randomness[PARAM_MAX]; + real_t parameters_min[PARAM_MAX]; + real_t parameters_max[PARAM_MAX]; Ref curve_parameters[PARAM_MAX]; Color color; @@ -167,6 +167,10 @@ private: Vector emission_colors; int emission_point_count = 0; + Ref scale_curve_x; + Ref scale_curve_y; + bool split_scale = false; + Vector2 gravity = Vector2(0, 980); void _update_internal(); @@ -236,11 +240,11 @@ public: void set_spread(real_t p_spread); real_t get_spread() const; - void set_param(Parameter p_param, real_t p_value); - real_t get_param(Parameter p_param) const; + void set_param_min(Parameter p_param, real_t p_value); + real_t get_param_min(Parameter p_param) const; - void set_param_randomness(Parameter p_param, real_t p_value); - real_t get_param_randomness(Parameter p_param) const; + void set_param_max(Parameter p_param, real_t p_value); + real_t get_param_max(Parameter p_param) const; void set_param_curve(Parameter p_param, const Ref &p_curve); Ref get_param_curve(Parameter p_param) const; @@ -261,6 +265,9 @@ public: void set_emission_normals(const Vector &p_normals); void set_emission_colors(const Vector &p_colors); void set_emission_point_count(int p_count); + void set_scale_curve_x(Ref p_scale_curve); + void set_scale_curve_y(Ref p_scale_curve); + void set_split_scale(bool p_split_scale); EmissionShape get_emission_shape() const; real_t get_emission_sphere_radius() const; @@ -269,6 +276,9 @@ public: Vector get_emission_normals() const; Vector get_emission_colors() const; int get_emission_point_count() const; + Ref get_scale_curve_x() const; + Ref get_scale_curve_y() const; + bool get_split_scale(); void set_gravity(const Vector2 &p_gravity); Vector2 get_gravity() const; -- cgit v1.2.3