readGLB {rgl2gltf}R Documentation

Read a GLB file.

Description

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.

Usage

readGLB(con, verbose = FALSE, ...)

Arguments

con

The connection or filename to read from.

verbose

Whether to report on the process.

...

Currently unused.

Value

An object of class "gltf". This is an R version of the structure represented by a “glTF” file's JSON information.

Author(s)

Duncan Murdoch

References

The specification of the glTF format: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html

See Also

readglTF

Examples


# 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)

gltf$closeBuffers()


[Package rgl2gltf version 1.0.3 Index]