paintFrame
The coordinate and frame size a hand-written paint: builder should draw in.
paintFrame(params: GpuFragmentParams): {uv: Expr; viewport: Expr}
Import paintFrame from shaders/std.
Returns uv and viewport as GPU values. Inside a distortion the uv is the distorted one, and inside a sized box the viewport is the box, so a generator built on these behaves like the library's own.
Parameters
| Name | Type | Notes |
|---|---|---|
params | GpuFragmentParams |
Example
paint: (params) => {
const {uv} = paintFrame(params)
const center = uniformOf(p('center'), params)
const d = length(sub(uv, vec2(center.member('x'), sub(1, center.member('y')))))
return vec4(splat3(smoothstep(0, 0.5, d)), 1)
}