Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

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

Events

  • on(event: "modelLoaded", callback: (modelId: string) => void, scope?: any): string
  • on(event: "modelUnloaded", callback: (modelId: string) => void, scope?: any): string
  • on(event: "rendering", callback: (renderEvent: { pass: number; sceneId: number }) => void, scope?: any): string
  • on(event: "rendered", callback: (renderEvent: { pass: number; sceneId: number }) => void, scope?: any): string
  • on(event: "objectVisibility", callback: (entity: VBOSceneModel | Mesh | Node) => void, scope?: any): string
  • on(event: "tick", callback: (tickEvent: TickEvent) => void, scope?: any): string
  • Fires when a model is loaded

    Parameters

    • event: "modelLoaded"

      The loaded event

    • callback: (modelId: string) => void

      Called fired on the event

        • (modelId: string): void
        • Parameters

          • modelId: string

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • Fires when a model is unloaded

    Parameters

    • event: "modelUnloaded"

      The loaded event

    • callback: (modelId: string) => void

      Called fired on the event

        • (modelId: string): void
        • Parameters

          • modelId: string

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • Fired when about to render a frame for a Scene.

    Parameters

    • event: "rendering"

      The rendering event

    • callback: (renderEvent: { pass: number; sceneId: number }) => void

      Called fired on the event

        • (renderEvent: { pass: number; sceneId: number }): void
        • Parameters

          • renderEvent: { pass: number; sceneId: number }
            • pass: number
            • sceneId: number

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • Fired when we have just rendered a frame for a Scene.

    Parameters

    • event: "rendered"

      The rendered event

    • callback: (renderEvent: { pass: number; sceneId: number }) => void

      Called fired on the event

        • (renderEvent: { pass: number; sceneId: number }): void
        • Parameters

          • renderEvent: { pass: number; sceneId: number }
            • pass: number
            • sceneId: number

          Returns void

    • Optional scope: any

      Scope for the callback

    Returns string

  • Fires when the entity visibility is updated.

    Parameters

    Returns string

  • Fired on each game loop iteration.

    Parameters

    • event: "tick"
    • callback: (tickEvent: TickEvent) => void

      Called fired on the event

    • Optional scope: any

      Scope for the callback

    Returns string

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 aabb(): number[]
  • Gets the World-space axis-aligned 3D boundary (AABB) of this Scene.

    The AABB is represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. [xmin, ymin,zmin,xmax,ymax, zmax].

    When the Scene has no content, will be [-100,-100,-100,100,100,100].

    Returns number[]

  • get center(): number[]
  • get clearEachPass(): boolean
  • set clearEachPass(value: boolean): void
  • When Scene.passes is greater than 1, indicates whether or not to clear the canvas before each pass (true) or just before the first pass (false).

    Default value is false.

    Returns boolean

  • When Scene.passes is greater than 1, indicates whether or not to clear the canvas before each pass (true) or just before the first pass (false).

    Default value is false.

    Parameters

    • value: boolean

    Returns void

  • get colorizedObjectIds(): string[]
  • get colorizedObjects(): {}
  • get entityOffsetsEnabled(): boolean
  • get gammaFactor(): number
  • set gammaFactor(value: number): void
  • get gammaInput(): boolean
  • set gammaInput(value: boolean): void
  • Gets whether or not Scene should expect all {@link Texture}s and colors to have pre-multiplied gamma.

    Default value is false.

    Returns boolean

  • Sets whether or not Scene should expect all {@link Texture}s and colors to have pre-multiplied gamma.

    Default value is false.

    Parameters

    • value: boolean

    Returns void

  • get gammaOutput(): boolean
  • set gammaOutput(value: boolean): void
  • get highlightedObjectIds(): string[]
  • get highlightedObjects(): {}
  • get logarithmicDepthBufferEnabled(): boolean
  • Whether logarithmic depth buffer is enabled.

    This is set via the Viewer constructor and is false by default.

    Returns boolean

    True if logarithmic depth buffer is enabled.

  • get modelIds(): string[]
  • get models(): {}
  • get numColorizedObjects(): number
  • get numHighlightedObjects(): number
  • get numObjects(): number
  • get numSelectedObjects(): number
  • get numVisibleObjects(): number
  • get numXRayedObjects(): number
  • get objectIds(): string[]
  • get objects(): {}
  • get offsetObjectIds(): string[]
  • get offsetObjects(): {}
  • get opacityObjectIds(): string[]
  • get opacityObjects(): {}
  • 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 passes(): number
  • set passes(value: number): void
  • get pbrEnabled(): boolean
  • set pbrEnabled(value: boolean): void
  • get pickSurfacePrecisionEnabled(): boolean
  • Whether precision surface picking is enabled.

    This is set via the Viewer constructor and is false by default.

    The pickSurfacePrecision option for Scene.pick only works if this is set true.

    Note that when true, this configuration will increase the amount of browser memory used by the Viewer.

    Returns boolean

    True if precision picking is enabled.

  • get sao(): SAO
  • get selectedObjectIds(): string[]
  • get selectedObjects(): {}
  • get startTime(): Date
  • get ticksPerOcclusionTest(): number
  • set ticksPerOcclusionTest(value: number): void
  • get ticksPerRender(): number
  • set ticksPerRender(value: number): void
  • get visibleObjectIds(): string[]
  • get visibleObjects(): {}
  • get xrayedObjectIds(): string[]
  • get xrayedObjects(): {}

Methods

  • clear(): void
  • clearLights(): void
  • clearSectionPlanes(): void
  • destroy(): void
  • doOcclusionTest(): 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

  • getAABB(ids: string[]): number[]
  • 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
  • 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

  • pick(params: { canvasPos?: number[]; direction?: number[]; excludeEntities?: string[]; includeEntities?: string[]; matrix?: number[]; origin?: number[]; pickSurface?: boolean; pickSurfaceNormal?: boolean; pickSurfacePrecision?: boolean }, pickResult?: PickResult): null | PickResult
  • Attempts to pick an Entity in this Scene.

    Parameters

    • params: { canvasPos?: number[]; direction?: number[]; excludeEntities?: string[]; includeEntities?: string[]; matrix?: number[]; origin?: number[]; pickSurface?: boolean; pickSurfaceNormal?: boolean; pickSurfacePrecision?: boolean }

      Picking parameters.

      • Optional canvasPos?: number[]
      • Optional direction?: number[]
      • Optional excludeEntities?: string[]
      • Optional includeEntities?: string[]
      • Optional matrix?: number[]
      • Optional origin?: number[]
      • Optional pickSurface?: boolean
      • Optional pickSurfaceNormal?: boolean
      • Optional pickSurfacePrecision?: boolean
    • Optional pickResult: PickResult

    Returns null | PickResult

    Holds results of the pick attempt, returned when an Entity is picked, else null. See method comments for description.

  • render(forceRender?: boolean): void
  • Renders a single frame of this Scene.

    The Scene will periodically render itself after any updates, but you can call this method to force a render if required.

    Parameters

    • Optional forceRender: boolean

    Returns void

  • setObjectsCollidable(ids: string[], collidable: boolean): boolean
  • setObjectsColorized(ids: string[], colorize: number[]): boolean
  • setObjectsCulled(ids: string[], culled: boolean): boolean
  • setObjectsEdges(ids: string[], edges: boolean): boolean
  • setObjectsHighlighted(ids: string[], highlighted: boolean): boolean
  • setObjectsOffset(ids: string[], offset: number[]): void
  • setObjectsOpacity(ids: string[], opacity: number): boolean
  • setObjectsPickable(ids: string[], pickable: boolean): boolean
  • setObjectsSelected(ids: string[], selected: boolean): boolean
  • setObjectsVisible(ids: string[], visible: boolean): boolean
  • setObjectsXRayed(ids: string[], xrayed: boolean): boolean
  • 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

  • withObjects(ids: string[], callback: Function): boolean

Generated using TypeDoc