Loki

Singleton class stores helper functions and holds on to other singleton classes like the AssetManager.

Constructor

new L3D.Loki()

Properties

static allowScripts bool

If false, user scripts won't be loaded.

static allowXR bool

If false, WebXR will not be enabled.

static catchExceptions bool

If true, exception catching will be done in inner engine loops, otherwise it won't use exception catching to improve performance.

static classes Object

Maps classes name like "Prefab" or "Animation" to its namespace "Loki.Prefab". Used in AssetLoader and AssetManager when reading classnames from JSONs.

static components Object

Contains all of the registered components.

static debug bool

If true, extra debugging info will be logged.

static graph Graph

The current active graph

static hasUserInteraction bool

True when the user has interacted with the page, allowing audio to be played.

static initialized bool

Whether initializeLoki has been called.

static loaderClasses Object

Classes that load assets

static loaderExtensions Object

File extensions registered to AssetLoader

static onComputeNode Signal

Fired when an output of node is about to be computed.

static onException Signal

Fired when an exception was caught.

static onRefreshGraph Signal

Fired when the editor graph should be refreshed.

static onRequestFrame Signal

Fired when a request has been made to redraw all of the canvases.

static onUpdateAsset Signal

Notify the Edtiro to update an asset.

static onUserInteraction Signal

Fired when the user has interacted with the page, allowing audio players to resume or unmute themselves.

static onVariableChange Signal

Fired when a variables value has changed.

static onXRSupportChanged Signal

Fired when the status of XR support has changed.

static scene Scene

The current active scene

static skipDraws number

When not 0, drawing will be disabled, to reduce draw calls during scene loads.

static version number

The current version of the Loki engine

static webPath String

The path to the web server.

Methods

static escapeString(s)

Prepare a string to be used in a JSON strcture or be sent over a web request.

Parameters
s String
Returns

static getVariable(name) → *

Get a variable value, used by variable nodes in a graph.

Parameters
name String
Returns
*

static hasVariable(name) → bool

Check to see if a variable has been defined.

Parameters
name String
Returns
bool

static isArray(obj) → bool

Returns true if the object is an array.

Parameters
obj *
Returns
bool

static isArrayOrTypedArray(obj) → bool

Returns true if the object is either an Array or a TypedArray

Parameters
obj *
Returns
bool

static isEmpty(obj) → bool

Returns true if the object is null, undefined, an object, map, array, or string with no contents.

Parameters
obj *
Returns
bool

static isEqual(a, b)

Test if two values are equal.

Parameters
a *
b *

static isFunction(obj) → bool

Returns true if the object is a function.

Parameters
obj *
Returns
bool

static isNullOrUndefined(obj)

Returns true if the object is null or undefined.

Parameters
obj *

static isNumber(obj) → bool

Returns true if the object is a number.

Parameters
obj *
Returns
bool

static isString(obj) → bool

Returns true if the object is a string.

Parameters
obj *
Returns
bool

static isTypedArray(obj) → bool

Returns true if the object is a typed array, such as Float32Array.

Parameters
obj *
Returns
bool

static requestFrame()

Request all active GLContexts to draw.

static requestUpdate()

Request an update for the acive scene.

static setVariable(name, value)

Set a variable value, used by variable nodes in a graph.

Parameters
name String
value *

static validateName(v) → bool

Checks if the given string is valid to use as an object name. It must start with a letter, and can only contain letters, numbers or "_".

Parameters
v String

The string to check.

Returns
bool

true if the string is valid, false otherwise.