construct
On this page

construct()

Function in Values

Low-level TypeName(args) constructor call, the primitive that vec2, vec3, vec2f64 and a struct's .construct({...}) all build on.

import { construct } from 'typeshade'

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

Syntax

const construct: <T extends ShaderType>(
type: T,
args: NodeLike[],
) => Node<KeyOf<T>>

Parameters

type T extends ShaderType
args NodeLike[]

Return value

Node<KeyOf<T>>

Description

A bare-number argument lifts to the constructed type’s element scalar. Call it directly only for a ShaderType those named helpers do not cover; ordinary authoring uses the typed wrapper.

Examples

Example

import { construct, vec3fT } from 'typeshade'
const v = construct(vec3fT, [1, 0, 0]) // same result as vec3(1, 0, 0)

In the guide

See also

Source

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

Edit this page Report a problem