NoJobEngine 2.0.7
Loading...
Searching...
No Matches
OpenGLFramebuffer.h
Go to the documentation of this file.
1
6#pragma once
8
9namespace NoJob
10{
11 class OpenGLFramebuffer final : public Framebuffer
12 {
13 public:
14 explicit OpenGLFramebuffer(
15 const FramebufferSpecification& specification);
16 ~OpenGLFramebuffer() override;
17
18 void Bind() override;
19 void Unbind() override;
20 void Resize(std::uint32_t width, std::uint32_t height) override;
21 void PresentToDefault(std::uint32_t width, std::uint32_t height) override;
22
23 std::uint32_t GetColorAttachmentRendererID() const override
24 {
25 // The editor always displays the post-processed LDR result.
26 return m_DisplayAttachment ? m_DisplayAttachment : m_ColorAttachment;
27 }
28
30 {
31 return m_Specification;
32 }
33
34 void SetPostProcessSettings(const FramebufferSpecification& specification) override
35 {
36 // Width/height are owned by Resize(); post settings can change live.
37 m_Specification.HDR = specification.HDR;
38 m_Specification.Bloom = specification.Bloom;
39 m_Specification.FXAA = specification.FXAA;
40 m_Specification.ScreenSpaceAO = specification.ScreenSpaceAO;
41 m_Specification.Exposure = specification.Exposure;
42 m_Specification.BloomThreshold = specification.BloomThreshold;
43 m_Specification.BloomStrength = specification.BloomStrength;
44 m_Specification.AOIntensity = specification.AOIntensity;
45 }
46
47 private:
48 void Invalidate();
49 void EnsurePostProcessResources();
50 void DestroyAttachments();
51 void RunPostProcess();
52
53 FramebufferSpecification m_Specification;
54 std::uint32_t m_RendererID = 0;
55 std::uint32_t m_ColorAttachment = 0; // linear HDR scene
56 std::uint32_t m_DepthAttachment = 0;
57 std::uint32_t m_PostProcessFBO = 0;
58 std::uint32_t m_DisplayAttachment = 0; // final LDR image for ImGui
59 std::uint32_t m_PostProgram = 0;
60 std::uint32_t m_FullscreenVAO = 0;
61 };
62}
Framebuffer declarations for the Rendering subsystem.
OpenGLFramebuffer(const FramebufferSpecification &specification)
void Resize(std::uint32_t width, std::uint32_t height) override
const FramebufferSpecification & GetSpecification() const override
std::uint32_t GetColorAttachmentRendererID() const override
void SetPostProcessSettings(const FramebufferSpecification &specification) override
void PresentToDefault(std::uint32_t width, std::uint32_t height) override