1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Improve set_radial_initial_angle by removing loops

(cherry picked from commit 46dfd9747a)
This commit is contained in:
arkology
2024-11-19 21:12:39 +03:00
committed by lawnjelly
parent ff5ff386c5
commit f11dd599c9
2 changed files with 7 additions and 5 deletions

View File

@@ -31,6 +31,7 @@
#include "texture_progress.h"
#include "core/engine.h"
#include "math.h"
void TextureProgress::set_under_texture(const Ref<Texture> &p_texture) {
under = p_texture;
@@ -577,12 +578,12 @@ int TextureProgress::get_fill_mode() {
}
void TextureProgress::set_radial_initial_angle(float p_angle) {
while (p_angle > 360) {
p_angle -= 360;
}
while (p_angle < 0) {
p_angle += 360;
ERR_FAIL_COND_MSG(!isfinite(p_angle), "Angle is non-finite.");
if (p_angle < 0.0 || p_angle > 360.0) {
p_angle = Math::fposmod(p_angle, 360.0f);
}
rad_init_angle = p_angle;
update();
}