H3DU.MeshJSON
H3DU.MeshJSON()
JSON exporter of graphics meshes.
This class is considered a supplementary class to the Public Domain HTML 3D Library and is not considered part of that library.
To use this class, you must include the script "extras/meshjson.js"; the class is not included in the "h3du_min.js" file which makes up the HTML 3D Library. Example:
<script type="text/javascript" src="extras/meshjson.js"></script>
Methods
(static) H3DU.MeshJSON.loadJSON(url)
Loads a mesh from JSON format.
Parameters
url
(Type: string)
URL to a JSON mesh object, as used in the Public Domain HTML 3D Library.
Return Value
A promise that, when resolved, exposes an object
that implements a property named toShape
, which is
a method that gets a H3DU.ShapeGroup describing the 3D mesh. (Type: Promise)
(static) H3DU.MeshJSON.toJSON(mesh)
Converts a mesh to JSON format.
Parameters
mesh
(Type: H3DU.Mesh | H3DU.MeshBuffer)
A mesh object or mesh buffer object, as used in the Public Domain HTML 3D Library.
Return Value
A JSON string describing the mesh. (Type: string)