DynamicParameterSource
An object that provides a DynamicParameter, such as a preset that holds a GlslFunction and the parameters of the user interface for it. A source can be set as a parameter of a style, or of a GlslParameter or GlslFunction, like the dynamic parameter itself. dynamicParameter is read when the style is used, so a source can replace its dynamic parameter without setting it on the style again.
dynamicParameter should return the same object until it is replaced: a different object makes the structure of the style be compared again, an object with another structure makes another shader.
class Ripple : DynamicParameterSource {
override val dynamicParameter = glslFunction<Vector2>("vec2 uv", "uv + p_amount * sin(uv.yx * 40.0)") {
parameter("amount", 0.01)
}
var amount: Double by dynamicParameter.Parameter("amount")
}
filter.parameter("warp", Ripple())Content copied to clipboard