Class: Viewer

Viewer(options)

new Viewer(options)

A Viewer can be used to render an interactive 3D scene to a HTML5 canvas.

Parameters:
Name Type Description
options

object with following keys:

  • divID - the ID of the div to place the viewer in
  • elem - the elem to place the viewer in (overrides divID if provided)
  • width - the initial width, in pixels, of the canvas
  • height - the initial height, in pixels, of the canvas
  • background (optional) - the color to render the background, like '#efefef'
  • alpha (optional) - the alpha of the background
  • antialias (optional) - if antialiasing should be used
  • intensity (optional) - the lighting intensity setting to use
  • cameraPosition (optional) - the starting position of the camera
  • displayPanAndZoomFrame (optional) - whether to display a frame when
  •                                 panning/zooming. Defaults to true.
    
  • lineTypePanAndZoomFrame - line type for the frame that is displayed when
  •                       panning/zooming. Only has effect when
    
  •                       displayPanAndZoomFrame is set to true.
Source:

Methods

addObject(object, selectable)

Add the given THREE Object3D to the global scene in the viewer.

Parameters:
Name Type Description
object

the THREE Object3D to add

selectable

(optional) - if the object should be added to the selectable list

Source:

draw()

Renders the associated scene to the viewer.

Source:

resize(width, height)

Resize 3D viewer

Parameters:
Name Type Description
width

new width value

height

new height value

Source:

start()

Start the render loop

Source:

stop()

Stop the render loop

Source: