@combos-fun/plugin-renderer 0.0.54 → 0.2.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/agent-skill.md +4 -1
- package/combos-plugin.json +2 -1
- package/dist/plugin-renderer.cjs.js +185 -55
- package/dist/plugin-renderer.cjs.js.map +1 -1
- package/dist/plugin-renderer.cjs.prod.js +1 -1
- package/dist/plugin-renderer.d.ts +56 -9
- package/dist/plugin-renderer.esm.js +186 -57
- package/dist/plugin-renderer.esm.js.map +1 -1
- package/package.json +4 -3
package/agent-skill.md
CHANGED
|
@@ -23,9 +23,12 @@ import {
|
|
|
23
23
|
ContainerManager,
|
|
24
24
|
RESOURCE_KEY_SPLIT,
|
|
25
25
|
RENDERER_TYPE,
|
|
26
|
+
Transform2D,
|
|
26
27
|
} from '@combos-fun/plugin-renderer';
|
|
27
28
|
```
|
|
28
29
|
|
|
30
|
+
`new GameObject(name)` then `addComponent(new Transform2D({ position, size, origin, anchor, scale, rotation }))`. Do not pass pose as the GameObject constructor's second argument. `RendererSystem` ensures a `Transform2D` when a node is parented if one is missing.
|
|
31
|
+
|
|
29
32
|
`RendererSystem.systemName = 'Renderer'`. Its params are Pixi `Partial<ApplicationOptions>`; common options are `canvas`, `width`, `height`, `resolution`, `backgroundColor`, `backgroundAlpha`, and `antialias`. The implementation forces `autoStart: true` and `sharedTicker: true`, and retries with canvas preference if initial app setup fails. `transparent`, `enableScroll`, and `renderType` are not consumed. `RENDERER_TYPE` remains exported but unused: `UNKNOWN = 0`, `WEBGL = 1`, `CANVAS = 2`.
|
|
30
33
|
|
|
31
34
|
Add `RendererSystem` before every 2D leaf system. Prefer constructor lookup:
|
|
@@ -49,7 +52,7 @@ new Game({
|
|
|
49
52
|
|
|
50
53
|
Extend `Renderer`, observe Component fields with `@decorators.componentObserver`, and in `init()` fetch `RendererSystem` then register with its `rendererManager`. Implement `componentChanged` for add/change/remove and `rendererUpdate` for per-frame sync.
|
|
51
54
|
|
|
52
|
-
Display objects belong under `containerManager.getContainer(gameObject.id)`, never directly under the Pixi stage. That lookup can be empty before the GameObject's `
|
|
55
|
+
Display objects belong under `containerManager.getContainer(gameObject.id)`, never directly under the Pixi stage. That lookup can be empty before the GameObject's `Transform2D` has created its container. Add `Transform2D` before leaf drawables, or add the object to the scene first so `RendererSystem` can ensure pose and a container.
|
|
53
56
|
|
|
54
57
|
## Key diagnostics
|
|
55
58
|
|
package/combos-plugin.json
CHANGED
|
@@ -5,6 +5,7 @@ var engine = require('@combos-fun/engine');
|
|
|
5
5
|
var rendererAdapter = require('@combos-fun/renderer-adapter');
|
|
6
6
|
var isEqual = require('lodash-es/isEqual');
|
|
7
7
|
var EventEmitter = require('eventemitter3');
|
|
8
|
+
var inspectorDecorator = require('@combos-fun/inspector-decorator');
|
|
8
9
|
var pixi_js = require('pixi.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -88,7 +89,7 @@ class ContainerManager {
|
|
|
88
89
|
this.containerMap[name]?.destroy({ children: true });
|
|
89
90
|
delete this.containerMap[name];
|
|
90
91
|
}
|
|
91
|
-
updateTransform({ name, transform }) {
|
|
92
|
+
updateTransform({ name, transform, parentSize, }) {
|
|
92
93
|
const container = this.containerMap[name];
|
|
93
94
|
if (!container || !transform)
|
|
94
95
|
return;
|
|
@@ -100,19 +101,106 @@ class ContainerManager {
|
|
|
100
101
|
container.skew = skew;
|
|
101
102
|
let x = position.x;
|
|
102
103
|
let y = position.y;
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
y = y + parent.size.height * anchor.y;
|
|
104
|
+
if (parentSize) {
|
|
105
|
+
x = x + parentSize.width * anchor.x;
|
|
106
|
+
y = y + parentSize.height * anchor.y;
|
|
107
107
|
}
|
|
108
108
|
container.position = { x, y };
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
/** 2D layout pose. Hierarchy lives on GameObject. */
|
|
113
|
+
class Transform2D extends engine.Component {
|
|
114
|
+
constructor() {
|
|
115
|
+
super(...arguments);
|
|
116
|
+
this.name = 'Transform2D';
|
|
117
|
+
this.position = { x: 0, y: 0 };
|
|
118
|
+
this.size = { width: 0, height: 0 };
|
|
119
|
+
this.origin = { x: 0, y: 0 };
|
|
120
|
+
this.anchor = { x: 0, y: 0 };
|
|
121
|
+
this.scale = { x: 1, y: 1 };
|
|
122
|
+
this.skew = { x: 0, y: 0 };
|
|
123
|
+
this.rotation = 0;
|
|
124
|
+
}
|
|
125
|
+
static { this.componentName = 'Transform2D'; }
|
|
126
|
+
init(params = {}) {
|
|
127
|
+
const props = ['position', 'size', 'origin', 'anchor', 'scale', 'skew'];
|
|
128
|
+
for (const key of props) {
|
|
129
|
+
Object.assign(this[key], params[key]);
|
|
130
|
+
}
|
|
131
|
+
this.rotation = params.rotation ?? this.rotation;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
tslib.__decorate([
|
|
135
|
+
inspectorDecorator.Field({
|
|
136
|
+
type: 'vector2',
|
|
137
|
+
step: 1,
|
|
138
|
+
group: 'Transform2D',
|
|
139
|
+
label: 'Position',
|
|
140
|
+
description: 'Position on the design canvas (x right, y down).',
|
|
141
|
+
})
|
|
142
|
+
], Transform2D.prototype, "position", void 0);
|
|
143
|
+
tslib.__decorate([
|
|
144
|
+
inspectorDecorator.Field({
|
|
145
|
+
type: 'size',
|
|
146
|
+
step: 1,
|
|
147
|
+
min: 0,
|
|
148
|
+
group: 'Transform2D',
|
|
149
|
+
label: 'Size',
|
|
150
|
+
description: 'Width and height of the object in design pixels.',
|
|
151
|
+
})
|
|
152
|
+
], Transform2D.prototype, "size", void 0);
|
|
153
|
+
tslib.__decorate([
|
|
154
|
+
inspectorDecorator.Field({
|
|
155
|
+
type: 'vector2',
|
|
156
|
+
step: 0.1,
|
|
157
|
+
group: 'Transform2D',
|
|
158
|
+
label: 'Origin',
|
|
159
|
+
description: 'Local origin used for layout math.',
|
|
160
|
+
})
|
|
161
|
+
], Transform2D.prototype, "origin", void 0);
|
|
162
|
+
tslib.__decorate([
|
|
163
|
+
inspectorDecorator.Field({
|
|
164
|
+
type: 'vector2',
|
|
165
|
+
step: 0.1,
|
|
166
|
+
group: 'Transform2D',
|
|
167
|
+
label: 'Anchor',
|
|
168
|
+
description: 'Anchor point (0–1) used when positioning and scaling.',
|
|
169
|
+
})
|
|
170
|
+
], Transform2D.prototype, "anchor", void 0);
|
|
171
|
+
tslib.__decorate([
|
|
172
|
+
inspectorDecorator.Field({
|
|
173
|
+
type: 'vector2',
|
|
174
|
+
step: 0.1,
|
|
175
|
+
group: 'Transform2D',
|
|
176
|
+
label: 'Scale',
|
|
177
|
+
description: 'Scale multipliers on X and Y (1 = original size).',
|
|
178
|
+
})
|
|
179
|
+
], Transform2D.prototype, "scale", void 0);
|
|
180
|
+
tslib.__decorate([
|
|
181
|
+
inspectorDecorator.Field({
|
|
182
|
+
type: 'vector2',
|
|
183
|
+
step: 0.1,
|
|
184
|
+
group: 'Transform2D',
|
|
185
|
+
label: 'Skew',
|
|
186
|
+
description: 'Skew amounts on X and Y.',
|
|
187
|
+
})
|
|
188
|
+
], Transform2D.prototype, "skew", void 0);
|
|
189
|
+
tslib.__decorate([
|
|
190
|
+
inspectorDecorator.Field({
|
|
191
|
+
type: 'number',
|
|
192
|
+
step: 0.1,
|
|
193
|
+
group: 'Transform2D',
|
|
194
|
+
label: 'Rotation',
|
|
195
|
+
description: 'Rotation in radians.',
|
|
196
|
+
editor: 'number-stepper',
|
|
197
|
+
})
|
|
198
|
+
], Transform2D.prototype, "rotation", void 0);
|
|
199
|
+
|
|
200
|
+
let PixiHierarchy$1 = class PixiHierarchy extends EventEmitter__default.default {
|
|
113
201
|
constructor({ system, containerManager }) {
|
|
114
202
|
super();
|
|
115
|
-
this.name = '
|
|
203
|
+
this.name = 'PixiHierarchy';
|
|
116
204
|
this.waitRemoveIds = [];
|
|
117
205
|
this.waitChangeScenes = [];
|
|
118
206
|
this.containerManager = containerManager;
|
|
@@ -121,12 +209,7 @@ let Transform$1 = class Transform extends EventEmitter__default.default {
|
|
|
121
209
|
init(system) {
|
|
122
210
|
this.system = system;
|
|
123
211
|
this.on('changeScene', ({ scene, mode, application }) => {
|
|
124
|
-
// switch (mode) {
|
|
125
|
-
// case LOAD_SCENE_MODE.SINGLE:
|
|
126
212
|
this.waitChangeScenes.push({ scene, mode, application });
|
|
127
|
-
// break;
|
|
128
|
-
// case LOAD_SCENE_MODE.MULTI_CANVAS:
|
|
129
|
-
// }
|
|
130
213
|
});
|
|
131
214
|
}
|
|
132
215
|
update() {
|
|
@@ -135,7 +218,7 @@ let Transform$1 = class Transform extends EventEmitter__default.default {
|
|
|
135
218
|
}
|
|
136
219
|
this.waitRemoveIds = [];
|
|
137
220
|
for (const sceneInfo of this.waitChangeScenes) {
|
|
138
|
-
|
|
221
|
+
this.ensureSceneContainer(sceneInfo.scene);
|
|
139
222
|
const container = this.containerManager.getContainer(sceneInfo.scene.id);
|
|
140
223
|
if (container) {
|
|
141
224
|
sceneInfo.application.stage.removeChildren();
|
|
@@ -144,43 +227,67 @@ let Transform$1 = class Transform extends EventEmitter__default.default {
|
|
|
144
227
|
}
|
|
145
228
|
this.waitChangeScenes = [];
|
|
146
229
|
}
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
230
|
+
ensureSceneContainer(scene) {
|
|
231
|
+
if (this.containerManager.getContainer(scene.id))
|
|
232
|
+
return;
|
|
233
|
+
const container = new rendererAdapter.Container();
|
|
234
|
+
container.label = scene.name;
|
|
235
|
+
this.containerManager.addContainer({
|
|
236
|
+
name: scene.id,
|
|
237
|
+
container,
|
|
238
|
+
});
|
|
157
239
|
}
|
|
158
|
-
|
|
240
|
+
ensureContainer(gameObject, transform) {
|
|
241
|
+
if (this.containerManager.getContainer(gameObject.id)) {
|
|
242
|
+
transform.worldTransform = this.containerManager.getContainer(gameObject.id)
|
|
243
|
+
.worldTransform;
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
159
246
|
const container = new rendererAdapter.Container();
|
|
160
|
-
container.label =
|
|
247
|
+
container.label = gameObject.name;
|
|
161
248
|
this.containerManager.addContainer({
|
|
162
|
-
name:
|
|
249
|
+
name: gameObject.id,
|
|
163
250
|
container,
|
|
164
251
|
});
|
|
165
|
-
const transform = changed.component;
|
|
166
|
-
// Pixi v8 exposes `worldTransform` on the display object; nested `transform.worldTransform` is gone.
|
|
167
252
|
transform.worldTransform = container.worldTransform;
|
|
168
253
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
254
|
+
componentChanged(changed) {
|
|
255
|
+
if (changed.componentName === 'GameObject') {
|
|
256
|
+
this.reparent(changed.gameObject);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (changed.componentName !== 'Transform2D')
|
|
260
|
+
return;
|
|
261
|
+
if (changed.type === engine.OBSERVER_TYPE.ADD) {
|
|
262
|
+
this.ensureContainer(changed.gameObject, changed.component);
|
|
263
|
+
this.reparent(changed.gameObject);
|
|
264
|
+
}
|
|
265
|
+
else if (changed.type === engine.OBSERVER_TYPE.REMOVE) {
|
|
266
|
+
this.waitRemoveIds.push(changed.gameObject.id);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
reparent(gameObject) {
|
|
270
|
+
if (!gameObject)
|
|
271
|
+
return;
|
|
272
|
+
const container = this.containerManager.getContainer(gameObject.id);
|
|
273
|
+
if (!container)
|
|
274
|
+
return;
|
|
275
|
+
if (gameObject.parent) {
|
|
276
|
+
const parentContainer = this.containerManager.getContainer(gameObject.parent.id);
|
|
277
|
+
if (parentContainer && container.parent !== parentContainer) {
|
|
278
|
+
parentContainer.addChild(container);
|
|
279
|
+
}
|
|
280
|
+
const render = gameObject.parent.getComponent('Render');
|
|
176
281
|
if (render) {
|
|
177
282
|
render.sortDirty = true;
|
|
178
283
|
}
|
|
179
284
|
}
|
|
180
|
-
else {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
285
|
+
else if (container.parent) {
|
|
286
|
+
const transform = gameObject.getComponent(Transform2D);
|
|
287
|
+
if (transform) {
|
|
288
|
+
delete transform.worldTransform;
|
|
289
|
+
}
|
|
290
|
+
container.parent.removeChild(container);
|
|
184
291
|
}
|
|
185
292
|
}
|
|
186
293
|
destroy() {
|
|
@@ -191,12 +298,13 @@ let Transform$1 = class Transform extends EventEmitter__default.default {
|
|
|
191
298
|
this.containerManager = null;
|
|
192
299
|
}
|
|
193
300
|
};
|
|
194
|
-
|
|
301
|
+
PixiHierarchy$1 = tslib.__decorate([
|
|
195
302
|
engine.decorators.componentObserver({
|
|
196
|
-
|
|
303
|
+
GameObject: ['parent'],
|
|
304
|
+
Transform2D: [],
|
|
197
305
|
})
|
|
198
|
-
],
|
|
199
|
-
var
|
|
306
|
+
], PixiHierarchy$1);
|
|
307
|
+
var PixiHierarchy = PixiHierarchy$1;
|
|
200
308
|
|
|
201
309
|
let result = undefined;
|
|
202
310
|
function getSuportCompressedTextureFormats(gl) {
|
|
@@ -255,7 +363,7 @@ let Renderer$2 = class Renderer extends engine.System {
|
|
|
255
363
|
game: this.game,
|
|
256
364
|
rendererSystem: this,
|
|
257
365
|
});
|
|
258
|
-
this.
|
|
366
|
+
this.hierarchy = new PixiHierarchy({
|
|
259
367
|
system: this,
|
|
260
368
|
containerManager: this.containerManager,
|
|
261
369
|
});
|
|
@@ -269,7 +377,8 @@ let Renderer$2 = class Renderer extends engine.System {
|
|
|
269
377
|
return;
|
|
270
378
|
}
|
|
271
379
|
scene.canvas = application.canvas;
|
|
272
|
-
this.
|
|
380
|
+
this.hierarchy.ensureSceneContainer(scene);
|
|
381
|
+
this.hierarchy.emit('changeScene', {
|
|
273
382
|
scene,
|
|
274
383
|
mode,
|
|
275
384
|
application,
|
|
@@ -316,24 +425,43 @@ let Renderer$2 = class Renderer extends engine.System {
|
|
|
316
425
|
update() {
|
|
317
426
|
const changes = this.componentObserver.clear();
|
|
318
427
|
for (const changed of changes) {
|
|
319
|
-
|
|
428
|
+
if (changed.componentName === 'GameObject' && changed.gameObject) {
|
|
429
|
+
this.ensureTransform2D(changed.gameObject);
|
|
430
|
+
if (changed.gameObject.parent)
|
|
431
|
+
this.ensureTransform2D(changed.gameObject.parent);
|
|
432
|
+
}
|
|
433
|
+
this.hierarchy.componentChanged(changed);
|
|
320
434
|
}
|
|
321
435
|
if (!this.application) {
|
|
322
436
|
return;
|
|
323
437
|
}
|
|
324
438
|
for (const gameObject of this.game.gameObjects) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
439
|
+
const transform = gameObject.getComponent(Transform2D);
|
|
440
|
+
if (transform) {
|
|
441
|
+
this.containerManager.updateTransform({
|
|
442
|
+
name: gameObject.id,
|
|
443
|
+
transform,
|
|
444
|
+
parentSize: gameObject.parent?.getComponent(Transform2D)?.size,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
329
447
|
this.rendererManager.update(gameObject);
|
|
330
448
|
}
|
|
331
449
|
}
|
|
450
|
+
ensureTransform2D(gameObject) {
|
|
451
|
+
if (!gameObject || gameObject === gameObject.scene)
|
|
452
|
+
return;
|
|
453
|
+
let transform = gameObject.getComponent(Transform2D);
|
|
454
|
+
if (!transform) {
|
|
455
|
+
transform = gameObject.addComponent(new Transform2D());
|
|
456
|
+
}
|
|
457
|
+
this.hierarchy.ensureContainer(gameObject, transform);
|
|
458
|
+
this.hierarchy.reparent(gameObject);
|
|
459
|
+
}
|
|
332
460
|
lateUpdate(e) {
|
|
333
461
|
if (!this.application) {
|
|
334
462
|
return;
|
|
335
463
|
}
|
|
336
|
-
this.
|
|
464
|
+
this.hierarchy.update();
|
|
337
465
|
this.application.ticker.update(e.time);
|
|
338
466
|
}
|
|
339
467
|
onDestroy() {
|
|
@@ -341,8 +469,8 @@ let Renderer$2 = class Renderer extends engine.System {
|
|
|
341
469
|
for (const app of this.multiApps) {
|
|
342
470
|
app && app.destroy();
|
|
343
471
|
}
|
|
344
|
-
this.
|
|
345
|
-
this.
|
|
472
|
+
this.hierarchy.destroy();
|
|
473
|
+
this.hierarchy = null;
|
|
346
474
|
this.params = null;
|
|
347
475
|
this.rendererManager = null;
|
|
348
476
|
this.containerManager = null;
|
|
@@ -360,7 +488,8 @@ let Renderer$2 = class Renderer extends engine.System {
|
|
|
360
488
|
};
|
|
361
489
|
Renderer$2 = tslib.__decorate([
|
|
362
490
|
engine.decorators.componentObserver({
|
|
363
|
-
|
|
491
|
+
GameObject: ['parent'],
|
|
492
|
+
Transform2D: [],
|
|
364
493
|
})
|
|
365
494
|
], Renderer$2);
|
|
366
495
|
var Renderer$1 = Renderer$2;
|
|
@@ -368,7 +497,7 @@ var Renderer$1 = Renderer$2;
|
|
|
368
497
|
/** Auto-generated by scripts/build-package.mjs — do not edit. */
|
|
369
498
|
Object.assign(Renderer$1, {
|
|
370
499
|
packageName: "@combos-fun/plugin-renderer",
|
|
371
|
-
packageVersion: "0.0
|
|
500
|
+
packageVersion: "0.2.0",
|
|
372
501
|
});
|
|
373
502
|
|
|
374
503
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -412,4 +541,5 @@ exports.RESOURCE_KEY_SPLIT = RESOURCE_KEY_SPLIT;
|
|
|
412
541
|
exports.Renderer = Renderer;
|
|
413
542
|
exports.RendererManager = RendererManager;
|
|
414
543
|
exports.RendererSystem = Renderer$1;
|
|
544
|
+
exports.Transform2D = Transform2D;
|
|
415
545
|
//# sourceMappingURL=plugin-renderer.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-renderer.cjs.js","sources":["../lib/manager/RendererManager.ts","../lib/manager/ContainerManager.ts","../lib/Transform.ts","../lib/compressedTexture/ability.ts","../lib/System.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer.ts","../lib/index.ts"],"sourcesContent":["import isEqual from 'lodash-es/isEqual';\nimport { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport Renderer from '../Renderer';\nimport RendererSystem from '../System';\n\nclass RendererManager {\n game: Game;\n rendererSystem: RendererSystem;\n constructor({ game, rendererSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n renderers: Renderer[] = [];\n register(...renderers: Renderer[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this.rendererSystem.rendererManager;\n renderer.containerManager = this.rendererSystem.containerManager;\n this.renderers.push(renderer);\n }\n }\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (props) {\n if ([OBSERVER_TYPE.ADD, OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(`gameObject: ${changed.gameObject.name}, ${changed.componentName} is error.`, changed, e);\n }\n continue;\n }\n\n const index = props.findIndex(prop => {\n return isEqual(prop, changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject && changed.gameObject.name}, ${\n changed.componentName\n } is componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n }\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const cache = [];\n const props = renderer.observerInfo[component.name];\n if (props && cache.indexOf(gameObject) === -1) {\n cache.push(gameObject);\n try {\n renderer.rendererUpdate && renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(`gameObject: ${gameObject.name}, ${component.name} is update error`, e);\n }\n }\n }\n }\n }\n}\nexport default RendererManager;\n","import { Transform } from '@combos-fun/engine';\nimport { Point, ObservablePoint } from 'pixi.js';\nimport { Container } from '@combos-fun/renderer-adapter';\n\nexport default class ContainerManager {\n containerMap: { [propName: number]: Container } = {};\n addContainer({ name, container }: { name: number; container: Container }) {\n this.containerMap[name] = container;\n }\n getContainer(name: number) {\n return this.containerMap[name];\n }\n removeContainer(name: number) {\n this.containerMap[name]?.destroy({ children: true });\n delete this.containerMap[name];\n }\n updateTransform({ name, transform }: { name: number; transform: Transform }) {\n const container = this.containerMap[name];\n if (!container || !transform) return;\n const { anchor, origin, position, rotation, scale, size, skew } = transform;\n container.rotation = rotation;\n container.scale = scale as Point;\n container.pivot.x = size.width * origin.x;\n container.pivot.y = size.height * origin.y;\n container.skew = skew as ObservablePoint;\n let x = position.x;\n let y = position.y;\n if (transform.parent) {\n const parent = transform.parent;\n x = x + parent.size.width * anchor.x;\n y = y + parent.size.height * anchor.y;\n }\n\n container.position = { x, y } as Point;\n }\n}\n","import { Transform as Trans, decorators, ComponentChanged, OBSERVER_TYPE, Scene, LOAD_SCENE_MODE } from '@combos-fun/engine';\nimport EventEmitter from 'eventemitter3';\nimport { Application, Container } from '@combos-fun/renderer-adapter';\nimport Render from './System';\nimport ContainerManager from './manager/ContainerManager';\n\n/** Surface used from the Render component; avoids importing plugin-renderer-render (workspace cycle). */\ntype RenderSortDirty = { sortDirty: boolean };\n\n@decorators.componentObserver({\n Transform: ['_parent'],\n})\nexport default class Transform extends EventEmitter {\n name: string = 'Transform';\n waitRemoveIds: number[] = [];\n waitSceneId: number;\n system: Render;\n containerManager: ContainerManager;\n waitChangeScenes: {\n scene: Scene;\n mode: LOAD_SCENE_MODE;\n application: Application;\n }[] = [];\n constructor({ system, containerManager }) {\n super();\n this.containerManager = containerManager;\n this.init(system);\n }\n init(system: Render) {\n this.system = system;\n this.on('changeScene', ({ scene, mode, application }) => {\n // switch (mode) {\n // case LOAD_SCENE_MODE.SINGLE:\n this.waitChangeScenes.push({ scene, mode, application });\n // break;\n // case LOAD_SCENE_MODE.MULTI_CANVAS:\n\n // }\n });\n }\n update() {\n for (const id of this.waitRemoveIds) {\n this.containerManager.removeContainer(id);\n }\n this.waitRemoveIds = [];\n\n for (const sceneInfo of this.waitChangeScenes) {\n // set scene\n const container = this.containerManager.getContainer(sceneInfo.scene.id);\n if (container) {\n sceneInfo.application.stage.removeChildren();\n sceneInfo.application.stage.addChild(container);\n }\n }\n this.waitChangeScenes = [];\n }\n componentChanged(changed: ComponentChanged) {\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.addContainer(changed);\n } else if (changed.type === OBSERVER_TYPE.CHANGE) {\n this.change(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.waitRemoveIds.push(changed.gameObject.id);\n }\n }\n addContainer(changed: ComponentChanged) {\n const container = new Container();\n container.label = changed.gameObject.name;\n this.containerManager.addContainer({\n name: changed.gameObject.id,\n container,\n });\n const transform = changed.component as Trans;\n // Pixi v8 exposes `worldTransform` on the display object; nested `transform.worldTransform` is gone.\n transform.worldTransform = container.worldTransform as unknown as Trans['worldTransform'];\n }\n change(changed: ComponentChanged) {\n const transform = changed.component as Trans;\n if (transform.parent) {\n const parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id);\n parentContainer.addChild(this.containerManager.getContainer(changed.gameObject.id));\n\n const render =\n changed.gameObject.transform.parent &&\n (changed.gameObject.transform.parent.gameObject.getComponent('Render') as unknown as RenderSortDirty);\n if (render) {\n render.sortDirty = true;\n }\n } else {\n const container = this.containerManager.getContainer(changed.gameObject.id);\n delete transform.worldTransform;\n container.parent && container.parent.removeChild(container);\n }\n }\n destroy() {\n this.removeAllListeners();\n this.waitRemoveIds = null;\n this.waitChangeScenes = null;\n this.system = null;\n this.containerManager = null;\n }\n}\n","/**\n * Inspired by PixiJS v6\n */\nexport type CompressedTextureExtensions = {\n s3tc?: WEBGL_compressed_texture_s3tc,\n s3tc_sRGB: WEBGL_compressed_texture_s3tc_srgb,\n etc: WEBGL_compressed_texture_etc,\n etc1: WEBGL_compressed_texture_etc1,\n pvrtc: WEBKIT_WEBGL_compressed_texture_pvrtc,\n atc: WEBGL_compressed_texture_atc,\n astc: WEBGL_compressed_texture_astc\n};\nexport type CompressedTextureExtensionRef = keyof CompressedTextureExtensions;\nlet result = undefined;\nexport interface SuportedCompressedTexture {\n s3tc: boolean,\n etc: boolean,\n etc1: boolean,\n pvrtc: boolean,\n atc: boolean,\n astc: boolean,\n}\nexport function getSuportCompressedTextureFormats(gl: WebGLRenderingContext): SuportedCompressedTexture {\n if (result) return result;\n\n if (!gl) {\n // #if _DEBUG\n console.warn('WebGL not available for compressed textures. Silently failing.');\n // #endif\n\n return {\n s3tc: false,\n etc: false,\n etc1: false,\n pvrtc: false,\n atc: false,\n astc: false,\n };\n }\n\n result = {\n s3tc: !!gl.getExtension('WEBGL_compressed_texture_s3tc'),\n etc: !!gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: !!gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: !!gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || !!gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: !!gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: !!gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n try {\n console.log('Supported compressed texture formats: ' + Object.keys(result).filter((type) => result[type]).join(', '))\n } catch (e) { }\n return result;\n}","import { System, decorators, Game, LOAD_SCENE_MODE, PureObserverInfo } from '@combos-fun/engine';\nimport { Application } from '@combos-fun/renderer-adapter';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport Transform from './Transform';\nimport { Ticker } from 'pixi.js';\nimport type { ApplicationOptions } from 'pixi.js';\nimport type { Renderer as PixiRenderer } from 'pixi.js';\nimport type { WebGLRenderer } from 'pixi.js';\nimport { registerCompressedTexture } from './compressedTexture';\nimport { SuportedCompressedTexture, getSuportCompressedTextureFormats } from './compressedTexture/ability';\n\nexport enum RENDERER_TYPE {\n UNKNOWN = 0,\n WEBGL = 1,\n CANVAS = 2,\n}\n\n@decorators.componentObserver({\n Transform: ['_parent'],\n})\nexport default class Renderer extends System<Partial<ApplicationOptions>> {\n static systemName: string = 'Renderer';\n params: Partial<ApplicationOptions>;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n application: Application | null = null;\n game: Game;\n transform: Transform;\n multiApps: Application[] = [];\n suportedCompressedTextureFormats: SuportedCompressedTexture;\n\n async init(params?: Partial<ApplicationOptions>) {\n this.params = params ?? {};\n const app = await this.createApplication(this.params);\n this.application = app;\n this.game.canvas = app.canvas;\n this.containerManager = new ContainerManager();\n this.rendererManager = new RendererManager({\n game: this.game,\n rendererSystem: this,\n });\n\n this.transform = new Transform({\n system: this,\n containerManager: this.containerManager,\n });\n this.game.on('sceneChanged', async ({ scene, mode, params: sceneParams }) => {\n let application: Application | null = this.application;\n if (mode === LOAD_SCENE_MODE.MULTI_CANVAS) {\n application = await this.createApplication(sceneParams);\n this.multiApps.push(application);\n }\n if (!application) {\n return;\n }\n scene.canvas = application.canvas;\n this.transform.emit('changeScene', {\n scene,\n mode,\n application,\n });\n });\n\n const gl = (app.renderer as WebGLRenderer).gl;\n if (gl) {\n this.suportedCompressedTextureFormats = getSuportCompressedTextureFormats(gl);\n registerCompressedTexture(gl);\n }\n }\n\n registerObserver(observerInfo: PureObserverInfo): void {\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n if (!Ctor.observerInfo) {\n Ctor.observerInfo = {} as PureObserverInfo;\n }\n const thisObserverInfo = Ctor.observerInfo;\n for (const key in observerInfo) {\n if (!thisObserverInfo[key]) {\n thisObserverInfo[key] = [];\n }\n thisObserverInfo[key].push(...observerInfo[key]);\n }\n }\n\n private async createApplication(params: Partial<ApplicationOptions>): Promise<Application> {\n const initOptions: Partial<ApplicationOptions> = {\n ...params,\n autoStart: true,\n sharedTicker: true,\n };\n\n const app = new Application();\n try {\n await app.init(initOptions);\n } catch {\n await app.init({\n ...initOptions,\n preference: 'canvas',\n });\n }\n\n Ticker.shared.stop();\n Ticker.shared.autoStart = false;\n\n return app;\n }\n\n update() {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.transform.componentChanged(changed);\n }\n if (!this.application) {\n return;\n }\n for (const gameObject of this.game.gameObjects) {\n this.containerManager.updateTransform({\n name: gameObject.id,\n transform: gameObject.transform,\n });\n this.rendererManager.update(gameObject);\n }\n }\n\n lateUpdate(e) {\n if (!this.application) {\n return;\n }\n this.transform.update();\n this.application.ticker.update(e.time);\n }\n\n onDestroy() {\n this.application?.destroy();\n for (const app of this.multiApps) {\n app && app.destroy();\n }\n this.transform.destroy();\n this.transform = null;\n this.params = null;\n this.rendererManager = null;\n this.containerManager = null;\n this.application = null;\n this.game = null;\n this.multiApps = null;\n }\n\n resize(width, height) {\n if (!this.application) {\n return;\n }\n this.params = { ...this.params, width, height };\n this.application.renderer.resize(width, height);\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer from './System';\n\nObject.assign(Renderer, {\n packageName: \"@combos-fun/plugin-renderer\",\n packageVersion: \"0.0.54\",\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { GameObject, Game, PureObserverInfo, ComponentChanged, System, UpdateParams } from '@combos-fun/engine';\nimport ContainerManager from './manager/ContainerManager';\nimport RendererManager from './manager/RendererManager';\n\nexport default class Renderer<T extends {} = {}> extends System<T> {\n /**\n * Renderer name\n */\n name: string;\n\n /**\n * currentGame\n */\n game: Game;\n\n /**\n * observer component props info\n */\n static observerInfo: PureObserverInfo;\n\n /**\n * observer component props info\n */\n observerInfo: PureObserverInfo;\n\n /**\n * containerManager\n */\n containerManager: ContainerManager;\n rendererManager: RendererManager;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n // init(arg?: any): void;\n\n /**\n * Called when an observed component property changes.\n */\n componentChanged(_changed: ComponentChanged) { }\n\n /**\n * Called every frame.\n * @param _gameObject gameObject\n */\n rendererUpdate(_gameObject: GameObject) { }\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {}\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import RendererSystem, { RENDERER_TYPE } from './System';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport Renderer from './Renderer';\n\n/** Shared resource cache key separator used across renderer plugins */\nexport const RESOURCE_KEY_SPLIT = '_s|r|c_';\n\nexport { RendererManager, ContainerManager, RendererSystem, RENDERER_TYPE, Renderer };\n\n"],"names":["OBSERVER_TYPE","isEqual","Transform","EventEmitter","Container","__decorate","decorators","RENDERER_TYPE","Renderer","System","LOAD_SCENE_MODE","Application","Ticker"],"mappings":";;;;;;;;;;;;;;AAKA,MAAM,eAAe,CAAA;AAGnB,IAAA,WAAA,CAAY,EAAE,IAAI,EAAE,cAAc,EAAE,EAAA;QAIpC,IAAA,CAAA,SAAS,GAAe,EAAE;AAHxB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc;IACtC;IAEA,QAAQ,CAAC,GAAG,SAAqB,EAAA;AAC/B,QAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;AAChC,YAAA,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;YACzB,QAAQ,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe;YAC9D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB;AAChE,YAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC/B;IACF;AACA,IAAA,gBAAgB,CAAC,OAA2B,EAAA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CAAC;AACpD,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;IAC5B;IAEU,eAAe,CAAC,EAAU,EAAE,OAAe,EAAA;QACnD,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,OAAO;IACxC;AACD;;AChED;AACO,MAAM,kBAAkB,GAAG;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin-renderer.cjs.js","sources":["../lib/manager/RendererManager.ts","../lib/manager/ContainerManager.ts","../lib/Transform2D.ts","../lib/PixiHierarchy.ts","../lib/compressedTexture/ability.ts","../lib/System.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer.ts","../lib/index.ts"],"sourcesContent":["import isEqual from 'lodash-es/isEqual';\nimport { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport Renderer from '../Renderer';\nimport RendererSystem from '../System';\n\nclass RendererManager {\n game: Game;\n rendererSystem: RendererSystem;\n constructor({ game, rendererSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n renderers: Renderer[] = [];\n register(...renderers: Renderer[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this.rendererSystem.rendererManager;\n renderer.containerManager = this.rendererSystem.containerManager;\n this.renderers.push(renderer);\n }\n }\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (props) {\n if ([OBSERVER_TYPE.ADD, OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(`gameObject: ${changed.gameObject.name}, ${changed.componentName} is error.`, changed, e);\n }\n continue;\n }\n\n const index = props.findIndex(prop => {\n return isEqual(prop, changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject && changed.gameObject.name}, ${\n changed.componentName\n } is componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n }\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const cache = [];\n const props = renderer.observerInfo[component.name];\n if (props && cache.indexOf(gameObject) === -1) {\n cache.push(gameObject);\n try {\n renderer.rendererUpdate && renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(`gameObject: ${gameObject.name}, ${component.name} is update error`, e);\n }\n }\n }\n }\n }\n}\nexport default RendererManager;\n","import { Point, ObservablePoint } from 'pixi.js';\nimport { Container } from '@combos-fun/renderer-adapter';\nimport type Transform2D from '../Transform2D';\n\nexport default class ContainerManager {\n containerMap: { [propName: number]: Container } = {};\n addContainer({ name, container }: { name: number; container: Container }) {\n this.containerMap[name] = container;\n }\n getContainer(name: number) {\n return this.containerMap[name];\n }\n removeContainer(name: number) {\n this.containerMap[name]?.destroy({ children: true });\n delete this.containerMap[name];\n }\n updateTransform({\n name,\n transform,\n parentSize,\n }: {\n name: number;\n transform: Transform2D;\n parentSize?: { width: number; height: number };\n }) {\n const container = this.containerMap[name];\n if (!container || !transform) return;\n const { anchor, origin, position, rotation, scale, size, skew } = transform;\n container.rotation = rotation;\n container.scale = scale as Point;\n container.pivot.x = size.width * origin.x;\n container.pivot.y = size.height * origin.y;\n container.skew = skew as ObservablePoint;\n let x = position.x;\n let y = position.y;\n if (parentSize) {\n x = x + parentSize.width * anchor.x;\n y = y + parentSize.height * anchor.y;\n }\n\n container.position = { x, y } as Point;\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport type { ComponentParams } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\ninterface Vector2 {\n x: number;\n y: number;\n}\n\ninterface Size2 {\n width: number;\n height: number;\n}\n\nexport interface TransformMatrix {\n a: number;\n b: number;\n c: number;\n d: number;\n tx: number;\n ty: number;\n array?: number[];\n}\n\nexport interface Transform2DParams extends ComponentParams {\n position?: Vector2;\n size?: Size2;\n origin?: Vector2;\n anchor?: Vector2;\n scale?: Vector2;\n skew?: Vector2;\n rotation?: number;\n}\n\n/** 2D layout pose. Hierarchy lives on GameObject. */\nclass Transform2D extends Component<Transform2DParams> {\n static componentName: string = 'Transform2D';\n readonly name: string = 'Transform2D';\n\n worldTransform: TransformMatrix;\n\n init(params: Transform2DParams = {}) {\n const props = ['position', 'size', 'origin', 'anchor', 'scale', 'skew'];\n for (const key of props) {\n Object.assign(this[key], params[key]);\n }\n this.rotation = params.rotation ?? this.rotation;\n }\n\n @Field({\n type: 'vector2',\n step: 1,\n group: 'Transform2D',\n label: 'Position',\n description: 'Position on the design canvas (x right, y down).',\n })\n position: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'size',\n step: 1,\n min: 0,\n group: 'Transform2D',\n label: 'Size',\n description: 'Width and height of the object in design pixels.',\n })\n size: Size2 = {width: 0, height: 0};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Origin',\n description: 'Local origin used for layout math.',\n })\n origin: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Anchor',\n description: 'Anchor point (0–1) used when positioning and scaling.',\n })\n anchor: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Scale',\n description: 'Scale multipliers on X and Y (1 = original size).',\n })\n scale: Vector2 = {x: 1, y: 1};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Skew',\n description: 'Skew amounts on X and Y.',\n })\n skew: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform2D',\n label: 'Rotation',\n description: 'Rotation in radians.',\n editor: 'number-stepper',\n })\n rotation: number = 0;\n}\n\nexport default Transform2D;\n","import { decorators, ComponentChanged, OBSERVER_TYPE, Scene, LOAD_SCENE_MODE, GameObject } from '@combos-fun/engine';\nimport EventEmitter from 'eventemitter3';\nimport { Application, Container } from '@combos-fun/renderer-adapter';\nimport Render from './System';\nimport ContainerManager from './manager/ContainerManager';\nimport Transform2D from './Transform2D';\n\ntype RenderSortDirty = { sortDirty: boolean };\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n Transform2D: [],\n})\nexport default class PixiHierarchy extends EventEmitter {\n name: string = 'PixiHierarchy';\n waitRemoveIds: number[] = [];\n system: Render;\n containerManager: ContainerManager;\n waitChangeScenes: {\n scene: Scene;\n mode: LOAD_SCENE_MODE;\n application: Application;\n }[] = [];\n constructor({ system, containerManager }) {\n super();\n this.containerManager = containerManager;\n this.init(system);\n }\n init(system: Render) {\n this.system = system;\n this.on('changeScene', ({ scene, mode, application }) => {\n this.waitChangeScenes.push({ scene, mode, application });\n });\n }\n update() {\n for (const id of this.waitRemoveIds) {\n this.containerManager.removeContainer(id);\n }\n this.waitRemoveIds = [];\n\n for (const sceneInfo of this.waitChangeScenes) {\n this.ensureSceneContainer(sceneInfo.scene);\n const container = this.containerManager.getContainer(sceneInfo.scene.id);\n if (container) {\n sceneInfo.application.stage.removeChildren();\n sceneInfo.application.stage.addChild(container);\n }\n }\n this.waitChangeScenes = [];\n }\n ensureSceneContainer(scene: Scene) {\n if (this.containerManager.getContainer(scene.id)) return;\n const container = new Container();\n container.label = scene.name;\n this.containerManager.addContainer({\n name: scene.id,\n container,\n });\n }\n ensureContainer(gameObject: GameObject, transform: Transform2D) {\n if (this.containerManager.getContainer(gameObject.id)) {\n transform.worldTransform = this.containerManager.getContainer(gameObject.id)\n .worldTransform as unknown as Transform2D['worldTransform'];\n return;\n }\n const container = new Container();\n container.label = gameObject.name;\n this.containerManager.addContainer({\n name: gameObject.id,\n container,\n });\n transform.worldTransform = container.worldTransform as unknown as Transform2D['worldTransform'];\n }\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'GameObject') {\n this.reparent(changed.gameObject);\n return;\n }\n if (changed.componentName !== 'Transform2D') return;\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.ensureContainer(changed.gameObject, changed.component as Transform2D);\n this.reparent(changed.gameObject);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.waitRemoveIds.push(changed.gameObject.id);\n }\n }\n reparent(gameObject?: GameObject) {\n if (!gameObject) return;\n const container = this.containerManager.getContainer(gameObject.id);\n if (!container) return;\n if (gameObject.parent) {\n const parentContainer = this.containerManager.getContainer(gameObject.parent.id);\n if (parentContainer && container.parent !== parentContainer) {\n parentContainer.addChild(container);\n }\n const render = gameObject.parent.getComponent('Render') as unknown as RenderSortDirty;\n if (render) {\n render.sortDirty = true;\n }\n } else if (container.parent) {\n const transform = gameObject.getComponent(Transform2D);\n if (transform) {\n delete transform.worldTransform;\n }\n container.parent.removeChild(container);\n }\n }\n destroy() {\n this.removeAllListeners();\n this.waitRemoveIds = null;\n this.waitChangeScenes = null;\n this.system = null;\n this.containerManager = null;\n }\n}\n","/**\n * Inspired by PixiJS v6\n */\nexport type CompressedTextureExtensions = {\n s3tc?: WEBGL_compressed_texture_s3tc,\n s3tc_sRGB: WEBGL_compressed_texture_s3tc_srgb,\n etc: WEBGL_compressed_texture_etc,\n etc1: WEBGL_compressed_texture_etc1,\n pvrtc: WEBKIT_WEBGL_compressed_texture_pvrtc,\n atc: WEBGL_compressed_texture_atc,\n astc: WEBGL_compressed_texture_astc\n};\nexport type CompressedTextureExtensionRef = keyof CompressedTextureExtensions;\nlet result = undefined;\nexport interface SuportedCompressedTexture {\n s3tc: boolean,\n etc: boolean,\n etc1: boolean,\n pvrtc: boolean,\n atc: boolean,\n astc: boolean,\n}\nexport function getSuportCompressedTextureFormats(gl: WebGLRenderingContext): SuportedCompressedTexture {\n if (result) return result;\n\n if (!gl) {\n // #if _DEBUG\n console.warn('WebGL not available for compressed textures. Silently failing.');\n // #endif\n\n return {\n s3tc: false,\n etc: false,\n etc1: false,\n pvrtc: false,\n atc: false,\n astc: false,\n };\n }\n\n result = {\n s3tc: !!gl.getExtension('WEBGL_compressed_texture_s3tc'),\n etc: !!gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: !!gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: !!gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || !!gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: !!gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: !!gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n try {\n console.log('Supported compressed texture formats: ' + Object.keys(result).filter((type) => result[type]).join(', '))\n } catch (e) { }\n return result;\n}","import { System, decorators, Game, LOAD_SCENE_MODE, PureObserverInfo } from '@combos-fun/engine';\nimport { Application } from '@combos-fun/renderer-adapter';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport PixiHierarchy from './PixiHierarchy';\nimport Transform2D from './Transform2D';\nimport { Ticker } from 'pixi.js';\nimport type { ApplicationOptions } from 'pixi.js';\nimport type { Renderer as PixiRenderer } from 'pixi.js';\nimport type { WebGLRenderer } from 'pixi.js';\nimport { registerCompressedTexture } from './compressedTexture';\nimport { SuportedCompressedTexture, getSuportCompressedTextureFormats } from './compressedTexture/ability';\n\nexport enum RENDERER_TYPE {\n UNKNOWN = 0,\n WEBGL = 1,\n CANVAS = 2,\n}\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n Transform2D: [],\n})\nexport default class Renderer extends System<Partial<ApplicationOptions>> {\n static systemName: string = 'Renderer';\n params: Partial<ApplicationOptions>;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n application: Application | null = null;\n game: Game;\n hierarchy: PixiHierarchy;\n multiApps: Application[] = [];\n suportedCompressedTextureFormats: SuportedCompressedTexture;\n\n async init(params?: Partial<ApplicationOptions>) {\n this.params = params ?? {};\n const app = await this.createApplication(this.params);\n this.application = app;\n this.game.canvas = app.canvas;\n this.containerManager = new ContainerManager();\n this.rendererManager = new RendererManager({\n game: this.game,\n rendererSystem: this,\n });\n\n this.hierarchy = new PixiHierarchy({\n system: this,\n containerManager: this.containerManager,\n });\n this.game.on('sceneChanged', async ({ scene, mode, params: sceneParams }) => {\n let application: Application | null = this.application;\n if (mode === LOAD_SCENE_MODE.MULTI_CANVAS) {\n application = await this.createApplication(sceneParams);\n this.multiApps.push(application);\n }\n if (!application) {\n return;\n }\n scene.canvas = application.canvas;\n this.hierarchy.ensureSceneContainer(scene);\n this.hierarchy.emit('changeScene', {\n scene,\n mode,\n application,\n });\n });\n\n const gl = (app.renderer as WebGLRenderer).gl;\n if (gl) {\n this.suportedCompressedTextureFormats = getSuportCompressedTextureFormats(gl);\n registerCompressedTexture(gl);\n }\n }\n\n registerObserver(observerInfo: PureObserverInfo): void {\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n if (!Ctor.observerInfo) {\n Ctor.observerInfo = {} as PureObserverInfo;\n }\n const thisObserverInfo = Ctor.observerInfo;\n for (const key in observerInfo) {\n if (!thisObserverInfo[key]) {\n thisObserverInfo[key] = [];\n }\n thisObserverInfo[key].push(...observerInfo[key]);\n }\n }\n\n private async createApplication(params: Partial<ApplicationOptions>): Promise<Application> {\n const initOptions: Partial<ApplicationOptions> = {\n ...params,\n autoStart: true,\n sharedTicker: true,\n };\n\n const app = new Application();\n try {\n await app.init(initOptions);\n } catch {\n await app.init({\n ...initOptions,\n preference: 'canvas',\n });\n }\n\n Ticker.shared.stop();\n Ticker.shared.autoStart = false;\n\n return app;\n }\n\n update() {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n if (changed.componentName === 'GameObject' && changed.gameObject) {\n this.ensureTransform2D(changed.gameObject);\n if (changed.gameObject.parent) this.ensureTransform2D(changed.gameObject.parent);\n }\n this.hierarchy.componentChanged(changed);\n }\n if (!this.application) {\n return;\n }\n for (const gameObject of this.game.gameObjects) {\n const transform = gameObject.getComponent(Transform2D);\n if (transform) {\n this.containerManager.updateTransform({\n name: gameObject.id,\n transform,\n parentSize: gameObject.parent?.getComponent(Transform2D)?.size,\n });\n }\n this.rendererManager.update(gameObject);\n }\n }\n\n private ensureTransform2D(gameObject: Game['gameObjects'][number]) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform2D);\n if (!transform) {\n transform = gameObject.addComponent(new Transform2D());\n }\n this.hierarchy.ensureContainer(gameObject, transform);\n this.hierarchy.reparent(gameObject);\n }\n\n lateUpdate(e) {\n if (!this.application) {\n return;\n }\n this.hierarchy.update();\n this.application.ticker.update(e.time);\n }\n\n onDestroy() {\n this.application?.destroy();\n for (const app of this.multiApps) {\n app && app.destroy();\n }\n this.hierarchy.destroy();\n this.hierarchy = null;\n this.params = null;\n this.rendererManager = null;\n this.containerManager = null;\n this.application = null;\n this.game = null;\n this.multiApps = null;\n }\n\n resize(width, height) {\n if (!this.application) {\n return;\n }\n this.params = { ...this.params, width, height };\n this.application.renderer.resize(width, height);\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer from './System';\n\nObject.assign(Renderer, {\n packageName: \"@combos-fun/plugin-renderer\",\n packageVersion: \"0.2.0\",\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { GameObject, Game, PureObserverInfo, ComponentChanged, System, UpdateParams } from '@combos-fun/engine';\nimport ContainerManager from './manager/ContainerManager';\nimport RendererManager from './manager/RendererManager';\n\nexport default class Renderer<T extends {} = {}> extends System<T> {\n /**\n * Renderer name\n */\n name: string;\n\n /**\n * currentGame\n */\n game: Game;\n\n /**\n * observer component props info\n */\n static observerInfo: PureObserverInfo;\n\n /**\n * observer component props info\n */\n observerInfo: PureObserverInfo;\n\n /**\n * containerManager\n */\n containerManager: ContainerManager;\n rendererManager: RendererManager;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n // init(arg?: any): void;\n\n /**\n * Called when an observed component property changes.\n */\n componentChanged(_changed: ComponentChanged) { }\n\n /**\n * Called every frame.\n * @param _gameObject gameObject\n */\n rendererUpdate(_gameObject: GameObject) { }\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {}\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import RendererSystem, { RENDERER_TYPE } from './System';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport Renderer from './Renderer';\nimport Transform2D from './Transform2D';\n\n/** Shared resource cache key separator used across renderer plugins */\nexport const RESOURCE_KEY_SPLIT = '_s|r|c_';\n\nexport type { Transform2DParams, TransformMatrix } from './Transform2D';\nexport { RendererManager, ContainerManager, RendererSystem, RENDERER_TYPE, Renderer, Transform2D };\n\n"],"names":["OBSERVER_TYPE","isEqual","Component","__decorate","Field","PixiHierarchy","EventEmitter","Container","decorators","RENDERER_TYPE","Renderer","System","LOAD_SCENE_MODE","Application","Ticker"],"mappings":";;;;;;;;;;;;;;;AAKA,MAAM,eAAe,CAAA;AAGnB,IAAA,WAAA,CAAY,EAAE,IAAI,EAAE,cAAc,EAAE,EAAA;QAIpC,IAAA,CAAA,SAAS,GAAe,EAAE;AAHxB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc;IACtC;IAEA,QAAQ,CAAC,GAAG,SAAqB,EAAA;AAC/B,QAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;AAChC,YAAA,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;YACzB,QAAQ,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe;YAC9D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB;AAChE,YAAA,IAAI,CA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
|
|
1
|
-
"use strict";var e=require("tslib"),t=require("@combos-fun/engine"),n=require("@combos-fun/renderer-adapter"),r=require("lodash-es/isEqual"),
|
|
1
|
+
"use strict";var e=require("tslib"),t=require("@combos-fun/engine"),n=require("@combos-fun/renderer-adapter"),r=require("lodash-es/isEqual"),o=require("eventemitter3"),a=require("@combos-fun/inspector-decorator"),s=require("pixi.js");function i(e){return e&&e.__esModule?e:{default:e}}var c=i(r),p=i(o);class h{constructor({game:e,rendererSystem:t}){this.renderers=[],this.game=e,this.rendererSystem=t}register(...e){for(const t of e)t.game=this.game,t.rendererManager=this.rendererSystem.rendererManager,t.containerManager=this.rendererSystem.containerManager,this.renderers.push(t)}componentChanged(e){for(const n of e)for(const e of this.renderers){const r=e.observerInfo[n.componentName];if(r){if([t.OBSERVER_TYPE.ADD,t.OBSERVER_TYPE.REMOVE].indexOf(n.type)>-1){try{e.componentChanged&&e.componentChanged(n)}catch(e){console.error(`gameObject: ${n.gameObject.name}, ${n.componentName} is error.`,n,e)}continue}if(r.findIndex(e=>c.default(e,n.prop))>-1)try{e.componentChanged&&e.componentChanged(n)}catch(e){console.error(`gameObject: ${n.gameObject&&n.gameObject.name}, ${n.componentName} is componentChanged error.`,n,e)}}}}update(e){for(const t of e.components)for(const n of this.renderers){const r=[];if(n.observerInfo[t.name]&&-1===r.indexOf(e)){r.push(e);try{n.rendererUpdate&&n.rendererUpdate(e)}catch(n){console.info(`gameObject: ${e.name}, ${t.name} is update error`,n)}}}}}class d{constructor(){this.containerMap={}}addContainer({name:e,container:t}){this.containerMap[e]=t}getContainer(e){return this.containerMap[e]}removeContainer(e){this.containerMap[e]?.destroy({children:!0}),delete this.containerMap[e]}updateTransform({name:e,transform:t,parentSize:n}){const r=this.containerMap[e];if(!r||!t)return;const{anchor:o,origin:a,position:s,rotation:i,scale:c,size:p,skew:h}=t;r.rotation=i,r.scale=c,r.pivot.x=p.width*a.x,r.pivot.y=p.height*a.y,r.skew=h;let d=s.x,m=s.y;n&&(d+=n.width*o.x,m+=n.height*o.y),r.position={x:d,y:m}}}class m extends t.Component{constructor(){super(...arguments),this.name="Transform2D",this.position={x:0,y:0},this.size={width:0,height:0},this.origin={x:0,y:0},this.anchor={x:0,y:0},this.scale={x:1,y:1},this.skew={x:0,y:0},this.rotation=0}static{this.componentName="Transform2D"}init(e={}){const t=["position","size","origin","anchor","scale","skew"];for(const n of t)Object.assign(this[n],e[n]);this.rotation=e.rotation??this.rotation}}e.__decorate([a.Field({type:"vector2",step:1,group:"Transform2D",label:"Position",description:"Position on the design canvas (x right, y down)."})],m.prototype,"position",void 0),e.__decorate([a.Field({type:"size",step:1,min:0,group:"Transform2D",label:"Size",description:"Width and height of the object in design pixels."})],m.prototype,"size",void 0),e.__decorate([a.Field({type:"vector2",step:.1,group:"Transform2D",label:"Origin",description:"Local origin used for layout math."})],m.prototype,"origin",void 0),e.__decorate([a.Field({type:"vector2",step:.1,group:"Transform2D",label:"Anchor",description:"Anchor point (0–1) used when positioning and scaling."})],m.prototype,"anchor",void 0),e.__decorate([a.Field({type:"vector2",step:.1,group:"Transform2D",label:"Scale",description:"Scale multipliers on X and Y (1 = original size)."})],m.prototype,"scale",void 0),e.__decorate([a.Field({type:"vector2",step:.1,group:"Transform2D",label:"Skew",description:"Skew amounts on X and Y."})],m.prototype,"skew",void 0),e.__decorate([a.Field({type:"number",step:.1,group:"Transform2D",label:"Rotation",description:"Rotation in radians.",editor:"number-stepper"})],m.prototype,"rotation",void 0);let l=class extends p.default{constructor({system:e,containerManager:t}){super(),this.name="PixiHierarchy",this.waitRemoveIds=[],this.waitChangeScenes=[],this.containerManager=t,this.init(e)}init(e){this.system=e,this.on("changeScene",({scene:e,mode:t,application:n})=>{this.waitChangeScenes.push({scene:e,mode:t,application:n})})}update(){for(const e of this.waitRemoveIds)this.containerManager.removeContainer(e);this.waitRemoveIds=[];for(const e of this.waitChangeScenes){this.ensureSceneContainer(e.scene);const t=this.containerManager.getContainer(e.scene.id);t&&(e.application.stage.removeChildren(),e.application.stage.addChild(t))}this.waitChangeScenes=[]}ensureSceneContainer(e){if(this.containerManager.getContainer(e.id))return;const t=new n.Container;t.label=e.name,this.containerManager.addContainer({name:e.id,container:t})}ensureContainer(e,t){if(this.containerManager.getContainer(e.id))return void(t.worldTransform=this.containerManager.getContainer(e.id).worldTransform);const r=new n.Container;r.label=e.name,this.containerManager.addContainer({name:e.id,container:r}),t.worldTransform=r.worldTransform}componentChanged(e){"GameObject"!==e.componentName?"Transform2D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?(this.ensureContainer(e.gameObject,e.component),this.reparent(e.gameObject)):e.type===t.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(e.gameObject.id)):this.reparent(e.gameObject)}reparent(e){if(!e)return;const t=this.containerManager.getContainer(e.id);if(t)if(e.parent){const n=this.containerManager.getContainer(e.parent.id);n&&t.parent!==n&&n.addChild(t);const r=e.parent.getComponent("Render");r&&(r.sortDirty=!0)}else if(t.parent){const n=e.getComponent(m);n&&delete n.worldTransform,t.parent.removeChild(t)}}destroy(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null}};l=e.__decorate([t.decorators.componentObserver({GameObject:["parent"],Transform2D:[]})],l);var g=l;let u;var f;exports.RENDERER_TYPE=void 0,(f=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[f.UNKNOWN=0]="UNKNOWN",f[f.WEBGL=1]="WEBGL",f[f.CANVAS=2]="CANVAS";let y=class extends t.System{constructor(){super(...arguments),this.application=null,this.multiApps=[]}static{this.systemName="Renderer"}async init(e){this.params=e??{};const n=await this.createApplication(this.params);this.application=n,this.game.canvas=n.canvas,this.containerManager=new d,this.rendererManager=new h({game:this.game,rendererSystem:this}),this.hierarchy=new g({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",async({scene:e,mode:n,params:r})=>{let o=this.application;n===t.LOAD_SCENE_MODE.MULTI_CANVAS&&(o=await this.createApplication(r),this.multiApps.push(o)),o&&(e.canvas=o.canvas,this.hierarchy.ensureSceneContainer(e),this.hierarchy.emit("changeScene",{scene:e,mode:n,application:o}))});const r=n.renderer.gl;r&&(this.suportedCompressedTextureFormats=function(e){if(u)return u;if(!e)return console.warn("WebGL not available for compressed textures. Silently failing."),{s3tc:!1,etc:!1,etc1:!1,pvrtc:!1,atc:!1,astc:!1};u={s3tc:!!e.getExtension("WEBGL_compressed_texture_s3tc"),etc:!!e.getExtension("WEBGL_compressed_texture_etc"),etc1:!!e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:!!e.getExtension("WEBGL_compressed_texture_pvrtc")||!!e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:!!e.getExtension("WEBGL_compressed_texture_atc"),astc:!!e.getExtension("WEBGL_compressed_texture_astc")};try{console.log("Supported compressed texture formats: "+Object.keys(u).filter(e=>u[e]).join(", "))}catch(e){}return u}(r))}registerObserver(e){const t=this.constructor;t.observerInfo||(t.observerInfo={});const n=t.observerInfo;for(const t in e)n[t]||(n[t]=[]),n[t].push(...e[t])}async createApplication(e){const t={...e,autoStart:!0,sharedTicker:!0},r=new n.Application;try{await r.init(t)}catch{await r.init({...t,preference:"canvas"})}return s.Ticker.shared.stop(),s.Ticker.shared.autoStart=!1,r}update(){const e=this.componentObserver.clear();for(const t of e)"GameObject"===t.componentName&&t.gameObject&&(this.ensureTransform2D(t.gameObject),t.gameObject.parent&&this.ensureTransform2D(t.gameObject.parent)),this.hierarchy.componentChanged(t);if(this.application)for(const e of this.game.gameObjects){const t=e.getComponent(m);t&&this.containerManager.updateTransform({name:e.id,transform:t,parentSize:e.parent?.getComponent(m)?.size}),this.rendererManager.update(e)}}ensureTransform2D(e){if(!e||e===e.scene)return;let t=e.getComponent(m);t||(t=e.addComponent(new m)),this.hierarchy.ensureContainer(e,t),this.hierarchy.reparent(e)}lateUpdate(e){this.application&&(this.hierarchy.update(),this.application.ticker.update(e.time))}onDestroy(){this.application?.destroy();for(const e of this.multiApps)e&&e.destroy();this.hierarchy.destroy(),this.hierarchy=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null}resize(e,t){this.application&&(this.params={...this.params,width:e,height:t},this.application.renderer.resize(e,t))}};y=e.__decorate([t.decorators.componentObserver({GameObject:["parent"],Transform2D:[]})],y);var v=y;Object.assign(v,{packageName:"@combos-fun/plugin-renderer",packageVersion:"0.2.0"});class _ extends t.System{constructor(e){super(e),this.asyncIdMap={};const t=this.constructor;this.observerInfo=t.observerInfo}componentChanged(e){}rendererUpdate(e){}update(e){const t=this.componentObserver.clear();for(const e of t)this.componentChanged(e)}increaseAsyncId(e){return this.asyncIdMap[e]=(this.asyncIdMap[e]||0)+1,this.asyncIdMap[e]}validateAsyncId(e,t){return this.asyncIdMap[e]===t}}exports.ContainerManager=d,exports.RESOURCE_KEY_SPLIT="_s|r|c_",exports.Renderer=_,exports.RendererManager=h,exports.RendererSystem=v,exports.Transform2D=m;
|
|
@@ -1,8 +1,49 @@
|
|
|
1
|
-
import { Transform as Transform$1, System, Game, PureObserverInfo, ComponentChanged, GameObject, UpdateParams, Scene, LOAD_SCENE_MODE } from '@combos-fun/engine';
|
|
2
1
|
import { Container, Application } from '@combos-fun/renderer-adapter';
|
|
2
|
+
import { Component, ComponentParams, System, Game, PureObserverInfo, ComponentChanged, GameObject, UpdateParams, Scene, LOAD_SCENE_MODE } from '@combos-fun/engine';
|
|
3
3
|
import EventEmitter from 'eventemitter3';
|
|
4
4
|
import { ApplicationOptions } from 'pixi.js';
|
|
5
5
|
|
|
6
|
+
interface Vector2 {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
interface Size2 {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
interface TransformMatrix {
|
|
15
|
+
a: number;
|
|
16
|
+
b: number;
|
|
17
|
+
c: number;
|
|
18
|
+
d: number;
|
|
19
|
+
tx: number;
|
|
20
|
+
ty: number;
|
|
21
|
+
array?: number[];
|
|
22
|
+
}
|
|
23
|
+
interface Transform2DParams extends ComponentParams {
|
|
24
|
+
position?: Vector2;
|
|
25
|
+
size?: Size2;
|
|
26
|
+
origin?: Vector2;
|
|
27
|
+
anchor?: Vector2;
|
|
28
|
+
scale?: Vector2;
|
|
29
|
+
skew?: Vector2;
|
|
30
|
+
rotation?: number;
|
|
31
|
+
}
|
|
32
|
+
/** 2D layout pose. Hierarchy lives on GameObject. */
|
|
33
|
+
declare class Transform2D extends Component<Transform2DParams> {
|
|
34
|
+
static componentName: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
worldTransform: TransformMatrix;
|
|
37
|
+
init(params?: Transform2DParams): void;
|
|
38
|
+
position: Vector2;
|
|
39
|
+
size: Size2;
|
|
40
|
+
origin: Vector2;
|
|
41
|
+
anchor: Vector2;
|
|
42
|
+
scale: Vector2;
|
|
43
|
+
skew: Vector2;
|
|
44
|
+
rotation: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
6
47
|
declare class ContainerManager {
|
|
7
48
|
containerMap: {
|
|
8
49
|
[propName: number]: Container;
|
|
@@ -13,9 +54,13 @@ declare class ContainerManager {
|
|
|
13
54
|
}): void;
|
|
14
55
|
getContainer(name: number): Container;
|
|
15
56
|
removeContainer(name: number): void;
|
|
16
|
-
updateTransform({ name, transform }: {
|
|
57
|
+
updateTransform({ name, transform, parentSize, }: {
|
|
17
58
|
name: number;
|
|
18
|
-
transform:
|
|
59
|
+
transform: Transform2D;
|
|
60
|
+
parentSize?: {
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
};
|
|
19
64
|
}): void;
|
|
20
65
|
}
|
|
21
66
|
|
|
@@ -70,10 +115,9 @@ declare class RendererManager {
|
|
|
70
115
|
update(gameObject: GameObject): void;
|
|
71
116
|
}
|
|
72
117
|
|
|
73
|
-
declare class
|
|
118
|
+
declare class PixiHierarchy extends EventEmitter {
|
|
74
119
|
name: string;
|
|
75
120
|
waitRemoveIds: number[];
|
|
76
|
-
waitSceneId: number;
|
|
77
121
|
system: Renderer;
|
|
78
122
|
containerManager: ContainerManager;
|
|
79
123
|
waitChangeScenes: {
|
|
@@ -87,9 +131,10 @@ declare class Transform extends EventEmitter {
|
|
|
87
131
|
});
|
|
88
132
|
init(system: Renderer): void;
|
|
89
133
|
update(): void;
|
|
134
|
+
ensureSceneContainer(scene: Scene): void;
|
|
135
|
+
ensureContainer(gameObject: GameObject, transform: Transform2D): void;
|
|
90
136
|
componentChanged(changed: ComponentChanged): void;
|
|
91
|
-
|
|
92
|
-
change(changed: ComponentChanged): void;
|
|
137
|
+
reparent(gameObject?: GameObject): void;
|
|
93
138
|
destroy(): void;
|
|
94
139
|
}
|
|
95
140
|
|
|
@@ -114,13 +159,14 @@ declare class Renderer extends System<Partial<ApplicationOptions>> {
|
|
|
114
159
|
containerManager: ContainerManager;
|
|
115
160
|
application: Application | null;
|
|
116
161
|
game: Game;
|
|
117
|
-
|
|
162
|
+
hierarchy: PixiHierarchy;
|
|
118
163
|
multiApps: Application[];
|
|
119
164
|
suportedCompressedTextureFormats: SuportedCompressedTexture;
|
|
120
165
|
init(params?: Partial<ApplicationOptions>): Promise<void>;
|
|
121
166
|
registerObserver(observerInfo: PureObserverInfo): void;
|
|
122
167
|
private createApplication;
|
|
123
168
|
update(): void;
|
|
169
|
+
private ensureTransform2D;
|
|
124
170
|
lateUpdate(e: any): void;
|
|
125
171
|
onDestroy(): void;
|
|
126
172
|
resize(width: any, height: any): void;
|
|
@@ -129,4 +175,5 @@ declare class Renderer extends System<Partial<ApplicationOptions>> {
|
|
|
129
175
|
/** Shared resource cache key separator used across renderer plugins */
|
|
130
176
|
declare const RESOURCE_KEY_SPLIT = "_s|r|c_";
|
|
131
177
|
|
|
132
|
-
export { ContainerManager, RENDERER_TYPE, RESOURCE_KEY_SPLIT, Renderer$1 as Renderer, RendererManager, Renderer as RendererSystem };
|
|
178
|
+
export { ContainerManager, RENDERER_TYPE, RESOURCE_KEY_SPLIT, Renderer$1 as Renderer, RendererManager, Renderer as RendererSystem, Transform2D };
|
|
179
|
+
export type { Transform2DParams, TransformMatrix };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
-
import { OBSERVER_TYPE, decorators, System, LOAD_SCENE_MODE } from '@combos-fun/engine';
|
|
2
|
+
import { OBSERVER_TYPE, Component, decorators, System, LOAD_SCENE_MODE } from '@combos-fun/engine';
|
|
3
3
|
import { Container, Application } from '@combos-fun/renderer-adapter';
|
|
4
4
|
import isEqual from 'lodash-es/isEqual';
|
|
5
5
|
import EventEmitter from 'eventemitter3';
|
|
6
|
+
import { Field } from '@combos-fun/inspector-decorator';
|
|
6
7
|
import { Ticker } from 'pixi.js';
|
|
7
8
|
|
|
8
9
|
class RendererManager {
|
|
@@ -81,7 +82,7 @@ class ContainerManager {
|
|
|
81
82
|
this.containerMap[name]?.destroy({ children: true });
|
|
82
83
|
delete this.containerMap[name];
|
|
83
84
|
}
|
|
84
|
-
updateTransform({ name, transform }) {
|
|
85
|
+
updateTransform({ name, transform, parentSize, }) {
|
|
85
86
|
const container = this.containerMap[name];
|
|
86
87
|
if (!container || !transform)
|
|
87
88
|
return;
|
|
@@ -93,19 +94,106 @@ class ContainerManager {
|
|
|
93
94
|
container.skew = skew;
|
|
94
95
|
let x = position.x;
|
|
95
96
|
let y = position.y;
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
y = y + parent.size.height * anchor.y;
|
|
97
|
+
if (parentSize) {
|
|
98
|
+
x = x + parentSize.width * anchor.x;
|
|
99
|
+
y = y + parentSize.height * anchor.y;
|
|
100
100
|
}
|
|
101
101
|
container.position = { x, y };
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
/** 2D layout pose. Hierarchy lives on GameObject. */
|
|
106
|
+
class Transform2D extends Component {
|
|
107
|
+
constructor() {
|
|
108
|
+
super(...arguments);
|
|
109
|
+
this.name = 'Transform2D';
|
|
110
|
+
this.position = { x: 0, y: 0 };
|
|
111
|
+
this.size = { width: 0, height: 0 };
|
|
112
|
+
this.origin = { x: 0, y: 0 };
|
|
113
|
+
this.anchor = { x: 0, y: 0 };
|
|
114
|
+
this.scale = { x: 1, y: 1 };
|
|
115
|
+
this.skew = { x: 0, y: 0 };
|
|
116
|
+
this.rotation = 0;
|
|
117
|
+
}
|
|
118
|
+
static { this.componentName = 'Transform2D'; }
|
|
119
|
+
init(params = {}) {
|
|
120
|
+
const props = ['position', 'size', 'origin', 'anchor', 'scale', 'skew'];
|
|
121
|
+
for (const key of props) {
|
|
122
|
+
Object.assign(this[key], params[key]);
|
|
123
|
+
}
|
|
124
|
+
this.rotation = params.rotation ?? this.rotation;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
__decorate([
|
|
128
|
+
Field({
|
|
129
|
+
type: 'vector2',
|
|
130
|
+
step: 1,
|
|
131
|
+
group: 'Transform2D',
|
|
132
|
+
label: 'Position',
|
|
133
|
+
description: 'Position on the design canvas (x right, y down).',
|
|
134
|
+
})
|
|
135
|
+
], Transform2D.prototype, "position", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
Field({
|
|
138
|
+
type: 'size',
|
|
139
|
+
step: 1,
|
|
140
|
+
min: 0,
|
|
141
|
+
group: 'Transform2D',
|
|
142
|
+
label: 'Size',
|
|
143
|
+
description: 'Width and height of the object in design pixels.',
|
|
144
|
+
})
|
|
145
|
+
], Transform2D.prototype, "size", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
Field({
|
|
148
|
+
type: 'vector2',
|
|
149
|
+
step: 0.1,
|
|
150
|
+
group: 'Transform2D',
|
|
151
|
+
label: 'Origin',
|
|
152
|
+
description: 'Local origin used for layout math.',
|
|
153
|
+
})
|
|
154
|
+
], Transform2D.prototype, "origin", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
Field({
|
|
157
|
+
type: 'vector2',
|
|
158
|
+
step: 0.1,
|
|
159
|
+
group: 'Transform2D',
|
|
160
|
+
label: 'Anchor',
|
|
161
|
+
description: 'Anchor point (0–1) used when positioning and scaling.',
|
|
162
|
+
})
|
|
163
|
+
], Transform2D.prototype, "anchor", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
Field({
|
|
166
|
+
type: 'vector2',
|
|
167
|
+
step: 0.1,
|
|
168
|
+
group: 'Transform2D',
|
|
169
|
+
label: 'Scale',
|
|
170
|
+
description: 'Scale multipliers on X and Y (1 = original size).',
|
|
171
|
+
})
|
|
172
|
+
], Transform2D.prototype, "scale", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
Field({
|
|
175
|
+
type: 'vector2',
|
|
176
|
+
step: 0.1,
|
|
177
|
+
group: 'Transform2D',
|
|
178
|
+
label: 'Skew',
|
|
179
|
+
description: 'Skew amounts on X and Y.',
|
|
180
|
+
})
|
|
181
|
+
], Transform2D.prototype, "skew", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
Field({
|
|
184
|
+
type: 'number',
|
|
185
|
+
step: 0.1,
|
|
186
|
+
group: 'Transform2D',
|
|
187
|
+
label: 'Rotation',
|
|
188
|
+
description: 'Rotation in radians.',
|
|
189
|
+
editor: 'number-stepper',
|
|
190
|
+
})
|
|
191
|
+
], Transform2D.prototype, "rotation", void 0);
|
|
192
|
+
|
|
193
|
+
let PixiHierarchy = class PixiHierarchy extends EventEmitter {
|
|
106
194
|
constructor({ system, containerManager }) {
|
|
107
195
|
super();
|
|
108
|
-
this.name = '
|
|
196
|
+
this.name = 'PixiHierarchy';
|
|
109
197
|
this.waitRemoveIds = [];
|
|
110
198
|
this.waitChangeScenes = [];
|
|
111
199
|
this.containerManager = containerManager;
|
|
@@ -114,12 +202,7 @@ let Transform = class Transform extends EventEmitter {
|
|
|
114
202
|
init(system) {
|
|
115
203
|
this.system = system;
|
|
116
204
|
this.on('changeScene', ({ scene, mode, application }) => {
|
|
117
|
-
// switch (mode) {
|
|
118
|
-
// case LOAD_SCENE_MODE.SINGLE:
|
|
119
205
|
this.waitChangeScenes.push({ scene, mode, application });
|
|
120
|
-
// break;
|
|
121
|
-
// case LOAD_SCENE_MODE.MULTI_CANVAS:
|
|
122
|
-
// }
|
|
123
206
|
});
|
|
124
207
|
}
|
|
125
208
|
update() {
|
|
@@ -128,7 +211,7 @@ let Transform = class Transform extends EventEmitter {
|
|
|
128
211
|
}
|
|
129
212
|
this.waitRemoveIds = [];
|
|
130
213
|
for (const sceneInfo of this.waitChangeScenes) {
|
|
131
|
-
|
|
214
|
+
this.ensureSceneContainer(sceneInfo.scene);
|
|
132
215
|
const container = this.containerManager.getContainer(sceneInfo.scene.id);
|
|
133
216
|
if (container) {
|
|
134
217
|
sceneInfo.application.stage.removeChildren();
|
|
@@ -137,43 +220,67 @@ let Transform = class Transform extends EventEmitter {
|
|
|
137
220
|
}
|
|
138
221
|
this.waitChangeScenes = [];
|
|
139
222
|
}
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
223
|
+
ensureSceneContainer(scene) {
|
|
224
|
+
if (this.containerManager.getContainer(scene.id))
|
|
225
|
+
return;
|
|
226
|
+
const container = new Container();
|
|
227
|
+
container.label = scene.name;
|
|
228
|
+
this.containerManager.addContainer({
|
|
229
|
+
name: scene.id,
|
|
230
|
+
container,
|
|
231
|
+
});
|
|
150
232
|
}
|
|
151
|
-
|
|
233
|
+
ensureContainer(gameObject, transform) {
|
|
234
|
+
if (this.containerManager.getContainer(gameObject.id)) {
|
|
235
|
+
transform.worldTransform = this.containerManager.getContainer(gameObject.id)
|
|
236
|
+
.worldTransform;
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
152
239
|
const container = new Container();
|
|
153
|
-
container.label =
|
|
240
|
+
container.label = gameObject.name;
|
|
154
241
|
this.containerManager.addContainer({
|
|
155
|
-
name:
|
|
242
|
+
name: gameObject.id,
|
|
156
243
|
container,
|
|
157
244
|
});
|
|
158
|
-
const transform = changed.component;
|
|
159
|
-
// Pixi v8 exposes `worldTransform` on the display object; nested `transform.worldTransform` is gone.
|
|
160
245
|
transform.worldTransform = container.worldTransform;
|
|
161
246
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
247
|
+
componentChanged(changed) {
|
|
248
|
+
if (changed.componentName === 'GameObject') {
|
|
249
|
+
this.reparent(changed.gameObject);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (changed.componentName !== 'Transform2D')
|
|
253
|
+
return;
|
|
254
|
+
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
255
|
+
this.ensureContainer(changed.gameObject, changed.component);
|
|
256
|
+
this.reparent(changed.gameObject);
|
|
257
|
+
}
|
|
258
|
+
else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
259
|
+
this.waitRemoveIds.push(changed.gameObject.id);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
reparent(gameObject) {
|
|
263
|
+
if (!gameObject)
|
|
264
|
+
return;
|
|
265
|
+
const container = this.containerManager.getContainer(gameObject.id);
|
|
266
|
+
if (!container)
|
|
267
|
+
return;
|
|
268
|
+
if (gameObject.parent) {
|
|
269
|
+
const parentContainer = this.containerManager.getContainer(gameObject.parent.id);
|
|
270
|
+
if (parentContainer && container.parent !== parentContainer) {
|
|
271
|
+
parentContainer.addChild(container);
|
|
272
|
+
}
|
|
273
|
+
const render = gameObject.parent.getComponent('Render');
|
|
169
274
|
if (render) {
|
|
170
275
|
render.sortDirty = true;
|
|
171
276
|
}
|
|
172
277
|
}
|
|
173
|
-
else {
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
278
|
+
else if (container.parent) {
|
|
279
|
+
const transform = gameObject.getComponent(Transform2D);
|
|
280
|
+
if (transform) {
|
|
281
|
+
delete transform.worldTransform;
|
|
282
|
+
}
|
|
283
|
+
container.parent.removeChild(container);
|
|
177
284
|
}
|
|
178
285
|
}
|
|
179
286
|
destroy() {
|
|
@@ -184,12 +291,13 @@ let Transform = class Transform extends EventEmitter {
|
|
|
184
291
|
this.containerManager = null;
|
|
185
292
|
}
|
|
186
293
|
};
|
|
187
|
-
|
|
294
|
+
PixiHierarchy = __decorate([
|
|
188
295
|
decorators.componentObserver({
|
|
189
|
-
|
|
296
|
+
GameObject: ['parent'],
|
|
297
|
+
Transform2D: [],
|
|
190
298
|
})
|
|
191
|
-
],
|
|
192
|
-
var
|
|
299
|
+
], PixiHierarchy);
|
|
300
|
+
var PixiHierarchy$1 = PixiHierarchy;
|
|
193
301
|
|
|
194
302
|
let result = undefined;
|
|
195
303
|
function getSuportCompressedTextureFormats(gl) {
|
|
@@ -248,7 +356,7 @@ let Renderer$1 = class Renderer extends System {
|
|
|
248
356
|
game: this.game,
|
|
249
357
|
rendererSystem: this,
|
|
250
358
|
});
|
|
251
|
-
this.
|
|
359
|
+
this.hierarchy = new PixiHierarchy$1({
|
|
252
360
|
system: this,
|
|
253
361
|
containerManager: this.containerManager,
|
|
254
362
|
});
|
|
@@ -262,7 +370,8 @@ let Renderer$1 = class Renderer extends System {
|
|
|
262
370
|
return;
|
|
263
371
|
}
|
|
264
372
|
scene.canvas = application.canvas;
|
|
265
|
-
this.
|
|
373
|
+
this.hierarchy.ensureSceneContainer(scene);
|
|
374
|
+
this.hierarchy.emit('changeScene', {
|
|
266
375
|
scene,
|
|
267
376
|
mode,
|
|
268
377
|
application,
|
|
@@ -309,24 +418,43 @@ let Renderer$1 = class Renderer extends System {
|
|
|
309
418
|
update() {
|
|
310
419
|
const changes = this.componentObserver.clear();
|
|
311
420
|
for (const changed of changes) {
|
|
312
|
-
|
|
421
|
+
if (changed.componentName === 'GameObject' && changed.gameObject) {
|
|
422
|
+
this.ensureTransform2D(changed.gameObject);
|
|
423
|
+
if (changed.gameObject.parent)
|
|
424
|
+
this.ensureTransform2D(changed.gameObject.parent);
|
|
425
|
+
}
|
|
426
|
+
this.hierarchy.componentChanged(changed);
|
|
313
427
|
}
|
|
314
428
|
if (!this.application) {
|
|
315
429
|
return;
|
|
316
430
|
}
|
|
317
431
|
for (const gameObject of this.game.gameObjects) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
432
|
+
const transform = gameObject.getComponent(Transform2D);
|
|
433
|
+
if (transform) {
|
|
434
|
+
this.containerManager.updateTransform({
|
|
435
|
+
name: gameObject.id,
|
|
436
|
+
transform,
|
|
437
|
+
parentSize: gameObject.parent?.getComponent(Transform2D)?.size,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
322
440
|
this.rendererManager.update(gameObject);
|
|
323
441
|
}
|
|
324
442
|
}
|
|
443
|
+
ensureTransform2D(gameObject) {
|
|
444
|
+
if (!gameObject || gameObject === gameObject.scene)
|
|
445
|
+
return;
|
|
446
|
+
let transform = gameObject.getComponent(Transform2D);
|
|
447
|
+
if (!transform) {
|
|
448
|
+
transform = gameObject.addComponent(new Transform2D());
|
|
449
|
+
}
|
|
450
|
+
this.hierarchy.ensureContainer(gameObject, transform);
|
|
451
|
+
this.hierarchy.reparent(gameObject);
|
|
452
|
+
}
|
|
325
453
|
lateUpdate(e) {
|
|
326
454
|
if (!this.application) {
|
|
327
455
|
return;
|
|
328
456
|
}
|
|
329
|
-
this.
|
|
457
|
+
this.hierarchy.update();
|
|
330
458
|
this.application.ticker.update(e.time);
|
|
331
459
|
}
|
|
332
460
|
onDestroy() {
|
|
@@ -334,8 +462,8 @@ let Renderer$1 = class Renderer extends System {
|
|
|
334
462
|
for (const app of this.multiApps) {
|
|
335
463
|
app && app.destroy();
|
|
336
464
|
}
|
|
337
|
-
this.
|
|
338
|
-
this.
|
|
465
|
+
this.hierarchy.destroy();
|
|
466
|
+
this.hierarchy = null;
|
|
339
467
|
this.params = null;
|
|
340
468
|
this.rendererManager = null;
|
|
341
469
|
this.containerManager = null;
|
|
@@ -353,7 +481,8 @@ let Renderer$1 = class Renderer extends System {
|
|
|
353
481
|
};
|
|
354
482
|
Renderer$1 = __decorate([
|
|
355
483
|
decorators.componentObserver({
|
|
356
|
-
|
|
484
|
+
GameObject: ['parent'],
|
|
485
|
+
Transform2D: [],
|
|
357
486
|
})
|
|
358
487
|
], Renderer$1);
|
|
359
488
|
var Renderer$2 = Renderer$1;
|
|
@@ -361,7 +490,7 @@ var Renderer$2 = Renderer$1;
|
|
|
361
490
|
/** Auto-generated by scripts/build-package.mjs — do not edit. */
|
|
362
491
|
Object.assign(Renderer$2, {
|
|
363
492
|
packageName: "@combos-fun/plugin-renderer",
|
|
364
|
-
packageVersion: "0.0
|
|
493
|
+
packageVersion: "0.2.0",
|
|
365
494
|
});
|
|
366
495
|
|
|
367
496
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -400,5 +529,5 @@ class Renderer extends System {
|
|
|
400
529
|
/** Shared resource cache key separator used across renderer plugins */
|
|
401
530
|
const RESOURCE_KEY_SPLIT = '_s|r|c_';
|
|
402
531
|
|
|
403
|
-
export { ContainerManager, RENDERER_TYPE, RESOURCE_KEY_SPLIT, Renderer, RendererManager, Renderer$2 as RendererSystem };
|
|
532
|
+
export { ContainerManager, RENDERER_TYPE, RESOURCE_KEY_SPLIT, Renderer, RendererManager, Renderer$2 as RendererSystem, Transform2D };
|
|
404
533
|
//# sourceMappingURL=plugin-renderer.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-renderer.esm.js","sources":["../lib/manager/RendererManager.ts","../lib/manager/ContainerManager.ts","../lib/Transform.ts","../lib/compressedTexture/ability.ts","../lib/System.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer.ts","../lib/index.ts"],"sourcesContent":["import isEqual from 'lodash-es/isEqual';\nimport { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport Renderer from '../Renderer';\nimport RendererSystem from '../System';\n\nclass RendererManager {\n game: Game;\n rendererSystem: RendererSystem;\n constructor({ game, rendererSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n renderers: Renderer[] = [];\n register(...renderers: Renderer[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this.rendererSystem.rendererManager;\n renderer.containerManager = this.rendererSystem.containerManager;\n this.renderers.push(renderer);\n }\n }\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (props) {\n if ([OBSERVER_TYPE.ADD, OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(`gameObject: ${changed.gameObject.name}, ${changed.componentName} is error.`, changed, e);\n }\n continue;\n }\n\n const index = props.findIndex(prop => {\n return isEqual(prop, changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject && changed.gameObject.name}, ${\n changed.componentName\n } is componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n }\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const cache = [];\n const props = renderer.observerInfo[component.name];\n if (props && cache.indexOf(gameObject) === -1) {\n cache.push(gameObject);\n try {\n renderer.rendererUpdate && renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(`gameObject: ${gameObject.name}, ${component.name} is update error`, e);\n }\n }\n }\n }\n }\n}\nexport default RendererManager;\n","import { Transform } from '@combos-fun/engine';\nimport { Point, ObservablePoint } from 'pixi.js';\nimport { Container } from '@combos-fun/renderer-adapter';\n\nexport default class ContainerManager {\n containerMap: { [propName: number]: Container } = {};\n addContainer({ name, container }: { name: number; container: Container }) {\n this.containerMap[name] = container;\n }\n getContainer(name: number) {\n return this.containerMap[name];\n }\n removeContainer(name: number) {\n this.containerMap[name]?.destroy({ children: true });\n delete this.containerMap[name];\n }\n updateTransform({ name, transform }: { name: number; transform: Transform }) {\n const container = this.containerMap[name];\n if (!container || !transform) return;\n const { anchor, origin, position, rotation, scale, size, skew } = transform;\n container.rotation = rotation;\n container.scale = scale as Point;\n container.pivot.x = size.width * origin.x;\n container.pivot.y = size.height * origin.y;\n container.skew = skew as ObservablePoint;\n let x = position.x;\n let y = position.y;\n if (transform.parent) {\n const parent = transform.parent;\n x = x + parent.size.width * anchor.x;\n y = y + parent.size.height * anchor.y;\n }\n\n container.position = { x, y } as Point;\n }\n}\n","import { Transform as Trans, decorators, ComponentChanged, OBSERVER_TYPE, Scene, LOAD_SCENE_MODE } from '@combos-fun/engine';\nimport EventEmitter from 'eventemitter3';\nimport { Application, Container } from '@combos-fun/renderer-adapter';\nimport Render from './System';\nimport ContainerManager from './manager/ContainerManager';\n\n/** Surface used from the Render component; avoids importing plugin-renderer-render (workspace cycle). */\ntype RenderSortDirty = { sortDirty: boolean };\n\n@decorators.componentObserver({\n Transform: ['_parent'],\n})\nexport default class Transform extends EventEmitter {\n name: string = 'Transform';\n waitRemoveIds: number[] = [];\n waitSceneId: number;\n system: Render;\n containerManager: ContainerManager;\n waitChangeScenes: {\n scene: Scene;\n mode: LOAD_SCENE_MODE;\n application: Application;\n }[] = [];\n constructor({ system, containerManager }) {\n super();\n this.containerManager = containerManager;\n this.init(system);\n }\n init(system: Render) {\n this.system = system;\n this.on('changeScene', ({ scene, mode, application }) => {\n // switch (mode) {\n // case LOAD_SCENE_MODE.SINGLE:\n this.waitChangeScenes.push({ scene, mode, application });\n // break;\n // case LOAD_SCENE_MODE.MULTI_CANVAS:\n\n // }\n });\n }\n update() {\n for (const id of this.waitRemoveIds) {\n this.containerManager.removeContainer(id);\n }\n this.waitRemoveIds = [];\n\n for (const sceneInfo of this.waitChangeScenes) {\n // set scene\n const container = this.containerManager.getContainer(sceneInfo.scene.id);\n if (container) {\n sceneInfo.application.stage.removeChildren();\n sceneInfo.application.stage.addChild(container);\n }\n }\n this.waitChangeScenes = [];\n }\n componentChanged(changed: ComponentChanged) {\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.addContainer(changed);\n } else if (changed.type === OBSERVER_TYPE.CHANGE) {\n this.change(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.waitRemoveIds.push(changed.gameObject.id);\n }\n }\n addContainer(changed: ComponentChanged) {\n const container = new Container();\n container.label = changed.gameObject.name;\n this.containerManager.addContainer({\n name: changed.gameObject.id,\n container,\n });\n const transform = changed.component as Trans;\n // Pixi v8 exposes `worldTransform` on the display object; nested `transform.worldTransform` is gone.\n transform.worldTransform = container.worldTransform as unknown as Trans['worldTransform'];\n }\n change(changed: ComponentChanged) {\n const transform = changed.component as Trans;\n if (transform.parent) {\n const parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id);\n parentContainer.addChild(this.containerManager.getContainer(changed.gameObject.id));\n\n const render =\n changed.gameObject.transform.parent &&\n (changed.gameObject.transform.parent.gameObject.getComponent('Render') as unknown as RenderSortDirty);\n if (render) {\n render.sortDirty = true;\n }\n } else {\n const container = this.containerManager.getContainer(changed.gameObject.id);\n delete transform.worldTransform;\n container.parent && container.parent.removeChild(container);\n }\n }\n destroy() {\n this.removeAllListeners();\n this.waitRemoveIds = null;\n this.waitChangeScenes = null;\n this.system = null;\n this.containerManager = null;\n }\n}\n","/**\n * Inspired by PixiJS v6\n */\nexport type CompressedTextureExtensions = {\n s3tc?: WEBGL_compressed_texture_s3tc,\n s3tc_sRGB: WEBGL_compressed_texture_s3tc_srgb,\n etc: WEBGL_compressed_texture_etc,\n etc1: WEBGL_compressed_texture_etc1,\n pvrtc: WEBKIT_WEBGL_compressed_texture_pvrtc,\n atc: WEBGL_compressed_texture_atc,\n astc: WEBGL_compressed_texture_astc\n};\nexport type CompressedTextureExtensionRef = keyof CompressedTextureExtensions;\nlet result = undefined;\nexport interface SuportedCompressedTexture {\n s3tc: boolean,\n etc: boolean,\n etc1: boolean,\n pvrtc: boolean,\n atc: boolean,\n astc: boolean,\n}\nexport function getSuportCompressedTextureFormats(gl: WebGLRenderingContext): SuportedCompressedTexture {\n if (result) return result;\n\n if (!gl) {\n // #if _DEBUG\n console.warn('WebGL not available for compressed textures. Silently failing.');\n // #endif\n\n return {\n s3tc: false,\n etc: false,\n etc1: false,\n pvrtc: false,\n atc: false,\n astc: false,\n };\n }\n\n result = {\n s3tc: !!gl.getExtension('WEBGL_compressed_texture_s3tc'),\n etc: !!gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: !!gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: !!gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || !!gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: !!gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: !!gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n try {\n console.log('Supported compressed texture formats: ' + Object.keys(result).filter((type) => result[type]).join(', '))\n } catch (e) { }\n return result;\n}","import { System, decorators, Game, LOAD_SCENE_MODE, PureObserverInfo } from '@combos-fun/engine';\nimport { Application } from '@combos-fun/renderer-adapter';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport Transform from './Transform';\nimport { Ticker } from 'pixi.js';\nimport type { ApplicationOptions } from 'pixi.js';\nimport type { Renderer as PixiRenderer } from 'pixi.js';\nimport type { WebGLRenderer } from 'pixi.js';\nimport { registerCompressedTexture } from './compressedTexture';\nimport { SuportedCompressedTexture, getSuportCompressedTextureFormats } from './compressedTexture/ability';\n\nexport enum RENDERER_TYPE {\n UNKNOWN = 0,\n WEBGL = 1,\n CANVAS = 2,\n}\n\n@decorators.componentObserver({\n Transform: ['_parent'],\n})\nexport default class Renderer extends System<Partial<ApplicationOptions>> {\n static systemName: string = 'Renderer';\n params: Partial<ApplicationOptions>;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n application: Application | null = null;\n game: Game;\n transform: Transform;\n multiApps: Application[] = [];\n suportedCompressedTextureFormats: SuportedCompressedTexture;\n\n async init(params?: Partial<ApplicationOptions>) {\n this.params = params ?? {};\n const app = await this.createApplication(this.params);\n this.application = app;\n this.game.canvas = app.canvas;\n this.containerManager = new ContainerManager();\n this.rendererManager = new RendererManager({\n game: this.game,\n rendererSystem: this,\n });\n\n this.transform = new Transform({\n system: this,\n containerManager: this.containerManager,\n });\n this.game.on('sceneChanged', async ({ scene, mode, params: sceneParams }) => {\n let application: Application | null = this.application;\n if (mode === LOAD_SCENE_MODE.MULTI_CANVAS) {\n application = await this.createApplication(sceneParams);\n this.multiApps.push(application);\n }\n if (!application) {\n return;\n }\n scene.canvas = application.canvas;\n this.transform.emit('changeScene', {\n scene,\n mode,\n application,\n });\n });\n\n const gl = (app.renderer as WebGLRenderer).gl;\n if (gl) {\n this.suportedCompressedTextureFormats = getSuportCompressedTextureFormats(gl);\n registerCompressedTexture(gl);\n }\n }\n\n registerObserver(observerInfo: PureObserverInfo): void {\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n if (!Ctor.observerInfo) {\n Ctor.observerInfo = {} as PureObserverInfo;\n }\n const thisObserverInfo = Ctor.observerInfo;\n for (const key in observerInfo) {\n if (!thisObserverInfo[key]) {\n thisObserverInfo[key] = [];\n }\n thisObserverInfo[key].push(...observerInfo[key]);\n }\n }\n\n private async createApplication(params: Partial<ApplicationOptions>): Promise<Application> {\n const initOptions: Partial<ApplicationOptions> = {\n ...params,\n autoStart: true,\n sharedTicker: true,\n };\n\n const app = new Application();\n try {\n await app.init(initOptions);\n } catch {\n await app.init({\n ...initOptions,\n preference: 'canvas',\n });\n }\n\n Ticker.shared.stop();\n Ticker.shared.autoStart = false;\n\n return app;\n }\n\n update() {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.transform.componentChanged(changed);\n }\n if (!this.application) {\n return;\n }\n for (const gameObject of this.game.gameObjects) {\n this.containerManager.updateTransform({\n name: gameObject.id,\n transform: gameObject.transform,\n });\n this.rendererManager.update(gameObject);\n }\n }\n\n lateUpdate(e) {\n if (!this.application) {\n return;\n }\n this.transform.update();\n this.application.ticker.update(e.time);\n }\n\n onDestroy() {\n this.application?.destroy();\n for (const app of this.multiApps) {\n app && app.destroy();\n }\n this.transform.destroy();\n this.transform = null;\n this.params = null;\n this.rendererManager = null;\n this.containerManager = null;\n this.application = null;\n this.game = null;\n this.multiApps = null;\n }\n\n resize(width, height) {\n if (!this.application) {\n return;\n }\n this.params = { ...this.params, width, height };\n this.application.renderer.resize(width, height);\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer from './System';\n\nObject.assign(Renderer, {\n packageName: \"@combos-fun/plugin-renderer\",\n packageVersion: \"0.0.54\",\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { GameObject, Game, PureObserverInfo, ComponentChanged, System, UpdateParams } from '@combos-fun/engine';\nimport ContainerManager from './manager/ContainerManager';\nimport RendererManager from './manager/RendererManager';\n\nexport default class Renderer<T extends {} = {}> extends System<T> {\n /**\n * Renderer name\n */\n name: string;\n\n /**\n * currentGame\n */\n game: Game;\n\n /**\n * observer component props info\n */\n static observerInfo: PureObserverInfo;\n\n /**\n * observer component props info\n */\n observerInfo: PureObserverInfo;\n\n /**\n * containerManager\n */\n containerManager: ContainerManager;\n rendererManager: RendererManager;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n // init(arg?: any): void;\n\n /**\n * Called when an observed component property changes.\n */\n componentChanged(_changed: ComponentChanged) { }\n\n /**\n * Called every frame.\n * @param _gameObject gameObject\n */\n rendererUpdate(_gameObject: GameObject) { }\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {}\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import RendererSystem, { RENDERER_TYPE } from './System';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport Renderer from './Renderer';\n\n/** Shared resource cache key separator used across renderer plugins */\nexport const RESOURCE_KEY_SPLIT = '_s|r|c_';\n\nexport { RendererManager, ContainerManager, RendererSystem, RENDERER_TYPE, Renderer };\n\n"],"names":["Renderer","Transform"],"mappings":";;;;;;;AAKA,MAAM,eAAe,CAAA;AAGnB,IAAA,WAAA,CAAY,EAAE,IAAI,EAAE,cAAc,EAAE,EAAA;QAIpC,IAAA,CAAA,SAAS,GAAe,EAAE;AAHxB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc;IACtC;IAEA,QAAQ,CAAC,GAAG,SAAqB,EAAA;AAC/B,QAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;AAChC,YAAA,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;YACzB,QAAQ,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe;YAC9D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB;AAChE,YAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC/B;IACF;AACA,IAAA,gBAAgB,CAAC,OAA2B,EAAA;AAC1C,QAAA,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE;AAC7B,YAAA,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;gBACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC;gBAC1D,IAAI,KAAK,EAAE;oBACT,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,CA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Hierarchy.ts","../lib/compressedTexture/ability.ts","../lib/System.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer.ts","../lib/index.ts"],"sourcesContent":["import isEqual from 'lodash-es/isEqual';\nimport { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport Renderer from '../Renderer';\nimport RendererSystem from '../System';\n\nclass RendererManager {\n game: Game;\n rendererSystem: RendererSystem;\n constructor({ game, rendererSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n renderers: Renderer[] = [];\n register(...renderers: Renderer[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this.rendererSystem.rendererManager;\n renderer.containerManager = this.rendererSystem.containerManager;\n this.renderers.push(renderer);\n }\n }\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (props) {\n if ([OBSERVER_TYPE.ADD, OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(`gameObject: ${changed.gameObject.name}, ${changed.componentName} is error.`, changed, e);\n }\n continue;\n }\n\n const index = props.findIndex(prop => {\n return isEqual(prop, changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged && renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject && changed.gameObject.name}, ${\n changed.componentName\n } is componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n }\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const cache = [];\n const props = renderer.observerInfo[component.name];\n if (props && cache.indexOf(gameObject) === -1) {\n cache.push(gameObject);\n try {\n renderer.rendererUpdate && renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(`gameObject: ${gameObject.name}, ${component.name} is update error`, e);\n }\n }\n }\n }\n }\n}\nexport default RendererManager;\n","import { Point, ObservablePoint } from 'pixi.js';\nimport { Container } from '@combos-fun/renderer-adapter';\nimport type Transform2D from '../Transform2D';\n\nexport default class ContainerManager {\n containerMap: { [propName: number]: Container } = {};\n addContainer({ name, container }: { name: number; container: Container }) {\n this.containerMap[name] = container;\n }\n getContainer(name: number) {\n return this.containerMap[name];\n }\n removeContainer(name: number) {\n this.containerMap[name]?.destroy({ children: true });\n delete this.containerMap[name];\n }\n updateTransform({\n name,\n transform,\n parentSize,\n }: {\n name: number;\n transform: Transform2D;\n parentSize?: { width: number; height: number };\n }) {\n const container = this.containerMap[name];\n if (!container || !transform) return;\n const { anchor, origin, position, rotation, scale, size, skew } = transform;\n container.rotation = rotation;\n container.scale = scale as Point;\n container.pivot.x = size.width * origin.x;\n container.pivot.y = size.height * origin.y;\n container.skew = skew as ObservablePoint;\n let x = position.x;\n let y = position.y;\n if (parentSize) {\n x = x + parentSize.width * anchor.x;\n y = y + parentSize.height * anchor.y;\n }\n\n container.position = { x, y } as Point;\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport type { ComponentParams } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\ninterface Vector2 {\n x: number;\n y: number;\n}\n\ninterface Size2 {\n width: number;\n height: number;\n}\n\nexport interface TransformMatrix {\n a: number;\n b: number;\n c: number;\n d: number;\n tx: number;\n ty: number;\n array?: number[];\n}\n\nexport interface Transform2DParams extends ComponentParams {\n position?: Vector2;\n size?: Size2;\n origin?: Vector2;\n anchor?: Vector2;\n scale?: Vector2;\n skew?: Vector2;\n rotation?: number;\n}\n\n/** 2D layout pose. Hierarchy lives on GameObject. */\nclass Transform2D extends Component<Transform2DParams> {\n static componentName: string = 'Transform2D';\n readonly name: string = 'Transform2D';\n\n worldTransform: TransformMatrix;\n\n init(params: Transform2DParams = {}) {\n const props = ['position', 'size', 'origin', 'anchor', 'scale', 'skew'];\n for (const key of props) {\n Object.assign(this[key], params[key]);\n }\n this.rotation = params.rotation ?? this.rotation;\n }\n\n @Field({\n type: 'vector2',\n step: 1,\n group: 'Transform2D',\n label: 'Position',\n description: 'Position on the design canvas (x right, y down).',\n })\n position: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'size',\n step: 1,\n min: 0,\n group: 'Transform2D',\n label: 'Size',\n description: 'Width and height of the object in design pixels.',\n })\n size: Size2 = {width: 0, height: 0};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Origin',\n description: 'Local origin used for layout math.',\n })\n origin: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Anchor',\n description: 'Anchor point (0–1) used when positioning and scaling.',\n })\n anchor: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Scale',\n description: 'Scale multipliers on X and Y (1 = original size).',\n })\n scale: Vector2 = {x: 1, y: 1};\n\n @Field({\n type: 'vector2',\n step: 0.1,\n group: 'Transform2D',\n label: 'Skew',\n description: 'Skew amounts on X and Y.',\n })\n skew: Vector2 = {x: 0, y: 0};\n\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform2D',\n label: 'Rotation',\n description: 'Rotation in radians.',\n editor: 'number-stepper',\n })\n rotation: number = 0;\n}\n\nexport default Transform2D;\n","import { decorators, ComponentChanged, OBSERVER_TYPE, Scene, LOAD_SCENE_MODE, GameObject } from '@combos-fun/engine';\nimport EventEmitter from 'eventemitter3';\nimport { Application, Container } from '@combos-fun/renderer-adapter';\nimport Render from './System';\nimport ContainerManager from './manager/ContainerManager';\nimport Transform2D from './Transform2D';\n\ntype RenderSortDirty = { sortDirty: boolean };\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n Transform2D: [],\n})\nexport default class PixiHierarchy extends EventEmitter {\n name: string = 'PixiHierarchy';\n waitRemoveIds: number[] = [];\n system: Render;\n containerManager: ContainerManager;\n waitChangeScenes: {\n scene: Scene;\n mode: LOAD_SCENE_MODE;\n application: Application;\n }[] = [];\n constructor({ system, containerManager }) {\n super();\n this.containerManager = containerManager;\n this.init(system);\n }\n init(system: Render) {\n this.system = system;\n this.on('changeScene', ({ scene, mode, application }) => {\n this.waitChangeScenes.push({ scene, mode, application });\n });\n }\n update() {\n for (const id of this.waitRemoveIds) {\n this.containerManager.removeContainer(id);\n }\n this.waitRemoveIds = [];\n\n for (const sceneInfo of this.waitChangeScenes) {\n this.ensureSceneContainer(sceneInfo.scene);\n const container = this.containerManager.getContainer(sceneInfo.scene.id);\n if (container) {\n sceneInfo.application.stage.removeChildren();\n sceneInfo.application.stage.addChild(container);\n }\n }\n this.waitChangeScenes = [];\n }\n ensureSceneContainer(scene: Scene) {\n if (this.containerManager.getContainer(scene.id)) return;\n const container = new Container();\n container.label = scene.name;\n this.containerManager.addContainer({\n name: scene.id,\n container,\n });\n }\n ensureContainer(gameObject: GameObject, transform: Transform2D) {\n if (this.containerManager.getContainer(gameObject.id)) {\n transform.worldTransform = this.containerManager.getContainer(gameObject.id)\n .worldTransform as unknown as Transform2D['worldTransform'];\n return;\n }\n const container = new Container();\n container.label = gameObject.name;\n this.containerManager.addContainer({\n name: gameObject.id,\n container,\n });\n transform.worldTransform = container.worldTransform as unknown as Transform2D['worldTransform'];\n }\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'GameObject') {\n this.reparent(changed.gameObject);\n return;\n }\n if (changed.componentName !== 'Transform2D') return;\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.ensureContainer(changed.gameObject, changed.component as Transform2D);\n this.reparent(changed.gameObject);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.waitRemoveIds.push(changed.gameObject.id);\n }\n }\n reparent(gameObject?: GameObject) {\n if (!gameObject) return;\n const container = this.containerManager.getContainer(gameObject.id);\n if (!container) return;\n if (gameObject.parent) {\n const parentContainer = this.containerManager.getContainer(gameObject.parent.id);\n if (parentContainer && container.parent !== parentContainer) {\n parentContainer.addChild(container);\n }\n const render = gameObject.parent.getComponent('Render') as unknown as RenderSortDirty;\n if (render) {\n render.sortDirty = true;\n }\n } else if (container.parent) {\n const transform = gameObject.getComponent(Transform2D);\n if (transform) {\n delete transform.worldTransform;\n }\n container.parent.removeChild(container);\n }\n }\n destroy() {\n this.removeAllListeners();\n this.waitRemoveIds = null;\n this.waitChangeScenes = null;\n this.system = null;\n this.containerManager = null;\n }\n}\n","/**\n * Inspired by PixiJS v6\n */\nexport type CompressedTextureExtensions = {\n s3tc?: WEBGL_compressed_texture_s3tc,\n s3tc_sRGB: WEBGL_compressed_texture_s3tc_srgb,\n etc: WEBGL_compressed_texture_etc,\n etc1: WEBGL_compressed_texture_etc1,\n pvrtc: WEBKIT_WEBGL_compressed_texture_pvrtc,\n atc: WEBGL_compressed_texture_atc,\n astc: WEBGL_compressed_texture_astc\n};\nexport type CompressedTextureExtensionRef = keyof CompressedTextureExtensions;\nlet result = undefined;\nexport interface SuportedCompressedTexture {\n s3tc: boolean,\n etc: boolean,\n etc1: boolean,\n pvrtc: boolean,\n atc: boolean,\n astc: boolean,\n}\nexport function getSuportCompressedTextureFormats(gl: WebGLRenderingContext): SuportedCompressedTexture {\n if (result) return result;\n\n if (!gl) {\n // #if _DEBUG\n console.warn('WebGL not available for compressed textures. Silently failing.');\n // #endif\n\n return {\n s3tc: false,\n etc: false,\n etc1: false,\n pvrtc: false,\n atc: false,\n astc: false,\n };\n }\n\n result = {\n s3tc: !!gl.getExtension('WEBGL_compressed_texture_s3tc'),\n etc: !!gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: !!gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: !!gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || !!gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: !!gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: !!gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n try {\n console.log('Supported compressed texture formats: ' + Object.keys(result).filter((type) => result[type]).join(', '))\n } catch (e) { }\n return result;\n}","import { System, decorators, Game, LOAD_SCENE_MODE, PureObserverInfo } from '@combos-fun/engine';\nimport { Application } from '@combos-fun/renderer-adapter';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport PixiHierarchy from './PixiHierarchy';\nimport Transform2D from './Transform2D';\nimport { Ticker } from 'pixi.js';\nimport type { ApplicationOptions } from 'pixi.js';\nimport type { Renderer as PixiRenderer } from 'pixi.js';\nimport type { WebGLRenderer } from 'pixi.js';\nimport { registerCompressedTexture } from './compressedTexture';\nimport { SuportedCompressedTexture, getSuportCompressedTextureFormats } from './compressedTexture/ability';\n\nexport enum RENDERER_TYPE {\n UNKNOWN = 0,\n WEBGL = 1,\n CANVAS = 2,\n}\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n Transform2D: [],\n})\nexport default class Renderer extends System<Partial<ApplicationOptions>> {\n static systemName: string = 'Renderer';\n params: Partial<ApplicationOptions>;\n rendererManager: RendererManager;\n containerManager: ContainerManager;\n application: Application | null = null;\n game: Game;\n hierarchy: PixiHierarchy;\n multiApps: Application[] = [];\n suportedCompressedTextureFormats: SuportedCompressedTexture;\n\n async init(params?: Partial<ApplicationOptions>) {\n this.params = params ?? {};\n const app = await this.createApplication(this.params);\n this.application = app;\n this.game.canvas = app.canvas;\n this.containerManager = new ContainerManager();\n this.rendererManager = new RendererManager({\n game: this.game,\n rendererSystem: this,\n });\n\n this.hierarchy = new PixiHierarchy({\n system: this,\n containerManager: this.containerManager,\n });\n this.game.on('sceneChanged', async ({ scene, mode, params: sceneParams }) => {\n let application: Application | null = this.application;\n if (mode === LOAD_SCENE_MODE.MULTI_CANVAS) {\n application = await this.createApplication(sceneParams);\n this.multiApps.push(application);\n }\n if (!application) {\n return;\n }\n scene.canvas = application.canvas;\n this.hierarchy.ensureSceneContainer(scene);\n this.hierarchy.emit('changeScene', {\n scene,\n mode,\n application,\n });\n });\n\n const gl = (app.renderer as WebGLRenderer).gl;\n if (gl) {\n this.suportedCompressedTextureFormats = getSuportCompressedTextureFormats(gl);\n registerCompressedTexture(gl);\n }\n }\n\n registerObserver(observerInfo: PureObserverInfo): void {\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n if (!Ctor.observerInfo) {\n Ctor.observerInfo = {} as PureObserverInfo;\n }\n const thisObserverInfo = Ctor.observerInfo;\n for (const key in observerInfo) {\n if (!thisObserverInfo[key]) {\n thisObserverInfo[key] = [];\n }\n thisObserverInfo[key].push(...observerInfo[key]);\n }\n }\n\n private async createApplication(params: Partial<ApplicationOptions>): Promise<Application> {\n const initOptions: Partial<ApplicationOptions> = {\n ...params,\n autoStart: true,\n sharedTicker: true,\n };\n\n const app = new Application();\n try {\n await app.init(initOptions);\n } catch {\n await app.init({\n ...initOptions,\n preference: 'canvas',\n });\n }\n\n Ticker.shared.stop();\n Ticker.shared.autoStart = false;\n\n return app;\n }\n\n update() {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n if (changed.componentName === 'GameObject' && changed.gameObject) {\n this.ensureTransform2D(changed.gameObject);\n if (changed.gameObject.parent) this.ensureTransform2D(changed.gameObject.parent);\n }\n this.hierarchy.componentChanged(changed);\n }\n if (!this.application) {\n return;\n }\n for (const gameObject of this.game.gameObjects) {\n const transform = gameObject.getComponent(Transform2D);\n if (transform) {\n this.containerManager.updateTransform({\n name: gameObject.id,\n transform,\n parentSize: gameObject.parent?.getComponent(Transform2D)?.size,\n });\n }\n this.rendererManager.update(gameObject);\n }\n }\n\n private ensureTransform2D(gameObject: Game['gameObjects'][number]) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform2D);\n if (!transform) {\n transform = gameObject.addComponent(new Transform2D());\n }\n this.hierarchy.ensureContainer(gameObject, transform);\n this.hierarchy.reparent(gameObject);\n }\n\n lateUpdate(e) {\n if (!this.application) {\n return;\n }\n this.hierarchy.update();\n this.application.ticker.update(e.time);\n }\n\n onDestroy() {\n this.application?.destroy();\n for (const app of this.multiApps) {\n app && app.destroy();\n }\n this.hierarchy.destroy();\n this.hierarchy = null;\n this.params = null;\n this.rendererManager = null;\n this.containerManager = null;\n this.application = null;\n this.game = null;\n this.multiApps = null;\n }\n\n resize(width, height) {\n if (!this.application) {\n return;\n }\n this.params = { ...this.params, width, height };\n this.application.renderer.resize(width, height);\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer from './System';\n\nObject.assign(Renderer, {\n packageName: \"@combos-fun/plugin-renderer\",\n packageVersion: \"0.2.0\",\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport { GameObject, Game, PureObserverInfo, ComponentChanged, System, UpdateParams } from '@combos-fun/engine';\nimport ContainerManager from './manager/ContainerManager';\nimport RendererManager from './manager/RendererManager';\n\nexport default class Renderer<T extends {} = {}> extends System<T> {\n /**\n * Renderer name\n */\n name: string;\n\n /**\n * currentGame\n */\n game: Game;\n\n /**\n * observer component props info\n */\n static observerInfo: PureObserverInfo;\n\n /**\n * observer component props info\n */\n observerInfo: PureObserverInfo;\n\n /**\n * containerManager\n */\n containerManager: ContainerManager;\n rendererManager: RendererManager;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n // init(arg?: any): void;\n\n /**\n * Called when an observed component property changes.\n */\n componentChanged(_changed: ComponentChanged) { }\n\n /**\n * Called every frame.\n * @param _gameObject gameObject\n */\n rendererUpdate(_gameObject: GameObject) { }\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {}\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import RendererSystem, { RENDERER_TYPE } from './System';\nimport RendererManager from './manager/RendererManager';\nimport ContainerManager from './manager/ContainerManager';\nimport Renderer from './Renderer';\nimport Transform2D from './Transform2D';\n\n/** Shared resource cache key separator used across renderer plugins */\nexport const RESOURCE_KEY_SPLIT = '_s|r|c_';\n\nexport type { Transform2DParams, TransformMatrix } from './Transform2D';\nexport { RendererManager, ContainerManager, RendererSystem, RENDERER_TYPE, Renderer, Transform2D };\n\n"],"names":["Renderer","PixiHierarchy"],"mappings":";;;;;;;;AAKA,MAAM,eAAe,CAAA;AAGnB,IAAA,WAAA,CAAY,EAAE,IAAI,EAAE,cAAc,EAAE,EAAA;QAIpC,IAAA,CAAA,SAAS,GAAe,EAAE;AAHxB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc;IACtC;IAEA,QAAQ,CAAC,GAAG,SAAqB,EAAA;AAC/B,QAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;AAChC,YAAA,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;YACzB,QAAQ,CAAC,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe;YAC9D,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB;AAChE,YAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC/B;IACF;AACA,IAAA,gBAAgB,CAAC,OAA2B,EAAA;AAC1C,QAAA,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE;AAC7B,YAAA,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;gBACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC;gBAC1D,IAAI,KAAK,EAAE;oBACT,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;AACx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;;AAIA;;AAEG;IACH,gBAAgB,CAAC,QAA0B,EAAA,EAAI;AAE/C;;;AAGG;IACH,cAAc,CAAC,WAAuB,EAAA,EAAI;AAEjC,IAAA,MAAM,CAAC,CAAgB,EAAA;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;AAC9C,QAAA,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE;AAC7B,YAAA,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;QAChC;IACF;AAIU,IAAA,eAAe,CAAC,EAAU,EAAA;AAClC,QAAA,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;AACpD,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;IAC5B;IAEU,eAAe,CAAC,EAAU,EAAE,OAAe,EAAA;QACnD,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,OAAO;IACxC;AACD;;AC/DD;AACO,MAAM,kBAAkB,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "2D rendering foundation",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer.esm.js",
|
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
"lodash-es": "^4.17.21",
|
|
41
41
|
"pixi.js": "^8.18.1",
|
|
42
42
|
"resource-loader": "^4.0.0-rc4",
|
|
43
|
-
"@combos-fun/
|
|
44
|
-
"@combos-fun/
|
|
43
|
+
"@combos-fun/renderer-adapter": "0.2.0",
|
|
44
|
+
"@combos-fun/engine": "0.2.0",
|
|
45
|
+
"@combos-fun/inspector-decorator": "0.2.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
47
48
|
"build": "node ../../scripts/build-package.mjs"
|