summary refs log tree commit diff
path: root/src/Util/ImageViewer.hpp
blob: cfe9d1870b47a24ee5e7e49a354b1c76d2541981 (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
#pragma once

#include "../GFX/Actions.hpp"
#include "../GFX/Mesh.hpp"
#include "../GFX/Image/RawImage.hpp"
#include "../GFX/Texture.hpp"

namespace MC::Util {

class ImageViewer {
public:
    explicit ImageViewer(const GFX::Image::RawImage& image, Real window_aspect)
        : m_mesh(create_mesh(window_aspect, image.width(), image.height())),
          m_texture(image) {}

    void render(GFX::Actions& actions);
private:
    static GFX::Mesh create_mesh(Real window_aspect, U32 image_width, U32 image_height);

    static constexpr Real view_size = 1000.0f;

    GFX::Mesh m_mesh;
    GFX::Texture m_texture;
};

}