summaryrefslogtreecommitdiffstats
path: root/src/RenderConfigs.hpp
blob: 62791691a2bca0061e7f90557f27ced042bd681e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once

#include "Gal.hpp"

class Gbuffer {
    std::shared_ptr<Gal::Framebuffer> lightFramebuffer;
    std::shared_ptr<Gal::Buffer> lightBuffer;
    std::shared_ptr<Gal::Pipeline> lightPipeline;
    std::shared_ptr<Gal::PipelineInstance> lightPipelineInstance;
    std::shared_ptr<Gal::Texture> color;
    std::shared_ptr<Gal::Texture> normal;
    std::shared_ptr<Gal::Texture> depthStencil;
    std::shared_ptr<Gal::Framebuffer> geomFramebuffer;

    std::shared_ptr<Gal::Texture> finalColor;

public:
    Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH);

    std::shared_ptr<Gal::Framebuffer> GetGeometryTarget() {
        return geomFramebuffer;
    }

    std::shared_ptr<Gal::Texture> GetFinalTexture() {
        return finalColor;
    }

    void Render() {
        lightPipeline->Activate();
        lightPipelineInstance->Activate();
        lightPipelineInstance->Render(0, 6);
    }

    void Clear() {
        geomFramebuffer->Clear();
        lightFramebuffer->Clear();
    }
};