ObjectViewer

ObjectViewer

An entity viewer class which can be used to render a scene in the bundle or each entity inside the scene with a controlled camera.
It has basic interaction with the camera:

  • Zoom in & Zoom out
  • Rotation
    It does not support:
  • Animation rendering
  • Translation of objects
  • Environment blending

Constructor

new ObjectViewer(_sumerianRunner, baseUrl)

Parameters:
Name Type Description
_sumerianRunner SumerianRunder

sumerian for rendering the canvas

baseUrl String

The baseUrl of the ajax call. For the most time, it should be empty string.

Methods

addDefaultCamera() → {ObjectViewer}

Add default camera to the world.

addDefaultLights() → {ObjectViewer}

Add default lights to the world.

initLoader(url)

Initialize model loader based on the loading url.

Parameters:
Name Type Description
url string

the full url of the root.bundle file. for example: http://localhost:8000/renderer-svc/example/root.bundle.

loadModel(url, id, useLightAndCameraDefaults) → {ObjectViewer}

Load model based on the url. Entry point for ObjectViewer

Parameters:
Name Type Description
url String

path of the root.bundle file

id String

id of the bundle

useLightAndCameraDefaults boolean

loadScene(loader, loadingOptions, bundleConfig)

loading scene from the bundle config files.

Parameters:
Name Type Description
loader DynamicLoader

the loader for loading the scene.

loadingOptions Object
Properties
Name Type Attributes Default Description
useDefaultCamera boolean <optional>
true
useDefaultLight boolean <optional>
true
bundleConfig Object

JSON content of bundle config.

removeEntities(entities) → {ObjectViewer}

Remove entities from the world

Parameters:
Name Type Description
entities array

setDefaultCamera(cameraEntity) → {ObjectViewer}

Set input cameraEntity to the default camera.

Parameters:
Name Type Description
cameraEntity Entity