aboutsummaryrefslogtreecommitdiff
path: root/include/RenderBackend/OpenGL/ShaderFrame.hpp
blob: da0918e10c82e58b2bef2766df9973226eb98b8c (plain)
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
#pragma once

#include "../../Result.hpp"
#include "../../types.hpp"
#include "../../utils.hpp"
#include "Uniform.hpp"
#include "DeviceMemory.hpp"

#include <map>
#include <memory>
#include <string>

namespace amalgine {
    class ShaderFrame {
        DISABLE_COPY(ShaderFrame)
        friend class ShaderProgram;
    public:
        ~ShaderFrame();
        ShaderFrame(ShaderFrame &&other) = default;
        ShaderFrame& operator=(ShaderFrame &&other) = default;

        DeviceMemory* get_input_by_name(const char *name);
        Result<Uniform> get_uniform_by_name(const char *name);

        void draw();
    private:
        ShaderFrame(u32 shader_program_id);
    private:
        u32 shader_program_id;
        u32 vertex_array_object_id;

        // TODO: Use a const char* as a key instead
        std::map<std::string, std::unique_ptr<DeviceMemory>> shader_inputs;
    };
}