extractTexture.Rd
Extracts a texture from a glTF object, and writes it to a file.
extractTexture(gltf, index = 0,
outfile = tempfile(),
verbose = TRUE)
The glTF object.
The texture number (starting from 0).
The filename to write to. If outfile
has no
file extension, one will be added based on the MIME type
of the texture.
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"
.