modifyShaders | R Documentation |
This function applies specified edits to shader code to support new functions.
modifyShaders(shaders, mod, ...)
shaders |
A list of shaders, e.g. as produced by |
mod |
Either a character value naming a built-in set of mods (currently just |
... |
Optional arguments; all will be passed to any functions
in |
The mods
argument is organized in a nested list.
The top level can contain vertexShader
and
fragmentShader
components.
Each of those is a list of changes to apply to that shader.
Each change is a list with old
and new
entries.
The old
entry is used as a "fixed" pattern to
select one or more lines from the shader to be replaced.
Multiple matches are allowed, but they shouldn't overlap.
Changes will be applied in the order specified, so take care
that a pattern doesn't match new text from an earlier change.
The new
entry contains the replacement. It
can either be a character vector or a function that returns
a character vector. If it is a function, it will be passed
the ...
argument.
See rgl2gltf:::shaderChanges
for the built-in modifications.
A new shader object incorporating the edits.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.