summary refs log tree commit diff
path: root/src/Util/ImageViewer.hpp
blob: d583aa862e3b1e5c8dd46dfec71f6a64cd9bceea (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 "../GFX/Image/RawImage.hpp"
#include "../GFX/Binder.hpp"
#include "../GFX/Texture.hpp"
#include "../GFX/Shading/Program.hpp"

namespace MC::Util {

class ImageViewer {
public:
    explicit ImageViewer(
        GFX::Image::RawImage& image
    ) : m_texture(image),
        m_program(
            {GFX::Shading::Shader::Type::Vertex, ImageViewer::vertex},
            {GFX::Shading::Shader::Type::Fragment, ImageViewer::fragment}
        ),
        m_mesh(GFX::Binder::load(default_mesh)) {};

    void render();
private:
    static GFX::Mesh create_default_mesh();

    static inline GFX::Mesh default_mesh = create_default_mesh();

    static const char* vertex;
    static const char* fragment;

    MC::GFX::BindableMesh m_mesh;
    MC::GFX::Shading::Program m_program;
    MC::GFX::Texture m_texture;
};

}