Options
All
  • Public
  • Public/Protected
  • All
Menu

Manages viewing and projection transforms for its Scene.

Hierarchy

Index

Constructors

  • new Camera(owner?: any, cfg?: {}): Camera

Properties

id: string

ID of this Component, unique within the Scene.

Components are mapped by this ID in {@link Scene.components}.

property

id

meta: any

Arbitrary, user-defined metadata on this component.

property

metadata

scene: Scene

The parent Scene that contains this Component.

property

scene

final
viewer: Viewer

The viewer that contains this Scene.

property

viewer

Accessors

  • get constrainPitch(): boolean
  • set constrainPitch(arg: boolean): void
  • Gets whether to prevent camera from being pitched upside down.

    The camera is upside down when the angle between Camera.up and Camera.worldUp is less than one degree.

    Default value is false.

    Returns boolean

    true if pitch rotation is currently constrained.

  • Sets whether to prevent camera from being pitched upside down.

    The camera is upside down when the angle between Camera.up and Camera.worldUp is less than one degree.

    Fires a {@link Camera.constrainPitch:event} event on change.

    Default value is false.

    Parameters

    • arg: boolean

    Returns void

    true if pitch rotation is currently constrained.

  • get customProjection(): CustomProjection
  • get deviceMatrix(): number[]
  • set deviceMatrix(arg: number[]): void
  • get eye(): number[]
  • set eye(arg: number[]): void
  • Gets the position of the Camera's eye.

    Default vale is [0,0,10].

    emits

    "eye" event on change, with the value of this property.

    Returns number[]

  • Sets the position of the Camera's eye.

    Default value is [0,0,10].

    emits

    "eye" event on change, with the value of this property.

    Parameters

    • arg: number[]

    Returns void

  • get eyeLookDist(): boolean
  • get frustum(): Frustum
  • get gimbalLock(): boolean
  • set gimbalLock(arg: boolean): void
  • Gets whether to lock yaw rotation to pivot about the World-space "up" axis.

    Fires a {@link Camera.gimbalLock:event} event on change.

    params

    {Boolean} gimbalLock Set true to lock gimbal.

    Returns boolean

    Returns true if gimbal is locked.

  • Sets whether to lock yaw rotation to pivot about the World-space "up" axis.

    Fires a {@link Camera.gimbalLock:event} event on change.

    params

    {Boolean} gimbalLock Set true to lock gimbal.

    Parameters

    • arg: boolean

    Returns void

  • get inverseViewMatrix(): number[]
  • get look(): number[]
  • set look(arg: number[]): void
  • Gets the position of this Camera's point-of-interest.

    Default value is [0,0,0].

    emits

    "look" event on change, with the value of this property.

    Returns number[]

    Camera look position.

  • Sets the position of this Camera's point-of-interest.

    Default value is [0,0,0].

    emits

    "look" event on change, with the value of this property.

    Parameters

    • arg: number[]

    Returns void

  • get matrix(): number[]
  • Gets the Camera's viewing transformation matrix.

    Fires a {@link Camera.matrix:event} event on change.

    Returns number[]

    The viewing transform matrix.

  • get normalMatrix(): number[]
  • The Camera's viewing normal transformation matrix.

    Fires a {@link Camera.matrix:event} event on change.

    Returns number[]

    The viewing normal transform matrix.

  • get ortho(): Ortho
  • The Component that owns the lifecycle of this Component, if any.

    When that component is destroyed, this component will be automatically destroyed also.

    Will be null if this Component has no owner.

    property

    owner

    Returns Component

  • get perspective(): Perspective
  • get projMatrix(): number[]
  • Gets the Camera's projection transformation projMatrix.

    Fires a {@link Camera.projMatrix:event} event on change.

    Returns number[]

    The projection matrix.

  • get project(): Perspective | Ortho | Frustum | CustomProjection
  • Gets the currently active projection for this Camera.

    The currently active project is selected with Camera.projection.

    Returns Perspective | Ortho | Frustum | CustomProjection

    The currently active projection is active.

  • get projection(): "perspective" | "ortho" | "frustum" | "customProjection"
  • set projection(arg: "perspective" | "ortho" | "frustum" | "customProjection"): void
  • Gets the active projection type.

    Possible values are "perspective", "ortho", "frustum" and "customProjection".

    Default value is "perspective".

    Returns "perspective" | "ortho" | "frustum" | "customProjection"

    Identifies the active projection type.

  • Sets the active projection type.

    Accepted values are "perspective", "ortho", "frustum" and "customProjection".

    Default value is "perspective".

    Parameters

    • arg: "perspective" | "ortho" | "frustum" | "customProjection"

    Returns void

  • get up(): number[]
  • set up(arg: number[]): void
  • get viewMatrix(): number[]
  • Gets the Camera's viewing transformation matrix.

    Fires a {@link Camera.matrix:event} event on change.

    Returns number[]

    The viewing transform matrix.

  • get viewNormalMatrix(): number[]
  • The Camera's viewing normal transformation matrix.

    Fires a {@link Camera.matrix:event} event on change.

    Returns number[]

    The viewing normal transform matrix.

  • get worldAxis(): number[]
  • set worldAxis(arg: number[]): void
  • Gets the up, right and forward axis of the World coordinate system.

    Has format: [rightX, rightY, rightZ, upX, upY, upZ, forwardX, forwardY, forwardZ]

    Default axis is [1, 0, 0, 0, 1, 0, 0, 0, 1]

    Returns number[]

    The current World coordinate axis.

  • Sets the up, right and forward axis of the World coordinate system.

    Has format: [rightX, rightY, rightZ, upX, upY, upZ, forwardX, forwardY, forwardZ]

    Default axis is [1, 0, 0, 0, 1, 0, 0, 0, 1]

    Parameters

    • arg: number[]

    Returns void

  • get worldForward(): number[]
  • get worldRight(): number[]
  • get worldUp(): number[]
  • get xUp(): boolean
  • get yUp(): boolean
  • get zUp(): boolean

Methods

  • clear(): void
  • destroy(): void
  • error(message: string): void
  • Logs an error for this component to the JavaScript console.

    The console message will have this format: [ERROR] [<component type> =<component id>: <message>

    Also fires the message as an "error" event on the parent Scene.

    Parameters

    • message: string

      The message to log

    Returns void

  • fire(event: string, value: any, forget?: boolean): void
  • Fires an event on this component.

    Notifies existing subscribers to the event, optionally retains the event to give to any subsequent notifications on the event as they are made.

    Parameters

    • event: string

      The event type name

    • value: any

      The event parameters

    • Optional forget: boolean

    Returns void

  • hasSubs(event: string): boolean
  • Returns true if there are any subscribers to the given event on this component.

    Parameters

    • event: string

      The event

    Returns boolean

    True if there are any subscribers to the given event on this component.

  • isType(type: any): boolean
  • log(message: string): void
  • Logs a console debugging message for this component.

    The console message will have this format: [LOG] [<component type> <component id>: <message>

    Also fires the message as a "log" event on the parent Scene.

    Parameters

    • message: string

      The message to log

    Returns void

  • off(subId: string): void
  • on(event: string, callback: Function, scope?: any): string
  • Subscribes to an event on this component.

    The callback is be called with this component as scope.

    Parameters

    • event: string

      The event

    • callback: Function

      Called fired on the event

    • Optional scope: any

    Returns string

    Handle to the subscription, which may be used to unsubscribe with .off.

  • once(event: string, callback: Function, scope?: any): void
  • Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

    This is equivalent to calling Component.on, and then calling Component.off inside the callback function.

    Parameters

    • event: string

      Data event to listen to

    • callback: Function

      Called when fresh data is available at the event

    • Optional scope: any

    Returns void

  • orbitPitch(angleInc: number): void
  • orbitYaw(angleInc: number): void
  • pan(pan: number[]): void
  • pitch(angleInc: number): void
  • warn(message: string): void
  • Logs a warning for this component to the JavaScript console.

    The console message will have this format: [WARN] [<component type> =<component id>: <message>

    Also fires the message as a "warn" event on the parent Scene.

    Parameters

    • message: string

      The message to log

    Returns void

  • yaw(angleInc: number): void
  • zoom(delta: number): void

Generated using TypeDoc