summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/animated_sprite_2d.cpp16
-rw-r--r--scene/2d/animated_sprite_2d.h6
-rw-r--r--scene/2d/cpu_particles_2d.cpp48
-rw-r--r--scene/2d/cpu_particles_2d.h38
-rw-r--r--scene/2d/gpu_particles_2d.cpp29
-rw-r--r--scene/2d/gpu_particles_2d.h30
-rw-r--r--scene/2d/navigation_region_2d.cpp4
-rw-r--r--scene/2d/physics_body_2d.cpp4
-rw-r--r--scene/2d/ray_cast_2d.cpp8
-rw-r--r--scene/2d/skeleton_2d.cpp20
-rw-r--r--scene/2d/skeleton_2d.h18
-rw-r--r--scene/3d/camera_3d.cpp42
-rw-r--r--scene/3d/camera_3d.h56
-rw-r--r--scene/3d/cpu_particles_3d.cpp176
-rw-r--r--scene/3d/cpu_particles_3d.h106
-rw-r--r--scene/3d/decal.cpp28
-rw-r--r--scene/3d/decal.h42
-rw-r--r--scene/3d/gpu_particles_3d.cpp12
-rw-r--r--scene/3d/gpu_particles_3d.h18
-rw-r--r--scene/3d/light_3d.cpp8
-rw-r--r--scene/3d/light_3d.h6
-rw-r--r--scene/3d/node_3d.cpp12
-rw-r--r--scene/3d/node_3d.h12
-rw-r--r--scene/3d/path_3d.cpp34
-rw-r--r--scene/3d/path_3d.h16
-rw-r--r--scene/3d/physics_body_3d.cpp4
-rw-r--r--scene/3d/proximity_group_3d.h2
-rw-r--r--scene/3d/skeleton_3d.cpp2
-rw-r--r--scene/3d/skeleton_3d.h4
-rw-r--r--scene/3d/skeleton_ik_3d.cpp2
-rw-r--r--scene/3d/sprite_3d.cpp14
-rw-r--r--scene/3d/sprite_3d.h8
-rw-r--r--scene/3d/velocity_tracker_3d.cpp12
-rw-r--r--scene/3d/voxelizer.cpp42
-rw-r--r--scene/3d/xr_nodes.cpp6
-rw-r--r--scene/3d/xr_nodes.h6
-rw-r--r--scene/animation/animation_blend_space_1d.cpp4
-rw-r--r--scene/animation/animation_blend_space_1d.h2
-rw-r--r--scene/animation/animation_blend_space_2d.cpp4
-rw-r--r--scene/animation/animation_blend_space_2d.h2
-rw-r--r--scene/animation/animation_blend_tree.cpp66
-rw-r--r--scene/animation/animation_blend_tree.h22
-rw-r--r--scene/animation/animation_node_state_machine.cpp4
-rw-r--r--scene/animation/animation_node_state_machine.h4
-rw-r--r--scene/animation/animation_player.cpp28
-rw-r--r--scene/animation/animation_player.h12
-rw-r--r--scene/animation/animation_tree.cpp66
-rw-r--r--scene/animation/animation_tree.h40
-rw-r--r--scene/animation/root_motion_view.h4
-rw-r--r--scene/gui/gradient_edit.cpp34
-rw-r--r--scene/gui/gradient_edit.h6
-rw-r--r--scene/gui/rich_text_effect.h6
-rw-r--r--scene/gui/rich_text_label.cpp4
-rw-r--r--scene/gui/rich_text_label.h4
-rw-r--r--scene/main/node.cpp11
-rw-r--r--scene/main/node.h5
-rw-r--r--scene/main/viewport.h2
-rw-r--r--scene/resources/animation.cpp238
-rw-r--r--scene/resources/animation.h114
-rw-r--r--scene/resources/curve.cpp8
-rw-r--r--scene/resources/curve.h4
-rw-r--r--scene/resources/default_theme/default_theme.cpp2
-rw-r--r--scene/resources/default_theme/theme_data.h4
-rw-r--r--scene/resources/height_map_shape_3d.cpp18
-rw-r--r--scene/resources/height_map_shape_3d.h6
-rw-r--r--scene/resources/mesh_data_tool.cpp4
-rw-r--r--scene/resources/polygon_path_finder.cpp8
-rw-r--r--scene/resources/resource_format_text.cpp12
-rw-r--r--scene/resources/sprite_frames.cpp4
-rw-r--r--scene/resources/sprite_frames.h6
-rw-r--r--scene/resources/visual_shader.cpp13
71 files changed, 819 insertions, 843 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp
index da2ab6ada8..026f0a85a6 100644
--- a/scene/2d/animated_sprite_2d.cpp
+++ b/scene/2d/animated_sprite_2d.cpp
@@ -159,12 +159,12 @@ void AnimatedSprite2D::_notification(int p_what) {
return;
}
- float speed = frames->get_animation_speed(animation) * speed_scale;
+ double speed = frames->get_animation_speed(animation) * speed_scale;
if (speed == 0) {
return; //do nothing
}
- float remaining = get_process_delta_time();
+ double remaining = get_process_delta_time();
while (remaining) {
if (timeout <= 0) {
@@ -205,7 +205,7 @@ void AnimatedSprite2D::_notification(int p_what) {
emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
- float to_process = MIN(timeout, remaining);
+ double to_process = MIN(timeout, remaining);
remaining -= to_process;
timeout -= to_process;
}
@@ -310,8 +310,8 @@ int AnimatedSprite2D::get_frame() const {
return frame;
}
-void AnimatedSprite2D::set_speed_scale(float p_speed_scale) {
- float elapsed = _get_frame_duration() - timeout;
+void AnimatedSprite2D::set_speed_scale(double p_speed_scale) {
+ double elapsed = _get_frame_duration() - timeout;
speed_scale = MAX(p_speed_scale, 0.0f);
@@ -320,7 +320,7 @@ void AnimatedSprite2D::set_speed_scale(float p_speed_scale) {
timeout -= elapsed;
}
-float AnimatedSprite2D::get_speed_scale() const {
+double AnimatedSprite2D::get_speed_scale() const {
return speed_scale;
}
@@ -402,9 +402,9 @@ bool AnimatedSprite2D::is_playing() const {
return playing;
}
-float AnimatedSprite2D::_get_frame_duration() {
+double AnimatedSprite2D::_get_frame_duration() {
if (frames.is_valid() && frames->has_animation(animation)) {
- float speed = frames->get_animation_speed(animation) * speed_scale;
+ double speed = frames->get_animation_speed(animation) * speed_scale;
if (speed > 0) {
return 1.0 / speed;
}
diff --git a/scene/2d/animated_sprite_2d.h b/scene/2d/animated_sprite_2d.h
index ef0027edf1..0769b19b50 100644
--- a/scene/2d/animated_sprite_2d.h
+++ b/scene/2d/animated_sprite_2d.h
@@ -56,7 +56,7 @@ class AnimatedSprite2D : public Node2D {
void _res_changed();
- float _get_frame_duration();
+ double _get_frame_duration();
void _reset_timeout();
void _set_playing(bool p_playing);
bool _is_playing() const;
@@ -94,8 +94,8 @@ public:
void set_frame(int p_frame);
int get_frame() const;
- void set_speed_scale(float p_speed_scale);
- float get_speed_scale() const;
+ void set_speed_scale(double p_speed_scale);
+ double get_speed_scale() const;
void set_centered(bool p_center);
bool is_centered() const;
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index a341ba69ac..ced1c5cb81 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -65,7 +65,7 @@ void CPUParticles2D::set_amount(int p_amount) {
particle_order.resize(p_amount);
}
-void CPUParticles2D::set_lifetime(float p_lifetime) {
+void CPUParticles2D::set_lifetime(double p_lifetime) {
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
lifetime = p_lifetime;
}
@@ -74,7 +74,7 @@ void CPUParticles2D::set_one_shot(bool p_one_shot) {
one_shot = p_one_shot;
}
-void CPUParticles2D::set_pre_process_time(float p_time) {
+void CPUParticles2D::set_pre_process_time(double p_time) {
pre_process_time = p_time;
}
@@ -86,7 +86,7 @@ void CPUParticles2D::set_randomness_ratio(real_t p_ratio) {
randomness_ratio = p_ratio;
}
-void CPUParticles2D::set_lifetime_randomness(float p_random) {
+void CPUParticles2D::set_lifetime_randomness(double p_random) {
lifetime_randomness = p_random;
}
@@ -95,7 +95,7 @@ void CPUParticles2D::set_use_local_coordinates(bool p_enable) {
set_notify_transform(!p_enable);
}
-void CPUParticles2D::set_speed_scale(real_t p_scale) {
+void CPUParticles2D::set_speed_scale(double p_scale) {
speed_scale = p_scale;
}
@@ -107,7 +107,7 @@ int CPUParticles2D::get_amount() const {
return particles.size();
}
-float CPUParticles2D::get_lifetime() const {
+double CPUParticles2D::get_lifetime() const {
return lifetime;
}
@@ -115,7 +115,7 @@ bool CPUParticles2D::get_one_shot() const {
return one_shot;
}
-float CPUParticles2D::get_pre_process_time() const {
+double CPUParticles2D::get_pre_process_time() const {
return pre_process_time;
}
@@ -127,7 +127,7 @@ real_t CPUParticles2D::get_randomness_ratio() const {
return randomness_ratio;
}
-float CPUParticles2D::get_lifetime_randomness() const {
+double CPUParticles2D::get_lifetime_randomness() const {
return lifetime_randomness;
}
@@ -135,7 +135,7 @@ bool CPUParticles2D::get_use_local_coordinates() const {
return local_coords;
}
-real_t CPUParticles2D::get_speed_scale() const {
+double CPUParticles2D::get_speed_scale() const {
return speed_scale;
}
@@ -516,7 +516,7 @@ void CPUParticles2D::_update_internal() {
return;
}
- float delta = get_process_delta_time();
+ double delta = get_process_delta_time();
if (emitting) {
inactive_time = 0;
} else {
@@ -536,14 +536,14 @@ void CPUParticles2D::_update_internal() {
_set_redraw(true);
if (time == 0 && pre_process_time > 0.0) {
- float frame_time;
+ double frame_time;
if (fixed_fps > 0) {
frame_time = 1.0 / fixed_fps;
} else {
frame_time = 1.0 / 30.0;
}
- float todo = pre_process_time;
+ double todo = pre_process_time;
while (todo >= 0) {
_particles_process(frame_time);
@@ -552,16 +552,16 @@ void CPUParticles2D::_update_internal() {
}
if (fixed_fps > 0) {
- float frame_time = 1.0 / fixed_fps;
- float decr = frame_time;
+ double frame_time = 1.0 / fixed_fps;
+ double decr = frame_time;
- float ldelta = delta;
+ double ldelta = delta;
if (ldelta > 0.1) { //avoid recursive stalls if fps goes below 10
ldelta = 0.1;
} else if (ldelta <= 0.0) { //unlikely but..
ldelta = 0.001;
}
- float todo = frame_remainder + ldelta;
+ double todo = frame_remainder + ldelta;
while (todo >= frame_time) {
_particles_process(frame_time);
@@ -577,7 +577,7 @@ void CPUParticles2D::_update_internal() {
_update_particle_data_buffer();
}
-void CPUParticles2D::_particles_process(float p_delta) {
+void CPUParticles2D::_particles_process(double p_delta) {
p_delta *= speed_scale;
int pcount = particles.size();
@@ -585,7 +585,7 @@ void CPUParticles2D::_particles_process(float p_delta) {
Particle *parray = w;
- float prev_time = time;
+ double prev_time = time;
time += p_delta;
if (time > lifetime) {
time = Math::fmod(time, lifetime);
@@ -604,7 +604,7 @@ void CPUParticles2D::_particles_process(float p_delta) {
velocity_xform[2] = Vector2();
}
- float system_phase = time / lifetime;
+ double system_phase = time / lifetime;
for (int i = 0; i < pcount; i++) {
Particle &p = parray[i];
@@ -613,12 +613,12 @@ void CPUParticles2D::_particles_process(float p_delta) {
continue;
}
- float local_delta = p_delta;
+ double local_delta = p_delta;
// The phase is a ratio between 0 (birth) and 1 (end of life) for each particle.
// While we use time in tests later on, for randomness we use the phase as done in the
// original shader code, and we later multiply by lifetime to get the time.
- real_t restart_phase = real_t(i) / real_t(pcount);
+ double restart_phase = double(i) / double(pcount);
if (randomness_ratio > 0.0) {
uint32_t seed = cycle;
@@ -627,12 +627,12 @@ void CPUParticles2D::_particles_process(float p_delta) {
}
seed *= uint32_t(pcount);
seed += uint32_t(i);
- real_t random = (idhash(seed) % uint32_t(65536)) / 65536.0;
- restart_phase += randomness_ratio * random * 1.0 / pcount;
+ double random = double(idhash(seed) % uint32_t(65536)) / 65536.0;
+ restart_phase += randomness_ratio * random * 1.0 / double(pcount);
}
restart_phase *= (1.0 - explosiveness_ratio);
- float restart_time = restart_phase * lifetime;
+ double restart_time = restart_phase * lifetime;
bool restart = false;
if (time > prev_time) {
@@ -874,7 +874,7 @@ void CPUParticles2D::_particles_process(float p_delta) {
tex_hue_variation = curve_parameters[PARAM_HUE_VARIATION]->interpolate(tv);
}
- real_t hue_rot_angle = (parameters[PARAM_HUE_VARIATION] + tex_hue_variation) * Math_TAU * Math::lerp(1.0f, p.hue_rot_rand * 2.0f - 1.0f, randomness[PARAM_HUE_VARIATION]);
+ real_t hue_rot_angle = (parameters[PARAM_HUE_VARIATION] + tex_hue_variation) * Math_TAU * Math::lerp(1, p.hue_rot_rand * 2.0f - 1.0f, randomness[PARAM_HUE_VARIATION]);
real_t hue_rot_c = Math::cos(hue_rot_angle);
real_t hue_rot_s = Math::sin(hue_rot_angle);
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index 92b8be77cf..1a1f35fca5 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -83,7 +83,7 @@ private:
struct Particle {
Transform2D transform;
Color color;
- float custom[4] = {};
+ real_t custom[4] = {};
real_t rotation = 0.0;
Vector2 velocity;
bool active = false;
@@ -91,16 +91,16 @@ private:
real_t scale_rand = 0.0;
real_t hue_rot_rand = 0.0;
real_t anim_offset_rand = 0.0;
- float time = 0.0;
- float lifetime = 0.0;
+ double time = 0.0;
+ double lifetime = 0.0;
Color base_color;
uint32_t seed = 0;
};
- float time = 0.0;
- float inactive_time = 0.0;
- float frame_remainder = 0.0;
+ double time = 0.0;
+ double inactive_time = 0.0;
+ double frame_remainder = 0.0;
int cycle = 0;
bool redraw = false;
@@ -131,12 +131,12 @@ private:
bool one_shot = false;
- float lifetime = 1.0;
- float pre_process_time = 0.0;
+ double lifetime = 1.0;
+ double pre_process_time = 0.0;
real_t explosiveness_ratio = 0.0;
real_t randomness_ratio = 0.0;
- real_t lifetime_randomness = 0.0;
- real_t speed_scale = 1.0;
+ double lifetime_randomness = 0.0;
+ double speed_scale = 1.0;
bool local_coords;
int fixed_fps = 0;
bool fractional_delta = true;
@@ -172,7 +172,7 @@ private:
Vector2 gravity = Vector2(0, 980);
void _update_internal();
- void _particles_process(float p_delta);
+ void _particles_process(double p_delta);
void _update_particle_data_buffer();
Mutex update_mutex;
@@ -193,27 +193,27 @@ protected:
public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
- void set_lifetime(float p_lifetime);
+ void set_lifetime(double p_lifetime);
void set_one_shot(bool p_one_shot);
- void set_pre_process_time(float p_time);
+ void set_pre_process_time(double p_time);
void set_explosiveness_ratio(real_t p_ratio);
void set_randomness_ratio(real_t p_ratio);
- void set_lifetime_randomness(float p_random);
+ void set_lifetime_randomness(double p_random);
void set_visibility_aabb(const Rect2 &p_aabb);
void set_use_local_coordinates(bool p_enable);
- void set_speed_scale(real_t p_scale);
+ void set_speed_scale(double p_scale);
bool is_emitting() const;
int get_amount() const;
- float get_lifetime() const;
+ double get_lifetime() const;
bool get_one_shot() const;
- float get_pre_process_time() const;
+ double get_pre_process_time() const;
real_t get_explosiveness_ratio() const;
real_t get_randomness_ratio() const;
- float get_lifetime_randomness() const;
+ double get_lifetime_randomness() const;
Rect2 get_visibility_aabb() const;
bool get_use_local_coordinates() const;
- real_t get_speed_scale() const;
+ double get_speed_scale() const;
void set_fixed_fps(int p_count);
int get_fixed_fps() const;
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index adfb94d574..4739d3dd46 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -54,7 +54,7 @@ void GPUParticles2D::set_amount(int p_amount) {
RS::get_singleton()->particles_set_amount(particles, amount);
}
-void GPUParticles2D::set_lifetime(float p_lifetime) {
+void GPUParticles2D::set_lifetime(double p_lifetime) {
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
lifetime = p_lifetime;
RS::get_singleton()->particles_set_lifetime(particles, lifetime);
@@ -76,7 +76,7 @@ void GPUParticles2D::set_one_shot(bool p_enable) {
}
}
-void GPUParticles2D::set_pre_process_time(float p_time) {
+void GPUParticles2D::set_pre_process_time(double p_time) {
pre_process_time = p_time;
RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
}
@@ -148,7 +148,8 @@ void GPUParticles2D::set_trail_enabled(bool p_enabled) {
RS::get_singleton()->particles_set_transform_align(particles, p_enabled ? RS::PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY : RS::PARTICLES_TRANSFORM_ALIGN_DISABLED);
}
-void GPUParticles2D::set_trail_length(float p_seconds) {
+
+void GPUParticles2D::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);
@@ -162,6 +163,7 @@ void GPUParticles2D::set_trail_sections(int p_sections) {
trail_sections = p_sections;
update();
}
+
void GPUParticles2D::set_trail_section_subdivisions(int p_subdivisions) {
ERR_FAIL_COND(trail_section_subdivisions < 1);
ERR_FAIL_COND(trail_section_subdivisions > 1024);
@@ -173,12 +175,13 @@ void GPUParticles2D::set_trail_section_subdivisions(int p_subdivisions) {
bool GPUParticles2D::is_trail_enabled() const {
return trail_enabled;
}
-float GPUParticles2D::get_trail_length() const {
+
+real_t GPUParticles2D::get_trail_length() const {
return trail_length;
}
void GPUParticles2D::_update_collision_size() {
- float csize = collision_base_size;
+ real_t csize = collision_base_size;
if (texture.is_valid()) {
csize *= (texture->get_width() + texture->get_height()) / 4.0; //half size since its a radius
@@ -187,16 +190,16 @@ void GPUParticles2D::_update_collision_size() {
RS::get_singleton()->particles_set_collision_base_size(particles, csize);
}
-void GPUParticles2D::set_collision_base_size(float p_size) {
+void GPUParticles2D::set_collision_base_size(real_t p_size) {
collision_base_size = p_size;
_update_collision_size();
}
-float GPUParticles2D::get_collision_base_size() const {
+real_t GPUParticles2D::get_collision_base_size() const {
return collision_base_size;
}
-void GPUParticles2D::set_speed_scale(float p_scale) {
+void GPUParticles2D::set_speed_scale(double p_scale) {
speed_scale = p_scale;
RS::get_singleton()->particles_set_speed_scale(particles, p_scale);
}
@@ -209,7 +212,7 @@ int GPUParticles2D::get_amount() const {
return amount;
}
-float GPUParticles2D::get_lifetime() const {
+double GPUParticles2D::get_lifetime() const {
return lifetime;
}
@@ -224,15 +227,15 @@ bool GPUParticles2D::get_one_shot() const {
return one_shot;
}
-float GPUParticles2D::get_pre_process_time() const {
+double GPUParticles2D::get_pre_process_time() const {
return pre_process_time;
}
-float GPUParticles2D::get_explosiveness_ratio() const {
+real_t GPUParticles2D::get_explosiveness_ratio() const {
return explosiveness_ratio;
}
-float GPUParticles2D::get_randomness_ratio() const {
+real_t GPUParticles2D::get_randomness_ratio() const {
return randomness_ratio;
}
@@ -248,7 +251,7 @@ Ref<Material> GPUParticles2D::get_process_material() const {
return process_material;
}
-float GPUParticles2D::get_speed_scale() const {
+double GPUParticles2D::get_speed_scale() const {
return speed_scale;
}
diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h
index 9d8e61daf7..a80e52d60c 100644
--- a/scene/2d/gpu_particles_2d.h
+++ b/scene/2d/gpu_particles_2d.h
@@ -51,11 +51,11 @@ private:
bool one_shot;
int amount;
- float lifetime;
- float pre_process_time;
+ double lifetime;
+ double pre_process_time;
float explosiveness_ratio;
float randomness_ratio;
- float speed_scale;
+ double speed_scale;
Rect2 visibility_rect;
bool local_coords;
int fixed_fps;
@@ -89,36 +89,36 @@ protected:
public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
- void set_lifetime(float p_lifetime);
+ void set_lifetime(double p_lifetime);
void set_one_shot(bool p_enable);
- void set_pre_process_time(float p_time);
+ void set_pre_process_time(double p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float 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);
- void set_speed_scale(float p_scale);
- void set_collision_base_size(float p_ratio);
+ void set_speed_scale(double p_scale);
+ 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);
void set_trail_sections(int p_sections);
void set_trail_section_subdivisions(int p_subdivisions);
bool is_emitting() const;
int get_amount() const;
- float get_lifetime() const;
+ double get_lifetime() const;
bool get_one_shot() const;
- float get_pre_process_time() const;
- float get_explosiveness_ratio() const;
- float get_randomness_ratio() const;
+ double get_pre_process_time() const;
+ real_t get_explosiveness_ratio() const;
+ real_t get_randomness_ratio() const;
Rect2 get_visibility_rect() const;
bool get_use_local_coordinates() const;
Ref<Material> get_process_material() const;
- float get_speed_scale() 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;
+ real_t get_trail_length() const;
int get_trail_sections() const;
int get_trail_section_subdivisions() const;
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index ea639ae3a3..58b20ccad0 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -455,7 +455,7 @@ void NavigationRegion2D::_notification(int p_what) {
// Draw the region
Transform2D xform = get_global_transform();
const NavigationServer2D *ns = NavigationServer2D::get_singleton();
- float radius = ns->map_get_edge_connection_margin(get_world_2d()->get_navigation_map()) / 2.0;
+ real_t radius = ns->map_get_edge_connection_margin(get_world_2d()->get_navigation_map()) / 2.0;
for (int i = 0; i < ns->region_get_connections_count(region); i++) {
// Two main points
Vector2 a = ns->region_get_connection_pathway_start(region, i);
@@ -465,7 +465,7 @@ void NavigationRegion2D::_notification(int p_what) {
draw_line(a, b, doors_color);
// Draw a circle to illustrate the margins.
- float angle = (b - a).angle();
+ real_t angle = (b - a).angle();
draw_arc(a, radius, angle + Math_PI / 2.0, angle - Math_PI / 2.0 + Math_TAU, 10, doors_color);
draw_arc(b, radius, angle - Math_PI / 2.0, angle + Math_PI / 2.0, 10, doors_color);
}
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index a382fb2f1e..00eeb60192 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1062,7 +1062,9 @@ void CharacterBody2D::move_and_slide() {
//this approach makes sure there is less delay between the actual body velocity and the one we saved
PhysicsDirectBodyState2D *bs = PhysicsServer2D::get_singleton()->body_get_direct_state(on_floor_body);
if (bs) {
- current_floor_velocity = bs->get_linear_velocity();
+ Transform2D gt = get_global_transform();
+ Vector2 local_position = gt.elements[2] - bs->get_transform().elements[2];
+ current_floor_velocity = bs->get_velocity_at_local_position(local_position);
}
}
diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp
index f6740040c1..602a0f2115 100644
--- a/scene/2d/ray_cast_2d.cpp
+++ b/scene/2d/ray_cast_2d.cpp
@@ -212,17 +212,17 @@ void RayCast2D::_update_raycast_state() {
void RayCast2D::_draw_debug_shape() {
Color draw_col = collided ? Color(1.0, 0.01, 0) : get_tree()->get_debug_collisions_color();
if (!enabled) {
- float g = draw_col.get_v();
+ const float g = draw_col.get_v();
draw_col.r = g;
draw_col.g = g;
draw_col.b = g;
}
// Draw an arrow indicating where the RayCast is pointing to
- const float max_arrow_size = 6;
- const float line_width = 1.4;
+ const real_t max_arrow_size = 6;
+ const real_t line_width = 1.4;
bool no_line = target_position.length() < line_width;
- float arrow_size = CLAMP(target_position.length() * 2 / 3, line_width, max_arrow_size);
+ real_t arrow_size = CLAMP(target_position.length() * 2 / 3, line_width, max_arrow_size);
if (no_line) {
arrow_size = target_position.length();
diff --git a/scene/2d/skeleton_2d.cpp b/scene/2d/skeleton_2d.cpp
index 15cbdf535e..85d632af00 100644
--- a/scene/2d/skeleton_2d.cpp
+++ b/scene/2d/skeleton_2d.cpp
@@ -45,7 +45,7 @@ bool Bone2D::_set(const StringName &p_path, const Variant &p_value) {
} else if (path.begins_with("length")) {
set_length(p_value);
} else if (path.begins_with("bone_angle")) {
- set_bone_angle(Math::deg2rad(float(p_value)));
+ set_bone_angle(Math::deg2rad(real_t(p_value)));
} else if (path.begins_with("default_length")) {
set_length(p_value);
}
@@ -330,7 +330,7 @@ bool Bone2D::_editor_get_bone_shape(Vector<Vector2> *p_shape, Vector<Vector2> *p
rel = (p_other_bone->get_global_transform().get_origin() - get_global_transform().get_origin());
rel = rel.rotated(-get_global_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation
} else {
- float angle_to_use = get_rotation() + bone_angle;
+ real_t angle_to_use = get_rotation() + bone_angle;
rel = Vector2(cos(angle_to_use), sin(angle_to_use)) * (length * MIN(get_global_scale().x, get_global_scale().y));
rel = rel.rotated(-get_rotation()); // Undo Bone2D node's rotation so its drawn correctly regardless of the node's rotation
}
@@ -414,12 +414,12 @@ void Bone2D::apply_rest() {
set_transform(rest);
}
-void Bone2D::set_default_length(float p_length) {
+void Bone2D::set_default_length(real_t p_length) {
WARN_DEPRECATED_MSG("set_default_length is deprecated. Please use set_length instead!");
set_length(p_length);
}
-float Bone2D::get_default_length() const {
+real_t Bone2D::get_default_length() const {
WARN_DEPRECATED_MSG("get_default_length is deprecated. Please use get_length instead!");
return get_length();
}
@@ -485,7 +485,7 @@ bool Bone2D::get_autocalculate_length_and_angle() const {
return autocalculate_length_and_angle;
}
-void Bone2D::set_length(float p_length) {
+void Bone2D::set_length(real_t p_length) {
length = p_length;
#ifdef TOOLS_ENABLED
@@ -493,11 +493,11 @@ void Bone2D::set_length(float p_length) {
#endif // TOOLS_ENABLED
}
-float Bone2D::get_length() const {
+real_t Bone2D::get_length() const {
return length;
}
-void Bone2D::set_bone_angle(float p_angle) {
+void Bone2D::set_bone_angle(real_t p_angle) {
bone_angle = p_angle;
#ifdef TOOLS_ENABLED
@@ -505,7 +505,7 @@ void Bone2D::set_bone_angle(float p_angle) {
#endif // TOOLS_ENABLED
}
-float Bone2D::get_bone_angle() const {
+real_t Bone2D::get_bone_angle() const {
return bone_angle;
}
@@ -690,7 +690,7 @@ RID Skeleton2D::get_skeleton() const {
return skeleton;
}
-void Skeleton2D::set_bone_local_pose_override(int p_bone_idx, Transform2D p_override, float p_amount, bool p_persistent) {
+void Skeleton2D::set_bone_local_pose_override(int p_bone_idx, Transform2D p_override, real_t p_amount, bool p_persistent) {
ERR_FAIL_INDEX_MSG(p_bone_idx, bones.size(), "Bone index is out of range!");
bones.write[p_bone_idx].local_pose_override = p_override;
bones.write[p_bone_idx].local_pose_override_amount = p_amount;
@@ -728,7 +728,7 @@ Ref<SkeletonModificationStack2D> Skeleton2D::get_modification_stack() const {
return modification_stack;
}
-void Skeleton2D::execute_modifications(float p_delta, int p_execution_mode) {
+void Skeleton2D::execute_modifications(real_t p_delta, int p_execution_mode) {
if (!modification_stack.is_valid()) {
return;
}
diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h
index 59bd711960..56fd0e8504 100644
--- a/scene/2d/skeleton_2d.h
+++ b/scene/2d/skeleton_2d.h
@@ -49,8 +49,8 @@ class Bone2D : public Node2D {
Transform2D rest;
bool autocalculate_length_and_angle = true;
- float length = 16;
- float bone_angle = 0;
+ real_t length = 16;
+ real_t bone_angle = 0;
int skeleton_index = -1;
@@ -85,10 +85,10 @@ public:
void set_autocalculate_length_and_angle(bool p_autocalculate);
bool get_autocalculate_length_and_angle() const;
- void set_length(float p_length);
- float get_length() const;
- void set_bone_angle(float p_angle);
- float get_bone_angle() const;
+ void set_length(real_t p_length);
+ real_t get_length() const;
+ void set_bone_angle(real_t p_angle);
+ real_t get_bone_angle() const;
int get_index_in_skeleton() const;
@@ -122,7 +122,7 @@ class Skeleton2D : public Node2D {
//Transform2D local_pose_cache;
Transform2D local_pose_override;
- float local_pose_override_amount = 0;
+ real_t local_pose_override_amount = 0;
bool local_pose_override_persistent = false;
};
@@ -153,12 +153,12 @@ public:
RID get_skeleton() const;
- void set_bone_local_pose_override(int p_bone_idx, Transform2D p_override, float p_amount, bool p_persistent = true);
+ void set_bone_local_pose_override(int p_bone_idx, Transform2D p_override, real_t p_amount, bool p_persistent = true);
Transform2D get_bone_local_pose_override(int p_bone_idx);
Ref<SkeletonModificationStack2D> get_modification_stack() const;
void set_modification_stack(Ref<SkeletonModificationStack2D> p_stack);
- void execute_modifications(float p_delta, int p_execution_mode);
+ void execute_modifications(real_t p_delta, int p_execution_mode);
Skeleton2D();
~Skeleton2D();
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp
index 2e962b96c3..e504277a55 100644
--- a/scene/3d/camera_3d.cpp
+++ b/scene/3d/camera_3d.cpp
@@ -153,7 +153,7 @@ Transform3D Camera3D::get_camera_transform() const {
return tr;
}
-void Camera3D::set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far) {
+void Camera3D::set_perspective(real_t p_fovy_degrees, real_t p_z_near, real_t p_z_far) {
if (!force_change && fov == p_fovy_degrees && p_z_near == near && p_z_far == far && mode == PROJECTION_PERSPECTIVE) {
return;
}
@@ -168,7 +168,7 @@ void Camera3D::set_perspective(float p_fovy_degrees, float p_z_near, float p_z_f
force_change = false;
}
-void Camera3D::set_orthogonal(float p_size, float p_z_near, float p_z_far) {
+void Camera3D::set_orthogonal(real_t p_size, real_t p_z_near, real_t p_z_far) {
if (!force_change && size == p_size && p_z_near == near && p_z_far == far && mode == PROJECTION_ORTHOGONAL) {
return;
}
@@ -184,7 +184,7 @@ void Camera3D::set_orthogonal(float p_size, float p_z_near, float p_z_far) {
update_gizmos();
}
-void Camera3D::set_frustum(float p_size, Vector2 p_offset, float p_z_near, float p_z_far) {
+void Camera3D::set_frustum(real_t p_size, Vector2 p_offset, real_t p_z_near, real_t p_z_far) {
if (!force_change && size == p_size && frustum_offset == p_offset && p_z_near == near && p_z_far == far && mode == PROJECTION_FRUSTUM) {
return;
}
@@ -295,7 +295,7 @@ Vector3 Camera3D::project_ray_origin(const Point2 &p_pos) const {
return get_camera_transform().origin;
} else {
Vector2 pos = cpos / viewport_size;
- float vsize, hsize;
+ real_t vsize, hsize;
if (keep_aspect == KEEP_WIDTH) {
vsize = size / viewport_size.aspect();
hsize = size;
@@ -368,7 +368,7 @@ Point2 Camera3D::unproject_position(const Vector3 &p_pos) const {
return res;
}
-Vector3 Camera3D::project_position(const Point2 &p_point, float p_z_depth) const {
+Vector3 Camera3D::project_position(const Point2 &p_point, real_t p_z_depth) const {
ERR_FAIL_COND_V_MSG(!is_inside_tree(), Vector3(), "Camera is not inside scene.");
if (p_z_depth == 0 && mode != PROJECTION_ORTHOGONAL) {
@@ -531,15 +531,15 @@ void Camera3D::_bind_methods() {
BIND_ENUM_CONSTANT(DOPPLER_TRACKING_PHYSICS_STEP);
}
-float Camera3D::get_fov() const {
+real_t Camera3D::get_fov() const {
return fov;
}
-float Camera3D::get_size() const {
+real_t Camera3D::get_size() const {
return size;
}
-float Camera3D::get_near() const {
+real_t Camera3D::get_near() const {
return near;
}
@@ -547,7 +547,7 @@ Vector2 Camera3D::get_frustum_offset() const {
return frustum_offset;
}
-float Camera3D::get_far() const {
+real_t Camera3D::get_far() const {
return far;
}
@@ -555,19 +555,19 @@ Camera3D::Projection Camera3D::get_projection() const {
return mode;
}
-void Camera3D::set_fov(float p_fov) {
+void Camera3D::set_fov(real_t p_fov) {
ERR_FAIL_COND(p_fov < 1 || p_fov > 179);
fov = p_fov;
_update_camera_mode();
}
-void Camera3D::set_size(float p_size) {
+void Camera3D::set_size(real_t p_size) {
ERR_FAIL_COND(p_size < 0.1 || p_size > 16384);
size = p_size;
_update_camera_mode();
}
-void Camera3D::set_near(float p_near) {
+void Camera3D::set_near(real_t p_near) {
near = p_near;
_update_camera_mode();
}
@@ -577,7 +577,7 @@ void Camera3D::set_frustum_offset(Vector2 p_offset) {
_update_camera_mode();
}
-void Camera3D::set_far(float p_far) {
+void Camera3D::set_far(real_t p_far) {
far = p_far;
_update_camera_mode();
}
@@ -630,21 +630,21 @@ bool Camera3D::is_position_in_frustum(const Vector3 &p_position) const {
return true;
}
-void Camera3D::set_v_offset(float p_offset) {
+void Camera3D::set_v_offset(real_t p_offset) {
v_offset = p_offset;
_update_camera();
}
-float Camera3D::get_v_offset() const {
+real_t Camera3D::get_v_offset() const {
return v_offset;
}
-void Camera3D::set_h_offset(float p_offset) {
+void Camera3D::set_h_offset(real_t p_offset) {
h_offset = p_offset;
_update_camera();
}
-float Camera3D::get_h_offset() const {
+real_t Camera3D::get_h_offset() const {
return h_offset;
}
@@ -672,11 +672,11 @@ Camera3D::~Camera3D() {
////////////////////////////////////////
-void ClippedCamera3D::set_margin(float p_margin) {
+void ClippedCamera3D::set_margin(real_t p_margin) {
margin = p_margin;
}
-float ClippedCamera3D::get_margin() const {
+real_t ClippedCamera3D::get_margin() const {
return margin;
}
@@ -746,7 +746,7 @@ void ClippedCamera3D::_notification(int p_what) {
xf.origin = ray_from;
xf.orthonormalize();
- float closest_safe = 1.0f, closest_unsafe = 1.0f;
+ real_t closest_safe = 1.0f, closest_unsafe = 1.0f;
if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, closest_safe, closest_unsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) {
clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * closest_safe);
}
@@ -813,7 +813,7 @@ void ClippedCamera3D::clear_exceptions() {
exclude.clear();
}
-float ClippedCamera3D::get_clip_offset() const {
+real_t ClippedCamera3D::get_clip_offset() const {
return clip_offset;
}
diff --git a/scene/3d/camera_3d.h b/scene/3d/camera_3d.h
index c6efc8f9a9..61e3f51d0b 100644
--- a/scene/3d/camera_3d.h
+++ b/scene/3d/camera_3d.h
@@ -63,13 +63,13 @@ private:
Projection mode = PROJECTION_PERSPECTIVE;
- float fov = 0.0;
- float size = 1.0;
+ real_t fov = 0.0;
+ real_t size = 1.0;
Vector2 frustum_offset;
- float near = 0.0;
- float far = 0.0;
- float v_offset = 0.0;
- float h_offset = 0.0;
+ real_t near = 0.0;
+ real_t far = 0.0;
+ real_t v_offset = 0.0;
+ real_t h_offset = 0.0;
KeepAspect keep_aspect = KEEP_HEIGHT;
RID camera;
@@ -107,10 +107,9 @@ public:
NOTIFICATION_LOST_CURRENT = 51
};
- void set_perspective(float p_fovy_degrees, float p_z_near, float p_z_far);
- void set_orthogonal(float p_size, float p_z_near, float p_z_far);
- void set_frustum(float p_size, Vector2 p_offset, float p_z_near,
- float p_z_far);
+ void set_perspective(real_t p_fovy_degrees, real_t p_z_near, real_t p_z_far);
+ void set_orthogonal(real_t p_size, real_t p_z_near, real_t p_z_far);
+ void set_frustum(real_t p_size, Vector2 p_offset, real_t p_z_near, real_t p_z_far);
void set_projection(Camera3D::Projection p_mode);
void make_current();
@@ -120,18 +119,18 @@ public:
RID get_camera() const;
- float get_fov() const;
- float get_size() const;
- float get_far() const;
- float get_near() const;
+ real_t get_fov() const;
+ real_t get_size() const;
+ real_t get_far() const;
+ real_t get_near() const;
Vector2 get_frustum_offset() const;
Projection get_projection() const;
- void set_fov(float p_fov);
- void set_size(float p_size);
- void set_far(float p_far);
- void set_near(float p_near);
+ void set_fov(real_t p_fov);
+ void set_size(real_t p_size);
+ void set_far(real_t p_far);
+ void set_near(real_t p_near);
void set_frustum_offset(Vector2 p_offset);
virtual Transform3D get_camera_transform() const;
@@ -141,8 +140,7 @@ public:
virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const;
virtual Point2 unproject_position(const Vector3 &p_pos) const;
bool is_position_behind(const Vector3 &p_pos) const;
- virtual Vector3 project_position(const Point2 &p_point,
- float p_z_depth) const;
+ virtual Vector3 project_position(const Point2 &p_point, real_t p_z_depth) const;
Vector<Vector3> get_near_plane_points() const;
@@ -164,11 +162,11 @@ public:
void set_keep_aspect_mode(KeepAspect p_aspect);
KeepAspect get_keep_aspect_mode() const;
- void set_v_offset(float p_offset);
- float get_v_offset() const;
+ void set_v_offset(real_t p_offset);
+ real_t get_v_offset() const;
- void set_h_offset(float p_offset);
- float get_h_offset() const;
+ void set_h_offset(real_t p_offset);
+ real_t get_h_offset() const;
void set_doppler_tracking(DopplerTracking p_tracking);
DopplerTracking get_doppler_tracking() const;
@@ -195,8 +193,8 @@ public:
private:
ClipProcessCallback process_callback = CLIP_PROCESS_PHYSICS;
RID pyramid_shape;
- float margin = 0.0;
- float clip_offset = 0.0;
+ real_t margin = 0.0;
+ real_t clip_offset = 0.0;
uint32_t collision_mask = 1;
bool clip_to_areas = false;
bool clip_to_bodies = true;
@@ -217,8 +215,8 @@ public:
void set_clip_to_bodies(bool p_clip);
bool is_clip_to_bodies_enabled() const;
- void set_margin(float p_margin);
- float get_margin() const;
+ void set_margin(real_t p_margin);
+ real_t get_margin() const;
void set_process_callback(ClipProcessCallback p_mode);
ClipProcessCallback get_process_callback() const;
@@ -235,7 +233,7 @@ public:
void remove_exception(const Object *p_object);
void clear_exceptions();
- float get_clip_offset() const;
+ real_t get_clip_offset() const;
ClippedCamera3D();
~ClippedCamera3D();
diff --git a/scene/3d/cpu_particles_3d.cpp b/scene/3d/cpu_particles_3d.cpp
index 60f8ad8f36..2377c618aa 100644
--- a/scene/3d/cpu_particles_3d.cpp
+++ b/scene/3d/cpu_particles_3d.cpp
@@ -78,7 +78,7 @@ void CPUParticles3D::set_amount(int p_amount) {
particle_order.resize(p_amount);
}
-void CPUParticles3D::set_lifetime(float p_lifetime) {
+void CPUParticles3D::set_lifetime(double p_lifetime) {
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
lifetime = p_lifetime;
}
@@ -87,19 +87,19 @@ void CPUParticles3D::set_one_shot(bool p_one_shot) {
one_shot = p_one_shot;
}
-void CPUParticles3D::set_pre_process_time(float p_time) {
+void CPUParticles3D::set_pre_process_time(double p_time) {
pre_process_time = p_time;
}
-void CPUParticles3D::set_explosiveness_ratio(float p_ratio) {
+void CPUParticles3D::set_explosiveness_ratio(real_t p_ratio) {
explosiveness_ratio = p_ratio;
}
-void CPUParticles3D::set_randomness_ratio(float p_ratio) {
+void CPUParticles3D::set_randomness_ratio(real_t p_ratio) {
randomness_ratio = p_ratio;
}
-void CPUParticles3D::set_lifetime_randomness(float p_random) {
+void CPUParticles3D::set_lifetime_randomness(double p_random) {
lifetime_randomness = p_random;
}
@@ -107,7 +107,7 @@ void CPUParticles3D::set_use_local_coordinates(bool p_enable) {
local_coords = p_enable;
}
-void CPUParticles3D::set_speed_scale(float p_scale) {
+void CPUParticles3D::set_speed_scale(double p_scale) {
speed_scale = p_scale;
}
@@ -119,7 +119,7 @@ int CPUParticles3D::get_amount() const {
return particles.size();
}
-float CPUParticles3D::get_lifetime() const {
+double CPUParticles3D::get_lifetime() const {
return lifetime;
}
@@ -127,19 +127,19 @@ bool CPUParticles3D::get_one_shot() const {
return one_shot;
}
-float CPUParticles3D::get_pre_process_time() const {
+double CPUParticles3D::get_pre_process_time() const {
return pre_process_time;
}
-float CPUParticles3D::get_explosiveness_ratio() const {
+real_t CPUParticles3D::get_explosiveness_ratio() const {
return explosiveness_ratio;
}
-float CPUParticles3D::get_randomness_ratio() const {
+real_t CPUParticles3D::get_randomness_ratio() const {
return randomness_ratio;
}
-float CPUParticles3D::get_lifetime_randomness() const {
+double CPUParticles3D::get_lifetime_randomness() const {
return lifetime_randomness;
}
@@ -147,7 +147,7 @@ bool CPUParticles3D::get_use_local_coordinates() const {
return local_coords;
}
-float CPUParticles3D::get_speed_scale() const {
+double CPUParticles3D::get_speed_scale() const {
return speed_scale;
}
@@ -247,47 +247,47 @@ Vector3 CPUParticles3D::get_direction() const {
return direction;
}
-void CPUParticles3D::set_spread(float p_spread) {
+void CPUParticles3D::set_spread(real_t p_spread) {
spread = p_spread;
}
-float CPUParticles3D::get_spread() const {
+real_t CPUParticles3D::get_spread() const {
return spread;
}
-void CPUParticles3D::set_flatness(float p_flatness) {
+void CPUParticles3D::set_flatness(real_t p_flatness) {
flatness = p_flatness;
}
-float CPUParticles3D::get_flatness() const {
+real_t CPUParticles3D::get_flatness() const {
return flatness;
}
-void CPUParticles3D::set_param(Parameter p_param, float p_value) {
+void CPUParticles3D::set_param(Parameter p_param, real_t p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
parameters[p_param] = p_value;
}
-float CPUParticles3D::get_param(Parameter p_param) const {
+real_t CPUParticles3D::get_param(Parameter p_param) const {
ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0);
return parameters[p_param];
}
-void CPUParticles3D::set_param_randomness(Parameter p_param, float p_value) {
+void CPUParticles3D::set_param_randomness(Parameter p_param, real_t p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
randomness[p_param] = p_value;
}
-float CPUParticles3D::get_param_randomness(Parameter p_param) const {
+real_t CPUParticles3D::get_param_randomness(Parameter p_param) const {
ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0);
return randomness[p_param];
}
-static void _adjust_curve_range(const Ref<Curve> &p_curve, float p_min, float p_max) {
+static void _adjust_curve_range(const Ref<Curve> &p_curve, real_t p_min, real_t p_max) {
Ref<Curve> curve = p_curve;
if (!curve.is_valid()) {
return;
@@ -381,7 +381,7 @@ void CPUParticles3D::set_emission_shape(EmissionShape p_shape) {
emission_shape = p_shape;
}
-void CPUParticles3D::set_emission_sphere_radius(float p_radius) {
+void CPUParticles3D::set_emission_sphere_radius(real_t p_radius) {
emission_sphere_radius = p_radius;
}
@@ -405,19 +405,19 @@ void CPUParticles3D::set_emission_ring_axis(Vector3 p_axis) {
emission_ring_axis = p_axis;
}
-void CPUParticles3D::set_emission_ring_height(float p_height) {
+void CPUParticles3D::set_emission_ring_height(real_t p_height) {
emission_ring_height = p_height;
}
-void CPUParticles3D::set_emission_ring_radius(float p_radius) {
+void CPUParticles3D::set_emission_ring_radius(real_t p_radius) {
emission_ring_radius = p_radius;
}
-void CPUParticles3D::set_emission_ring_inner_radius(float p_radius) {
+void CPUParticles3D::set_emission_ring_inner_radius(real_t p_radius) {
emission_ring_inner_radius = p_radius;
}
-float CPUParticles3D::get_emission_sphere_radius() const {
+real_t CPUParticles3D::get_emission_sphere_radius() const {
return emission_sphere_radius;
}
@@ -441,15 +441,15 @@ Vector3 CPUParticles3D::get_emission_ring_axis() const {
return emission_ring_axis;
}
-float CPUParticles3D::get_emission_ring_height() const {
+real_t CPUParticles3D::get_emission_ring_height() const {
return emission_ring_height;
}
-float CPUParticles3D::get_emission_ring_radius() const {
+real_t CPUParticles3D::get_emission_ring_radius() const {
return emission_ring_radius;
}
-float CPUParticles3D::get_emission_ring_inner_radius() const {
+real_t CPUParticles3D::get_emission_ring_inner_radius() const {
return emission_ring_inner_radius;
}
@@ -498,7 +498,7 @@ static uint32_t idhash(uint32_t x) {
return x;
}
-static float rand_from_seed(uint32_t &seed) {
+static real_t rand_from_seed(uint32_t &seed) {
int k;
int s = int(seed);
if (s == 0) {
@@ -510,7 +510,7 @@ static float rand_from_seed(uint32_t &seed) {
s += 2147483647;
}
seed = uint32_t(s);
- return float(seed % uint32_t(65536)) / 65535.0;
+ return (seed % uint32_t(65536)) / 65535.0;
}
void CPUParticles3D::_update_internal() {
@@ -519,7 +519,7 @@ void CPUParticles3D::_update_internal() {
return;
}
- float delta = get_process_delta_time();
+ double delta = get_process_delta_time();
if (emitting) {
inactive_time = 0;
} else {
@@ -541,14 +541,14 @@ void CPUParticles3D::_update_internal() {
bool processed = false;
if (time == 0 && pre_process_time > 0.0) {
- float frame_time;
+ double frame_time;
if (fixed_fps > 0) {
frame_time = 1.0 / fixed_fps;
} else {
frame_time = 1.0 / 30.0;
}
- float todo = pre_process_time;
+ double todo = pre_process_time;
while (todo >= 0) {
_particles_process(frame_time);
@@ -558,16 +558,16 @@ void CPUParticles3D::_update_internal() {
}
if (fixed_fps > 0) {
- float frame_time = 1.0 / fixed_fps;
- float decr = frame_time;
+ double frame_time = 1.0 / fixed_fps;
+ double decr = frame_time;
- float ldelta = delta;
+ double ldelta = delta;
if (ldelta > 0.1) { //avoid recursive stalls if fps goes below 10
ldelta = 0.1;
} else if (ldelta <= 0.0) { //unlikely but..
ldelta = 0.001;
}
- float todo = frame_remainder + ldelta;
+ double todo = frame_remainder + ldelta;
while (todo >= frame_time) {
_particles_process(frame_time);
@@ -587,7 +587,7 @@ void CPUParticles3D::_update_internal() {
}
}
-void CPUParticles3D::_particles_process(float p_delta) {
+void CPUParticles3D::_particles_process(double p_delta) {
p_delta *= speed_scale;
int pcount = particles.size();
@@ -595,7 +595,7 @@ void CPUParticles3D::_particles_process(float p_delta) {
Particle *parray = w;
- float prev_time = time;
+ double prev_time = time;
time += p_delta;
if (time > lifetime) {
time = Math::fmod(time, lifetime);
@@ -613,7 +613,7 @@ void CPUParticles3D::_particles_process(float p_delta) {
velocity_xform = emission_xform.basis;
}
- float system_phase = time / lifetime;
+ double system_phase = time / lifetime;
for (int i = 0; i < pcount; i++) {
Particle &p = parray[i];
@@ -622,12 +622,12 @@ void CPUParticles3D::_particles_process(float p_delta) {
continue;
}
- float local_delta = p_delta;
+ double local_delta = p_delta;
// The phase is a ratio between 0 (birth) and 1 (end of life) for each particle.
// While we use time in tests later on, for randomness we use the phase as done in the
// original shader code, and we later multiply by lifetime to get the time.
- float restart_phase = float(i) / float(pcount);
+ double restart_phase = double(i) / double(pcount);
if (randomness_ratio > 0.0) {
uint32_t seed = cycle;
@@ -636,12 +636,12 @@ void CPUParticles3D::_particles_process(float p_delta) {
}
seed *= uint32_t(pcount);
seed += uint32_t(i);
- float random = float(idhash(seed) % uint32_t(65536)) / 65536.0;
- restart_phase += randomness_ratio * random * 1.0 / float(pcount);
+ double random = double(idhash(seed) % uint32_t(65536)) / 65536.0;
+ restart_phase += randomness_ratio * random * 1.0 / double(pcount);
}
restart_phase *= (1.0 - explosiveness_ratio);
- float restart_time = restart_phase * lifetime;
+ double restart_time = restart_phase * lifetime;
bool restart = false;
if (time > prev_time) {
@@ -682,17 +682,17 @@ void CPUParticles3D::_particles_process(float p_delta) {
}
p.active = true;
- /*float tex_linear_velocity = 0;
+ /*real_t tex_linear_velocity = 0;
if (curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) {
tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->interpolate(0);
}*/
- float tex_angle = 0.0;
+ real_t tex_angle = 0.0;
if (curve_parameters[PARAM_ANGLE].is_valid()) {
tex_angle = curve_parameters[PARAM_ANGLE]->interpolate(tv);
}
- float tex_anim_offset = 0.0;
+ real_t tex_anim_offset = 0.0;
if (curve_parameters[PARAM_ANGLE].is_valid()) {
tex_anim_offset = curve_parameters[PARAM_ANGLE]->interpolate(tv);
}
@@ -705,26 +705,26 @@ void CPUParticles3D::_particles_process(float p_delta) {
p.anim_offset_rand = Math::randf();
if (particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
- float angle1_rad = Math::atan2(direction.y, direction.x) + Math::deg2rad((Math::randf() * 2.0 - 1.0) * spread);
+ real_t angle1_rad = Math::atan2(direction.y, direction.x) + Math::deg2rad((Math::randf() * 2.0 - 1.0) * spread);
Vector3 rot = Vector3(Math::cos(angle1_rad), Math::sin(angle1_rad), 0.0);
- p.velocity = rot * parameters[PARAM_INITIAL_LINEAR_VELOCITY] * Math::lerp(1.0f, float(Math::randf()), randomness[PARAM_INITIAL_LINEAR_VELOCITY]);
+ p.velocity = rot * parameters[PARAM_INITIAL_LINEAR_VELOCITY] * Math::lerp((real_t)1.0, real_t(Math::randf()), randomness[PARAM_INITIAL_LINEAR_VELOCITY]);
} else {
//initiate velocity spread in 3D
- float angle1_rad = Math::atan2(direction.x, direction.z) + Math::deg2rad((Math::randf() * 2.0 - 1.0) * spread);
- float angle2_rad = Math::atan2(direction.y, Math::abs(direction.z)) + Math::deg2rad((Math::randf() * 2.0 - 1.0) * (1.0 - flatness) * spread);
+ real_t angle1_rad = Math::atan2(direction.x, direction.z) + Math::deg2rad((Math::randf() * 2.0 - 1.0) * spread);
+ real_t angle2_rad = Math::atan2(direction.y, Math::abs(direction.z)) + Math::deg2rad((Math::randf() * 2.0 - 1.0) * (1.0 - flatness) * spread);
Vector3 direction_xz = Vector3(Math::sin(angle1_rad), 0, Math::cos(angle1_rad));
Vector3 direction_yz = Vector3(0, Math::sin(angle2_rad), Math::cos(angle2_rad));
direction_yz.z = direction_yz.z / MAX(0.0001, Math::sqrt(ABS(direction_yz.z))); //better uniform distribution
Vector3 direction = Vector3(direction_xz.x * direction_yz.z, direction_yz.y, direction_xz.z * direction_yz.z);
direction.normalize();
- p.velocity = direction * parameters[PARAM_INITIAL_LINEAR_VELOCITY] * Math::lerp(1.0f, float(Math::randf()), randomness[PARAM_INITIAL_LINEAR_VELOCITY]);
+ p.velocity = direction * parameters[PARAM_INITIAL_LINEAR_VELOCITY] * Math::lerp((real_t)1.0, real_t(Math::randf()), randomness[PARAM_INITIAL_LINEAR_VELOCITY]);
}
- float base_angle = (parameters[PARAM_ANGLE] + tex_angle) * Math::lerp(1.0f, p.angle_rand, randomness[PARAM_ANGLE]);
+ real_t base_angle = (parameters[PARAM_ANGLE] + tex_angle) * Math::lerp((real_t)1.0, p.angle_rand, randomness[PARAM_ANGLE]);
p.custom[0] = Math::deg2rad(base_angle); //angle
p.custom[1] = 0.0; //phase
- p.custom[2] = (parameters[PARAM_ANIM_OFFSET] + tex_anim_offset) * Math::lerp(1.0f, p.anim_offset_rand, randomness[PARAM_ANIM_OFFSET]); //animation offset (0-1)
+ p.custom[2] = (parameters[PARAM_ANIM_OFFSET] + tex_anim_offset) * Math::lerp((real_t)1.0, p.anim_offset_rand, randomness[PARAM_ANIM_OFFSET]); //animation offset (0-1)
p.transform = Transform3D();
p.time = 0;
p.lifetime = lifetime * (1.0 - Math::randf() * lifetime_randomness);
@@ -783,8 +783,8 @@ void CPUParticles3D::_particles_process(float p_delta) {
}
} break;
case EMISSION_SHAPE_RING: {
- float ring_random_angle = Math::randf() * 2.0 * Math_PI;
- float ring_random_radius = Math::randf() * (emission_ring_radius - emission_ring_inner_radius) + emission_ring_inner_radius;
+ real_t ring_random_angle = Math::randf() * Math_TAU;
+ real_t ring_random_radius = Math::randf() * (emission_ring_radius - emission_ring_inner_radius) + emission_ring_inner_radius;
Vector3 axis = emission_ring_axis.normalized();
Vector3 ortho_axis = Vector3();
if (axis == Vector3(1.0, 0.0, 0.0)) {
@@ -824,53 +824,53 @@ void CPUParticles3D::_particles_process(float p_delta) {
p.custom[1] = p.time / lifetime;
tv = p.time / p.lifetime;
- float tex_linear_velocity = 0.0;
+ real_t tex_linear_velocity = 0.0;
if (curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) {
tex_linear_velocity = curve_parameters[PARAM_INITIAL_LINEAR_VELOCITY]->interpolate(tv);
}
- float tex_orbit_velocity = 0.0;
+ real_t tex_orbit_velocity = 0.0;
if (particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
if (curve_parameters[PARAM_ORBIT_VELOCITY].is_valid()) {
tex_orbit_velocity = curve_parameters[PARAM_ORBIT_VELOCITY]->interpolate(tv);
}
}
- float tex_angular_velocity = 0.0;
+ real_t tex_angular_velocity = 0.0;
if (curve_parameters[PARAM_ANGULAR_VELOCITY].is_valid()) {
tex_angular_velocity = curve_parameters[PARAM_ANGULAR_VELOCITY]->interpolate(tv);
}
- float tex_linear_accel = 0.0;
+ real_t tex_linear_accel = 0.0;
if (curve_parameters[PARAM_LINEAR_ACCEL].is_valid()) {
tex_linear_accel = curve_parameters[PARAM_LINEAR_ACCEL]->interpolate(tv);
}
- float tex_tangential_accel = 0.0;
+ real_t tex_tangential_accel = 0.0;
if (curve_parameters[PARAM_TANGENTIAL_ACCEL].is_valid()) {
tex_tangential_accel = curve_parameters[PARAM_TANGENTIAL_ACCEL]->interpolate(tv);
}
- float tex_radial_accel = 0.0;
+ real_t tex_radial_accel = 0.0;
if (curve_parameters[PARAM_RADIAL_ACCEL].is_valid()) {
tex_radial_accel = curve_parameters[PARAM_RADIAL_ACCEL]->interpolate(tv);
}
- float tex_damping = 0.0;
+ real_t tex_damping = 0.0;
if (curve_parameters[PARAM_DAMPING].is_valid()) {
tex_damping = curve_parameters[PARAM_DAMPING]->interpolate(tv);
}
- float tex_angle = 0.0;
+ real_t tex_angle = 0.0;
if (curve_parameters[PARAM_ANGLE].is_valid()) {
tex_angle = curve_parameters[PARAM_ANGLE]->interpolate(tv);
}
- float tex_anim_speed = 0.0;
+ real_t tex_anim_speed = 0.0;
if (curve_parameters[PARAM_ANIM_SPEED].is_valid()) {
tex_anim_speed = curve_parameters[PARAM_ANIM_SPEED]->interpolate(tv);
}
- float tex_anim_offset = 0.0;
+ real_t tex_anim_offset = 0.0;
if (curve_parameters[PARAM_ANIM_OFFSET].is_valid()) {
tex_anim_offset = curve_parameters[PARAM_ANIM_OFFSET]->interpolate(tv);
}
@@ -881,28 +881,28 @@ void CPUParticles3D::_particles_process(float p_delta) {
position.z = 0.0;
}
//apply linear acceleration
- force += p.velocity.length() > 0.0 ? p.velocity.normalized() * (parameters[PARAM_LINEAR_ACCEL] + tex_linear_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_LINEAR_ACCEL]) : Vector3();
+ force += p.velocity.length() > 0.0 ? p.velocity.normalized() * (parameters[PARAM_LINEAR_ACCEL] + tex_linear_accel) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed), randomness[PARAM_LINEAR_ACCEL]) : Vector3();
//apply radial acceleration
Vector3 org = emission_xform.origin;
Vector3 diff = position - org;
- force += diff.length() > 0.0 ? diff.normalized() * (parameters[PARAM_RADIAL_ACCEL] + tex_radial_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_RADIAL_ACCEL]) : Vector3();
+ force += diff.length() > 0.0 ? diff.normalized() * (parameters[PARAM_RADIAL_ACCEL] + tex_radial_accel) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed), randomness[PARAM_RADIAL_ACCEL]) : Vector3();
//apply tangential acceleration;
if (particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
Vector2 yx = Vector2(diff.y, diff.x);
Vector2 yx2 = (yx * Vector2(-1.0, 1.0)).normalized();
- force += yx.length() > 0.0 ? Vector3(yx2.x, yx2.y, 0.0) * ((parameters[PARAM_TANGENTIAL_ACCEL] + tex_tangential_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_TANGENTIAL_ACCEL])) : Vector3();
+ force += yx.length() > 0.0 ? Vector3(yx2.x, yx2.y, 0.0) * ((parameters[PARAM_TANGENTIAL_ACCEL] + tex_tangential_accel) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed), randomness[PARAM_TANGENTIAL_ACCEL])) : Vector3();
} else {
Vector3 crossDiff = diff.normalized().cross(gravity.normalized());
- force += crossDiff.length() > 0.0 ? crossDiff.normalized() * ((parameters[PARAM_TANGENTIAL_ACCEL] + tex_tangential_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_TANGENTIAL_ACCEL])) : Vector3();
+ force += crossDiff.length() > 0.0 ? crossDiff.normalized() * ((parameters[PARAM_TANGENTIAL_ACCEL] + tex_tangential_accel) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed), randomness[PARAM_TANGENTIAL_ACCEL])) : Vector3();
}
//apply attractor forces
p.velocity += force * local_delta;
//orbit velocity
if (particle_flags[PARTICLE_FLAG_DISABLE_Z]) {
- float orbit_amount = (parameters[PARAM_ORBIT_VELOCITY] + tex_orbit_velocity) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_ORBIT_VELOCITY]);
+ real_t orbit_amount = (parameters[PARAM_ORBIT_VELOCITY] + tex_orbit_velocity) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed), randomness[PARAM_ORBIT_VELOCITY]);
if (orbit_amount != 0.0) {
- float ang = orbit_amount * local_delta * Math_TAU;
+ real_t ang = orbit_amount * local_delta * Math_TAU;
// Not sure why the ParticlesMaterial code uses a clockwise rotation matrix,
// but we use -ang here to reproduce its behavior.
Transform2D rot = Transform2D(-ang, Vector2());
@@ -915,8 +915,8 @@ void CPUParticles3D::_particles_process(float p_delta) {
p.velocity = p.velocity.normalized() * tex_linear_velocity;
}
if (parameters[PARAM_DAMPING] + tex_damping > 0.0) {
- float v = p.velocity.length();
- float damp = (parameters[PARAM_DAMPING] + tex_damping) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_DAMPING]);
+ real_t v = p.velocity.length();
+ real_t damp = (parameters[PARAM_DAMPING] + tex_damping) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed), randomness[PARAM_DAMPING]);
v -= damp * local_delta;
if (v < 0.0) {
p.velocity = Vector3();
@@ -924,27 +924,27 @@ void CPUParticles3D::_particles_process(float p_delta) {
p.velocity = p.velocity.normalized() * v;
}
}
- float base_angle = (parameters[PARAM_ANGLE] + tex_angle) * Math::lerp(1.0f, p.angle_rand, randomness[PARAM_ANGLE]);
- base_angle += p.custom[1] * lifetime * (parameters[PARAM_ANGULAR_VELOCITY] + tex_angular_velocity) * Math::lerp(1.0f, rand_from_seed(alt_seed) * 2.0f - 1.0f, randomness[PARAM_ANGULAR_VELOCITY]);
+ real_t base_angle = (parameters[PARAM_ANGLE] + tex_angle) * Math::lerp((real_t)1.0, p.angle_rand, randomness[PARAM_ANGLE]);
+ base_angle += p.custom[1] * lifetime * (parameters[PARAM_ANGULAR_VELOCITY] + tex_angular_velocity) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed) * 2.0f - 1.0f, randomness[PARAM_ANGULAR_VELOCITY]);
p.custom[0] = Math::deg2rad(base_angle); //angle
- p.custom[2] = (parameters[PARAM_ANIM_OFFSET] + tex_anim_offset) * Math::lerp(1.0f, p.anim_offset_rand, randomness[PARAM_ANIM_OFFSET]) + p.custom[1] * (parameters[PARAM_ANIM_SPEED] + tex_anim_speed) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_ANIM_SPEED]); //angle
+ p.custom[2] = (parameters[PARAM_ANIM_OFFSET] + tex_anim_offset) * Math::lerp((real_t)1.0, p.anim_offset_rand, randomness[PARAM_ANIM_OFFSET]) + p.custom[1] * (parameters[PARAM_ANIM_SPEED] + tex_anim_speed) * Math::lerp((real_t)1.0, rand_from_seed(alt_seed), randomness[PARAM_ANIM_SPEED]); //angle
}
//apply color
//apply hue rotation
- float tex_scale = 1.0;
+ real_t tex_scale = 1.0;
if (curve_parameters[PARAM_SCALE].is_valid()) {
tex_scale = curve_parameters[PARAM_SCALE]->interpolate(tv);
}
- float tex_hue_variation = 0.0;
+ real_t tex_hue_variation = 0.0;
if (curve_parameters[PARAM_HUE_VARIATION].is_valid()) {
tex_hue_variation = curve_parameters[PARAM_HUE_VARIATION]->interpolate(tv);
}
- float hue_rot_angle = (parameters[PARAM_HUE_VARIATION] + tex_hue_variation) * Math_TAU * Math::lerp(1.0f, p.hue_rot_rand * 2.0f - 1.0f, randomness[PARAM_HUE_VARIATION]);
- float hue_rot_c = Math::cos(hue_rot_angle);
- float hue_rot_s = Math::sin(hue_rot_angle);
+ real_t hue_rot_angle = (parameters[PARAM_HUE_VARIATION] + tex_hue_variation) * Math_TAU * Math::lerp(1, p.hue_rot_rand * 2.0f - 1.0f, randomness[PARAM_HUE_VARIATION]);
+ real_t hue_rot_c = Math::cos(hue_rot_angle);
+ real_t hue_rot_s = Math::sin(hue_rot_angle);
Basis hue_rot_mat;
{
@@ -1013,9 +1013,9 @@ void CPUParticles3D::_particles_process(float p_delta) {
}
//scale by scale
- float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
- if (base_scale < 0.000001) {
- base_scale = 0.000001;
+ real_t base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], (real_t)1.0, p.scale_rand * randomness[PARAM_SCALE]);
+ if (base_scale < CMP_EPSILON) {
+ base_scale = CMP_EPSILON;
}
p.transform.basis.scale(Vector3(1, 1, 1) * base_scale);
@@ -1097,7 +1097,7 @@ void CPUParticles3D::_update_particle_data_buffer() {
ptr[10] = t.basis.elements[2][2];
ptr[11] = t.origin.z;
} else {
- memset(ptr, 0, sizeof(float) * 12);
+ memset(ptr, 0, sizeof(Transform3D));
}
Color c = r[idx].color;
diff --git a/scene/3d/cpu_particles_3d.h b/scene/3d/cpu_particles_3d.h
index 07d345ba2c..bb6699ddc7 100644
--- a/scene/3d/cpu_particles_3d.h
+++ b/scene/3d/cpu_particles_3d.h
@@ -86,23 +86,23 @@ private:
struct Particle {
Transform3D transform;
Color color;
- float custom[4] = {};
+ real_t custom[4] = {};
Vector3 velocity;
bool active = false;
- float angle_rand = 0.0;
- float scale_rand = 0.0;
- float hue_rot_rand = 0.0;
- float anim_offset_rand = 0.0;
- float time = 0.0;
- float lifetime = 0.0;
+ real_t angle_rand = 0.0;
+ real_t scale_rand = 0.0;
+ real_t hue_rot_rand = 0.0;
+ real_t anim_offset_rand = 0.0;
+ double time = 0.0;
+ double lifetime = 0.0;
Color base_color;
uint32_t seed = 0;
};
- float time = 0.0;
- float inactive_time = 0.0;
- float frame_remainder = 0.0;
+ double time = 0.0;
+ double inactive_time = 0.0;
+ double frame_remainder = 0.0;
int cycle = 0;
bool redraw = false;
@@ -132,12 +132,12 @@ private:
bool one_shot = false;
- float lifetime = 1.0;
- float pre_process_time = 0.0;
- float explosiveness_ratio = 0.0;
- float randomness_ratio = 0.0;
- float lifetime_randomness = 0.0;
- float speed_scale = 1.0;
+ double lifetime = 1.0;
+ double pre_process_time = 0.0;
+ real_t explosiveness_ratio = 0.0;
+ real_t randomness_ratio = 0.0;
+ double lifetime_randomness = 0.0;
+ double speed_scale = 1.0;
bool local_coords = true;
int fixed_fps = 0;
bool fractional_delta = true;
@@ -153,11 +153,11 @@ private:
////////
Vector3 direction = Vector3(1, 0, 0);
- float spread = 45.0;
- float flatness = 0.0;
+ real_t spread = 45.0;
+ real_t flatness = 0.0;
- float parameters[PARAM_MAX];
- float randomness[PARAM_MAX] = {};
+ real_t parameters[PARAM_MAX];
+ real_t randomness[PARAM_MAX] = {};
Ref<Curve> curve_parameters[PARAM_MAX];
Color color = Color(1, 1, 1, 1);
@@ -166,21 +166,21 @@ private:
bool particle_flags[PARTICLE_FLAG_MAX] = {};
EmissionShape emission_shape = EMISSION_SHAPE_POINT;
- float emission_sphere_radius = 1.0;
+ real_t emission_sphere_radius = 1.0;
Vector3 emission_box_extents = Vector3(1, 1, 1);
Vector<Vector3> emission_points;
Vector<Vector3> emission_normals;
Vector<Color> emission_colors;
int emission_point_count = 0;
Vector3 emission_ring_axis;
- float emission_ring_height;
- float emission_ring_radius;
- float emission_ring_inner_radius;
+ real_t emission_ring_height;
+ real_t emission_ring_radius;
+ real_t emission_ring_inner_radius;
Vector3 gravity = Vector3(0, -9.8, 0);
void _update_internal();
- void _particles_process(float p_delta);
+ void _particles_process(double p_delta);
void _update_particle_data_buffer();
Mutex update_mutex;
@@ -200,27 +200,27 @@ public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
- void set_lifetime(float p_lifetime);
+ void set_lifetime(double p_lifetime);
void set_one_shot(bool p_one_shot);
- void set_pre_process_time(float p_time);
- void set_explosiveness_ratio(float p_ratio);
- void set_randomness_ratio(float p_ratio);
- void set_lifetime_randomness(float p_random);
+ void set_pre_process_time(double p_time);
+ void set_explosiveness_ratio(real_t p_ratio);
+ void set_randomness_ratio(real_t p_ratio);
+ void set_lifetime_randomness(double p_random);
void set_visibility_aabb(const AABB &p_aabb);
void set_use_local_coordinates(bool p_enable);
- void set_speed_scale(float p_scale);
+ void set_speed_scale(double p_scale);
bool is_emitting() const;
int get_amount() const;
- float get_lifetime() const;
+ double get_lifetime() const;
bool get_one_shot() const;
- float get_pre_process_time() const;
- float get_explosiveness_ratio() const;
- float get_randomness_ratio() const;
- float get_lifetime_randomness() const;
+ double get_pre_process_time() const;
+ real_t get_explosiveness_ratio() const;
+ real_t get_randomness_ratio() const;
+ double get_lifetime_randomness() const;
AABB get_visibility_aabb() const;
bool get_use_local_coordinates() const;
- float get_speed_scale() const;
+ double get_speed_scale() const;
void set_fixed_fps(int p_count);
int get_fixed_fps() const;
@@ -242,17 +242,17 @@ public:
void set_direction(Vector3 p_direction);
Vector3 get_direction() const;
- void set_spread(float p_spread);
- float get_spread() const;
+ void set_spread(real_t p_spread);
+ real_t get_spread() const;
- void set_flatness(float p_flatness);
- float get_flatness() const;
+ void set_flatness(real_t p_flatness);
+ real_t get_flatness() const;
- void set_param(Parameter p_param, float p_value);
- float get_param(Parameter p_param) const;
+ void set_param(Parameter p_param, real_t p_value);
+ real_t get_param(Parameter p_param) const;
- void set_param_randomness(Parameter p_param, float p_value);
- float get_param_randomness(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_curve(Parameter p_param, const Ref<Curve> &p_curve);
Ref<Curve> get_param_curve(Parameter p_param) const;
@@ -267,28 +267,28 @@ public:
bool get_particle_flag(ParticleFlags p_particle_flag) const;
void set_emission_shape(EmissionShape p_shape);
- void set_emission_sphere_radius(float p_radius);
+ void set_emission_sphere_radius(real_t p_radius);
void set_emission_box_extents(Vector3 p_extents);
void set_emission_points(const Vector<Vector3> &p_points);
void set_emission_normals(const Vector<Vector3> &p_normals);
void set_emission_colors(const Vector<Color> &p_colors);
void set_emission_point_count(int p_count);
void set_emission_ring_axis(Vector3 p_axis);
- void set_emission_ring_height(float p_height);
- void set_emission_ring_radius(float p_radius);
- void set_emission_ring_inner_radius(float p_radius);
+ void set_emission_ring_height(real_t p_height);
+ void set_emission_ring_radius(real_t p_radius);
+ void set_emission_ring_inner_radius(real_t p_radius);
EmissionShape get_emission_shape() const;
- float get_emission_sphere_radius() const;
+ real_t get_emission_sphere_radius() const;
Vector3 get_emission_box_extents() const;
Vector<Vector3> get_emission_points() const;
Vector<Vector3> get_emission_normals() const;
Vector<Color> get_emission_colors() const;
int get_emission_point_count() const;
Vector3 get_emission_ring_axis() const;
- float get_emission_ring_height() const;
- float get_emission_ring_radius() const;
- float get_emission_ring_inner_radius() const;
+ real_t get_emission_ring_height() const;
+ real_t get_emission_ring_radius() const;
+ real_t get_emission_ring_inner_radius() const;
void set_gravity(const Vector3 &p_gravity);
Vector3 get_gravity() const;
diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp
index 05f023721b..c94a99a203 100644
--- a/scene/3d/decal.cpp
+++ b/scene/3d/decal.cpp
@@ -53,48 +53,48 @@ Ref<Texture2D> Decal::get_texture(DecalTexture p_type) const {
return textures[p_type];
}
-void Decal::set_emission_energy(float p_energy) {
+void Decal::set_emission_energy(real_t p_energy) {
emission_energy = p_energy;
RS::get_singleton()->decal_set_emission_energy(decal, emission_energy);
}
-float Decal::get_emission_energy() const {
+real_t Decal::get_emission_energy() const {
return emission_energy;
}
-void Decal::set_albedo_mix(float p_mix) {
+void Decal::set_albedo_mix(real_t p_mix) {
albedo_mix = p_mix;
RS::get_singleton()->decal_set_albedo_mix(decal, albedo_mix);
}
-float Decal::get_albedo_mix() const {
+real_t Decal::get_albedo_mix() const {
return albedo_mix;
}
-void Decal::set_upper_fade(float p_fade) {
+void Decal::set_upper_fade(real_t p_fade) {
upper_fade = p_fade;
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
}
-float Decal::get_upper_fade() const {
+real_t Decal::get_upper_fade() const {
return upper_fade;
}
-void Decal::set_lower_fade(float p_fade) {
+void Decal::set_lower_fade(real_t p_fade) {
lower_fade = p_fade;
RS::get_singleton()->decal_set_fade(decal, upper_fade, lower_fade);
}
-float Decal::get_lower_fade() const {
+real_t Decal::get_lower_fade() const {
return lower_fade;
}
-void Decal::set_normal_fade(float p_fade) {
+void Decal::set_normal_fade(real_t p_fade) {
normal_fade = p_fade;
RS::get_singleton()->decal_set_normal_fade(decal, normal_fade);
}
-float Decal::get_normal_fade() const {
+real_t Decal::get_normal_fade() const {
return normal_fade;
}
@@ -117,21 +117,21 @@ bool Decal::is_distance_fade_enabled() const {
return distance_fade_enabled;
}
-void Decal::set_distance_fade_begin(float p_distance) {
+void Decal::set_distance_fade_begin(real_t p_distance) {
distance_fade_begin = p_distance;
RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length);
}
-float Decal::get_distance_fade_begin() const {
+real_t Decal::get_distance_fade_begin() const {
return distance_fade_begin;
}
-void Decal::set_distance_fade_length(float p_length) {
+void Decal::set_distance_fade_length(real_t p_length) {
distance_fade_length = p_length;
RS::get_singleton()->decal_set_distance_fade(decal, distance_fade_enabled, distance_fade_begin, distance_fade_length);
}
-float Decal::get_distance_fade_length() const {
+real_t Decal::get_distance_fade_length() const {
return distance_fade_length;
}
diff --git a/scene/3d/decal.h b/scene/3d/decal.h
index 31a6315213..041c8f97b2 100644
--- a/scene/3d/decal.h
+++ b/scene/3d/decal.h
@@ -51,16 +51,16 @@ private:
RID decal;
Vector3 extents = Vector3(1, 1, 1);
Ref<Texture2D> textures[TEXTURE_MAX];
- float emission_energy = 1.0;
- float albedo_mix = 1.0;
+ real_t emission_energy = 1.0;
+ real_t albedo_mix = 1.0;
Color modulate = Color(1, 1, 1, 1);
uint32_t cull_mask = (1 << 20) - 1;
- float normal_fade = 0.0;
- float upper_fade = 0.3;
- float lower_fade = 0.3;
+ real_t normal_fade = 0.0;
+ real_t upper_fade = 0.3;
+ real_t lower_fade = 0.3;
bool distance_fade_enabled = false;
- float distance_fade_begin = 10.0;
- float distance_fade_length = 1.0;
+ real_t distance_fade_begin = 10.0;
+ real_t distance_fade_length = 1.0;
protected:
static void _bind_methods();
@@ -75,32 +75,32 @@ public:
void set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture);
Ref<Texture2D> get_texture(DecalTexture p_type) const;
- void set_emission_energy(float p_energy);
- float get_emission_energy() const;
+ void set_emission_energy(real_t p_energy);
+ real_t get_emission_energy() const;
- void set_albedo_mix(float p_mix);
- float get_albedo_mix() const;
+ void set_albedo_mix(real_t p_mix);
+ real_t get_albedo_mix() const;
void set_modulate(Color p_modulate);
Color get_modulate() const;
- void set_upper_fade(float p_energy);
- float get_upper_fade() const;
+ void set_upper_fade(real_t p_energy);
+ real_t get_upper_fade() const;
- void set_lower_fade(float p_fade);
- float get_lower_fade() const;
+ void set_lower_fade(real_t p_fade);
+ real_t get_lower_fade() const;
- void set_normal_fade(float p_fade);
- float get_normal_fade() const;
+ void set_normal_fade(real_t p_fade);
+ real_t get_normal_fade() const;
void set_enable_distance_fade(bool p_enable);
bool is_distance_fade_enabled() const;
- void set_distance_fade_begin(float p_distance);
- float get_distance_fade_begin() const;
+ void set_distance_fade_begin(real_t p_distance);
+ real_t get_distance_fade_begin() const;
- void set_distance_fade_length(float p_length);
- float get_distance_fade_length() const;
+ void set_distance_fade_length(real_t p_length);
+ real_t get_distance_fade_length() const;
void set_cull_mask(uint32_t p_layers);
uint32_t get_cull_mask() const;
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp
index 44cd7c10d8..8b8b53c3bf 100644
--- a/scene/3d/gpu_particles_3d.cpp
+++ b/scene/3d/gpu_particles_3d.cpp
@@ -59,7 +59,7 @@ void GPUParticles3D::set_amount(int p_amount) {
RS::get_singleton()->particles_set_amount(particles, amount);
}
-void GPUParticles3D::set_lifetime(float p_lifetime) {
+void GPUParticles3D::set_lifetime(double p_lifetime) {
ERR_FAIL_COND_MSG(p_lifetime <= 0, "Particles lifetime must be greater than 0.");
lifetime = p_lifetime;
RS::get_singleton()->particles_set_lifetime(particles, lifetime);
@@ -81,7 +81,7 @@ void GPUParticles3D::set_one_shot(bool p_one_shot) {
}
}
-void GPUParticles3D::set_pre_process_time(float p_time) {
+void GPUParticles3D::set_pre_process_time(double p_time) {
pre_process_time = p_time;
RS::get_singleton()->particles_set_pre_process_time(particles, pre_process_time);
}
@@ -118,7 +118,7 @@ void GPUParticles3D::set_process_material(const Ref<Material> &p_material) {
update_configuration_warnings();
}
-void GPUParticles3D::set_speed_scale(float p_scale) {
+void GPUParticles3D::set_speed_scale(double p_scale) {
speed_scale = p_scale;
RS::get_singleton()->particles_set_speed_scale(particles, p_scale);
}
@@ -136,7 +136,7 @@ int GPUParticles3D::get_amount() const {
return amount;
}
-float GPUParticles3D::get_lifetime() const {
+double GPUParticles3D::get_lifetime() const {
return lifetime;
}
@@ -144,7 +144,7 @@ bool GPUParticles3D::get_one_shot() const {
return one_shot;
}
-float GPUParticles3D::get_pre_process_time() const {
+double GPUParticles3D::get_pre_process_time() const {
return pre_process_time;
}
@@ -168,7 +168,7 @@ Ref<Material> GPUParticles3D::get_process_material() const {
return process_material;
}
-float GPUParticles3D::get_speed_scale() const {
+double GPUParticles3D::get_speed_scale() const {
return speed_scale;
}
diff --git a/scene/3d/gpu_particles_3d.h b/scene/3d/gpu_particles_3d.h
index 7b21cf03f1..31e0e2abf5 100644
--- a/scene/3d/gpu_particles_3d.h
+++ b/scene/3d/gpu_particles_3d.h
@@ -64,11 +64,11 @@ private:
bool one_shot;
int amount;
- float lifetime;
- float pre_process_time;
+ double lifetime;
+ double pre_process_time;
float explosiveness_ratio;
float randomness_ratio;
- float speed_scale;
+ double speed_scale;
AABB visibility_aabb;
bool local_coords;
int fixed_fps;
@@ -104,30 +104,30 @@ public:
void set_emitting(bool p_emitting);
void set_amount(int p_amount);
- void set_lifetime(float p_lifetime);
+ void set_lifetime(double p_lifetime);
void set_one_shot(bool p_one_shot);
- void set_pre_process_time(float p_time);
+ void set_pre_process_time(double p_time);
void set_explosiveness_ratio(float p_ratio);
void set_randomness_ratio(float 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(float p_scale);
+ void set_speed_scale(double p_scale);
void set_collision_base_size(float p_ratio);
void set_trail_enabled(bool p_enabled);
void set_trail_length(float p_seconds);
bool is_emitting() const;
int get_amount() const;
- float get_lifetime() const;
+ double get_lifetime() const;
bool get_one_shot() const;
- float get_pre_process_time() const;
+ double get_pre_process_time() const;
float get_explosiveness_ratio() const;
float get_randomness_ratio() const;
AABB get_visibility_aabb() const;
bool get_use_local_coordinates() const;
Ref<Material> get_process_material() const;
- float get_speed_scale() const;
+ double get_speed_scale() const;
float get_collision_base_size() const;
bool is_trail_enabled() const;
float get_trail_length() const;
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index c2943a9606..40f33dfa72 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -38,7 +38,7 @@ bool Light3D::_can_gizmo_scale() const {
return false;
}
-void Light3D::set_param(Param p_param, float p_value) {
+void Light3D::set_param(Param p_param, real_t p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
param[p_param] = p_value;
@@ -53,7 +53,7 @@ void Light3D::set_param(Param p_param, float p_value) {
}
}
-float Light3D::get_param(Param p_param) const {
+real_t Light3D::get_param(Param p_param) const {
ERR_FAIL_INDEX_V(p_param, PARAM_MAX, 0);
return param[p_param];
}
@@ -128,8 +128,8 @@ AABB Light3D::get_aabb() const {
return AABB(Vector3(-1, -1, -1) * param[PARAM_RANGE], Vector3(2, 2, 2) * param[PARAM_RANGE]);
} else if (type == RenderingServer::LIGHT_SPOT) {
- float len = param[PARAM_RANGE];
- float size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len;
+ real_t len = param[PARAM_RANGE];
+ real_t size = Math::tan(Math::deg2rad(param[PARAM_SPOT_ANGLE])) * len;
return AABB(Vector3(-size, -size, -len), Vector3(size * 2, size * 2, len));
}
diff --git a/scene/3d/light_3d.h b/scene/3d/light_3d.h
index d0308a3025..51ed2fcf50 100644
--- a/scene/3d/light_3d.h
+++ b/scene/3d/light_3d.h
@@ -71,7 +71,7 @@ public:
private:
Color color;
- float param[PARAM_MAX] = {};
+ real_t param[PARAM_MAX] = {};
Color shadow_color;
bool shadow = false;
bool negative = false;
@@ -102,8 +102,8 @@ public:
void set_editor_only(bool p_editor_only);
bool is_editor_only() const;
- void set_param(Param p_param, float p_value);
- float get_param(Param p_param) const;
+ void set_param(Param p_param, real_t p_value);
+ real_t get_param(Param p_param) const;
void set_shadow(bool p_enable);
bool has_shadow() const;
diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp
index 0daee69ee5..92402c9a6a 100644
--- a/scene/3d/node_3d.cpp
+++ b/scene/3d/node_3d.cpp
@@ -588,31 +588,31 @@ bool Node3D::is_visible() const {
return data.visible;
}
-void Node3D::rotate_object_local(const Vector3 &p_axis, float p_angle) {
+void Node3D::rotate_object_local(const Vector3 &p_axis, real_t p_angle) {
Transform3D t = get_transform();
t.basis.rotate_local(p_axis, p_angle);
set_transform(t);
}
-void Node3D::rotate(const Vector3 &p_axis, float p_angle) {
+void Node3D::rotate(const Vector3 &p_axis, real_t p_angle) {
Transform3D t = get_transform();
t.basis.rotate(p_axis, p_angle);
set_transform(t);
}
-void Node3D::rotate_x(float p_angle) {
+void Node3D::rotate_x(real_t p_angle) {
Transform3D t = get_transform();
t.basis.rotate(Vector3(1, 0, 0), p_angle);
set_transform(t);
}
-void Node3D::rotate_y(float p_angle) {
+void Node3D::rotate_y(real_t p_angle) {
Transform3D t = get_transform();
t.basis.rotate(Vector3(0, 1, 0), p_angle);
set_transform(t);
}
-void Node3D::rotate_z(float p_angle) {
+void Node3D::rotate_z(real_t p_angle) {
Transform3D t = get_transform();
t.basis.rotate(Vector3(0, 0, 1), p_angle);
set_transform(t);
@@ -644,7 +644,7 @@ void Node3D::scale_object_local(const Vector3 &p_scale) {
set_transform(t);
}
-void Node3D::global_rotate(const Vector3 &p_axis, float p_angle) {
+void Node3D::global_rotate(const Vector3 &p_axis, real_t p_angle) {
Transform3D t = get_global_transform();
t.basis.rotate(p_axis, p_angle);
set_global_transform(t);
diff --git a/scene/3d/node_3d.h b/scene/3d/node_3d.h
index 282f4805cc..da54452abb 100644
--- a/scene/3d/node_3d.h
+++ b/scene/3d/node_3d.h
@@ -167,18 +167,18 @@ public:
Transform3D get_relative_transform(const Node *p_parent) const;
- void rotate(const Vector3 &p_axis, float p_angle);
- void rotate_x(float p_angle);
- void rotate_y(float p_angle);
- void rotate_z(float p_angle);
+ void rotate(const Vector3 &p_axis, real_t p_angle);
+ void rotate_x(real_t p_angle);
+ void rotate_y(real_t p_angle);
+ void rotate_z(real_t p_angle);
void translate(const Vector3 &p_offset);
void scale(const Vector3 &p_ratio);
- void rotate_object_local(const Vector3 &p_axis, float p_angle);
+ void rotate_object_local(const Vector3 &p_axis, real_t p_angle);
void scale_object_local(const Vector3 &p_scale);
void translate_object_local(const Vector3 &p_offset);
- void global_rotate(const Vector3 &p_axis, float p_angle);
+ void global_rotate(const Vector3 &p_axis, real_t p_angle);
void global_scale(const Vector3 &p_scale);
void global_translate(const Vector3 &p_offset);
diff --git a/scene/3d/path_3d.cpp b/scene/3d/path_3d.cpp
index 589135710f..6818acf69d 100644
--- a/scene/3d/path_3d.cpp
+++ b/scene/3d/path_3d.cpp
@@ -94,13 +94,13 @@ void PathFollow3D::_update_transform(bool p_update_xyz_rot) {
return;
}
- float bl = c->get_baked_length();
+ real_t bl = c->get_baked_length();
if (bl == 0.0) {
return;
}
- float bi = c->get_bake_interval();
- float o_next = offset + bi;
- float o_prev = offset - bi;
+ real_t bi = c->get_bake_interval();
+ real_t o_next = offset + bi;
+ real_t o_prev = offset - bi;
if (loop) {
o_next = Math::fposmod(o_next, bl);
@@ -169,8 +169,8 @@ void PathFollow3D::_update_transform(bool p_update_xyz_rot) {
Vector3 t_cur = (c->interpolate_baked(offset + delta_offset, cubic) - pos).normalized();
Vector3 axis = t_prev.cross(t_cur);
- float dot = t_prev.dot(t_cur);
- float angle = Math::acos(CLAMP(dot, -1, 1));
+ real_t dot = t_prev.dot(t_cur);
+ real_t angle = Math::acos(CLAMP(dot, -1, 1));
if (likely(!Math::is_zero_approx(angle))) {
if (rotation_mode == ROTATION_Y) {
@@ -189,7 +189,7 @@ void PathFollow3D::_update_transform(bool p_update_xyz_rot) {
}
// do the additional tilting
- float tilt_angle = c->interpolate_baked_tilt(offset);
+ real_t tilt_angle = c->interpolate_baked_tilt(offset);
Vector3 tilt_axis = t_cur; // not sure what tilt is supposed to do, is this correct??
if (likely(!Math::is_zero_approx(Math::abs(tilt_angle)))) {
@@ -244,7 +244,7 @@ bool PathFollow3D::get_cubic_interpolation() const {
void PathFollow3D::_validate_property(PropertyInfo &property) const {
if (property.name == "offset") {
- float max = 10000;
+ real_t max = 10000;
if (path && path->get_curve().is_valid()) {
max = path->get_curve()->get_baked_length();
}
@@ -307,13 +307,13 @@ void PathFollow3D::_bind_methods() {
BIND_ENUM_CONSTANT(ROTATION_ORIENTED);
}
-void PathFollow3D::set_offset(float p_offset) {
+void PathFollow3D::set_offset(real_t p_offset) {
delta_offset = p_offset - offset;
offset = p_offset;
if (path) {
if (path->get_curve().is_valid()) {
- float path_length = path->get_curve()->get_baked_length();
+ real_t path_length = path->get_curve()->get_baked_length();
if (loop) {
offset = Math::fposmod(offset, path_length);
@@ -329,39 +329,39 @@ void PathFollow3D::set_offset(float p_offset) {
}
}
-void PathFollow3D::set_h_offset(float p_h_offset) {
+void PathFollow3D::set_h_offset(real_t p_h_offset) {
h_offset = p_h_offset;
if (path) {
_update_transform();
}
}
-float PathFollow3D::get_h_offset() const {
+real_t PathFollow3D::get_h_offset() const {
return h_offset;
}
-void PathFollow3D::set_v_offset(float p_v_offset) {
+void PathFollow3D::set_v_offset(real_t p_v_offset) {
v_offset = p_v_offset;
if (path) {
_update_transform();
}
}
-float PathFollow3D::get_v_offset() const {
+real_t PathFollow3D::get_v_offset() const {
return v_offset;
}
-float PathFollow3D::get_offset() const {
+real_t PathFollow3D::get_offset() const {
return offset;
}
-void PathFollow3D::set_unit_offset(float p_unit_offset) {
+void PathFollow3D::set_unit_offset(real_t p_unit_offset) {
if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) {
set_offset(p_unit_offset * path->get_curve()->get_baked_length());
}
}
-float PathFollow3D::get_unit_offset() const {
+real_t PathFollow3D::get_unit_offset() const {
if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) {
return get_offset() / path->get_curve()->get_baked_length();
} else {
diff --git a/scene/3d/path_3d.h b/scene/3d/path_3d.h
index 8545370a4a..1ffe291100 100644
--- a/scene/3d/path_3d.h
+++ b/scene/3d/path_3d.h
@@ -83,17 +83,17 @@ protected:
static void _bind_methods();
public:
- void set_offset(float p_offset);
- float get_offset() const;
+ void set_offset(real_t p_offset);
+ real_t get_offset() const;
- void set_h_offset(float p_h_offset);
- float get_h_offset() const;
+ void set_h_offset(real_t p_h_offset);
+ real_t get_h_offset() const;
- void set_v_offset(float p_v_offset);
- float get_v_offset() const;
+ void set_v_offset(real_t p_v_offset);
+ real_t get_v_offset() const;
- void set_unit_offset(float p_unit_offset);
- float get_unit_offset() const;
+ void set_unit_offset(real_t p_unit_offset);
+ real_t get_unit_offset() const;
void set_loop(bool p_loop);
bool has_loop() const;
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 100e3563a3..38104a8365 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -1101,7 +1101,9 @@ void CharacterBody3D::move_and_slide() {
//this approach makes sure there is less delay between the actual body velocity and the one we saved
PhysicsDirectBodyState3D *bs = PhysicsServer3D::get_singleton()->body_get_direct_state(on_floor_body);
if (bs) {
- current_floor_velocity = bs->get_linear_velocity();
+ Transform3D gt = get_global_transform();
+ Vector3 local_position = gt.origin - bs->get_transform().origin;
+ current_floor_velocity = bs->get_velocity_at_local_position(local_position);
}
}
diff --git a/scene/3d/proximity_group_3d.h b/scene/3d/proximity_group_3d.h
index 05aa00b228..e45adc3040 100644
--- a/scene/3d/proximity_group_3d.h
+++ b/scene/3d/proximity_group_3d.h
@@ -49,7 +49,7 @@ private:
DispatchMode dispatch_mode = MODE_PROXY;
Vector3 grid_radius = Vector3(1, 1, 1);
- float cell_size = 1.0;
+ real_t cell_size = 1.0;
uint32_t group_version = 0;
void _clear_groups();
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp
index 9ce4c37457..86e2af7df5 100644
--- a/scene/3d/skeleton_3d.cpp
+++ b/scene/3d/skeleton_3d.cpp
@@ -366,7 +366,7 @@ void Skeleton3D::clear_bones_global_pose_override() {
_make_dirty();
}
-void Skeleton3D::set_bone_global_pose_override(int p_bone, const Transform3D &p_pose, float p_amount, bool p_persistent) {
+void Skeleton3D::set_bone_global_pose_override(int p_bone, const Transform3D &p_pose, real_t p_amount, bool p_persistent) {
ERR_FAIL_INDEX(p_bone, bones.size());
bones.write[p_bone].global_pose_override_amount = p_amount;
bones.write[p_bone].global_pose_override = p_pose;
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index 2f6e416c8c..3fdf5321a5 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -85,7 +85,7 @@ private:
bool custom_pose_enable = false;
Transform3D custom_pose;
- float global_pose_override_amount = 0.0;
+ real_t global_pose_override_amount = 0.0;
bool global_pose_override_reset = false;
Transform3D global_pose_override;
@@ -147,7 +147,7 @@ public:
Transform3D get_bone_global_pose_no_override(int p_bone) const;
void clear_bones_global_pose_override();
- void set_bone_global_pose_override(int p_bone, const Transform3D &p_pose, float p_amount, bool p_persistent = false);
+ void set_bone_global_pose_override(int p_bone, const Transform3D &p_pose, real_t p_amount, bool p_persistent = false);
void set_bone_enabled(int p_bone, bool p_enabled);
bool is_bone_enabled(int p_bone) const;
diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp
index 1005d51e63..a891566633 100644
--- a/scene/3d/skeleton_ik_3d.cpp
+++ b/scene/3d/skeleton_ik_3d.cpp
@@ -85,7 +85,7 @@ bool FabrikInverseKinematic::build_chain(Task *p_task, bool p_force_simple_chain
chain_sub_tip = p_task->skeleton->get_bone_parent(chain_sub_tip);
}
- BoneId middle_chain_item_id = (((float)sub_chain_size) * 0.5);
+ BoneId middle_chain_item_id = (BoneId)(sub_chain_size * 0.5);
// Build chain by reading chain ids in reverse order
// For each chain item id will be created a ChainItem if doesn't exists
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index a901920dbe..a28382f4cb 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -132,12 +132,12 @@ Color SpriteBase3D::get_modulate() const {
return modulate;
}
-void SpriteBase3D::set_pixel_size(float p_amount) {
+void SpriteBase3D::set_pixel_size(real_t p_amount) {
pixel_size = p_amount;
_queue_update();
}
-float SpriteBase3D::get_pixel_size() const {
+real_t SpriteBase3D::get_pixel_size() const {
return pixel_size;
}
@@ -203,7 +203,7 @@ Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const {
return Ref<TriangleMesh>();
}
- float pixel_size = get_pixel_size();
+ real_t pixel_size = get_pixel_size();
Vector2 vertices[4] = {
@@ -470,7 +470,7 @@ void Sprite3D::_draw() {
Color color = _get_color_accum();
color.a *= get_opacity();
- float pixel_size = get_pixel_size();
+ real_t pixel_size = get_pixel_size();
Vector2 vertices[4] = {
@@ -837,7 +837,7 @@ void AnimatedSprite3D::_draw() {
Color color = _get_color_accum();
color.a *= get_opacity();
- float pixel_size = get_pixel_size();
+ real_t pixel_size = get_pixel_size();
Vector2 vertices[4] = {
@@ -1037,7 +1037,7 @@ void AnimatedSprite3D::_notification(int p_what) {
return; //do nothing
}
- float remaining = get_process_delta_time();
+ double remaining = get_process_delta_time();
while (remaining) {
if (timeout <= 0) {
@@ -1059,7 +1059,7 @@ void AnimatedSprite3D::_notification(int p_what) {
emit_signal(SceneStringNames::get_singleton()->frame_changed);
}
- float to_process = MIN(timeout, remaining);
+ double to_process = MIN(timeout, remaining);
remaining -= to_process;
timeout -= to_process;
}
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index 404ef57e6a..d35b9ffe1b 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -72,7 +72,7 @@ private:
float opacity = 1.0;
Vector3::Axis axis = Vector3::AXIS_Z;
- float pixel_size = 0.01;
+ real_t pixel_size = 0.01;
AABB aabb;
RID mesh;
@@ -130,8 +130,8 @@ public:
void set_opacity(float p_amount);
float get_opacity() const;
- void set_pixel_size(float p_amount);
- float get_pixel_size() const;
+ void set_pixel_size(real_t p_amount);
+ real_t get_pixel_size() const;
void set_axis(Vector3::Axis p_axis);
Vector3::Axis get_axis() const;
@@ -213,7 +213,7 @@ class AnimatedSprite3D : public SpriteBase3D {
bool centered = false;
- float timeout = 0;
+ double timeout = 0.0;
void _res_changed();
diff --git a/scene/3d/velocity_tracker_3d.cpp b/scene/3d/velocity_tracker_3d.cpp
index 5b5cc06456..a027749eaa 100644
--- a/scene/3d/velocity_tracker_3d.cpp
+++ b/scene/3d/velocity_tracker_3d.cpp
@@ -61,16 +61,16 @@ void VelocityTracker3D::update_position(const Vector3 &p_position) {
Vector3 VelocityTracker3D::get_tracked_linear_velocity() const {
Vector3 linear_velocity;
- float max_time = 1 / 5.0; //maximum time to interpolate a velocity
+ double max_time = 1 / 5.0; //maximum time to interpolate a velocity
Vector3 distance_accum;
- float time_accum = 0.0;
- float base_time = 0.0;
+ double time_accum = 0.0;
+ double base_time = 0.0;
if (position_history_len) {
if (physics_step) {
uint64_t base = Engine::get_singleton()->get_physics_frames();
- base_time = float(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second();
+ base_time = double(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second();
} else {
uint64_t base = Engine::get_singleton()->get_frame_ticks();
base_time = double(base - position_history[0].frame) / 1000000.0;
@@ -78,12 +78,12 @@ Vector3 VelocityTracker3D::get_tracked_linear_velocity() const {
}
for (int i = 0; i < position_history_len - 1; i++) {
- float delta = 0.0;
+ double delta = 0.0;
uint64_t diff = position_history[i].frame - position_history[i + 1].frame;
Vector3 distance = position_history[i].position - position_history[i + 1].position;
if (physics_step) {
- delta = float(diff) / Engine::get_singleton()->get_iterations_per_second();
+ delta = double(diff) / Engine::get_singleton()->get_iterations_per_second();
} else {
delta = double(diff) / 1000000.0;
}
diff --git a/scene/3d/voxelizer.cpp b/scene/3d/voxelizer.cpp
index f1b9708f91..6124326d2d 100644
--- a/scene/3d/voxelizer.cpp
+++ b/scene/3d/voxelizer.cpp
@@ -56,20 +56,20 @@ static _FORCE_INLINE_ void get_uv_and_normal(const Vector3 &p_pos, const Vector3
Vector3 v1 = p_vtx[2] - p_vtx[0];
Vector3 v2 = p_pos - p_vtx[0];
- float d00 = v0.dot(v0);
- float d01 = v0.dot(v1);
- float d11 = v1.dot(v1);
- float d20 = v2.dot(v0);
- float d21 = v2.dot(v1);
- float denom = (d00 * d11 - d01 * d01);
+ real_t d00 = v0.dot(v0);
+ real_t d01 = v0.dot(v1);
+ real_t d11 = v1.dot(v1);
+ real_t d20 = v2.dot(v0);
+ real_t d21 = v2.dot(v1);
+ real_t denom = (d00 * d11 - d01 * d01);
if (denom == 0) {
r_uv = p_uv[0];
r_normal = p_normal[0];
return;
}
- float v = (d11 * d20 - d01 * d21) / denom;
- float w = (d00 * d21 - d01 * d20) / denom;
- float u = 1.0f - v - w;
+ real_t v = (d11 * d20 - d01 * d21) / denom;
+ real_t w = (d00 * d21 - d01 * d20) / denom;
+ real_t u = 1.0f - v - w;
r_uv = p_uv[0] * u + p_uv[1] * v + p_uv[2] * w;
r_normal = (p_normal[0] * u + p_normal[1] * v + p_normal[2] * w).normalized();
@@ -81,7 +81,7 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co
//find best axis to map to, for scanning values
int closest_axis = 0;
- float closest_dot = 0;
+ real_t closest_dot = 0;
Plane plane = Plane(p_vtx[0], p_vtx[1], p_vtx[2]);
Vector3 normal = plane.normal;
@@ -89,7 +89,7 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co
for (int i = 0; i < 3; i++) {
Vector3 axis;
axis[i] = 1.0;
- float dot = ABS(normal.dot(axis));
+ real_t dot = ABS(normal.dot(axis));
if (i == 0 || dot > closest_dot) {
closest_axis = i;
closest_dot = dot;
@@ -103,8 +103,8 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co
Vector3 t2;
t2[(closest_axis + 2) % 3] = 1.0;
- t1 *= p_aabb.size[(closest_axis + 1) % 3] / float(color_scan_cell_width);
- t2 *= p_aabb.size[(closest_axis + 2) % 3] / float(color_scan_cell_width);
+ t1 *= p_aabb.size[(closest_axis + 1) % 3] / real_t(color_scan_cell_width);
+ t2 *= p_aabb.size[(closest_axis + 2) % 3] / real_t(color_scan_cell_width);
Color albedo_accum;
Color emission_accum;
@@ -114,10 +114,10 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co
//map to a grid average in the best axis for this face
for (int i = 0; i < color_scan_cell_width; i++) {
- Vector3 ofs_i = float(i) * t1;
+ Vector3 ofs_i = real_t(i) * t1;
for (int j = 0; j < color_scan_cell_width; j++) {
- Vector3 ofs_j = float(j) * t2;
+ Vector3 ofs_j = real_t(j) * t2;
Vector3 from = p_aabb.position + ofs_i + ofs_j;
Vector3 to = from + t1 + t2 + axis * p_aabb.size[closest_axis];
@@ -155,8 +155,8 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co
lnormal = normal;
}
- int uv_x = CLAMP(int(Math::fposmod(uv.x, 1.0f) * bake_texture_size), 0, bake_texture_size - 1);
- int uv_y = CLAMP(int(Math::fposmod(uv.y, 1.0f) * bake_texture_size), 0, bake_texture_size - 1);
+ int uv_x = CLAMP(int(Math::fposmod(uv.x, (real_t)1.0) * bake_texture_size), 0, bake_texture_size - 1);
+ int uv_y = CLAMP(int(Math::fposmod(uv.y, (real_t)1.0) * bake_texture_size), 0, bake_texture_size - 1);
int ofs = uv_y * bake_texture_size + uv_x;
albedo_accum.r += p_material.albedo[ofs].r;
@@ -187,8 +187,8 @@ void Voxelizer::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, co
lnormal = normal;
}
- int uv_x = CLAMP(Math::fposmod(uv.x, 1.0f) * bake_texture_size, 0, bake_texture_size - 1);
- int uv_y = CLAMP(Math::fposmod(uv.y, 1.0f) * bake_texture_size, 0, bake_texture_size - 1);
+ int uv_x = CLAMP(Math::fposmod(uv.x, (real_t)1.0) * bake_texture_size, 0, bake_texture_size - 1);
+ int uv_y = CLAMP(Math::fposmod(uv.y, (real_t)1.0) * bake_texture_size, 0, bake_texture_size - 1);
int ofs = uv_y * bake_texture_size + uv_x;
@@ -636,7 +636,7 @@ void Voxelizer::begin_bake(int p_subdiv, const AABB &p_bounds) {
}
axis_cell_size[i] = axis_cell_size[longest_axis];
- float axis_size = po2_bounds.size[longest_axis];
+ real_t axis_size = po2_bounds.size[longest_axis];
//shrink until fit subdiv
while (axis_size / 2.0 >= po2_bounds.size[i]) {
@@ -954,7 +954,7 @@ Ref<MultiMesh> Voxelizer::create_debug_multimesh() {
Vector3 face_points[4];
for (int j = 0; j < 4; j++) {
- float v[3];
+ real_t v[3];
v[0] = 1.0;
v[1] = 1 - 2 * ((j >> 1) & 1);
v[2] = v[1] * (1 - 2 * (j & 1));
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index b04c7e2858..e620f33478 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -124,7 +124,7 @@ Point2 XRCamera3D::unproject_position(const Vector3 &p_pos) const {
return res;
};
-Vector3 XRCamera3D::project_position(const Point2 &p_point, float p_z_depth) const {
+Vector3 XRCamera3D::project_position(const Point2 &p_point, real_t p_z_depth) const {
// get our XRServer
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL_V(xr_server, Vector3());
@@ -544,7 +544,7 @@ void XROrigin3D::clear_tracked_camera_if(XRCamera3D *p_tracked_camera) {
};
};
-float XROrigin3D::get_world_scale() const {
+real_t XROrigin3D::get_world_scale() const {
// get our XRServer
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL_V(xr_server, 1.0);
@@ -552,7 +552,7 @@ float XROrigin3D::get_world_scale() const {
return xr_server->get_world_scale();
};
-void XROrigin3D::set_world_scale(float p_world_scale) {
+void XROrigin3D::set_world_scale(real_t p_world_scale) {
// get our XRServer
XRServer *xr_server = XRServer::get_singleton();
ERR_FAIL_NULL(xr_server);
diff --git a/scene/3d/xr_nodes.h b/scene/3d/xr_nodes.h
index 90079f5fe9..312287a93b 100644
--- a/scene/3d/xr_nodes.h
+++ b/scene/3d/xr_nodes.h
@@ -54,7 +54,7 @@ public:
virtual Vector3 project_local_ray_normal(const Point2 &p_pos) const override;
virtual Point2 unproject_position(const Vector3 &p_pos) const override;
- virtual Vector3 project_position(const Point2 &p_point, float p_z_depth) const override;
+ virtual Vector3 project_position(const Point2 &p_point, real_t p_z_depth) const override;
virtual Vector<Plane> get_frustum() const override;
XRCamera3D() {}
@@ -163,8 +163,8 @@ public:
void set_tracked_camera(XRCamera3D *p_tracked_camera);
void clear_tracked_camera_if(XRCamera3D *p_tracked_camera);
- float get_world_scale() const;
- void set_world_scale(float p_world_scale);
+ real_t get_world_scale() const;
+ void set_world_scale(real_t p_world_scale);
XROrigin3D() {}
~XROrigin3D() {}
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp
index 6e5d964b76..0167992baf 100644
--- a/scene/animation/animation_blend_space_1d.cpp
+++ b/scene/animation/animation_blend_space_1d.cpp
@@ -219,7 +219,7 @@ void AnimationNodeBlendSpace1D::_add_blend_point(int p_index, const Ref<Animatio
}
}
-float AnimationNodeBlendSpace1D::process(float p_time, bool p_seek) {
+double AnimationNodeBlendSpace1D::process(double p_time, bool p_seek) {
if (blend_points_used == 0) {
return 0.0;
}
@@ -229,7 +229,7 @@ float AnimationNodeBlendSpace1D::process(float p_time, bool p_seek) {
return blend_node(blend_points[0].name, blend_points[0].node, p_time, p_seek, 1.0, FILTER_IGNORE, false);
}
- float blend_pos = get_parameter(blend_position);
+ double blend_pos = get_parameter(blend_position);
float weights[MAX_BLEND_POINTS] = {};
diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h
index 8886e6c679..6730c09fd4 100644
--- a/scene/animation/animation_blend_space_1d.h
+++ b/scene/animation/animation_blend_space_1d.h
@@ -93,7 +93,7 @@ public:
void set_value_label(const String &p_label);
String get_value_label() const;
- float process(float p_time, bool p_seek) override;
+ double process(double p_time, bool p_seek) override;
String get_caption() const override;
Ref<AnimationNode> get_child_by_name(const StringName &p_name) override;
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index d88a9badf4..145e7c605b 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -431,12 +431,12 @@ void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vect
r_weights[2] = w;
}
-float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
+double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek) {
_update_triangles();
Vector2 blend_pos = get_parameter(blend_position);
int closest = get_parameter(this->closest);
- float length_internal = get_parameter(this->length_internal);
+ double length_internal = get_parameter(this->length_internal);
float mind = 0.0; //time of min distance point
if (blend_mode == BLEND_MODE_INTERPOLATED) {
diff --git a/scene/animation/animation_blend_space_2d.h b/scene/animation/animation_blend_space_2d.h
index 65d09a550d..a919fff1d2 100644
--- a/scene/animation/animation_blend_space_2d.h
+++ b/scene/animation/animation_blend_space_2d.h
@@ -126,7 +126,7 @@ public:
void set_y_label(const String &p_label);
String get_y_label() const;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
virtual String get_caption() const override;
Vector2 get_closest_point(const Vector2 &p_point);
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 4bddae3b14..049f3483ff 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -63,11 +63,11 @@ void AnimationNodeAnimation::_validate_property(PropertyInfo &property) const {
}
}
-float AnimationNodeAnimation::process(float p_time, bool p_seek) {
+double AnimationNodeAnimation::process(double p_time, bool p_seek) {
AnimationPlayer *ap = state->player;
ERR_FAIL_COND_V(!ap, 0);
- float time = get_parameter(this->time);
+ double time = get_parameter(this->time);
if (!ap->has_animation(animation)) {
AnimationNodeBlendTree *tree = Object::cast_to<AnimationNodeBlendTree>(parent);
@@ -84,7 +84,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) {
Ref<Animation> anim = ap->get_animation(animation);
- float step;
+ double step;
if (p_seek) {
time = p_time;
@@ -94,7 +94,7 @@ float AnimationNodeAnimation::process(float p_time, bool p_seek) {
step = p_time;
}
- float anim_size = anim->get_length();
+ double anim_size = anim->get_length();
if (anim->has_loop()) {
if (anim_size) {
@@ -202,12 +202,12 @@ bool AnimationNodeOneShot::has_filter() const {
return true;
}
-float AnimationNodeOneShot::process(float p_time, bool p_seek) {
+double AnimationNodeOneShot::process(double p_time, bool p_seek) {
bool active = get_parameter(this->active);
bool prev_active = get_parameter(this->prev_active);
- float time = get_parameter(this->time);
- float remaining = get_parameter(this->remaining);
- float time_to_restart = get_parameter(this->time_to_restart);
+ double time = get_parameter(this->time);
+ double remaining = get_parameter(this->remaining);
+ double time_to_restart = get_parameter(this->time_to_restart);
if (!active) {
//make it as if this node doesn't exist, pass input 0 by.
@@ -370,9 +370,9 @@ bool AnimationNodeAdd2::has_filter() const {
return true;
}
-float AnimationNodeAdd2::process(float p_time, bool p_seek) {
- float amount = get_parameter(add_amount);
- float rem0 = blend_input(0, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
+double AnimationNodeAdd2::process(double p_time, bool p_seek) {
+ double amount = get_parameter(add_amount);
+ double rem0 = blend_input(0, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
blend_input(1, p_time, p_seek, amount, FILTER_PASS, !sync);
return rem0;
@@ -416,10 +416,10 @@ bool AnimationNodeAdd3::has_filter() const {
return true;
}
-float AnimationNodeAdd3::process(float p_time, bool p_seek) {
- float amount = get_parameter(add_amount);
+double AnimationNodeAdd3::process(double p_time, bool p_seek) {
+ double amount = get_parameter(add_amount);
blend_input(0, p_time, p_seek, MAX(0, -amount), FILTER_PASS, !sync);
- float rem0 = blend_input(1, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
+ double rem0 = blend_input(1, p_time, p_seek, 1.0, FILTER_IGNORE, !sync);
blend_input(2, p_time, p_seek, MAX(0, amount), FILTER_PASS, !sync);
return rem0;
@@ -452,11 +452,11 @@ String AnimationNodeBlend2::get_caption() const {
return "Blend2";
}
-float AnimationNodeBlend2::process(float p_time, bool p_seek) {
- float amount = get_parameter(blend_amount);
+double AnimationNodeBlend2::process(double p_time, bool p_seek) {
+ double amount = get_parameter(blend_amount);
- float rem0 = blend_input(0, p_time, p_seek, 1.0 - amount, FILTER_BLEND, !sync);
- float rem1 = blend_input(1, p_time, p_seek, amount, FILTER_PASS, !sync);
+ double rem0 = blend_input(0, p_time, p_seek, 1.0 - amount, FILTER_BLEND, !sync);
+ double rem1 = blend_input(1, p_time, p_seek, amount, FILTER_PASS, !sync);
return amount > 0.5 ? rem1 : rem0; //hacky but good enough
}
@@ -507,11 +507,11 @@ bool AnimationNodeBlend3::is_using_sync() const {
return sync;
}
-float AnimationNodeBlend3::process(float p_time, bool p_seek) {
- float amount = get_parameter(blend_amount);
- float rem0 = blend_input(0, p_time, p_seek, MAX(0, -amount), FILTER_IGNORE, !sync);
- float rem1 = blend_input(1, p_time, p_seek, 1.0 - ABS(amount), FILTER_IGNORE, !sync);
- float rem2 = blend_input(2, p_time, p_seek, MAX(0, amount), FILTER_IGNORE, !sync);
+double AnimationNodeBlend3::process(double p_time, bool p_seek) {
+ double amount = get_parameter(blend_amount);
+ double rem0 = blend_input(0, p_time, p_seek, MAX(0, -amount), FILTER_IGNORE, !sync);
+ double rem1 = blend_input(1, p_time, p_seek, 1.0 - ABS(amount), FILTER_IGNORE, !sync);
+ double rem2 = blend_input(2, p_time, p_seek, MAX(0, amount), FILTER_IGNORE, !sync);
return amount > 0.5 ? rem2 : (amount < -0.5 ? rem0 : rem1); //hacky but good enough
}
@@ -545,8 +545,8 @@ String AnimationNodeTimeScale::get_caption() const {
return "TimeScale";
}
-float AnimationNodeTimeScale::process(float p_time, bool p_seek) {
- float scale = get_parameter(this->scale);
+double AnimationNodeTimeScale::process(double p_time, bool p_seek) {
+ double scale = get_parameter(this->scale);
if (p_seek) {
return blend_input(0, p_time, true, 1.0, FILTER_IGNORE, false);
} else {
@@ -575,12 +575,12 @@ String AnimationNodeTimeSeek::get_caption() const {
return "Seek";
}
-float AnimationNodeTimeSeek::process(float p_time, bool p_seek) {
- float seek_pos = get_parameter(this->seek_pos);
+double AnimationNodeTimeSeek::process(double p_time, bool p_seek) {
+ double seek_pos = get_parameter(this->seek_pos);
if (p_seek) {
return blend_input(0, p_time, true, 1.0, FILTER_IGNORE, false);
} else if (seek_pos >= 0) {
- float ret = blend_input(0, seek_pos, true, 1.0, FILTER_IGNORE, false);
+ double ret = blend_input(0, seek_pos, true, 1.0, FILTER_IGNORE, false);
set_parameter(this->seek_pos, -1.0); //reset
return ret;
} else {
@@ -676,13 +676,13 @@ float AnimationNodeTransition::get_cross_fade_time() const {
return xfade;
}
-float AnimationNodeTransition::process(float p_time, bool p_seek) {
+double AnimationNodeTransition::process(double p_time, bool p_seek) {
int current = get_parameter(this->current);
int prev = get_parameter(this->prev);
int prev_current = get_parameter(this->prev_current);
- float time = get_parameter(this->time);
- float prev_xfading = get_parameter(this->prev_xfading);
+ double time = get_parameter(this->time);
+ double prev_xfading = get_parameter(this->prev_xfading);
bool switched = current != prev_current;
@@ -794,7 +794,7 @@ String AnimationNodeOutput::get_caption() const {
return "Output";
}
-float AnimationNodeOutput::process(float p_time, bool p_seek) {
+double AnimationNodeOutput::process(double p_time, bool p_seek) {
return blend_input(0, p_time, p_seek, 1.0);
}
@@ -1007,7 +1007,7 @@ String AnimationNodeBlendTree::get_caption() const {
return "BlendTree";
}
-float AnimationNodeBlendTree::process(float p_time, bool p_seek) {
+double AnimationNodeBlendTree::process(double p_time, bool p_seek) {
Ref<AnimationNodeOutput> output = nodes[SceneStringNames::get_singleton()->output].node;
return _blend_node("output", nodes[SceneStringNames::get_singleton()->output].connections, this, output, p_time, p_seek, 1.0);
}
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
index d82658c8c2..8508aaf71b 100644
--- a/scene/animation/animation_blend_tree.h
+++ b/scene/animation/animation_blend_tree.h
@@ -53,7 +53,7 @@ public:
static Vector<String> (*get_editable_animation_list)();
virtual String get_caption() const override;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
void set_animation(const StringName &p_name);
StringName get_animation() const;
@@ -122,7 +122,7 @@ public:
bool is_using_sync() const;
virtual bool has_filter() const override;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
AnimationNodeOneShot();
};
@@ -148,7 +148,7 @@ public:
bool is_using_sync() const;
virtual bool has_filter() const override;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
AnimationNodeAdd2();
};
@@ -172,7 +172,7 @@ public:
bool is_using_sync() const;
virtual bool has_filter() const override;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
AnimationNodeAdd3();
};
@@ -191,7 +191,7 @@ public:
virtual Variant get_parameter_default_value(const StringName &p_parameter) const override;
virtual String get_caption() const override;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
void set_use_sync(bool p_sync);
bool is_using_sync() const;
@@ -218,7 +218,7 @@ public:
void set_use_sync(bool p_sync);
bool is_using_sync() const;
- float process(float p_time, bool p_seek) override;
+ double process(double p_time, bool p_seek) override;
AnimationNodeBlend3();
};
@@ -236,7 +236,7 @@ public:
virtual String get_caption() const override;
- float process(float p_time, bool p_seek) override;
+ double process(double p_time, bool p_seek) override;
AnimationNodeTimeScale();
};
@@ -255,7 +255,7 @@ public:
virtual String get_caption() const override;
- float process(float p_time, bool p_seek) override;
+ double process(double p_time, bool p_seek) override;
AnimationNodeTimeSeek();
};
@@ -313,7 +313,7 @@ public:
void set_cross_fade_time(float p_fade);
float get_cross_fade_time() const;
- float process(float p_time, bool p_seek) override;
+ double process(double p_time, bool p_seek) override;
AnimationNodeTransition();
};
@@ -323,7 +323,7 @@ class AnimationNodeOutput : public AnimationNode {
public:
virtual String get_caption() const override;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
AnimationNodeOutput();
};
@@ -390,7 +390,7 @@ public:
void get_node_connections(List<NodeConnection> *r_connections) const;
virtual String get_caption() const override;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
void get_node_list(List<StringName> *r_list);
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index bf53b554bf..9fc1dbd0c6 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -286,7 +286,7 @@ bool AnimationNodeStateMachinePlayback::_travel(AnimationNodeStateMachine *p_sta
return true;
}
-float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_state_machine, float p_time, bool p_seek) {
+double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek) {
//if not playing and it can restart, then restart
if (!playing && start_request == StringName()) {
if (!stop_request && p_state_machine->start_node) {
@@ -790,7 +790,7 @@ Vector2 AnimationNodeStateMachine::get_graph_offset() const {
return graph_offset;
}
-float AnimationNodeStateMachine::process(float p_time, bool p_seek) {
+double AnimationNodeStateMachine::process(double p_time, bool p_seek) {
Ref<AnimationNodeStateMachinePlayback> playback = get_parameter(this->playback);
ERR_FAIL_COND_V(playback.is_null(), 0.0);
diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h
index 9c1bca63c3..6f0e3107fd 100644
--- a/scene/animation/animation_node_state_machine.h
+++ b/scene/animation/animation_node_state_machine.h
@@ -114,7 +114,7 @@ class AnimationNodeStateMachinePlayback : public Resource {
bool _travel(AnimationNodeStateMachine *p_state_machine, const StringName &p_travel);
- float process(AnimationNodeStateMachine *p_state_machine, float p_time, bool p_seek);
+ double process(AnimationNodeStateMachine *p_state_machine, double p_time, bool p_seek);
protected:
static void _bind_methods();
@@ -210,7 +210,7 @@ public:
void set_graph_offset(const Vector2 &p_offset);
Vector2 get_graph_offset() const;
- virtual float process(float p_time, bool p_seek) override;
+ virtual double process(double p_time, bool p_seek) override;
virtual String get_caption() const override;
virtual Ref<AnimationNode> get_child_by_name(const StringName &p_name) override;
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 67b6205a65..5d200ebf86 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -341,7 +341,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim, Node *p_root_ov
}
}
-void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_is_current, bool p_seeked, bool p_started) {
+void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, double p_time, double p_delta, float p_interp, bool p_is_current, bool p_seeked, bool p_started) {
_ensure_node_caches(p_anim);
ERR_FAIL_COND(p_anim->node_cache.size() != p_anim->animation->get_track_count());
@@ -723,7 +723,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
continue;
}
- float pos = a->track_get_key_time(i, idx);
+ double pos = a->track_get_key_time(i, idx);
StringName anim_name = a->animation_track_get_key_animation(i, idx);
if (String(anim_name) == "[stop]" || !player->has_animation(anim_name)) {
@@ -732,12 +732,12 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
Ref<Animation> anim = player->get_animation(anim_name);
- float at_anim_pos;
+ double at_anim_pos;
if (anim->has_loop()) {
- at_anim_pos = Math::fposmod(p_time - pos, anim->get_length()); //seek to loop
+ at_anim_pos = Math::fposmod(p_time - pos, (double)anim->get_length()); //seek to loop
} else {
- at_anim_pos = MAX(anim->get_length(), p_time - pos); //seek to end
+ at_anim_pos = MAX((double)anim->get_length(), p_time - pos); //seek to end
}
if (player->is_playing() || p_seeked) {
@@ -776,11 +776,11 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
}
}
-void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, float p_blend, bool p_seeked, bool p_started) {
- float delta = p_delta * speed_scale * cd.speed_scale;
- float next_pos = cd.pos + delta;
+void AnimationPlayer::_animation_process_data(PlaybackData &cd, double p_delta, float p_blend, bool p_seeked, bool p_started) {
+ double delta = p_delta * speed_scale * cd.speed_scale;
+ double next_pos = cd.pos + delta;
- float len = cd.from->animation->get_length();
+ real_t len = cd.from->animation->get_length();
bool loop = cd.from->animation->has_loop();
if (!loop) {
@@ -808,7 +808,7 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f
}
} else {
- float looped_next_pos = Math::fposmod(next_pos, len);
+ double looped_next_pos = Math::fposmod(next_pos, (double)len);
if (looped_next_pos == 0 && next_pos != 0) {
// Loop multiples of the length to it, rather than 0
// so state at time=length is previewable in the editor
@@ -823,7 +823,7 @@ void AnimationPlayer::_animation_process_data(PlaybackData &cd, float p_delta, f
_animation_process_animation(cd.from, cd.pos, delta, p_blend, &cd == &playback.current, p_seeked, p_started);
}
-void AnimationPlayer::_animation_process2(float p_delta, bool p_started) {
+void AnimationPlayer::_animation_process2(double p_delta, bool p_started) {
Playback &c = playback;
accum_pass++;
@@ -927,7 +927,7 @@ void AnimationPlayer::_animation_update_transforms() {
cache_update_bezier_size = 0;
}
-void AnimationPlayer::_animation_process(float p_delta) {
+void AnimationPlayer::_animation_process(double p_delta) {
if (playback.current.from) {
end_reached = false;
end_notify = false;
@@ -1283,7 +1283,7 @@ float AnimationPlayer::get_playing_speed() const {
return speed_scale * playback.current.speed_scale;
}
-void AnimationPlayer::seek(float p_time, bool p_update) {
+void AnimationPlayer::seek(double p_time, bool p_update) {
if (!playback.current.from) {
if (playback.assigned) {
ERR_FAIL_COND(!animation_set.has(playback.assigned));
@@ -1299,7 +1299,7 @@ void AnimationPlayer::seek(float p_time, bool p_update) {
}
}
-void AnimationPlayer::seek_delta(float p_time, float p_delta) {
+void AnimationPlayer::seek_delta(double p_time, float p_delta) {
if (!playback.current.from) {
if (playback.assigned) {
ERR_FAIL_COND(!animation_set.has(playback.assigned));
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 7cd9de1fa1..b693e29bdf 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -215,13 +215,13 @@ private:
NodePath root;
- void _animation_process_animation(AnimationData *p_anim, float p_time, float p_delta, float p_interp, bool p_is_current = true, bool p_seeked = false, bool p_started = false);
+ void _animation_process_animation(AnimationData *p_anim, double p_time, double p_delta, float p_interp, bool p_is_current = true, bool p_seeked = false, bool p_started = false);
void _ensure_node_caches(AnimationData *p_anim, Node *p_root_override = nullptr);
- void _animation_process_data(PlaybackData &cd, float p_delta, float p_blend, bool p_seeked, bool p_started);
- void _animation_process2(float p_delta, bool p_started);
+ void _animation_process_data(PlaybackData &cd, double p_delta, float p_blend, bool p_seeked, bool p_started);
+ void _animation_process2(double p_delta, bool p_started);
void _animation_update_transforms();
- void _animation_process(float p_delta);
+ void _animation_process(double p_delta);
void _node_removed(Node *p_node);
void _stop_playing_caches();
@@ -306,8 +306,8 @@ public:
void set_method_call_mode(AnimationMethodCallMode p_mode);
AnimationMethodCallMode get_method_call_mode() const;
- void seek(float p_time, bool p_update = false);
- void seek_delta(float p_time, float p_delta);
+ void seek(double p_time, bool p_update = false);
+ void seek_delta(double p_time, float p_delta);
float get_current_animation_position() const;
float get_current_animation_length() const;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index e623309888..543545b90f 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -85,7 +85,7 @@ void AnimationNode::get_child_nodes(List<ChildNode> *r_child_nodes) {
}
}
-void AnimationNode::blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend) {
+void AnimationNode::blend_animation(const StringName &p_animation, real_t p_time, real_t p_delta, bool p_seeked, real_t p_blend) {
ERR_FAIL_COND(!state);
ERR_FAIL_COND(!state->player->has_animation(p_animation));
@@ -115,13 +115,13 @@ void AnimationNode::blend_animation(const StringName &p_animation, float p_time,
state->animation_states.push_back(anim_state);
}
-float AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, float p_time, bool p_seek, const Vector<StringName> &p_connections) {
+real_t AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, real_t p_time, bool p_seek, const Vector<StringName> &p_connections) {
base_path = p_base_path;
parent = p_parent;
connections = p_connections;
state = p_state;
- float t = process(p_time, p_seek);
+ real_t t = process(p_time, p_seek);
state = nullptr;
parent = nullptr;
@@ -140,7 +140,7 @@ void AnimationNode::make_invalid(const String &p_reason) {
state->invalid_reasons += String::utf8("• ") + p_reason;
}
-float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) {
+real_t AnimationNode::blend_input(int p_input, real_t p_time, bool p_seek, real_t p_blend, FilterAction p_filter, bool p_optimize) {
ERR_FAIL_INDEX_V(p_input, inputs.size(), 0);
ERR_FAIL_COND_V(!state, 0);
@@ -158,8 +158,8 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p
Ref<AnimationNode> node = blend_tree->get_node(node_name);
//inputs.write[p_input].last_pass = state->last_pass;
- float activity = 0.0;
- float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity);
+ real_t activity = 0.0;
+ real_t ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), nullptr, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity);
Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path);
@@ -170,11 +170,11 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p
return ret;
}
-float AnimationNode::blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) {
+real_t AnimationNode::blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, real_t p_time, bool p_seek, real_t p_blend, FilterAction p_filter, bool p_optimize) {
return _blend_node(p_sub_path, Vector<StringName>(), this, p_node, p_time, p_seek, p_blend, p_filter, p_optimize);
}
-float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize, float *r_max) {
+real_t AnimationNode::_blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, real_t p_time, bool p_seek, real_t p_blend, FilterAction p_filter, bool p_optimize, real_t *r_max) {
ERR_FAIL_COND_V(!p_node.is_valid(), 0);
ERR_FAIL_COND_V(!state, 0);
@@ -184,8 +184,8 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Strin
p_node->blends.resize(blend_count);
}
- float *blendw = p_node->blends.ptrw();
- const float *blendr = blends.ptr();
+ real_t *blendw = p_node->blends.ptrw();
+ const real_t *blendr = blends.ptr();
bool any_valid = false;
@@ -328,7 +328,7 @@ void AnimationNode::remove_input(int p_index) {
emit_changed();
}
-float AnimationNode::process(float p_time, bool p_seek) {
+double AnimationNode::process(double p_time, bool p_seek) {
if (get_script_instance()) {
return get_script_instance()->call("_process", p_time, p_seek);
}
@@ -718,7 +718,7 @@ void AnimationTree::_clear_caches() {
cache_valid = false;
}
-void AnimationTree::_process_graph(float p_delta) {
+void AnimationTree::_process_graph(real_t p_delta) {
_update_properties(); //if properties need updating, update them
//check all tracks, see if they need modification
@@ -790,7 +790,7 @@ void AnimationTree::_process_graph(float p_delta) {
// root source blends
root->blends.resize(state.track_count);
- float *src_blendsw = root->blends.ptrw();
+ real_t *src_blendsw = root->blends.ptrw();
for (int i = 0; i < state.track_count; i++) {
src_blendsw[i] = 1.0; //by default all go to 1 for the root input
}
@@ -818,9 +818,9 @@ void AnimationTree::_process_graph(float p_delta) {
for (const AnimationNode::AnimationState &as : state.animation_states) {
Ref<Animation> a = as.animation;
- float time = as.time;
- float delta = as.delta;
- float weight = as.blend;
+ double time = as.time;
+ double delta = as.delta;
+ real_t weight = as.blend;
bool seeked = as.seeked;
for (int i = 0; i < a->get_track_count(); i++) {
@@ -840,7 +840,7 @@ void AnimationTree::_process_graph(float p_delta) {
ERR_CONTINUE(blend_idx < 0 || blend_idx >= state.track_count);
- float blend = (*as.track_blends)[blend_idx] * weight;
+ real_t blend = (*as.track_blends)[blend_idx] * weight;
if (blend < CMP_EPSILON) {
continue; //nothing to blend
@@ -860,7 +860,7 @@ void AnimationTree::_process_graph(float p_delta) {
t->scale = Vector3(1, 1, 1);
}
- float prev_time = time - delta;
+ real_t prev_time = time - delta;
if (prev_time < 0) {
if (!a->has_loop()) {
prev_time = 0;
@@ -928,7 +928,7 @@ void AnimationTree::_process_graph(float p_delta) {
t->rot = rot;
t->rot_blend_accum = blend;
} else {
- float rot_total = t->rot_blend_accum + blend;
+ real_t rot_total = t->rot_blend_accum + blend;
t->rot = rot.slerp(t->rot, t->rot_blend_accum / rot_total).normalized();
t->rot_blend_accum = rot_total;
}
@@ -1003,7 +1003,7 @@ void AnimationTree::_process_graph(float p_delta) {
case Animation::TYPE_BEZIER: {
TrackCacheBezier *t = static_cast<TrackCacheBezier *>(track);
- float bezier = a->bezier_track_interpolate(i, time);
+ real_t bezier = a->bezier_track_interpolate(i, time);
if (t->process_pass != process_pass) {
t->value = bezier;
@@ -1029,10 +1029,10 @@ void AnimationTree::_process_graph(float p_delta) {
t->playing = false;
playing_caches.erase(t);
} else {
- float start_ofs = a->audio_track_get_key_start_offset(i, idx);
+ real_t start_ofs = a->audio_track_get_key_start_offset(i, idx);
start_ofs += time - a->track_get_key_time(i, idx);
- float end_ofs = a->audio_track_get_key_end_offset(i, idx);
- float len = stream->get_length();
+ real_t end_ofs = a->audio_track_get_key_end_offset(i, idx);
+ real_t len = stream->get_length();
if (start_ofs > len - end_ofs) {
t->object->call("stop");
@@ -1068,9 +1068,9 @@ void AnimationTree::_process_graph(float p_delta) {
t->playing = false;
playing_caches.erase(t);
} else {
- float start_ofs = a->audio_track_get_key_start_offset(i, idx);
- float end_ofs = a->audio_track_get_key_end_offset(i, idx);
- float len = stream->get_length();
+ real_t start_ofs = a->audio_track_get_key_start_offset(i, idx);
+ real_t end_ofs = a->audio_track_get_key_end_offset(i, idx);
+ real_t len = stream->get_length();
t->object->call("set_stream", stream);
t->object->call("play", start_ofs);
@@ -1093,7 +1093,7 @@ void AnimationTree::_process_graph(float p_delta) {
if (!loop && time < t->start) {
stop = true;
} else if (t->len > 0) {
- float len = t->start > time ? (a->get_length() - t->start) + time : time - t->start;
+ real_t len = t->start > time ? (a->get_length() - t->start) + time : time - t->start;
if (len > t->len) {
stop = true;
@@ -1109,7 +1109,7 @@ void AnimationTree::_process_graph(float p_delta) {
}
}
- float db = Math::linear2db(MAX(blend, 0.00001));
+ real_t db = Math::linear2db(MAX(blend, 0.00001));
if (t->object->has_method("set_unit_db")) {
t->object->call("set_unit_db", db);
} else {
@@ -1132,7 +1132,7 @@ void AnimationTree::_process_graph(float p_delta) {
continue;
}
- float pos = a->track_get_key_time(i, idx);
+ double pos = a->track_get_key_time(i, idx);
StringName anim_name = a->animation_track_get_key_animation(i, idx);
if (String(anim_name) == "[stop]" || !player2->has_animation(anim_name)) {
@@ -1141,10 +1141,10 @@ void AnimationTree::_process_graph(float p_delta) {
Ref<Animation> anim = player2->get_animation(anim_name);
- float at_anim_pos;
+ real_t at_anim_pos;
if (anim->has_loop()) {
- at_anim_pos = Math::fposmod(time - pos, anim->get_length()); //seek to loop
+ at_anim_pos = Math::fposmod(time - pos, (double)anim->get_length()); //seek to loop
} else {
at_anim_pos = MAX(anim->get_length(), time - pos); //seek to end
}
@@ -1238,7 +1238,7 @@ void AnimationTree::_process_graph(float p_delta) {
}
}
-void AnimationTree::advance(float p_time) {
+void AnimationTree::advance(real_t p_time) {
_process_graph(p_time);
}
@@ -1443,7 +1443,7 @@ void AnimationTree::rename_parameter(const String &p_base, const String &p_new_b
_update_properties();
}
-float AnimationTree::get_connection_activity(const StringName &p_path, int p_connection) const {
+real_t AnimationTree::get_connection_activity(const StringName &p_path, int p_connection) const {
if (!input_activity_map_get.has(p_path)) {
return 0;
}
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index 60e0c7200a..59bbc5b4da 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -57,16 +57,16 @@ public:
Vector<Input> inputs;
- float process_input(int p_input, float p_time, bool p_seek, float p_blend);
+ real_t process_input(int p_input, real_t p_time, bool p_seek, real_t p_blend);
friend class AnimationTree;
struct AnimationState {
Ref<Animation> animation;
- float time = 0.0;
- float delta = 0.0;
- const Vector<float> *track_blends = nullptr;
- float blend = 0.0;
+ double time = 0.0;
+ double delta = 0.0;
+ const Vector<real_t> *track_blends = nullptr;
+ real_t blend = 0.0;
bool seeked = false;
};
@@ -81,10 +81,10 @@ public:
uint64_t last_pass = 0;
};
- Vector<float> blends;
+ Vector<real_t> blends;
State *state = nullptr;
- float _pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, float p_time, bool p_seek, const Vector<StringName> &p_connections);
+ real_t _pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, real_t p_time, bool p_seek, const Vector<StringName> &p_connections);
void _pre_update_animations(HashMap<NodePath, int> *track_map);
//all this is temporary
@@ -98,12 +98,12 @@ public:
Array _get_filters() const;
void _set_filters(const Array &p_filters);
friend class AnimationNodeBlendTree;
- float _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true, float *r_max = nullptr);
+ real_t _blend_node(const StringName &p_subpath, const Vector<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> p_node, real_t p_time, bool p_seek, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true, real_t *r_max = nullptr);
protected:
- void blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend);
- float blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true);
- float blend_input(int p_input, float p_time, bool p_seek, float p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true);
+ void blend_animation(const StringName &p_animation, real_t p_time, real_t p_delta, bool p_seeked, real_t p_blend);
+ real_t blend_node(const StringName &p_sub_path, Ref<AnimationNode> p_node, real_t p_time, bool p_seek, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true);
+ real_t blend_input(int p_input, real_t p_time, bool p_seek, real_t p_blend, FilterAction p_filter = FILTER_IGNORE, bool p_optimize = true);
void make_invalid(const String &p_reason);
static void _bind_methods();
@@ -126,7 +126,7 @@ public:
virtual void get_child_nodes(List<ChildNode> *r_child_nodes);
- virtual float process(float p_time, bool p_seek);
+ virtual double process(double p_time, bool p_seek);
virtual String get_caption() const;
int get_input_count() const;
@@ -191,7 +191,7 @@ private:
int bone_idx = -1;
Vector3 loc;
Quaternion rot;
- float rot_blend_accum = 0.0;
+ real_t rot_blend_accum = 0.0;
Vector3 scale;
TrackCacheTransform() {
@@ -210,7 +210,7 @@ private:
};
struct TrackCacheBezier : public TrackCache {
- float value = 0.0;
+ real_t value = 0.0;
Vector<StringName> subpath;
TrackCacheBezier() {
type = Animation::TYPE_BEZIER;
@@ -219,8 +219,8 @@ private:
struct TrackCacheAudio : public TrackCache {
bool playing = false;
- float start = 0.0;
- float len = 0.0;
+ real_t start = 0.0;
+ real_t len = 0.0;
TrackCacheAudio() {
type = Animation::TYPE_AUDIO;
@@ -251,7 +251,7 @@ private:
void _clear_caches();
bool _update_caches(AnimationPlayer *player);
- void _process_graph(float p_delta);
+ void _process_graph(real_t p_delta);
uint64_t setup_pass = 1;
uint64_t process_pass = 1;
@@ -271,7 +271,7 @@ private:
struct Activity {
uint64_t last_pass = 0;
- float activity = 0.0;
+ real_t activity = 0.0;
};
HashMap<StringName, Vector<Activity>> input_activity_map;
@@ -312,8 +312,8 @@ public:
Transform3D get_root_motion_transform() const;
- float get_connection_activity(const StringName &p_path, int p_connection) const;
- void advance(float p_time);
+ real_t get_connection_activity(const StringName &p_path, int p_connection) const;
+ void advance(real_t p_time);
void rename_parameter(const String &p_base, const String &p_new_base);
diff --git a/scene/animation/root_motion_view.h b/scene/animation/root_motion_view.h
index 55fd2d2b73..d64c8bc675 100644
--- a/scene/animation/root_motion_view.h
+++ b/scene/animation/root_motion_view.h
@@ -39,8 +39,8 @@ class RootMotionView : public VisualInstance3D {
public:
Ref<ImmediateMesh> immediate;
NodePath path;
- float cell_size = 1.0;
- float radius = 10.0;
+ real_t cell_size = 1.0;
+ real_t radius = 10.0;
bool use_in_game = false;
Color color = Color(0.5, 0.5, 1.0);
bool first = true;
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index 83ecf1d534..635f3c51b9 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -49,9 +49,6 @@ GradientEdit::GradientEdit() {
popup->add_child(picker);
add_child(popup);
-
- checker = Ref<ImageTexture>(memnew(ImageTexture));
- Ref<Image> img = memnew(Image(checker_bg_png));
}
int GradientEdit::_get_point_from_pos(int x) {
@@ -311,7 +308,7 @@ void GradientEdit::_notification(int p_what) {
int total_w = get_size().width - get_size().height - SPACING;
//Draw checker pattern for ramp
- _draw_checker(0, 0, total_w, h);
+ draw_texture_rect(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")), Rect2(0, 0, total_w, h), true);
//Draw color ramp
Gradient::Point prev;
@@ -378,7 +375,7 @@ void GradientEdit::_notification(int p_what) {
}
//Draw "button" for color selector
- _draw_checker(total_w + SPACING, 0, h, h);
+ draw_texture_rect(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")), Rect2(total_w + SPACING, 0, h, h), true);
if (grabbed != -1) {
//Draw with selection color
draw_rect(Rect2(total_w + SPACING, 0, h, h), points[grabbed].color);
@@ -405,27 +402,6 @@ void GradientEdit::_notification(int p_what) {
}
}
-void GradientEdit::_draw_checker(int x, int y, int w, int h) {
- //Draw it with polygon to insert UVs for scale
- Vector<Vector2> backPoints;
- backPoints.push_back(Vector2(x, y));
- backPoints.push_back(Vector2(x, y + h));
- backPoints.push_back(Vector2(x + w, y + h));
- backPoints.push_back(Vector2(x + w, y));
- Vector<Color> colorPoints;
- colorPoints.push_back(Color(1, 1, 1, 1));
- colorPoints.push_back(Color(1, 1, 1, 1));
- colorPoints.push_back(Color(1, 1, 1, 1));
- colorPoints.push_back(Color(1, 1, 1, 1));
- Vector<Vector2> uvPoints;
- //Draw checker pattern pixel-perfect and scale it by 2.
- uvPoints.push_back(Vector2(x, y));
- uvPoints.push_back(Vector2(x, y + h * .5f / checker->get_height()));
- uvPoints.push_back(Vector2(x + w * .5f / checker->get_width(), y + h * .5f / checker->get_height()));
- uvPoints.push_back(Vector2(x + w * .5f / checker->get_width(), y));
- draw_polygon(backPoints, colorPoints, uvPoints, checker);
-}
-
Size2 GradientEdit::get_minimum_size() const {
return Vector2(0, 16);
}
@@ -439,7 +415,7 @@ void GradientEdit::_color_changed(const Color &p_color) {
emit_signal(SNAME("ramp_changed"));
}
-void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors) {
+void GradientEdit::set_ramp(const Vector<real_t> &p_offsets, const Vector<Color> &p_colors) {
ERR_FAIL_COND(p_offsets.size() != p_colors.size());
points.clear();
for (int i = 0; i < p_offsets.size(); i++) {
@@ -453,8 +429,8 @@ void GradientEdit::set_ramp(const Vector<float> &p_offsets, const Vector<Color>
update();
}
-Vector<float> GradientEdit::get_offsets() const {
- Vector<float> ret;
+Vector<real_t> GradientEdit::get_offsets() const {
+ Vector<real_t> ret;
for (int i = 0; i < points.size(); i++) {
ret.push_back(points[i].offset);
}
diff --git a/scene/gui/gradient_edit.h b/scene/gui/gradient_edit.h
index eb7367d598..b0ee2c4abb 100644
--- a/scene/gui/gradient_edit.h
+++ b/scene/gui/gradient_edit.h
@@ -42,8 +42,6 @@ class GradientEdit : public Control {
PopupPanel *popup;
ColorPicker *picker;
- Ref<ImageTexture> checker;
-
bool grabbing = false;
int grabbed = -1;
Vector<Gradient::Point> points;
@@ -59,8 +57,8 @@ protected:
static void _bind_methods();
public:
- void set_ramp(const Vector<float> &p_offsets, const Vector<Color> &p_colors);
- Vector<float> get_offsets() const;
+ void set_ramp(const Vector<real_t> &p_offsets, const Vector<Color> &p_colors);
+ Vector<real_t> get_offsets() const;
Vector<Color> get_colors() const;
void set_points(Vector<Gradient::Point> &p_points);
Vector<Gradient::Point> &get_points();
diff --git a/scene/gui/rich_text_effect.h b/scene/gui/rich_text_effect.h
index d809fd502f..67323e7f93 100644
--- a/scene/gui/rich_text_effect.h
+++ b/scene/gui/rich_text_effect.h
@@ -59,7 +59,7 @@ public:
bool outline = false;
Point2 offset;
Color color;
- float elapsed_time = 0.0f;
+ double elapsed_time = 0.0f;
Dictionary environment;
uint32_t glpyh_index = 0;
RID font;
@@ -69,8 +69,8 @@ public:
Vector2i get_range() { return range; }
void set_range(const Vector2i &p_range) { range = p_range; }
- float get_elapsed_time() { return elapsed_time; }
- void set_elapsed_time(float p_elapsed_time) { elapsed_time = p_elapsed_time; }
+ double get_elapsed_time() { return elapsed_time; }
+ void set_elapsed_time(double p_elapsed_time) { elapsed_time = p_elapsed_time; }
bool is_visible() { return visibility; }
void set_visibility(bool p_visibility) { visibility = p_visibility; }
bool is_outline() { return outline; }
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 3cb1f7d2bc..cf2a1481a1 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1323,7 +1323,7 @@ void RichTextLabel::_update_scroll() {
}
}
-void RichTextLabel::_update_fx(RichTextLabel::ItemFrame *p_frame, float p_delta_time) {
+void RichTextLabel::_update_fx(RichTextLabel::ItemFrame *p_frame, double p_delta_time) {
Item *it = p_frame;
while (it) {
ItemFX *ifx = nullptr;
@@ -1441,7 +1441,7 @@ void RichTextLabel::_notification(int p_what) {
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
if (is_visible_in_tree()) {
- float dt = get_process_delta_time();
+ double dt = get_process_delta_time();
_update_fx(main, dt);
update();
}
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index a73176ba7e..28dfe74b08 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -260,7 +260,7 @@ private:
};
struct ItemFX : public Item {
- float elapsed_time = 0.f;
+ double elapsed_time = 0.f;
};
struct ItemShake : public ItemFX {
@@ -440,7 +440,7 @@ private:
void _fetch_item_fx_stack(Item *p_item, Vector<ItemFX *> &r_stack);
void _update_scroll();
- void _update_fx(ItemFrame *p_frame, float p_delta_time);
+ void _update_fx(ItemFrame *p_frame, double p_delta_time);
void _scroll_changed(double);
void _gui_input(Ref<InputEvent> p_event);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index f1e5574351..cbd5fa7425 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -116,6 +116,9 @@ void Node::_notification(int p_notification) {
memdelete(data.path_cache);
data.path_cache = nullptr;
}
+ if (data.filename.length()) {
+ get_multiplayer()->scene_enter_exit_notify(data.filename, this, false);
+ }
} break;
case NOTIFICATION_PATH_CHANGED: {
if (data.path_cache) {
@@ -147,6 +150,10 @@ void Node::_notification(int p_notification) {
get_script_instance()->call(SceneStringNames::get_singleton()->_ready);
}
+ if (data.filename.length()) {
+ ERR_FAIL_COND(!is_inside_tree());
+ get_multiplayer()->scene_enter_exit_notify(data.filename, this, true);
+ }
} break;
case NOTIFICATION_POSTINITIALIZE: {
@@ -705,7 +712,7 @@ bool Node::is_enabled() const {
return _is_enabled();
}
-float Node::get_physics_process_delta_time() const {
+double Node::get_physics_process_delta_time() const {
if (data.tree) {
return data.tree->get_physics_process_time();
} else {
@@ -713,7 +720,7 @@ float Node::get_physics_process_delta_time() const {
}
}
-float Node::get_process_delta_time() const {
+double Node::get_process_delta_time() const {
if (data.tree) {
return data.tree->get_process_time();
} else {
diff --git a/scene/main/node.h b/scene/main/node.h
index 0a88553ea1..9997f4e055 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -202,6 +202,7 @@ protected:
static String _get_name_num_separator();
friend class SceneState;
+ friend class MultiplayerAPI;
void _add_child_nocheck(Node *p_child, const StringName &p_name);
void _set_owner_nocheck(Node *p_owner);
@@ -339,11 +340,11 @@ public:
/* PROCESSING */
void set_physics_process(bool p_process);
- float get_physics_process_delta_time() const;
+ double get_physics_process_delta_time() const;
bool is_physics_processing() const;
void set_process(bool p_process);
- float get_process_delta_time() const;
+ double get_process_delta_time() const;
bool is_processing() const;
void set_physics_process_internal(bool p_process_internal);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index b5c49a8a97..c836f50bf2 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -375,7 +375,7 @@ private:
Variant drag_data;
ObjectID drag_preview_id;
Ref<SceneTreeTimer> tooltip_timer;
- float tooltip_delay = 0.0;
+ double tooltip_delay = 0.0;
Transform2D focus_inv_xform;
bool roots_order_dirty = false;
List<Control *> roots;
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 640ec50eb9..e6a74e7685 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -77,17 +77,17 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
} else if (what == "keys" || what == "key_values") {
if (track_get_type(track) == TYPE_TRANSFORM3D) {
TransformTrack *tt = static_cast<TransformTrack *>(tracks[track]);
- Vector<float> values = p_value;
+ Vector<real_t> values = p_value;
int vcount = values.size();
- ERR_FAIL_COND_V(vcount % 12, false); // should be multiple of 11
+ ERR_FAIL_COND_V(vcount % 12, false); // should be multiple of 12
- const float *r = values.ptr();
+ const real_t *r = values.ptr();
tt->transforms.resize(vcount / 12);
for (int i = 0; i < (vcount / 12); i++) {
TKey<TransformKey> &tk = tt->transforms.write[i];
- const float *ofs = &r[i * 12];
+ const real_t *ofs = &r[i * 12];
tk.time = ofs[0];
tk.transition = ofs[1];
@@ -125,7 +125,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
vt->update_mode = UpdateMode(um);
}
- Vector<float> times = d["times"];
+ Vector<real_t> times = d["times"];
Array values = d["values"];
ERR_FAIL_COND_V(times.size() != values.size(), false);
@@ -133,7 +133,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
if (times.size()) {
int valcount = times.size();
- const float *rt = times.ptr();
+ const real_t *rt = times.ptr();
vt->values.resize(valcount);
@@ -143,10 +143,10 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
}
if (d.has("transitions")) {
- Vector<float> transitions = d["transitions"];
+ Vector<real_t> transitions = d["transitions"];
ERR_FAIL_COND_V(transitions.size() != valcount, false);
- const float *rtr = transitions.ptr();
+ const real_t *rtr = transitions.ptr();
for (int i = 0; i < valcount; i++) {
vt->values.write[i].transition = rtr[i];
@@ -165,7 +165,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("values"), false);
- Vector<float> times = d["times"];
+ Vector<real_t> times = d["times"];
Array values = d["values"];
ERR_FAIL_COND_V(times.size() != values.size(), false);
@@ -173,17 +173,17 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
if (times.size()) {
int valcount = times.size();
- const float *rt = times.ptr();
+ const real_t *rt = times.ptr();
for (int i = 0; i < valcount; i++) {
track_insert_key(track, rt[i], values[i]);
}
if (d.has("transitions")) {
- Vector<float> transitions = d["transitions"];
+ Vector<real_t> transitions = d["transitions"];
ERR_FAIL_COND_V(transitions.size() != valcount, false);
- const float *rtr = transitions.ptr();
+ const real_t *rtr = transitions.ptr();
for (int i = 0; i < valcount; i++) {
track_set_key_transition(track, i, rtr[i]);
@@ -196,16 +196,16 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("points"), false);
- Vector<float> times = d["times"];
- PackedFloat32Array values = d["points"];
+ Vector<real_t> times = d["times"];
+ Vector<real_t> values = d["points"];
ERR_FAIL_COND_V(times.size() * 5 != values.size(), false);
if (times.size()) {
int valcount = times.size();
- const float *rt = times.ptr();
- const float *rv = values.ptr();
+ const real_t *rt = times.ptr();
+ const real_t *rv = values.ptr();
bt->values.resize(valcount);
@@ -227,7 +227,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("clips"), false);
- Vector<float> times = d["times"];
+ Vector<real_t> times = d["times"];
Array clips = d["clips"];
ERR_FAIL_COND_V(clips.size() != times.size(), false);
@@ -235,7 +235,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
if (times.size()) {
int valcount = times.size();
- const float *rt = times.ptr();
+ const real_t *rt = times.ptr();
ad->values.clear();
@@ -268,7 +268,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
ERR_FAIL_COND_V(!d.has("times"), false);
ERR_FAIL_COND_V(!d.has("clips"), false);
- Vector<float> times = d["times"];
+ Vector<real_t> times = d["times"];
Vector<String> clips = d["clips"];
ERR_FAIL_COND_V(clips.size() != times.size(), false);
@@ -276,7 +276,7 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
if (times.size()) {
int valcount = times.size();
- const float *rt = times.ptr();
+ const real_t *rt = times.ptr();
const String *rc = clips.ptr();
an->values.resize(valcount);
@@ -352,9 +352,9 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
r_ret = track_is_enabled(track);
} else if (what == "keys") {
if (track_get_type(track) == TYPE_TRANSFORM3D) {
- Vector<float> keys;
+ Vector<real_t> keys;
int kk = track_get_key_count(track);
- keys.resize(kk * 12);
+ keys.resize(kk * sizeof(Transform3D));
real_t *w = keys.ptrw();
@@ -389,8 +389,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- Vector<float> key_times;
- Vector<float> key_transitions;
+ Vector<real_t> key_times;
+ Vector<real_t> key_transitions;
Array key_values;
int kk = vt->values.size();
@@ -399,8 +399,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
key_transitions.resize(kk);
key_values.resize(kk);
- float *wti = key_times.ptrw();
- float *wtr = key_transitions.ptrw();
+ real_t *wti = key_times.ptrw();
+ real_t *wtr = key_transitions.ptrw();
int idx = 0;
@@ -427,8 +427,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
} else if (track_get_type(track) == TYPE_METHOD) {
Dictionary d;
- Vector<float> key_times;
- Vector<float> key_transitions;
+ Vector<real_t> key_times;
+ Vector<real_t> key_transitions;
Array key_values;
int kk = track_get_key_count(track);
@@ -437,8 +437,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
key_transitions.resize(kk);
key_values.resize(kk);
- float *wti = key_times.ptrw();
- float *wtr = key_transitions.ptrw();
+ real_t *wti = key_times.ptrw();
+ real_t *wtr = key_transitions.ptrw();
int idx = 0;
for (int i = 0; i < track_get_key_count(track); i++) {
@@ -463,16 +463,16 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- Vector<float> key_times;
- Vector<float> key_points;
+ Vector<real_t> key_times;
+ Vector<real_t> key_points;
int kk = bt->values.size();
key_times.resize(kk);
key_points.resize(kk * 5);
- float *wti = key_times.ptrw();
- float *wpo = key_points.ptrw();
+ real_t *wti = key_times.ptrw();
+ real_t *wpo = key_points.ptrw();
int idx = 0;
@@ -499,14 +499,14 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- Vector<float> key_times;
+ Vector<real_t> key_times;
Array clips;
int kk = ad->values.size();
key_times.resize(kk);
- float *wti = key_times.ptrw();
+ real_t *wti = key_times.ptrw();
int idx = 0;
@@ -533,7 +533,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
Dictionary d;
- Vector<float> key_times;
+ Vector<real_t> key_times;
Vector<String> clips;
int kk = an->values.size();
@@ -541,7 +541,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const {
key_times.resize(kk);
clips.resize(kk);
- float *wti = key_times.ptrw();
+ real_t *wti = key_times.ptrw();
String *wcl = clips.ptrw();
const TKey<StringName> *vls = an->values.ptr();
@@ -722,7 +722,7 @@ bool Animation::track_get_interpolation_loop_wrap(int p_track) const {
// transform
/*
template<class T>
-int Animation::_insert_pos(float p_time, T& p_keys) {
+int Animation::_insert_pos(double p_time, T& p_keys) {
// simple, linear time inset that should be fast enough in reality.
int idx=p_keys.size();
@@ -745,12 +745,12 @@ int Animation::_insert_pos(float p_time, T& p_keys) {
*/
template <class T, class V>
-int Animation::_insert(float p_time, T &p_keys, const V &p_value) {
+int Animation::_insert(double p_time, T &p_keys, const V &p_value) {
int idx = p_keys.size();
while (true) {
// Condition for replacement.
- if (idx > 0 && Math::is_equal_approx(p_keys[idx - 1].time, p_time)) {
+ if (idx > 0 && Math::is_equal_approx((double)p_keys[idx - 1].time, p_time)) {
float transition = p_keys[idx - 1].transition;
p_keys.write[idx - 1] = p_value;
p_keys.write[idx - 1].transition = transition;
@@ -794,7 +794,7 @@ Error Animation::transform_track_get_key(int p_track, int p_key, Vector3 *r_loc,
return OK;
}
-int Animation::transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quaternion &p_rot, const Vector3 &p_scale) {
+int Animation::transform_track_insert_key(int p_track, double p_time, const Vector3 &p_loc, const Quaternion &p_rot, const Vector3 &p_scale) {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_TRANSFORM3D, -1);
@@ -812,7 +812,7 @@ int Animation::transform_track_insert_key(int p_track, float p_time, const Vecto
return ret;
}
-void Animation::track_remove_key_at_time(int p_track, float p_time) {
+void Animation::track_remove_key_at_time(int p_track, double p_time) {
int idx = track_find_key(p_track, p_time, true);
ERR_FAIL_COND(idx < 0);
track_remove_key(p_track, idx);
@@ -864,7 +864,7 @@ void Animation::track_remove_key(int p_track, int p_idx) {
emit_changed();
}
-int Animation::track_find_key(int p_track, float p_time, bool p_exact) const {
+int Animation::track_find_key(int p_track, double p_time, bool p_exact) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
@@ -946,7 +946,7 @@ int Animation::track_find_key(int p_track, float p_time, bool p_exact) const {
return -1;
}
-void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key, float p_transition) {
+void Animation::track_insert_key(int p_track, double p_time, const Variant &p_key, real_t p_transition) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
@@ -1151,7 +1151,7 @@ Variant Animation::track_get_key_value(int p_track, int p_key_idx) const {
ERR_FAIL_V(Variant());
}
-float Animation::track_get_key_time(int p_track, int p_key_idx) const {
+double Animation::track_get_key_time(int p_track, int p_key_idx) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
@@ -1196,7 +1196,7 @@ float Animation::track_get_key_time(int p_track, int p_key_idx) const {
ERR_FAIL_V(-1);
}
-void Animation::track_set_key_time(int p_track, int p_key_idx, float p_time) {
+void Animation::track_set_key_time(int p_track, int p_key_idx, double p_time) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
@@ -1260,7 +1260,7 @@ void Animation::track_set_key_time(int p_track, int p_key_idx, float p_time) {
ERR_FAIL();
}
-float Animation::track_get_key_transition(int p_track, int p_key_idx) const {
+real_t Animation::track_get_key_transition(int p_track, int p_key_idx) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
@@ -1379,7 +1379,7 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
emit_changed();
}
-void Animation::track_set_key_transition(int p_track, int p_key_idx, float p_transition) {
+void Animation::track_set_key_transition(int p_track, int p_key_idx, real_t p_transition) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
@@ -1412,7 +1412,7 @@ void Animation::track_set_key_transition(int p_track, int p_key_idx, float p_tra
}
template <class K>
-int Animation::_find(const Vector<K> &p_keys, float p_time) const {
+int Animation::_find(const Vector<K> &p_keys, double p_time) const {
int len = p_keys.size();
if (len == 0) {
return -2;
@@ -1433,7 +1433,7 @@ int Animation::_find(const Vector<K> &p_keys, float p_time) const {
while (low <= high) {
middle = (low + high) / 2;
- if (Math::is_equal_approx(p_time, keys[middle].time)) { //match
+ if (Math::is_equal_approx(p_time, (double)keys[middle].time)) { //match
return middle;
} else if (p_time < keys[middle].time) {
high = middle - 1; //search low end of array
@@ -1449,7 +1449,7 @@ int Animation::_find(const Vector<K> &p_keys, float p_time) const {
return middle;
}
-Animation::TransformKey Animation::_interpolate(const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, float p_c) const {
+Animation::TransformKey Animation::_interpolate(const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, real_t p_c) const {
TransformKey ret;
ret.loc = _interpolate(p_a.loc, p_b.loc, p_c);
ret.rot = _interpolate(p_a.rot, p_b.rot, p_c);
@@ -1458,25 +1458,25 @@ Animation::TransformKey Animation::_interpolate(const Animation::TransformKey &p
return ret;
}
-Vector3 Animation::_interpolate(const Vector3 &p_a, const Vector3 &p_b, float p_c) const {
+Vector3 Animation::_interpolate(const Vector3 &p_a, const Vector3 &p_b, real_t p_c) const {
return p_a.lerp(p_b, p_c);
}
-Quaternion Animation::_interpolate(const Quaternion &p_a, const Quaternion &p_b, float p_c) const {
+Quaternion Animation::_interpolate(const Quaternion &p_a, const Quaternion &p_b, real_t p_c) const {
return p_a.slerp(p_b, p_c);
}
-Variant Animation::_interpolate(const Variant &p_a, const Variant &p_b, float p_c) const {
+Variant Animation::_interpolate(const Variant &p_a, const Variant &p_b, real_t p_c) const {
Variant dst;
Variant::interpolate(p_a, p_b, p_c, dst);
return dst;
}
-float Animation::_interpolate(const float &p_a, const float &p_b, float p_c) const {
+real_t Animation::_interpolate(const real_t &p_a, const real_t &p_b, real_t p_c) const {
return p_a * (1.0 - p_c) + p_b * p_c;
}
-Animation::TransformKey Animation::_cubic_interpolate(const Animation::TransformKey &p_pre_a, const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, const Animation::TransformKey &p_post_b, float p_c) const {
+Animation::TransformKey Animation::_cubic_interpolate(const Animation::TransformKey &p_pre_a, const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, const Animation::TransformKey &p_post_b, real_t p_c) const {
Animation::TransformKey tk;
tk.loc = p_a.loc.cubic_interpolate(p_b.loc, p_pre_a.loc, p_post_b.loc, p_c);
@@ -1486,15 +1486,15 @@ Animation::TransformKey Animation::_cubic_interpolate(const Animation::Transform
return tk;
}
-Vector3 Animation::_cubic_interpolate(const Vector3 &p_pre_a, const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_post_b, float p_c) const {
+Vector3 Animation::_cubic_interpolate(const Vector3 &p_pre_a, const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_post_b, real_t p_c) const {
return p_a.cubic_interpolate(p_b, p_pre_a, p_post_b, p_c);
}
-Quaternion Animation::_cubic_interpolate(const Quaternion &p_pre_a, const Quaternion &p_a, const Quaternion &p_b, const Quaternion &p_post_b, float p_c) const {
+Quaternion Animation::_cubic_interpolate(const Quaternion &p_pre_a, const Quaternion &p_a, const Quaternion &p_b, const Quaternion &p_post_b, real_t p_c) const {
return p_a.cubic_slerp(p_b, p_pre_a, p_post_b, p_c);
}
-Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a, const Variant &p_b, const Variant &p_post_b, float p_c) const {
+Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a, const Variant &p_b, const Variant &p_post_b, real_t p_c) const {
Variant::Type type_a = p_a.get_type();
Variant::Type type_b = p_b.get_type();
Variant::Type type_pa = p_pre_a.get_type();
@@ -1515,9 +1515,9 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
real_t p2 = p_b;
real_t p3 = p_post_b;
- float t = p_c;
- float t2 = t * t;
- float t3 = t2 * t;
+ real_t t = p_c;
+ real_t t2 = t * t;
+ real_t t3 = t2 * t;
return 0.5f * ((p1 * 2.0f) +
(-p0 + p2) * t +
@@ -1579,12 +1579,12 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
}
}
-float Animation::_cubic_interpolate(const float &p_pre_a, const float &p_a, const float &p_b, const float &p_post_b, float p_c) const {
+real_t Animation::_cubic_interpolate(const real_t &p_pre_a, const real_t &p_a, const real_t &p_b, const real_t &p_post_b, real_t p_c) const {
return _interpolate(p_a, p_b, p_c);
}
template <class T>
-T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, InterpolationType p_interp, bool p_loop_wrap, bool *p_ok) const {
+T Animation::_interpolate(const Vector<TKey<T>> &p_keys, double p_time, InterpolationType p_interp, bool p_loop_wrap, bool *p_ok) const {
int len = _find(p_keys, length) + 1; // try to find last key (there may be more past the end)
if (len <= 0) {
@@ -1608,7 +1608,7 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
bool result = true;
int next = 0;
- float c = 0.0;
+ real_t c = 0.0;
// prepare for all cases of interpolation
if (loop && p_loop_wrap) {
@@ -1616,8 +1616,8 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
if (idx >= 0) {
if ((idx + 1) < len) {
next = idx + 1;
- float delta = p_keys[next].time - p_keys[idx].time;
- float from = p_time - p_keys[idx].time;
+ real_t delta = p_keys[next].time - p_keys[idx].time;
+ real_t from = p_time - p_keys[idx].time;
if (Math::is_zero_approx(delta)) {
c = 0;
@@ -1627,8 +1627,8 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
} else {
next = 0;
- float delta = (length - p_keys[idx].time) + p_keys[next].time;
- float from = p_time - p_keys[idx].time;
+ real_t delta = (length - p_keys[idx].time) + p_keys[next].time;
+ real_t from = p_time - p_keys[idx].time;
if (Math::is_zero_approx(delta)) {
c = 0;
@@ -1641,12 +1641,12 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
// on loop, behind first key
idx = len - 1;
next = 0;
- float endtime = (length - p_keys[idx].time);
+ real_t endtime = (length - p_keys[idx].time);
if (endtime < 0) { // may be keys past the end
endtime = 0;
}
- float delta = endtime + p_keys[next].time;
- float from = endtime + p_time;
+ real_t delta = endtime + p_keys[next].time;
+ real_t from = endtime + p_time;
if (Math::is_zero_approx(delta)) {
c = 0;
@@ -1660,8 +1660,8 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
if (idx >= 0) {
if ((idx + 1) < len) {
next = idx + 1;
- float delta = p_keys[next].time - p_keys[idx].time;
- float from = p_time - p_keys[idx].time;
+ real_t delta = p_keys[next].time - p_keys[idx].time;
+ real_t from = p_time - p_keys[idx].time;
if (Math::is_zero_approx(delta)) {
c = 0;
@@ -1690,7 +1690,7 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
return T();
}
- float tr = p_keys[idx].transition;
+ real_t tr = p_keys[idx].transition;
if (tr == 0 || idx == next) {
// don't interpolate if not needed
@@ -1728,7 +1728,7 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
// do a barrel roll
}
-Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const {
+Error Animation::transform_track_interpolate(int p_track, double p_time, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), ERR_INVALID_PARAMETER);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_TRANSFORM3D, ERR_INVALID_PARAMETER);
@@ -1758,7 +1758,7 @@ Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3
return OK;
}
-Variant Animation::value_track_interpolate(int p_track, float p_time) const {
+Variant Animation::value_track_interpolate(int p_track, double p_time) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_VALUE, Variant());
@@ -1775,7 +1775,7 @@ Variant Animation::value_track_interpolate(int p_track, float p_time) const {
return Variant();
}
-void Animation::_value_track_get_key_indices_in_range(const ValueTrack *vt, float from_time, float to_time, List<int> *p_indices) const {
+void Animation::_value_track_get_key_indices_in_range(const ValueTrack *vt, double from_time, double to_time, List<int> *p_indices) const {
if (from_time != length && to_time == length) {
to_time = length * 1.001; //include a little more if at the end
}
@@ -1812,15 +1812,15 @@ void Animation::_value_track_get_key_indices_in_range(const ValueTrack *vt, floa
}
}
-void Animation::value_track_get_key_indices(int p_track, float p_time, float p_delta, List<int> *p_indices) const {
+void Animation::value_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices) const {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_VALUE);
ValueTrack *vt = static_cast<ValueTrack *>(t);
- float from_time = p_time - p_delta;
- float to_time = p_time;
+ double from_time = p_time - p_delta;
+ double to_time = p_time;
if (from_time > to_time) {
SWAP(from_time, to_time);
@@ -1875,7 +1875,7 @@ Animation::UpdateMode Animation::value_track_get_update_mode(int p_track) const
}
template <class T>
-void Animation::_track_get_key_indices_in_range(const Vector<T> &p_array, float from_time, float to_time, List<int> *p_indices) const {
+void Animation::_track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices) const {
if (from_time != length && to_time == length) {
to_time = length * 1.01; //include a little more if at the end
}
@@ -1908,12 +1908,12 @@ void Animation::_track_get_key_indices_in_range(const Vector<T> &p_array, float
}
}
-void Animation::track_get_key_indices_in_range(int p_track, float p_time, float p_delta, List<int> *p_indices) const {
+void Animation::track_get_key_indices_in_range(int p_track, double p_time, double p_delta, List<int> *p_indices) const {
ERR_FAIL_INDEX(p_track, tracks.size());
const Track *t = tracks[p_track];
- float from_time = p_time - p_delta;
- float to_time = p_time;
+ double from_time = p_time - p_delta;
+ double to_time = p_time;
if (from_time > to_time) {
SWAP(from_time, to_time);
@@ -2021,7 +2021,7 @@ void Animation::track_get_key_indices_in_range(int p_track, float p_time, float
}
}
-void Animation::_method_track_get_key_indices_in_range(const MethodTrack *mt, float from_time, float to_time, List<int> *p_indices) const {
+void Animation::_method_track_get_key_indices_in_range(const MethodTrack *mt, double from_time, double to_time, List<int> *p_indices) const {
if (from_time != length && to_time == length) {
to_time = length * 1.01; //include a little more if at the end
}
@@ -2054,15 +2054,15 @@ void Animation::_method_track_get_key_indices_in_range(const MethodTrack *mt, fl
}
}
-void Animation::method_track_get_key_indices(int p_track, float p_time, float p_delta, List<int> *p_indices) const {
+void Animation::method_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices) const {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_METHOD);
MethodTrack *mt = static_cast<MethodTrack *>(t);
- float from_time = p_time - p_delta;
- float to_time = p_time;
+ double from_time = p_time - p_delta;
+ double to_time = p_time;
if (from_time > to_time) {
SWAP(from_time, to_time);
@@ -2128,7 +2128,7 @@ StringName Animation::method_track_get_name(int p_track, int p_key_idx) const {
return pm->methods[p_key_idx].method;
}
-int Animation::bezier_track_insert_key(int p_track, float p_time, float p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle) {
+int Animation::bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle) {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_BEZIER, -1);
@@ -2154,7 +2154,7 @@ int Animation::bezier_track_insert_key(int p_track, float p_time, float p_value,
return key;
}
-void Animation::bezier_track_set_key_value(int p_track, int p_index, float p_value) {
+void Animation::bezier_track_set_key_value(int p_track, int p_index, real_t p_value) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_BEZIER);
@@ -2199,7 +2199,7 @@ void Animation::bezier_track_set_key_out_handle(int p_track, int p_index, const
emit_changed();
}
-float Animation::bezier_track_get_key_value(int p_track, int p_index) const {
+real_t Animation::bezier_track_get_key_value(int p_track, int p_index) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_BEZIER, 0);
@@ -2246,7 +2246,7 @@ static _FORCE_INLINE_ Vector2 _bezier_interp(real_t t, const Vector2 &start, con
return start * omt3 + control_1 * omt2 * t * 3.0 + control_2 * omt * t2 * 3.0 + end * t3;
}
-float Animation::bezier_track_interpolate(int p_track, float p_time) const {
+real_t Animation::bezier_track_interpolate(int p_track, double p_time) const {
//this uses a different interpolation scheme
ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
Track *track = tracks[p_track];
@@ -2277,14 +2277,14 @@ float Animation::bezier_track_interpolate(int p_track, float p_time) const {
return bt->values[bt->values.size() - 1].value.value;
}
- float t = p_time - bt->values[idx].time;
+ double t = p_time - bt->values[idx].time;
int iterations = 10;
- float duration = bt->values[idx + 1].time - bt->values[idx].time; // time duration between our two keyframes
- float low = 0.0; // 0% of the current animation segment
- float high = 1.0; // 100% of the current animation segment
- float middle;
+ real_t duration = bt->values[idx + 1].time - bt->values[idx].time; // time duration between our two keyframes
+ real_t low = 0.0; // 0% of the current animation segment
+ real_t high = 1.0; // 100% of the current animation segment
+ real_t middle;
Vector2 start(0, bt->values[idx].value.value);
Vector2 start_out = start + bt->values[idx].value.out_handle;
@@ -2307,12 +2307,12 @@ float Animation::bezier_track_interpolate(int p_track, float p_time) const {
//interpolate the result:
Vector2 low_pos = _bezier_interp(low, start, start_out, end_in, end);
Vector2 high_pos = _bezier_interp(high, start, start_out, end_in, end);
- float c = (t - low_pos.x) / (high_pos.x - low_pos.x);
+ real_t c = (t - low_pos.x) / (high_pos.x - low_pos.x);
return low_pos.lerp(high_pos, c).y;
}
-int Animation::audio_track_insert_key(int p_track, float p_time, const RES &p_stream, float p_start_offset, float p_end_offset) {
+int Animation::audio_track_insert_key(int p_track, double p_time, const RES &p_stream, real_t p_start_offset, real_t p_end_offset) {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_AUDIO, -1);
@@ -2352,7 +2352,7 @@ void Animation::audio_track_set_key_stream(int p_track, int p_key, const RES &p_
emit_changed();
}
-void Animation::audio_track_set_key_start_offset(int p_track, int p_key, float p_offset) {
+void Animation::audio_track_set_key_start_offset(int p_track, int p_key, real_t p_offset) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_AUDIO);
@@ -2370,7 +2370,7 @@ void Animation::audio_track_set_key_start_offset(int p_track, int p_key, float p
emit_changed();
}
-void Animation::audio_track_set_key_end_offset(int p_track, int p_key, float p_offset) {
+void Animation::audio_track_set_key_end_offset(int p_track, int p_key, real_t p_offset) {
ERR_FAIL_INDEX(p_track, tracks.size());
Track *t = tracks[p_track];
ERR_FAIL_COND(t->type != TYPE_AUDIO);
@@ -2400,7 +2400,7 @@ RES Animation::audio_track_get_key_stream(int p_track, int p_key) const {
return at->values[p_key].value.stream;
}
-float Animation::audio_track_get_key_start_offset(int p_track, int p_key) const {
+real_t Animation::audio_track_get_key_start_offset(int p_track, int p_key) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
const Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_AUDIO, 0);
@@ -2412,7 +2412,7 @@ float Animation::audio_track_get_key_start_offset(int p_track, int p_key) const
return at->values[p_key].value.start_offset;
}
-float Animation::audio_track_get_key_end_offset(int p_track, int p_key) const {
+real_t Animation::audio_track_get_key_end_offset(int p_track, int p_key) const {
ERR_FAIL_INDEX_V(p_track, tracks.size(), 0);
const Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_AUDIO, 0);
@@ -2426,7 +2426,7 @@ float Animation::audio_track_get_key_end_offset(int p_track, int p_key) const {
//
-int Animation::animation_track_insert_key(int p_track, float p_time, const StringName &p_animation) {
+int Animation::animation_track_insert_key(int p_track, double p_time, const StringName &p_animation) {
ERR_FAIL_INDEX_V(p_track, tracks.size(), -1);
Track *t = tracks[p_track];
ERR_FAIL_COND_V(t->type != TYPE_ANIMATION, -1);
@@ -2470,7 +2470,7 @@ StringName Animation::animation_track_get_key_animation(int p_track, int p_key)
return at->values[p_key].value;
}
-void Animation::set_length(float p_length) {
+void Animation::set_length(real_t p_length) {
if (p_length < ANIM_MIN_LENGTH) {
p_length = ANIM_MIN_LENGTH;
}
@@ -2478,7 +2478,7 @@ void Animation::set_length(float p_length) {
emit_changed();
}
-float Animation::get_length() const {
+real_t Animation::get_length() const {
return length;
}
@@ -2558,12 +2558,12 @@ void Animation::track_swap(int p_track, int p_with_track) {
emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
-void Animation::set_step(float p_step) {
+void Animation::set_step(real_t p_step) {
step = p_step;
emit_changed();
}
-float Animation::get_step() const {
+real_t Animation::get_step() const {
return step;
}
@@ -2708,7 +2708,7 @@ void Animation::clear() {
emit_signal(SceneStringNames::get_singleton()->tracks_changed);
}
-bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err, float p_alowed_angular_err, float p_max_optimizable_angle, const Vector3 &p_norm) {
+bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, real_t p_alowed_linear_err, real_t p_alowed_angular_err, real_t p_max_optimizable_angle, const Vector3 &p_norm) {
real_t c = (t1.time - t0.time) / (t2.time - t0.time);
real_t t[3] = { -1, -1, -1 };
@@ -2727,9 +2727,9 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons
} else {
Vector3 pd = (v2 - v0);
- float d0 = pd.dot(v0);
- float d1 = pd.dot(v1);
- float d2 = pd.dot(v2);
+ real_t d0 = pd.dot(v0);
+ real_t d1 = pd.dot(v1);
+ real_t d2 = pd.dot(v2);
if (d1 < d0 || d1 > d2) {
return false;
}
@@ -2817,9 +2817,9 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons
} else {
Vector3 pd = (v2 - v0);
- float d0 = pd.dot(v0);
- float d1 = pd.dot(v1);
- float d2 = pd.dot(v2);
+ real_t d0 = pd.dot(v0);
+ real_t d1 = pd.dot(v1);
+ real_t d2 = pd.dot(v2);
if (d1 < d0 || d1 > d2) {
return false; //beyond segment range
}
@@ -2875,7 +2875,7 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons
return erase;
}
-void Animation::_transform_track_optimize(int p_idx, float p_allowed_linear_err, float p_allowed_angular_err, float p_max_optimizable_angle) {
+void Animation::_transform_track_optimize(int p_idx, real_t p_allowed_linear_err, real_t p_allowed_angular_err, real_t p_max_optimizable_angle) {
ERR_FAIL_INDEX(p_idx, tracks.size());
ERR_FAIL_COND(tracks[p_idx]->type != TYPE_TRANSFORM3D);
TransformTrack *tt = static_cast<TransformTrack *>(tracks[p_idx]);
@@ -2915,7 +2915,7 @@ void Animation::_transform_track_optimize(int p_idx, float p_allowed_linear_err,
}
}
-void Animation::optimize(float p_allowed_linear_err, float p_allowed_angular_err, float p_max_optimizable_angle) {
+void Animation::optimize(real_t p_allowed_linear_err, real_t p_allowed_angular_err, real_t p_max_optimizable_angle) {
for (int i = 0; i < tracks.size(); i++) {
if (tracks[i]->type == TYPE_TRANSFORM3D) {
_transform_track_optimize(i, p_allowed_linear_err, p_allowed_angular_err, p_max_optimizable_angle);
diff --git a/scene/resources/animation.h b/scene/resources/animation.h
index 920ee2e5ab..6227f6967f 100644
--- a/scene/resources/animation.h
+++ b/scene/resources/animation.h
@@ -76,8 +76,8 @@ private:
};
struct Key {
- float transition = 1.0;
- float time = 0.0; // time in secs
+ real_t transition = 1.0;
+ double time = 0.0; // time in secs
};
// transform key holds either Vector3 or Quaternion
@@ -129,7 +129,7 @@ private:
struct BezierKey {
Vector2 in_handle; //relative (x always <0)
Vector2 out_handle; //relative (x always >0)
- float value = 0.0;
+ real_t value = 0.0;
};
struct BezierTrack : public Track {
@@ -144,8 +144,8 @@ private:
struct AudioKey {
RES stream;
- float start_offset = 0.0; //offset from start
- float end_offset = 0.0; //offset from end, if 0 then full length or infinite
+ real_t start_offset = 0.0; //offset from start
+ real_t end_offset = 0.0; //offset from end, if 0 then full length or infinite
AudioKey() {
}
};
@@ -172,46 +172,46 @@ private:
/*
template<class T>
- int _insert_pos(float p_time, T& p_keys);*/
+ int _insert_pos(double p_time, T& p_keys);*/
template <class T>
void _clear(T &p_keys);
template <class T, class V>
- int _insert(float p_time, T &p_keys, const V &p_value);
+ int _insert(double p_time, T &p_keys, const V &p_value);
template <class K>
- inline int _find(const Vector<K> &p_keys, float p_time) const;
+ inline int _find(const Vector<K> &p_keys, double p_time) const;
- _FORCE_INLINE_ Animation::TransformKey _interpolate(const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, float p_c) const;
+ _FORCE_INLINE_ Animation::TransformKey _interpolate(const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, real_t p_c) const;
- _FORCE_INLINE_ Vector3 _interpolate(const Vector3 &p_a, const Vector3 &p_b, float p_c) const;
- _FORCE_INLINE_ Quaternion _interpolate(const Quaternion &p_a, const Quaternion &p_b, float p_c) const;
- _FORCE_INLINE_ Variant _interpolate(const Variant &p_a, const Variant &p_b, float p_c) const;
- _FORCE_INLINE_ float _interpolate(const float &p_a, const float &p_b, float p_c) const;
+ _FORCE_INLINE_ Vector3 _interpolate(const Vector3 &p_a, const Vector3 &p_b, real_t p_c) const;
+ _FORCE_INLINE_ Quaternion _interpolate(const Quaternion &p_a, const Quaternion &p_b, real_t p_c) const;
+ _FORCE_INLINE_ Variant _interpolate(const Variant &p_a, const Variant &p_b, real_t p_c) const;
+ _FORCE_INLINE_ real_t _interpolate(const real_t &p_a, const real_t &p_b, real_t p_c) const;
- _FORCE_INLINE_ Animation::TransformKey _cubic_interpolate(const Animation::TransformKey &p_pre_a, const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, const Animation::TransformKey &p_post_b, float p_c) const;
- _FORCE_INLINE_ Vector3 _cubic_interpolate(const Vector3 &p_pre_a, const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_post_b, float p_c) const;
- _FORCE_INLINE_ Quaternion _cubic_interpolate(const Quaternion &p_pre_a, const Quaternion &p_a, const Quaternion &p_b, const Quaternion &p_post_b, float p_c) const;
- _FORCE_INLINE_ Variant _cubic_interpolate(const Variant &p_pre_a, const Variant &p_a, const Variant &p_b, const Variant &p_post_b, float p_c) const;
- _FORCE_INLINE_ float _cubic_interpolate(const float &p_pre_a, const float &p_a, const float &p_b, const float &p_post_b, float p_c) const;
+ _FORCE_INLINE_ Animation::TransformKey _cubic_interpolate(const Animation::TransformKey &p_pre_a, const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, const Animation::TransformKey &p_post_b, real_t p_c) const;
+ _FORCE_INLINE_ Vector3 _cubic_interpolate(const Vector3 &p_pre_a, const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_post_b, real_t p_c) const;
+ _FORCE_INLINE_ Quaternion _cubic_interpolate(const Quaternion &p_pre_a, const Quaternion &p_a, const Quaternion &p_b, const Quaternion &p_post_b, real_t p_c) const;
+ _FORCE_INLINE_ Variant _cubic_interpolate(const Variant &p_pre_a, const Variant &p_a, const Variant &p_b, const Variant &p_post_b, real_t p_c) const;
+ _FORCE_INLINE_ real_t _cubic_interpolate(const real_t &p_pre_a, const real_t &p_a, const real_t &p_b, const real_t &p_post_b, real_t p_c) const;
template <class T>
- _FORCE_INLINE_ T _interpolate(const Vector<TKey<T>> &p_keys, float p_time, InterpolationType p_interp, bool p_loop_wrap, bool *p_ok) const;
+ _FORCE_INLINE_ T _interpolate(const Vector<TKey<T>> &p_keys, double p_time, InterpolationType p_interp, bool p_loop_wrap, bool *p_ok) const;
template <class T>
- _FORCE_INLINE_ void _track_get_key_indices_in_range(const Vector<T> &p_array, float from_time, float to_time, List<int> *p_indices) const;
+ _FORCE_INLINE_ void _track_get_key_indices_in_range(const Vector<T> &p_array, double from_time, double to_time, List<int> *p_indices) const;
- _FORCE_INLINE_ void _value_track_get_key_indices_in_range(const ValueTrack *vt, float from_time, float to_time, List<int> *p_indices) const;
- _FORCE_INLINE_ void _method_track_get_key_indices_in_range(const MethodTrack *mt, float from_time, float to_time, List<int> *p_indices) const;
+ _FORCE_INLINE_ void _value_track_get_key_indices_in_range(const ValueTrack *vt, double from_time, double to_time, List<int> *p_indices) const;
+ _FORCE_INLINE_ void _method_track_get_key_indices_in_range(const MethodTrack *mt, double from_time, double to_time, List<int> *p_indices) const;
- float length = 1.0;
- float step = 0.1;
+ double length = 1.0;
+ real_t step = 0.1;
bool loop = false;
// bind helpers
private:
- Array _transform_track_interpolate(int p_track, float p_time) const {
+ Array _transform_track_interpolate(int p_track, double p_time) const {
Vector3 loc;
Quaternion rot;
Vector3 scale;
@@ -223,7 +223,7 @@ private:
return ret;
}
- Vector<int> _value_track_get_key_indices(int p_track, float p_time, float p_delta) const {
+ Vector<int> _value_track_get_key_indices(int p_track, double p_time, double p_delta) const {
List<int> idxs;
value_track_get_key_indices(p_track, p_time, p_delta, &idxs);
Vector<int> idxr;
@@ -233,7 +233,7 @@ private:
}
return idxr;
}
- Vector<int> _method_track_get_key_indices(int p_track, float p_time, float p_delta) const {
+ Vector<int> _method_track_get_key_indices(int p_track, double p_time, double p_delta) const {
List<int> idxs;
method_track_get_key_indices(p_track, p_time, p_delta, &idxs);
Vector<int> idxr;
@@ -244,8 +244,8 @@ private:
return idxr;
}
- bool _transform_track_optimize_key(const TKey<TransformKey> &t0, const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, float p_alowed_linear_err, float p_alowed_angular_err, float p_max_optimizable_angle, const Vector3 &p_norm);
- void _transform_track_optimize(int p_idx, float p_allowed_linear_err = 0.05, float p_allowed_angular_err = 0.01, float p_max_optimizable_angle = Math_PI * 0.125);
+ bool _transform_track_optimize_key(const TKey<TransformKey> &t0, const TKey<TransformKey> &t1, const TKey<TransformKey> &t2, real_t p_alowed_linear_err, real_t p_alowed_angular_err, real_t p_max_optimizable_angle, const Vector3 &p_norm);
+ void _transform_track_optimize(int p_idx, real_t p_allowed_linear_err = 0.05, real_t p_allowed_angular_err = 0.01, real_t p_max_optimizable_angle = Math_PI * 0.125);
protected:
bool _set(const StringName &p_name, const Variant &p_value);
@@ -279,75 +279,75 @@ public:
void track_set_enabled(int p_track, bool p_enabled);
bool track_is_enabled(int p_track) const;
- void track_insert_key(int p_track, float p_time, const Variant &p_key, float p_transition = 1);
- void track_set_key_transition(int p_track, int p_key_idx, float p_transition);
+ void track_insert_key(int p_track, double p_time, const Variant &p_key, real_t p_transition = 1);
+ void track_set_key_transition(int p_track, int p_key_idx, real_t p_transition);
void track_set_key_value(int p_track, int p_key_idx, const Variant &p_value);
- void track_set_key_time(int p_track, int p_key_idx, float p_time);
- int track_find_key(int p_track, float p_time, bool p_exact = false) const;
+ void track_set_key_time(int p_track, int p_key_idx, double p_time);
+ int track_find_key(int p_track, double p_time, bool p_exact = false) const;
void track_remove_key(int p_track, int p_idx);
- void track_remove_key_at_time(int p_track, float p_time);
+ void track_remove_key_at_time(int p_track, double p_time);
int track_get_key_count(int p_track) const;
Variant track_get_key_value(int p_track, int p_key_idx) const;
- float track_get_key_time(int p_track, int p_key_idx) const;
- float track_get_key_transition(int p_track, int p_key_idx) const;
+ double track_get_key_time(int p_track, int p_key_idx) const;
+ real_t track_get_key_transition(int p_track, int p_key_idx) const;
- int transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quaternion &p_rot = Quaternion(), const Vector3 &p_scale = Vector3());
+ int transform_track_insert_key(int p_track, double p_time, const Vector3 &p_loc, const Quaternion &p_rot = Quaternion(), const Vector3 &p_scale = Vector3());
Error transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const;
void track_set_interpolation_type(int p_track, InterpolationType p_interp);
InterpolationType track_get_interpolation_type(int p_track) const;
- int bezier_track_insert_key(int p_track, float p_time, float p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle);
- void bezier_track_set_key_value(int p_track, int p_index, float p_value);
+ int bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle);
+ void bezier_track_set_key_value(int p_track, int p_index, real_t p_value);
void bezier_track_set_key_in_handle(int p_track, int p_index, const Vector2 &p_handle);
void bezier_track_set_key_out_handle(int p_track, int p_index, const Vector2 &p_handle);
- float bezier_track_get_key_value(int p_track, int p_index) const;
+ real_t bezier_track_get_key_value(int p_track, int p_index) const;
Vector2 bezier_track_get_key_in_handle(int p_track, int p_index) const;
Vector2 bezier_track_get_key_out_handle(int p_track, int p_index) const;
- float bezier_track_interpolate(int p_track, float p_time) const;
+ real_t bezier_track_interpolate(int p_track, double p_time) const;
- int audio_track_insert_key(int p_track, float p_time, const RES &p_stream, float p_start_offset = 0, float p_end_offset = 0);
+ int audio_track_insert_key(int p_track, double p_time, const RES &p_stream, real_t p_start_offset = 0, real_t p_end_offset = 0);
void audio_track_set_key_stream(int p_track, int p_key, const RES &p_stream);
- void audio_track_set_key_start_offset(int p_track, int p_key, float p_offset);
- void audio_track_set_key_end_offset(int p_track, int p_key, float p_offset);
+ void audio_track_set_key_start_offset(int p_track, int p_key, real_t p_offset);
+ void audio_track_set_key_end_offset(int p_track, int p_key, real_t p_offset);
RES audio_track_get_key_stream(int p_track, int p_key) const;
- float audio_track_get_key_start_offset(int p_track, int p_key) const;
- float audio_track_get_key_end_offset(int p_track, int p_key) const;
+ real_t audio_track_get_key_start_offset(int p_track, int p_key) const;
+ real_t audio_track_get_key_end_offset(int p_track, int p_key) const;
- int animation_track_insert_key(int p_track, float p_time, const StringName &p_animation);
+ int animation_track_insert_key(int p_track, double p_time, const StringName &p_animation);
void animation_track_set_key_animation(int p_track, int p_key, const StringName &p_animation);
StringName animation_track_get_key_animation(int p_track, int p_key) const;
void track_set_interpolation_loop_wrap(int p_track, bool p_enable);
bool track_get_interpolation_loop_wrap(int p_track) const;
- Error transform_track_interpolate(int p_track, float p_time, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const;
+ Error transform_track_interpolate(int p_track, double p_time, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const;
- Variant value_track_interpolate(int p_track, float p_time) const;
- void value_track_get_key_indices(int p_track, float p_time, float p_delta, List<int> *p_indices) const;
+ Variant value_track_interpolate(int p_track, double p_time) const;
+ void value_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices) const;
void value_track_set_update_mode(int p_track, UpdateMode p_mode);
UpdateMode value_track_get_update_mode(int p_track) const;
- void method_track_get_key_indices(int p_track, float p_time, float p_delta, List<int> *p_indices) const;
+ void method_track_get_key_indices(int p_track, double p_time, double p_delta, List<int> *p_indices) const;
Vector<Variant> method_track_get_params(int p_track, int p_key_idx) const;
StringName method_track_get_name(int p_track, int p_key_idx) const;
void copy_track(int p_track, Ref<Animation> p_to_animation);
- void track_get_key_indices_in_range(int p_track, float p_time, float p_delta, List<int> *p_indices) const;
+ void track_get_key_indices_in_range(int p_track, double p_time, double p_delta, List<int> *p_indices) const;
- void set_length(float p_length);
- float get_length() const;
+ void set_length(real_t p_length);
+ real_t get_length() const;
void set_loop(bool p_enabled);
bool has_loop() const;
- void set_step(float p_step);
- float get_step() const;
+ void set_step(real_t p_step);
+ real_t get_step() const;
void clear();
- void optimize(float p_allowed_linear_err = 0.05, float p_allowed_angular_err = 0.01, float p_max_optimizable_angle = Math_PI * 0.125);
+ void optimize(real_t p_allowed_linear_err = 0.05, real_t p_allowed_angular_err = 0.01, real_t p_max_optimizable_angle = Math_PI * 0.125);
Animation();
~Animation();
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index c13db83d6d..3b666640f8 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -1366,7 +1366,7 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const {
frac /= bake_interval;
}
- return Math::lerp(r[idx], r[idx + 1], frac);
+ return Math::lerp(r[idx], r[idx + 1], (real_t)frac);
}
Vector3 Curve3D::interpolate_baked_up_vector(float p_offset, bool p_apply_tilt) const {
@@ -1424,7 +1424,7 @@ PackedVector3Array Curve3D::get_baked_points() const {
return baked_point_cache;
}
-PackedFloat32Array Curve3D::get_baked_tilts() const {
+Vector<real_t> Curve3D::get_baked_tilts() const {
if (baked_cache_dirty) {
_bake();
}
@@ -1545,7 +1545,7 @@ Dictionary Curve3D::_get_data() const {
PackedVector3Array d;
d.resize(points.size() * 3);
Vector3 *w = d.ptrw();
- PackedFloat32Array t;
+ Vector<real_t> t;
t.resize(points.size());
real_t *wt = t.ptrw();
@@ -1571,7 +1571,7 @@ void Curve3D::_set_data(const Dictionary &p_data) {
ERR_FAIL_COND(pc % 3 != 0);
points.resize(pc / 3);
const Vector3 *r = rp.ptr();
- PackedFloat32Array rtl = p_data["tilts"];
+ Vector<real_t> rtl = p_data["tilts"];
const real_t *rt = rtl.ptr();
for (int i = 0; i < points.size(); i++) {
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 746c6fa597..c25d307608 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -222,7 +222,7 @@ class Curve3D : public Resource {
mutable bool baked_cache_dirty = false;
mutable PackedVector3Array baked_point_cache;
- mutable PackedFloat32Array baked_tilt_cache;
+ mutable Vector<real_t> baked_tilt_cache;
mutable PackedVector3Array baked_up_vector_cache;
mutable float baked_max_ofs = 0.0;
@@ -265,7 +265,7 @@ public:
float interpolate_baked_tilt(float p_offset) const;
Vector3 interpolate_baked_up_vector(float p_offset, bool p_apply_tilt = false) const;
PackedVector3Array get_baked_points() const; //useful for going through
- PackedFloat32Array get_baked_tilts() const; //useful for going through
+ Vector<real_t> get_baked_tilts() const; //useful for going through
PackedVector3Array get_baked_up_vectors() const;
Vector3 get_closest_point(const Vector3 &p_to_point) const;
float get_closest_offset(const Vector3 &p_to_point) const;
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index d0dee2b5e3..efc37709a5 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -863,6 +863,8 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("bar_arrow", "ColorPicker", make_icon(bar_arrow_png));
theme->set_icon("picker_cursor", "ColorPicker", make_icon(picker_cursor_png));
+ // ColorPickerButton
+
theme->set_icon("bg", "ColorPickerButton", make_icon(mini_checkerboard_png));
// TooltipPanel
diff --git a/scene/resources/default_theme/theme_data.h b/scene/resources/default_theme/theme_data.h
index cdb1bc527b..97e64e4746 100644
--- a/scene/resources/default_theme/theme_data.h
+++ b/scene/resources/default_theme/theme_data.h
@@ -50,10 +50,6 @@ static const unsigned char checked_disabled_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x3, 0x0, 0x0, 0x0, 0x28, 0x2d, 0xf, 0x53, 0x0, 0x0, 0x0, 0x9, 0x70, 0x48, 0x59, 0x73, 0x0, 0x0, 0xb, 0x13, 0x0, 0x0, 0xb, 0x13, 0x1, 0x0, 0x9a, 0x9c, 0x18, 0x0, 0x0, 0x0, 0x99, 0x50, 0x4c, 0x54, 0x45, 0x0, 0x0, 0x0, 0x7a, 0x78, 0x83, 0x7a, 0x78, 0x83, 0x73, 0x72, 0x7b, 0x7a, 0x78, 0x83, 0x7a, 0x78, 0x83, 0x7a, 0x78, 0x83, 0x82, 0x80, 0x8a, 0x90, 0x90, 0x93, 0x6a, 0x69, 0x70, 0x6a, 0x68, 0x70, 0x93, 0x93, 0x95, 0x58, 0x58, 0x5c, 0x58, 0x58, 0x5b, 0x7d, 0x7d, 0x7f, 0x58, 0x58, 0x5b, 0xa4, 0xa4, 0xa4, 0x9e, 0x9e, 0xa0, 0x9e, 0x9e, 0x9e, 0x9b, 0x9b, 0x9c, 0x9b, 0x9b, 0x9b, 0x9a, 0x9a, 0x9a, 0x99, 0x99, 0x99, 0x98, 0x98, 0x98, 0x97, 0x97, 0x97, 0x96, 0x96, 0x96, 0x95, 0x95, 0x95, 0x93, 0x93, 0x94, 0x8f, 0x8f, 0x8f, 0x86, 0x86, 0x88, 0x85, 0x85, 0x86, 0x82, 0x82, 0x83, 0x81, 0x81, 0x83, 0x7f, 0x7f, 0x81, 0x7c, 0x7c, 0x7e, 0x7a, 0x7a, 0x7d, 0x78, 0x78, 0x7b, 0x71, 0x71, 0x74, 0x68, 0x68, 0x6c, 0x66, 0x66, 0x6a, 0x65, 0x65, 0x68, 0x63, 0x63, 0x66, 0x5f, 0x5f, 0x63, 0x5c, 0x5c, 0x60, 0x5c, 0x5c, 0x5f, 0x5a, 0x5a, 0x5e, 0x59, 0x59, 0x5d, 0x59, 0x59, 0x5c, 0x58, 0x58, 0x5b, 0x57, 0x57, 0x5a, 0x56, 0x56, 0x59, 0x10, 0x13, 0xbb, 0xf, 0x0, 0x0, 0x0, 0x10, 0x74, 0x52, 0x4e, 0x53, 0x0, 0x7, 0x27, 0x27, 0x50, 0x66, 0x68, 0x6a, 0x81, 0xb4, 0xb4, 0xdd, 0xfa, 0xfa, 0xfb, 0xfb, 0x5b, 0xd1, 0xf1, 0xe6, 0x0, 0x0, 0x0, 0x96, 0x49, 0x44, 0x41, 0x54, 0x78, 0x5e, 0x5d, 0x8f, 0xc9, 0x12, 0x82, 0x30, 0x14, 0x4, 0x87, 0x18, 0x50, 0x51, 0x44, 0x25, 0x42, 0x4, 0x77, 0xc4, 0x8d, 0x97, 0x0, 0xf9, 0xff, 0x8f, 0xb3, 0x88, 0xa4, 0x4a, 0xed, 0x63, 0x5f, 0xa6, 0x7, 0xf8, 0x7, 0x1e, 0xe3, 0x7e, 0x60, 0x19, 0x4f, 0x46, 0x1e, 0x0, 0x36, 0x8d, 0x4c, 0x67, 0x59, 0x65, 0x33, 0x6, 0x80, 0x47, 0xad, 0x56, 0x3d, 0xb7, 0x3c, 0x5d, 0x70, 0x0, 0xbe, 0xd1, 0x44, 0x65, 0x4d, 0x94, 0xc8, 0xc2, 0xf8, 0x0, 0x82, 0x4e, 0x91, 0x94, 0x15, 0x5d, 0xd2, 0xec, 0xde, 0x5, 0x83, 0x38, 0xc8, 0xe3, 0x63, 0x23, 0xce, 0xca, 0x9, 0x7a, 0x6e, 0xf3, 0x93, 0x48, 0x1a, 0x27, 0x14, 0x35, 0x3b, 0xb9, 0x5e, 0x56, 0xe4, 0x84, 0x22, 0xba, 0xa, 0x51, 0xd0, 0xb7, 0xa8, 0xcb, 0xfd, 0xcb, 0x9, 0x3b, 0xfb, 0x41, 0xdb, 0x59, 0x17, 0xa6, 0x94, 0x6e, 0xe3, 0x3e, 0x8c, 0x85, 0xf1, 0x90, 0x6e, 0xe6, 0x21, 0xfb, 0x39, 0xe7, 0x73, 0xe6, 0xfd, 0x5f, 0x7, 0xde, 0xc3, 0xb5, 0x16, 0x87, 0xb0, 0x9e, 0x42, 0x46, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
-static const unsigned char checker_bg_png[] = {
- 0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0x8, 0x0, 0x0, 0x0, 0x0, 0xe1, 0x64, 0xe1, 0x57, 0x0, 0x0, 0x0, 0x14, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0xfc, 0xcf, 0xc0, 0xc0, 0xd0, 0x0, 0xc4, 0xf8, 0x18, 0xf5, 0x84, 0x19, 0x0, 0x9f, 0x5f, 0xa, 0x1, 0xf8, 0xef, 0x65, 0xf4, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
-};
-
static const unsigned char close_png[] = {
0x89, 0x50, 0x4e, 0x47, 0xd, 0xa, 0x1a, 0xa, 0x0, 0x0, 0x0, 0xd, 0x49, 0x48, 0x44, 0x52, 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x10, 0x8, 0x4, 0x0, 0x0, 0x0, 0xb5, 0xfa, 0x37, 0xea, 0x0, 0x0, 0x0, 0x62, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0x63, 0xa0, 0x16, 0xe0, 0x8c, 0xe0, 0x11, 0x43, 0xe6, 0xf3, 0x88, 0x71, 0x46, 0xa0, 0x48, 0x73, 0xfc, 0xe3, 0xb8, 0xcc, 0x23, 0x86, 0x90, 0xe6, 0xb8, 0xcc, 0xf1, 0xf, 0x49, 0x9, 0x8f, 0x28, 0xe7, 0x25, 0x8e, 0xff, 0x1c, 0xd7, 0xb9, 0x24, 0x91, 0x79, 0xdc, 0x12, 0x40, 0xe, 0xa6, 0x12, 0x54, 0x69, 0x4c, 0x25, 0xb7, 0x38, 0xae, 0x21, 0xa4, 0x31, 0x94, 0x80, 0x24, 0x81, 0xf0, 0x36, 0x48, 0x1a, 0xaf, 0x2, 0x88, 0x5b, 0xf0, 0x5a, 0x81, 0xa1, 0x4, 0xe1, 0x34, 0x84, 0x73, 0xb1, 0x4a, 0xa3, 0x7b, 0x9a, 0x70, 0x40, 0x11, 0xe, 0x6a, 0xca, 0x1, 0x0, 0x2a, 0x28, 0x37, 0x83, 0x3e, 0x27, 0xb0, 0x34, 0x0, 0x0, 0x0, 0x0, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
};
diff --git a/scene/resources/height_map_shape_3d.cpp b/scene/resources/height_map_shape_3d.cpp
index de5da944bc..d1a958ad38 100644
--- a/scene/resources/height_map_shape_3d.cpp
+++ b/scene/resources/height_map_shape_3d.cpp
@@ -41,7 +41,7 @@ Vector<Vector3> HeightMapShape3D::get_debug_mesh_lines() const {
Vector2 size(map_width - 1, map_depth - 1);
Vector2 start = size * -0.5;
- const float *r = map_data.ptr();
+ const real_t *r = map_data.ptr();
// reserve some memory for our points..
points.resize(((map_width - 1) * map_depth * 2) + (map_width * (map_depth - 1) * 2) + ((map_width - 1) * (map_depth - 1) * 2));
@@ -105,7 +105,7 @@ void HeightMapShape3D::set_map_width(int p_new) {
int new_size = map_width * map_depth;
map_data.resize(map_width * map_depth);
- float *w = map_data.ptrw();
+ real_t *w = map_data.ptrw();
while (was_size < new_size) {
w[was_size++] = 0.0;
}
@@ -129,7 +129,7 @@ void HeightMapShape3D::set_map_depth(int p_new) {
int new_size = map_width * map_depth;
map_data.resize(new_size);
- float *w = map_data.ptrw();
+ real_t *w = map_data.ptrw();
while (was_size < new_size) {
w[was_size++] = 0.0;
}
@@ -143,7 +143,7 @@ int HeightMapShape3D::get_map_depth() const {
return map_depth;
}
-void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) {
+void HeightMapShape3D::set_map_data(Vector<real_t> p_new) {
int size = (map_width * map_depth);
if (p_new.size() != size) {
// fail
@@ -151,10 +151,10 @@ void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) {
}
// copy
- float *w = map_data.ptrw();
- const float *r = p_new.ptr();
+ real_t *w = map_data.ptrw();
+ const real_t *r = p_new.ptr();
for (int i = 0; i < size; i++) {
- float val = r[i];
+ real_t val = r[i];
w[i] = val;
if (i == 0) {
min_height = val;
@@ -174,7 +174,7 @@ void HeightMapShape3D::set_map_data(PackedFloat32Array p_new) {
notify_change_to_owners();
}
-PackedFloat32Array HeightMapShape3D::get_map_data() const {
+Vector<real_t> HeightMapShape3D::get_map_data() const {
return map_data;
}
@@ -194,7 +194,7 @@ void HeightMapShape3D::_bind_methods() {
HeightMapShape3D::HeightMapShape3D() :
Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_HEIGHTMAP)) {
map_data.resize(map_width * map_depth);
- float *w = map_data.ptrw();
+ real_t *w = map_data.ptrw();
w[0] = 0.0;
w[1] = 0.0;
w[2] = 0.0;
diff --git a/scene/resources/height_map_shape_3d.h b/scene/resources/height_map_shape_3d.h
index 1219791c56..1273aee040 100644
--- a/scene/resources/height_map_shape_3d.h
+++ b/scene/resources/height_map_shape_3d.h
@@ -38,7 +38,7 @@ class HeightMapShape3D : public Shape3D {
int map_width = 2;
int map_depth = 2;
- PackedFloat32Array map_data;
+ Vector<real_t> map_data;
real_t min_height = 0.0;
real_t max_height = 0.0;
@@ -51,8 +51,8 @@ public:
int get_map_width() const;
void set_map_depth(int p_new);
int get_map_depth() const;
- void set_map_data(PackedFloat32Array p_new);
- PackedFloat32Array get_map_data() const;
+ void set_map_data(Vector<real_t> p_new);
+ Vector<real_t> get_map_data() const;
virtual Vector<Vector3> get_debug_mesh_lines() const override;
virtual real_t get_enclosing_radius() const override;
diff --git a/scene/resources/mesh_data_tool.cpp b/scene/resources/mesh_data_tool.cpp
index 3fb4f8f211..04b2437ae8 100644
--- a/scene/resources/mesh_data_tool.cpp
+++ b/scene/resources/mesh_data_tool.cpp
@@ -107,9 +107,9 @@ Error MeshDataTool::create_from_surface(const Ref<ArrayMesh> &p_mesh, int p_surf
bo = arrays[Mesh::ARRAY_BONES].operator Vector<int>().ptr();
}
- const real_t *we = nullptr;
+ const float *we = nullptr;
if (arrays[Mesh::ARRAY_WEIGHTS].get_type() != Variant::NIL) {
- we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<real_t>().ptr();
+ we = arrays[Mesh::ARRAY_WEIGHTS].operator Vector<float>().ptr();
}
vertices.resize(vcount);
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index a08684a506..4dd3c874cb 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -417,9 +417,9 @@ void PolygonPathFinder::_set_data(const Dictionary &p_data) {
}
if (p_data.has("penalties")) {
- Vector<float> penalties = p_data["penalties"];
+ Vector<real_t> penalties = p_data["penalties"];
if (penalties.size() == pc) {
- const float *pr2 = penalties.ptr();
+ const real_t *pr2 = penalties.ptr();
for (int i = 0; i < pc; i++) {
points.write[i].penalty = pr2[i];
}
@@ -445,11 +445,11 @@ Dictionary PolygonPathFinder::_get_data() const {
p.resize(MAX(0, points.size() - 2));
connections.resize(MAX(0, points.size() - 2));
ind.resize(edges.size() * 2);
- Vector<float> penalties;
+ Vector<real_t> penalties;
penalties.resize(MAX(0, points.size() - 2));
{
Vector2 *wp = p.ptrw();
- float *pw = penalties.ptrw();
+ real_t *pw = penalties.ptrw();
for (int i = 0; i < points.size() - 2; i++) {
wp[i] = points[i].pos;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 2b93414906..dbe118a262 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -558,6 +558,12 @@ Error ResourceLoaderText::load() {
resource_current++;
+ int_resources[id] = res; //always assign int resources
+ if (do_assign && cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) {
+ res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE);
+ res->set_scene_unique_id(id);
+ }
+
while (true) {
String assign;
Variant value;
@@ -585,12 +591,6 @@ Error ResourceLoaderText::load() {
}
}
- int_resources[id] = res; //always assign int resources
- if (do_assign && cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) {
- res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE);
- res->set_scene_unique_id(id);
- }
-
if (progress && resources_total > 0) {
*progress = resource_current / float(resources_total);
}
diff --git a/scene/resources/sprite_frames.cpp b/scene/resources/sprite_frames.cpp
index e9adf67559..140c6f821f 100644
--- a/scene/resources/sprite_frames.cpp
+++ b/scene/resources/sprite_frames.cpp
@@ -122,14 +122,14 @@ Vector<String> SpriteFrames::get_animation_names() const {
return names;
}
-void SpriteFrames::set_animation_speed(const StringName &p_anim, float p_fps) {
+void SpriteFrames::set_animation_speed(const StringName &p_anim, double p_fps) {
ERR_FAIL_COND_MSG(p_fps < 0, "Animation speed cannot be negative (" + itos(p_fps) + ").");
Map<StringName, Anim>::Element *E = animations.find(p_anim);
ERR_FAIL_COND_MSG(!E, "Animation '" + String(p_anim) + "' doesn't exist.");
E->get().speed = p_fps;
}
-float SpriteFrames::get_animation_speed(const StringName &p_anim) const {
+double SpriteFrames::get_animation_speed(const StringName &p_anim) const {
const Map<StringName, Anim>::Element *E = animations.find(p_anim);
ERR_FAIL_COND_V_MSG(!E, 0, "Animation '" + String(p_anim) + "' doesn't exist.");
return E->get().speed;
diff --git a/scene/resources/sprite_frames.h b/scene/resources/sprite_frames.h
index 282c5f20ab..fdfd6af5ab 100644
--- a/scene/resources/sprite_frames.h
+++ b/scene/resources/sprite_frames.h
@@ -37,7 +37,7 @@ class SpriteFrames : public Resource {
GDCLASS(SpriteFrames, Resource);
struct Anim {
- float speed = 5.0;
+ double speed = 5.0;
bool loop = true;
Vector<Ref<Texture2D>> frames;
};
@@ -64,8 +64,8 @@ public:
void get_animation_list(List<StringName> *r_animations) const;
Vector<String> get_animation_names() const;
- void set_animation_speed(const StringName &p_anim, float p_fps);
- float get_animation_speed(const StringName &p_anim) const;
+ void set_animation_speed(const StringName &p_anim, double p_fps);
+ double get_animation_speed(const StringName &p_anim) const;
void set_animation_loop(const StringName &p_anim, bool p_loop);
bool get_animation_loop(const StringName &p_anim) const;
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index a23152a6d1..a6815da6f4 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1648,19 +1648,10 @@ void VisualShader::_update_shader() const {
{
//fill render mode enums
int idx = 0;
- bool specular = false;
while (render_mode_enums[idx].string) {
if (shader_mode == render_mode_enums[idx].mode) {
- if (shader_mode == Shader::MODE_SPATIAL) {
- if (String(render_mode_enums[idx].string) == "specular") {
- specular = true;
- }
- }
- if (modes.has(render_mode_enums[idx].string) || specular) {
- int which = 0;
- if (modes.has(render_mode_enums[idx].string)) {
- which = modes[render_mode_enums[idx].string];
- }
+ if (modes.has(render_mode_enums[idx].string)) {
+ int which = modes[render_mode_enums[idx].string];
int count = 0;
for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode)).size(); i++) {
String mode = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader_mode))[i];