diff --git a/Renderer/Renderer.cpp b/Renderer/Renderer.cpp index 76b8368..2bf7c5f 100644 --- a/Renderer/Renderer.cpp +++ b/Renderer/Renderer.cpp @@ -364,7 +364,7 @@ void Renderer::draw() { auto sz = win.getDimensions(); - const auto p = glm::perspective(glm::radians(90.0f), static_cast(sz.width) / static_cast(sz.height), 0.01f, 10000.0f); + const auto p = glm::perspective(glm::radians(90.0f), static_cast(sz.width) / static_cast(sz.height), near_plane, far_plane); auto uni = UniformData{ .view = cam.view(), diff --git a/Renderer/Renderer.hpp b/Renderer/Renderer.hpp index 7da0e0a..dc319c4 100644 --- a/Renderer/Renderer.hpp +++ b/Renderer/Renderer.hpp @@ -80,6 +80,9 @@ struct Renderer { size_t n_indices; bool visibility_testing; + float near_plane = 2.0f; + float far_plane = 10000.0f; + float tess_factor = 1.8f; float tess_edge_size = 20.0f; }; diff --git a/Scene/BSP.cpp b/Scene/BSP.cpp index ad37d6b..c236509 100644 --- a/Scene/BSP.cpp +++ b/Scene/BSP.cpp @@ -59,7 +59,7 @@ void BSP::load_indices(const glm::vec3& cam_pos, bool visibility_test) { case Face::ePATCH: break; case Face::ePOLYGON: - // case Face::eMESH: + case Face::eMESH: for (size_t i = 0; i < face.n_mesh_vertices; i++) indices.push_back(face.first_vertex_idx + mesh_vertices[face.first_mesh_vertex_idx+i].idx); break; diff --git a/UI/UI.cpp b/UI/UI.cpp index f60534b..b363bf0 100644 --- a/UI/UI.cpp +++ b/UI/UI.cpp @@ -11,7 +11,13 @@ #include -UI::UI(Renderer* ren) : info{ .flycam = ren->flycam, .visibility_testing = ren->visibility_testing, .time = ren->time, .cam = ren->cam, .tess_factor = ren->tess_factor, .tess_edge_size = ren->tess_edge_size, .n_indices = ren->n_indices }, dev(ren->dev) { +UI::UI(Renderer* ren) : + info { + .flycam = ren->flycam, .visibility_testing = ren->visibility_testing, + .time = ren->time, .cam = ren->cam, .tess_factor = ren->tess_factor, + .tess_edge_size = ren->tess_edge_size, .n_indices = ren->n_indices, + .near_plane = ren->near_plane, .far_plane = ren->far_plane + }, dev(ren->dev) { IMGUI_CHECKVERSION(); ImGui::CreateContext(); @@ -94,6 +100,8 @@ void UI::newFrame() { ImGui::Text("Time: %f", info.time); ImGui::Checkbox("Fly Camera", &info.flycam); ImGui::Checkbox("Visibility Testing", &info.visibility_testing); + ImGui::SliderFloat("Near Plane", &info.near_plane, 0.00, 0.20); + ImGui::SliderFloat("Far Plane", &info.far_plane, 1000.0, 10000.0); ImGui::SliderFloat("Tessellation Factor", &info.tess_factor, 0.1, 10.0); ImGui::SliderFloat("Edge Size", &info.tess_edge_size, 0.0, 40.0); diff --git a/UI/UI.hpp b/UI/UI.hpp index 8a220f6..5947c54 100644 --- a/UI/UI.hpp +++ b/UI/UI.hpp @@ -19,6 +19,8 @@ struct UI { float& tess_factor; float& tess_edge_size; const size_t& n_indices; + float& near_plane; + float& far_plane; } info; vk::Device dev;