36 RENDER = 0, DEPTH = 1, STENCIL = 2,
38 enum BufferDimension {
42 NONE = 0, COLOR_ONLY = 1, DEPTH_ONLY = 2, MULTI = 3,
45 IN_ORDER = 0, REVERSE = 1,
50 BufferType type = RENDER;
51 unsigned int renderbufferId = 0;
102 void AttachCubeBuffer(
int index,
int level = 0)
const;
104 void AttachFrameBuffer(
int target = GL_FRAMEBUFFER)
const;
106 void DetachFrameBuffer()
const;
108 void ResizeFrameBuffer(
int width,
int height);
110 void Exterminate()
override;
114 STexture* BlitCopiedFrameBuffer()
const;
116 int GetWidth()
const;
118 int GetHeight()
const;
120 const ivec2& GetSize()
const {
124 BufferStatus GetBufferStatus()
const;
152 if (m_mainColorBuffer ==
nullptr)
return nullptr;
153 return m_mainColorBuffer->texture;
161 if (m_depthBuffer ==
nullptr)
return nullptr;
162 return m_depthBuffer->texture;
165 void SetValue(std::string name_str, Arguments value)
override;
167 std::string PrintValue()
const override;
173 int GenerateAttachmentType(SFrameBuffer::BufferType type,
bool isIncreaseAttachment =
true)
const;
175 int GenerateInternalFormat(
int channel)
const;
177 int GenerateInternalType(
int channel)
const;
179 void ReleaseBufferObject(
const SFrameBuffer::BufferObject* bufferObject);
183 BufferDimension m_dimension = PLANE;
185 unsigned int m_fbo = 0;
186 std::vector<BufferObject*> m_buffers;
187 BufferObject* m_mainColorBuffer =
nullptr;
188 BufferObject* m_depthBuffer =
nullptr;
190 mutable BufferStatus m_bufferStatus = BufferStatus::NONE;
191 mutable unsigned short m_colorAttachmentSize = 0;
193 mutable PostObject m_postObject;