diff --git a/includes/RT/Window.hpp b/includes/RT/Window.hpp index 26d4f8c..5f2f9be 100644 --- a/includes/RT/Window.hpp +++ b/includes/RT/Window.hpp @@ -6,7 +6,7 @@ /* By: ycontre +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/13 16:15:41 by TheRed #+# #+# */ -/* Updated: 2025/03/17 15:24:12 by tomoron ### ########.fr */ +/* Updated: 2025/03/18 16:17:38 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -42,7 +42,7 @@ class Window GLFWwindow *getWindow(void) const; float getFps(void) const; int getFrameCount(void) const; - + int getOutputTexture(void) const; int getPixelisation(void); bool &getAccumulate(void); @@ -57,6 +57,8 @@ class Window Scene *_scene; Renderer *_renderer; Clusterizer *_clusterizer; + + int _output_texture; float _fps; float _delta; diff --git a/srcs/RT.cpp b/srcs/RT.cpp index b0970c6..059a195 100644 --- a/srcs/RT.cpp +++ b/srcs/RT.cpp @@ -96,7 +96,7 @@ int main(int argc, char **argv) window.imGuiNewFrame(); render_program.use(); - drawScreenTriangle(VAO, textures[0], render_program.getProgram()); + drawScreenTriangle(VAO, textures[window.getOutputTexture()], render_program.getProgram()); window.imGuiRender(raytracing_program); diff --git a/srcs/class/ObjParser.cpp b/srcs/class/ObjParser.cpp index 7eb3fa0..ea332d4 100644 --- a/srcs/class/ObjParser.cpp +++ b/srcs/class/ObjParser.cpp @@ -6,7 +6,7 @@ /* By: ycontre +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/01/16 15:00:33 by tomoron #+# #+# */ -/* Updated: 2025/02/06 02:19:50 by tomoron ### ########.fr */ +/* Updated: 2025/03/18 16:45:15 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -62,7 +62,7 @@ glm::vec3 ObjParser::getNormals(std::stringstream &line) { glm::vec3 res; - if(!(line >> res.x) || !(line >> res.y) || (!(line >> res.z)) && !line.eof()) + if((!(line >> res.x) || !(line >> res.y) || (!(line >> res.z))) && !line.eof()) throw std::runtime_error("syntax error in obj file while parsing normal vertex"); return(res); } diff --git a/srcs/class/Window.cpp b/srcs/class/Window.cpp index 12663ec..e0f51be 100644 --- a/srcs/class/Window.cpp +++ b/srcs/class/Window.cpp @@ -23,6 +23,7 @@ Window::Window(Scene *scene, int width, int height, const char *title, int sleep _fps = 0; _frameCount = 0; _pixelisation = 0; + _output_texture = 0; _renderer = new Renderer(scene, this, args); _clusterizer = new Clusterizer(args, _renderer); glfwSetErrorCallback(GLFWErrorCallback); @@ -208,6 +209,7 @@ void Window::imGuiRender(ShaderProgram &raytracing_program) ImGui::Text("Fps: %d", int(_fps)); ImGui::Text("Frame: %d", _frameCount); ImGui::Text("Objects: %lu", _scene->getObjectData().size() + _scene->getTriangleData().size()); + ImGui::SliderInt("Output texture", &_output_texture, 0, 7); ImGui::Spacing(); @@ -363,6 +365,11 @@ bool &Window::getAccumulate(void) return (accumulate); } +int Window::getOutputTexture(void) const +{ + return (_output_texture); +} + int Window::getPixelisation(void) { bool mouse = glfwGetMouseButton(_window, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS;