+ | New output texture slider

This commit is contained in:
TheRedShip
2025-02-24 20:37:25 +01:00
parent 16c90128bf
commit 3d2bcce9ca
3 changed files with 11 additions and 2 deletions

View File

@ -41,7 +41,7 @@ class Window
GLFWwindow *getWindow(void) const; GLFWwindow *getWindow(void) const;
float getFps(void) const; float getFps(void) const;
int getFrameCount(void) const; int getFrameCount(void) const;
int getOutputTexture(void) const;
int getPixelisation(void); int getPixelisation(void);
bool &getAccumulate(void); bool &getAccumulate(void);
@ -54,6 +54,8 @@ class Window
GLFWwindow *_window; GLFWwindow *_window;
Scene *_scene; Scene *_scene;
Renderer *_renderer; Renderer *_renderer;
int _output_texture;
float _fps; float _fps;
float _delta; float _delta;

View File

@ -96,7 +96,7 @@ int main(int argc, char **argv)
window.imGuiNewFrame(); window.imGuiNewFrame();
render_program.use(); render_program.use();
drawScreenTriangle(VAO, textures[0], render_program.getProgram()); drawScreenTriangle(VAO, textures[window.getOutputTexture()], render_program.getProgram());
window.imGuiRender(raytracing_program); window.imGuiRender(raytracing_program);

View File

@ -23,6 +23,7 @@ Window::Window(Scene *scene, int width, int height, const char *title, int sleep
_fps = 0; _fps = 0;
_frameCount = 0; _frameCount = 0;
_pixelisation = 0; _pixelisation = 0;
_output_texture = 0;
_renderer = new Renderer(scene, this, args); _renderer = new Renderer(scene, this, args);
glfwSetErrorCallback(GLFWErrorCallback); glfwSetErrorCallback(GLFWErrorCallback);
if (!glfwInit()) if (!glfwInit())
@ -200,6 +201,7 @@ void Window::imGuiRender(ShaderProgram &raytracing_program)
ImGui::Text("Fps: %d", int(_fps)); ImGui::Text("Fps: %d", int(_fps));
ImGui::Text("Frame: %d", _frameCount); ImGui::Text("Frame: %d", _frameCount);
ImGui::Text("Objects: %lu", _scene->getObjectData().size() + _scene->getTriangleData().size()); ImGui::Text("Objects: %lu", _scene->getObjectData().size() + _scene->getTriangleData().size());
ImGui::SliderInt("Output texture", &_output_texture, 0, 7);
ImGui::Spacing(); ImGui::Spacing();
@ -354,6 +356,11 @@ bool &Window::getAccumulate(void)
return (accumulate); return (accumulate);
} }
int Window::getOutputTexture(void) const
{
return (_output_texture);
}
int Window::getPixelisation(void) int Window::getPixelisation(void)
{ {
bool mouse = glfwGetMouseButton(_window, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS; bool mouse = glfwGetMouseButton(_window, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS;