Load a model into current viewer.
Signature:
loadModel(modelId: string, configOrOnProgress?: LoadModelConfig | ProgressFn, changeCamera?: boolean, islocal?: boolean, path?: string | IFile[]): Promise<string>;
Parameter | Description |
---|---|
modelId | The global unique ID to this model under developer account. |
configOrOnProgress | LoadModelConfig | Config object for model loading. Accept config object or onProgress callback function. |
changeCamera | Modify the camera position and rotation to fit the entire scene after model being loaded. |
islocal | |
path | string | |
Returns:
Promise<string>
A promise contains the model id.
var modelId = '';
var viewer = new Modelo.View.Viewer3D("model");
// using config object
viewer.loadModel(modelId, { initialTransform: [], onProgress: percentage => console.log('load', percentage) });
// shortcut if progress report is the only thing needed
viewer.loadModel(modelId, percentage => console.log('upload', percentage));
// load model with initial camera
var cameraInfo = {
at: [15.57903783461154, -25.414359459288228, 22.210090505989292],
distance: 113.14927943427459,
fov: 46,
phi: -0.12480681479775713,
theta: 4.154997199769766,
};
viewer.loadModel(modelId, { cameraInfo });