1 #include "viewport.hpp"
4 #include <glm/gtc/matrix_transform.hpp>
9 Viewport::Viewport(int w, int h)
12 , fov(0.78539816339744830961f) // π/4
13 , aspect(float(w) / float(h))
16 , perspective(glm::perspective(fov, aspect, near, far))
17 , ortho(glm::ortho(0.0f, float(width), float(height), 0.0f, near, far)) {
21 void Viewport::Resize(int w, int h) noexcept {
24 aspect = float(width) / float(height);
25 perspective = glm::perspective(fov, aspect, near, far);
26 ortho = glm::ortho(0.0f, float(width), float(height), 0.0f, near, far);
27 glViewport(0, 0, width, height);