Class: Renderer

Renderer(containerIn) → {Renderer}

new Renderer(containerIn) → {Renderer}

Create a Zinc 3D renderer in the container provided. The primary function of a Zinc 3D renderer is to display the current scene (@link Scene} set to the renderer and each scene may contain as many geometries, glyphset and other primitives as the system can support. Zinc.Renderer also allows additional scenes to be displayed.
Parameters:
Name Type Description
containerIn Object Container to create the renderer on.
Author:
  • Alan Wu
Source:
Returns:
Type
Renderer

Methods

addActiveScene(additionalScene)

Add additional active scene for rendering, this scene will also be rendered but viewport of the currentScene will be used.
Parameters:
Name Type Description
additionalScene Zinc.Scene Scene to be added to the rendering.
Source:

addPostRenderCallbackFunction(callbackFunction) → {Number}

Add a callback function which will be called everytime after the renderer renders its scene.
Parameters:
Name Type Description
callbackFunction function callbackFunction to be added.
Source:
Returns:
Type
Number

addPreRenderCallbackFunction(callbackFunction) → {Number}

Add a callback function which will be called everytime before the renderer renders its scene.
Parameters:
Name Type Description
callbackFunction function callbackFunction to be added.
Source:
Returns:
Type
Number

addToOrthoScene()

Add {Three.Object} to the ortho scene, objects added to the ortho scene are rendered in normalised coordinates and overlay on top of current scene.
Source:

addToScene()

Add {Three.Object} to the current scene.
Source:

animate()

Start the animation and begin the rendering loop.
Source:

clearAllActiveScene()

Clear all additional scenes from rendering except for curentScene.
Source:

createScene(name) → {Zinc.Scene}

Create a new scene with the provided name if scene with the same name exists, return undefined.
Parameters:
Name Type Description
name String Name of the scene to be created.
Source:
Returns:
Type
Zinc.Scene

dispose()

Dispose all memory allocated, this will effetively destroy all scenes.
Source:

getCurrentScene() → {Zinc.Scene}

Get the current scene on display.
Source:
Returns:
;
Type
Zinc.Scene

getPlayRate()

Get the current play rate, playrate affects how fast an animated object animates. Also see Zinc.Scene#duration.
Source:

getSceneByName(name) → {Zinc.Scene}

Return scene with the matching name if scene with that name has been created.
Parameters:
Name Type Description
name String Name to match
Source:
Returns:
Type
Zinc.Scene

getThreeJSRenderer()

Get the internal Three.Renderer, to gain access to ThreeJS APIs.
Source:

getZincGeometryByID() → {Zinc.Geometry}

Get {Zinc.Geoemtry} by its id. This should be called from Zinc.Scene;
Source:
Returns:
Type
Zinc.Geometry

initialiseVisualisation()

Initialise the renderer and its visualisations.
Source:

isSceneActive(sceneIn)

Check if a scene is currently active.
Parameters:
Name Type Description
sceneIn Zinc.Scene Scene to check if it is currently rendered.
Source:

loadFromViewURL(URL)

Load a legacy file format containing the viewport and its model file from an external location provided by the url. Use the new metadata format with Zinc.Scene#loadMetadataURL instead. This should be called from Zinc.Scene;
Parameters:
Name Type Description
URL String address to the file containing viewport and model information.
Deprecated:
  • Yes
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. This should be called from Zinc.Scene.
Deprecated:
  • Yes
Source:

loadViewURL(URL)

Load the viewport from an external location provided by the url. This should be called from Zinc.Scene;
Parameters:
Name Type Description
URL String address to the file containing viewport information.
Deprecated:
  • Yes
Source:

onWindowResize()

Call this to resize the renderer, this is normally call automatically.
Source:

removeActiveScene(additionalScene)

Remove a currenrtly active scene from the renderer, this scene will also be rendered but viewport of the currentScene will be used.
Parameters:
Name Type Description
additionalScene Zinc.Scene Scene to be removed from rendering.
Source:

removePostRenderCallbackFunction(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.
Source:

removePreRenderCallbackFunction(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.
Source:

render()

Render the current and all additional scenes. It will first update all geometries and glyphsets in scenes, clear depth buffer and render the ortho scene, call the preRenderCallbackFunctions stack , render the scenes then postRenderCallback.
Source:

resetView()

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

setCurrentScene(sceneIn)

Set the current scene on display.
Parameters:
Name Type Description
sceneIn Zinc.Scene The scene to be set, only scene created by this instance of ZincRenderer is supported currently.
Source:

setMorphsTime()

Get the current play rate, playrate affects how fast an animated object animates. Also see Zinc.Scene#duration.
Source:

setPlayRate(PlayRateIn)

Set the current play rate, playrate affects how fast an animated object animates.
Parameters:
Name Type Description
PlayRateIn Number value to set the playrate to. Also see Zinc.Scene#duration.
Source:

stopAnimate()

Stop the animation and renderer to get into the render loop.
Source:

transitionScene(endingScene, duration)

Transition from the current viewport to the endingScene's viewport in the specified duration.
Parameters:
Name Type Description
endingScene Zinc.Scene Viewport of this scene will be used as the destination.
duration Number Amount of time to transition from current viewport to the endingScene's viewport.
Source:

viewAll()

Adjust zoom distance to include all primitives in scene and also the additional scenes but the lookat direction and up vectors will remain constant.
Source: