Package: graphene

Function graphene:matrix-init-look-at

Lambda List

graphene:matrix-init-look-at (matrix eye center up)

Arguments

matrix -- a graphene:matrix-t instance
eye -- a graphene:vec3-t instance for the vector describing the position to look from
center -- a graphene:vec3-t instance for the vector describing the position at
up -- a graphene:vec3-t instance for the vector describing the world's upward direction, usually, this is the y axis vector returned from the graphene:vec3-y-axis function

Return Value

The initialized graphene:matrix-t instance.

Details

Initializes the matrix so that it positions the "camera" at the given eye coordinates towards an object at the center coordinates. The top of the camera is aligned to the direction of the up vector.

Before the transform, the camera is assumed to be placed at the origin, looking towards the negative Z axis, with the top side of the camera facing in the direction of the Y axis and the right side in the direction of the X axis.

In theory, one could use matrix to transform a model of such a camera into world-space. However, it is more common to use the inverse of matrix to transform another object from world coordinates to the view coordinates of the camera. Typically you would then apply the camera projection transform to get from view to screen coordinates.
 

See also

#2024-12-30