Class ModelPreviewComponent
Defined in: ModelPreviewComponent.js.
Constructor Attributes | Constructor Name and Description |
---|---|
ModelPreviewComponent(canvasId, pitchAndScaleChangeSupported, transformationsChangeSupported)
Creates a model preview component.
|
Method Attributes | Method Name and Description |
---|---|
clear()
Stops rotation animation and clears buffers used by its canvas.
|
|
dispose()
Removes listeners bound to global objects and clears this component.
|
|
Returns the HTML element used to view this component at screen.
|
|
Returns the depth of the 3D model.
|
|
Returns the elevation of the 3D model.
|
|
Returns the height of the 3D model.
|
|
Returns the transformations applied to 3D model.
|
|
Returns the width of the 3D model.
|
|
Returns the abscissa of the 3D model.
|
|
Returns the ordinate of the 3D model.
|
|
Returns the material of the shape last picked by the user.
|
|
Returns the
pitch angle used by view platform transform. |
|
Returns the zoom factor used by view platform transform.
|
|
Returns the
yaw angle used by view platform transform. |
|
setModel(model, modelFlags, modelRotation, width, depth, height, onerror, onprogression)
Loads and displays the given 3D model.
|
|
setModelMaterials(materials)
Sets the materials applied to 3D model.
|
|
setModelTransformations(transformations)
Sets the transformations applied to 3D model
|
|
setViewPitch(viewPitch)
Sets the
pitch angle used by view platform transform. |
|
setViewScale(viewScale)
Sets the zoom factor used by view platform transform.
|
|
setViewYaw(viewYaw)
Sets the
yaw angle used by view platform transform. |
|
startRotationAnimation(roundsPerMinute)
Starts rotation animation.
|
|
Stops the running rotation animation.
|
Class Detail
ModelPreviewComponent(canvasId, pitchAndScaleChangeSupported, transformationsChangeSupported)
Creates a model preview component.
Author: Emmanuel Puybaret.
Author: Emmanuel Puybaret.
- Parameters:
- {string} canvasId
- the ID of the 3D canvas where a model will be viewed
- {boolean} pitchAndScaleChangeSupported
- if
true
the component will handles events to let the user rotate the displayed model - {boolean} transformationsChangeSupported Optional
- if
true
the component will handles events to let the user transform the displayed model
Method Detail
clear()
Stops rotation animation and clears buffers used by its canvas.
dispose()
Removes listeners bound to global objects and clears this component.
This method should be called to free resources in the browser when this component is not needed anymore.
getHTMLElement()
Returns the HTML element used to view this component at screen.
{number}
getModelDepth()
Returns the depth of the 3D model.
- Returns:
- {number}
{number}
getModelElevation()
Returns the elevation of the 3D model.
- Returns:
- {number}
{number}
getModelHeight()
Returns the height of the 3D model.
- Returns:
- {number}
{Array}
getModelTransformations()
Returns the transformations applied to 3D model.
- Returns:
- {Array}
{number}
getModelWidth()
Returns the width of the 3D model.
- Returns:
- {number}
{number}
getModelX()
Returns the abscissa of the 3D model.
- Returns:
- {number}
{number}
getModelY()
Returns the ordinate of the 3D model.
- Returns:
- {number}
{HomeMaterial}
getPickedMaterial()
Returns the material of the shape last picked by the user.
- Returns:
- {HomeMaterial}
{number}
getViewPitch()
Returns the
pitch
angle used by view platform transform.
- Returns:
- {number}
{number}
getViewScale()
Returns the zoom factor used by view platform transform.
- Returns:
- {number}
{number}
getViewYaw()
Returns the
yaw
angle used by view platform transform.
- Returns:
- {number}
setModel(model, modelFlags, modelRotation, width, depth, height, onerror, onprogression)
Loads and displays the given 3D model.
- Parameters:
- {URLContent} model
- a content with a URL pointing to a 3D model to parse and view
- {boolean|Number} modelFlags Optional
- if
true
, displays opposite faces - {Array} modelRotation
- a 3x3 array describing how to transform the 3D model
- {number} width Optional
- optional width of the model
- {number} depth Optional
- optional width of the model
- {number} height Optional
- optional width of the model
- onerror
- callback called in case of error while reading the model
- onprogression
- callback to follow the reading of the model
setModelMaterials(materials)
Sets the materials applied to 3D model.
- Parameters:
- {Array} materials
setModelTransformations(transformations)
Sets the transformations applied to 3D model
- Parameters:
- {Array} transformations
setViewPitch(viewPitch)
Sets the
pitch
angle used by view platform transform.
- Parameters:
- {number} viewPitch
setViewScale(viewScale)
Sets the zoom factor used by view platform transform.
- Parameters:
- {number} viewScale
setViewYaw(viewYaw)
Sets the
yaw
angle used by view platform transform.
- Parameters:
- {number} viewYaw
startRotationAnimation(roundsPerMinute)
Starts rotation animation.
- Parameters:
- {number} roundsPerMinute Optional
- the rotation speed in rounds per minute, 5rpm if missing
stopRotationAnimation()
Stops the running rotation animation.