EmbeddedViewer
This is the main object for embedding the viewer on a website.
Constructor
new EmbeddedViewer (parentElement, parameters)
Parameters
parentElement
HTMLElement
The parent element for the viewer canvas. It must be an existing DOM element and it will be the container for the canvas. The size of the viewer will be automatically adjusted to the size of the parent element.
parameters
object
Parameters for embedding.
Camera to use. If not specified, the default camera will be used and the model will be fitted to the window.
Camera projection mode.
Background color of the canvas.
Default color of the model. It has effect only if the imported model doesn't specify any color.
Default line color of the model. It has effect only if the imported model doesn't specify any color.
Edge settings.
Environment settings.
onModelLoaded
function
(optional)
Callback that is called when the model with all of the textures is fully loaded.
Methods
LoadModelFromUrlList (modelUrls)
Description
Loads the model based on a list of urls. The list must contain the main model file and all of the referenced files. For example in case of an obj file the list must contain the corresponding mtl and texture files, too.
Parameters
modelUrls
string[]
Url list of model files.
LoadModelFromFileList (fileList)
Description
Loads the model based on a list of File objects. The list must contain the main model file and all of the referenced files. You must use this method when you are using a file picker or drag and drop to select files from a computer.
Parameters
fileList
File[]
File object list of model files.
LoadModelFromInputFiles (inputFiles)
Description
Loads the model based on a list of InputFile objects. This method is used internally, you should use LoadModelFromUrlList or LoadModelFromFileList instead.
Parameters
inputFiles
InputFile[]
List of model files.
GetViewer ()
Description
Returns the underlying Viewer object.
Returns
Viewer
GetModel ()
Description
Returns the underlying Model object.
Returns
Model
Resize ()
Description
This method must be called when the size of the parent element changes to make sure that the context has the same dimensions as the parent element.
Destroy ()
Description
Frees up all the memory that is allocated by the viewer. You should call this function if yo don't need the viewer anymore.