vec2()
Function in Builtins
A vec2<f32> constructor, WGSL-style: vec2(x, y).
import { vec2 } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
const vec2: (...a: NodeLike[]) => Node<"vec2<f32>">Parameters
...aNodeLike[]
Return value
Node<'vec2<f32>'>
Description
A bare number component lifts to f32,
so vec2(pos.x, 0) emits an f32 zero with no f32() wrapper. construct is the
untyped primitive this and every other vector and struct constructor is built on.
Examples
Example
import { vec2 } from 'typeshade'
const uv = vec2(0, 1) // Node<'vec2<f32>'>In the guide
See also
Source
src/core/ir/node.ts, line 2491, at commit 26de7be8