Members
(constant) action :Object.<String:Number>
Type:
- Object.<String:Number>
(constant) actionRobot :Object.<String:Number>
Type:
- Object.<String:Number>
aspect :Number
Type:
- Number
(constant) cameraPos :Object.<String, THREE.Vector3>
Camera position for the three axes.
Type:
- Object.<String, THREE.Vector3>
(constant) colorTable :Object.<String:hexadecimal>
Type:
- Object.<String:hexadecimal>
ctrlType :Number
Type:
- Number
(constant) ctype :number
Type:
- number
(constant) environment :Object.<String, THREE.DataTexture>
Type:
- Object.<String, THREE.DataTexture>
(constant) fnames :Object.<String, String>
Type:
- Object.<String, String>
line :THREE.LineSegments
The edges of the mesh of the current loaded object.
Type:
- THREE.LineSegments
loadedModelName :String
Type:
- String
material :THREE.Material
Current material for STL or VTK files.
Type:
mesh :THREE.Mesh
The mesh of the current loaded object for the formats vtk/stl.
Every time a new object is loaded the previous one is disposed of.Type:
- THREE.Mesh
(constant) mobile :Boolean
Type:
- Boolean
modelCnt :Number
Type:
- Number
modelGeometry :THREE.Object3D
Type:
modelj :Object
Type:
- Object
(constant) models :Array.<String>
Type:
- Array.<String>
object :THREE.Object3D
The geometry of the current loaded object for the formats obj/gltf.
Every time a new object is loaded the previous one is disposed of.Type:
(constant) orthoView :Boolean
Define an orthographic view type.
The interpolate property is used to interpolate from the current orientation to the front, top, and side views.Type:
- Boolean
Methods
(async) anonymous()
Self-invoking anonymous function.
- Appends the models read from the json file to the <select> element.
- Sorts the list of models from the <select> element.
- Displays the default model.
- Resizes the window to occupy the maximum area of the device's viewport.
createBoxHelper(object)
Parameters:
Name | Type | Description |
---|---|---|
object |
THREE.Object3D | a three.js object. |
createEvent(key, ctrl)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
key |
String | char code. | |
ctrl |
Boolean | false | control key. |
Fires:
damp(position, target, lambda, dt) → {THREE.Vector3}
Exponential Decay: THREE.MathUtils.lerp(position, target, 1 - Math.exp(-lambda * dt))
Linearly interpolate between the given position and a target, where delta is the percent distance along the line:
dt = 0 will be position anddt = 1 will be target.
Parameters:
Name | Type | Description |
---|---|---|
position |
THREE.Vector3 | current point. |
target |
THREE.Vector3 | target point. |
lambda |
Number | a higher lambda value will make the movement more sudden, and a lower value will make the movement more gradual. |
dt |
DOMHighResTimeStamp | delta time in seconds. |
Returns:
- Type
- THREE.Vector3
delMaterial(mat)
Dispose material and its texture.
TO BE FINISHED.Parameters:
Name | Type | Description |
---|---|---|
mat |
THREE.Material | material. |
getModels(optionNames)
Parameters:
Name | Type | Description |
---|---|---|
optionNames |
Array.<String> | array of model file names. |
handleKeyPress() → {key_event}
Closure for keydown events.
Returns:
- Type
- key_event
init(dfile)
Parameters:
Name | Type | Description |
---|---|---|
dfile |
String | initial model name. |
isEqual(v1, v2, epsilon) → {Boolean}
Vector3 comparison must be based on distance: if the distance between two Vector3 is less than some predefined value, they are considered equal.
Parameters:
Name | Type | Description |
---|---|---|
v1 |
THREE.Vector3 | first vector. |
v2 |
THREE.Vector3 | second vector. |
epsilon |
Number | tolerance. |
Returns:
- Type
- Boolean
loadModel(geometry)
Callback to load a model from a file to the scene.
The previous model loaded is disposed of; that is, we try to release its geometry and material objects since they are no longer used. Render Targets allocate some resources needed by the shaders and should also be released.
Parameters:
Name | Type | Description |
---|---|---|
geometry |
THREE.BufferGeometry | model. |
(async) loadModelj() → {Object}
Returns:
- Type
- Object
loadTextures(dfile)
Load textures (before any model), then call init.
To be sure everything has been loaded, one can either use a series of nested load calls or, as I do, simply use loadAsync to avoid the so-called callback hell.Parameters:
Name | Type | Description |
---|---|---|
dfile |
String | initial model name. |
- Source:
- See:
(async) loadTexturesAsync(dfile)
Parameters:
Name | Type | Description |
---|---|---|
dfile |
String | initial model name. |
- Source:
- See:
runAnimation()
setAnimationLoop(loop)
A built in function that can be used instead of requestAnimationFrame.
The renderer.setAnimationLoop parameter is a callback, which will be called every available frame.If null is passed, it will stop any already ongoing animation.
Parameters:
Name | Type | Description |
---|---|---|
loop |
function | callback. |
setModels(optionNames)
Parameters:
Name | Type | Description |
---|---|---|
optionNames |
Array.<String> | array of model file names. |
Type Definitions
handleWindowResize()
Fires when the document view (window) has been resized.
Also resizes the canvas and viewport.- Source:
- See:
key_event(event)
Handler for keydown events.
Selects the next/previous model or turns stats and mesh visible/invisible when pressing keys ("n","N") or ("s","m"), respectively.Parameters:
Name | Type | Description |
---|---|---|
event |
KeyboardEvent | keyboard event. |
Events
clickFront
Appends an event listener for events whose type attribute value is click.
Fires after both the mousedown and mouseup events have fired (in that order).
Front button must be pressed and released while the pointer is located inside it.The callback argument sets the callback that will be invoked when the event is dispatched.
- Source:
- See:
clickReset
Appends an event listener for events whose type attribute value is click.
Fires after both the mousedown and mouseup events have fired (in that order).
Reset button must be pressed and released while the pointer is located inside it.The callback argument sets the callback that will be invoked when the event is dispatched.
- Source:
- See:
clickSide
Appends an event listener for events whose type attribute value is click.
Fires after both the mousedown and mouseup events have fired (in that order).
Side button must be pressed and released while the pointer is located inside it.The callback argument sets the callback that will be invoked when the event is dispatched.
- Source:
- See:
clickTop
Appends an event listener for events whose type attribute value is click.
Fires after both the mousedown and mouseup events have fired (in that order).
Top button must be pressed and released while the pointer is located inside it.The callback argument sets the callback that will be invoked when the event is dispatched.
- Source:
- See:
controls
Appends an event listener for events whose type attribute value is change.
Fires when the camera has been transformed by the controls.
The callback argument sets the callback that will be invoked when the event is dispatched.Parameters:
Name | Type | Description |
---|---|---|
event |
Event | a generic event. |
function |
callback | function to run when the event occurs. |
keydown
Appends an event listener for events whose type attribute value is keydown.
Fired when a key is pressed.
The callback argument sets the callback that will be invoked when the event is dispatched.
Parameters:
Name | Type | Description |
---|---|---|
event |
KeyboardEvent | a UIEvent. |
function |
callback | function to run when the event occurs. |
- Source:
- See:
load
Sets the entry point of the application.
Fired when the whole page has loaded, including all dependent resources such as stylesheets, scripts, iframes, and images, except those that are loaded lazily.
Type:
- function
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | load event. |
- Source:
- See:
materialRadio
Appends an event listener for events whose type attribute value is change.
Fired when the material <input type="radio"> is checked (but not when unchecked).
The callback argument sets the callback that will be invoked when the event is dispatched.Parameters:
Name | Type | Description |
---|---|---|
event |
Event | a generic event. |
function |
callback | function to run when the event occurs. |
- Source:
- See:
meshChkBox
Appends an event listener for events whose type attribute value is change.
Fired when the mesh <input type="checkbox"> is checked or unchecked (by clicking or using the keyboard).
The callback argument sets the callback that will be invoked when the event is dispatched.Parameters:
Name | Type | Description |
---|---|---|
event |
Event | a generic event. |
function |
callback | function to run when the event occurs. |
- Source:
- See:
modelsSelect
Appends an event listener for events whose type attribute value is change.
Fired for models <select> element when the user modifies its value.
The callback argument sets the callback that will be invoked when the event is dispatched.Parameters:
Name | Type | Description |
---|---|---|
event |
Event | a generic event. |
function |
callback | function to run when the event occurs. |
- Source:
- See:
pointerdown
Fired when the pointer is pressed on the canvas.
The orthoView.interpolate is set to false, so interpolation is interrupted as soon as the pointer is pressed.Note that adding the event to the controls object does not work.
resize
Appends an event listener for events whose type attribute value is resize.
Fires when the document view (window) has been resized.
The callback argument sets the callback that will be invoked when the event is dispatched.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | a generic event. |
function |
callback | function to run when the event occurs. |
useCapture |
Boolean | handler is executed in the bubbling or capturing phase. |
- Source:
- See:
statsChkBox
Appends an event listener for events whose type attribute value is change.
Fired when the stats <input type="checkbox"> is checked or unchecked (by clicking or using the keyboard).
The callback argument sets the callback that will be invoked when the event is dispatched.Parameters:
Name | Type | Description |
---|---|---|
event |
Event | a generic event. |
function |
callback | function to run when the event occurs. |
- Source:
- See: