Skip to content
Snippets Groups Projects
Commit 18a5ce25 authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#81] Add gui

parent bdbb57ea
No related branches found
No related tags found
1 merge request!68Resolve "Complete Voxelization"
...@@ -26,7 +26,7 @@ if(MSVC) ...@@ -26,7 +26,7 @@ if(MSVC)
endif() endif()
# including headers of dependencies and the VkCV framework # 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 # 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)
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <vkcv/Logger.hpp> #include <vkcv/Logger.hpp>
#include "Voxelization.hpp" #include "Voxelization.hpp"
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include "vkcv/gui/GUI.hpp"
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
const char* applicationName = "Voxelization"; const char* applicationName = "Voxelization";
...@@ -318,6 +319,10 @@ int main(int argc, const char** argv) { ...@@ -318,6 +319,10 @@ int main(int argc, const char** argv) {
voxelDependencies.vertexLayout = vertexLayout; voxelDependencies.vertexLayout = vertexLayout;
Voxelization voxelization(&core, voxelDependencies); Voxelization voxelization(&core, voxelDependencies);
vkcv::gui::GUI gui(core, window);
glm::vec2 lightAngles(90.f, 0.f);
auto start = std::chrono::system_clock::now(); auto start = std::chrono::system_clock::now();
const auto appStartTime = start; const auto appStartTime = start;
while (window.isWindowOpen()) { while (window.isWindowOpen()) {
...@@ -349,10 +354,11 @@ int main(int argc, const char** argv) { ...@@ -349,10 +354,11 @@ int main(int argc, const char** argv) {
start = end; start = end;
cameraManager.update(0.000001 * static_cast<double>(deltatime.count())); cameraManager.update(0.000001 * static_cast<double>(deltatime.count()));
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - appStartTime); glm::vec2 lightAngleRadian = glm::radians(lightAngles);
lightInfo.direction = glm::normalize(glm::vec3(
const float sunTheta = 0.001f * static_cast<float>(duration.count()); std::cos(lightAngleRadian.x) * std::cos(lightAngleRadian.y),
lightInfo.direction = glm::normalize(glm::vec3(std::cos(sunTheta), 1, std::sin(sunTheta))); std::sin(lightAngleRadian.x),
std::cos(lightAngleRadian.x) * std::sin(lightAngleRadian.y)));
const float shadowProjectionSize = 20.f; const float shadowProjectionSize = 20.f;
glm::mat4 projectionLight = glm::ortho( glm::mat4 projectionLight = glm::ortho(
...@@ -440,6 +446,14 @@ int main(int argc, const char** argv) { ...@@ -440,6 +446,14 @@ int main(int argc, const char** argv) {
core.prepareSwapchainImageForPresent(cmdStream); core.prepareSwapchainImageForPresent(cmdStream);
core.submitCommandStream(cmdStream); core.submitCommandStream(cmdStream);
gui.beginGUI();
ImGui::Begin("Settings");
ImGui::DragFloat2("Light angles", &lightAngles.x);
ImGui::End();
gui.endGUI();
core.endFrame(); core.endFrame();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment