31 #include "Core/Macro/Macro.h" 32 #include "Platform/OpenGL/Texture.h" 33 #include "Platform/OpenGL/CubeMap.h" 55 DEPTH_STENCIL_ATTACHMENT,
60 enum class AttachmentType : uint8_t
67 using BindableId =
unsigned int;
70 AttachmentType currentAttachment = AttachmentType::NONE;
71 #if defined(MXENGINE_DEBUG) 72 std::aligned_storage_t<32> attachmentStorage;
74 std::aligned_storage_t<24> attachmentStorage;
77 #if defined(MXENGINE_DEBUG) 78 mutable const Texture* _texturePtr =
nullptr;
79 mutable const CubeMap* _cubemapPtr =
nullptr;
82 void OnTextureAttach(
const Texture& texture, Attachment attachment);
83 void OnCubeMapAttach(
const CubeMap& cubemap, Attachment attachment);
91 void CopyFrameBufferContents(
const FrameBuffer& framebuffer)
const;
92 void CopyFrameBufferContents(
int screenWidth,
int screenHeight)
const;
93 void Validate()
const;
94 void DetachRenderTarget();
95 bool HasTextureAttached()
const;
96 bool HasCubeMapAttached()
const;
97 void UseDrawBuffers(
size_t count)
const;
98 size_t GetWidth()
const;
99 size_t GetHeight()
const;
102 BindableId GetNativeHandle()
const;
104 template<
template<
typename,
typename>
typename Resource,
typename Factory>
109 this->DetachRenderTarget();
111 this->currentAttachment = AttachmentType::TEXTURE;
112 this->OnTextureAttach(**attachedTexture, attachment);
114 #if defined(MXENGINE_DEBUG) 115 this->_texturePtr = attachedTexture->GetUnchecked();
116 this->_cubemapPtr =
nullptr;
120 template<
template<
typename,
typename>
typename Resource,
typename Factory>
123 MX_ASSERT(this->currentAttachment != AttachmentType::NONE);
124 this->OnTextureAttach(*texture, attachment);
127 template<
template<
typename,
typename>
typename Resource,
typename Factory>
130 MX_ASSERT(this->currentAttachment != AttachmentType::NONE);
131 this->OnCubeMapAttach(*cubemap, attachment);
134 template<
template<
typename,
typename>
typename Resource,
typename Factory>
139 this->DetachRenderTarget();
141 this->currentAttachment = AttachmentType::CUBEMAP;
142 this->OnCubeMapAttach(**attachedCubeMap, attachment);
144 #if defined(MXENGINE_DEBUG) 145 this->_cubemapPtr = attachedCubeMap->GetUnchecked();
146 this->_texturePtr =
nullptr;
150 template<
template<
typename,
typename>
typename Resource,
typename Factory>
153 if (!this->HasTextureAttached())
158 #if defined(MXENGINE_DEBUG) 159 this->_texturePtr = texture.GetUnchecked();
165 template<
template<
typename,
typename>
typename Resource,
typename Factory>
168 if (!this->HasCubeMapAttached())
173 #if defined(MXENGINE_DEBUG) 174 this->_cubemapPtr = cubemap.GetUnchecked();
Definition: AbstractFactory.h:61
Definition: FrameBuffer.h:58
Definition: Application.cpp:49