Plug-in that allows using glTF models as assets in XML3D scenes
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib
.gitignore
Gruntfile.js
LICENSE
README.md
package.json
xml3d-gltf-plugin-min.js
xml3d-gltf-plugin.js

README.md

xml3d-gltf-plugin License

This plug-in allows using glTF models as configurable assets in XML3D scenes.

Examples

Usage

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!

Advanced Usage

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.

TODOs

  • Map skeleton animations to Xflow
  • Cameras and Lights
  • Shader support (currently, shader parameters are mapped to XML3D shading models)
  • Extensions:

License

MIT License (MIT)