ThreeContext creates a WebGL context using Threejs. It also handle mouse control with two possible logics (orbit or trackball)
An event can be associated to a ThreeContext instance: raycast
with the method
.on("raycast", function(hits){...})
where hits
is the object list being raycasted.
Extends EventManager
(DOMObject
= null
)
the div object as a DOM element.
(Object)
the options parameters
Adds a Thorus knot to the scene.
THREE.Mesh
:
Kills the scene, interaction, animation and reset all objects to null
Get the default AmbientLight
THREE.AmbientLight
:
Get the axes helper
THREE.Mesh
:
Get the camera
THREE.Camera
:
Get the default directional light
THREE.DirectionalLight
:
Get the scene, mainly so that we can externalize things from this file
THREE.Scene
:
Get the scene object
THREE.Scene
:
Get the png image data as base64, in order to later display it in a markup
Since we are using Controls, applying the lookat just on the camera in not enough
(THREE.Vector3)
a position to look at
Throw a ray from the camera to the pointer, potentially intersect some element.
Can emit the event onRaycast
with the section instance as argument
(Object)
the option object
Name | Description |
---|---|
options.emitEvent boolean
|
Throw the event
'raycast'
with the intersected objects in arguments (default:
false
, the result is returned)
|
options.parent THREE.Object3D
|
the raycast will be performed recursively on all the children of this object (default:
this._scene
)
|
(array | null)
:
an array of interections or null if none