[Skybox] Small tweaks.
This commit is contained in:
parent
b47fbc9d18
commit
a1ababe8a6
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user