vec4
On this page

vec4()

Function in Builtins

A vec4<f32> constructor, WGSL-style: vec4.

import { vec4 } from 'typeshade/core/ir'

This export returns an IR node. A "use typeshade" file calls the builtin itself: vec4()

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

const vec4: (...a: NodeLike[]) => Node<"vec4<f32>">

Parameters

...a NodeLike[]

Return value

Node<'vec4<f32>'>

Description

Bare number components lift to f32, so the common clip-space pattern vec4(pos, 0, 1) needs no f32() wrapper on the trailing arguments.

Examples

Example

import { fn, vec2, vec4, f32T } from 'typeshade/core/ir'
const clip = fn('clip', { pos: f32T }, ({ pos }) => vec4(vec2(pos, pos), 0, 1))

In the guide

See also

Source

src/core/ir/node.ts, line 2244, at commit af54ddad5

Edit this page Report a problem