diff --git a/include/graphics/fbo.hpp b/include/graphics/fbo.hpp index fec2ca3..7f83579 100644 --- a/include/graphics/fbo.hpp +++ b/include/graphics/fbo.hpp @@ -35,7 +35,9 @@ namespace gfx{ public: fbo(); - fbo(util::no_initialize_t); + template + explicit fbo(Args&&... args); + explicit fbo(util::no_initialize_t); fbo(const fbo&) = delete; fbo(fbo&& f); ~fbo(); @@ -58,8 +60,35 @@ namespace gfx{ bool bind()const; bool bind(gl_frame_buffer_manager& b)const; + private: + template + void i_attach(const rbo& r, GLenum point, Args&&... args); + template + void i_attach(const texture& r, GLenum point, Args&&... args); + }; + template + fbo::fbo(Args&&... args): + fbo() + { + i_attach(std::forward(args)...); + } + template + void fbo::i_attach(const rbo& r, GLenum point, Args&&... args){ + attach(r, point); + if constexpr(sizeof...(args) > 0){ + i_attach(std::forward(args)...); + } + } + template + void fbo::i_attach(const texture& t, GLenum point, Args&&... args){ + attach(t, point); + if constexpr(sizeof...(args) > 0){ + i_attach(std::forward(args)...); + } + } + } #endif