[colobot] 32/62: Make planets stay in one place in the sky - at least in the X direction.
Didier Raboud
odyx at moszumanska.debian.org
Fri Nov 10 11:53:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch debian/master
in repository colobot.
commit 2e8798b33d3b1671249d8653487300f9d1bf21bd
Author: immibis <immibis at gmail.com>
Date: Sat Aug 5 19:45:36 2017 +1200
Make planets stay in one place in the sky - at least in the X direction.
---
src/graphics/engine/planet.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/graphics/engine/planet.cpp b/src/graphics/engine/planet.cpp
index 1aad335..44a3ef8 100644
--- a/src/graphics/engine/planet.cpp
+++ b/src/graphics/engine/planet.cpp
@@ -115,8 +115,16 @@ void CPlanet::Draw()
Math::Point p1, p2;
- float a = eyeDirH + planet.angle.x;
- p1.x = Math::Mod(a, Math::PI*2.0f)-0.5f;
+ // Determine the 2D coordinates of the centre of the planet.
+
+ // Not sure why this is + when you'd expect -. Perhaps one of the angles is inverted.
+ // Compute the camera-relative angles. (0, 0) is straight ahead (the dead centre of the screen).
+
+ // Why -1.0f? Simply because the old formula included that, and we need it to
+ // be consistent for the outer space cutscenes to work.
+ float a = planet.angle.x + eyeDirH - 1.0f;
+ a = Math::Mod(a+Math::PI, Math::PI*2.0f)-Math::PI; // normalize to -pi <= a < pi
+ p1.x = a/m_engine->GetHFovAngle() + 0.5f;
a = eyeDirV + planet.angle.y;
p1.y = 0.4f+(Math::Mod(a+Math::PI, Math::PI*2.0f)-Math::PI)*(2.0f/Math::PI);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list