diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Util/ImageViewer.cpp | 8 | ||||
| -rw-r--r-- | src/Util/ImageViewer.hpp | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Util/ImageViewer.cpp b/src/Util/ImageViewer.cpp index f94ccd0..9720408 100644 --- a/src/Util/ImageViewer.cpp +++ b/src/Util/ImageViewer.cpp @@ -20,7 +20,7 @@ ImageViewer::ImageViewer( model_uniform.set(Math::MVP::model({}, {})); view_uniform.set(Math::MVP::view({}, {})); - projection_uniform.set(Math::MVP::orthographic_projection(1000 * window_aspect, 1000, 0.0f, 100.0f)); + projection_uniform.set(Math::MVP::orthographic_projection(view_size * window_aspect, view_size, 0.0f, 100.0f)); m_program.unbind(); } @@ -37,12 +37,12 @@ void ImageViewer::render() const { 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 = 500.0f; + 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); - float x = max_size * window_aspect - width / 2.0f; - float y = max_size - height / 2.0f; + float x = (view_size * window_aspect - width) / 2.0f; + float y = (view_size - height) / 2.0f; return {{ std::vector<Vector<3>>{ diff --git a/src/Util/ImageViewer.hpp b/src/Util/ImageViewer.hpp index 59c0bf3..16ef2dd 100644 --- a/src/Util/ImageViewer.hpp +++ b/src/Util/ImageViewer.hpp @@ -16,6 +16,8 @@ public: private: static GFX::Mesh create_mesh(float window_aspect, uint32_t image_width, uint32_t image_height); + static constexpr float view_size = 1000.0f; + static const char* vertex; static const char* fragment; |
