Object that contains items that will be rendered in the view. For more information ThreeJS.Scene
Adds a scene layer to the 3D view. Note: see the example on how to add a custom data layer in the 'Developer Guide' section.
Scene layer to add
Create a tween that is added to the watch list when started and removed from the watch list when it completes or when it is stopped.
As long as at least one tween is watched, the view will render at a fixed frame rate.
The object to tween. This is passed on to the Tween constructor.
Optional
group: false | GroupThe tween group. This is passed on to the Tween constructor.
The tween with onStart(), onStop() and onComplete() callbacks installed.
Get the first viewport
Last mouse position
Find 3D objects under the mouse cursor.
Mouse position
Intersections with mouse cursor
This method is viewport-aware and takes care of the extra transformation.
Get 3D position of specified screen coordinates assuming a ground plane at given height
Screen X coordinate
Screen Y coordinate
Z coordinate of ground plane. Can be undefined.
Optional
viewport: ViewportInterfaceViewport to use (optional)
3D position of mouse or gesture event on the plane (or null)
This method is viewport-aware and takes care of the extra transformation.
Unprojects the screen coordinates and intersects the ray with a plane with normal (0,0,1) at specified height in order to get the 3D point coordinates on the plane.
If z is undefined, the plane is assumed to be 1 unit away from the camera position in the direction the camera is facing.
Takes a screenshot of the view.
Optional
mimeType: stringMIME type of the returned data, defaults to image/jpeg
.
Optional
quality: numberImage quality that will be passed on to the HTMLCanvasElement.toDataURL method.
Data of the screenshot, including info about its dimensions.
Invalidates the scene so that it is rendered. Call this method whenever things happen that modify the appearance of the scene (e.g. a texture download finishes).
Optional
callback: (() => void)callback to be run after scene has been rendered
Unproject screen-space coordinates given as input event.
Hammer.JS event data
Optional
z: numberZ coordinate in screen-space (defaults to 1 if not provided)
Unprojected coordinates (local coordinates)
This method is viewport-aware and takes care of the extra transformation.
Unproject screen-space coordinates (relative to the viewport, i.e. (0,0) is the upper left corner of the rendering DIV).
X coordinate in screen-space
Y coordinate in screen-space
Optional
z: numberZ coordinate in screen-space (defaults to 1 if not provided)
Optional
viewport: ViewportInterfaceThe viewport to use for unprojection
Unprojected coordinates (local coordinates)
Generated using TypeDoc
Base interface for 3D views.
The view provides a layer mechanism to plug in modules that add 3D objects to the view. Layers can define events that are called on various occasions, e.g., when the user changes the current location or moves the mouse. Layers are responsible for managing the Three.JS objects below their scene node. To simplify user input handling, meshes added to the scene can define handlers for events like clicks, mouse over, mouse out, dragging, etc.
This interface provides a mechanism to render-on-demand, i.e., only when scene contents changed. Whenever the scene or objects are modified (e.g. by a layer), a call to invalidateScene causes the scene to be rendered. invalidateScene can be called repeatedly, however rendering will only occur at a fixed rate.
For tweening, the view provides the methods watchTween and forgetTween. As long as tweens are watched by the view, the rendering loop will stay active. To use this mechanism, call watchTween when you start it and forgetTween when it completes.