This function builds a "look-at" (view) matrix based on the specified parameters listed below. Since this function modifies the view matrix and not the projection matrix, you should first initialize the projection matrix using the other matrix function matrix_build_projection_perspective, then use this function to move the view camera around within the projection.
To set the view you first need to define the position you look from, which is indicated by the parameters (xfrom, yfrom, zfrom). Next you must specify the direction you look at and this is done by giving a second point to look towards with the arguments (xto, yto, zto). Finally, you can still rotate the camera around the line from the viewpoint to the looking point, and to specify this we must give an "up" vector - the direction that is upwards in the camera. This is given by the last three arguments (xup, yup, zup).
matrix_build_lookat(xfrom, yfrom, zfrom, xto, yto, zto, xup, yup, zup);
|xfrom||The x coordinate of the position to look from.|
|yfrom||The y coordinate of the position to look from.|
|zfrom||The z coordinate of the position to look from.|
|xto||The x coordinate of the position to look to.|
|yto||The y coordinate of the position to look to.|
|zto||The z coordinate of the position to look to.|
|xup||The x coordinate of the "up" vector.|
|yup||The y coordinate of the "up" vector.|
|zup||The z coordinate of the "up" vector.|
viewmat = matrix_build_lookat(640, 240, -10, 640,
240, 0, 0, 1, 0);
projmat = matrix_build_projection_ortho(640, 480, 1.0, 32000.0);
The above code creates a new look-at matrix and orthographic matrix, stores their IDs in local variables and then uses them to set the view and projection matrices for the camera assigned to view port.