Serializer of JSCAD geometries to X3D source data (XML).
The serialization of the following geometries are possible.
- serialization of 3D geometries (geom3) to X3D IndexedTriangleSet (a unique mesh containing coordinates)
- serialization of 2D geometries (geom2) to X3D Polyline2D
- serialization of 2D paths (path2) to X3D Polyline2D
Material (color) is added to X3D shapes when found on the geometry.
- Source:
Example
const { serializer, mimeType } = require('@jscad/x3d-serializer')
Methods
(static) serialize(options, …objects) → {Array}
- Source:
Serialize the give objects to X3D elements (XML).
Example
const geometry = primitives.cube()
const x3dData = serializer({unit: 'meter'}, geometry)
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | options for serialization, REQUIRED Properties
|
|||||||||||||||||||||||||||||||||||||||||
objects |
Object | Array |
<repeatable> |
objects to serialize as X3D |
Returns:
serialized contents, X3D format (XML)
- Type
- Array