Interfaces

.ComponentProperty: Interface 

Custom component property.

For more information about component properties, have a look at the Properties attribute.

Properties

NameTypeDescription
defaultanyDefault value, depending on type.
requiredboolean
typeTypeProperty type.
valuesstring[]Values for Enum

.ComponentProto: Interface 

Component prototype interface.

User component’s should have the same structure.

Properties

NameTypeDescription
init() ⇒ voidTriggered after the component instantiation. For more information, please have a look at init.
onActivate() ⇒ voidTriggered when the component goes from deactivated to activated. For more information, please have a look at onActivate.
onDeactivate() ⇒ voidTriggered when the component goes from activated to deactivated. For more information, please have a look at onDeactivate.
onDestroy() ⇒ void0.8.5+ Triggered when the component is removed from its object. For more information, please have a look at onDestroy.
start() ⇒ voidTriggered after the component is activated for the first time. For more information, please have a look at start.
update(dt: number) ⇒ voidTriggered once per frame. For more information, please have a look at update.

.GLTFExtensions: Interface 

Extension data obtained from glTF files.

Properties

NameTypeDescription
idMappingnumber[]Remapping from glTF node index to objectId.
meshRecord<number, Record<string, Record<string, any»>Mesh extension objects. Key is objectId, value is JSON data indexed by extension name.
nodeRecord<number, Record<string, Record<string, any»>Node extension objects. Key is objectId, value is JSON data indexed by extension name.
rootRecord<string, Record<string, any»glTF root extensions object. JSON data indexed by extension name.

.ListenerOptions: Interface 

Registration options for a listener in an Emitter.

Properties

NameTypeDescription
idanyListener identifier. This is used to find and remove the listener without needing the callback reference. The identifier can be any type. However, remember that the comparison will be by-value for primitive types (string, number), but by reference for objects. For more information, please look at the remove method.
oncebooleanIf true, the listener is automatically removed after it’s invoked. Defaults to false.

.LoadRuntimeOptions: Interface 

Options to forward to loadRuntime

Properties

NameTypeDescription
canvasstringCanvas id or element. If this is undefined, looks for a canvas with id ‘canvas’.
loaderbooleanIf true, forces the runtime to load a loader-compatible version. This option allows to load gltf data at runtime.
loadingScreenstringPath to the loading screen. If undefined, defaults to ‘WonderlandRuntime-LoadingScreen.bin’. Beware that these are special .bin files signed by Wonderland. Customizing requires an enterprise license, please reach out for more information.
logsLogLevel[]Logging level(s) to enable. By default, all levels are enabled.
physxbooleanIf true, forces the runtime to load a physx-compatible version. Note: If your scene uses physx, you must enable this option.
simdbooleanIf true, forces the runtime to load the SIMD-compatible version. If undefined, performs browser feature detection to check whether SIMD is supported or not.
threadsbooleanIf true, forces the runtime to load the threads-compatible version. If undefined, performs browser feature detection to check whether threads are supported or not.
xrFramebufferScaleFactornumberDefault framebuffer scale factor. This can later be changed using xrFramebufferScaleFactor
xrOfferSessionXROfferSessionOptions0.8.5+ Whether to advertise AR/VR session support to the browser. Adds an interactive UI element to the browser interface to start an XR session. Browser support is optional, so it’s advised to still allow requesting a session with a UI element on the website itself. If undefined, no XR session is automatically offered to the browser.

.MaterialParameters: Interface 

Constructor parameters object for a Material instance.

Properties

NameTypeDescription
pipelinestringThe name of the pipeline.

.MeshParameters: Interface 

Mesh constructor parameters object.

Usage:

1const mesh = Mesh({vertexCount: 3, indexData: [0, 1, 2]});

Properties

NameTypeDescription
indexDataReadonly<NumberArray>Index data values.
indexTypeMeshIndexTypeIndex type, null if not indexed.
skinningTypeMeshSkinningTypeWhether the mesh should be skinned. Defaults to not skinned.
vertexCountnumberNumber of vertices to allocate.

.NumberArray: Interface 

Represents any object that can be used as an array for read / write.

Properties

NameTypeDescription
lengthnumber

.PropertyReferenceOptions: Interface 

Options to create a reference property, i.e., object, mesh, animation, skin, etc…

Properties

NameTypeDescription
requiredbooleanIf true, the component will throw if the property isn’t initialized.

.RetainListenerOptions: Interface 

Registration options for a listener in an RetainEmitter.

Those options extend ListenerOptions.

Properties

NameTypeDescription
idanyListener identifier. This is used to find and remove the listener without needing the callback reference. The identifier can be any type. However, remember that the comparison will be by-value for primitive types (string, number), but by reference for objects. For more information, please look at the remove method.
immediatebooleanIf true, directly resolves if the emitter retains a value. If false, the listener isn’t invoked until the next notify. Defaults to true.
oncebooleanIf true, the listener is automatically removed after it’s invoked. Defaults to false.

.SceneAppendParameters: Interface 

Options for append.

Properties

NameTypeDescription
baseURLundefinedstring
loadGltfExtensionsbooleanWhether to load glTF extension data

.SceneLoadOptions: Interface 

Scene loading options.

Properties

NameTypeDescription
baseURLstringPath from which resources are resolved (images, languages, etc…).
bufferArrayBufferAn in-memory buffer, containing the bytes of a .bin file.

.XROfferSessionOptions: Interface 

0.8.5+

Options for xrOfferSession

Properties

NameTypeDescription
featuresstring[]Required features for the offered XR session
mode‘auto’XRSessionMode
optionalFeaturesstring[]Optional features for the offered XR session

.CollisionCallback: Type Alias 

Definition:

1CollisionCallback = (type: CollisionEventType, other: PhysXComponent)  void

.ComponentConstructor: Type Alias 

Component constructor type.

For more information, please have a look at the Component class.

Definition:

1ComponentConstructor<T: extends Component> = Constructor<T> & {
2    InheritProperties: boolean;
3    Properties: Record<string, ComponentProperty>;
4    TypeName: string;
5    _isBaseComponent: boolean;
6    onRegister: (engine: WonderlandEngine)  void;
7}

.Constructor: Type Alias 

Definition:

1Constructor<T> = (...args: any[][])  T

.ImageLike: Type Alias 

Element that can be used as an image in the engine.

Definition:

1ImageLike = HTMLImageElement | HTMLVideoElement | HTMLCanvasElement

.ListenerCallback: Type Alias 

Definition:

1ListenerCallback<T: extends unknown[]> = (...data: T[])  void

.PropertyArgs: Type Alias 

Retrieve all the argument types of a Property function.

Definition:

1PropertyArgs<key: extends PropertyKeys> = Parameters<['undefined']>

.PropertyKeys: Type Alias 

All the keys that exists on the Property object.

Definition:

1PropertyKeys = keyof undefined

.SceneAppendResult: Type Alias 

Result obtained when appending a scene with append.

Definition:

1SceneAppendResult = Object3D | null | SceneAppendResultWithExtensions

.SceneAppendResultWithExtensions: Type Alias 

Result obtained when appending a scene with append with gltf extensions.

Definition:

1SceneAppendResultWithExtensions = {
2    extensions: GLTFExtensions;
3    root: Object3D | null;
4}

.TypedArray: Type Alias 

Typed array instance based on a given TypedArrayCtor constructor.

Definition:

1TypedArray<T: extends TypedArrayCtor> = InstanceType<T>

.TypedArrayCtor: Type Alias 

A type alias for any TypedArray constructor, except big-int arrays.

Definition:

1TypedArrayCtor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor

.Version: Type Alias 

Version type following a subset of the Semantic Versioning specification.

Definition:

1Version = {
2    major: number;
3    minor: number;
4    patch: number;
5    rc: number;
6}