빠른 시작
<canvas id="mainCanvas"></canvas>
<script type="module">
import { Engine, EngineConfiguration, Scene, Vector2, Rect, Colors } from "./build/vanilla.js";
class MainScene extends Scene {
draw(graphic) {
super.draw(graphic);
graphic.setFillColor(Colors.white);
graphic.drawRect(Rect.create(100, 100, 200, 120));
}
}
const engineConfiguration = new EngineConfiguration();
engineConfiguration.canvasId = "mainCanvas";
engineConfiguration.referenceResolutionSize = Vector2.create(1280, 720);
engineConfiguration.autoResizeOnWindowResize = true;
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
</script>
번들을 직접 만들 때는 esbuild 를 씁니다. 저장소 루트에서 아래 명령이 build/vanilla.js 와 build/vanilla.min.js 를 짓습니다.
node tools/bundle.cjsvanilla.js는 줄과 들여쓰기를 남기고 주석을 뺀 읽는 판입니다. 원래 소스와 주석은 소스 맵(vanilla.js.map)에 들어 있습니다.vanilla.min.js는 줄인 판입니다.
샘플
모두 저장소의 examples/ 에 소스가 있고, 아래 링크는 배포본입니다.
| 샘플 | 설명 | 데모 | 소스 |
|---|---|---|---|
| Toon Shading | VRM 1.0 캐릭터의 애니풍 렌더링. 3 톤 램프, 구면 노멀 얼굴 그림자, 앞머리 그림자, 천사 고리, 화면 공간 림, 아웃라인, 스프링 본, Quaternius(CC0) 본 애니메이션 8 종 | 열기 | examples/toonshading |
| Old Face | MetaHuman(Epic Games, 데모 전용) 얼굴의 PBR. 서브서피스 스캐터링, 표정 주름 맵, 그룸 카드 머리카락, 눈 굴절, 머티리얼 그래프 패널. 에셋 고지: MetaHuman, 라이선스 | 열기 | examples/oldface |
| Ancient Mountain | 절차 지형(경사, 고도 3 중 블렌딩)과 하늘, 구름, 섀도우 맵, 걷기 / 달리기 / 등반하는 캐릭터 | 열기 | examples/ancientmountain |
| Neon Horizon | 절차 하늘(초콜릿 하늘, 바닐라 태양)과 함대 3D 모델, 엔진 글로우, 기함 주포 연출 | 열기 | examples/neonhorizon |
| UI Showcase | UI 컴포넌트 전시. 버튼, 스크롤 뷰, 리스트, 차트, 다이얼로그, 레이아웃 | 열기 | examples/uishowcase |
| Particle Effects | 불 / 분수 / 눈 / 비 / 폭발 등 파티클 프리셋 18 종 | 열기 | examples/particleeffects |
| Timeline Showcase | 타임라인 편집기로 만든 문서 8 종 재생. 트랜스포트, 스크럽, 마커 / 이벤트 | 열기 | examples/timelineshowcase |
| Sprite Effects | ShaderSprite 49 종, ScreenEffect 59 종, 게임 연출 조합 시연 |
열기 | examples/spriteeffects |
배포본이 없는 예제: examples/cameratour(돌아가는 Camera2D, 노드 트윈, Indicator), examples/toonmaterial(툰 확장 시험 장면: 머티리얼 셰이더 조각, 텍스처와 데칼, 점광, 반 램버트 띠, 더하기 홀로그램, 평면 거울, 영구 인스턴스 버퍼)
Getting Started
<canvas id="mainCanvas"></canvas>
<script type="module">
import { Engine, EngineConfiguration, Scene, Vector2, Rect, Colors } from "./build/vanilla.js";
class MainScene extends Scene {
draw(graphic) {
super.draw(graphic);
graphic.setFillColor(Colors.white);
graphic.drawRect(Rect.create(100, 100, 200, 120));
}
}
const engineConfiguration = new EngineConfiguration();
engineConfiguration.canvasId = "mainCanvas";
engineConfiguration.referenceResolutionSize = Vector2.create(1280, 720);
engineConfiguration.autoResizeOnWindowResize = true;
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
</script>
To build the bundle yourself, use esbuild. From the repository root, the command below builds build/vanilla.js and build/vanilla.min.js.
node tools/bundle.cjsvanilla.jsis the readable build: it keeps lines and indentation and drops comments. The original sources and comments are in the source map (vanilla.js.map).vanilla.min.jsis the minified build.
Samples
All sources are in examples/ in the repository, and the links below are the deployed builds.
| Sample | Description | Demo | Source |
|---|---|---|---|
| Toon Shading | Anime-style rendering of a VRM 1.0 character. 3-tone ramp, spherical-normal face shadows, bangs shadows, angel ring, screen-space rim, outlines, spring bones, 8 Quaternius (CC0) bone animations | Open | examples/toonshading |
| Old Face | PBR MetaHuman face (Epic Games, demo only). Subsurface scattering, expression wrinkle maps, groom card hair, eye refraction, material graph panel. Asset notice: MetaHuman, license | Open | examples/oldface |
| Ancient Mountain | Procedural terrain (3-way blending by slope and altitude) with sky, clouds, shadow map, and a character that walks / runs / climbs | Open | examples/ancientmountain |
| Neon Horizon | Procedural sky (chocolate sky, vanilla sun) with fleet 3D models, engine glow, flagship main gun sequence | Open | examples/neonhorizon |
| UI Showcase | UI component showcase. Buttons, scroll views, lists, charts, dialogs, layout | Open | examples/uishowcase |
| Particle Effects | 18 particle presets such as fire / fountain / snow / rain / explosion | Open | examples/particleeffects |
| Timeline Showcase | Playback of 8 documents made with the timeline editor. Transport, scrubbing, markers / events | Open | examples/timelineshowcase |
| Sprite Effects | 49 ShaderSprite types, 58 ScreenEffect types, demos of combined game effects |
Open | examples/spriteeffects |
Examples without a deployed build: examples/cameratour (rotating Camera2D, node tweens, Indicator), examples/toonmaterial (toon extension test scene: material shader snippets, textures and decals, point lights, half-Lambert bands, additive holograms, planar mirrors, persistent instance buffers)