summaryrefslogtreecommitdiff
path: root/Userland/Demos/Cube
diff options
context:
space:
mode:
authorNicholas-Baron <nicholas.baron.ten@gmail.com>2021-04-15 00:36:14 -0700
committerAndreas Kling <kling@serenityos.org>2021-04-16 19:01:54 +0200
commit73dd293ec4ffcfefae9db8e10eaaa84d4a4be4a8 (patch)
tree835bd47b8c14f8af6b070f1adbeef630db28d5a9 /Userland/Demos/Cube
parent6606d70826b21c803742ed2b971d061b7f3497e3 (diff)
downloadserenity-73dd293ec4ffcfefae9db8e10eaaa84d4a4be4a8.zip
Everywhere: Add `-Wdouble-promotion` warning
This warning informs of float-to-double conversions. The best solution seems to be to do math *either* in 32-bit *or* in 64-bit, and only to cross over when absolutely necessary.
Diffstat (limited to 'Userland/Demos/Cube')
-rw-r--r--Userland/Demos/Cube/Cube.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Demos/Cube/Cube.cpp b/Userland/Demos/Cube/Cube.cpp
index 807fcf8595..0758c71981 100644
--- a/Userland/Demos/Cube/Cube.cpp
+++ b/Userland/Demos/Cube/Cube.cpp
@@ -177,12 +177,12 @@ void Cube::timer_event(Core::TimerEvent&)
normal.normalize();
// Perspective projection
- a.set_x(WIDTH / 2 + a.x() / (1 + a.z() * 0.35) * WIDTH / 3);
- a.set_y(HEIGHT / 2 - a.y() / (1 + a.z() * 0.35) * WIDTH / 3);
- b.set_x(WIDTH / 2 + b.x() / (1 + b.z() * 0.35) * WIDTH / 3);
- b.set_y(HEIGHT / 2 - b.y() / (1 + b.z() * 0.35) * WIDTH / 3);
- c.set_x(WIDTH / 2 + c.x() / (1 + c.z() * 0.35) * WIDTH / 3);
- c.set_y(HEIGHT / 2 - c.y() / (1 + c.z() * 0.35) * WIDTH / 3);
+ a.set_x(WIDTH / 2 + a.x() / (1 + a.z() * 0.35f) * WIDTH / 3);
+ a.set_y(HEIGHT / 2 - a.y() / (1 + a.z() * 0.35f) * WIDTH / 3);
+ b.set_x(WIDTH / 2 + b.x() / (1 + b.z() * 0.35f) * WIDTH / 3);
+ b.set_y(HEIGHT / 2 - b.y() / (1 + b.z() * 0.35f) * WIDTH / 3);
+ c.set_x(WIDTH / 2 + c.x() / (1 + c.z() * 0.35f) * WIDTH / 3);
+ c.set_y(HEIGHT / 2 - c.y() / (1 + c.z() * 0.35f) * WIDTH / 3);
float winding = (b.x() - a.x()) * (c.y() - a.y()) - (b.y() - a.y()) * (c.x() - a.x());
if (winding < 0)