mix
Function
Returns a * (1 - t) + b * t.
The signature and the sentence under each name are the compiler's own text at commit 26de7be8.
Syntax
declare function mix<V extends vec2 | vec3 | vec4>(a0: V, a1: V, a2: (f32)): Vdeclare function mix<V extends vec2 | vec3 | vec4>(a0: V, a1: V, a2: V): Vdeclare function mix<P0 extends number, P1 extends number, P2 extends number>(a0: P0, a1: P1, a2: P2): ([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : ([P1] extends [boolean] ? bool : typeof f32Tag extends keyof P1 ? f32 : typeof i32Tag extends keyof P1 ? i32 : typeof u32Tag extends keyof P1 ? u32 : typeof f64Tag extends keyof P1 ? f64 : ([P2] extends [boolean] ? bool : typeof f32Tag extends keyof P2 ? f32 : typeof i32Tag extends keyof P2 ? i32 : typeof u32Tag extends keyof P2 ? u32 : typeof f64Tag extends keyof P2 ? f64 : number)))declare function mix(a: vec2, b: vec2, t: number): vec2declare function mix(a: vec3, b: vec3, t: number): vec3declare function mix(a: vec4, b: vec4, t: number): vec4declare function mix(a: vec2f64, b: vec2f64, t: number): vec2f64declare function mix(a: vec3f64, b: vec3f64, t: number): vec3f64declare function mix(a: vec4f64, b: vec4f64, t: number): vec4f64declare function mix<T extends Numeric>(a: T, b: T, t: T): TA number in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.
type f32 = number & { readonly [f32Tag]?: true }
A declaration you write still needs a width, and a bare number on a field or a parameter is refused; the TypeScript constructs page carries that row with the compiler's own message.
A signature may name a type the ambient file declares for its own use. These are those declarations.
Numerictype Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u
Parameters
Return value
V([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : ([P1] extends [boolean] ? bool : typeof f32Tag extends keyof P1 ? f32 : typeof i32Tag extends keyof P1 ? i32 : typeof u32Tag extends keyof P1 ? u32 : typeof f64Tag extends keyof P1 ? f64 : ([P2] extends [boolean] ? bool : typeof f32Tag extends keyof P2 ? f32 : typeof i32Tag extends keyof P2 ? i32 : typeof u32Tag extends keyof P2 ? u32 : typeof f64Tag extends keyof P2 ? f64 : number)))vec2vec3vec4vec2f64vec3f64vec4f64T
Description
t is a scalar or the same shape as a and b. f64 vectors accept an f32 blend factor.
Targets
- WGSL
-
mix(a, b, c) - GLSL ES 3.00
-
mix(a, b, c)
Examples
graticule.tshillshade.tsfp64-checker-plane.tsfp64-loran.tsfp64-mercator-tiles.tsfp64-rtc.tscolor-ramp.tsdiscard-cutout.tsjulia.tsfbm-clouds.tsdomain-warp.tsraymarch-boxes.tstunnel.tsmetaballs.tsocean.tsstarfield.tstruchet.tskaleidoscope.tsheart.tsfp64-mandelbrot.tsfp64-julia.tsfp64-burning-ship.tsfp64-newton.tsfp64-clock.tsfp64-cancellation.tsfp64-sine-sweep.tsgradient-pass.tstexture-array-lod.tstextured-quad.shade.tsshadow-compare.shade.tscube-env.shade.tscube-array-gather.shade.tsuniform-array.shade.tsblock-scope.shade.tspick-composite.shade.tscutout.shade.tsdefault-args.shade.tsbit-bump.shade.tsclosures.shade.tshigher-order.shade.tsarray-methods.shade.tscapsule-corp-namek-class.shade.tsclass-syntax.shade.tsrng-method.shade.tsclass-builder.shade.tsclass-parts.shade.tsrt-renderer-class.shade.tsimported-noise.shade.tshillshade-twin.shade.tsjulia-twin.shade.tsdomain-warp-twin.shade.tstunnel-twin.shade.tsocean-twin.shade.tsstarfield-twin.shade.tskaleidoscope-twin.shade.tsgradient-twin.shade.tsfp64-checker-plane-twin.shade.tsfp64-loran-twin.shade.tsfp64-rtc-twin.shade.tsfp64-julia-twin.shade.tsfp64-burning-ship-twin.shade.tsfp64-newton-twin.shade.tsfp64-clock-twin.shade.tsfp64-cancellation-twin.shade.tsfp64-sine-sweep-twin.shade.ts