Creates a Viewer.
Viewer configuration.
Optional
id?: stringID for this Viewer, automatically generated by default.
Optional
origin?: FloatArrayParamThe Real-space 3D origin, in current measurement units, at which the World-space coordinate origin [0,0,0]
sits.
Manages rendering of models.
Optional
scale?: numberThe number of Real-space units in each World-space coordinate system unit.
Optional
scene?: SceneContains model representations. A Scene can be attached to a maximum of one Viewer - don't share a Scene between multiple Viewers.
Optional
units?: stringThe measurement unit type. Accepted values are "meters"
, "metres"
, , "centimeters"
, "centimetres"
, "millimeters"
, "millimetres"
, "yards"
, "feet"
and "inches"
.
Readonly
capabilitiesIndicates the capabilities of this Viewer.
Readonly
destroyedTrue once this Viewer has been destroyed.
Don't use this Viewer if this is false
.
Protected
dirtyReadonly
idID of this Viewer.
The number of Views belonging to this Viewer.
The maxiumum number of Views that a Viewer can have is determined by the Renderer implementation it was configured with, which is provided in Capabilities.maxViews.
Readonly
rendererThe Renderer that this Viewer was configured with via the Viewer's constructor. Th Renderer is only used by the Viewer, and is not intended to for users to use directly. It's provided via this property in order to verify which Render implementation the Viewer is configured with.
Readonly
sceneThe Viewer's scene representation.
The !SceneModel | SceneModels is the container of !SceneModel | SceneModels and !SceneObject | SceneObjects, which contain the geometry and materials for models currently loaded in the Viewer.
Readonly
startThe time that this Viewer was created. This is the number of milliseconds since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC.
Readonly
Internal
viewList of all the Views in this Viewer.
Each View is an independently configurable view of the Viewer's models, with its own canvas, camera position, section planes, lights, and object visual states.
Readonly
viewsProtected
cleanProtected
cleanClears this Viewer.
Destroys all existing Views and resets all properties to their default values.
Creates a new View within this Viewer.
const view1 = myViewer.createView({
id: "myView",
elementId: "myView1"
});
if (view1 instanceof SDKError) {
console.log(view1.message);
} else {
view1.camera.eye = [-3.933, 2.855, 27.018];
view1.camera.look = [4.400, 3.724, 8.899];
view1.camera.up = [-0.018, 0.999, 0.039];
//...
}
View configuration.
Configures this Viewer.
Protected
setGets the current configuration of this Viewer.
Emits an event when the Component has been destroyed.
Readonly
onEmits an event each time a message is logged.
Readonly
onEmits an event each time a Viewer "tick" occurs (~10-60 times per second).
Readonly
onEmits an event each time a View is created.
Readonly
onEmits an event each time a View is destroyed.
The xeokit SDK's Browser-based model viewer.
See "@xeokit/sdk/viewer" for usage.