@next2d/render-queue 2.13.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +269 -5
- package/package.json +1 -1
- package/src/RenderQueue.d.ts +5 -52
- package/src/RenderQueue.js +160 -52
package/README.md
CHANGED
|
@@ -1,11 +1,275 @@
|
|
|
1
|
-
@next2d/render-queue
|
|
2
|
-
=============
|
|
1
|
+
# @next2d/render-queue
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
**Important**: `@next2d/render-queue` prohibits importing other packages. This package is a foundational module that must remain independent to avoid circular dependencies.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
**重要**: `@next2d/render-queue` は他の packages の import を禁止しています。このパッケージは基盤モジュールであり、循環依存を避けるために独立を維持する必要があります。
|
|
6
|
+
|
|
7
|
+
## 概要 / Overview
|
|
8
|
+
|
|
9
|
+
**日本語:**
|
|
10
|
+
|
|
11
|
+
`@next2d/render-queue`は、Next2D Playerのレンダリングパイプラインにおいて、描画データを効率的に管理するためのレンダーキューパッケージです。Float32Array型のバッファを使用し、DisplayObjectsからの描画命令をバッチ処理してWebGL/WebGPUに送信することで、高速なGPUレンダリングを実現します。
|
|
12
|
+
|
|
13
|
+
**English:**
|
|
14
|
+
|
|
15
|
+
`@next2d/render-queue` is a render queue package that efficiently manages rendering data in the Next2D Player rendering pipeline. It uses a Float32Array-based buffer to batch rendering commands from DisplayObjects and send them to WebGL/WebGPU for high-performance GPU rendering.
|
|
16
|
+
|
|
17
|
+
## 特徴 / Features
|
|
18
|
+
|
|
19
|
+
- **Float32Array型バッファ**: GPU最適化された高速なデータ構造
|
|
20
|
+
- **動的リサイズ**: 2の累乗サイズで自動的にバッファを拡張
|
|
21
|
+
- **バッチ処理**: 複数の描画命令をまとめてGPUに送信
|
|
22
|
+
- **シングルトンパターン**: グローバルな`renderQueue`インスタンスで一元管理
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
- **Float32Array-based buffer**: GPU-optimized high-performance data structure
|
|
27
|
+
- **Dynamic resizing**: Automatically expands buffer to power-of-two sizes
|
|
28
|
+
- **Batch processing**: Groups multiple rendering commands for GPU submission
|
|
29
|
+
- **Singleton pattern**: Centralized management via global `renderQueue` instance
|
|
30
|
+
|
|
31
|
+
## インストール / Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
7
34
|
npm install @next2d/render-queue
|
|
8
35
|
```
|
|
9
36
|
|
|
10
|
-
##
|
|
37
|
+
## ディレクトリ構成 / Directory Structure
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
packages/render-queue/
|
|
41
|
+
├── src/
|
|
42
|
+
│ ├── RenderQueue.ts # レンダーキュー管理クラス / Render queue management class
|
|
43
|
+
│ ├── RenderQueueUtil.ts # ユーティリティ関数 / Utility functions
|
|
44
|
+
│ └── index.ts # エクスポート定義 / Export definitions
|
|
45
|
+
├── README.md
|
|
46
|
+
└── package.json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### ファイル説明 / File Descriptions
|
|
50
|
+
|
|
51
|
+
#### RenderQueue.ts
|
|
52
|
+
**日本語:** レンダーキューの主要クラス。Float32Array型のバッファを管理し、描画データの追加とリサイズを処理します。
|
|
53
|
+
|
|
54
|
+
**English:** Main render queue class. Manages Float32Array buffer and handles adding rendering data and resizing.
|
|
55
|
+
|
|
56
|
+
**主要メソッド / Key Methods:**
|
|
57
|
+
- `push(...args: number[])`: 個別の数値をバッファに追加 / Add individual numbers to buffer
|
|
58
|
+
- `set(array: Float32Array | Uint8Array)`: 配列をバッファにセット / Set array to buffer
|
|
59
|
+
- `resize(length: number)`: バッファを拡張 / Expand buffer
|
|
60
|
+
|
|
61
|
+
#### RenderQueueUtil.ts
|
|
62
|
+
**日本語:** バッファサイズの最適化のための2の累乗計算関数を提供します。
|
|
63
|
+
|
|
64
|
+
**English:** Provides power-of-two calculation function for buffer size optimization.
|
|
65
|
+
|
|
66
|
+
**主要関数 / Key Functions:**
|
|
67
|
+
- `$upperPowerOfTwo(v: number)`: 指定値を2の累乗に切り上げ / Round up to power of two
|
|
68
|
+
|
|
69
|
+
## レンダリングパイプラインにおける役割 / Role in Rendering Pipeline
|
|
70
|
+
|
|
71
|
+
### 日本語
|
|
72
|
+
|
|
73
|
+
レンダーキューは、Next2D Playerのレンダリングパイプラインにおいて中心的な役割を果たします:
|
|
74
|
+
|
|
75
|
+
1. **データ収集フェーズ**: DisplayObjectsのツリー構造を走査し、各オブジェクトの描画に必要なデータ(座標、色、変換行列など)をFloat32Arrayバッファに収集します。
|
|
76
|
+
|
|
77
|
+
2. **バッチ処理**: 複数のDisplayObjectsからのデータを単一のバッファにまとめることで、GPUへの呼び出し回数を削減し、レンダリングパフォーマンスを大幅に向上させます。
|
|
78
|
+
|
|
79
|
+
3. **GPU転送**: 収集されたデータはWebGL/WebGPUのバッファオブジェクトに転送され、シェーダープログラムで処理されます。
|
|
80
|
+
|
|
81
|
+
4. **動的メモリ管理**: 描画データ量に応じて自動的にバッファサイズを調整し、メモリ効率を最適化します。バッファは常に2の累乗サイズで管理されるため、GPUでの処理効率が向上します。
|
|
82
|
+
|
|
83
|
+
### English
|
|
84
|
+
|
|
85
|
+
The render queue plays a central role in the Next2D Player rendering pipeline:
|
|
86
|
+
|
|
87
|
+
1. **Data Collection Phase**: Traverses the DisplayObjects tree structure and collects data required for rendering each object (coordinates, colors, transformation matrices, etc.) into the Float32Array buffer.
|
|
88
|
+
|
|
89
|
+
2. **Batch Processing**: Combines data from multiple DisplayObjects into a single buffer, reducing GPU call count and significantly improving rendering performance.
|
|
90
|
+
|
|
91
|
+
3. **GPU Transfer**: Collected data is transferred to WebGL/WebGPU buffer objects and processed by shader programs.
|
|
92
|
+
|
|
93
|
+
4. **Dynamic Memory Management**: Automatically adjusts buffer size according to rendering data volume, optimizing memory efficiency. Buffers are always managed in power-of-two sizes, improving GPU processing efficiency.
|
|
94
|
+
|
|
95
|
+
## アーキテクチャ図 / Architecture Diagram
|
|
96
|
+
|
|
97
|
+
```mermaid
|
|
98
|
+
graph TB
|
|
99
|
+
subgraph "DisplayObject Layer"
|
|
100
|
+
DO1[DisplayObject 1]
|
|
101
|
+
DO2[DisplayObject 2]
|
|
102
|
+
DO3[DisplayObject 3]
|
|
103
|
+
DON[DisplayObject N]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
subgraph "Render Queue Layer"
|
|
107
|
+
RQ[RenderQueue Instance]
|
|
108
|
+
Buffer[Float32Array Buffer]
|
|
109
|
+
Push[push method]
|
|
110
|
+
Set[set method]
|
|
111
|
+
Resize[resize method]
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
subgraph "GPU Layer"
|
|
115
|
+
WebGL[WebGL Buffer]
|
|
116
|
+
WebGPU[WebGPU Buffer]
|
|
117
|
+
Shader[Shader Programs]
|
|
118
|
+
GPU[GPU Rendering]
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
DO1 -->|Transform Data| Push
|
|
122
|
+
DO2 -->|Color Data| Push
|
|
123
|
+
DO3 -->|Vertex Data| Set
|
|
124
|
+
DON -->|Texture Coords| Set
|
|
125
|
+
|
|
126
|
+
Push --> Buffer
|
|
127
|
+
Set --> Buffer
|
|
128
|
+
Buffer -.->|Capacity Check| Resize
|
|
129
|
+
Resize -.->|Expand to Power of 2| Buffer
|
|
130
|
+
|
|
131
|
+
Buffer -->|Batch Transfer| WebGL
|
|
132
|
+
Buffer -->|Batch Transfer| WebGPU
|
|
133
|
+
WebGL --> Shader
|
|
134
|
+
WebGPU --> Shader
|
|
135
|
+
Shader --> GPU
|
|
136
|
+
|
|
137
|
+
style RQ fill:#e1f5ff
|
|
138
|
+
style Buffer fill:#fff4e1
|
|
139
|
+
style GPU fill:#ffe1e1
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### フロー説明 / Flow Description
|
|
143
|
+
|
|
144
|
+
**日本語:**
|
|
145
|
+
|
|
146
|
+
1. **データ追加**: 各DisplayObjectは、レンダリングに必要なデータ(変換行列、色、頂点座標、テクスチャ座標など)を`push()`または`set()`メソッドを通じてバッファに追加します。
|
|
147
|
+
|
|
148
|
+
2. **容量チェック**: データ追加時、バッファ容量が不足している場合、`resize()`メソッドが自動的に呼び出され、2の累乗サイズにバッファが拡張されます。
|
|
149
|
+
|
|
150
|
+
3. **バッチ転送**: フレームの描画準備が完了すると、蓄積されたバッファデータがWebGL/WebGPUのバッファオブジェクトに一括転送されます。
|
|
151
|
+
|
|
152
|
+
4. **GPU処理**: 転送されたデータはシェーダープログラムで処理され、最終的にGPUでレンダリングされます。
|
|
153
|
+
|
|
154
|
+
**English:**
|
|
155
|
+
|
|
156
|
+
1. **Data Addition**: Each DisplayObject adds rendering data (transformation matrices, colors, vertex coordinates, texture coordinates, etc.) to the buffer via `push()` or `set()` methods.
|
|
157
|
+
|
|
158
|
+
2. **Capacity Check**: When adding data, if buffer capacity is insufficient, the `resize()` method is automatically called to expand the buffer to a power-of-two size.
|
|
159
|
+
|
|
160
|
+
3. **Batch Transfer**: Once frame rendering preparation is complete, accumulated buffer data is batch-transferred to WebGL/WebGPU buffer objects.
|
|
161
|
+
|
|
162
|
+
4. **GPU Processing**: Transferred data is processed by shader programs and finally rendered by the GPU.
|
|
163
|
+
|
|
164
|
+
## 使用例 / Usage Example
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { renderQueue } from "@next2d/render-queue";
|
|
168
|
+
|
|
169
|
+
// 個別の数値を追加 / Add individual numbers
|
|
170
|
+
renderQueue.push(1.0, 0.0, 0.0, 1.0); // 変換行列 / Transformation matrix
|
|
171
|
+
renderQueue.push(255, 128, 64, 255); // RGBA色 / RGBA color
|
|
172
|
+
|
|
173
|
+
// 配列をセット / Set array
|
|
174
|
+
const vertices = new Float32Array([
|
|
175
|
+
0.0, 0.0, // 頂点1 / Vertex 1
|
|
176
|
+
1.0, 0.0, // 頂点2 / Vertex 2
|
|
177
|
+
1.0, 1.0, // 頂点3 / Vertex 3
|
|
178
|
+
0.0, 1.0 // 頂点4 / Vertex 4
|
|
179
|
+
]);
|
|
180
|
+
renderQueue.set(vertices);
|
|
181
|
+
|
|
182
|
+
// バッファデータを取得 / Get buffer data
|
|
183
|
+
const buffer = renderQueue.buffer;
|
|
184
|
+
const offset = renderQueue.offset;
|
|
185
|
+
|
|
186
|
+
// フレーム終了後にリセット / Reset after frame
|
|
187
|
+
renderQueue.offset = 0;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## パフォーマンス最適化 / Performance Optimization
|
|
191
|
+
|
|
192
|
+
### 日本語
|
|
193
|
+
|
|
194
|
+
1. **2の累乗リサイズ**: バッファサイズは常に2の累乗(256, 512, 1024, ...)で管理され、メモリアライメントとGPU効率が最適化されます。
|
|
195
|
+
|
|
196
|
+
2. **Float32Array使用**: JavaScriptの通常の配列ではなく、型付き配列を使用することで、メモリフットプリントを削減し、GPU転送を高速化します。
|
|
197
|
+
|
|
198
|
+
3. **シングルトンパターン**: グローバルな`renderQueue`インスタンスを使用することで、インスタンス生成のオーバーヘッドを排除します。
|
|
199
|
+
|
|
200
|
+
4. **バッチ処理**: 個別のGPU呼び出しを削減し、ドローコールを最小化することでレンダリング性能を向上させます。
|
|
201
|
+
|
|
202
|
+
### English
|
|
203
|
+
|
|
204
|
+
1. **Power-of-Two Resizing**: Buffer sizes are always managed as powers of two (256, 512, 1024, ...), optimizing memory alignment and GPU efficiency.
|
|
205
|
+
|
|
206
|
+
2. **Float32Array Usage**: Uses typed arrays instead of regular JavaScript arrays, reducing memory footprint and accelerating GPU transfer.
|
|
207
|
+
|
|
208
|
+
3. **Singleton Pattern**: Uses a global `renderQueue` instance, eliminating instance creation overhead.
|
|
209
|
+
|
|
210
|
+
4. **Batch Processing**: Improves rendering performance by reducing individual GPU calls and minimizing draw calls.
|
|
211
|
+
|
|
212
|
+
## API リファレンス / API Reference
|
|
213
|
+
|
|
214
|
+
### RenderQueue Class
|
|
215
|
+
|
|
216
|
+
#### Properties
|
|
217
|
+
|
|
218
|
+
| Property | Type | Description (日本語) | Description (English) |
|
|
219
|
+
|----------|------|---------------------|----------------------|
|
|
220
|
+
| `buffer` | `Float32Array` | レンダリングデータを格納するバッファ | Buffer storing rendering data |
|
|
221
|
+
| `offset` | `number` | バッファ内の現在の書き込み位置 | Current write position in buffer |
|
|
222
|
+
|
|
223
|
+
#### Methods
|
|
224
|
+
|
|
225
|
+
##### `push(...args: number[]): void`
|
|
226
|
+
|
|
227
|
+
**日本語:** 可変長引数として渡された数値をバッファに追加します。必要に応じて自動的にバッファをリサイズします。
|
|
228
|
+
|
|
229
|
+
**English:** Adds numbers passed as variadic arguments to the buffer. Automatically resizes buffer if necessary.
|
|
230
|
+
|
|
231
|
+
**Parameters:**
|
|
232
|
+
- `...args: number[]` - 追加する数値 / Numbers to add
|
|
233
|
+
|
|
234
|
+
##### `set(array: Float32Array | Uint8Array): void`
|
|
235
|
+
|
|
236
|
+
**日本語:** 型付き配列をバッファにセットします。大量のデータを一度に追加する際に`push()`より効率的です。
|
|
237
|
+
|
|
238
|
+
**English:** Sets typed array to buffer. More efficient than `push()` when adding large amounts of data at once.
|
|
239
|
+
|
|
240
|
+
**Parameters:**
|
|
241
|
+
- `array: Float32Array | Uint8Array` - セットする配列 / Array to set
|
|
242
|
+
|
|
243
|
+
##### `resize(length: number): void`
|
|
244
|
+
|
|
245
|
+
**日本語:** バッファを指定された長さに対応できるよう、2の累乗サイズにリサイズします。既存のデータは保持されます。
|
|
246
|
+
|
|
247
|
+
**English:** Resizes buffer to power-of-two size to accommodate specified length. Existing data is preserved.
|
|
248
|
+
|
|
249
|
+
**Parameters:**
|
|
250
|
+
- `length: number` - 必要な追加容量 / Required additional capacity
|
|
251
|
+
|
|
252
|
+
### Utility Functions
|
|
253
|
+
|
|
254
|
+
#### `$upperPowerOfTwo(v: number): number`
|
|
255
|
+
|
|
256
|
+
**日本語:** 指定された値を2の累乗に切り上げます。バッファサイズの最適化に使用されます。
|
|
257
|
+
|
|
258
|
+
**English:** Rounds up specified value to power of two. Used for buffer size optimization.
|
|
259
|
+
|
|
260
|
+
**Parameters:**
|
|
261
|
+
- `v: number` - 入力値 / Input value
|
|
262
|
+
|
|
263
|
+
**Returns:**
|
|
264
|
+
- `number` - 2の累乗に切り上げられた値 / Value rounded up to power of two
|
|
265
|
+
|
|
266
|
+
**Example:**
|
|
267
|
+
```typescript
|
|
268
|
+
$upperPowerOfTwo(100); // 128
|
|
269
|
+
$upperPowerOfTwo(256); // 256
|
|
270
|
+
$upperPowerOfTwo(300); // 512
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## ライセンス / License
|
|
274
|
+
|
|
11
275
|
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - see the [LICENSE](LICENSE) file for details.
|
package/package.json
CHANGED
package/src/RenderQueue.d.ts
CHANGED
|
@@ -1,61 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description レンダーキューの管理クラス
|
|
3
|
-
* Management class of the render queue
|
|
4
|
-
*
|
|
5
|
-
* @class
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
1
|
declare class RenderQueue {
|
|
9
|
-
/**
|
|
10
|
-
* @description バッファ
|
|
11
|
-
* Buffer
|
|
12
|
-
*
|
|
13
|
-
* @type {Float32Array}
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
2
|
buffer: Float32Array;
|
|
17
|
-
/**
|
|
18
|
-
* @description オフセット
|
|
19
|
-
* Offset
|
|
20
|
-
*
|
|
21
|
-
* @type {number}
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
3
|
offset: number;
|
|
25
|
-
/**
|
|
26
|
-
* @constructor
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
4
|
constructor();
|
|
30
|
-
/**
|
|
31
|
-
* @description バッファにデータを追加
|
|
32
|
-
* Add data to the buffer
|
|
33
|
-
*
|
|
34
|
-
* @param {...number} args
|
|
35
|
-
* @return {void}
|
|
36
|
-
* @method
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
5
|
push(...args: number[]): void;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* @return {void}
|
|
46
|
-
* @method
|
|
47
|
-
* @public
|
|
48
|
-
*/
|
|
6
|
+
pushDisplayObjectBuffer(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number): void;
|
|
7
|
+
pushInstanceBuffer(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number): void;
|
|
8
|
+
pushShapeBuffer(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number): void;
|
|
9
|
+
pushTextFieldBuffer(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number): void;
|
|
10
|
+
pushVideoBuffer(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number): void;
|
|
49
11
|
set(array: Float32Array | Uint8Array): void;
|
|
50
|
-
/**
|
|
51
|
-
* @description バッファをリサイズ
|
|
52
|
-
* Resize the buffer
|
|
53
|
-
*
|
|
54
|
-
* @param {number} length
|
|
55
|
-
* @return {void}
|
|
56
|
-
* @method
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
12
|
resize(length: number): void;
|
|
60
13
|
}
|
|
61
14
|
export declare const renderQueue: RenderQueue;
|
package/src/RenderQueue.js
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
import { $upperPowerOfTwo } from "./RenderQueueUtil";
|
|
2
|
-
/**
|
|
3
|
-
* @description レンダーキューの管理クラス
|
|
4
|
-
* Management class of the render queue
|
|
5
|
-
*
|
|
6
|
-
* @class
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
2
|
class RenderQueue {
|
|
10
|
-
/**
|
|
11
|
-
* @constructor
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
3
|
constructor() {
|
|
15
|
-
/**
|
|
16
|
-
* @description バッファ
|
|
17
|
-
* Buffer
|
|
18
|
-
*
|
|
19
|
-
* @type {Float32Array}
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
4
|
Object.defineProperty(this, "buffer", {
|
|
23
5
|
enumerable: true,
|
|
24
6
|
configurable: true,
|
|
25
7
|
writable: true,
|
|
26
8
|
value: void 0
|
|
27
9
|
});
|
|
28
|
-
/**
|
|
29
|
-
* @description オフセット
|
|
30
|
-
* Offset
|
|
31
|
-
*
|
|
32
|
-
* @type {number}
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
10
|
Object.defineProperty(this, "offset", {
|
|
36
11
|
enumerable: true,
|
|
37
12
|
configurable: true,
|
|
@@ -41,15 +16,6 @@ class RenderQueue {
|
|
|
41
16
|
this.buffer = new Float32Array(256);
|
|
42
17
|
this.offset = 0;
|
|
43
18
|
}
|
|
44
|
-
/**
|
|
45
|
-
* @description バッファにデータを追加
|
|
46
|
-
* Add data to the buffer
|
|
47
|
-
*
|
|
48
|
-
* @param {...number} args
|
|
49
|
-
* @return {void}
|
|
50
|
-
* @method
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
19
|
push(...args) {
|
|
54
20
|
if (this.buffer.length < this.offset + args.length) {
|
|
55
21
|
this.resize(args.length);
|
|
@@ -58,15 +24,166 @@ class RenderQueue {
|
|
|
58
24
|
this.buffer[this.offset++] = args[idx];
|
|
59
25
|
}
|
|
60
26
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
27
|
+
pushDisplayObjectBuffer(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) {
|
|
28
|
+
if (this.buffer.length < this.offset + 22) {
|
|
29
|
+
this.resize(22);
|
|
30
|
+
}
|
|
31
|
+
this.buffer[this.offset++] = a;
|
|
32
|
+
this.buffer[this.offset++] = b;
|
|
33
|
+
this.buffer[this.offset++] = c;
|
|
34
|
+
this.buffer[this.offset++] = d;
|
|
35
|
+
this.buffer[this.offset++] = e;
|
|
36
|
+
this.buffer[this.offset++] = f;
|
|
37
|
+
this.buffer[this.offset++] = g;
|
|
38
|
+
this.buffer[this.offset++] = h;
|
|
39
|
+
this.buffer[this.offset++] = i;
|
|
40
|
+
this.buffer[this.offset++] = j;
|
|
41
|
+
this.buffer[this.offset++] = k;
|
|
42
|
+
this.buffer[this.offset++] = l;
|
|
43
|
+
this.buffer[this.offset++] = m;
|
|
44
|
+
this.buffer[this.offset++] = n;
|
|
45
|
+
this.buffer[this.offset++] = o;
|
|
46
|
+
this.buffer[this.offset++] = p;
|
|
47
|
+
this.buffer[this.offset++] = q;
|
|
48
|
+
this.buffer[this.offset++] = r;
|
|
49
|
+
this.buffer[this.offset++] = s;
|
|
50
|
+
this.buffer[this.offset++] = t;
|
|
51
|
+
this.buffer[this.offset++] = u;
|
|
52
|
+
this.buffer[this.offset++] = v;
|
|
53
|
+
}
|
|
54
|
+
pushInstanceBuffer(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) {
|
|
55
|
+
if (this.buffer.length < this.offset + 24) {
|
|
56
|
+
this.resize(24);
|
|
57
|
+
}
|
|
58
|
+
this.buffer[this.offset++] = a;
|
|
59
|
+
this.buffer[this.offset++] = b;
|
|
60
|
+
this.buffer[this.offset++] = c;
|
|
61
|
+
this.buffer[this.offset++] = d;
|
|
62
|
+
this.buffer[this.offset++] = e;
|
|
63
|
+
this.buffer[this.offset++] = f;
|
|
64
|
+
this.buffer[this.offset++] = g;
|
|
65
|
+
this.buffer[this.offset++] = h;
|
|
66
|
+
this.buffer[this.offset++] = i;
|
|
67
|
+
this.buffer[this.offset++] = j;
|
|
68
|
+
this.buffer[this.offset++] = k;
|
|
69
|
+
this.buffer[this.offset++] = l;
|
|
70
|
+
this.buffer[this.offset++] = m;
|
|
71
|
+
this.buffer[this.offset++] = n;
|
|
72
|
+
this.buffer[this.offset++] = o;
|
|
73
|
+
this.buffer[this.offset++] = p;
|
|
74
|
+
this.buffer[this.offset++] = q;
|
|
75
|
+
this.buffer[this.offset++] = r;
|
|
76
|
+
this.buffer[this.offset++] = s;
|
|
77
|
+
this.buffer[this.offset++] = t;
|
|
78
|
+
this.buffer[this.offset++] = u;
|
|
79
|
+
this.buffer[this.offset++] = v;
|
|
80
|
+
this.buffer[this.offset++] = w;
|
|
81
|
+
this.buffer[this.offset++] = x;
|
|
82
|
+
}
|
|
83
|
+
pushShapeBuffer(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a1, b1, c1, d1, e1, f1) {
|
|
84
|
+
if (this.buffer.length < this.offset + 32) {
|
|
85
|
+
this.resize(32);
|
|
86
|
+
}
|
|
87
|
+
this.buffer[this.offset++] = a;
|
|
88
|
+
this.buffer[this.offset++] = b;
|
|
89
|
+
this.buffer[this.offset++] = c;
|
|
90
|
+
this.buffer[this.offset++] = d;
|
|
91
|
+
this.buffer[this.offset++] = e;
|
|
92
|
+
this.buffer[this.offset++] = f;
|
|
93
|
+
this.buffer[this.offset++] = g;
|
|
94
|
+
this.buffer[this.offset++] = h;
|
|
95
|
+
this.buffer[this.offset++] = i;
|
|
96
|
+
this.buffer[this.offset++] = j;
|
|
97
|
+
this.buffer[this.offset++] = k;
|
|
98
|
+
this.buffer[this.offset++] = l;
|
|
99
|
+
this.buffer[this.offset++] = m;
|
|
100
|
+
this.buffer[this.offset++] = n;
|
|
101
|
+
this.buffer[this.offset++] = o;
|
|
102
|
+
this.buffer[this.offset++] = p;
|
|
103
|
+
this.buffer[this.offset++] = q;
|
|
104
|
+
this.buffer[this.offset++] = r;
|
|
105
|
+
this.buffer[this.offset++] = s;
|
|
106
|
+
this.buffer[this.offset++] = t;
|
|
107
|
+
this.buffer[this.offset++] = u;
|
|
108
|
+
this.buffer[this.offset++] = v;
|
|
109
|
+
this.buffer[this.offset++] = w;
|
|
110
|
+
this.buffer[this.offset++] = x;
|
|
111
|
+
this.buffer[this.offset++] = y;
|
|
112
|
+
this.buffer[this.offset++] = z;
|
|
113
|
+
this.buffer[this.offset++] = a1;
|
|
114
|
+
this.buffer[this.offset++] = b1;
|
|
115
|
+
this.buffer[this.offset++] = c1;
|
|
116
|
+
this.buffer[this.offset++] = d1;
|
|
117
|
+
this.buffer[this.offset++] = e1;
|
|
118
|
+
this.buffer[this.offset++] = f1;
|
|
119
|
+
}
|
|
120
|
+
pushTextFieldBuffer(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a1, b1, c1, d1) {
|
|
121
|
+
if (this.buffer.length < this.offset + 30) {
|
|
122
|
+
this.resize(30);
|
|
123
|
+
}
|
|
124
|
+
this.buffer[this.offset++] = a;
|
|
125
|
+
this.buffer[this.offset++] = b;
|
|
126
|
+
this.buffer[this.offset++] = c;
|
|
127
|
+
this.buffer[this.offset++] = d;
|
|
128
|
+
this.buffer[this.offset++] = e;
|
|
129
|
+
this.buffer[this.offset++] = f;
|
|
130
|
+
this.buffer[this.offset++] = g;
|
|
131
|
+
this.buffer[this.offset++] = h;
|
|
132
|
+
this.buffer[this.offset++] = i;
|
|
133
|
+
this.buffer[this.offset++] = j;
|
|
134
|
+
this.buffer[this.offset++] = k;
|
|
135
|
+
this.buffer[this.offset++] = l;
|
|
136
|
+
this.buffer[this.offset++] = m;
|
|
137
|
+
this.buffer[this.offset++] = n;
|
|
138
|
+
this.buffer[this.offset++] = o;
|
|
139
|
+
this.buffer[this.offset++] = p;
|
|
140
|
+
this.buffer[this.offset++] = q;
|
|
141
|
+
this.buffer[this.offset++] = r;
|
|
142
|
+
this.buffer[this.offset++] = s;
|
|
143
|
+
this.buffer[this.offset++] = t;
|
|
144
|
+
this.buffer[this.offset++] = u;
|
|
145
|
+
this.buffer[this.offset++] = v;
|
|
146
|
+
this.buffer[this.offset++] = w;
|
|
147
|
+
this.buffer[this.offset++] = x;
|
|
148
|
+
this.buffer[this.offset++] = y;
|
|
149
|
+
this.buffer[this.offset++] = z;
|
|
150
|
+
this.buffer[this.offset++] = a1;
|
|
151
|
+
this.buffer[this.offset++] = b1;
|
|
152
|
+
this.buffer[this.offset++] = c1;
|
|
153
|
+
this.buffer[this.offset++] = d1;
|
|
154
|
+
}
|
|
155
|
+
pushVideoBuffer(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a1) {
|
|
156
|
+
if (this.buffer.length < this.offset + 27) {
|
|
157
|
+
this.resize(27);
|
|
158
|
+
}
|
|
159
|
+
this.buffer[this.offset++] = a;
|
|
160
|
+
this.buffer[this.offset++] = b;
|
|
161
|
+
this.buffer[this.offset++] = c;
|
|
162
|
+
this.buffer[this.offset++] = d;
|
|
163
|
+
this.buffer[this.offset++] = e;
|
|
164
|
+
this.buffer[this.offset++] = f;
|
|
165
|
+
this.buffer[this.offset++] = g;
|
|
166
|
+
this.buffer[this.offset++] = h;
|
|
167
|
+
this.buffer[this.offset++] = i;
|
|
168
|
+
this.buffer[this.offset++] = j;
|
|
169
|
+
this.buffer[this.offset++] = k;
|
|
170
|
+
this.buffer[this.offset++] = l;
|
|
171
|
+
this.buffer[this.offset++] = m;
|
|
172
|
+
this.buffer[this.offset++] = n;
|
|
173
|
+
this.buffer[this.offset++] = o;
|
|
174
|
+
this.buffer[this.offset++] = p;
|
|
175
|
+
this.buffer[this.offset++] = q;
|
|
176
|
+
this.buffer[this.offset++] = r;
|
|
177
|
+
this.buffer[this.offset++] = s;
|
|
178
|
+
this.buffer[this.offset++] = t;
|
|
179
|
+
this.buffer[this.offset++] = u;
|
|
180
|
+
this.buffer[this.offset++] = v;
|
|
181
|
+
this.buffer[this.offset++] = w;
|
|
182
|
+
this.buffer[this.offset++] = x;
|
|
183
|
+
this.buffer[this.offset++] = y;
|
|
184
|
+
this.buffer[this.offset++] = z;
|
|
185
|
+
this.buffer[this.offset++] = a1;
|
|
186
|
+
}
|
|
70
187
|
set(array) {
|
|
71
188
|
if (this.buffer.length < this.offset + array.length) {
|
|
72
189
|
this.resize(array.length);
|
|
@@ -74,15 +191,6 @@ class RenderQueue {
|
|
|
74
191
|
this.buffer.set(array, this.offset);
|
|
75
192
|
this.offset += array.length;
|
|
76
193
|
}
|
|
77
|
-
/**
|
|
78
|
-
* @description バッファをリサイズ
|
|
79
|
-
* Resize the buffer
|
|
80
|
-
*
|
|
81
|
-
* @param {number} length
|
|
82
|
-
* @return {void}
|
|
83
|
-
* @method
|
|
84
|
-
* @public
|
|
85
|
-
*/
|
|
86
194
|
resize(length) {
|
|
87
195
|
const newBuffer = new Float32Array($upperPowerOfTwo(this.offset + length));
|
|
88
196
|
if (this.buffer.length) {
|