Fixed rendering issues!

Turns out it was all just fustrum shit
This commit is contained in:
connellpaxton 2024-02-19 22:45:17 -05:00
parent 346038a8f7
commit f95c48bac6
5 changed files with 16 additions and 3 deletions

View File

@ -364,7 +364,7 @@ void Renderer::draw() {
auto sz = win.getDimensions();
const auto p = glm::perspective(glm::radians(90.0f), static_cast<float>(sz.width) / static_cast<float>(sz.height), 0.01f, 10000.0f);
const auto p = glm::perspective(glm::radians(90.0f), static_cast<float>(sz.width) / static_cast<float>(sz.height), near_plane, far_plane);
auto uni = UniformData{
.view = cam.view(),

View File

@ -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;
};

View File

@ -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;

View File

@ -11,7 +11,13 @@
#include <Scene/Camera.hpp>
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);

View File

@ -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;