Class DollyCamera

Class representing some Geometry.

Hierarchy (view full)

Constructors

Properties

aspect: number

The aspect ratio of the perspective matric - normally defined as width / height

1
autoRotate: boolean
autoRotateSpeed: number
bottom: number

The bottom plane of the orthagraphic view

children: Obj[]

The children of this object

dollyStart: Vec2
ease: number
element: HTMLElement
enabled: boolean
enablePan: boolean
enableRotate: boolean
enableZoom: boolean
far: number

The far point of the perspective matrix

100
fov: number

The field of view of the perspective matrix, in degrees

45
frustum: {
    [key: string]: {
        constant: number;
        pos: Vec3;
    };
}
inertia: number
left: number

The left plane of the orthagraphic view

matrix: Mat4

A matrix representing the translation, rotation and scale of this object.

matrixAutoUpdate: boolean

Whether to automatically calculate the object matrix each time updateWorldMatrix is called. Convenient, but potentially costly.

maxAzimuthAngle: number
maxDistance: number
maxPolarAngle: number
minAzimuthAngle: number
minDistance: number
minPolarAngle: number
mouseButtons: {
    ORBIT: number;
    PAN: number;
    ZOOM: number;
}
near: number

The near point of the perspective matrix

.1
offset: Vec3
panDelta: Vec3
panSpeed: number
panStart: Vec2
parent?: null | Obj

The parent of this object.

position: Vec3

Object position

projectionMatrix: Mat4

The camera projection matrix gives a vector space projection to a subspace.

projectionViewMatrix: Mat4

The combined projection and view matrix.

quaternion: Quat

Object rotation, expressed as a quaternion

right: number

The right plane of the orthagraphic view

rotateSpeed: number
rotateStart: Vec2
rotation: Vec3

Object rotation, expressed as a 3D Euler rotation

scale: Vec3

Object scale

spherical: Vec3
sphericalDelta: Vec3
sphericalTarget: Vec3
state: number
target: Vec3
top: number

The top plane of the orthagraphic view

type: "orthographic" | "perspective"

The camera type - perspective or orthographic. If left / right are provided this will default to orthographic, otherwise it will default to perspective

up: Vec3

The up unit vector

viewMatrix: Mat4

The camera view matrix transforms vertices from world-space to view-space.

visible: boolean

Whether this objec is visible or not. This will stop the renderer from trying to render this object

worldMatrix: Mat4

The world matrix represents the function of all ancestor matrices and the matrix of this object

worldMatrixNeedsUpdate: boolean = false

A boolean indicating whether the world matrix requires updating.

worldPosition: Vec3

The position in world space

zoom: number

The zoom level of the orthagraphic view

1
zoomSpeed: number
zoomStyle: string
STATE_DOLLY: number = 2
STATE_DOLLY_PAN: number = 8
STATE_NONE: number = 0
STATE_PAN: number = 4
STATE_ROTATE: number = 1

Methods

  • Adds a child object to this and indicates whether to notify the child

    Parameters

    • child: Obj

      The object to add as a child of this one

    • notifyChild: boolean = true

      Whether to set the parent of the indicated child to this

    Returns void

  • Determines whether the camera frustum intersects the supplied drawable object. Used mainly for frustum culling.

    Parameters

    • node: Drawable

      The node to test intersection against

    Returns boolean

    Boolean indicating intersection

  • Determines whether the frustum intersects a sphere

    Parameters

    • center: Vec3

      The center of the sphere to test.

    • radius: number

      The radius of the sphere to test.

    Returns boolean

    Boolean indicating intersection

  • Remove a child from this object.

    Parameters

    • child: Obj

      The child to remove

    • notifyChild: boolean = true

      Whether to notify the child of the removal

    Returns void

  • Sets the parent of this object and indicates whether to set a child relationship on the parent.

    Parameters

    • parent: null | Obj

      The parent object to use

    • notifyParent: boolean = true

      Whether to set the full parent-child relationsjip

    Returns void

  • Traverses the object tree and runs a given function against the object. If true is returned, the traversal is stopped. This is useful for testing things like visibility etc.

    Parameters

    • callback: ((node: Obj) => null | boolean)

      The function to call, it should return true or null based on some condition

        • (node): null | boolean
        • Parameters

          Returns null | boolean

    Returns void

  • UpdateRotation should be called whenever a change to the quaternion variable is made. This will update the rotation in response to the change in the quaternion. For example:

    const Box = new Mesh(gl, { geometry: BoxGeo, program });
    Box.quaternion = Quat.fromAxisAngle(new Vec3(1,0,0), Math.PI*-.25);
    Box.updateQuaternion();
    console.log(Box.rotation) // {_x: 0.7853981633974483, _y: 0, _z: 0}

    Returns void

  • UpdateRotation should be called whenever a change to the rotation variable is made. This will update the quaternion in response to the change in the rotation. For example:

    const Box = new Mesh(gl, { geometry: BoxGeo, program });
    Box.rotation.x = Math.PI*.25;
    Box.updateRotation();
    console.log(Box.quaternion) // {_x: 0.3826834323650898, _y: 0, _z: 0, _w: 0.9238795325112867}

    Returns void