summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/gpu_particles_2d.cpp18
-rw-r--r--scene/2d/gpu_particles_2d.h14
2 files changed, 16 insertions, 16 deletions
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index 4739d3dd46..58525c6954 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -81,12 +81,12 @@ void GPUParticles2D::set_pre_process_time(double p_time) {
RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
}
-void GPUParticles2D::set_explosiveness_ratio(float p_ratio) {
+void GPUParticles2D::set_explosiveness_ratio(real_t p_ratio) {
explosiveness_ratio = p_ratio;
RS::get_singleton()->particles_set_explosiveness_ratio(particles, explosiveness_ratio);
}
-void GPUParticles2D::set_randomness_ratio(float p_ratio) {
+void GPUParticles2D::set_randomness_ratio(real_t p_ratio) {
randomness_ratio = p_ratio;
RS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio);
}
@@ -176,7 +176,7 @@ bool GPUParticles2D::is_trail_enabled() const {
return trail_enabled;
}
-real_t GPUParticles2D::get_trail_length() const {
+double GPUParticles2D::get_trail_length() const {
return trail_length;
}
@@ -355,19 +355,19 @@ void GPUParticles2D::_notification(int p_what) {
PackedInt32Array indices;
int total_segments = trail_sections * trail_section_subdivisions;
- float depth = size.height * trail_sections;
+ real_t depth = size.height * trail_sections;
for (int j = 0; j <= total_segments; j++) {
- float v = j;
+ real_t v = j;
v /= total_segments;
- float y = depth * v;
+ real_t y = depth * v;
y = (depth * 0.5) - y;
int bone = j / trail_section_subdivisions;
- float blend = 1.0 - float(j % trail_section_subdivisions) / float(trail_section_subdivisions);
+ real_t blend = 1.0 - real_t(j % trail_section_subdivisions) / real_t(trail_section_subdivisions);
- float s = size.width;
+ real_t s = size.width;
points.push_back(Vector2(-s * 0.5, 0));
points.push_back(Vector2(+s * 0.5, 0));
@@ -413,7 +413,7 @@ void GPUParticles2D::_notification(int p_what) {
for (int i = 0; i <= trail_sections; i++) {
Transform3D xform;
/*
- xform.origin.y = depth / 2.0 - size.height * float(i);
+ xform.origin.y = depth / 2.0 - size.height * real_t(i);
xform.origin.y = -xform.origin.y; //bind is an inverse transform, so negate y */
xforms.push_back(xform);
}
diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h
index a80e52d60c..67a87f2339 100644
--- a/scene/2d/gpu_particles_2d.h
+++ b/scene/2d/gpu_particles_2d.h
@@ -53,8 +53,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;
Rect2 visibility_rect;
bool local_coords;
@@ -70,10 +70,10 @@ private:
void _update_particle_emission_transform();
NodePath sub_emitter;
- float collision_base_size = 1.0;
+ real_t collision_base_size = 1.0;
bool trail_enabled = false;
- float trail_length = 0.3;
+ double trail_length = 0.3;
int trail_sections = 8;
int trail_section_subdivisions = 4;
@@ -92,8 +92,8 @@ public:
void set_lifetime(double p_lifetime);
void set_one_shot(bool p_enable);
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_rect(const Rect2 &p_visibility_rect);
void set_use_local_coordinates(bool p_enable);
void set_process_material(const Ref<Material> &p_material);
@@ -118,7 +118,7 @@ public:
real_t get_collision_base_size() const;
bool is_trail_enabled() const;
- real_t get_trail_length() const;
+ double get_trail_length() const;
int get_trail_sections() const;
int get_trail_section_subdivisions() const;