Buffer | R Documentation |
These files typically have one buffer holding all the binary data for a scene.
new()
Buffer$new(json = NULL, binfile = NULL)
json
list read from glTF file.
binfile
optional External binary filename, or raw vector
load()
Load from file.
Buffer$load(uri, buf = 0)
uri
Which file to load.
buf
Which buffer number to load.
saveOpenBuffer()
Write open buffer to connection.
Buffer$saveOpenBuffer(con, buf = 0)
con
Output connection.
buf
Buffer number.
getBuffer()
Get buffer object.
Buffer$getBuffer(buf, default = list(byteLength = 0))
buf
Buffer number.
default
Default buffer object if buf
not found.
A list containing components described here: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-buffer.
setBuffer()
Set buffer object.
Buffer$setBuffer(buf, buffer)
buf
Buffer number.
buffer
New value to insert.
openBuffer()
Open a connection for the data in a buffer.
Buffer$openBuffer(buf)
buf
Buffer number.
An open binary connection.
writeBuffer()
Write data to buffer.
Buffer$writeBuffer(values, type, size, buf = 0)
values
Values to write.
type
Type to write.
size
Byte size of each value.
buf
Which buffer to write to.
Byte offset of start of bytes written.
closeBuffer()
Close the connection in a buffer.
If there was a connection open, this will save the
contents in the raw vector bytes
within the buffer object.
Buffer$closeBuffer(buf)
buf
The buffer number.
closeBuffers()
Close any open buffers.
Call this after working with a GLTF file to avoid warnings from R about closing unused connections.
Buffer$closeBuffers()
getBufferview()
Get bufferView
object.
Buffer$getBufferview(bufv)
bufv
bufferView
number.
A list containing components described here: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-bufferview.
addBufferView()
Add a new buffer view.
Buffer$addBufferView(values, type, size, target = NULL, buf = 0)
values
Values to put in the view.
type
Type of values.
size
Size of values in bytes.
target
Optional target use for values.
buf
Which buffer to write to.
New bufferView
number.
openBufferview()
Open a connection to a buffer view.
Buffer$openBufferview(bufv)
bufv
Which bufferView
.
A connection.
setBufferview()
Set bufferView
object.
Buffer$setBufferview(bufv, bufferView)
bufv
bufferView
number.
bufferView
New value to insert.
getAccessor()
Get accessor object
Buffer$getAccessor(acc)
acc
Accessor number
A list containing components described here: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-accessor
setAccessor()
Set accessor object.
Buffer$setAccessor(acc, accessor)
acc
Accessor number.
accessor
New value to insert.
readAccessor()
Read data given by accessor number.
Buffer$readAccessor(acc)
acc
Accessor number.
A vector or array as specified in the accessor. For the MATn
types, the 3rd index
indexes the element.
readAccessor0()
Read data given by accessor object.
Buffer$readAccessor0(accessor)
accessor
Accessor object
A vector or array as specified in the accessor. For the MATn
types, the 3rd index
indexes the element.
addAccessor()
Write values to accessor, not including min
and max
.
Buffer$addAccessor( values, target = NULL, types = "anyGLTF", normalized = FALSE )
values
Values to write.
target
Optional target use for values.
types
Which types can be used?
normalized
Are normalized integers allowed?
useDouble
Whether to write doubles or singles.
New accessor number
dataURI()
Convert buffer to data URI.
Buffer$dataURI(buf = 0)
buf
Buffer to convert.
String containing data URI.
as.list()
Convert to list.
Buffer$as.list()
List suitable for writing using JSON.
clone()
The objects of this class are cloneable with this method.
Buffer$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.