From 84f720966c74d5b37f70e21867e9e3e6a1e44c36 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Mon, 1 Feb 2021 21:16:37 -0500 Subject: Use doubles for time in many other places --- editor/plugins/canvas_item_editor_plugin.cpp | 2 +- editor/plugins/canvas_item_editor_plugin.h | 2 +- editor/plugins/gpu_particles_2d_editor_plugin.cpp | 4 ++-- editor/plugins/gpu_particles_3d_editor_plugin.cpp | 4 ++-- editor/plugins/node_3d_editor_plugin.cpp | 6 +++--- editor/plugins/node_3d_editor_plugin.h | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'editor/plugins') diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c440064898..7fe12089c8 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4073,7 +4073,7 @@ void CanvasItemEditor::_popup_warning_depop(Control *p_control) { info_overlay->set_offset(SIDE_LEFT, (show_rulers ? RULER_WIDTH : 0) + 10); } -void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const float p_duration) { +void CanvasItemEditor::_popup_warning_temporarily(Control *p_control, const double p_duration) { Timer *timer; if (!popup_temporarily_timers.has(p_control)) { timer = memnew(Timer); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 1f59dfbc49..efdc75f087 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -540,7 +540,7 @@ private: VSplitContainer *bottom_split; void _update_context_menu_stylebox(); - void _popup_warning_temporarily(Control *p_control, const float p_duration); + void _popup_warning_temporarily(Control *p_control, const double p_duration); void _popup_warning_depop(Control *p_control); void _set_owner_for_node_and_children(Node *p_node, Node *p_owner); diff --git a/editor/plugins/gpu_particles_2d_editor_plugin.cpp b/editor/plugins/gpu_particles_2d_editor_plugin.cpp index 5184e837ce..efec5a709d 100644 --- a/editor/plugins/gpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_2d_editor_plugin.cpp @@ -60,7 +60,7 @@ void GPUParticles2DEditorPlugin::_file_selected(const String &p_file) { void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) { switch (p_idx) { case MENU_GENERATE_VISIBILITY_RECT: { - float gen_time = particles->get_lifetime(); + double gen_time = particles->get_lifetime(); if (gen_time < 1.0) { generate_seconds->set_value(1.0); } else { @@ -100,7 +100,7 @@ void GPUParticles2DEditorPlugin::_menu_callback(int p_idx) { } void GPUParticles2DEditorPlugin::_generate_visibility_rect() { - float time = generate_seconds->get_value(); + double time = generate_seconds->get_value(); float running = 0.0; diff --git a/editor/plugins/gpu_particles_3d_editor_plugin.cpp b/editor/plugins/gpu_particles_3d_editor_plugin.cpp index 8576082597..fff25b6f59 100644 --- a/editor/plugins/gpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_3d_editor_plugin.cpp @@ -282,9 +282,9 @@ void GPUParticles3DEditor::_menu_option(int p_option) { } void GPUParticles3DEditor::_generate_aabb() { - float time = generate_seconds->get_value(); + double time = generate_seconds->get_value(); - float running = 0.0; + double running = 0.0; EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time)); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 931c50fc44..4cb11cc5f1 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2735,7 +2735,7 @@ void Node3DEditorViewport::_notification(int p_what) { if (show_fps) { cpu_time_history[cpu_time_history_index] = RS::get_singleton()->viewport_get_measured_render_time_cpu(viewport->get_viewport_rid()); cpu_time_history_index = (cpu_time_history_index + 1) % FRAME_TIME_HISTORY; - float cpu_time = 0.0; + double cpu_time = 0.0; for (int i = 0; i < FRAME_TIME_HISTORY; i++) { cpu_time += cpu_time_history[i]; } @@ -2745,7 +2745,7 @@ void Node3DEditorViewport::_notification(int p_what) { gpu_time_history[gpu_time_history_index] = RS::get_singleton()->viewport_get_measured_render_time_gpu(viewport->get_viewport_rid()); gpu_time_history_index = (gpu_time_history_index + 1) % FRAME_TIME_HISTORY; - float gpu_time = 0.0; + double gpu_time = 0.0; for (int i = 0; i < FRAME_TIME_HISTORY; i++) { gpu_time += gpu_time_history[i]; } @@ -2769,7 +2769,7 @@ void Node3DEditorViewport::_notification(int p_what) { frame_time_gradient->get_color_at_offset( Math::range_lerp(gpu_time, 0, 30, 0, 1))); - const float fps = 1000.0 / gpu_time; + const double fps = 1000.0 / gpu_time; fps_label->set_text(vformat(TTR("FPS: %d"), fps)); // Middle point is at 60 FPS. fps_label->add_theme_color_override( diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index cb2edbcbc1..0c1456aaf8 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -166,9 +166,9 @@ public: }; private: - float cpu_time_history[FRAME_TIME_HISTORY]; + double cpu_time_history[FRAME_TIME_HISTORY]; int cpu_time_history_index; - float gpu_time_history[FRAME_TIME_HISTORY]; + double gpu_time_history[FRAME_TIME_HISTORY]; int gpu_time_history_index; int index; @@ -336,7 +336,7 @@ private: String last_message; String message; - float message_time; + double message_time; void set_message(String p_message, float p_time = 5); -- cgit v1.2.3