gltfWidget {rgl2gltf} | R Documentation |
Create a widget for a glTF display.
Description
This creates a widget holding a glTF scene, with controls to animate it if it supports animation, and with shaders that implement normal textures.
Usage
gltfWidget(gltf,
animation = 0,
start = times[1], stop = times[2],
times = gltf$timerange(animation),
method = c("shader", "rigid"),
add = FALSE, close = !add,
verbose = FALSE,
open3dParams = getr3dDefaults(),
usePBR = hasPBRparams(gltf),
PBRargs = list(), ...)
Arguments
gltf |
A |
animation |
Which animation to use? If no animation is present, this is ignored. |
start , stop |
The starting and stopping times for the animation. Ignored if no animation. |
times |
An alternate way to specify the times. Ignored if no animation. |
method |
The
|
add |
Should the gltf object be added to an existing rgl scene, or should it open a new scene? |
close |
Should |
verbose |
Give some progress information. |
open3dParams |
A list to pass as the |
usePBR |
Whether to use physically based rendering methods.
The default
uses an internal function to determine if |
PBRargs |
A list containing optional arguments to the |
... |
Additional parameters which will be passed to |
Details
See playgltf
for a description of the method
used for animation. The "fixed"
method is fast, but
doesn't do a good job on some animations.
If the gltf
object doesn't contain any animations,
or animation = NA
, this
will simply display it as a widget with no controls.
Value
A widget suitable for display or inclusion in an R Markdown document.
Note
Physically based rendering (PBR, controlled by usePBR
) is
only used with method = "shader"
.
If PBR is not used, the V8 package is required so that the shaders can be modified.
Examples
if ((interactive() || rgl::in_pkgdown_example()) && requireNamespace("manipulateWidget")) {
gltf <- readGLB(system.file("glb/RiggedSimple.glb", package = "rgl2gltf"))
gltfWidget(gltf)
}