vec2()
Function in Builtins
A vec2<f32> constructor, WGSL-style: vec2(x, y).
import { vec2 } from 'typeshade/core/ir'
This export returns an IR node. A "use typeshade" file calls the builtin itself: vec2()
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
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/core/ir'
const uv = vec2(0, 1) // Node<'vec2<f32>'>In the guide
See also
Source
src/core/ir/node.ts, line 2216, at commit af54ddad5