readGLB.Rd
GLB is the self-contained binary format of glTF
files. This function reads one, extracts the embedded files
into the temporary directory, and returns a "gltf"
object containing the information in R format.
readGLB(con, verbose = FALSE, ...)
The connection or filename to read from.
Whether to report on the process.
Currently unused.
An object of class "gltf"
. This is an R version of
the structure represented by a “glTF” file's JSON
information.
The specification of the glTF format: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html
# This web page has lots of sample files
samples <- "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0"
# Get one of them: an avocado
gltf <- readGLB(paste0(samples, "/Avocado/glTF-Binary/Avocado.glb?raw=true"))
if (interactive())
rgl::plot3d(gltf)
if (rgl::in_pkgdown_example())
gltfWidget(gltf)