Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
0ac04f5
#242 基礎実装をコミット
ienaga Nov 30, 2025
d80fe76
#242 バージョン情報を更新
ienaga Nov 30, 2025
c27d506
#243 update packages
ienaga Dec 2, 2025
5d2bc7c
#243 delete flow_chart.svg
ienaga Dec 2, 2025
929e188
#243 update github actions
ienaga Dec 2, 2025
b561245
Merge branch 'webgpu' into develop
ienaga Dec 2, 2025
b28760c
#242 update packages
ienaga Dec 2, 2025
11c850b
#242 Shapeのキャッシュ処理を改修、キャッシュIDの24bit整数の生成処理を改修
ienaga Dec 2, 2025
bedb719
#242 WebGL版の背景の初期化処理を見直し
ienaga Dec 3, 2025
0a91218
#242 WebGL版の背景処理を改修
ienaga Dec 3, 2025
a691470
#242 不要なファイルを削除
ienaga Dec 3, 2025
21745ab
#242 update README
ienaga Dec 8, 2025
f0f6ded
#242 @next2d/cacheのREADMEを更新
ienaga Dec 8, 2025
12e685f
#242 @next2d/cacheに英語の説明を追加
ienaga Dec 8, 2025
dc2e546
#242 @next2d/cacheのREADMEを更新
ienaga Dec 8, 2025
eadfee3
#242 update @next2d/core README
ienaga Dec 8, 2025
2c9c11d
#242 @next2d/coreのREADMEに英語の説明を追加
ienaga Dec 8, 2025
ba527c4
#242 update README
ienaga Dec 8, 2025
1a9f08f
#242 update README
ienaga Dec 8, 2025
f0bc720
#242 Shapeの処理をリファクタリング
ienaga Dec 8, 2025
8b7e138
#242 WebGL版をリファクタリング
ienaga Dec 8, 2025
59327f1
#242 WebGLの処理をリファクタリング
ienaga Dec 8, 2025
68d3a59
#242 WebGPUを実装(WIP)
ienaga Dec 8, 2025
7afe8df
#242 WebGPU実装(WIP)
ienaga Dec 8, 2025
556175f
#242 WebGPU実装(WIP)
ienaga Dec 8, 2025
15cfb4c
#242 WenGPUの実装(WIP)
ienaga Dec 8, 2025
1846aaf
#242 update @next2d/webgl RENDERING_FLOW.md
ienaga Dec 8, 2025
a0fb411
#242 @next2d/webglのドキュメントを更新
ienaga Dec 8, 2025
04672a3
#242 WenGPUの実装を追加(WIP)
ienaga Dec 8, 2025
ab40bb2
#242 @next2d/webglのドキュメントを更新
ienaga Dec 8, 2025
ec94400
#242 @next2d/webglのドキュメントを追加
ienaga Dec 8, 2025
40f0707
#242 WenGPUを実装(WIP)
ienaga Dec 8, 2025
ab97a4f
#242 @next2d/webglのドキュメントを追加
ienaga Dec 8, 2025
a875e17
#242 @next2d/webglのドキュメントを追加
ienaga Dec 8, 2025
9772318
#242 update @next2d/webgl ドキュメント
ienaga Dec 8, 2025
ad20aa5
#242 WebGPUの実装を追加(WIP)
ienaga Dec 8, 2025
4642141
#242 update @next2d/webgl ドキュメント
ienaga Dec 8, 2025
d4536f6
#242 WebGPUの実装を追加(WIP)
ienaga Dec 8, 2025
dc1a200
#242 update README
ienaga Dec 9, 2025
82bc8f0
#242 WebGPUの実装を追加(WIP)
ienaga Dec 9, 2025
409da52
#242 WebGLとWebGPU実装の比較とリファクタリング(WIP)
ienaga Dec 9, 2025
7e85722
#242 利用していない関数を削除
ienaga Dec 9, 2025
dcf5739
#242 WebGPUのグラデーション処理を修正(WIP)
ienaga Dec 9, 2025
36d95aa
#242 WebGPUの実装を追加
ienaga Dec 9, 2025
f2aa402
#242 WebGPUの実装を追加(WIP)
ienaga Dec 9, 2025
279f804
#242 WebGPUの実装を追加(WIP)
ienaga Dec 9, 2025
d25287e
#242 WebGPU実装の処理を分割
ienaga Dec 9, 2025
e1827d3
#242 WebGPUで利用してない処理を削除
ienaga Dec 9, 2025
e2371b6
#242 ゲーム制作で出た、細かいバグを改修
ienaga Jan 19, 2026
0ca1688
#242 update packages
ienaga Jan 19, 2026
d63c157
#242 テストコードとアトラスへの描画時の初期化処理を改修
ienaga Jan 19, 2026
5e02305
#242 Linter対応
ienaga Jan 19, 2026
dc648e9
#242 Linter対応
ienaga Jan 19, 2026
a5dfc0f
#242 識別IDの高負荷処理をリファクタリング
ienaga Jan 20, 2026
20713f9
#242 Shapeにload関数を追加
ienaga Jan 22, 2026
6eb32d2
#242 atlas textureへの不要な描画処理の判定を追加
ienaga Jan 26, 2026
2bc1efe
#242 webgl版の負荷が高い処理を改修
ienaga Jan 26, 2026
950d721
#242 shape処理の描画部分を改修、メモリ肥大化部分を改修
ienaga Jan 27, 2026
c8bfb72
#242 マスク処理を追加(WIP)
ienaga Jan 27, 2026
ebbd129
#242 リサイズへの対応を追加、マスク処理を改修(WIP)
ienaga Jan 28, 2026
6f3d608
#242 マスク処理を追加(WIP)
ienaga Jan 28, 2026
b727ede
#242 グラデーションの処理を実装(WIP)
ienaga Jan 29, 2026
f6648f0
#242 Shapeとグラデーション処理を改修
ienaga Jan 30, 2026
bda821b
#242 フィルターを実装(WIP)
ienaga Jan 30, 2026
fc4285f
#242 ブレンドモードを実装(WIP)
ienaga Jan 30, 2026
629ee5e
#242 Lint対応
ienaga Jan 30, 2026
bddcb90
#242 処理速度改善を実施
ienaga Jan 30, 2026
9346f95
#242 処理のリファクタリング
ienaga Jan 30, 2026
ee84762
#242 テストケースを追加
ienaga Jan 30, 2026
7d55ff0
#242 テストケースを追加
ienaga Jan 31, 2026
6801e3f
#242 テストケースを追加
ienaga Jan 31, 2026
ef6119b
#242 テストケースを追加
ienaga Jan 31, 2026
a7398be
#242 テストケースを追加
ienaga Jan 31, 2026
96bfa7d
#242 テストケースを追加
ienaga Jan 31, 2026
0a3b930
#242 テストケースを追加
ienaga Jan 31, 2026
a132522
#242 ユニットテストを追加
ienaga Jan 31, 2026
a667854
#242 不要なファイルを削除、テストケースを追加
ienaga Jan 31, 2026
788e175
#242 デバックソースを削除
ienaga Jan 31, 2026
7373e7e
#242 実装をリファクタリング
ienaga Jan 31, 2026
0356a9c
#242 リファクタリングを実施
ienaga Jan 31, 2026
e72dcc6
#242 update packages
ienaga Feb 1, 2026
3c1c20f
#242 E2Eテストを追加
ienaga Feb 1, 2026
b4a1694
#242 DisplayObjectContainerのブレンドモードとフィルター描画を実装(WIP)
ienaga Feb 1, 2026
8554674
#242 e2eのテスト導入準備、CPU負荷の高い箇所を修正
ienaga Feb 1, 2026
352bc83
rendererに受け渡すbuffer作成処理を改善
ienaga Feb 1, 2026
cfc9895
#242 キャッシュIDの生成ロジックを改修
ienaga Feb 1, 2026
8ff36b9
#242 不要な関数・クラスを削除、複数アトラスの不具合改修
ienaga Feb 1, 2026
3c5a087
#242 不要なファイルを削除
ienaga Feb 1, 2026
079c169
#242 最大サイズを調整
ienaga Feb 1, 2026
0e45ffb
#242 描画判定処理を改修
ienaga Feb 1, 2026
4b0d750
#242 シザーカットの範囲を改修
ienaga Feb 1, 2026
66749c1
#242 フィルターのキャッシュキーを変更、e2eのキャプチャー画像を更新
ienaga Feb 1, 2026
4dd36e8
#242 フィルターのシェーダーを改修
ienaga Feb 1, 2026
f7f98e5
e2eのキャプチャーを追加
ienaga Feb 1, 2026
9e156d4
#242 maskプロパティの設定を追加
ienaga Feb 2, 2026
ebcabc3
#242 e2eのテストケースを追加
ienaga Feb 2, 2026
e13b29a
#242 e2eのwebgl版のキャプチャーを追加
ienaga Feb 3, 2026
e3b5a0e
#242 update packages
ienaga Feb 3, 2026
2d381bb
#242 lineBitmapのバグを修正
ienaga Feb 3, 2026
6d36881
#242 e2eテストのスナップショットを更新
ienaga Feb 3, 2026
57dac45
#242 e2eのvideoのキャプチャー出力を修正
ienaga Feb 3, 2026
270a988
#242 convolution filterのキャプチャーを更新
ienaga Feb 3, 2026
0425657
#242 strokeのパス処理を改修
ienaga Feb 3, 2026
713ff15
#242 strokeのパス解析の改修、DisplacementMapFilterのパラメーターを修正
ienaga Feb 3, 2026
0cc0f16
#242 webgpu版の描画結果(WIP)
ienaga Feb 3, 2026
7879cb9
#242 グラフィックのMesh処理を改修
ienaga Feb 3, 2026
9251700
#242 AI開発に向けたspecsを作成(WIP)
ienaga Feb 3, 2026
a6f04c9
#242 webgl版のスナップショットを更新
ienaga Feb 3, 2026
2a8bb1e
#242 webgpuのe2eテストを追加(WIP)
ienaga Feb 3, 2026
6363c6a
#242 AIスキル用specsを追加(WIP)
ienaga Feb 3, 2026
13ab7e8
#242 AIのスキル用specsを追加(WIP)
ienaga Feb 3, 2026
ef3399d
#242 webgpu版のスナップショットを更新(WIP)
ienaga Feb 3, 2026
59274b9
#242 AIのスキル用のspecsを追加(WIP)
ienaga Feb 3, 2026
e900e9d
#242 AIのスキル用のspecsを追加(WIP)
ienaga Feb 3, 2026
1441782
#242 AIのスキル用のspecsを作成(WIP)
ienaga Feb 4, 2026
e1ceb68
#242 webgpu版のベクター処理を改修
ienaga Feb 4, 2026
edae5e3
#242 AIのskills用のspecsを作成(WIP)
ienaga Feb 4, 2026
4df35b4
#242 Video描画をリファクタリング
ienaga Feb 4, 2026
0e3562e
#242 webglのブレンド描画のバグを改修
ienaga Feb 5, 2026
87f4762
#242 webgpuのscreenブレンドの処理を改修
ienaga Feb 5, 2026
4457c53
#242 webgl版のstrokeのmeshのバグを改修
ienaga Feb 5, 2026
72a5144
#242 webgpu版のスナップショットを更新
ienaga Feb 5, 2026
ba603c6
#242 webglのe2eテストのスナップショットを更新
ienaga Feb 5, 2026
93a3c54
#242 webgpuのstroke処理を改修
ienaga Feb 6, 2026
54c2076
#242 テキストのフィルターの処理を改修
ienaga Feb 6, 2026
d054511
#242 複数のフィルターのテストを追加(WIP)
ienaga Feb 6, 2026
78f2ac0
#242 GradientBevelFilterを改修
ienaga Feb 6, 2026
632ddcb
#242 GradientGlowFilterを修正
ienaga Feb 6, 2026
ca14a97
#242 webgpu版のマスク処理にアンチエイリアスを追加
ienaga Feb 6, 2026
8f6d9a8
#242 webgpuのブレンドモードを改修
ienaga Feb 6, 2026
2410115
#242 Glowフィルターを修正
ienaga Feb 6, 2026
d1d1ad8
#242 update packages
ienaga Feb 6, 2026
9e290a1
#242 webgpuのリファクタリング
ienaga Feb 7, 2026
748a323
#242 テストケースを修正
ienaga Feb 7, 2026
7618e44
#242 e2eのテストパターンを追加
ienaga Feb 7, 2026
a42c4d9
#242 フィルターの受け渡し処理を追加
ienaga Feb 7, 2026
72758f1
#242 DisplayObjectContainerへのブレンド・フィルター適用(メインスレッド側)
ienaga Feb 7, 2026
56bada0
#242 Lint対応
ienaga Feb 7, 2026
f2d3512
#242 コンテナーのブレンドとフィルターの実装(WIP)
ienaga Feb 7, 2026
5029304
#242 コンテナのブレンドとフィルターを実装(WIP)
ienaga Feb 7, 2026
7c0c7d7
#242 ObjectPoolが重複箇所を改修
ienaga Feb 7, 2026
c838a26
#242 ObjectPoolが重複箇所を改修
ienaga Feb 7, 2026
5a11d45
#242 コンテナのブレンド・フィルターを実装
ienaga Feb 7, 2026
6f68356
#242 コンテナのブレンド・フィルター実装(webgl)
ienaga Feb 8, 2026
200db08
#242 webgpuのブレンド・フィルターを実装(WIP)
ienaga Feb 8, 2026
f2b099d
#242 webgpuのブレンド・フィルターの処理を改修
ienaga Feb 8, 2026
90652ae
#242 webgpu版のコンテナのブレンド・フィルター時のColorTransfromを実装
ienaga Feb 8, 2026
b4355a4
#242 webgpu版のフィルター実装
ienaga Feb 8, 2026
1cf120e
#242 webgpu版をリファクタリング
ienaga Feb 8, 2026
ac95fc8
#242 webgpu版の1pxの余白問題を改修
ienaga Feb 8, 2026
687225c
#242 webgpu版のリファクタリング
ienaga Feb 8, 2026
36093b9
#242 webgl版をリファクタリング
ienaga Feb 8, 2026
c5c3b11
#242 webgpuのcall数をリファクタリング
ienaga Feb 9, 2026
d32a45f
#242 webglのcall数をリファクタリング
ienaga Feb 9, 2026
d51a2f7
#242 webgpu版をリファクタリング
ienaga Feb 9, 2026
31430ce
#242 webgl版をリファクタリング
ienaga Feb 9, 2026
cc7d991
#242 webgpu版のリファクタリング
ienaga Feb 9, 2026
6eebe4f
#242 webgpu版をリファクタリング
ienaga Feb 9, 2026
f153906
#242 webgpu版をリファクタリング
ienaga Feb 9, 2026
abe7628
#242 アトラスの1pxの線が出てしまう事象への対処を追加
ienaga Feb 9, 2026
fbadd2e
#242 テストケースを修正
ienaga Feb 9, 2026
db2f90c
#242 webgpu版をリファクタリング
ienaga Feb 9, 2026
6a04a1b
#242 webgpu版をリファクタリング
ienaga Feb 9, 2026
cc48030
#242 webgpu版のリファクタリング
ienaga Feb 10, 2026
9271f1d
#242 webgpu版をリファクタリング
ienaga Feb 10, 2026
b08b369
#242 不要なファイルを削除
ienaga Feb 10, 2026
6c0d890
#242 webgpu版をリファクタリング
ienaga Feb 10, 2026
8ab74b2
#242 webgl版をリファクタリング
ienaga Feb 10, 2026
f31647e
#242 webgpuに切り替え
ienaga Feb 10, 2026
5107b2b
#242 Shape.loadを改修
ienaga Feb 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 12 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- run: npm install -g npm@latest
- run: npm install
- run: npm run test

Expand All @@ -28,7 +32,11 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- run: npm install -g npm@latest
- run: npm install
- run: npm run test
16 changes: 12 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- run: npm install -g npm@latest
- run: npm install
- run: npm run lint

Expand All @@ -28,7 +32,11 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- run: npm install -g npm@latest
- run: npm install
- run: npm run lint
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "22.x"
node-version: 24
registry-url: "https://registry.npmjs.org"
- run: npm install -g npm@latest
- run: npm install
- run: npm run publish:dist
- run: cd ~/work/player/player/dist/src && npm publish --access public
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ build
coverage
.DS_Store
.idea
Thumbs.db
Thumbs.db
.playwright-mcp
playwright-report
test-results
130 changes: 130 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Next2D Player is a WebGL/WebGPU-based 2D graphics rendering engine for creating rich, interactive graphics, games, and cross-platform applications. It uses hardware acceleration for graphics processing and OffscreenCanvas with web workers for multi-threaded rendering performance.

## Build & Development Commands

```bash
npm install # Install dependencies
npm start # Start dev server with Vite (opens index.html)
npm test # Run all tests with Vitest
npm run lint # ESLint for src/**/*.ts and packages/**/*.ts
npm run build:vite # Build production bundle
npm run clean # Clean build artifacts
```

### Running a Single Test

Tests use Vitest. To run a specific test file:
```bash
npx vitest packages/webgl/src/Blend/service/BlendAddService.test.ts
```

Or run tests matching a pattern:
```bash
npx vitest --testNamePattern "BlendAddService"
```

## Architecture

### Package Structure (Monorepo with npm workspaces)

The `packages/` directory contains modular packages with strict dependency rules:

**Core packages (loosely coupled, no cross-imports allowed):**
- `@next2d/events` - Event system
- `@next2d/cache` - Caching utilities
- `@next2d/filters` - Image filters
- `@next2d/geom` - Geometry/matrix utilities
- `@next2d/texture-packer` - Texture atlas packing
- `@next2d/render-queue` - Render command queue

**Rendering layer:**
- `@next2d/webgl` - WebGL rendering context and operations
- `@next2d/webgpu` - WebGPU rendering (alternative backend)
- `@next2d/renderer` - OffscreenCanvas worker-based renderer (imports only `@next2d/webgl`)

**Display layer:**
- `@next2d/display` - DisplayObject hierarchy (Shape, MovieClip, Bitmap, etc.)
- `@next2d/text` - TextField rendering
- `@next2d/media` - Audio/Video support
- `@next2d/ui` - UI components
- `@next2d/net` - Network/loading utilities

**Entry point:**
- `@next2d/core` - Main Next2D class, Player, Canvas (references other packages but cannot be referenced BY other packages)

### Code Organization Pattern

Each class follows a `usecase`/`service` pattern for method implementation:

```
class => method => service (simple operations)
class => method => usecase => service (complex operations)
```

Key rules:
- Logic lives in `usecase` or `service` files, not in class methods
- Services cannot call other services directly
- Usecases orchestrate multiple services
- Methods only set class variables (`private`/`protected`)

Directory structure example:
```
packages/webgl/src/
Context.ts # Main class
Context/
service/ContextResetService.ts # Simple operations
service/ContextResetService.test.ts
usecase/ContextBindUseCase.ts # Complex operations
usecase/ContextBindUseCase.test.ts
```

### Rendering Pipeline

The player uses a two-thread architecture:
1. **Main thread**: DisplayObject tree management, event handling, animation logic
2. **Worker thread**: WebGL/WebGPU rendering via OffscreenCanvas

Flow: DisplayObjects -> RenderQueue -> Worker -> WebGL Context -> Canvas

Key rendering features:
- Texture Atlas with binary tree packing for efficient GPU memory
- Instanced array rendering for batch drawing
- Filter/blend effects rendered to texture cache
- Mask rendering with stencil buffer

## WebGL/WebGPU Renderer Switching

The renderer backend is controlled by the `useWebGPU` flag in:
`packages/renderer/src/Command/service/CommandInitializeContextService.ts`

- `const useWebGPU: boolean = true;` → WebGPU renderer
- `const useWebGPU: boolean = false;` → WebGL renderer

E2E tests use whichever renderer is set by this flag. To compare WebGL vs WebGPU output:
1. Set `useWebGPU = false`, run e2e tests for WebGL snapshots
2. Set `useWebGPU = true`, run e2e tests for WebGPU snapshots
3. Compare the generated snapshots

### E2E Tests

E2E tests use Playwright. Run from the `e2e/` directory:
```bash
cd e2e
npx playwright test tests/sprite.spec.ts --project=webgl --update-snapshots
npx playwright test tests/sprite.spec.ts --project=webgpu --update-snapshots
```

Snapshots are saved to:
- `e2e/snapshots/webgl/{spec}-snapshots/`
- `e2e/snapshots/webgpu/{spec}-snapshots/`

## Requirements

- Node.js >= v22.x
- TypeScript ES2020 target
4 changes: 0 additions & 4 deletions drawing_flow_chart.svg

This file was deleted.

Binary file added e2e/fixtures/images/test-asymmetric.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e/fixtures/images/test-checker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e/fixtures/images/test-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e/fixtures/images/test-gradient.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e/fixtures/images/test-star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e/fixtures/images/test-stripe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added e2e/fixtures/videos/movie.mp4
Binary file not shown.
Loading
Loading