jGL
|
An orthographic camera for 2D. More...
#include <orthoCam.h>
Public Member Functions | |
OrthoCam (int resx, int resy) | |
Construct a new Ortho Cam object. | |
OrthoCam (int resx, int resy, glm::vec2 pos) | |
Construct a new Ortho Cam object. | |
glm::vec4 | screenToWorld (float x, float y) const |
Convert screen position to world position. | |
glm::vec2 | worldToScreen (float x, float y) const |
Convert world position to screen coordinate. | |
const glm::mat4 & | getVP () const |
const glm::mat4 | getProjection () const |
glm::vec2 | getResolution () const |
glm::vec2 | getPosition () const |
float | getZoomLevel () const |
void | incrementZoom (float dz) |
void | setPosition (glm::vec2 newPosition) |
void | setPosition (float x, float y) |
void | move (float dx, float dy) |
An orthographic camera for 2D.
World coordinates are scaled to the size of the longest screen dimension in pixels. So [1, 1] is the top right of the screen always.
Position is the bottom left of corner. Increasing y in world space goes up the screen.
|
inline |
Construct a new Ortho Cam object.
resx | pixel resolution in x |
resy | pixel resolution in y |
|
inline |
Construct a new Ortho Cam object.
resx | pixel resolution in x. |
resy | pixel resolution in y. |
pos | position in world coordinates. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Convert screen position to world position.
x | screen x coordinate. |
y | screen y coordinate. |
|
inline |
|
inline |
|
inline |
Convert world position to screen coordinate.
x | world x coordinate. |
y | world y coordinate. |