X3DOM Plugins
Presentation
I worked on the creation of x3dom-based tools for mesh data visualization and analysis. I wanted to create new DOM nodes that integrate nicely in a standard x3dom tree, namely iso-color, threshold, clip-plane.
I had two goals in mind:
- create an x3dom plugin API that allows one to create new DOM nodes which extend x3dom functionality;
- keep a simple x3dom-like interface for the final users.
For a detailed technical explanation take a look at the GitHub repository.
Example
Following example illustrates the usage of such plugins. The relevant markup looks like:
<TriangleSet>
<Coordinate point="..."> </Coordinate>
<Normal vector="..."> </Normal>
<Threshold
upperBound="1" lowerBound="0" dataName="triSetData" > </Threshold>
<IsoColor
max="1" min="0" dataName="triSetData" > </IsoColor>
<FloatVertexAttribute
name="triSetData" numComponents="1" value="..."> </FloatVertexAttribute>
<FloatVertexAttribute
name="other_set_of_data" numComponents="1" value="..."> </FloatVertexAttribute>
...
</TriangleSet>
The Threshold and IsoColor nodes work like any x3dom node: they react to any attribute change using DOM's node setAttribute method. This makes it easy to use HTML widgets like sliders / buttons to drive the plugin's parameters.