isVec
이 페이지에서

isVec()

함수, 타입 분류

Narrows a ShaderType to the native { kind: 'vec' } arm, whose elem is 'f32' | 'i32' | 'u32'.

import { isVec } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

const isVec: (t: ShaderType) => t is Extract<ShaderType, { kind: "vec"; }>

매개변수

t ShaderType

반환값

t is Extract<ShaderType, { kind: 'vec' }>

설명

The emulated-double vector is the separate 'vec64' kind; test for it with isVec64. Binary-op type resolution uses it (isMat(a) && isVec(b), isVec(a) && isScalar(b)) to decide between a vector-scalar broadcast, a matrix-vector product and a same-kind op, and the .x/.y/.r/.g swizzle guards use it to reject a non-vector receiver.

예제

예제

import { isVec, vec3fT, f32T } from 'typeshade'
isVec(vec3fT) // true
isVec(f32T) // false

함께 보기

소스

src/core/ir/types.ts, 1072행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고