Migrating from SceneJS 2.0 to 3.1
This will be a work-in-progress over the next few weeks, primarily to help out the BIMSurfer crew migrate their IFC viewer over to the latest SceneJS API. When it’s done, we should have a useful migration document. Check back soon.
Scene graph construction
Create a scene graph like this:
- The scene starts immediately - no need to call
canvasIdis optional - when you omit it, SceneJS will create a canvas for the scene, expanded to fit the browser window
- Basic scene example
baseColor attribute has been deprecated - now use
color instead, ie:
Previously in V2.X
In V2.X, each light source was:
- a separate node,
- which you could nest,
- and wrap in modelling transforms to move them around.
Now in V3.X
In V3.X, light nodes have been simplified as shown below, where a single
lights node defines multiple light
sources for its subgraph. The
- cannot be nested - a child
lightsnode overrides the effect of parent
- wrapping in modelling transforms has no effect
These restrictions greatly simplify the engine and provide improved performance.
Ambient lighting now supported
If you define a light source of type “ambient” it will provide ambient lighting throughout the entire scene.
All of the geometry primitive nodes are now provided as plugins. In V2.X, you would create a box primitive like this:
Now in V3.X you create it using a plugin:
V3.X provides many more defaults and training wheelss You can leave out just about any kind of non-content node, such
material etc. and it will provide internal defaults for those.
This means that you can create a scene containing nothing but a
geometry node and that appear nicely aligned in the
view volume, with perspective projection, illuminated with default light source and coloured white. This is good for examples,
allowing us to specify only the nodes we want to demonstrate in those example scenes.
Attribute name changes
The ‘renderer’ node
renderer node configures misceleaneous WebGL capabilities for its subgraph, such as line width, color buffer, depth buffer etc.
It will be replaced by a collection of more specific nodes, eg.
comments powered by Disqus