30 static constexpr auto DEFAULT_FB = 1;
32 static constexpr auto DEFAULT_FB = 0;
36 friend class Framebuffer;
41 virtual void onFramebufferResize(glm::u32vec2 size) = 0;
42 virtual void attach(Framebuffer& to, GLenum attachmentType) = 0;
46 Framebuffer(Framebuffer&& rhs)
noexcept: mHandle(rhs.mHandle),
48 mAttachedTargets(std::move(rhs.mAttachedTargets)),
49 mSupersamplingRatio(rhs.mSupersamplingRatio) {
58 void resize(glm::u32vec2 newSize);
61 std::uint32_t supersamlingRatio() const noexcept {
62 return mSupersamplingRatio;
65 void setSupersamplingRatio(std::uint32_t ratio)
noexcept {
66 mSupersamplingRatio = ratio;
70 glm::u32vec2 supersampledSize() const noexcept {
71 return mSize * mSupersamplingRatio;
75 glm::u32vec2 size() const noexcept {
79 operator bool()
const {
82 uint32_t getHandle()
const {
86 void attach(_<IRenderTarget> renderTarget, GLenum attachmentType ) {
87 renderTarget->attach(*
this, attachmentType);
89 mAttachedTargets << std::move(renderTarget);
92 Framebuffer& operator=(Framebuffer&& rhs)
noexcept {
93 if (mHandle == rhs.mHandle) {
96 std::swap(mHandle, rhs.mHandle);
98 mSupersamplingRatio = rhs.mSupersamplingRatio;
99 mAttachedTargets = std::move(rhs.mAttachedTargets);
103 static gl::Framebuffer* current();
108 uint32_t mHandle = 0;
109 std::uint32_t mSupersamplingRatio = 1;
110 glm::u32vec2 mSize{0, 0};
111 AVector<_<IRenderTarget>> mAttachedTargets;