rtm/camera_utilsf.h¶
#include "rtm/camera_utilsf.h"
matrix_look_to¶
matrix3x4f matrix_look_to(vector4f position, vector4f direction, vector4f up)
Returns a left-handed affine 3x4 matrix representing a camera transform. A camera transform multiplied by a point3 transforms a point3 local to the camera into world space. The camera transform is located at the specified position, looking towards the specified direction, and using the specified up direction.
The look to direction and up inputs do not need to be normalized.
In this frame of reference:
- X axis: right direction
- Y axis: up direction
- Z axis: forward/look direction
matrix_look_at¶
matrix3x4f matrix_look_at(vector4f position, vector4f location, vector4f up)
Returns a left-handed affine 3x4 matrix representing a camera transform. A camera transform multiplied by a point3 transforms a point3 local to the camera into world space. The camera transform is located at the specified position, looking towards the specified location, and using the specified up direction.
The up input does not need to be normalized.
In this frame of reference:
- X axis: right direction
- Y axis: up direction
- Z axis: forward/look direction
view_look_to¶
matrix3x4f view_look_to(vector4f position, vector4f direction, vector4f up)
Returns a left-handed affine 3x4 matrix representing a camera view transform. A camera view transform is the inverse of a camera transform. A camera transform multiplied by a point3 transforms a point3 local to the camera into world space while a camera view transform multiplied by a point3 does the opposite: it transforms a world space point3 into local space of the camera. This is typically used before applying a projection matrix. The camera transform is located at the specified position, looking towards the specified direction, and using the specified up direction. The camera view transform is then constructed from its inverse.
The look to direction and up inputs do not need to be normalized.
In this frame of reference:
- X axis: right direction
- Y axis: up direction
- Z axis: forward/look direction
view_look_at¶
matrix3x4f view_look_at(vector4f position, vector4f location, vector4f up)
Returns a left-handed affine 3x4 matrix representing a camera view transform. A camera view transform is the inverse of a camera transform. A camera transform multiplied by a point3 transforms a point3 local to the camera into world space while a camera view transform multiplied by a point3 does the opposite: it transforms a world space point3 into local space of the camera. This is typically used before applying a projection matrix. The camera transform is located at the specified position, looking towards the specified location, and using the specified up direction. The camera view transform is then constructed from its inverse.
The look to direction and up inputs do not need to be normalized.
In this frame of reference:
- X axis: right direction
- Y axis: up direction
- Z axis: forward/look direction
proj_perspective¶
matrix4x4f proj_perspective(float view_width, float view_height, float near_distance, float far_distance)
Returns a left-handed 4x4 perspective projection matrix using the screen dimensions.
In this frame of reference:
- X axis: right direction
- Y axis: up direction
- Z axis: forward/look direction
proj_perspective_fov¶
matrix4x4f proj_perspective_fov(float fov_angle_y, float aspect_ratio, float near_distance, float far_distance)
Returns a left-handed 4x4 perspective projection matrix using the screen field of view.
In this frame of reference:
- X axis: right direction
- Y axis: up direction
- Z axis: forward/look direction
proj_orthographic¶
matrix4x4f proj_orthographic(float view_width, float view_height, float near_distance, float far_distance)
Returns a left-handed 4x4 orthographic projection matrix.
In this frame of reference:
- X axis: right direction
- Y axis: up direction
- Z axis: forward/look direction