mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-19 14:53:56 -07:00
Comments By: phosit, Stan Tested By: Langbart, phosit Differential Revision: https://code.wildfiregames.com/D4636 This was SVN commit r26858.
78 lines
1.9 KiB
C++
78 lines
1.9 KiB
C++
/* Copyright (C) 2022 Wildfire Games.
|
|
* This file is part of 0 A.D.
|
|
*
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef INCLUDED_RENDERER_BACKEND_GL_FRAMEBUFFER
|
|
#define INCLUDED_RENDERER_BACKEND_GL_FRAMEBUFFER
|
|
|
|
#include "graphics/Color.h"
|
|
#include "lib/ogl.h"
|
|
#include "renderer/backend/IFramebuffer.h"
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
|
|
namespace Renderer
|
|
{
|
|
|
|
namespace Backend
|
|
{
|
|
|
|
namespace GL
|
|
{
|
|
|
|
class CDevice;
|
|
class CTexture;
|
|
|
|
class CFramebuffer final : public IFramebuffer
|
|
{
|
|
public:
|
|
~CFramebuffer() override;
|
|
|
|
IDevice* GetDevice() override;
|
|
|
|
const CColor& GetClearColor() const override { return m_ClearColor; }
|
|
|
|
GLuint GetHandle() const { return m_Handle; }
|
|
GLbitfield GetAttachmentMask() const { return m_AttachmentMask; }
|
|
|
|
uint32_t GetWidth() const { return m_Width; }
|
|
uint32_t GetHeight() const { return m_Height; }
|
|
|
|
private:
|
|
friend class CDevice;
|
|
|
|
static std::unique_ptr<CFramebuffer> Create(
|
|
CDevice* device, const char* name,
|
|
CTexture* colorAttachment, CTexture* depthStencilAttachment, const CColor& clearColor);
|
|
static std::unique_ptr<CFramebuffer> CreateBackbuffer(CDevice* device);
|
|
|
|
CFramebuffer();
|
|
|
|
CDevice* m_Device = nullptr;
|
|
GLuint m_Handle = 0;
|
|
uint32_t m_Width = 0, m_Height = 0;
|
|
GLbitfield m_AttachmentMask = 0;
|
|
CColor m_ClearColor;
|
|
};
|
|
|
|
} // namespace GL
|
|
|
|
} // namespace Backend
|
|
|
|
} // namespace Renderer
|
|
|
|
#endif // INCLUDED_RENDERER_BACKEND_GL_FRAMEBUFFER
|