23 #include "hx3d/graphics/viewports/viewport.hpp" 25 #include "hx3d/graphics/cameras/camera.hpp" 26 #include "hx3d/graphics/gl.hpp" 33 _worldWidth(0), _worldHeight(0), _screenX(0), _screenY(0), _screenWidth(0), _screenHeight(0) {}
35 Viewport::~Viewport() {}
62 glm::vec2 worldPoint = glm::vec2(0);
66 worldPoint.x = screenPoint.x / ratioX -
_screenX / ratioX;
67 worldPoint.y = screenPoint.y / ratioY -
_screenY / ratioY;
float viewportHeight
Viewport height.
void apply(Camera &camera)
Apply the viewport on the screen, centering the camera.
float _worldHeight
World height.
virtual void update()=0
Update the camera.
float viewportWidth
Viewport width.
glm::vec3 position
Camera position.
virtual void internalUpdate(Camera &camera) override
Update the viewport, centering the camera (internal).
int _screenHeight
Screen height.
void setScreenPosition(const float x, const float y)
Set the viewport position.
int _screenWidth
Screen width.
void update(Camera &camera, const int screenWidth, const int screenHeight)
Update the viewport with a new screen width and height, centering the camera.
glm::vec2 screenToWorld(const glm::vec2 screenPoint)
Convert a screen point to a world point.
float _worldWidth
World width.
glm::vec2 getWorldSize()
Get the world size.