WL
WL : object
Wonderland Engine API
Kind: global namespace
- WL : object
- .canvas : HTMLCanvasElement
- .xrSession : XRSession
- .onXRSupported : Array.<xrSupportCallback>
- .onSceneLoaded : Array.<sceneLoadedCallback>
- .arSupported
- .vrSupported
- .scene : Scene
- .physics : Physics
- .Type : enum
- .Collider : enum
- .Alignment : enum
- .Justification : enum
- .TextEffect : enum
- .InputType : enum
- .LightType : enum
- .AnimationState : enum
- .ForceMode : enum
- .CollisionEventType : enum
- .Shape : enum
- .MeshIndexType : enum
- .onXRSessionStart : Array.<xrSessionStartCallback>
- .onXRSessionEnd : Array.<xrSessionEndCallback>
- .MeshAttribute
- .textures
- .registerComponent(name, params, object)
- .init()
- .reset()
- ._initPhysics()
- .getTempBufferU8(count) ⇒ Uint8Array
- .getTempBufferU16(count) ⇒ Uint16Array
- .getTempBufferU32(count) ⇒ Uint32Array
- .getTempBufferI32(count) ⇒ Int32Array
- .getTempBufferF32(count) ⇒ Float32Array
- .isString(value) ⇒
- ._wrapComponent(type, componentType, componentId) ⇒ CollisionComponent | TextComponent | ViewComponent | MeshComponent | InputComponent | LightComponent | AnimationComponent | PhysXComponent | Component
- .CustomParameter : object
- .xrSessionStartCallback : function
- .xrSessionEndCallback : function
- .xrSupportCallback : function
- .sceneLoadedCallback : function
- .collisionCallback : function
.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
.onXRSupported : Array.<xrSupportCallback>
List of functions to call once VR/AR support has been determined.
Kind: static property of WL
.onSceneLoaded : Array.<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 : Scene
Current main scene
Kind: static property of WL
.physics : Physics
Physics, only available when physx is enabled in the runtime
Kind: static property of WL
.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 as well. |
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 be chosen over Sphere and AxisAlignedBox if really necessary. |
.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 |
Bottom | number | 4 | Text bottom is at object origin |
.TextEffect : enum
Effect type enum for TextComponent
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
None | number | 0 | Text is rendered normally |
Outline | number | 1 | Text is rendered with an outline |
.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 |
Spot | number | 2 | Spot light |
Sun | number | 3 | 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 |
.CollisionEventType : enum
Collision callback event type
Kind: static enum of WL
Properties
Name | Type | Default | Description |
---|---|---|---|
Touch | number | 0 | Touch/contact detected, collision |
TouchLost | number | 1 | Touch/contact lost, uncollide |
TriggerTouch | number | 2 | Touch/contact with trigger detected |
TriggerTouchLost | number | 3 | Touch/contact with trigger lost |
.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 |
.onXRSessionStart : Array.<xrSessionStartCallback>
List of functions to call if a WebXR session is started
Kind: static constant of WL
.onXRSessionEnd : Array.<xrSessionEndCallback>
List of functions to call if a WebXR session ends
Kind: static constant of WL
.MeshAttribute
Mesh attribute enum
Kind: static constant of WL
Enum{number}:
0.9.0+
.Position
Position attribute, 3 floats
Kind: static property of MeshAttribute
.Tangent
Tangent attribute, 4 floats
Kind: static property of MeshAttribute
.Normal
Normal attribute, 3 floats
Kind: static property of MeshAttribute
.TextureCoordinate
Texture coordinate attribute, 2 floats
Kind: static property of MeshAttribute
.Color
Color attribute, 4 floats, RGBA, range 0
to 1
Kind: static property of MeshAttribute
.JointId
Joint id attribute, 4 unsigned ints
Kind: static property of MeshAttribute
.JointWeight
Joint weights attribute, 4 floats
Kind: static property of MeshAttribute
.SecondaryJointId
Secondary joint id attribute, 4 unsigned ints
Kind: static property of MeshAttribute
.SecondaryJointWeight
Secondary joint weights attribute, 4 floats
Kind: static property of MeshAttribute
.textures
Access to the textures managed by Wonderland Engine
Kind: static constant 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 |
.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
.init ()
Initialize API resources, called by the engine automatically.
Kind: static method of WL
.reset ()
Reset the runtime state, including: - Component cache - Images - Callbacks
Kind: static method of WL
._initPhysics ()
Initialize API resources, called by the engine automatically, if PhysX is enabled.
Kind: static method of WL
.getTempBufferU8 (count) ⇒ Uint8Array
Returns a uint8 buffer view on temporary WASM memory.
Note: this method might allocate if the requested memory is bigger than the current temporary memory allocated.
Kind: static method of WL
Returns: Uint8Array - A TypedArray over the WASM memory
Param | Type | Description |
---|---|---|
count | number | The number of elements required |
.getTempBufferU16 (count) ⇒ Uint16Array
Returns a uint16 buffer view on temporary WASM memory.
Note: this method might allocate if the requested memory is bigger than the current temporary memory allocated.
Kind: static method of WL
Returns: Uint16Array - A TypedArray over the WASM memory
Param | Type | Description |
---|---|---|
count | number | The number of elements required |
.getTempBufferU32 (count) ⇒ Uint32Array
Returns a uint32 buffer view on temporary WASM memory.
Note: this method might allocate if the requested memory is bigger than the current temporary memory allocated.
Kind: static method of WL
Returns: Uint32Array - A TypedArray over the WASM memory
Param | Type | Description |
---|---|---|
count | number | The number of elements required. |
.getTempBufferI32 (count) ⇒ Int32Array
Returns a int32 buffer view on temporary WASM memory.
Note: this method might allocate if the requested memory is bigger than the current temporary memory allocated.
Kind: static method of WL
Returns: Int32Array - A TypedArray over the WASM memory
Param | Type | Description |
---|---|---|
count | number | The number of elements required |
.getTempBufferF32 (count) ⇒ Float32Array
Returns a float32 buffer view on temporary WASM memory.
Note: this method might allocate if the requested memory is bigger than the current temporary memory allocated.
Kind: static method of WL
Returns: Float32Array - A TypedArray over the WASM memory
Param | Type | Description |
---|---|---|
count | number | The number of elements required |
.isString (value) ⇒
Check if a given value is a native string or a String
instance
Kind: static method of WL
Returns: true
if the value
has type string literal or String
, false
otherwise
Param | Type | Description |
---|---|---|
value | Object | The value to check |
._wrapComponent (type, componentType, componentId) ⇒ CollisionComponent | TextComponent | ViewComponent | MeshComponent | InputComponent | LightComponent | AnimationComponent | PhysXComponent | Component
Retrieves a component instance if it exists, or create and cache a new one
Kind: static method of WL
Returns: CollisionComponent | TextComponent | ViewComponent | MeshComponent | InputComponent | LightComponent | AnimationComponent | PhysXComponent | Component - JavaScript instance wrapping the native component
Param | Type | Description |
---|---|---|
type | string | component type name |
componentType | number | Component manager index |
componentId | number | Component id in the manager |
.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 |
.xrSessionStartCallback : function
Kind: static typedef of WL
Param | Type | Description |
---|---|---|
session | XRSession | WebXR session that started |
.xrSessionEndCallback : function
Kind: static typedef of WL
.xrSupportCallback : function
Kind: static typedef of WL
Param | Type | Description |
---|---|---|
type | string | Type of session which is supported/not supported. Either "vr" or "ar" |
supported | boolean | Whether given session type is supported |
.sceneLoadedCallback : function
Kind: static typedef of WL
.collisionCallback : function
Kind: static typedef of WL
Param | Type | Description |
---|---|---|
type | CollisionEventType | Type of the event |
other | PhysXComponent | Other component that was (un)collided with |