Import 3d assets from glTF (Graphics Library Transmission Format) file format
All possible failures
Internal Msg type. Handle these in your update function. Your application Msg type should contain:
type Msg
= GltfMsg Gltf.MsgInternal state. Your application model should contain one:
type alias Model =
{ gltf : Gltf
}Internal update function. Call it in your update something like this:
GltfMsg msg_ ->
Gltf.update
{ toMsg = GltfMsg
, onComplete = GltfOnComplete
}
msg_
model.gltf
|> Tuple.mapFirst (\gltf -> { model | gltf = gltf })The onComplete function will be called when the query is ready. Your application Msg type should handle these:
type Msg
= GltfMsg Gltf.Msg
| GltfOnComplete (Result Gltf.Error Gltf.QueryResult)In the onComplete handler you can use the content functions to get a tree of nodes, animations, cameras etc.
Get default scene from a file of type .glb
Note: If file does not specify a default scene this returns the first in list
Get default scene from a file of type .gltf
Note: If file does not specify a default scene this returns the first in list
Get content from a file of type .glb by supplying one of following queries:
Get content from a file of type .gltf by supplying one of following queries:
Queries the glTF file for the default scene. If no default scene is defined this will query the first scene.
Queries the glTF file for scene by index.
Query an already loaded file
Get all animations
Get all cameras
Get node trees returned by query
Get information of all scenes
Get all skins
Get camera by index
Get texture by index.
Information about the file