From 11608132133a160e465dec3d7851be7f871462ab Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Tue, 14 Jul 2020 21:36:05 +0200 Subject: [PATCH] [Skybox] Small tweaks. --- source/client/graphics/CelestialObject.cpp | 2 +- source/client/graphics/Skybox.cpp | 8 ++++---- source/client/states/GameState.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/client/graphics/CelestialObject.cpp b/source/client/graphics/CelestialObject.cpp index 9432744e8..d1a073bbf 100644 --- a/source/client/graphics/CelestialObject.cpp +++ b/source/client/graphics/CelestialObject.cpp @@ -58,7 +58,7 @@ void CelestialObject::updateVertexBuffer() const { } void CelestialObject::draw(gk::RenderTarget &target, gk::RenderStates states) const { - states.transform.rotate(-fmod(gk::GameClock::getInstance().getTicks() * 4 / 1000.f, 360), {0, 1, 0}); + states.transform.rotate(-fmod(gk::GameClock::getInstance().getTicks() * 1.f / 1000.f, 360), {0, 1, 0}); states.transform *= getTransform(); states.vertexAttributes = VertexAttribute::All; diff --git a/source/client/graphics/Skybox.cpp b/source/client/graphics/Skybox.cpp index 9f449dd75..1e261845c 100644 --- a/source/client/graphics/Skybox.cpp +++ b/source/client/graphics/Skybox.cpp @@ -33,10 +33,10 @@ Skybox::Skybox(gk::Camera &camera) : m_camera(camera) { m_shader.linkProgram(); m_sun.setColor(gk::Color::Yellow); - m_sun.setPosition(150, -10, -10); + m_sun.setPosition(300, -10, -10); - m_moon.setColor(gk::Color::White); - m_moon.setPosition(-150, -10, -10); + m_moon.setColor(gk::Color{240, 240, 240}); + m_moon.setPosition(-300, -10, -10); } void Skybox::draw(gk::RenderTarget &target, gk::RenderStates states) const { @@ -44,7 +44,7 @@ void Skybox::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(cameraPosition.x, cameraPosition.y, cameraPosition.z); + states.transform.translate(cameraPosition.x, cameraPosition.y, cameraPosition.z - 50); target.draw(m_sun, states); target.draw(m_moon, states); diff --git a/source/client/states/GameState.cpp b/source/client/states/GameState.cpp index 6cbc1f48c..06a8b653f 100644 --- a/source/client/states/GameState.cpp +++ b/source/client/states/GameState.cpp @@ -58,7 +58,7 @@ GameState::GameState() m_clientCommandHandler.setupCallbacks(); m_camera.setAspectRatio((float)Config::screenWidth / Config::screenHeight); - m_camera.setFarClippingPlane(10000.0f); + m_camera.setFarClippingPlane(1000.0f); m_world.setClient(m_clientCommandHandler); m_world.setCamera(m_player.camera()); @@ -201,7 +201,7 @@ void GameState::onGuiScaleChanged(const GuiScaleChangedEvent &event) { } void GameState::draw(gk::RenderTarget &target, gk::RenderStates states) const { - float time = std::fmod(gk::GameClock::getInstance().getTicks() * 4.f / 1000.f, 360.f) / 360.f; + float time = std::fmod(gk::GameClock::getInstance().getTicks() * 1.f / 1000.f, 360.f) / 360.f; if (m_world.sky()) { const float pi = 3.1415927f; float sunlight = std::clamp(0.5f + std::sin(2 * pi * time) * 2.0f, 0.0f, 1.0f);