# \donttest{
# This web page has lots of sample files
samples <- "https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0"
filename <- tempfile(fileext = ".gltf")
# Get one of them: a 2 cylinder engine. We need both parts
# to be able to view it, though only the .gltf part is
# needed for readglTF()
download.file(paste0(samples, "/2CylinderEngine/glTF/2CylinderEngine.gltf"),
destfile = filename)
download.file(paste0(samples, "/2CylinderEngine/glTF/2CylinderEngine0.bin?raw=true"),
destfile = file.path(tempdir(), "2CylinderEngine0.bin"),
mode = "wb")
gltf <- readglTF(filename)
gltf
# gltf files contain references to other files using
# relative paths, so we can only use them from their
# own directory
olddir <- setwd(dirname(filename))
rgl::plot3d(gltf)
setwd(olddir)
# }
Run the code above in your browser using DataLab