projectionMatrix(for:viewportSize:zNear:zFar:)
Returns a transform matrix appropriate for rendering 3D content to match the image captured by the camera, using the specified parameters.
Declaration
func projectionMatrix(for orientation: UIInterfaceOrientation, viewportSize: CGSize, zNear: CGFloat, zFar: CGFloat) -> simd_float4x4Parameters
- orientation:
The orientation in which the camera image is to be presented.
- viewportSize:
The size, in points, of the view in which the camera image is to be presented.
- zNear:
The distance from the camera to the near clipping plane.
- zFar:
The distance from the camera to the far clipping plane.
Return Value
A projection matrix that provides an aspect fill and rotation for the provided viewport size and orientation.
Discussion
This method has no effect on ARKit, and the zNear and zFar parameters have no relationships to ARKit camera state. Instead, this method uses those parameters as well as the camera’s state to construct a projection matrix for use in your own rendering code.