Class Camera¶
-
class Camera¶
Public Types
Public Functions
-
Camera()¶
-
~Camera()¶
-
void update(float deltaTime)¶
-
void attach()¶
-
inline void reApplyScissor()¶
Re-applies the scissor-area defined via the viewport.
This can be useful if you changed the scissor-area and now wish to reset it.
-
void setScreenArea(int x, int y, int width, int height)¶
-
inline void setPerspective(float newFov)¶
Switches the camera over to a perspective projection.
- Parameters:
newFov – vertical fov in radians
-
inline void setOrthographic(float newOrthoSize)¶
Switches the camera over to an orthographic projection.
- Parameters:
newOrthoSize – vertical half-size of the view volume in world units
-
inline void setProjection(Projection newProjection)¶
Switches between perspective and orthographic projection, keeping the settings (fov / ortho-size) of both.
-
inline Projection getProjection() const¶
- void setLookAt(
- const fm_vec3_t &newPos,
- const fm_vec3_t &newTarget,
- const fm_vec3_t &newUp = {0, 1, 0}
Sets new camera values based on a look-at transform.
If you have an arbitrary rotation based camera prefer using ‘setPosRot’.
- Parameters:
newPos – camera eye
newTarget – camera target
newUp – camera up vector (+Y by default)
-
void setPosRot(const fm_vec3_t &newPos, const fm_quat_t &rot)¶
Sets a new camera by position and rotation.
If you have a look-at based camera prefer using ‘setLookAt’.
- Parameters:
pos – camera eye
rot – rotation
-
inline const fm_vec3_t &getTarget() const¶
-
inline const fm_vec3_t &getPos() const¶
-
inline fm_vec3_t getViewDir() const¶
-
inline const fm_mat4_t &getViewMatrix() const¶
-
inline const fm_vec3_t &getUp() const¶
-
fm_vec3_t getScreenPos(const fm_vec3_t &worldPos)¶
Public Members
-
float fov = {}¶
-
float near = {}¶
-
float far = {}¶
-
float aspectRatio = {}¶
-
float orthoSize = {}¶
-
Projection projection = {Projection::PERSPECTIVE}¶
-
Camera()¶