This plug-in allows using glTF models as configurable assets in XML3D scenes.
Include xml3d-gltf-plugin.js
after including the xml3d.js library:
<script src="xml3d-5.2-min.js" type="text/javascript"></script>
<script src="xml3d-gltf-plugin-min.js" type="text/javascript"></script>
Now, including glTF assets into your scene is as easy as:
<model src="../path/to/your/CesiumMilkTruck.gltf"></model>
That's it!
glTF models in XML3D are not static but can be configured. This requires addressing the primitive to configure.
In this example, we override the material of Geometry-mesh002Node0
with a JavaScript/shade.js wood material:
<model src="resources/CesiumMilkTruck/glTF/CesiumMilkTruck.gltf">
<assetmesh name="Geometry-mesh002Node0" material="#mat"></assetmesh>
</model>
This feature is still experimental. Since primitives in glTF have no identifier, we use the glTF mesh id plus the index of the primitive in the primitive array.
In the example above, the mesh's id is Geometry-mesh002Node
and the primitive has an index of 0
.
- Map skeleton animations to Xflow
- Cameras and Lights
- Shader support (currently, shader parameters are mapped to XML3D shading models)
- Extensions:
- Binary glTF: KHR_binary_glTF
- Common Materials: KHR_materials_common
- Other extensions
MIT License (MIT)