Index
Enumerations
Interfaces
Types
Properties
Methods
Types
EmitPathDescriptor
A descriptor for an emit component property contained by a scene object.
Type declaration
-
component: Scene.IComponent
The component with the property.
-
id: string
The user defined id of the path. This id must be a unique string for the scene object.
-
node: Scene.INode
The parent scene node of the component.
-
property: string
The property name of the component.
-
type: Scene.PathType.EMIT
The type of the path: PathType.EMIT
EventPathDescriptor
A descriptor for an event component property contained by a scene object.
Type declaration
-
component: Scene.IComponent
The component with the property.
-
id: string
The user defined id of the path. This id must be a unique string for the scene object.
-
node: Scene.INode
The parent scene node of the component.
-
property: string
The property name of the component.
-
type: Scene.PathType.EVENT
The type of the path: PathType.EVENT
InputPathDescriptor
A descriptor for an input component property contained by a scene object.
Type declaration
-
component: Scene.IComponent
The component with the property.
-
id: string
The user defined id of the path. This id must be a unique string for the scene object.
-
node: Scene.INode
The parent scene node of the component.
-
property: string
The property name of the component.
-
type: Scene.PathType.INPUT
The type of the path: PathType.INPUT
InteractionEvent
The payload for a 3D interaction event.
Type declaration
-
collider: Object3D
-
Optional hover?: undefined | false | true
-
input: unknown
-
normal: Vector3 | null
-
point: Vector3 | null
OutputPathDescriptor
A descriptor for an output component property contained by a scene object.
Type declaration
-
component: Scene.IComponent
The component with the property.
-
id: string
The user defined id of the path. This id must be a unique string for the scene object.
-
node: Scene.INode
The parent scene node of the component.
-
property: string
The property name of the component.
-
type: Scene.PathType.OUTPUT
The type of the path: PathType.OUTPUT
PredefinedOutputs
Type declaration
-
collider: Object3D | null
Set this to any Object3D and it will be interactable. See IComponent.onEvent
-
object
Root: Object3D | null Set this to any Object3D and it will be added to the scene.
SceneComponentName
Properties
THREE
Direct access to the three.js instance used by Showcase.
The type typeof THREE is resolved from the three npm package's type definitions.
Install three (or @types/three) in your project for full type support.
const THREE = sdk.Scene.THREE;
const geometry = new THREE.BoxGeometry(1, 1, 1);
Methods
configure
-
This is a convenience function that provides access to three.js framework objects. Typically used to configure global properties on the renderer or effect composer.
await sdk.Scene.configure(function(renderer, three, effectComposer){ // configure PBR renderer.physicallyCorrectLights = true; // configure shadow mapping renderer.shadowMap.enabled = true; renderer.shadowMap.bias = 0.0001; renderer.shadowMap.type = three.PCFSoftShadowMap; if (effectComposer) { // add a custom pass here } });Parameters
-
callback: function
-
-
Parameters
-
renderer: WebGLRenderer
Matterport's WebGLRenderer object.
-
three: typeof THREE
three.js module.
-
effectComposer: EffectComposer | null
Matterport's EffectComposer object. This value can be null. To enable the effect composer, you must set useEffectComposer: 1 in your application config. Please note that enabling effect composer disables renderer.antialias (&aa=1)
Returns void
-
-
-
Returns Promise<void>
-
createNode
-
Creates a scene node.
Returns Promise<Scene.INode>
A promise that resolves with the new scene node.
createNodes
-
Creates an array of scene nodes.
Parameters
-
count: number
The number of scene nodes to create.
Returns Promise<Scene.INode[]>
A promise that resolves with the array of scene nodes.
-
createObjects
-
Creates an array of scene objects.
Parameters
-
count: number
The number of scene objects to create.
Returns Promise<Scene.IObject[]>
A promise that resolves with the array of scene objects.
// create a single object and destructure it from the returned array const [sceneObject] = await sdk.Scene.createObjects(1); const node = sceneObject.addNode(); // ... -
deserialize
-
This function returns a scene object with all of its scene nodes from a serialized scene. The returned scene object has not been started yet.
Parameters
-
text: string
The serialized scene.
Returns Promise<Scene.IObject>
A promise that resolves with a scene object.
-
register
-
Register a component factory.
Parameters
-
name: string
A unique component name.
-
factory: function
A function that returns a new instance of the component.
-
-
Returns Scene.IComponent
-
-
Returns Promise<IDisposable | null>
a disposable that can be used to unregister the component.
-
registerComponents
-
Register an array of component factories all at once and return an array of disposables. Calling dispose on any of the returned disposables, unregisters the component.
function myComponent1Factory() { return new MyComponent1(); } function myComponent2Factory() { return new MyComponent2(); } const disposables = await sdk.Scene.registerComponents([ { name: 'myComponent1', factory: myComponent1Factory, }, { name: 'myComponent2', factory: myComponent2Factory, }, ]); // when you are done with the components, you can unregister the components by calling dispose on each item in the return result. for (const disposable of disposables) { disposable.dispose(); }Parameters
-
components: Scene.IComponentDesc[]
An array of IComponentDesc
Returns Promise<IDisposable[] | null>
an array of disposables that unregister the components when disposed.
-
serialize
-
Serialize a scene object, its nodes, and their components to a string.
Parameters
-
sceneObject: Scene.IObject
Returns Promise<string>
A promise that resolves with the serialized string.
-
-
This function serializes an array of scene nodes and their components to a string. This function is only provided to provide an upgrade path from nodes that were created before the introduction of
IObjects.Parameters
-
sceneNodes: Scene.INode[]
An array of scene nodes.
Returns Promise<string>
A promise that resolves with the serialized string.
-
unregisterComponents
-
Parameters
-
components: Scene.IComponentDesc[]
Returns Promise<void>
-
The Scene namespace is currently only available for Bundle SDK distributions. Learn more about the Bundle SDK