summary refs log tree commit diff
path: root/src/Util/ImageViewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Util/ImageViewer.cpp')
-rw-r--r--src/Util/ImageViewer.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Util/ImageViewer.cpp b/src/Util/ImageViewer.cpp
index 9720408..8ff8c57 100644
--- a/src/Util/ImageViewer.cpp
+++ b/src/Util/ImageViewer.cpp
@@ -6,7 +6,7 @@ namespace MC::Util {
 
 ImageViewer::ImageViewer(
         const GFX::Image::RawImage& image,
-        float window_aspect
+        Real window_aspect
 ) : m_texture(image),
     m_program(
         {GFX::Shading::Shader::Type::Vertex, vertex},
@@ -18,9 +18,9 @@ ImageViewer::ImageViewer(
     auto view_uniform = m_program.uniform("view_matrix");
     auto projection_uniform = m_program.uniform("projection_matrix");
 
-    model_uniform.set(Math::MVP::model({}, {}));
-    view_uniform.set(Math::MVP::view({}, {}));
-    projection_uniform.set(Math::MVP::orthographic_projection(view_size * window_aspect, view_size, 0.0f, 100.0f));
+    model_uniform.set(Math::MVP::model<F32>({}, {}));
+    view_uniform.set(Math::MVP::view<F32>({}, {}));
+    projection_uniform.set(Math::MVP::orthographic_projection<F32>(view_size * window_aspect, view_size, 0.0f, 100.0f));
 
     m_program.unbind();
 }
@@ -35,23 +35,23 @@ void ImageViewer::render() const {
     m_program.unbind();
 }
 
-GFX::Mesh ImageViewer::create_mesh(float window_aspect, uint32_t image_width, uint32_t image_height) {
-    auto aspect = (float)image_width / image_height;
-    float max_size = view_size * 0.8f;
-    float width = max_size * std::min(1.0f, aspect);
-    float height = max_size * std::min(1.0f, 1/aspect);
+GFX::Mesh ImageViewer::create_mesh(Real window_aspect, U32 image_width, U32 image_height) {
+    auto aspect = (Real)image_width / image_height;
+    Real max_size = view_size * 0.8;
+    Real width = max_size * std::min(1.0, aspect);
+    Real height = max_size * std::min(1.0, 1/aspect);
 
-    float x = (view_size * window_aspect - width) / 2.0f;
-    float y = (view_size - height) / 2.0f;
+    Real x = (view_size * window_aspect - width) / 2.0f;
+    Real y = (view_size - height) / 2.0f;
 
     return {{
-        std::vector<Vector<3>>{
+        std::vector<Vector<3, F32>>{
             {x, y, 0.0f}, // top left
             {x, y + height, 0.0f}, // bottom left
             {x + width, y + height, 0.0f}, // bottom right
             {x + width, y, 0.0f}  // top right
         },
-        std::vector<Vector<2>>{
+        std::vector<Vector<2, F32>>{
             {0.0f, 0.0f},
             {0.0f, 1.0f},
             {1.0f, 1.0f},
@@ -60,7 +60,7 @@ GFX::Mesh ImageViewer::create_mesh(float window_aspect, uint32_t image_width, ui
     }, {0, 1, 2, 0, 2, 3}};
 }
 
-const char* ImageViewer::vertex = R"v(
+const Char* ImageViewer::vertex = R"v(
 #version 330 core
 
 uniform mat4 model_matrix;
@@ -77,7 +77,7 @@ void main() {
     frag_tex_coord = tex_coord;
 })v";
 
-const char* ImageViewer::fragment = R"f(
+const Char* ImageViewer::fragment = R"f(
 #version 330 core
 
 uniform sampler2D image;