Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cd1a8b3

Browse files
committedJan 26, 2025··
Fix cases where floats are promoted to doubles and then converted back to floats. (-Wdouble-promotion)
1 parent a8476db commit cd1a8b3

File tree

9 files changed

+67
-66
lines changed

9 files changed

+67
-66
lines changed
 

‎include/godot_cpp/core/math.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,14 @@ inline float sinh(float p_x) {
320320
}
321321

322322
inline float sinc(float p_x) {
323-
return p_x == 0 ? 1 : ::sin(p_x) / p_x;
323+
return p_x == 0 ? 1 : ::sinf(p_x) / p_x;
324324
}
325325
inline double sinc(double p_x) {
326326
return p_x == 0 ? 1 : ::sin(p_x) / p_x;
327327
}
328328

329329
inline float sincn(float p_x) {
330-
return (float)sinc(Math_PI * p_x);
330+
return sinc((float)Math_PI * p_x);
331331
}
332332
inline double sincn(double p_x) {
333333
return sinc(Math_PI * p_x);
@@ -653,8 +653,8 @@ inline bool is_equal_approx(double a, double b) {
653653
return true;
654654
}
655655
// Then check for approximate equality.
656-
double tolerance = CMP_EPSILON * abs(a);
657-
if (tolerance < CMP_EPSILON) {
656+
double tolerance = (double)CMP_EPSILON * abs(a);
657+
if (tolerance < (double)CMP_EPSILON) {
658658
tolerance = CMP_EPSILON;
659659
}
660660
return abs(a - b) < tolerance;
@@ -670,7 +670,7 @@ inline bool is_equal_approx(double a, double b, double tolerance) {
670670
}
671671

672672
inline bool is_zero_approx(double s) {
673-
return abs(s) < CMP_EPSILON;
673+
return abs(s) < (double)CMP_EPSILON;
674674
}
675675

676676
inline float absf(float g) {
@@ -769,7 +769,7 @@ inline int fast_ftoi(float a) {
769769
int b;
770770

771771
#if (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0603) || (defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) // windows 8 phone?
772-
b = (int)((a > 0.0) ? (a + 0.5) : (a - 0.5));
772+
b = (int)((a > 0.0f) ? (a + 0.5f) : (a - 0.5f));
773773

774774
#elif defined(_MSC_VER) && _MSC_VER < 1800
775775
__asm fld a __asm fistp b
@@ -788,9 +788,10 @@ inline int fast_ftoi(float a) {
788788
return b;
789789
}
790790

791-
inline double snapped(double p_value, double p_step) {
791+
template<typename T>
792+
inline T snapped(T p_value, T p_step) {
792793
if (p_step != 0) {
793-
p_value = Math::floor(p_value / p_step + 0.5) * p_step;
794+
p_value = Math::floor(p_value / p_step + 0.5f) * p_step;
794795
}
795796
return p_value;
796797
}

‎include/godot_cpp/templates/hashfuncs.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_one_double(double p_in, uint32_t p_s
154154
} u;
155155

156156
// Normalize +/- 0.0 and NaN values so they hash the same.
157-
if (p_in == 0.0f) {
157+
if (p_in == 0.0) {
158158
u.d = 0.0;
159159
} else if (Math::is_nan(p_in)) {
160160
u.d = NAN;
@@ -242,7 +242,7 @@ static _FORCE_INLINE_ uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev
242242
} u;
243243

244244
// Normalize +/- 0.0 and NaN values so they hash the same.
245-
if (p_in == 0.0f) {
245+
if (p_in == 0.0) {
246246
u.d = 0.0;
247247
} else if (Math::is_nan(p_in)) {
248248
u.d = NAN;
@@ -271,7 +271,7 @@ static _FORCE_INLINE_ uint64_t hash_djb2_one_float_64(double p_in, uint64_t p_pr
271271
} u;
272272

273273
// Normalize +/- 0.0 and NaN values so they hash the same.
274-
if (p_in == 0.0f) {
274+
if (p_in == 0.0) {
275275
u.d = 0.0;
276276
} else if (Math::is_nan(p_in)) {
277277
u.d = NAN;

‎include/godot_cpp/variant/color.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,19 @@ struct _NO_DISCARD_ Color {
141141

142142
float cMax = MAX(cRed, MAX(cGreen, cBlue));
143143

144-
float expp = MAX(-B - 1.0f, floor(Math::log(cMax) / (real_t)Math_LN2)) + 1.0f + B;
144+
float expp = MAX(-B - 1.0f, Math::floor(Math::log(cMax) / (real_t)Math_LN2)) + 1.0f + B;
145145

146-
float sMax = (float)floor((cMax / Math::pow(2.0f, expp - B - N)) + 0.5f);
146+
float sMax = Math::floor((cMax / Math::pow(2.0f, expp - B - N)) + 0.5f);
147147

148148
float exps = expp + 1.0f;
149149

150150
if (0.0f <= sMax && sMax < pow2to9) {
151151
exps = expp;
152152
}
153153

154-
float sRed = Math::floor((cRed / pow(2.0f, exps - B - N)) + 0.5f);
155-
float sGreen = Math::floor((cGreen / pow(2.0f, exps - B - N)) + 0.5f);
156-
float sBlue = Math::floor((cBlue / pow(2.0f, exps - B - N)) + 0.5f);
154+
float sRed = Math::floor((cRed / Math::pow(2.0f, exps - B - N)) + 0.5f);
155+
float sGreen = Math::floor((cGreen / Math::pow(2.0f, exps - B - N)) + 0.5f);
156+
float sBlue = Math::floor((cBlue / Math::pow(2.0f, exps - B - N)) + 0.5f);
157157

158158
return (uint32_t(Math::fast_ftoi(sRed)) & 0x1FF) | ((uint32_t(Math::fast_ftoi(sGreen)) & 0x1FF) << 9) | ((uint32_t(Math::fast_ftoi(sBlue)) & 0x1FF) << 18) | ((uint32_t(Math::fast_ftoi(exps)) & 0x1F) << 27);
159159
}

‎include/godot_cpp/variant/projection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct _NO_DISCARD_ Projection {
9898
Projection jitter_offseted(const Vector2 &p_offset) const;
9999

100100
static real_t get_fovy(real_t p_fovx, real_t p_aspect) {
101-
return Math::rad_to_deg(Math::atan(p_aspect * Math::tan(Math::deg_to_rad(p_fovx) * 0.5)) * 2.0);
101+
return Math::rad_to_deg(Math::atan(p_aspect * Math::tan(Math::deg_to_rad(p_fovx) * 0.5f)) * 2.0f);
102102
}
103103

104104
real_t get_z_far() const;

‎include/godot_cpp/variant/vector2.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ Vector2 Vector2::bezier_interpolate(const Vector2 &p_control_1, const Vector2 &p
292292
Vector2 res = *this;
293293

294294
/* Formula from Wikipedia article on Bezier curves. */
295-
real_t omt = (1.0 - p_t);
295+
real_t omt = (1.0f - p_t);
296296
real_t omt2 = omt * omt;
297297
real_t omt3 = omt2 * omt;
298298
real_t t2 = p_t * p_t;
299299
real_t t3 = t2 * p_t;
300300

301-
return res * omt3 + p_control_1 * omt2 * p_t * 3.0 + p_control_2 * omt * t2 * 3.0 + p_end * t3;
301+
return res * omt3 + p_control_1 * omt2 * p_t * 3.0f + p_control_2 * omt * t2 * 3.0f + p_end * t3;
302302
}
303303

304304
Vector2 Vector2::direction_to(const Vector2 &p_to) const {

‎include/godot_cpp/variant/vector3.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ Vector3 Vector3::bezier_interpolate(const Vector3 &p_control_1, const Vector3 &p
277277
Vector3 res = *this;
278278

279279
/* Formula from Wikipedia article on Bezier curves. */
280-
real_t omt = (1.0 - p_t);
280+
real_t omt = (1.0f - p_t);
281281
real_t omt2 = omt * omt;
282282
real_t omt3 = omt2 * omt;
283283
real_t t2 = p_t * p_t;
284284
real_t t3 = t2 * p_t;
285285

286-
return res * omt3 + p_control_1 * omt2 * p_t * 3.0 + p_control_2 * omt * t2 * 3.0 + p_end * t3;
286+
return res * omt3 + p_control_1 * omt2 * p_t * 3.0f + p_control_2 * omt * t2 * 3.0f + p_end * t3;
287287
}
288288

289289
real_t Vector3::distance_to(const Vector3 &p_to) const {

‎src/variant/basis.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ Vector3 Basis::get_euler(EulerOrder p_order) const {
470470
if (rows[1][0] == 0 && rows[0][1] == 0 && rows[1][2] == 0 && rows[2][1] == 0 && rows[1][1] == 1) {
471471
// return the simplest form (human friendlier in editor and scripts)
472472
euler.x = 0;
473-
euler.y = atan2(rows[0][2], rows[0][0]);
473+
euler.y = Math::atan2(rows[0][2], rows[0][0]);
474474
euler.z = 0;
475475
} else {
476476
euler.x = Math::atan2(-rows[1][2], rows[2][2]);
@@ -479,12 +479,12 @@ Vector3 Basis::get_euler(EulerOrder p_order) const {
479479
}
480480
} else {
481481
euler.x = Math::atan2(rows[2][1], rows[1][1]);
482-
euler.y = -Math_PI / 2.0f;
482+
euler.y = (real_t)(-Math_PI / 2.0);
483483
euler.z = 0.0f;
484484
}
485485
} else {
486486
euler.x = Math::atan2(rows[2][1], rows[1][1]);
487-
euler.y = Math_PI / 2.0f;
487+
euler.y = (real_t)(Math_PI / 2.0);
488488
euler.z = 0.0f;
489489
}
490490
return euler;
@@ -508,13 +508,13 @@ Vector3 Basis::get_euler(EulerOrder p_order) const {
508508
// It's -1
509509
euler.x = -Math::atan2(rows[1][2], rows[2][2]);
510510
euler.y = 0.0f;
511-
euler.z = Math_PI / 2.0f;
511+
euler.z = (real_t)(Math_PI / 2.0);
512512
}
513513
} else {
514514
// It's 1
515515
euler.x = -Math::atan2(rows[1][2], rows[2][2]);
516516
euler.y = 0.0f;
517-
euler.z = -Math_PI / 2.0f;
517+
euler.z = (real_t)(-Math_PI / 2.0);
518518
}
519519
return euler;
520520
}
@@ -535,22 +535,22 @@ Vector3 Basis::get_euler(EulerOrder p_order) const {
535535
// is this a pure X rotation?
536536
if (rows[1][0] == 0 && rows[0][1] == 0 && rows[0][2] == 0 && rows[2][0] == 0 && rows[0][0] == 1) {
537537
// return the simplest form (human friendlier in editor and scripts)
538-
euler.x = atan2(-m12, rows[1][1]);
538+
euler.x = Math::atan2(-m12, rows[1][1]);
539539
euler.y = 0;
540540
euler.z = 0;
541541
} else {
542-
euler.x = asin(-m12);
543-
euler.y = atan2(rows[0][2], rows[2][2]);
544-
euler.z = atan2(rows[1][0], rows[1][1]);
542+
euler.x = Math::asin(-m12);
543+
euler.y = Math::atan2(rows[0][2], rows[2][2]);
544+
euler.z = Math::atan2(rows[1][0], rows[1][1]);
545545
}
546546
} else { // m12 == -1
547-
euler.x = Math_PI * 0.5f;
548-
euler.y = atan2(rows[0][1], rows[0][0]);
547+
euler.x = (real_t)(Math_PI * 0.5);
548+
euler.y = Math::atan2(rows[0][1], rows[0][0]);
549549
euler.z = 0;
550550
}
551551
} else { // m12 == 1
552-
euler.x = -Math_PI * 0.5f;
553-
euler.y = -atan2(rows[0][1], rows[0][0]);
552+
euler.x = (real_t)(-Math_PI * 0.5);
553+
euler.y = -Math::atan2(rows[0][1], rows[0][0]);
554554
euler.z = 0;
555555
}
556556

@@ -575,13 +575,13 @@ Vector3 Basis::get_euler(EulerOrder p_order) const {
575575
// It's -1
576576
euler.x = Math::atan2(rows[2][1], rows[2][2]);
577577
euler.y = 0.0f;
578-
euler.z = -Math_PI / 2.0f;
578+
euler.z = (real_t)(-Math_PI / 2.0);
579579
}
580580
} else {
581581
// It's 1
582582
euler.x = Math::atan2(rows[2][1], rows[2][2]);
583583
euler.y = 0.0f;
584-
euler.z = Math_PI / 2.0f;
584+
euler.z = (real_t)(Math_PI / 2.0);
585585
}
586586
return euler;
587587
}
@@ -601,13 +601,13 @@ Vector3 Basis::get_euler(EulerOrder p_order) const {
601601
euler.z = Math::atan2(-rows[0][1], rows[1][1]);
602602
} else {
603603
// It's -1
604-
euler.x = -Math_PI / 2.0f;
604+
euler.x = (real_t)(-Math_PI / 2.0);
605605
euler.y = Math::atan2(rows[0][2], rows[0][0]);
606606
euler.z = 0;
607607
}
608608
} else {
609609
// It's 1
610-
euler.x = Math_PI / 2.0f;
610+
euler.x = (real_t)(Math_PI / 2.0);
611611
euler.y = Math::atan2(rows[0][2], rows[0][0]);
612612
euler.z = 0;
613613
}
@@ -630,13 +630,13 @@ Vector3 Basis::get_euler(EulerOrder p_order) const {
630630
} else {
631631
// It's -1
632632
euler.x = 0;
633-
euler.y = Math_PI / 2.0f;
633+
euler.y = (real_t)(Math_PI / 2.0);
634634
euler.z = -Math::atan2(rows[0][1], rows[1][1]);
635635
}
636636
} else {
637637
// It's 1
638638
euler.x = 0;
639-
euler.y = -Math_PI / 2.0f;
639+
euler.y = (real_t)(-Math_PI / 2.0);
640640
euler.z = -Math::atan2(rows[0][1], rows[1][1]);
641641
}
642642
return euler;
@@ -816,7 +816,7 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
816816
return;
817817
}
818818
// As we have reached here there are no singularities so we can handle normally.
819-
double s = Math::sqrt((rows[2][1] - rows[1][2]) * (rows[2][1] - rows[1][2]) + (rows[0][2] - rows[2][0]) * (rows[0][2] - rows[2][0]) + (rows[1][0] - rows[0][1]) * (rows[1][0] - rows[0][1])); // Used to normalize.
819+
real_t s = Math::sqrt((rows[2][1] - rows[1][2]) * (rows[2][1] - rows[1][2]) + (rows[0][2] - rows[2][0]) * (rows[0][2] - rows[2][0]) + (rows[1][0] - rows[0][1]) * (rows[1][0] - rows[0][1])); // Used to normalize.
820820

821821
if (Math::abs(s) < CMP_EPSILON) {
822822
// Prevent divide by zero, should not happen if matrix is orthogonal and should be caught by singularity test above.
@@ -939,9 +939,9 @@ void Basis::rotate_sh(real_t *p_values) {
939939
const static real_t s_c_scale = 1.0 / 0.91529123286551084;
940940
const static real_t s_c_scale_inv = 0.91529123286551084;
941941

942-
const static real_t s_rc2 = 1.5853309190550713 * s_c_scale;
942+
const static real_t s_rc2 = (real_t)1.5853309190550713 * s_c_scale;
943943
const static real_t s_c4_div_c3 = s_c4 / s_c3;
944-
const static real_t s_c4_div_c3_x2 = (s_c4 / s_c3) * 2.0;
944+
const static real_t s_c4_div_c3_x2 = (s_c4 / s_c3) * (real_t)2.0;
945945

946946
const static real_t s_scale_dst2 = s_c3 * s_c_scale_inv;
947947
const static real_t s_scale_dst4 = s_c5 * s_c_scale_inv;

‎src/variant/projection.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ Projection Projection ::jitter_offseted(const Vector2 &p_offset) const {
253253

254254
void Projection::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov) {
255255
if (p_flip_fov) {
256-
p_fovy_degrees = get_fovy(p_fovy_degrees, 1.0 / p_aspect);
256+
p_fovy_degrees = get_fovy(p_fovy_degrees, 1.0f / p_aspect);
257257
}
258258

259259
real_t sine, cotangent, deltaZ;
260-
real_t radians = Math::deg_to_rad(p_fovy_degrees / 2.0);
260+
real_t radians = Math::deg_to_rad(p_fovy_degrees / 2.0f);
261261

262262
deltaZ = p_z_far - p_z_near;
263263
sine = Math::sin(radians);
@@ -279,30 +279,30 @@ void Projection::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t
279279

280280
void Projection::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far, bool p_flip_fov, int p_eye, real_t p_intraocular_dist, real_t p_convergence_dist) {
281281
if (p_flip_fov) {
282-
p_fovy_degrees = get_fovy(p_fovy_degrees, 1.0 / p_aspect);
282+
p_fovy_degrees = get_fovy(p_fovy_degrees, 1.0f / p_aspect);
283283
}
284284

285285
real_t left, right, modeltranslation, ymax, xmax, frustumshift;
286286

287-
ymax = p_z_near * tan(Math::deg_to_rad(p_fovy_degrees / 2.0));
287+
ymax = p_z_near * Math::tan(Math::deg_to_rad(p_fovy_degrees / 2.0f));
288288
xmax = ymax * p_aspect;
289-
frustumshift = (p_intraocular_dist / 2.0) * p_z_near / p_convergence_dist;
289+
frustumshift = (p_intraocular_dist / 2.0f) * p_z_near / p_convergence_dist;
290290

291291
switch (p_eye) {
292292
case 1: { // left eye
293293
left = -xmax + frustumshift;
294294
right = xmax + frustumshift;
295-
modeltranslation = p_intraocular_dist / 2.0;
295+
modeltranslation = p_intraocular_dist / 2.0f;
296296
} break;
297297
case 2: { // right eye
298298
left = -xmax - frustumshift;
299299
right = xmax - frustumshift;
300-
modeltranslation = -p_intraocular_dist / 2.0;
300+
modeltranslation = -p_intraocular_dist / 2.0f;
301301
} break;
302302
default: { // mono, should give the same result as set_perspective(p_fovy_degrees,p_aspect,p_z_near,p_z_far,p_flip_fov)
303303
left = -xmax;
304304
right = xmax;
305-
modeltranslation = 0.0;
305+
modeltranslation = 0.0f;
306306
} break;
307307
}
308308

@@ -317,13 +317,13 @@ void Projection::set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t
317317

318318
void Projection::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_dist, real_t p_display_width, real_t p_display_to_lens, real_t p_oversample, real_t p_z_near, real_t p_z_far) {
319319
// we first calculate our base frustum on our values without taking our lens magnification into account.
320-
real_t f1 = (p_intraocular_dist * 0.5) / p_display_to_lens;
321-
real_t f2 = ((p_display_width - p_intraocular_dist) * 0.5) / p_display_to_lens;
322-
real_t f3 = (p_display_width / 4.0) / p_display_to_lens;
320+
real_t f1 = (p_intraocular_dist * 0.5f) / p_display_to_lens;
321+
real_t f2 = ((p_display_width - p_intraocular_dist) * 0.5f) / p_display_to_lens;
322+
real_t f3 = (p_display_width / 4.0f) / p_display_to_lens;
323323

324324
// now we apply our oversample factor to increase our FOV. how much we oversample is always a balance we strike between performance and how much
325325
// we're willing to sacrifice in FOV.
326-
real_t add = ((f1 + f2) * (p_oversample - 1.0)) / 2.0;
326+
real_t add = ((f1 + f2) * (p_oversample - 1.0f)) / 2.0f;
327327
f1 += add;
328328
f2 += add;
329329
f3 *= p_oversample;
@@ -346,13 +346,13 @@ void Projection::set_for_hmd(int p_eye, real_t p_aspect, real_t p_intraocular_di
346346
void Projection::set_orthogonal(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_znear, real_t p_zfar) {
347347
set_identity();
348348

349-
columns[0][0] = 2.0 / (p_right - p_left);
349+
columns[0][0] = 2.0f / (p_right - p_left);
350350
columns[3][0] = -((p_right + p_left) / (p_right - p_left));
351-
columns[1][1] = 2.0 / (p_top - p_bottom);
351+
columns[1][1] = 2.0f / (p_top - p_bottom);
352352
columns[3][1] = -((p_top + p_bottom) / (p_top - p_bottom));
353-
columns[2][2] = -2.0 / (p_zfar - p_znear);
353+
columns[2][2] = -2.0f / (p_zfar - p_znear);
354354
columns[3][2] = -((p_zfar + p_znear) / (p_zfar - p_znear));
355-
columns[3][3] = 1.0;
355+
columns[3][3] = 1.0f;
356356
}
357357

358358
void Projection::set_orthogonal(real_t p_size, real_t p_aspect, real_t p_znear, real_t p_zfar, bool p_flip_fov) {
@@ -670,7 +670,7 @@ void Projection::invert() {
670670
}
671671

672672
/** Replace pivot by reciprocal (at last we can touch it). **/
673-
columns[k][k] = 1.0 / pvt_val;
673+
columns[k][k] = 1.0f / pvt_val;
674674
}
675675

676676
/* That was most of the work, one final pass of row/column interchange */
@@ -804,11 +804,11 @@ real_t Projection::get_aspect() const {
804804
int Projection::get_pixels_per_meter(int p_for_pixel_width) const {
805805
Vector3 result = xform(Vector3(1, 0, -1));
806806

807-
return int((result.x * 0.5 + 0.5) * p_for_pixel_width);
807+
return int((result.x * 0.5f + 0.5f) * p_for_pixel_width);
808808
}
809809

810810
bool Projection::is_orthogonal() const {
811-
return columns[3][3] == 1.0;
811+
return columns[3][3] == 1.0f;
812812
}
813813

814814
real_t Projection::get_fov() const {
@@ -821,7 +821,7 @@ real_t Projection::get_fov() const {
821821
right_plane.normalize();
822822

823823
if ((matrix[8] == 0) && (matrix[9] == 0)) {
824-
return Math::rad_to_deg(Math::acos(Math::abs(right_plane.normal.x))) * 2.0;
824+
return Math::rad_to_deg(Math::acos(Math::abs(right_plane.normal.x))) * 2.0f;
825825
} else {
826826
// our frustum is asymmetrical need to calculate the left planes angle separately..
827827
Plane left_plane = Plane(matrix[3] + matrix[0],
@@ -839,8 +839,8 @@ float Projection::get_lod_multiplier() const {
839839
return get_viewport_half_extents().x;
840840
} else {
841841
float zn = get_z_near();
842-
float width = get_viewport_half_extents().x * 2.0;
843-
return 1.0 / (zn / width);
842+
float width = get_viewport_half_extents().x * 2.0f;
843+
return 1.0f / (zn / width);
844844
}
845845

846846
// Usage is lod_size / (lod_distance * multiplier) < threshold

‎src/variant/quaternion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Quaternion Quaternion::slerp(const Quaternion &p_to, real_t p_weight) const {
137137
// standard case (slerp)
138138
omega = Math::acos(cosom);
139139
sinom = Math::sin(omega);
140-
scale0 = Math::sin((1.0 - p_weight) * omega) / sinom;
140+
scale0 = Math::sin((1.0f - p_weight) * omega) / sinom;
141141
scale1 = Math::sin(p_weight * omega) / sinom;
142142
} else {
143143
// "from" and "to" quaternions are very close

0 commit comments

Comments
 (0)
Please sign in to comment.