Camera

Holds the MVP matrix and methods to manipulate it.

Constructor

new Camera()

Classes

Camera

Methods

resize(width, height)

Resize the viewport.

Parameters:
NameTypeDefaultDescription
widthnumbercanvas.width
heightnumbercanvas.height

rotate(angle)

Rotate the camera around its center.

Parameters:
NameTypeDescription
anglenumber

Amount to rotate by (clockwise) in radians.

setMVP(mvp)

Set the ModelViewProjection matrix in the shader.

Parameters:
NameTypeDescription
mvpglMatrix.mat4

Optional to use instead of the default.

translate(vector3)

Translate the camera.

Parameters:
NameTypeDescription
vector3glMatrix.vec3

3D Vector to move by.

zoom(amount)

Zoom the camera from its center.

Parameters:
NameTypeDescription
amountnumber

Amount to zoom by (in the order of 0.05), negative values to zoom out.