untitled-pixi-live2d-engine 1.1.0 → 1.2.1
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 +99 -90
- package/dist/cubism-legacy.es.js +27 -116
- package/dist/cubism-legacy.js +26 -115
- package/dist/cubism-legacy.min.js +1 -1
- package/dist/cubism.es.js +38 -130
- package/dist/cubism.js +37 -129
- package/dist/cubism.min.js +1 -1
- package/dist/index.es.js +38 -130
- package/dist/index.js +37 -129
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +30 -22
package/README.md
CHANGED
|
@@ -2,47 +2,84 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
|
+

|
|
6
|
+

|
|
5
7
|
|
|
6
8
|
**English (Current)** | [**简体中文**](README-ZH.md) | [**日本語**](README-JA.md)
|
|
7
9
|
|
|
8
|
-
A Live2D rendering
|
|
10
|
+
A Live2D rendering engine for **[PixiJS v8](https://pixijs.com/)**, supporting **Cubism 2 / 3 / 4 / 5** models.
|
|
9
11
|
|
|
10
|
-
This project
|
|
11
|
-
Compared to the official Live2D SDK, this library significantly reduces usage complexity while preserving full functionality, with additional optimizations for stability and long-term maintainability.
|
|
12
|
+
This project is a major refactor of [pixi-live2d-display-mulmotion](https://github.com/Sekai-World/pixi-live2d-display), adapted for PixiJS v8 and Cubism 5 SDK with improvements to API design, rendering pipeline, and type safety.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
It is **fully compatible with PixiJS v8 and Live2D Cubism 5.4 SDK**, and further provides:
|
|
14
|
+
## Key Features
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- Stronger TypeScript type safety
|
|
18
|
-
- Optimized internal architecture for extensibility and maintainability
|
|
16
|
+
### Native PixiJS v8 Rendering
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
Registers a custom **Render Pipe** with `extensions.add(Live2DPlugin)` to integrate with the PixiJS v8 rendering architecture:
|
|
21
19
|
|
|
22
|
-
- Supports
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- `position`
|
|
26
|
-
- `scale`
|
|
27
|
-
- `rotation`
|
|
28
|
-
- `skew`
|
|
29
|
-
- `anchor`
|
|
20
|
+
- Supports `Filter` and `RenderTexture`
|
|
21
|
+
- Participates in **zIndex sorting** and **blend modes**
|
|
22
|
+
- Inherits renderer resolution — filters won't blur due to downsampling
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
- Mouse tracking
|
|
33
|
-
- Hit area detection
|
|
24
|
+
### Cubism 2–5 Support
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
Works with both **Cubism 2.1 (Legacy)** and **Cubism 5 (Modern)**, with separate bundle entries to import the corresponding runtime as needed.
|
|
27
|
+
|
|
28
|
+
### Texture LOD
|
|
29
|
+
|
|
30
|
+
For large texture atlases (4096px+), three LOD strategies are available:
|
|
31
|
+
|
|
32
|
+
- **`full`** (default): generates a full mipmap chain
|
|
33
|
+
- **`single-auto`**: generates a lower-resolution texture on demand based on the model's actual screen size, reducing VRAM usage
|
|
34
|
+
- **`false`**: uses the original texture only
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const model = await Live2DModel.from('model.json', {
|
|
38
|
+
textureOptions: { lod: 'single-auto' }
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Automatic High-Precision Mask Detection
|
|
43
|
+
|
|
44
|
+
Complex models (many masked drawables, high vertex density, etc.) can produce visual artifacts when mask precision is insufficient. The engine automatically analyzes the model structure and enables high-precision masks when needed. This is enabled by default and can also be controlled manually.
|
|
45
|
+
|
|
46
|
+
### Parallel Motions & Last-Frame Freeze
|
|
47
|
+
|
|
48
|
+
- **Parallel playback**: drive multiple motion groups simultaneously, useful for independent upper/lower body animations
|
|
49
|
+
- **Last-frame freeze**: hold a motion on its final frame, useful for pose switching or static illustrations
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// Parallel playback
|
|
53
|
+
model.parallelMotion([
|
|
54
|
+
{ group: 'upper_body', index: 0 },
|
|
55
|
+
{ group: 'lower_body', index: 1 }
|
|
56
|
+
])
|
|
57
|
+
|
|
58
|
+
// Last-frame freeze
|
|
59
|
+
await model.parallelLastFrame([
|
|
60
|
+
{ group: 'arm', index: 0 },
|
|
61
|
+
{ group: 'expression', index: 2 }
|
|
62
|
+
])
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Feature List
|
|
66
|
+
|
|
67
|
+
- **Cubism 2 / 3 / 4 / 5** model support
|
|
68
|
+
- Native PixiJS v8 rendering pipeline (Filter / RenderTexture / Render Pipe)
|
|
69
|
+
- Texture LOD and automatic high-precision mask detection
|
|
70
|
+
- Parallel motion playback / last-frame freeze
|
|
71
|
+
- Real-time lip sync
|
|
72
|
+
- PixiJS-style transforms: `position` / `scale` / `rotation` / `skew` / `anchor`
|
|
73
|
+
- Mouse tracking / hit area detection
|
|
74
|
+
- Improved motion reservation and priority scheduling
|
|
75
|
+
- Strict TypeScript type definitions
|
|
76
|
+
- Configurable Cubism work memory size
|
|
40
77
|
|
|
41
78
|
## Requirements
|
|
42
79
|
|
|
43
80
|
- **PixiJS**: `8.x`
|
|
44
81
|
- **Cubism runtime**: `2.1` or `5`
|
|
45
|
-
- **Browser**:
|
|
82
|
+
- **Browser**: must support `WebGL` and `ES6`
|
|
46
83
|
|
|
47
84
|
## Installation
|
|
48
85
|
|
|
@@ -55,7 +92,7 @@ npm install untitled-pixi-live2d-engine
|
|
|
55
92
|
```
|
|
56
93
|
|
|
57
94
|
```ts
|
|
58
|
-
import { Live2DModel } from 'untitled-pixi-live2d-engine'
|
|
95
|
+
import { Live2DModel, Live2DPlugin } from 'untitled-pixi-live2d-engine'
|
|
59
96
|
|
|
60
97
|
// Cubism Legacy only (Cubism 2.1)
|
|
61
98
|
import { Live2DModel } from 'untitled-pixi-live2d-engine/cubism-legacy'
|
|
@@ -64,73 +101,44 @@ import { Live2DModel } from 'untitled-pixi-live2d-engine/cubism-legacy'
|
|
|
64
101
|
import { Live2DModel } from 'untitled-pixi-live2d-engine/cubism'
|
|
65
102
|
```
|
|
66
103
|
|
|
67
|
-
###
|
|
104
|
+
### Via HTML
|
|
68
105
|
|
|
69
106
|
```html
|
|
70
107
|
<script src="https://cdn.jsdelivr.net/npm/untitled-pixi-live2d-engine/dist/index.min.js"></script>
|
|
71
108
|
```
|
|
72
109
|
|
|
73
|
-
## Cubism Runtime
|
|
110
|
+
## Cubism Runtime
|
|
74
111
|
|
|
75
|
-
|
|
112
|
+
Live2D models are split into two categories by Cubism architecture, each requiring a different external runtime:
|
|
76
113
|
|
|
77
|
-
|
|
78
|
-
|
|
114
|
+
| Category | Model Version | External Runtime | Bundle Entry |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| **Cubism Legacy** | Cubism 2.1 | `live2d.min.js` | `cubism-legacy.js` |
|
|
117
|
+
| **Cubism Modern** | Cubism 3 / 4 / 5 | `live2dcubismcore.min.js` | `cubism.js` |
|
|
118
|
+
| **Both** | — | Both of the above | `index.js` |
|
|
79
119
|
|
|
80
|
-
|
|
120
|
+
### Obtaining the External Runtime
|
|
81
121
|
|
|
82
|
-
|
|
122
|
+
**Cubism Legacy** — `live2d.min.js`
|
|
83
123
|
|
|
84
|
-
|
|
124
|
+
Official distribution was discontinued on [September 4, 2019](https://help.live2d.com/en/other/other_20/). Available from:
|
|
125
|
+
- [GitHub](https://github.com/dylanNew/live2d/tree/master/webgl/Live2D/lib)
|
|
126
|
+
- [jsDelivr CDN](https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js)
|
|
85
127
|
|
|
86
|
-
|
|
87
|
-
index.js
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
> Use this unified entry when your project needs to load both Cubism 2 and Cubism 3+ models.
|
|
91
|
-
|
|
92
|
-
### Cubism Legacy Only (Cubism 2.1)
|
|
93
|
-
|
|
94
|
-
#### Prerequisites
|
|
95
|
-
|
|
96
|
-
You must manually include `live2d.min.js`:
|
|
97
|
-
|
|
98
|
-
- Official distribution was discontinued on
|
|
99
|
-
[September 4, 2019](https://help.live2d.com/en/other/other_20/)
|
|
100
|
-
- Available from:
|
|
101
|
-
- GitHub:
|
|
102
|
-
[https://github.com/dylanNew/live2d/tree/master/webgl/Live2D/lib](https://github.com/dylanNew/live2d/tree/master/webgl/Live2D/lib)
|
|
103
|
-
- jsDelivr CDN:
|
|
104
|
-
[https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js](https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js)
|
|
105
|
-
|
|
106
|
-
#### Bundle entry
|
|
107
|
-
|
|
108
|
-
```text
|
|
109
|
-
cubism-legacy.js
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Cubism Modern Only (Cubism 3 / 4 / 5)
|
|
113
|
-
|
|
114
|
-
#### Prerequisites
|
|
128
|
+
**Cubism Modern** — `live2dcubismcore.min.js`
|
|
115
129
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- Downloadable from the official **Cubism 5 SDK**
|
|
119
|
-
[https://www.live2d.com/download/cubism-sdk/download-web/](https://www.live2d.com/download/cubism-sdk/download-web/)
|
|
120
|
-
|
|
121
|
-
#### Bundle entry
|
|
122
|
-
|
|
123
|
-
```text
|
|
124
|
-
cubism.js
|
|
125
|
-
```
|
|
130
|
+
Download from the official [Cubism 5 SDK for Web](https://www.live2d.com/download/cubism-sdk/download-web/).
|
|
126
131
|
|
|
127
132
|
## Quick Start
|
|
128
133
|
|
|
129
|
-
The following example
|
|
134
|
+
The following example uses PixiJS v8 and supports both Cubism Legacy and Cubism Modern.
|
|
130
135
|
|
|
131
136
|
```ts
|
|
132
|
-
import { Application } from 'pixi.js'
|
|
133
|
-
import { configureCubismSDK, Live2DModel } from 'untitled-pixi-live2d-engine'
|
|
137
|
+
import { Application, extensions } from 'pixi.js'
|
|
138
|
+
import { configureCubismSDK, Live2DModel, Live2DPlugin } from 'untitled-pixi-live2d-engine'
|
|
139
|
+
|
|
140
|
+
// Register the Live2D render pipe before creating the Pixi renderer
|
|
141
|
+
extensions.add(Live2DPlugin)
|
|
134
142
|
|
|
135
143
|
const app = new Application()
|
|
136
144
|
await app.init({
|
|
@@ -142,11 +150,9 @@ await app.init({
|
|
|
142
150
|
|
|
143
151
|
document.body.appendChild(app.canvas)
|
|
144
152
|
|
|
145
|
-
// Configure Cubism Modern work memory (optional, default
|
|
146
|
-
// Increase
|
|
147
|
-
// configureCubismSDK({
|
|
148
|
-
// memorySizeMB: 32
|
|
149
|
-
// })
|
|
153
|
+
// Configure Cubism Modern work memory (optional, default 16MB)
|
|
154
|
+
// Increase when loading multiple or complex models
|
|
155
|
+
// configureCubismSDK({ memorySizeMB: 32 })
|
|
150
156
|
|
|
151
157
|
const model = await Live2DModel.from('model/model3.json')
|
|
152
158
|
model.anchor.set(0.5)
|
|
@@ -155,7 +161,7 @@ model.position.set(app.screen.width / 2, app.screen.height / 2)
|
|
|
155
161
|
app.stage.addChild(model)
|
|
156
162
|
```
|
|
157
163
|
|
|
158
|
-
##
|
|
164
|
+
## API Examples
|
|
159
165
|
|
|
160
166
|
### Play a Motion
|
|
161
167
|
|
|
@@ -172,7 +178,7 @@ model.parallelMotion([
|
|
|
172
178
|
])
|
|
173
179
|
```
|
|
174
180
|
|
|
175
|
-
###
|
|
181
|
+
### Last-Frame Freeze
|
|
176
182
|
|
|
177
183
|
**Single motion:**
|
|
178
184
|
|
|
@@ -201,13 +207,16 @@ model.speak('audio_file_url')
|
|
|
201
207
|
model.expression('id')
|
|
202
208
|
```
|
|
203
209
|
|
|
204
|
-
For more advanced usage, see
|
|
205
|
-
[pixi-live2d-display-lipsync](https://github.com/RaSan147/pixi-live2d-display)
|
|
206
|
-
|
|
207
210
|
## FAQ
|
|
208
211
|
|
|
209
|
-
### Q:
|
|
212
|
+
### Q: Models stop updating after loading multiple models?
|
|
213
|
+
|
|
214
|
+
When using the Cubism Modern runtime, this is usually caused by insufficient work memory. Increase `memorySizeMB` during initialization (minimum 16MB):
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
configureCubismSDK({ memorySizeMB: 32 })
|
|
218
|
+
```
|
|
210
219
|
|
|
211
|
-
|
|
220
|
+
## License
|
|
212
221
|
|
|
213
|
-
|
|
222
|
+
[MIT](LICENSE)
|
package/dist/cubism-legacy.es.js
CHANGED
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
-
import { EventEmitter, Matrix, loadTextures, Assets, Ticker, Transform, Point, Bounds, Container, ObservablePoint, WebGLRenderer, DOMAdapter, Texture, CanvasSource } from "pixi.js";
|
|
42
|
+
import { EventEmitter, Matrix, loadTextures, Assets, Ticker, Transform, Point, Bounds, ExtensionType, Container, ObservablePoint, WebGLRenderer, DOMAdapter, Texture, CanvasSource } from "pixi.js";
|
|
43
43
|
import { sound, Sound, webaudio } from "@pixi/sound";
|
|
44
44
|
const LOGICAL_WIDTH = 2;
|
|
45
45
|
const LOGICAL_HEIGHT = 2;
|
|
@@ -106,7 +106,7 @@ const config = {
|
|
|
106
106
|
preserveExpressionOnMotion: true,
|
|
107
107
|
cubism: CubismFrameworkConfig
|
|
108
108
|
};
|
|
109
|
-
const VERSION = "1.1
|
|
109
|
+
const VERSION = "1.2.1";
|
|
110
110
|
const logger = {
|
|
111
111
|
log(tag, ...messages) {
|
|
112
112
|
if (config.logLevel <= config.LOG_LEVEL_VERBOSE) {
|
|
@@ -2177,114 +2177,6 @@ const createInternalModel = (context, next) => __async(null, null, function* ()
|
|
|
2177
2177
|
}
|
|
2178
2178
|
throw new TypeError("Missing settings.");
|
|
2179
2179
|
});
|
|
2180
|
-
const _ZipLoader = class _ZipLoader {
|
|
2181
|
-
static unzip(reader, settings) {
|
|
2182
|
-
return __async(this, null, function* () {
|
|
2183
|
-
const filePaths = yield _ZipLoader.getFilePaths(reader);
|
|
2184
|
-
const requiredFilePaths = [];
|
|
2185
|
-
for (const definedFile of settings.getDefinedFiles()) {
|
|
2186
|
-
const actualPath = decodeURI(resolveURL(settings.url, definedFile));
|
|
2187
|
-
if (filePaths.includes(actualPath)) {
|
|
2188
|
-
requiredFilePaths.push(actualPath);
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
const files = yield _ZipLoader.getFiles(reader, requiredFilePaths);
|
|
2192
|
-
for (let i = 0; i < files.length; i++) {
|
|
2193
|
-
const path = requiredFilePaths[i];
|
|
2194
|
-
const file = files[i];
|
|
2195
|
-
Object.defineProperty(file, "webkitRelativePath", {
|
|
2196
|
-
value: path
|
|
2197
|
-
});
|
|
2198
|
-
}
|
|
2199
|
-
return files;
|
|
2200
|
-
});
|
|
2201
|
-
}
|
|
2202
|
-
static createSettings(reader) {
|
|
2203
|
-
return __async(this, null, function* () {
|
|
2204
|
-
const filePaths = yield _ZipLoader.getFilePaths(reader);
|
|
2205
|
-
const settingsFilePath = filePaths.find(
|
|
2206
|
-
(path) => path.endsWith("model.json") || path.endsWith("model3.json")
|
|
2207
|
-
);
|
|
2208
|
-
if (!settingsFilePath) {
|
|
2209
|
-
throw new Error("Settings file not found");
|
|
2210
|
-
}
|
|
2211
|
-
const settingsText = yield _ZipLoader.readText(reader, settingsFilePath);
|
|
2212
|
-
if (!settingsText) {
|
|
2213
|
-
throw new Error("Empty settings file: " + settingsFilePath);
|
|
2214
|
-
}
|
|
2215
|
-
const settingsJSON = JSON.parse(settingsText);
|
|
2216
|
-
settingsJSON.url = settingsFilePath;
|
|
2217
|
-
const runtime = _ZipLoader.live2dFactory.findRuntime(settingsJSON);
|
|
2218
|
-
if (!runtime) {
|
|
2219
|
-
throw new Error("Unknown settings JSON");
|
|
2220
|
-
}
|
|
2221
|
-
return runtime.createModelSettings(settingsJSON);
|
|
2222
|
-
});
|
|
2223
|
-
}
|
|
2224
|
-
static zipReader(data, url) {
|
|
2225
|
-
return Promise.reject(new Error("Not implemented"));
|
|
2226
|
-
}
|
|
2227
|
-
static getFilePaths(reader) {
|
|
2228
|
-
return Promise.reject(new Error("Not implemented"));
|
|
2229
|
-
}
|
|
2230
|
-
static getFiles(reader, paths) {
|
|
2231
|
-
return Promise.reject(new Error("Not implemented"));
|
|
2232
|
-
}
|
|
2233
|
-
static readText(reader, path) {
|
|
2234
|
-
return Promise.reject(new Error("Not implemented"));
|
|
2235
|
-
}
|
|
2236
|
-
static releaseReader(reader) {
|
|
2237
|
-
}
|
|
2238
|
-
};
|
|
2239
|
-
// will be set by Live2DFactory
|
|
2240
|
-
__publicField(_ZipLoader, "live2dFactory");
|
|
2241
|
-
__publicField(_ZipLoader, "ZIP_PROTOCOL", "zip://");
|
|
2242
|
-
__publicField(_ZipLoader, "uid", 0);
|
|
2243
|
-
__publicField(_ZipLoader, "factory", (context, next) => __async(null, null, function* () {
|
|
2244
|
-
const source = context.source;
|
|
2245
|
-
let sourceURL;
|
|
2246
|
-
let zipBlob;
|
|
2247
|
-
let settings;
|
|
2248
|
-
if (typeof source === "string" && (source.endsWith(".zip") || source.startsWith(_ZipLoader.ZIP_PROTOCOL))) {
|
|
2249
|
-
if (source.startsWith(_ZipLoader.ZIP_PROTOCOL)) {
|
|
2250
|
-
sourceURL = source.slice(_ZipLoader.ZIP_PROTOCOL.length);
|
|
2251
|
-
} else {
|
|
2252
|
-
sourceURL = source;
|
|
2253
|
-
}
|
|
2254
|
-
zipBlob = yield Live2DLoader.load({
|
|
2255
|
-
url: sourceURL,
|
|
2256
|
-
type: "blob",
|
|
2257
|
-
target: context.live2dModel
|
|
2258
|
-
});
|
|
2259
|
-
} else if (Array.isArray(source) && source.length === 1 && source[0] instanceof File && source[0].name.endsWith(".zip")) {
|
|
2260
|
-
zipBlob = source[0];
|
|
2261
|
-
sourceURL = URL.createObjectURL(zipBlob);
|
|
2262
|
-
settings = source.settings;
|
|
2263
|
-
}
|
|
2264
|
-
if (zipBlob) {
|
|
2265
|
-
if (!zipBlob.size) {
|
|
2266
|
-
throw new Error("Empty zip file");
|
|
2267
|
-
}
|
|
2268
|
-
const reader = yield _ZipLoader.zipReader(zipBlob, sourceURL);
|
|
2269
|
-
if (!settings) {
|
|
2270
|
-
settings = yield _ZipLoader.createSettings(reader);
|
|
2271
|
-
}
|
|
2272
|
-
settings._objectURL = _ZipLoader.ZIP_PROTOCOL + _ZipLoader.uid + "/" + settings.url;
|
|
2273
|
-
const files = yield _ZipLoader.unzip(reader, settings);
|
|
2274
|
-
files.settings = settings;
|
|
2275
|
-
context.source = files;
|
|
2276
|
-
if (sourceURL.startsWith("blob:")) {
|
|
2277
|
-
context.live2dModel.once("modelLoaded", (internalModel) => {
|
|
2278
|
-
internalModel.once("destroy", function() {
|
|
2279
|
-
URL.revokeObjectURL(sourceURL);
|
|
2280
|
-
});
|
|
2281
|
-
});
|
|
2282
|
-
}
|
|
2283
|
-
_ZipLoader.releaseReader(reader);
|
|
2284
|
-
}
|
|
2285
|
-
return next();
|
|
2286
|
-
}));
|
|
2287
|
-
let ZipLoader = _ZipLoader;
|
|
2288
2180
|
const _FileLoader = class _FileLoader {
|
|
2289
2181
|
/**
|
|
2290
2182
|
* Resolves the path of a resource file to the object URL.
|
|
@@ -2565,7 +2457,6 @@ __publicField(_Live2DFactory, "createInternalModel", createInternalModel);
|
|
|
2565
2457
|
* Middlewares to run through when setting up a Live2DModel.
|
|
2566
2458
|
*/
|
|
2567
2459
|
__publicField(_Live2DFactory, "live2DModelMiddlewares", [
|
|
2568
|
-
ZipLoader.factory,
|
|
2569
2460
|
FileLoader.factory,
|
|
2570
2461
|
urlToJSON,
|
|
2571
2462
|
jsonToSettings,
|
|
@@ -2591,7 +2482,6 @@ ExpressionManager.prototype["_loadExpression"] = function(index) {
|
|
|
2591
2482
|
return Live2DFactory.loadExpression(this, index);
|
|
2592
2483
|
};
|
|
2593
2484
|
FileLoader["live2dFactory"] = Live2DFactory;
|
|
2594
|
-
ZipLoader["live2dFactory"] = Live2DFactory;
|
|
2595
2485
|
const _Automator = class _Automator {
|
|
2596
2486
|
constructor(model, {
|
|
2597
2487
|
autoUpdate = true,
|
|
@@ -2745,10 +2635,17 @@ const tempMatrix = new Matrix();
|
|
|
2745
2635
|
const tempWorldMatrix = new Matrix();
|
|
2746
2636
|
const tempDrawableBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
2747
2637
|
const tempModelBounds = new Bounds();
|
|
2638
|
+
let live2DPluginFallbackWarned = false;
|
|
2748
2639
|
class Live2DPipe {
|
|
2749
2640
|
constructor(renderer) {
|
|
2750
2641
|
this.renderer = renderer;
|
|
2751
2642
|
}
|
|
2643
|
+
addRenderable(model, instructionSet) {
|
|
2644
|
+
var _a, _b;
|
|
2645
|
+
const renderPipes = this.renderer.renderPipes;
|
|
2646
|
+
(_b = (_a = renderPipes.batch) == null ? void 0 : _a.break) == null ? void 0 : _b.call(_a, instructionSet);
|
|
2647
|
+
instructionSet.add(model);
|
|
2648
|
+
}
|
|
2752
2649
|
execute(model) {
|
|
2753
2650
|
if (!model.visible || model.alpha <= 0) {
|
|
2754
2651
|
return;
|
|
@@ -2757,12 +2654,28 @@ class Live2DPipe {
|
|
|
2757
2654
|
}
|
|
2758
2655
|
updateRenderable() {
|
|
2759
2656
|
}
|
|
2657
|
+
destroyRenderable() {
|
|
2658
|
+
}
|
|
2659
|
+
validateRenderable() {
|
|
2660
|
+
return false;
|
|
2661
|
+
}
|
|
2760
2662
|
destroy() {
|
|
2761
2663
|
}
|
|
2762
2664
|
}
|
|
2665
|
+
__publicField(Live2DPipe, "extension", {
|
|
2666
|
+
type: [ExtensionType.WebGLPipes],
|
|
2667
|
+
name: "live2d"
|
|
2668
|
+
});
|
|
2669
|
+
const Live2DPlugin = Live2DPipe;
|
|
2763
2670
|
function ensureLive2DPipe(renderer) {
|
|
2764
2671
|
const r = renderer;
|
|
2765
2672
|
if (!r.renderPipes.live2d) {
|
|
2673
|
+
if (!live2DPluginFallbackWarned) {
|
|
2674
|
+
live2DPluginFallbackWarned = true;
|
|
2675
|
+
console.warn(
|
|
2676
|
+
"[untitled-pixi-live2d-engine] Lazy Live2D render pipe registration is deprecated. Register Live2DPlugin explicitly with `extensions.add(Live2DPlugin)` before creating the Pixi renderer."
|
|
2677
|
+
);
|
|
2678
|
+
}
|
|
2766
2679
|
r.renderPipes.live2d = new Live2DPipe(renderer);
|
|
2767
2680
|
}
|
|
2768
2681
|
}
|
|
@@ -3112,9 +3025,7 @@ class Live2DModel extends Container {
|
|
|
3112
3025
|
ensureLive2DPipe(renderer);
|
|
3113
3026
|
const renderPipes = renderer.renderPipes;
|
|
3114
3027
|
const addRenderable = () => {
|
|
3115
|
-
|
|
3116
|
-
(_b2 = (_a2 = renderPipes.batch) == null ? void 0 : _a2.break) == null ? void 0 : _b2.call(_a2, instructionSet);
|
|
3117
|
-
instructionSet.add(this);
|
|
3028
|
+
renderPipes.live2d.addRenderable(this, instructionSet);
|
|
3118
3029
|
};
|
|
3119
3030
|
const collectChildren = () => {
|
|
3120
3031
|
const children = this.children;
|
|
@@ -4434,6 +4345,7 @@ export {
|
|
|
4434
4345
|
Live2DLoader,
|
|
4435
4346
|
Live2DModel,
|
|
4436
4347
|
Live2DPhysics,
|
|
4348
|
+
Live2DPlugin,
|
|
4437
4349
|
Live2DPose,
|
|
4438
4350
|
Live2DTransform,
|
|
4439
4351
|
MBToByte,
|
|
@@ -4446,7 +4358,6 @@ export {
|
|
|
4446
4358
|
VERSION,
|
|
4447
4359
|
VOLUME,
|
|
4448
4360
|
XHRLoader,
|
|
4449
|
-
ZipLoader,
|
|
4450
4361
|
applyMixins,
|
|
4451
4362
|
clamp$1 as clamp,
|
|
4452
4363
|
config,
|