diff options
| author | Mel <einebeere@gmail.com> | 2022-10-24 00:40:08 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-10-24 00:40:08 +0200 |
| commit | dc2af6a6fb7ae3cf1b9f917058889329d4652491 (patch) | |
| tree | 49030d19e9e403336be0de048681b4bbd921218d /src/Util/ImageViewer.hpp | |
| parent | ad84d0686f1d7f72e86b55cdadd8272f225f776d (diff) | |
| download | meowcraft-dc2af6a6fb7ae3cf1b9f917058889329d4652491.tar.zst meowcraft-dc2af6a6fb7ae3cf1b9f917058889329d4652491.zip | |
Image viewer utility
Diffstat (limited to 'src/Util/ImageViewer.hpp')
| -rw-r--r-- | src/Util/ImageViewer.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/Util/ImageViewer.hpp b/src/Util/ImageViewer.hpp new file mode 100644 index 0000000..d583aa8 --- /dev/null +++ b/src/Util/ImageViewer.hpp @@ -0,0 +1,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; +}; + +} \ No newline at end of file |
