Type Alias: ThreeDPreviewService
ThreeDPreviewService =
PreviewService&object
Type Declaration
animateToLastCameraFocus()
animateToLastCameraFocus():
Promise<void>
Restores the product camera to it's last set focus point. If the user has been panning this will animate the camera to the original focus point. If the camera is still focused on it's origin point this function is a noop.
Returns
Promise<void>
executeCameraAnimation()
executeCameraAnimation(
animation):Promise<void>
Executes an animation of the camera.
Parameters
animation
The animation to execute.
Returns
Promise<void>
flipTransform()
flipTransform(
position?,rotation?,scale?):object
Flips a given transform from one handedness to another. NOTE: Will provide sensible defaults if only some values are provided.
Parameters
position?
The position vector for the transform
rotation?
The rotation vector for the transform. NOTE: Should be expressed in radians.
scale?
The scale vector for the transform
Returns
object
position
position:
Vector
rotation
rotation:
Vector
scale
scale:
Vector
forceStopCameraAnimations()
forceStopCameraAnimations():
void
Forces the camera to stop any animations that are currently running. Note this will not resolve any existing promises.
Returns
void
getAllModels()
getAllModels(): readonly
ModelContainer[]
Returns all loaded models.
Returns
readonly ModelContainer[]
A map of id to model container.
getCameraPose()
getCameraPose():
CameraPose|undefined
Returns the values of the Arc Rotate Camera
Returns
CameraPose | undefined
getCurrentConfiguration()
getCurrentConfiguration():
PreviewOptions|undefined
Returns the current configuration object applied to the scene.
Returns
PreviewOptions | undefined
getModelById()
getModelById(
id):ModelContainer|undefined
Retrieves a loaded model by it's id.
Parameters
id
string
The id of the model to retrieve.
Returns
ModelContainer | undefined
The model container if it exists, undefined otherwise.
loadModel()
loadModel(
modelDetails,options?):ModelContainer
Loads a model into the scene.
Parameters
modelDetails
The details of the model to load.
options?
Optional configuration.
progressHandler?
(event) => void
An event handler that is called when loading progress changes.
refocusCamera?
boolean
When true, camera will automatically animate to the model after it loads.
Default
true
Returns
A reference to the model container. Call getInitializationPromise() to wait for the model to be loaded.
orbitEnabled()
orbitEnabled():
boolean
Returns true when the current configuration allows the user to rotate around the product.
Returns
boolean
preloadModel()
preloadModel(
url):Promise<void>
Preloads a model into the scene. This will load the model into memory, but it will not be visible in the scene.
Parameters
url
string
The url of the model to preload.
Returns
Promise<void>
registerFocusLostListener()
registerFocusLostListener(
listener):void
Allows listeners to be aware of the camera losing focus of the main product.
Parameters
listener
() => void
A function to be called when focus is lost.
Returns
void
registerModelLoadEventListener()
registerModelLoadEventListener(
listener):void
Provides listeners with information about model load events.
Parameters
listener
(e) => void
A function to get load events. The eventType will be 'load' or 'unload', and the modelContainer will be the model that was loaded or unloaded.
Returns
void
registerPlugin()
registerPlugin(
plugin):void
Registers a plugin with the preview service.
Parameters
plugin
The plugin to register.
Returns
void
renderSceneScreenshot()
renderSceneScreenshot(
resolution,cameraAnimation):Promise<string>
Takes a screenshot of the scene using a given camera animation otherwise using the existing orientation of the camera in the scene. A resolution must be provided to render the scene at.
Parameters
resolution
number
cameraAnimation
Returns
Promise<string>
setAutoRotation()
setAutoRotation(
shouldAutoRotate):void
When configuration has allowed for auto rotation we can pause the rotation via this function.
Parameters
shouldAutoRotate
boolean
When true rotation is running, paused otherwise.
Returns
void
setCameraPose()
setCameraPose(
cameraPose):void
Sets the values of the Arc Rotate Camera
Parameters
cameraPose
Returns
void
setCameraState()
setCameraState(
rigType):void
Controls the current control state of the camera.
Parameters
rigType
The control type to use.
Returns
void
setHighlightMaterials()
setHighlightMaterials(
materials):void
Takes a list of material names supported by the highlighter. This function must be notified of materials for highlighting to work.
Parameters
materials
string[]
A list of material names to allow highlighting on.
Returns
void
setHighlights()
setHighlights(
materials):void
Designed for use when utilizing the 3D preview in an editor format. Given a list of material names, highlights the associated meshes in the scene.
Parameters
materials
readonly MaterialHandle[]
Returns
void
setRenderingPipelineConfiguration()
setRenderingPipelineConfiguration(
renderingPipelineConfiguration):void
Sets the rendering pipeline configuration for the scene. Overwrites any existing configuration.
Parameters
renderingPipelineConfiguration
RenderingPipelineConfiguration
The configuration to apply. Empty values will be set to default.
Returns
void
unregisterFocusLostListener()
unregisterFocusLostListener(
listener):void
Removes a listener from the focusLost observers. The listener will no longer be notified
Parameters
listener
() => void
The listener to remove.
Returns
void
unregisterModelLoadEventListener()
unregisterModelLoadEventListener(
listener):void
Allows you to pass any function that originally called registerModelLoadEventListener() to have it excluded from load events. If the function was never registered this call has no effect.
Parameters
listener
(e) => void
The listener to exclude from load events.
Returns
void
unregisterPlugin()
unregisterPlugin(
plugin):void
Removes a plugin from the preview service.
Parameters
plugin
The plugin to remove.
Returns
void
updatePreviewOptions()
updatePreviewOptions(
options):void
Sets the preview options for the scene. Certain options may not be applied, as they are only applicable upon initialization.
Parameters
options
The options to apply.
Returns
void