Class Camera

Constructors

Properties

active: boolean

Is this camera active, default: true

aspectRatio: number

Aspect ratio of the camera, default: 1

far: number

Far clipping plane, default: 100

fov: number

Field of view in degrees, default: 45

fpAngleX: number
fpAngleY: number
fpFly: boolean
fpHandlersAdded: boolean
fpMode: boolean
fpMoveSpeed: number
fpTurnSpeed: number
keysDown: Set<string>
lookAt: XYZ

Camera look at point, default: [0, 0, 0]

maxAngleDown: number = ...
maxAngleUp: number = ...
near: number

Near clipping plane, default: 0.1

orthoZoom: number

Orthographic zoom level, only used when type is orthographic, default: 20

position: XYZ

Camera position

touches: Touch[] = []

Change camera projection, default: CameraType.PERSPECTIVE

up: XYZ

Camera up vector, default: [0, 1, 0]

usedForEnvMap: boolean

Is this camera used for a dynamic environment map, default: false

usedForShadowMap: boolean

Is this camera used for a shadow map, default: false

Accessors

  • get matrix(): mat4
  • Get the current view matrix for the camera

    Returns mat4

  • get projectionMatrix(): mat4
  • Get the projection matrix for this camera

    Returns mat4

Methods

  • Switches the camera to first person mode, where the camera is controlled by the mouse and keyboard. The mouse controls look direction and the keyboard controls movement.

    Parameters

    • angleY: number = 0

      Starting look up/down angle in radians, default 0

    • angleX: number = 0

      Starting look left/right angle in radians, default 0

    • turnSpeed: number = 0.001

      Speed of looking in radians, default 0.001

    • moveSpeed: number = 1.0

      Speed of moving in units, default 1.0

    • fly: boolean = false

    Returns void

  • Get the corners of the view frustum for this camera in world space

    Parameters

    • scaleFar: number = 1

      Scale the far plane to bring the frustum closer, default: 1

    Returns {
        center: vec3;
        farBottomLeftWorld: vec3;
        farBottomRightWorld: vec3;
        farTopLeftWorld: vec3;
        farTopRightWorld: vec3;
        nearBottomLeftWorld: vec3;
        nearBottomRightWorld: vec3;
        nearTopLeftWorld: vec3;
        nearTopRightWorld: vec3;
    }

    • center: vec3
    • farBottomLeftWorld: vec3
    • farBottomRightWorld: vec3
    • farTopLeftWorld: vec3
    • farTopRightWorld: vec3
    • nearBottomLeftWorld: vec3
    • nearBottomRightWorld: vec3
    • nearTopLeftWorld: vec3
    • nearTopRightWorld: vec3
  • Get the center of the camera view frustum

    Parameters

    • scaleFar: number = 1

    Returns XYZ

    Point in world space

  • Get the camera position as a string for debugging

    Returns string

  • Called every frame to update the camera, currently only used for movement in FP mode

    Returns void

Generated using TypeDoc