... | ... | @@ -12,6 +12,53 @@ Without the call, the change of material would not be applied. |
|
|
* To add textures, we need another file format because STL does not support texture coordinates. Is there a Javascript loader for OBJ?
|
|
|
* Scan 3D models will be inserted into the scene. The instrument Salsa has bought a scanner.
|
|
|
|
|
|
## Transforms, axis
|
|
|
|
|
|
The model is loaded and animated by the following pseudo-code:
|
|
|
|
|
|
<pre>
|
|
|
Nomad3DController.move(delta)
|
|
|
|
|
|
// Rotation is made in the axis frame.
|
|
|
localToPivot = translation(-axis.position.x, -axis.position.y, -axis.position.z)
|
|
|
rotation = rotation(axis.direction, delta)
|
|
|
|
|
|
component.sceneNode.apply(localToPivot)
|
|
|
component.sceneNode.apply(rotation)
|
|
|
component.sceneNode.apply(localToPivot^-1)
|
|
|
|
|
|
Component.update
|
|
|
controller.update()
|
|
|
|
|
|
for all child : children
|
|
|
child.update()
|
|
|
|
|
|
Component.showConfiguration(config, parentTransform)
|
|
|
transform = config.transformMatrix()
|
|
|
localTransform = transform
|
|
|
inverseParent = parentTransform^-1
|
|
|
localTransform.premultiply(inverseParent)
|
|
|
sceneNode.matrix.identity()
|
|
|
sceneNode.applyMatrix(localTransform);
|
|
|
|
|
|
for all child : children
|
|
|
child.showConfiguration(config, transform)
|
|
|
|
|
|
Model.update
|
|
|
root.update()
|
|
|
|
|
|
Model.showConfiguration(config)
|
|
|
root.showConfiguration(config)
|
|
|
|
|
|
Importer.read
|
|
|
model.update
|
|
|
model.showConfiguration("median")
|
|
|
|
|
|
</pre>
|
|
|
|
|
|
The main idea is to initialise the model positions by the median configuration and then move it by delta positions.
|
|
|
However the Controller.move function is using the axis position and direction with a change of frame that seems strange.
|
|
|
|
|
|
## Video demo
|
|
|
|
|
|
To run the Viewer in demo mode, i.e. animating the model by reading a log file:
|
... | ... | |