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. |
Returns:
- Type
- Scene
Members
ambient
a THREE.AmbientLight for controlling the ambient lighting of this scene.
directionalLight
A THREE.DirectionalLight object for controlling lighting of this scene.
Methods
addMetadataTimeStamp()
All time stamp to the metadata TimeStamps field.
addObject(object)
Add any {THREE.Object} into this scene.
Parameters:
Name | Type | Description |
---|---|---|
object |
THREE.Object | to be addded into this scene. |
addZincObject(zincObject) → {THREE.Vector3}
Add zinc object into the root Region of sfcene.
Parameters:
Name | Type | Description |
---|---|---|
zincObject |
ZincObject | zinc object ot be added. |
Returns:
- Type
- THREE.Vector3
addZincObjectAddedCallbacks(callbackFunction) → {Number}
Add a callback function which will be called everytime zinc object is added.
Parameters:
Name | Type | Description |
---|---|---|
callbackFunction |
function | callbackFunction to be added. |
Returns:
- Type
- Number
addZincObjectRemovedCallbacks(callbackFunction) → {Number}
Add a callback function which will be called everytime zinc object is removed.
Parameters:
Name | Type | Description |
---|---|---|
callbackFunction |
function | callbackFunction to be added. |
Returns:
- Type
- Number
alignBoundingBoxToCameraView(boundingBox, transitionTime)
Rotate 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. |
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. |
changeZoomByScrollRateUnit()
Set the zoom level by unit scroll rate
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.
clearZincObjectAddedCallbacks()
Clear all zinc object callback function
clearZincObjectRemovedCallbacks()
Clear all zinc object callback function
createLines()
Create points in region specified in the path
createPoints()
Create points in region specified in the path
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
getBoundingBox() → {THREE.Box3}
Get the bounding box of all the object in this scene only.
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. |
Returns:
- Type
- THREE.Box3
getCurrentTime() → {Number}
Get the current time of the scene.
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.
Returns:
- Type
- Array
getDuration() → {Number}
Get the default duration value.
Returns:
- Type
- Number
getMetadata()
Get all metadata set for the scene.
getMetadataTag()
Get a specific metadata field.
getMinimapDiffFromNormalised()
Get the coordinates difference of the current viewing
point and projected coordinates.
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. |
Returns:
- Type
- THREE.Vector3
getNormalisedMinimapCoordinates()
Get the Normalised coordinates on minimap if mouse event is
inside the minimap
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. |
Returns:
- Type
- THREE.Vector3
getPickableThreeJSObjects()
Get all pickable objects.
getRootRegion() → {Region}
Get the root region of the scene.
Returns:
Return the root region of the scene
- Type
- Region
getThreeJSScene() → {THREE.Scene}
Return the internal {THREE.Scene}.
Returns:
- Type
- THREE.Scene
getThreeJSScene() → {THREE.Scene}
Get the internal {THREE.Scene}.
Returns:
- Type
- THREE.Scene
getZincCameraControls() → {Zinc.CameraControls}
Get the camera control of this scene.
Returns:
- Type
- Zinc.CameraControls
isStereoEffectEnable() → {Boolean}
Check if stereo effect is enabled.
Returns:
- Type
- Boolean
isTimeVarying() → {Boolean}
Check if any object in this scene is time varying.
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. |
loadGLTF()
Load GLTF into this scene object.
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. |
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. |
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. |
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.
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. |
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. |
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. |
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. |
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. |
objectIsInScene() → {Boolean}
Check rather object is in scene.
Returns:
- Type
- Boolean
removeMetadataTag()
Remove a specific metadata field.
removeObject(object)
Remove any {THREE.Object} from this scene.
Parameters:
Name | Type | Description |
---|---|---|
object |
THREE.Object | to be removed from this scene. |
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. |
removeZincObjectAddedCallbacks(id)
Remove a callback function that is previously added to the scene.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | identifier of the previously added callback function. |
removeZincObjectRemovedCallbacks(id)
Remove a callback function that is previously added to the scene.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | identifier of the previously added callback function. |
resetDuration()
Reset duration of scene to default value.
resetMetadata()
Reset all metadata fields to original value.
resetView()
Reset the viewport of this scene to its original state.
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 |
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. |
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. |
setMetadataTag()
Set a specific metadata field.
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. |
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. |
setupMultipleViews(viewData)
Set up multiple views.
Parameters:
Name | Type | Description |
---|---|---|
viewData |
Zinc.Viewport | Viewport data to be loaded. |
translateBoundingBoxToCameraView(boundingBox, transitionTime)
Translate the camera view to the center 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. |
triggerObjectAddedCallback()
Used to trigger zinc object added callback
triggerObjectRemovedCallback()
Used to trigger zinc object removed callback
updatePickableThreeJSObjects()
Update pickable objects list
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. |
Returns:
- Type
- THREE.Vector3
viewAll()
Adjust zoom distance to include all primitives in scene only.
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. |