Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Camera<EventTypes>

Camera is a device from which the world is viewed.

Type parameters

  • EventTypes: string | symbol

Hierarchy

Implements

  • TransformId

Index

Constructors

constructor

  • new Camera(renderer: Renderer): Camera
  • Creates a new camera using the specified renderer. By default the camera looks towards negative z and is positioned at z = 5.

    Parameters

    • renderer: Renderer

      Renderer to use.

    Returns Camera

Properties

Private Optional _aspect

_aspect: undefined | number

Private _far

_far: number = 1000

Private _fieldOfView

_fieldOfView: number = 60

Private _near

_near: number = 0.1

Private _orthographic

_orthographic: boolean = false

Private _orthographicSize

_orthographicSize: number = 10

Private Optional _projection

_projection: MatrixComponent

Private _transformId

_transformId: number = 0

Private Optional _view

_view: MatrixComponent

Private Optional _viewProjection

_viewProjection: MatrixComponent

renderer

renderer: Renderer

Renderer to use.

transform

transform: Transform3D = new Transform3D()

Static main

main: Camera

Main camera which is used by default.

Static prefixed

prefixed: string | boolean

Accessors

aspect

  • get aspect(): undefined | number
  • set aspect(value: number | undefined): void
  • The aspect ratio (width divided by height). If not set, the aspect ratio of the renderer will be used by default.

    Returns undefined | number

  • The aspect ratio (width divided by height). If not set, the aspect ratio of the renderer will be used by default.

    Parameters

    • value: number | undefined

    Returns void

far

  • get far(): number
  • set far(value: number): void
  • The far clipping plane distance, 1000 is the default value.

    Returns number

  • The far clipping plane distance, 1000 is the default value.

    Parameters

    • value: number

    Returns void

fieldOfView

  • get fieldOfView(): number
  • set fieldOfView(value: number): void
  • The vertical field of view in degrees, 60 is the default value.

    Returns number

  • The vertical field of view in degrees, 60 is the default value.

    Parameters

    • value: number

    Returns void

localTransform

near

  • get near(): number
  • set near(value: number): void
  • The near clipping plane distance, 0.1 is the default value.

    Returns number

  • The near clipping plane distance, 0.1 is the default value.

    Parameters

    • value: number

    Returns void

orthographic

  • get orthographic(): boolean
  • set orthographic(value: boolean): void
  • Camera will render objects uniformly, with no sense of perspective.

    Returns boolean

  • Camera will render objects uniformly, with no sense of perspective.

    Parameters

    • value: boolean

    Returns void

orthographicSize

  • get orthographicSize(): number
  • set orthographicSize(value: number): void
  • The camera's half-size when in orthographic mode. The visible area from center of the screen to the top.

    Returns number

  • The camera's half-size when in orthographic mode. The visible area from center of the screen to the top.

    Parameters

    • value: number

    Returns void

position

projection

  • get projection(): Float32Array

rotationQuaternion

scale

transformId

  • get transformId(): number

view

  • get view(): Float32Array

viewProjection

  • get viewProjection(): Float32Array

worldTransform

z

  • get z(): number
  • set z(value: number): void
  • The position of the object on the z axis relative to the local coordinates of the parent.

    Returns number

  • The position of the object on the z axis relative to the local coordinates of the parent.

    Parameters

    • value: number

    Returns void

Methods

addListener

  • addListener(event: EventTypes, fn: ListenerFn, context?: any): this
  • Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

destroy

  • destroy(options?: boolean | IDestroyOptions): void

emit

  • emit(event: EventTypes, ...args: Array<any>): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: EventTypes
    • Rest ...args: Array<any>

    Returns boolean

eventNames

  • eventNames(): Array<EventTypes>
  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<EventTypes>

listenerCount

  • listenerCount(event: EventTypes): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: EventTypes

    Returns number

listeners

  • Return the listeners registered for a given event.

    Parameters

    • event: EventTypes

    Returns Array<ListenerFn>

off

  • off(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: undefined | false | true): this
  • Parameters

    • event: EventTypes
    • Optional fn: EventEmitter.ListenerFn
    • Optional context: any
    • Optional once: undefined | false | true

    Returns this

on

  • on(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

once

  • once(event: EventTypes, fn: ListenerFn, context?: any): this
  • Add a one-time listener for a given event.

    Parameters

    • event: EventTypes
    • fn: ListenerFn
    • Optional context: any

    Returns this

removeAllListeners

  • Remove all listeners, or those of the specified event.

    Parameters

    Returns this

removeListener

  • removeListener(event: EventTypes, fn?: EventEmitter.ListenerFn, context?: any, once?: undefined | false | true): this
  • Remove the listeners of a given event.

    Parameters

    • event: EventTypes
    • Optional fn: EventEmitter.ListenerFn
    • Optional context: any
    • Optional once: undefined | false | true

    Returns this

screenToRay

  • screenToRay(x: number, y: number, viewSize?: { height: number; width: number }): undefined | Ray
  • Converts screen coordinates to a ray.

    Parameters

    • x: number

      Screen x coordinate.

    • y: number

      Screen y coordinate.

    • Default value viewSize: { height: number; width: number } = this.renderer

      The size of the view when not rendering to the entire screen.

      • height: number
      • width: number

    Returns undefined | Ray

screenToWorld

  • Converts screen coordinates to world coordinates.

    Parameters

    • x: number

      Screen x coordinate.

    • y: number

      Screen y coordinate.

    • distance: number

      Distance from the camera.

    • Default value point: ObservablePoint3D = new ObservablePoint3D(() => { }, undefined)

      Point to set.

    • Default value viewSize: { height: number; width: number } = this.renderer

      The size of the view when not rendering to the entire screen.

      • height: number
      • width: number

    Returns undefined | ObservablePoint3D

worldToScreen

  • worldToScreen(x: number, y: number, z: number, point?: Point, viewSize?: { height: number; width: number }): Point
  • Converts world coordinates to screen coordinates.

    Parameters

    • x: number

      World x coordinate.

    • y: number

      World y coordinate.

    • z: number

      World z coordinate.

    • Default value point: Point = new PIXI.Point()

      Point to set.

    • Default value viewSize: { height: number; width: number } = this.renderer

      The size of the view when not rendering to the entire screen.

      • height: number
      • width: number

    Returns Point

Generated using TypeDoc