Skip to main content

Function: createProjectionMatrix()

createProjectionMatrix(width, height, cameraPosition, zoom): Matrix3x3

Defined in: rendering/shaders/utils/create-projection-matrix.ts:13

Creates a projection matrix for rendering with a camera. The projection matrix is centered on the camera position and applies zoom.

Parameters

width

number

The width of the viewport.

height

number

The height of the viewport.

cameraPosition

Vector2

The position of the camera in world coordinates.

zoom

number

The zoom level to apply to the projection.

Returns

Matrix3x3

A 3x3 projection matrix that can be used for rendering.