---
title: "vec4(): typeshade/core/ir의 IR 빌더 함수, TypeShade 컴파일러 API"
description: "vec4, typeshade/core/ir의 IR 빌더 함수입니다. vec4<f32> 생성자이며, WGSL 방식으로 vec4라고 씁니다."
url: https://typeshade.dev/ko/api/vec4/
language: ko
---

# `vec4()`

함수, 내장 함수 분류

`vec4<f32>` 생성자이며, WGSL 방식으로 `vec4`라고 씁니다.

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

이 export는 IR 노드를 반환합니다. `"use typeshade"` 파일에서는 내장 함수 자체를 부릅니다: [`vec4()`](https://typeshade.dev/ko/reference/functions/vec4/)

설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.

## 구문

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

## 매개변수

**`...a` `NodeLike[]`**

## 반환값

`Node<'vec4<f32>'>`

## 설명

일반 숫자 성분은 `f32`로 승격됩니다. 그래서 흔한 클립 공간 패턴 `vec4(pos, 0, 1)`은 뒤쪽 인자에 `f32()` 래퍼가 필요하지 않습니다.

## 예제

### 예제

```ts
import { fn, vec2, vec4, f32T } from 'typeshade/core/ir'

const clip = fn('clip', { pos: f32T }, ({ pos }) => vec4(vec2(pos, pos), 0, 1))
```

## 관련 가이드

- [첫 셰이더](https://typeshade.dev/ko/guide/internals/your-first-shader/)
- [값과 변경](https://typeshade.dev/ko/guide/internals/values-and-mutation/)
- [함수와 진입점](https://typeshade.dev/ko/guide/internals/functions-and-entry-points/)
- [레이아웃과 리소스](https://typeshade.dev/ko/guide/internals/layouts-and-resources/)
- [CPU 오라클 안내서](https://typeshade.dev/ko/guide/internals/the-cpu-oracle/)
- [GLSL 셰이더 옮기기](https://typeshade.dev/ko/guide/internals/migrating-a-glsl-shader/)

## 함께 보기

- [`vec4()`](https://typeshade.dev/ko/reference/functions/vec4/)

## 소스

[`src/core/ir/node.ts`, 2244행](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L2244), 커밋 af54ddad5 기준
