extractTexture | R Documentation |
Extracts a texture from a glTF object, and writes it to a file.
extractTexture(gltf, index = 0,
outfile = tempfile(),
verbose = TRUE)
gltf |
The glTF object. |
index |
The texture number (starting from 0). |
outfile |
The filename to write to. If |
verbose |
Whether to report on success. |
Since rgl doesn't support any texture format except PNG, this function will attempt to convert JPEG textures to PNG. To do that it needs to have the jpeg and png packages available.
Returns the filename that was written, or NULL
if the request failed.
If closeConnections = FALSE
, the filename will have
attribute "gltf"
containing the gltf
object which might now contain a new open connection.
If the texture has a recorded MIME type in gltf
,
that will be returned in attribute "mimeType"
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.