CameraBase

Lore. CameraBase

An abstract class representing the base for camera implementations.

Constructor

new CameraBase()

Source:
Properties:
Name Type Description
type string

The type name of this object (Lore.CameraBase).

renderer Lore.Renderer

A Lore.Renderer object.

isProjectionMatrixStale boolean

A boolean indicating whether or not the projection matrix was changed and has to be updated.

projectionMatrix Lore.ProjectionMatrix

A Lore.ProjectionMatrix object.

viewMatrix Lore.Matrix4f

A Lore.Matrix4f object representing the view matrix for this camera.

Creates an instance of CameraBase.

Methods

getProjectionMatrix() → {Float32Array}

Source:

Returns the projection matrix of this camera instance as an array.

Returns:

The entries of the projection matrix.

Type
Float32Array

getViewMatrix() → {Float32Array}

Source:

Returns the view matrix of this camera instance as an array.

Returns:

The entries of the view matrix.

Type
Float32Array

init(gl, program) → {CameraBase}

Source:

Initializes this camera instance.

Parameters:
Name Type Description
gl any

A gl context.

program any

A program pointer.

Returns:

Returns itself.

Type
CameraBase

sceneToScreen(vec, renderer) → {Array}

Source:

Projects a vector into screen space.

Parameters:
Name Type Description
vec Vector3f

A vector.

renderer Renderer

An instance of a Lore renderer.

Returns:

An array containing the x and y position in screen space.

Type
Array

setLookAt(vec) → {CameraBase}

Source:

Sets the lookat of this camera instance.

Parameters:
Name Type Description
vec Vector3f

The vector to set the lookat to.

Returns:

Returns itself.

Type
CameraBase

updateProjectionMatrix() → {Vector3f}

Source:

Virtual Method

Returns:

Returns itself.

Type
Vector3f

updateViewMatrix() → {Vector3f}

Source:

Upates the view matrix of this camera.

Returns:

Returns itself.

Type
Vector3f

updateViewport(width, height)

Source:

Has to be called when the viewport size changes (e.g. window resize).

Parameters:
Name Type Description
width Number

The width of the viewport.

height Number

The height of the viewport.