SKYCIV.renderer
SkyCiv 3D renderer is available to bring your models to 3D life. Use the SkyCiv Renderer to build your model and visualise the model to ensure the structure is built correctly, confirm member orientation and include in your reporting.
This client side renderer can be included in your applications so you can have a full rendering of your model in real-time. The viewer is fully functional on mobile and tablet devices.
note
Terms of Use: Copyright SkyCiv Pty Ltd 2024. The SkyCiv Renderer can be used in accordance with the following conditions:
Individual Use: Free to use, must retain SkyCiv logo
Commercial Use: Requires a licensed agreement with SkyCiv
Some of the functionality of this library includes:
- Initialising the renderer
- Updating your model data
- Displaying Results
- Mouse click events
- Take screenshots
#
Getting StartedThe following provides a walkthrough of how to set up the SkyCiv Renderer.
#
Renderer fileThe following versions of the renderer are available:
- skyciv-renderer-dist.js (Current)
- skyciv-renderer-dist-1.0.1.js
- skyciv-renderer-dist-1.0.0.js
- skyciv-renderer-dist-2.0.0.js
#
Which one?If the file will be hosted locally in the project, then choose the file with the latest version.
If the src
of the html script element is set to one of the above urls, then it is also a good idea to select the file with the latest version.
The files with a version number will never change. The file named skyciv-renderer-dist.js
will always be the latest version.
#
Add the renderer file to the projectSimply add the s3d-renderer.js file to your project to then include it as a script in your HTML file. Create a div with an id of renderer-container
.
#
InitializeThis will initialize the viewer Object and display the following in the container assuming that the s3d_model
variable is a valid object.
Test our Renderer
#
Viewer MethodsThe following methods are available via the viewer
variable created in the sample code above. The viewer
variable is an instance of SKYCIV.renderer
which will often be referred to as viewer
throughout the documentation.
setMode
#
Function: viewer.setMode(mode)
Description: Sets the viewer mode.
Params: The mode
parameter can either be model
or results
.
setView
#
Function: viewer.setView(view, custom_camera_position, zoom_factor)
Description: Sets the view angle.
Params: The view
parameter can be custom
, top
, bottom
, front
, back
, left
, right
, top_front_left
, back_left
, etc...
render
#
Function: viewer.render(callback, dont_call_model_update)
Description: Render the current state. Changes are not visible until this is called.
Params: The callback function to run one the render completes and whether the viewer.model.update function should be called on completion - this defaults to true.
refresh
#
Function: viewer.refresh()
Description: Refreshes the render completely (rebuilds the structure and renders again).
Params: none
clear
#
Function: viewer.clear()
Description: Clear the render completely.
Params: none
screenshot.get
#
Function: viewer.screenshot.get(args)
Description: Gets screenshot and returns the base64 data of the image in the callback.
Params: Arguments object. See sample.
screenshot.save
#
Function: viewer.screenshot.save(args)
Description: Saves screenshot to device.
Params: Arguments object. See sample.
settings.get
#
Function: viewer.settings.get()
Description: Get the current renderer settings.
Params: none
settings.set
#
Function: viewer.settings.set(settings_object)
Description: Update the renderer settings.
Params: Settings object. See sample.
#
Viewer Click EventsThe following methods can be found under the viewer.mouse
property.
enable
#
Function: viewer.mouse.enable()
Description: Enable mouse interaction (on by default).
Params: none
selectObject
#
Function: viewer.mouse.selectedObject(object_type, id)
Description: Manually select/highlight an object in the scene.
Params: A string which accepts node
, member
or plate
and the element ID as an integer.
getSelectedObjects
#
Function: viewer.mouse.getSelectedObjects(object_type)
Description: Get all selected elements in the scene. Specify type to only select a specific type. Provide no arguments to get all types.
Params: A string which accepts node
, member
or plate
.
setOnObjectClickFunction
#
Function: viewer.mouse.setOnObjectClickFunction(function)
Description: Function to call when clicking/selecting an object.
Params: The callback function to execute.