modifyShaders.Rd
This function applies specified edits to shader code to support new functions.
modifyShaders(shaders, mod, ...)
A list of shaders, e.g. as produced by getShaders
.
Either a character value naming a built-in set of mods (currently just "skins"
), or a list of mods as described
in the Details section.
Optional arguments; all will be passed to any functions
in mods
.
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.