WL
WL : object
Wonderland Engine Library
Kind: global namespace
- WL : object
- .canvas : HTMLCanvasElement
- .xrSession : XRSession
- .onXRSessionStart : xrSessionStartCallback
- .onXRSessionEnd : xrSessionEndCallback
- .onXRSupported : xrSupportCallback
- .onSceneLoaded : sceneLoadedCallback
- .arSupported
- .vrSupported
- .scene
- .physics
- .textures
- .Type : enum
- .Collider : enum
- .Alignment : enum
- .Justification : enum
- .InputType : enum
- .LightType : enum
- .AnimationState : enum
- .ForceMode : enum
- .Shape : enum
- .MeshIndexType : enum
- .registerComponent(name, params, object)
- .CustomParameter : object
.canvas : HTMLCanvasElement
Canvas element that Wonderland Engine renders to
Kind: static property of WL
.xrSession : XRSession
Current WebXR session or null if no session active
Kind: static property of WL
.onXRSessionStart : xrSessionStartCallback
List of functions to call if a WebXR session is started
Kind: static property of WL
.onXRSessionEnd : xrSessionEndCallback
List of functions to call if a WebXR session ends
Kind: static property of WL
.onXRSupported : xrSupportCallback
List of functions to call once VR/AR support has been determined.
Kind: static property of WL
.onSceneLoaded : sceneLoadedCallback
List of functions to call once the main scene has been loaded
Kind: static property of WL
.arSupported
Whether AR is supported by the browser
undefined
until support could be determined
Kind: static property of WL
.vrSupported
Whether VR is supported by the browser
undefined
until support could be determined
Kind: static property of WL
.scene
Current main scene
Kind: static property of WL
Type{wl.scene}:
.physics
Physics, only available when physx is enabled in the runtime
Kind: static property of WL
Type{wl.physics}:
.textures
Access to the texures managed by Wonderland Engine
Kind: static property of WL
.load(filename, crossOrigin) ⇒ Promise.<Texture>
Load an image from URL as Texture
Kind: static method of textures
Returns: Promise.<Texture> - Loaded texture
Param | Type | Description |
---|---|---|
filename | string | URL to load from |
crossOrigin | string | Cross origin flag for the Image object |
.Type : enum
Component parameter type enum
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Bool | number | Bool: Appears in the editor as checkbox. | |
Int | number | Int: Appears in the editor as int input field. | |
Float | number | Float: Appears in the editor as float input field. | |
String | number | String / Text: Appears in the editor as text input field. | |
Enum | number | Enumeration: Appears in the editor as dropdown with given values. If parameters is enum, a values parameter needs to be specified for the parameter aswell. |
|
Object | number | Object reference: Appears in the editor as object resource selection dropdown with object picker. | |
Mesh | number | Mesh reference: Appears in the editor as mesh resource selection dropdown. | |
Texture | number | Texture reference: Appears in the editor as texture resource selection dropdown. | |
Material | number | Material reference: Appears in the editor as material resource selection dropdown. | |
Animation | number | Animation reference: Appears in the editor as animation resource selection dropdown. | |
Skin | number | Skin reference: Appears in the editor as skin resource selection dropdown. |
.Collider : enum
Collider type enum for CollisionComponent
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Sphere | number | 0 | Sphere Collider: Simplest and most performant collision shape. If this type is set on a CollisionComponent, only the first component of extents will be used to determine the radius. |
AxisAlignedBox | number | 1 | Axis Aligned Bounding Box Collider: Box that is always aligned to XYZ axis. It cannot be rotated but is more efficient than Box. |
Box | number | 2 | Aligned Bounding Box Collider: Box that matches the object’s rotation and translation correctly. This is the least efficient collider and should only chosen over Sphere and AxisAlignedBox if really neccessary. |
.Alignment : enum
Alignment type enum for TextComponent
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Left | number | 1 | Text start is at object origin |
Center | number | 2 | Text center is at object origin |
Right | number | 3 | Text end is at object origin |
.Justification : enum
Justification type enum for TextComponent
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Line | number | 1 | Text line is at object origin |
Middle | number | 2 | Text middle is at object origin |
Top | number | 3 | Text top is at object origin |
.InputType : enum
Input type enum for InputComponent
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Head | number | 0 | Head input |
EyeLeft | number | 1 | Left eye input |
EyeRight | number | 2 | Right eye input |
ControllerLeft | number | 3 | Left controller input |
ControllerRight | number | 4 | Right controller input |
RayLeft | number | 5 | Left ray input |
RayRight | number | 6 | Right ray input |
.LightType : enum
Light type enum for LightComponent
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Point | number | 1 | Point light |
Sun | number | 2 | Sun light / Directional light |
.AnimationState : enum
Animation state of AnimationComponent
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Playing | number | 1 | Animation is currently playing |
Paused | number | 2 | Animation is paused and will continue at current playback time on play |
Stopped | number | 3 | Animation is stopped |
.ForceMode : enum
Rigid body force mode for addForce and addTorque.
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Force | number | 0 | Apply as force |
Impulse | number | 1 | Apply as impulse |
VelocityChange | number | 2 | Apply as velocity change, mass dependent |
Acceleration | number | 3 | Apply as mass dependent force |
.Shape : enum
Rigid body shape.
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
None | number | 0 | No shape |
Sphere | number | 1 | Sphere shape |
Capsule | number | 2 | Capsule shape |
Box | number | 3 | Box shape |
Plane | number | 4 | Plane shape |
ConvexMesh | number | 5 | Convex mesh shape |
TriangleMesh | number | 6 | Triangle mesh shape |
.MeshIndexType : enum
Mesh index type
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
UnsignedByte | number | 1 | Single byte mesh index, range 0-255 |
UnsignedShort | number | 2 | Two byte mesh index, range 0-65535 |
UnsignedInt | number | 4 | Four byte mesh index, range 0-4294967295 |
.registerComponent(name, params, object)
Register a custom JavaScript component type
Kind: static method of WL
Param | Type | Description |
---|---|---|
name | string | Name of the component |
params | object | Dict of param names to CustomParameter |
object | Component | Object containing functions for the component type |
Example
WL.registerComponent('my-new-type', {
myParam: {type: WL.Type.Float, default: 42.0},
}, {
init: function() {},
start: function() {},
update: function(dt) {},
});
.CustomParameter : object
Kind: static typedef of WL
Properties
Name | Type | Description |
---|---|---|
type | Type | Parameter type |
[default] | * | Default value, depending on type. |
values | Array.<string> | Values for Enum |