Change calls to rotate() to calls to rotateX/Y/Z

Mostly cosmetic, but will also optimize some operations if the compiler is not smart enough.

Also fix a typo in a comment.
master
Pedro Gimeno 2020-07-29 01:55:54 +02:00
parent dd8df8bf78
commit 180123c0b7
6 changed files with 7 additions and 7 deletions

2
external/gamekit vendored

@ -1 +1 @@
Subproject commit ca131a8af626b9def9d0335f2a00f395a27b65b2
Subproject commit f0285a38170f3f59963b56bbb3347a6321f7e064

View File

@ -101,7 +101,7 @@ void CelestialObject::updateAxisTransform() const {
// The axis is completely vertical. This does not make much sense,
// because the sun and the moon will rotate horizontally following
// the horizon, but let's not crash! There are infinite rotations
// thatcan keep the sun and moon in the horizon. Let's pick one:
// that can keep the sun and moon in the horizon. Let's pick one:
// local X axis pointing to world's X, local Y axis pointing to
// world's Z, and local Z axis pointing to world's -Y. That places
// Polaris at the top, and the sun to the East at 6:00 and to the

View File

@ -274,7 +274,7 @@ void PlayerBox::draw(gk::RenderTarget &target, gk::RenderStates states) const {
// Subtract the camera position - see comment in ClientWorld::draw()
const gk::Vector3d &cameraPosition = m_camera.getDPosition();
states.transform.translate(m_x - cameraPosition.x, m_y - cameraPosition.y, m_z - cameraPosition.z);
states.transform.rotate(m_viewAngleH, gk::Vector3{0, 0, 1});
states.transform.rotateZ(m_viewAngleH);
states.transform *= getTransform();
states.texture = &m_texture;

View File

@ -95,7 +95,7 @@ void Skybox::loadSky(const Sky &sky) {
star.setPosition(v.x, v.y, v.z);
// Rotate the star to make it face the camera
star.rotate(atan2f(v.y, v.x) * float(180./M_PI), gk::Vector3f{0.f, 0.f, 1.f});
star.rotateZ(atan2f(v.y, v.x) * float(180./M_PI));
// Set a random rotation in the day cycle
star.setRotationOffset(rand() % GameTime::dayLength);

View File

@ -51,8 +51,8 @@ InventoryCube::InventoryCube(float size, bool isEntity)
// NOTE: intrinsic rotations! The axis is the local axis of the object.
// Note also that we start looking at the bottom of the cube due to how
// glm::ortho is used (see comment below).
m_transform.rotate(120.f, {1, 0, 0});
m_transform.rotate(-45.f, {0, 0, 1});
m_transform.rotateX(120.f);
m_transform.rotateZ(-45.f);
}
}

View File

@ -72,7 +72,7 @@ void Minimap::update(const ClientPlayer &player, class ClientWorld &world) {
}
m_playerFovRotationTransform = gk::Transform::Identity;
m_playerFovRotationTransform.rotate(player.cameraYaw() - 90.f, {0, 0, -1});
m_playerFovRotationTransform.rotateZ(90.f - player.cameraYaw());
static float oldCameraFov = Config::cameraFOV;
static u16 oldRenderDistance = Config::renderDistance;