Class: Scene

Scene(containerIn) → {Scene}

new Scene(containerIn) → {Scene}

A Scene contains Region,and CameraControls which controls the viewport and additional features. It is the main object used for controlling what is and what is not displayed on the renderer.
Parameters:
Name Type Description
containerIn Object Container to create the renderer on.
Author:
  • Alan Wu
Source:
Returns:
Type
Scene

Members

ambient

a THREE.AmbientLight for controlling the ambient lighting of this scene.
Source:

directionalLight

A THREE.DirectionalLight object for controlling lighting of this scene.
Source:

Methods

addMetadataTimeStamp()

All time stamp to the metadata TimeStamps field.
Source:

addObject(object)

Add any {THREE.Object} into this scene.
Parameters:
Name Type Description
object THREE.Object to be addded into this scene.
Source:

addZincObject(zincObject) → {THREE.Vector3}

Add zinc object into the root Region of sfcene.
Parameters:
Name Type Description
zincObject ZincObject zinc object ot be added.
Source:
Returns:
Type
THREE.Vector3

alignBoundingBoxToCameraView(boundingBox, transitionTime)

Transition the camera view to view the entirety of the bounding box with a smooth transition within the providied transitionTime.
Parameters:
Name Type Description
boundingBox THREE.Box3 the bounding box to target
transitionTime Number Duration to perform the transition.
Source:

alignObjectToCameraView(zincObject, transitionTime)

Transition the camera into viewing the zinc object with a smooth transition within the providied transitionTime.
Parameters:
Name Type Description
zincObject ZincObject the bounding box to target
transitionTime Number Duration to perform the transition.
Source:

changeZoomByScrollRateUnit()

Set the zoom level by unit scroll rate
Source:

clearAll()

Remove all objects that are created with ZincJS APIs and it will free the memory allocated. This does not remove obejcts that are added using the addObject APIs.
Source:

exportGLTF(binary) → {Promise}

Export the scene in GLTF format, it can either return it in string or binary form.
Parameters:
Name Type Description
binary Boolean Indicate it should be exported as binary or text.
Source:
Returns:
The exported data if the promise resolve successfully
Type
Promise

findGeometriesWithGroupName(GroupName) → {Array}

Find and return all geometries in this scene with the matching GroupName.
Parameters:
Name Type Description
GroupName String Groupname to match with.
Source:
Returns:
Type
Array

findGlyphsetsWithGroupName(GroupName) → {Array}

Find and return all glyphsets in this scene with the matching GroupName.
Parameters:
Name Type Description
GroupName String Groupname to match with.
Source:
Returns:
Type
Array

findLinesWithGroupName(GroupName) → {Array}

Find and return all lines in this scene with the matching GroupName.
Parameters:
Name Type Description
GroupName String Groupname to match with.
Source:
Returns:
Type
Array

findObjectsWithGroupName(GroupName) → {Array}

Find a list of objects with the specified name, this will tranverse through the region tree to find all child objects with matching name.
Parameters:
Name Type Description
GroupName String Groupname to match with.
Source:
Returns:
Type
Array

findPointsetsWithGroupName(GroupName) → {Array}

Find and return all pointsets in this scene with the matching GroupName.
Parameters:
Name Type Description
GroupName String Groupname to match with.
Source:
Returns:
Type
Array

forEachGeometry(callbackFunction)

A function which iterates through the list of geometries and call the callback function with the geometries as the argument.
Parameters:
Name Type Description
callbackFunction function Callback function with the geometry as an argument.
Source:

forEachGlyphset(callbackFunction)

A function which iterates through the list of glyphsets and call the callback function with the glyphset as the argument.
Parameters:
Name Type Description
callbackFunction function Callback function with the glyphset as an argument.
Source:

forEachLine(callbackFunction)

A function which iterates through the list of lines and call the callback function with the lines as the argument.
Parameters:
Name Type Description
callbackFunction function Callback function with the lines as an argument.
Source:

forEachPointset(callbackFunction)

A function which iterates through the list of pointsets and call the callback function with the pointset as the argument.
Parameters:
Name Type Description
callbackFunction function Callback function with the pointset as an argument.
Source:

getBoundingBox() → {THREE.Box3}

Get the bounding box of all the object in this scene only.
Source:
Returns:
Type
THREE.Box3

getBoundingBoxOfZincObjects(objectsArray) → {THREE.Box3}

Get the bounding box of all zinc objects in list.
Parameters:
Name Type Description
objectsArray Array Groupname to match with.
Source:
Returns:
Type
THREE.Box3

getCurrentTime() → {Number}

Get the current time of the scene.
Source:
Returns:
Type
Number

getDownloadProgress() → {Array}

This function returns a three component array, which contains [totalsize, totalLoaded and errorDownload] of all the downloads happening in this scene.
Source:
Returns:
Type
Array

getDuration() → {Number}

Get the default duration value.
Source:
Returns:
Type
Number

getMetadata()

Get all metadata set for the scene.
Source:

getMetadataTag()

Get a specific metadata field.
Source:

getMinimapDiffFromNormalised()

Get the coordinates difference of the current viewing point and projected coordinates.
Source:

getNamedObjectsScreenXY(name) → {THREE.Vector3}

Get the screen coordinate of the centroid of all objects in scene with the provided name.
Parameters:
Name Type Description
name String List of ZincObject.
Source:
Returns:
Type
THREE.Vector3

getNormalisedMinimapCoordinates()

Get the Normalised coordinates on minimap if mouse event is inside the minimap
Source:

getObjectsScreenXY(zincObjects) → {THREE.Vector3}

Get the screen coordinate of the centroid of provided list of objects.
Parameters:
Name Type Description
zincObjects Array List of ZincObject.
Source:
Returns:
Type
THREE.Vector3

getPickableThreeJSObjects()

Get all pickable objects.
Source:

getRootRegion() → {Region}

Get the root region of the scene.
Source:
Returns:
Return the root region of the scene
Type
Region

getThreeJSScene() → {THREE.Scene}

Return the internal {THREE.Scene}.
Source:
Returns:
Type
THREE.Scene

getThreeJSScene() → {THREE.Scene}

Get the internal {THREE.Scene}.
Source:
Returns:
Type
THREE.Scene

getZincCameraControls() → {Zinc.CameraControls}

Get the camera control of this scene.
Source:
Returns:
Type
Zinc.CameraControls

isStereoEffectEnable() → {Boolean}

Check if stereo effect is enabled.
Source:
Returns:
Type
Boolean

isTimeVarying() → {Boolean}

Check if any object in this scene is time varying.
Source:
Returns:
Type
Boolean

loadFromViewURL(URL)

Load a legacy file format containing the viewport and its meta file from an external location provided by the url. Use the new metadata format with Zinc.Scene#loadMetadataURL instead.
Parameters:
Name Type Description
URL String address to the file containing viewport and model information.
Deprecated:
  • Yes
Source:

loadGLTF()

Load GLTF into this scene object.
Source:

loadGlyphsetURL(metaurl, glyphurl, groupName, finishCallback)

Load a glyphset into this scene object.
Parameters:
Name Type Description
metaurl String Provide informations such as transformations, colours and others for each of the glyph in the glyphsset.
glyphurl String regular json model file providing geometry of the glyph.
groupName String name to assign the glyphset's groupname to.
finishCallback function Callback function which will be called once the glyphset is succssfully load in.
Source:

loadLinesURL(metaurl, timeEnabled, morphColour, groupName, finishCallback)

Load lines into this scene object.
Parameters:
Name Type Description
metaurl String Provide informations such as transformations, colours and others for each of the glyph in the glyphsset.
timeEnabled Boolean Indicate if morphing is enabled.
morphColour Boolean Indicate if color morphing is enabled.
groupName STRING name to assign the pointset's groupname to.
finishCallback function Callback function which will be called once the glyphset is succssfully load in.
Source:

loadMetadataURL(url, finishCallback)

Load a metadata file from the provided URL into this scene. Once succssful scene proceeds to read each items into scene for visualisations.
Parameters:
Name Type Description
url String Location of the metafile
finishCallback function Callback function which will be called for each glyphset and geometry that has been written in.
Source:

loadModelsURL()

Load a legacy model(s) format with the provided URLs and parameters. This only loads the geometry without any of the metadata. Therefore, extra parameters should be provided.
Deprecated:
  • Yes
Source:

loadOBJ(url, groupName, finishCallback)

Read a OBJ file into this scene, the geometry will be presented as Zinc.Geometry.
Parameters:
Name Type Description
url STRING location to the STL file.
groupName STRING name to assign the geometry's groupname to.
finishCallback function Callback function which will be called once the OBJ geometry is succssfully loaded.
Source:

loadPointsetURL(metaurl, timeEnabled, morphColour, groupName, finishCallback)

Load a pointset into this scene object.
Parameters:
Name Type Description
metaurl String Provide informations such as transformations, colours and others for each of the glyph in the glyphsset.
timeEnabled Boolean Indicate if morphing is enabled.
morphColour Boolean Indicate if color morphing is enabled.
groupName STRING name to assign the pointset's groupname to.
finishCallback function Callback function which will be called once the glyphset is succssfully load in.
Source:

loadSTL(url, groupName, finishCallback)

Read a STL file into this scene, the geometry will be presented as Zinc.Geometry.
Parameters:
Name Type Description
url STRING location to the STL file.
groupName STRING name to assign the geometry's groupname to.
finishCallback function Callback function which will be called once the STL geometry is succssfully loaded.
Source:

loadView(viewData)

Load the viewport Data from the argument Zinc.Viewport and set it as the default viewport of this scene.
Parameters:
Name Type Description
viewData Zinc.Viewport Viewport data to be loaded.
Source:

loadViewURL(URL)

Load the viewport from an external location provided by the url.
Parameters:
Name Type Description
URL String address to the file containing viewport information.
Source:

objectIsInScene() → {Boolean}

Check rather object is in scene.
Source:
Returns:
Type
Boolean

removeMetadataTag()

Remove a specific metadata field.
Source:

removeObject(object)

Remove any {THREE.Object} from this scene.
Parameters:
Name Type Description
object THREE.Object to be removed from this scene.
Source:

removeZincObject(zincObject)

Remove a ZincObject from this scene if it presents. This will eventually destroy the object and free up the memory.
Parameters:
Name Type Description
zincObject Zinc.Object object to be removed from this scene.
Source:

resetDuration()

Reset duration of scene to default value.
Source:

resetMetadata()

Reset all metadata fields to original value.
Source:

resetView()

Reset the viewport of this scene to its original state.
Source:

setCameraTargetToObject(zincObject)

Set the camera to point to the centroid of the zinc object.
Parameters:
Name Type Description
zincObject ZincObject the bounding box to target
Source:

setDuration(durationIn)

Set the default duration value for geometries and glyphsets that are to be loaded into this scene.
Parameters:
Name Type Description
durationIn Number duration of the scene.
Source:

setInteractiveControlEnable(flag)

Enable or disable interactive control, this is on by default.
Parameters:
Name Type Description
flag Boolean Indicate either interactive control should be enabled or disabled.
Source:

setMetadataTag()

Set a specific metadata field.
Source:

setMorphsTime(time)

Set the current time of all the geometries and glyphsets of this scene.
Parameters:
Name Type Description
time Number Value to set the time to.
Source:

setStereoEffectEnable(stereoFlag)

Enable or disable stereo effect of this scene.
Parameters:
Name Type Description
stereoFlag Boolean Indicate either stereo effect control should be enabled or disabled.
Source:

setupMultipleViews(viewData)

Set up multiple views.
Parameters:
Name Type Description
viewData Zinc.Viewport Viewport data to be loaded.
Source:

updatePickableThreeJSObjects()

Update pickable objects list
Source:

vectorToScreenXY(point, objectsArray) → {THREE.Vector3}

Convert the vector3 into screen coordinates.
Parameters:
Name Type Description
point THREE.Vector3 Vector 3 containing the point to convert, this vector will be overwritten with the returned value.
objectsArray Array Groupname to match with.
Source:
Returns:
Type
THREE.Vector3

viewAll()

Adjust zoom distance to include all primitives in scene only.
Source:

viewAllWithBoundingBox(boundingBox)

Adjust the viewport to display the desired volume provided by the bounding box.
Parameters:
Name Type Description
boundingBox THREE.Box3 The bounding box which describes the volume of which we the viewport should be displaying.
Source: