These methods convert a "gltf" object to a "rglscene" object, similar to what scene3d would produce, or a "mesh3d" object.

# S3 method for gltf
as.rglscene(x, scene = x$scene, nodes = NULL,
         useRGLinfo = TRUE, time = NULL, ani = 0, clone = TRUE,
         quick = FALSE, add = FALSE, ...)
# S3 method for gltf
as.mesh3d(x, ...)

Arguments

x

The "gltf" object to convert.

scene

Which scene to convert? If NULL (e.g. x doesn't define a default scene), scene 0 will be used.

nodes

Which nodes to convert? If NULL, all nodes used in the scene will be converted, otherwise only the listed ones and their children.

useRGLinfo

"gltf" objects contain RGL-specific information in “extra” fields. If useRGLinfo is TRUE, we use that information, otherwise include only what standard glTF viewers would display.

time

Set the "time" within an animation.

ani

Animation number to use.

clone

Whether to clone the gltf object. See the Details below.

quick

If TRUE, plot3d will work on the result, but it is not sufficiently complete to use as the scene in rglwidget.

add

If quick = FALSE, the scene will be plotted in an existing rgl scene, and both old and new parts will be returned.

...

as.mesh3d passes these arguments to as.rglscene.

Details

These functions need to modify the glTF object, caching some information to help with the conversion. By default they do this on a cloned copy of it, and the original is left unchanged. If the object has already been cloned this can be skipped by setting clone = FALSE.

Value

An "rglscene" object.