vec4
On this page

vec4()

Function in Builtins

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

import { vec4 } from 'typeshade'

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

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'
const clip = fn('clip', { pos: f32T }, ({ pos }) => vec4(vec2(pos, pos), 0, 1))

In the guide

Source

src/core/ir/node.ts, line 2519, at commit 26de7be8

Edit this page Report a problem