construct()
함수, 값 분류
Low-level TypeName(args) constructor call, the primitive that vec2, vec3, vec2f64 and a struct's .construct({...}) all build on.
import { construct } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
const construct: <T extends ShaderType>( type: T, args: NodeLike[],) => Node<KeyOf<T>>매개변수
typeT extends ShaderTypeargsNodeLike[]
반환값
설명
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.
예제
예제
import { construct, vec3fT } from 'typeshade'
const v = construct(vec3fT, [1, 0, 0]) // same result as vec3(1, 0, 0)관련 가이드
함께 보기
소스
src/core/ir/node.ts, 2444행, 커밋 c66579bf 기준