diff --git a/projects/voxelization/CMakeLists.txt b/projects/voxelization/CMakeLists.txt index 33cfaef6197079b72ab2f295a4503e80be724db4..bc87996096226af4e3f3d05c3e10bb287c61cc8d 100644 --- a/projects/voxelization/CMakeLists.txt +++ b/projects/voxelization/CMakeLists.txt @@ -26,7 +26,7 @@ if(MSVC) endif() # including headers of dependencies and the VkCV framework -target_include_directories(voxelization SYSTEM BEFORE PRIVATE ${vkcv_include} ${vkcv_includes} ${vkcv_asset_loader_include} ${vkcv_camera_include} ${vkcv_shader_compiler_include}) +target_include_directories(voxelization SYSTEM BEFORE PRIVATE ${vkcv_include} ${vkcv_includes} ${vkcv_asset_loader_include} ${vkcv_camera_include} ${vkcv_shader_compiler_include} ${vkcv_gui_include}) # linking with libraries from all dependencies and the VkCV framework -target_link_libraries(voxelization vkcv ${vkcv_libraries} vkcv_asset_loader ${vkcv_asset_loader_libraries} vkcv_camera vkcv_shader_compiler) +target_link_libraries(voxelization vkcv ${vkcv_libraries} vkcv_asset_loader ${vkcv_asset_loader_libraries} vkcv_camera vkcv_shader_compiler vkcv_gui) diff --git a/projects/voxelization/src/main.cpp b/projects/voxelization/src/main.cpp index 684e78111821df546e95d8a2caf6b10e4d6744ae..ec8153e735553e26f3b1b2cafe06950398bb5308 100644 --- a/projects/voxelization/src/main.cpp +++ b/projects/voxelization/src/main.cpp @@ -8,6 +8,7 @@ #include <vkcv/Logger.hpp> #include "Voxelization.hpp" #include <glm/glm.hpp> +#include "vkcv/gui/GUI.hpp" int main(int argc, const char** argv) { const char* applicationName = "Voxelization"; @@ -318,6 +319,10 @@ int main(int argc, const char** argv) { voxelDependencies.vertexLayout = vertexLayout; Voxelization voxelization(&core, voxelDependencies); + vkcv::gui::GUI gui(core, window); + + glm::vec2 lightAngles(90.f, 0.f); + auto start = std::chrono::system_clock::now(); const auto appStartTime = start; while (window.isWindowOpen()) { @@ -349,10 +354,11 @@ int main(int argc, const char** argv) { start = end; cameraManager.update(0.000001 * static_cast<double>(deltatime.count())); - auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - appStartTime); - - const float sunTheta = 0.001f * static_cast<float>(duration.count()); - lightInfo.direction = glm::normalize(glm::vec3(std::cos(sunTheta), 1, std::sin(sunTheta))); + glm::vec2 lightAngleRadian = glm::radians(lightAngles); + lightInfo.direction = glm::normalize(glm::vec3( + std::cos(lightAngleRadian.x) * std::cos(lightAngleRadian.y), + std::sin(lightAngleRadian.x), + std::cos(lightAngleRadian.x) * std::sin(lightAngleRadian.y))); const float shadowProjectionSize = 20.f; glm::mat4 projectionLight = glm::ortho( @@ -440,6 +446,14 @@ int main(int argc, const char** argv) { core.prepareSwapchainImageForPresent(cmdStream); core.submitCommandStream(cmdStream); + gui.beginGUI(); + + ImGui::Begin("Settings"); + ImGui::DragFloat2("Light angles", &lightAngles.x); + ImGui::End(); + + gui.endGUI(); + core.endFrame(); }