diff --git a/include/core/Config.hpp b/include/core/Config.hpp index 88ec4d1..fd8f2a3 100644 --- a/include/core/Config.hpp +++ b/include/core/Config.hpp @@ -12,6 +12,7 @@ struct Config { float fov{glm::radians(90.0f)}; // Vertical fov in radians float near{10.0f}; float far{100000.0f}; + glm::vec3 sky_color{0.0f}; // camera CameraController::Type camera_controller_type{CameraController::Type::UNITY}; diff --git a/src/core/Serializer.cpp b/src/core/Serializer.cpp index 85ae134..3c853c6 100644 --- a/src/core/Serializer.cpp +++ b/src/core/Serializer.cpp @@ -61,6 +61,7 @@ nlohmann::json Serializer::serialize(Config const& source) const target["fov"] = source.fov; target["near"] = source.near; target["far"] = source.far; + target["sky_color"] = source.sky_color; target["camera_controller_type"] = source.camera_controller_type; target["movement_speed"] = source.movement_speed; target["rotation_speed"] = source.rotation_speed; @@ -129,6 +130,7 @@ Config Serializer::deserialize_config(nlohmann::json& source) const .fov = source["fov"], .near = source["near"], .far = source["far"], + .sky_color = source["sky_color"], .camera_controller_type = source["camera_controller_type"], .movement_speed = source["movement_speed"], .rotation_speed = source["rotation_speed"], diff --git a/src/renderer/Camera.cpp b/src/renderer/Camera.cpp index d68e524..cec9e63 100644 --- a/src/renderer/Camera.cpp +++ b/src/renderer/Camera.cpp @@ -155,7 +155,12 @@ void Camera::draw(ViewingMode mode, shader.use(); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.id); + + auto& sky_color = Project::get_current()->config.sky_color; + glClearColor(sky_color.r, sky_color.g, sky_color.b, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glViewport(0, 0, framebuffer.width, framebuffer.height); // view/projection transformations diff --git a/src/ui/SettingsPane.cpp b/src/ui/SettingsPane.cpp index 6b0c2af..a140eef 100644 --- a/src/ui/SettingsPane.cpp +++ b/src/ui/SettingsPane.cpp @@ -73,6 +73,7 @@ void SettingsPane::render() ImGui::SeparatorText("Textures"); ImGui::ColorEdit3("Fallback Texture Color", &config.fallback_color[0]); + ImGui::ColorEdit3("Sky Color", &config.sky_color[0]); } ImGui::End(); }