30 static constexpr auto DEFAULT_FB = 1;
31#elif AUI_PLATFORM_LINUX
32 static int DEFAULT_FB;
34 static constexpr auto DEFAULT_FB = 0;
38 friend class Framebuffer;
43 virtual void onFramebufferResize(glm::u32vec2 size) = 0;
44 virtual void attach(Framebuffer& to, GLenum attachmentType) = 0;
48 Framebuffer(Framebuffer&& rhs)
noexcept: mHandle(rhs.mHandle),
50 mAttachedTargets(std::move(rhs.mAttachedTargets)),
51 mSupersamplingRatio(rhs.mSupersamplingRatio) {
60 void resize(glm::u32vec2 newSize);
63 std::uint32_t supersamlingRatio() const noexcept {
64 return mSupersamplingRatio;
67 void setSupersamplingRatio(std::uint32_t ratio)
noexcept {
68 mSupersamplingRatio = ratio;
72 glm::u32vec2 supersampledSize() const noexcept {
73 return mSize * mSupersamplingRatio;
77 glm::u32vec2 size() const noexcept {
81 operator bool()
const {
84 uint32_t getHandle()
const {
88 void attach(_<IRenderTarget> renderTarget, GLenum attachmentType ) {
89 renderTarget->attach(*
this, attachmentType);
91 mAttachedTargets << std::move(renderTarget);
94 Framebuffer& operator=(Framebuffer&& rhs)
noexcept {
95 if (mHandle == rhs.mHandle) {
98 std::swap(mHandle, rhs.mHandle);
100 mSupersamplingRatio = rhs.mSupersamplingRatio;
101 mAttachedTargets = std::move(rhs.mAttachedTargets);
105 static gl::Framebuffer* current();
110 uint32_t mHandle = 0;
111 std::uint32_t mSupersamplingRatio = 1;
112 glm::u32vec2 mSize{0, 0};
113 AVector<_<IRenderTarget>> mAttachedTargets;