@galacean/effects 1.1.3 → 1.1.4
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/dist/index.js +101 -90
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +101 -90
- package/dist/index.mjs.map +1 -1
- package/dist/weapp.js +100 -89
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +100 -89
- package/dist/weapp.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime player for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v1.1.
|
|
6
|
+
* Version: v1.1.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -14729,6 +14729,9 @@ var VFXItem = /** @class */ (function () {
|
|
|
14729
14729
|
VFXItem.isTree = function (item) {
|
|
14730
14730
|
return item.type === ItemType$1.tree;
|
|
14731
14731
|
};
|
|
14732
|
+
VFXItem.isCamera = function (item) {
|
|
14733
|
+
return item.type === ItemType$1.camera;
|
|
14734
|
+
};
|
|
14732
14735
|
VFXItem.isExtraCamera = function (item) {
|
|
14733
14736
|
return item.id === 'extra-camera' && item.name === 'extra-camera';
|
|
14734
14737
|
};
|
|
@@ -14929,10 +14932,11 @@ var VFXItem = /** @class */ (function () {
|
|
|
14929
14932
|
}
|
|
14930
14933
|
else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
14931
14934
|
this._contentVisible = false;
|
|
14935
|
+
shouldUpdate = true;
|
|
14936
|
+
dt = 0;
|
|
14932
14937
|
// 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
|
|
14933
14938
|
if (this.type === ItemType$1.composition) {
|
|
14934
14939
|
this.handleVisibleChanged(false);
|
|
14935
|
-
this.onItemUpdate(0, lifetime);
|
|
14936
14940
|
}
|
|
14937
14941
|
}
|
|
14938
14942
|
lifetime = Math.min(lifetime, 1);
|
|
@@ -15516,10 +15520,6 @@ var CameraVFXItem = /** @class */ (function (_super) {
|
|
|
15516
15520
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.update(lifetime);
|
|
15517
15521
|
this.updateCamera();
|
|
15518
15522
|
};
|
|
15519
|
-
// override onEnd () {
|
|
15520
|
-
// this.controller?.update(1);
|
|
15521
|
-
// this.updateCamera();
|
|
15522
|
-
// }
|
|
15523
15523
|
CameraVFXItem.prototype.updateCamera = function () {
|
|
15524
15524
|
if (this.controller && this.composition) {
|
|
15525
15525
|
var camera = this.composition.camera;
|
|
@@ -23564,7 +23564,7 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23564
23564
|
configurable: true
|
|
23565
23565
|
});
|
|
23566
23566
|
ParticleSystem.prototype.updateEmitterTransform = function (time) {
|
|
23567
|
-
var parentTransform = this.parentTransform;
|
|
23567
|
+
var parentTransform = this.transform.parentTransform;
|
|
23568
23568
|
var _a = this.basicTransform, path = _a.path, position = _a.position;
|
|
23569
23569
|
var selfPos = position.clone();
|
|
23570
23570
|
if (path) {
|
|
@@ -23574,9 +23574,9 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23574
23574
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
23575
23575
|
if (this.options.particleFollowParent && parentTransform) {
|
|
23576
23576
|
var tempMatrix = parentTransform.getWorldMatrix();
|
|
23577
|
-
this.particleMesh.mesh.worldMatrix = tempMatrix
|
|
23577
|
+
this.particleMesh.mesh.worldMatrix = tempMatrix;
|
|
23578
23578
|
if (this.trailMesh) {
|
|
23579
|
-
this.trailMesh.mesh.worldMatrix = tempMatrix
|
|
23579
|
+
this.trailMesh.mesh.worldMatrix = tempMatrix;
|
|
23580
23580
|
}
|
|
23581
23581
|
}
|
|
23582
23582
|
};
|
|
@@ -23595,8 +23595,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23595
23595
|
link.pushNode(linkContent);
|
|
23596
23596
|
this.particleMesh.setPoint(point, pointIndex);
|
|
23597
23597
|
this.clearPointTrail(pointIndex);
|
|
23598
|
-
if (this.
|
|
23599
|
-
this.trailMesh.setPointStartPos(pointIndex, this.parentTransform.position.clone());
|
|
23598
|
+
if (this.trailMesh) {
|
|
23599
|
+
this.trailMesh.setPointStartPos(pointIndex, this.transform.parentTransform.position.clone());
|
|
23600
23600
|
}
|
|
23601
23601
|
};
|
|
23602
23602
|
ParticleSystem.prototype.setVisible = function (visible) {
|
|
@@ -23634,7 +23634,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23634
23634
|
}
|
|
23635
23635
|
};
|
|
23636
23636
|
ParticleSystem.prototype.setParentTransform = function (transform) {
|
|
23637
|
-
this.parentTransform = transform;
|
|
23637
|
+
// this.transform.parentTransform = transform;
|
|
23638
|
+
// this.parentTransform = transform;
|
|
23638
23639
|
};
|
|
23639
23640
|
ParticleSystem.prototype.getTextures = function () {
|
|
23640
23641
|
var e_1, _a, e_2, _b;
|
|
@@ -23927,8 +23928,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23927
23928
|
if (trails.sizeAffectsLifetime) {
|
|
23928
23929
|
lifetime *= size[0];
|
|
23929
23930
|
}
|
|
23930
|
-
if (trails.parentAffectsPosition && this.parentTransform) {
|
|
23931
|
-
position.add(this.parentTransform.position);
|
|
23931
|
+
if (trails.parentAffectsPosition && this.transform.parentTransform) {
|
|
23932
|
+
position.add(this.transform.parentTransform.position);
|
|
23932
23933
|
var pos = this.trailMesh.getPointStartPos(pointIndex);
|
|
23933
23934
|
if (pos) {
|
|
23934
23935
|
position.subtract(pos);
|
|
@@ -24168,12 +24169,11 @@ var ParticleVFXItem = /** @class */ (function (_super) {
|
|
|
24168
24169
|
ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
|
|
24169
24170
|
var _a;
|
|
24170
24171
|
if (this.content) {
|
|
24171
|
-
var hide = !this.
|
|
24172
|
+
var hide = !this.visible;
|
|
24172
24173
|
var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
|
|
24173
24174
|
if (!hide && parentItem) {
|
|
24174
24175
|
var parentData = parentItem.getRenderData();
|
|
24175
24176
|
if (parentData) {
|
|
24176
|
-
this.content.setParentTransform(parentData.transform);
|
|
24177
24177
|
if (!parentData.visible) {
|
|
24178
24178
|
hide = false;
|
|
24179
24179
|
}
|
|
@@ -29176,7 +29176,6 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29176
29176
|
}
|
|
29177
29177
|
var cachedTextures = textureOptions.map(function (option) { return option && (option instanceof Texture ? option : Texture.create(engine, option)); });
|
|
29178
29178
|
// 缓存创建的Texture对象
|
|
29179
|
-
// @ts-expect-error
|
|
29180
29179
|
scene.textureOptions = cachedTextures;
|
|
29181
29180
|
cachedTextures === null || cachedTextures === void 0 ? void 0 : cachedTextures.forEach(function (tex) { return tex === null || tex === void 0 ? void 0 : tex.initialize(); });
|
|
29182
29181
|
try {
|
|
@@ -29406,24 +29405,24 @@ var AssetManager = /** @class */ (function () {
|
|
|
29406
29405
|
this.timeout = timeout;
|
|
29407
29406
|
};
|
|
29408
29407
|
/**
|
|
29409
|
-
*
|
|
29410
|
-
* 通过 json 创建出场景对象,并进行提前编译等工作
|
|
29408
|
+
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
29411
29409
|
* @param url - json 的 URL 链接或者 json 对象
|
|
29412
29410
|
* @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
|
|
29413
29411
|
* @param options - 扩展参数
|
|
29414
29412
|
* @returns
|
|
29415
29413
|
*/
|
|
29416
29414
|
AssetManager.prototype.loadScene = function (url, renderer, options) {
|
|
29417
|
-
var _a, _b;
|
|
29415
|
+
var _a, _b, _c;
|
|
29418
29416
|
return __awaiter(this, void 0, void 0, function () {
|
|
29419
|
-
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29417
|
+
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29420
29418
|
var _this = this;
|
|
29421
|
-
return __generator(this, function (
|
|
29419
|
+
return __generator(this, function (_d) {
|
|
29422
29420
|
timeLabel = "Load asset: ".concat(isString(url) ? url : this.id);
|
|
29423
29421
|
startTime = performance.now();
|
|
29424
29422
|
timeInfos = [];
|
|
29425
29423
|
gpuInstance = renderer === null || renderer === void 0 ? void 0 : renderer.engine.gpuCapability;
|
|
29426
29424
|
asyncShaderCompile = (_b = (_a = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail) === null || _a === void 0 ? void 0 : _a.asyncShaderCompile) !== null && _b !== void 0 ? _b : false;
|
|
29425
|
+
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
29427
29426
|
cancelLoading = false;
|
|
29428
29427
|
waitPromise = new Promise(function (resolve, reject) {
|
|
29429
29428
|
return loadTimer = window.setTimeout(function () {
|
|
@@ -29448,10 +29447,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
29448
29447
|
});
|
|
29449
29448
|
}); };
|
|
29450
29449
|
loadResourcePromise = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
29451
|
-
var
|
|
29450
|
+
var scene, rawImages, images_1, i, _a, i, _b, usedImages_1, jsonScene_1, pluginSystem_1, _c, bins_1, images_2, compositions_1, fonts_1, _d, loadedBins_1, loadedImages_1, loadedTextures, totalTime;
|
|
29452
29451
|
var _this = this;
|
|
29453
|
-
return __generator(this, function (
|
|
29454
|
-
switch (
|
|
29452
|
+
return __generator(this, function (_e) {
|
|
29453
|
+
switch (_e.label) {
|
|
29455
29454
|
case 0:
|
|
29456
29455
|
if (!isObject(url)) return [3 /*break*/, 1];
|
|
29457
29456
|
// TODO: 原 JSONLoader contructor 判断是否兼容
|
|
@@ -29464,42 +29463,66 @@ var AssetManager = /** @class */ (function () {
|
|
|
29464
29463
|
this.baseUrl = url;
|
|
29465
29464
|
return [4 /*yield*/, hookTimeInfo('loadJSON', function () { return _this.loadJSON(url); })];
|
|
29466
29465
|
case 2:
|
|
29467
|
-
rawJSON =
|
|
29468
|
-
|
|
29469
|
-
case 3:
|
|
29466
|
+
rawJSON = _e.sent();
|
|
29467
|
+
_e.label = 3;
|
|
29468
|
+
case 3:
|
|
29469
|
+
if (!isScene(rawJSON)) return [3 /*break*/, 6];
|
|
29470
|
+
// 已经加载过的 可能需要更新数据模板
|
|
29471
|
+
scene = __assign$1({}, rawJSON);
|
|
29472
|
+
if (!(this.options && this.options.variables && Object.keys(this.options.variables).length !== 0)) return [3 /*break*/, 5];
|
|
29473
|
+
rawImages = rawJSON.jsonScene.images;
|
|
29474
|
+
images_1 = scene.images;
|
|
29475
|
+
for (i = 0; i < rawImages.length; i++) {
|
|
29476
|
+
// 仅重新加载数据模板对应的图片
|
|
29477
|
+
if (images_1[i] instanceof HTMLCanvasElement) {
|
|
29478
|
+
images_1[i] = rawImages[i];
|
|
29479
|
+
}
|
|
29480
|
+
}
|
|
29481
|
+
_a = scene;
|
|
29482
|
+
return [4 /*yield*/, hookTimeInfo('processImages', function () { return _this.processImages(images_1, scene.usedImages, compressedTexture); })];
|
|
29470
29483
|
case 4:
|
|
29471
|
-
_a =
|
|
29472
|
-
|
|
29484
|
+
_a.images = _e.sent();
|
|
29485
|
+
// 更新 TextureOptions 中的 image 指向
|
|
29486
|
+
for (i = 0; i < scene.images.length; i++) {
|
|
29487
|
+
scene.textureOptions[i].image = scene.images[i];
|
|
29488
|
+
}
|
|
29489
|
+
_e.label = 5;
|
|
29490
|
+
case 5: return [3 /*break*/, 12];
|
|
29491
|
+
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
29492
|
+
case 7:
|
|
29493
|
+
_b = _e.sent(), usedImages_1 = _b.usedImages, jsonScene_1 = _b.jsonScene, pluginSystem_1 = _b.pluginSystem;
|
|
29494
|
+
_c = jsonScene_1.bins, bins_1 = _c === void 0 ? [] : _c, images_2 = jsonScene_1.images, compositions_1 = jsonScene_1.compositions, fonts_1 = jsonScene_1.fonts;
|
|
29473
29495
|
return [4 /*yield*/, Promise.all([
|
|
29474
|
-
hookTimeInfo('processBins', function () { return _this.processBins(
|
|
29475
|
-
hookTimeInfo('processImages', function () {
|
|
29476
|
-
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(
|
|
29496
|
+
hookTimeInfo('processBins', function () { return _this.processBins(bins_1); }),
|
|
29497
|
+
hookTimeInfo('processImages', function () { return _this.processImages(images_2, usedImages_1, compressedTexture); }),
|
|
29498
|
+
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(compositions_1, pluginSystem_1, renderer, options); }),
|
|
29477
29499
|
])];
|
|
29478
|
-
case
|
|
29479
|
-
|
|
29480
|
-
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(
|
|
29481
|
-
case
|
|
29482
|
-
|
|
29483
|
-
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(
|
|
29484
|
-
case
|
|
29485
|
-
loadedTextures =
|
|
29500
|
+
case 8:
|
|
29501
|
+
_d = __read$3.apply(void 0, [_e.sent(), 2]), loadedBins_1 = _d[0], loadedImages_1 = _d[1];
|
|
29502
|
+
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(fonts_1); })];
|
|
29503
|
+
case 9:
|
|
29504
|
+
_e.sent();
|
|
29505
|
+
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
29506
|
+
case 10:
|
|
29507
|
+
loadedTextures = _e.sent();
|
|
29486
29508
|
scene = {
|
|
29487
|
-
jsonScene: jsonScene,
|
|
29488
|
-
images: loadedImages,
|
|
29489
|
-
textureOptions: loadedTextures,
|
|
29490
|
-
bins: loadedBins,
|
|
29491
|
-
storage: {},
|
|
29492
|
-
pluginSystem: this.pluginSystem,
|
|
29493
|
-
renderLevel: this.options.renderLevel,
|
|
29494
|
-
totalTime: 0,
|
|
29495
|
-
startTime: 0,
|
|
29496
29509
|
url: url,
|
|
29510
|
+
renderLevel: this.options.renderLevel,
|
|
29511
|
+
storage: {},
|
|
29512
|
+
pluginSystem: pluginSystem_1,
|
|
29513
|
+
jsonScene: jsonScene_1,
|
|
29514
|
+
usedImages: usedImages_1,
|
|
29515
|
+
images: loadedImages_1,
|
|
29516
|
+
textureOptions: loadedTextures,
|
|
29517
|
+
bins: loadedBins_1,
|
|
29497
29518
|
};
|
|
29498
29519
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29499
|
-
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return
|
|
29500
|
-
case
|
|
29520
|
+
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return pluginSystem_1.loadResources(scene, _this.options); })];
|
|
29521
|
+
case 11:
|
|
29501
29522
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29502
|
-
|
|
29523
|
+
_e.sent();
|
|
29524
|
+
_e.label = 12;
|
|
29525
|
+
case 12:
|
|
29503
29526
|
totalTime = performance.now() - startTime;
|
|
29504
29527
|
console.info({
|
|
29505
29528
|
content: "".concat(timeLabel, ": ").concat(totalTime.toFixed(4), "ms, ").concat(timeInfos.join(' ')),
|
|
@@ -29516,7 +29539,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29516
29539
|
});
|
|
29517
29540
|
});
|
|
29518
29541
|
};
|
|
29519
|
-
AssetManager.prototype.precompile = function (compositions, renderer, options) {
|
|
29542
|
+
AssetManager.prototype.precompile = function (compositions, pluginSystem, renderer, options) {
|
|
29520
29543
|
return __awaiter(this, void 0, void 0, function () {
|
|
29521
29544
|
var shaderLibrary;
|
|
29522
29545
|
return __generator(this, function (_a) {
|
|
@@ -29526,7 +29549,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29526
29549
|
return [2 /*return*/];
|
|
29527
29550
|
}
|
|
29528
29551
|
shaderLibrary = renderer === null || renderer === void 0 ? void 0 : renderer.getShaderLibrary();
|
|
29529
|
-
return [4 /*yield*/,
|
|
29552
|
+
return [4 /*yield*/, (pluginSystem === null || pluginSystem === void 0 ? void 0 : pluginSystem.precompile(compositions, renderer, options))];
|
|
29530
29553
|
case 1:
|
|
29531
29554
|
_a.sent();
|
|
29532
29555
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
@@ -29543,7 +29566,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29543
29566
|
};
|
|
29544
29567
|
AssetManager.prototype.processJSON = function (json) {
|
|
29545
29568
|
return __awaiter(this, void 0, void 0, function () {
|
|
29546
|
-
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, renderLevel, usedImages;
|
|
29569
|
+
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, pluginSystem, renderLevel, usedImages;
|
|
29547
29570
|
return __generator(this, function (_b) {
|
|
29548
29571
|
switch (_b.label) {
|
|
29549
29572
|
case 0:
|
|
@@ -29557,8 +29580,8 @@ var AssetManager = /** @class */ (function () {
|
|
|
29557
29580
|
}
|
|
29558
29581
|
});
|
|
29559
29582
|
_a = jsonScene.plugins, plugins = _a === void 0 ? [] : _a, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
29560
|
-
|
|
29561
|
-
return [4 /*yield*/,
|
|
29583
|
+
pluginSystem = new PluginSystem(plugins);
|
|
29584
|
+
return [4 /*yield*/, pluginSystem.processRawJSON(jsonScene, this.options)];
|
|
29562
29585
|
case 1:
|
|
29563
29586
|
_b.sent();
|
|
29564
29587
|
renderLevel = this.options.renderLevel;
|
|
@@ -29575,6 +29598,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29575
29598
|
return [2 /*return*/, {
|
|
29576
29599
|
usedImages: usedImages,
|
|
29577
29600
|
jsonScene: jsonScene,
|
|
29601
|
+
pluginSystem: pluginSystem,
|
|
29578
29602
|
}];
|
|
29579
29603
|
}
|
|
29580
29604
|
});
|
|
@@ -29958,7 +29982,8 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
29958
29982
|
}
|
|
29959
29983
|
else {
|
|
29960
29984
|
item = createVFXItem(this.itemProps[i], this.composition);
|
|
29961
|
-
|
|
29985
|
+
// 相机不跟随合成移动
|
|
29986
|
+
item.transform.parentTransform = VFXItem.isCamera(item) ? new Transform() : this.transform;
|
|
29962
29987
|
}
|
|
29963
29988
|
if (VFXItem.isExtraCamera(item)) {
|
|
29964
29989
|
this.extraCamera = item;
|
|
@@ -30144,7 +30169,7 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
30144
30169
|
if (!parentItem) {
|
|
30145
30170
|
itemNode.parentId = undefined;
|
|
30146
30171
|
item.parent = undefined;
|
|
30147
|
-
item.transform.parentTransform = this.transform;
|
|
30172
|
+
item.transform.parentTransform = VFXItem.isExtraCamera(item) ? new Transform() : this.transform;
|
|
30148
30173
|
}
|
|
30149
30174
|
else {
|
|
30150
30175
|
var parentNode = this.itemCacheMap.get(parentItem.id);
|
|
@@ -35779,7 +35804,7 @@ var Player = /** @class */ (function () {
|
|
|
35779
35804
|
Player.prototype.createComposition = function (url, options) {
|
|
35780
35805
|
if (options === void 0) { options = {}; }
|
|
35781
35806
|
return __awaiter(this, void 0, void 0, function () {
|
|
35782
|
-
var renderer, last, opts,
|
|
35807
|
+
var renderer, last, opts, source, scene, composition, firstFrameTime;
|
|
35783
35808
|
var _this = this;
|
|
35784
35809
|
return __generator(this, function (_a) {
|
|
35785
35810
|
switch (_a.label) {
|
|
@@ -35800,14 +35825,9 @@ var Player = /** @class */ (function () {
|
|
|
35800
35825
|
else {
|
|
35801
35826
|
this.assetManager = new AssetManager(opts);
|
|
35802
35827
|
}
|
|
35803
|
-
|
|
35804
|
-
|
|
35805
|
-
return [3 /*break*/, 3];
|
|
35806
|
-
case 1: return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
35807
|
-
case 2:
|
|
35828
|
+
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
35829
|
+
case 1:
|
|
35808
35830
|
scene = _a.sent();
|
|
35809
|
-
_a.label = 3;
|
|
35810
|
-
case 3:
|
|
35811
35831
|
composition = new Composition(__assign$1(__assign$1({}, opts), { renderer: renderer, width: renderer.getWidth(), height: renderer.getHeight(), event: this.event, handlePlayerPause: this.handlePlayerPause, handleMessageItem: this.handleMessageItem }), scene);
|
|
35812
35832
|
if (this.ticker) {
|
|
35813
35833
|
if (composition.renderLevel === RenderLevel$1.B) {
|
|
@@ -35819,7 +35839,7 @@ var Player = /** @class */ (function () {
|
|
|
35819
35839
|
resolve(null);
|
|
35820
35840
|
});
|
|
35821
35841
|
})];
|
|
35822
|
-
case
|
|
35842
|
+
case 2:
|
|
35823
35843
|
_a.sent();
|
|
35824
35844
|
if (opts.autoplay) {
|
|
35825
35845
|
this.autoPlaying = true;
|
|
@@ -35977,38 +35997,29 @@ var Player = /** @class */ (function () {
|
|
|
35977
35997
|
var _this = this;
|
|
35978
35998
|
var _a, _b, _c;
|
|
35979
35999
|
dt = Math.min(dt, 33) * this.speed;
|
|
35980
|
-
var removed = false;
|
|
35981
36000
|
var comps = this.compositions;
|
|
35982
36001
|
var skipRender = false;
|
|
35983
36002
|
comps.sort(function (a, b) { return a.getIndex() - b.getIndex(); });
|
|
35984
|
-
|
|
36003
|
+
this.compositions = [];
|
|
36004
|
+
for (var i = 0; i < comps.length; i++) {
|
|
36005
|
+
var composition = comps[i];
|
|
35985
36006
|
if (composition.textureOffloaded) {
|
|
35986
36007
|
skipRender = true;
|
|
35987
36008
|
console.error({
|
|
35988
36009
|
content: "Composition ".concat(composition.name, " texture offloaded, skip render."),
|
|
35989
36010
|
type: LOG_TYPE,
|
|
35990
36011
|
});
|
|
36012
|
+
this.compositions.push(composition);
|
|
36013
|
+
continue;
|
|
35991
36014
|
}
|
|
35992
|
-
if (composition.isDestroyed) {
|
|
35993
|
-
delete comps[i];
|
|
35994
|
-
removed = true;
|
|
35995
|
-
return;
|
|
35996
|
-
}
|
|
35997
|
-
if (composition.renderer) {
|
|
36015
|
+
if (!composition.isDestroyed && composition.renderer) {
|
|
35998
36016
|
composition.update(dt);
|
|
35999
36017
|
}
|
|
36000
|
-
if (composition.isDestroyed) {
|
|
36001
|
-
|
|
36002
|
-
removed = true;
|
|
36003
|
-
return;
|
|
36018
|
+
if (!composition.isDestroyed) {
|
|
36019
|
+
this.compositions.push(composition);
|
|
36004
36020
|
}
|
|
36005
|
-
});
|
|
36006
|
-
if (removed) {
|
|
36007
|
-
comps = comps.filter(function (comp) { return comp; });
|
|
36008
|
-
comps.map(function (comp, index) { return comp.setIndex(index); });
|
|
36009
|
-
this.compositions = comps;
|
|
36010
36021
|
}
|
|
36011
|
-
this.baseCompositionIndex =
|
|
36022
|
+
this.baseCompositionIndex = this.compositions.length;
|
|
36012
36023
|
if (skipRender) {
|
|
36013
36024
|
(_a = this.handleRenderError) === null || _a === void 0 ? void 0 : _a.call(this, new Error('play when texture offloaded'));
|
|
36014
36025
|
return (_b = this.ticker) === null || _b === void 0 ? void 0 : _b.pause();
|
|
@@ -36018,7 +36029,7 @@ var Player = /** @class */ (function () {
|
|
|
36018
36029
|
var gl = this.renderer.context.gl;
|
|
36019
36030
|
var time = (level === 2 && this.reportGPUTime) ? gpuTimer(gl) : undefined;
|
|
36020
36031
|
time === null || time === void 0 ? void 0 : time.begin();
|
|
36021
|
-
if (this.compositions.length || forceRender) {
|
|
36032
|
+
if (this.compositions.length || this.compositions.length < comps.length || forceRender) {
|
|
36022
36033
|
this.renderer.setFrameBuffer(null);
|
|
36023
36034
|
this.renderer.clear({
|
|
36024
36035
|
stencilAction: TextureLoadAction.clear,
|
|
@@ -36364,9 +36375,9 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
36364
36375
|
Engine.create = function (gl) {
|
|
36365
36376
|
return new GLEngine(gl);
|
|
36366
36377
|
};
|
|
36367
|
-
var version = "1.1.
|
|
36378
|
+
var version = "1.1.4";
|
|
36368
36379
|
console.info({
|
|
36369
|
-
content: '[Galacean Effects Player] version: ' + "1.1.
|
|
36380
|
+
content: '[Galacean Effects Player] version: ' + "1.1.4",
|
|
36370
36381
|
type: LOG_TYPE,
|
|
36371
36382
|
});
|
|
36372
36383
|
|