Reference Source
public class | source

SkyboxesPlugin

Extends:

Plugin → SkyboxesPlugin

Viewer plugin that manages skyboxes

Example:


// Create a Viewer
const viewer = new Viewer({
    canvasId: "myCanvas"
});

// Add a GLTFModelsPlugin
var gltfLoaderPlugin = new GLTFModelsPlugin(viewer, {
    id: "GLTFModels"  // Default value
});

// Add a SkyboxesPlugin
var skyboxesPlugin = new SkyboxesPlugin(viewer, {
    id: "Skyboxes" // Default value
});

// Load a glTF model
const model = gltfLoaderPlugin.load({
    id: "myModel",
    src: "./models/gltf/mygltfmodel.gltf"
});

// Create three directional World-space lights. "World" means that they will appear as if part
// of the world, instead of "View", where they move with the user's head.

skyboxesPlugin.createLight({
    id: "keyLight",
    dir: [0.8, -0.6, -0.8],
    color: [1.0, 0.3, 0.3],
    intensity: 1.0,
    space: "world"
});

skyboxesPlugin.createLight({
    id: "fillLight",
    dir: [-0.8, -0.4, -0.4],
    color: [0.3, 1.0, 0.3],
    intensity: 1.0,
    space: "world"
});

skyboxesPlugin.createDirLight({
    id: "rimLight",
    dir: [0.2, -0.8, 0.8],
    color: [0.6, 0.6, 0.6],
    intensity: 1.0,
    space: "world"
});

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

skyboxes: {}

Method Summary

Public Methods
public

clear()

Destroys all skyboxes.

public

createSkybox(id: String, params: Object): Skybox

Creates a skybox.

public

Destroys this plugin.

public

destroySkybox(id: *)

Destroys a skybox.

Inherited Summary

From class Plugin
public

ID for this Plugin, unique within its Viewer.

public

The Viewer that contains this Plugin.

public

Destroys this Plugin and removes it from its Viewer.

public

error(msg: String)

Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

fire(event: String, value: Object, forget: Boolean)

Fires an event on this Plugin.

public

Returns true if there are any subscribers to the given event on this Plugin.

public

log(msg: String)

Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

off(subId: String)

Cancels an event subscription that was previously made with Plugin#on or Plugin#once.

public

on(event: String, callback: Function, scope: Object): String

Subscribes to an event on this Plugin.

public

once(event: String, callback: Function, scope: Object)

Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

public

scheduleTask(task: *)

Schedule a task to perform on the next browser interval

public

warn(msg: String)

Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.

Public Constructors

public constructor() source

Creates this Plugin and installs it into the given Viewer.

Override:

Plugin#constructor

Public Members

public skyboxes: {} source

Public Methods

public clear() source

Destroys all skyboxes.

public createSkybox(id: String, params: Object): Skybox source

Creates a skybox.

Params:

NameTypeAttributeDescription
id String

Unique ID to assign to the skybox.

params Object

Skybox configuration.

params.active Boolean
  • optional
  • default: true

Whether the skybox plane is initially active. Only skyboxes while this is true.

Return:

Skybox

The new skybox.

public destroy() source

Destroys this plugin.

Clears skyboxes from the Viewer first.

Override:

Plugin#destroy

public destroySkybox(id: *) source

Destroys a skybox.

Params:

NameTypeAttributeDescription
id *