diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-12 20:51:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-12 20:51:21 +0200 |
commit | 56ac302dc4bbb887c45157b3e377313378e376c1 (patch) | |
tree | 9ca4c63cc2674641b6eff09d99a8cd729bdf8bf5 /scene/3d | |
parent | 1a9c8aaba9214dbed40c2c58adce724e1b7b8276 (diff) | |
parent | 03e2544d50b73a56907694fc45cb82ad11c74a95 (diff) |
Merge pull request #51580 from aaronfranke/particles-real-double
Use real_t and double where appropriate in Particles
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/gpu_particles_3d.cpp | 18 | ||||
-rw-r--r-- | scene/3d/gpu_particles_3d.h | 24 | ||||
-rw-r--r-- | scene/3d/gpu_particles_collision_3d.cpp | 22 | ||||
-rw-r--r-- | scene/3d/gpu_particles_collision_3d.h | 30 |
4 files changed, 48 insertions, 46 deletions
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index 8b8b53c3bf..7a6410ec51 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -86,12 +86,12 @@ void GPUParticles3D::set_pre_process_time(double p_time) { RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time); } -void GPUParticles3D::set_explosiveness_ratio(float p_ratio) { +void GPUParticles3D::set_explosiveness_ratio(real_t p_ratio) { explosiveness_ratio = p_ratio; RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio); } -void GPUParticles3D::set_randomness_ratio(float p_ratio) { +void GPUParticles3D::set_randomness_ratio(real_t p_ratio) { randomness_ratio = p_ratio; RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio); } @@ -123,7 +123,7 @@ void GPUParticles3D::set_speed_scale(double p_scale) { RS::get_singleton()->particles_set_speed_scale(particles, p_scale); } -void GPUParticles3D::set_collision_base_size(float p_size) { +void GPUParticles3D::set_collision_base_size(real_t p_size) { collision_base_size = p_size; RS::get_singleton()->particles_set_collision_base_size(particles, p_size); } @@ -148,11 +148,11 @@ double GPUParticles3D::get_pre_process_time() const { return pre_process_time; } -float GPUParticles3D::get_explosiveness_ratio() const { +real_t GPUParticles3D::get_explosiveness_ratio() const { return explosiveness_ratio; } -float GPUParticles3D::get_randomness_ratio() const { +real_t GPUParticles3D::get_randomness_ratio() const { return randomness_ratio; } @@ -172,7 +172,7 @@ double GPUParticles3D::get_speed_scale() const { return speed_scale; } -float GPUParticles3D::get_collision_base_size() const { +real_t GPUParticles3D::get_collision_base_size() const { return collision_base_size; } @@ -186,7 +186,8 @@ void GPUParticles3D::set_trail_enabled(bool p_enabled) { RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length); update_configuration_warnings(); } -void GPUParticles3D::set_trail_length(float p_seconds) { + +void GPUParticles3D::set_trail_length(double p_seconds) { ERR_FAIL_COND(p_seconds < 0.001); trail_length = p_seconds; RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_length); @@ -195,7 +196,8 @@ void GPUParticles3D::set_trail_length(float p_seconds) { bool GPUParticles3D::is_trail_enabled() const { return trail_enabled; } -float GPUParticles3D::get_trail_length() const { + +double GPUParticles3D::get_trail_length() const { return trail_length; } diff --git a/scene/3d/gpu_particles_3d.h b/scene/3d/gpu_particles_3d.h index 31e0e2abf5..31f33fde59 100644 --- a/scene/3d/gpu_particles_3d.h +++ b/scene/3d/gpu_particles_3d.h @@ -66,8 +66,8 @@ private: int amount; double lifetime; double pre_process_time; - float explosiveness_ratio; - float randomness_ratio; + real_t explosiveness_ratio; + real_t randomness_ratio; double speed_scale; AABB visibility_aabb; bool local_coords; @@ -75,10 +75,10 @@ private: bool fractional_delta; bool interpolate = true; NodePath sub_emitter; - float collision_base_size = 0.01; + real_t collision_base_size = 0.01; bool trail_enabled = false; - float trail_length = 0.3; + double trail_length = 0.3; TransformAlign transform_align = TRANSFORM_ALIGN_DISABLED; @@ -107,30 +107,30 @@ public: void set_lifetime(double p_lifetime); void set_one_shot(bool p_one_shot); void set_pre_process_time(double p_time); - void set_explosiveness_ratio(float p_ratio); - void set_randomness_ratio(float p_ratio); + void set_explosiveness_ratio(real_t p_ratio); + void set_randomness_ratio(real_t p_ratio); void set_visibility_aabb(const AABB &p_aabb); void set_use_local_coordinates(bool p_enable); void set_process_material(const Ref<Material> &p_material); void set_speed_scale(double p_scale); - void set_collision_base_size(float p_ratio); + void set_collision_base_size(real_t p_ratio); void set_trail_enabled(bool p_enabled); - void set_trail_length(float p_seconds); + void set_trail_length(double p_seconds); bool is_emitting() const; int get_amount() const; double get_lifetime() const; bool get_one_shot() const; double get_pre_process_time() const; - float get_explosiveness_ratio() const; - float get_randomness_ratio() const; + real_t get_explosiveness_ratio() const; + real_t get_randomness_ratio() const; AABB get_visibility_aabb() const; bool get_use_local_coordinates() const; Ref<Material> get_process_material() const; double get_speed_scale() const; - float get_collision_base_size() const; + real_t get_collision_base_size() const; bool is_trail_enabled() const; - float get_trail_length() const; + double get_trail_length() const; void set_fixed_fps(int p_count); int get_fixed_fps() const; diff --git a/scene/3d/gpu_particles_collision_3d.cpp b/scene/3d/gpu_particles_collision_3d.cpp index cc1b620025..8b214a9cfb 100644 --- a/scene/3d/gpu_particles_collision_3d.cpp +++ b/scene/3d/gpu_particles_collision_3d.cpp @@ -70,13 +70,13 @@ void GPUParticlesCollisionSphere::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius"); } -void GPUParticlesCollisionSphere::set_radius(float p_radius) { +void GPUParticlesCollisionSphere::set_radius(real_t p_radius) { radius = p_radius; RS::get_singleton()->particles_collision_set_sphere_radius(_get_collision(), radius); update_gizmos(); } -float GPUParticlesCollisionSphere::get_radius() const { +real_t GPUParticlesCollisionSphere::get_radius() const { return radius; } @@ -217,7 +217,7 @@ uint32_t GPUParticlesCollisionSDF::_create_bvh(LocalVector<BVH> &bvh_tree, FaceP return index; } -static _FORCE_INLINE_ float Vector3_dot2(const Vector3 &p_vec3) { +static _FORCE_INLINE_ real_t Vector3_dot2(const Vector3 &p_vec3) { return p_vec3.dot(p_vec3); } @@ -738,31 +738,31 @@ uint32_t GPUParticlesAttractor3D::get_cull_mask() const { return cull_mask; } -void GPUParticlesAttractor3D::set_strength(float p_strength) { +void GPUParticlesAttractor3D::set_strength(real_t p_strength) { strength = p_strength; RS::get_singleton()->particles_collision_set_attractor_strength(collision, p_strength); } -float GPUParticlesAttractor3D::get_strength() const { +real_t GPUParticlesAttractor3D::get_strength() const { return strength; } -void GPUParticlesAttractor3D::set_attenuation(float p_attenuation) { +void GPUParticlesAttractor3D::set_attenuation(real_t p_attenuation) { attenuation = p_attenuation; RS::get_singleton()->particles_collision_set_attractor_attenuation(collision, p_attenuation); } -float GPUParticlesAttractor3D::get_attenuation() const { +real_t GPUParticlesAttractor3D::get_attenuation() const { return attenuation; } -void GPUParticlesAttractor3D::set_directionality(float p_directionality) { +void GPUParticlesAttractor3D::set_directionality(real_t p_directionality) { directionality = p_directionality; RS::get_singleton()->particles_collision_set_attractor_directionality(collision, p_directionality); update_gizmos(); } -float GPUParticlesAttractor3D::get_directionality() const { +real_t GPUParticlesAttractor3D::get_directionality() const { return directionality; } @@ -803,13 +803,13 @@ void GPUParticlesAttractorSphere::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.01,1024,0.01,or_greater"), "set_radius", "get_radius"); } -void GPUParticlesAttractorSphere::set_radius(float p_radius) { +void GPUParticlesAttractorSphere::set_radius(real_t p_radius) { radius = p_radius; RS::get_singleton()->particles_collision_set_sphere_radius(_get_collision(), radius); update_gizmos(); } -float GPUParticlesAttractorSphere::get_radius() const { +real_t GPUParticlesAttractorSphere::get_radius() const { return radius; } diff --git a/scene/3d/gpu_particles_collision_3d.h b/scene/3d/gpu_particles_collision_3d.h index c55463378d..f96edd4bfc 100644 --- a/scene/3d/gpu_particles_collision_3d.h +++ b/scene/3d/gpu_particles_collision_3d.h @@ -60,14 +60,14 @@ public: class GPUParticlesCollisionSphere : public GPUParticlesCollision3D { GDCLASS(GPUParticlesCollisionSphere, GPUParticlesCollision3D); - float radius = 1.0; + real_t radius = 1.0; protected: static void _bind_methods(); public: - void set_radius(float p_radius); - float get_radius() const; + void set_radius(real_t p_radius); + real_t get_radius() const; virtual AABB get_aabb() const override; @@ -253,9 +253,9 @@ class GPUParticlesAttractor3D : public VisualInstance3D { uint32_t cull_mask = 0xFFFFFFFF; RID collision; - float strength = 1.0; - float attenuation = 1.0; - float directionality = 0.0; + real_t strength = 1.0; + real_t attenuation = 1.0; + real_t directionality = 0.0; protected: _FORCE_INLINE_ RID _get_collision() { return collision; } @@ -267,14 +267,14 @@ public: void set_cull_mask(uint32_t p_cull_mask); uint32_t get_cull_mask() const; - void set_strength(float p_strength); - float get_strength() const; + void set_strength(real_t p_strength); + real_t get_strength() const; - void set_attenuation(float p_attenuation); - float get_attenuation() const; + void set_attenuation(real_t p_attenuation); + real_t get_attenuation() const; - void set_directionality(float p_directionality); - float get_directionality() const; + void set_directionality(real_t p_directionality); + real_t get_directionality() const; virtual Vector<Face3> get_faces(uint32_t p_usage_flags) const override { return Vector<Face3>(); } @@ -284,14 +284,14 @@ public: class GPUParticlesAttractorSphere : public GPUParticlesAttractor3D { GDCLASS(GPUParticlesAttractorSphere, GPUParticlesAttractor3D); - float radius = 1.0; + real_t radius = 1.0; protected: static void _bind_methods(); public: - void set_radius(float p_radius); - float get_radius() const; + void set_radius(real_t p_radius); + real_t get_radius() const; virtual AABB get_aabb() const override; |