@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.js
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
|
'use strict';
|
|
@@ -14733,6 +14733,9 @@ var VFXItem = /** @class */ (function () {
|
|
|
14733
14733
|
VFXItem.isTree = function (item) {
|
|
14734
14734
|
return item.type === ItemType$1.tree;
|
|
14735
14735
|
};
|
|
14736
|
+
VFXItem.isCamera = function (item) {
|
|
14737
|
+
return item.type === ItemType$1.camera;
|
|
14738
|
+
};
|
|
14736
14739
|
VFXItem.isExtraCamera = function (item) {
|
|
14737
14740
|
return item.id === 'extra-camera' && item.name === 'extra-camera';
|
|
14738
14741
|
};
|
|
@@ -14933,10 +14936,11 @@ var VFXItem = /** @class */ (function () {
|
|
|
14933
14936
|
}
|
|
14934
14937
|
else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
14935
14938
|
this._contentVisible = false;
|
|
14939
|
+
shouldUpdate = true;
|
|
14940
|
+
dt = 0;
|
|
14936
14941
|
// 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
|
|
14937
14942
|
if (this.type === ItemType$1.composition) {
|
|
14938
14943
|
this.handleVisibleChanged(false);
|
|
14939
|
-
this.onItemUpdate(0, lifetime);
|
|
14940
14944
|
}
|
|
14941
14945
|
}
|
|
14942
14946
|
lifetime = Math.min(lifetime, 1);
|
|
@@ -15520,10 +15524,6 @@ var CameraVFXItem = /** @class */ (function (_super) {
|
|
|
15520
15524
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.update(lifetime);
|
|
15521
15525
|
this.updateCamera();
|
|
15522
15526
|
};
|
|
15523
|
-
// override onEnd () {
|
|
15524
|
-
// this.controller?.update(1);
|
|
15525
|
-
// this.updateCamera();
|
|
15526
|
-
// }
|
|
15527
15527
|
CameraVFXItem.prototype.updateCamera = function () {
|
|
15528
15528
|
if (this.controller && this.composition) {
|
|
15529
15529
|
var camera = this.composition.camera;
|
|
@@ -23568,7 +23568,7 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23568
23568
|
configurable: true
|
|
23569
23569
|
});
|
|
23570
23570
|
ParticleSystem.prototype.updateEmitterTransform = function (time) {
|
|
23571
|
-
var parentTransform = this.parentTransform;
|
|
23571
|
+
var parentTransform = this.transform.parentTransform;
|
|
23572
23572
|
var _a = this.basicTransform, path = _a.path, position = _a.position;
|
|
23573
23573
|
var selfPos = position.clone();
|
|
23574
23574
|
if (path) {
|
|
@@ -23578,9 +23578,9 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23578
23578
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
23579
23579
|
if (this.options.particleFollowParent && parentTransform) {
|
|
23580
23580
|
var tempMatrix = parentTransform.getWorldMatrix();
|
|
23581
|
-
this.particleMesh.mesh.worldMatrix = tempMatrix
|
|
23581
|
+
this.particleMesh.mesh.worldMatrix = tempMatrix;
|
|
23582
23582
|
if (this.trailMesh) {
|
|
23583
|
-
this.trailMesh.mesh.worldMatrix = tempMatrix
|
|
23583
|
+
this.trailMesh.mesh.worldMatrix = tempMatrix;
|
|
23584
23584
|
}
|
|
23585
23585
|
}
|
|
23586
23586
|
};
|
|
@@ -23599,8 +23599,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23599
23599
|
link.pushNode(linkContent);
|
|
23600
23600
|
this.particleMesh.setPoint(point, pointIndex);
|
|
23601
23601
|
this.clearPointTrail(pointIndex);
|
|
23602
|
-
if (this.
|
|
23603
|
-
this.trailMesh.setPointStartPos(pointIndex, this.parentTransform.position.clone());
|
|
23602
|
+
if (this.trailMesh) {
|
|
23603
|
+
this.trailMesh.setPointStartPos(pointIndex, this.transform.parentTransform.position.clone());
|
|
23604
23604
|
}
|
|
23605
23605
|
};
|
|
23606
23606
|
ParticleSystem.prototype.setVisible = function (visible) {
|
|
@@ -23638,7 +23638,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23638
23638
|
}
|
|
23639
23639
|
};
|
|
23640
23640
|
ParticleSystem.prototype.setParentTransform = function (transform) {
|
|
23641
|
-
this.parentTransform = transform;
|
|
23641
|
+
// this.transform.parentTransform = transform;
|
|
23642
|
+
// this.parentTransform = transform;
|
|
23642
23643
|
};
|
|
23643
23644
|
ParticleSystem.prototype.getTextures = function () {
|
|
23644
23645
|
var e_1, _a, e_2, _b;
|
|
@@ -23931,8 +23932,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23931
23932
|
if (trails.sizeAffectsLifetime) {
|
|
23932
23933
|
lifetime *= size[0];
|
|
23933
23934
|
}
|
|
23934
|
-
if (trails.parentAffectsPosition && this.parentTransform) {
|
|
23935
|
-
position.add(this.parentTransform.position);
|
|
23935
|
+
if (trails.parentAffectsPosition && this.transform.parentTransform) {
|
|
23936
|
+
position.add(this.transform.parentTransform.position);
|
|
23936
23937
|
var pos = this.trailMesh.getPointStartPos(pointIndex);
|
|
23937
23938
|
if (pos) {
|
|
23938
23939
|
position.subtract(pos);
|
|
@@ -24172,12 +24173,11 @@ var ParticleVFXItem = /** @class */ (function (_super) {
|
|
|
24172
24173
|
ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
|
|
24173
24174
|
var _a;
|
|
24174
24175
|
if (this.content) {
|
|
24175
|
-
var hide = !this.
|
|
24176
|
+
var hide = !this.visible;
|
|
24176
24177
|
var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
|
|
24177
24178
|
if (!hide && parentItem) {
|
|
24178
24179
|
var parentData = parentItem.getRenderData();
|
|
24179
24180
|
if (parentData) {
|
|
24180
|
-
this.content.setParentTransform(parentData.transform);
|
|
24181
24181
|
if (!parentData.visible) {
|
|
24182
24182
|
hide = false;
|
|
24183
24183
|
}
|
|
@@ -29180,7 +29180,6 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29180
29180
|
}
|
|
29181
29181
|
var cachedTextures = textureOptions.map(function (option) { return option && (option instanceof Texture ? option : Texture.create(engine, option)); });
|
|
29182
29182
|
// 缓存创建的Texture对象
|
|
29183
|
-
// @ts-expect-error
|
|
29184
29183
|
scene.textureOptions = cachedTextures;
|
|
29185
29184
|
cachedTextures === null || cachedTextures === void 0 ? void 0 : cachedTextures.forEach(function (tex) { return tex === null || tex === void 0 ? void 0 : tex.initialize(); });
|
|
29186
29185
|
try {
|
|
@@ -29410,24 +29409,24 @@ var AssetManager = /** @class */ (function () {
|
|
|
29410
29409
|
this.timeout = timeout;
|
|
29411
29410
|
};
|
|
29412
29411
|
/**
|
|
29413
|
-
*
|
|
29414
|
-
* 通过 json 创建出场景对象,并进行提前编译等工作
|
|
29412
|
+
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
29415
29413
|
* @param url - json 的 URL 链接或者 json 对象
|
|
29416
29414
|
* @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
|
|
29417
29415
|
* @param options - 扩展参数
|
|
29418
29416
|
* @returns
|
|
29419
29417
|
*/
|
|
29420
29418
|
AssetManager.prototype.loadScene = function (url, renderer, options) {
|
|
29421
|
-
var _a, _b;
|
|
29419
|
+
var _a, _b, _c;
|
|
29422
29420
|
return __awaiter(this, void 0, void 0, function () {
|
|
29423
|
-
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29421
|
+
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29424
29422
|
var _this = this;
|
|
29425
|
-
return __generator(this, function (
|
|
29423
|
+
return __generator(this, function (_d) {
|
|
29426
29424
|
timeLabel = "Load asset: ".concat(isString(url) ? url : this.id);
|
|
29427
29425
|
startTime = performance.now();
|
|
29428
29426
|
timeInfos = [];
|
|
29429
29427
|
gpuInstance = renderer === null || renderer === void 0 ? void 0 : renderer.engine.gpuCapability;
|
|
29430
29428
|
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;
|
|
29429
|
+
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
29431
29430
|
cancelLoading = false;
|
|
29432
29431
|
waitPromise = new Promise(function (resolve, reject) {
|
|
29433
29432
|
return loadTimer = window.setTimeout(function () {
|
|
@@ -29452,10 +29451,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
29452
29451
|
});
|
|
29453
29452
|
}); };
|
|
29454
29453
|
loadResourcePromise = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
29455
|
-
var
|
|
29454
|
+
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;
|
|
29456
29455
|
var _this = this;
|
|
29457
|
-
return __generator(this, function (
|
|
29458
|
-
switch (
|
|
29456
|
+
return __generator(this, function (_e) {
|
|
29457
|
+
switch (_e.label) {
|
|
29459
29458
|
case 0:
|
|
29460
29459
|
if (!isObject(url)) return [3 /*break*/, 1];
|
|
29461
29460
|
// TODO: 原 JSONLoader contructor 判断是否兼容
|
|
@@ -29468,42 +29467,66 @@ var AssetManager = /** @class */ (function () {
|
|
|
29468
29467
|
this.baseUrl = url;
|
|
29469
29468
|
return [4 /*yield*/, hookTimeInfo('loadJSON', function () { return _this.loadJSON(url); })];
|
|
29470
29469
|
case 2:
|
|
29471
|
-
rawJSON =
|
|
29472
|
-
|
|
29473
|
-
case 3:
|
|
29470
|
+
rawJSON = _e.sent();
|
|
29471
|
+
_e.label = 3;
|
|
29472
|
+
case 3:
|
|
29473
|
+
if (!isScene(rawJSON)) return [3 /*break*/, 6];
|
|
29474
|
+
// 已经加载过的 可能需要更新数据模板
|
|
29475
|
+
scene = __assign$1({}, rawJSON);
|
|
29476
|
+
if (!(this.options && this.options.variables && Object.keys(this.options.variables).length !== 0)) return [3 /*break*/, 5];
|
|
29477
|
+
rawImages = rawJSON.jsonScene.images;
|
|
29478
|
+
images_1 = scene.images;
|
|
29479
|
+
for (i = 0; i < rawImages.length; i++) {
|
|
29480
|
+
// 仅重新加载数据模板对应的图片
|
|
29481
|
+
if (images_1[i] instanceof HTMLCanvasElement) {
|
|
29482
|
+
images_1[i] = rawImages[i];
|
|
29483
|
+
}
|
|
29484
|
+
}
|
|
29485
|
+
_a = scene;
|
|
29486
|
+
return [4 /*yield*/, hookTimeInfo('processImages', function () { return _this.processImages(images_1, scene.usedImages, compressedTexture); })];
|
|
29474
29487
|
case 4:
|
|
29475
|
-
_a =
|
|
29476
|
-
|
|
29488
|
+
_a.images = _e.sent();
|
|
29489
|
+
// 更新 TextureOptions 中的 image 指向
|
|
29490
|
+
for (i = 0; i < scene.images.length; i++) {
|
|
29491
|
+
scene.textureOptions[i].image = scene.images[i];
|
|
29492
|
+
}
|
|
29493
|
+
_e.label = 5;
|
|
29494
|
+
case 5: return [3 /*break*/, 12];
|
|
29495
|
+
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
29496
|
+
case 7:
|
|
29497
|
+
_b = _e.sent(), usedImages_1 = _b.usedImages, jsonScene_1 = _b.jsonScene, pluginSystem_1 = _b.pluginSystem;
|
|
29498
|
+
_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;
|
|
29477
29499
|
return [4 /*yield*/, Promise.all([
|
|
29478
|
-
hookTimeInfo('processBins', function () { return _this.processBins(
|
|
29479
|
-
hookTimeInfo('processImages', function () {
|
|
29480
|
-
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(
|
|
29500
|
+
hookTimeInfo('processBins', function () { return _this.processBins(bins_1); }),
|
|
29501
|
+
hookTimeInfo('processImages', function () { return _this.processImages(images_2, usedImages_1, compressedTexture); }),
|
|
29502
|
+
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(compositions_1, pluginSystem_1, renderer, options); }),
|
|
29481
29503
|
])];
|
|
29482
|
-
case
|
|
29483
|
-
|
|
29484
|
-
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(
|
|
29485
|
-
case
|
|
29486
|
-
|
|
29487
|
-
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(
|
|
29488
|
-
case
|
|
29489
|
-
loadedTextures =
|
|
29504
|
+
case 8:
|
|
29505
|
+
_d = __read$3.apply(void 0, [_e.sent(), 2]), loadedBins_1 = _d[0], loadedImages_1 = _d[1];
|
|
29506
|
+
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(fonts_1); })];
|
|
29507
|
+
case 9:
|
|
29508
|
+
_e.sent();
|
|
29509
|
+
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
29510
|
+
case 10:
|
|
29511
|
+
loadedTextures = _e.sent();
|
|
29490
29512
|
scene = {
|
|
29491
|
-
jsonScene: jsonScene,
|
|
29492
|
-
images: loadedImages,
|
|
29493
|
-
textureOptions: loadedTextures,
|
|
29494
|
-
bins: loadedBins,
|
|
29495
|
-
storage: {},
|
|
29496
|
-
pluginSystem: this.pluginSystem,
|
|
29497
|
-
renderLevel: this.options.renderLevel,
|
|
29498
|
-
totalTime: 0,
|
|
29499
|
-
startTime: 0,
|
|
29500
29513
|
url: url,
|
|
29514
|
+
renderLevel: this.options.renderLevel,
|
|
29515
|
+
storage: {},
|
|
29516
|
+
pluginSystem: pluginSystem_1,
|
|
29517
|
+
jsonScene: jsonScene_1,
|
|
29518
|
+
usedImages: usedImages_1,
|
|
29519
|
+
images: loadedImages_1,
|
|
29520
|
+
textureOptions: loadedTextures,
|
|
29521
|
+
bins: loadedBins_1,
|
|
29501
29522
|
};
|
|
29502
29523
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29503
|
-
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return
|
|
29504
|
-
case
|
|
29524
|
+
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return pluginSystem_1.loadResources(scene, _this.options); })];
|
|
29525
|
+
case 11:
|
|
29505
29526
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29506
|
-
|
|
29527
|
+
_e.sent();
|
|
29528
|
+
_e.label = 12;
|
|
29529
|
+
case 12:
|
|
29507
29530
|
totalTime = performance.now() - startTime;
|
|
29508
29531
|
console.info({
|
|
29509
29532
|
content: "".concat(timeLabel, ": ").concat(totalTime.toFixed(4), "ms, ").concat(timeInfos.join(' ')),
|
|
@@ -29520,7 +29543,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29520
29543
|
});
|
|
29521
29544
|
});
|
|
29522
29545
|
};
|
|
29523
|
-
AssetManager.prototype.precompile = function (compositions, renderer, options) {
|
|
29546
|
+
AssetManager.prototype.precompile = function (compositions, pluginSystem, renderer, options) {
|
|
29524
29547
|
return __awaiter(this, void 0, void 0, function () {
|
|
29525
29548
|
var shaderLibrary;
|
|
29526
29549
|
return __generator(this, function (_a) {
|
|
@@ -29530,7 +29553,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29530
29553
|
return [2 /*return*/];
|
|
29531
29554
|
}
|
|
29532
29555
|
shaderLibrary = renderer === null || renderer === void 0 ? void 0 : renderer.getShaderLibrary();
|
|
29533
|
-
return [4 /*yield*/,
|
|
29556
|
+
return [4 /*yield*/, (pluginSystem === null || pluginSystem === void 0 ? void 0 : pluginSystem.precompile(compositions, renderer, options))];
|
|
29534
29557
|
case 1:
|
|
29535
29558
|
_a.sent();
|
|
29536
29559
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
@@ -29547,7 +29570,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29547
29570
|
};
|
|
29548
29571
|
AssetManager.prototype.processJSON = function (json) {
|
|
29549
29572
|
return __awaiter(this, void 0, void 0, function () {
|
|
29550
|
-
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, renderLevel, usedImages;
|
|
29573
|
+
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, pluginSystem, renderLevel, usedImages;
|
|
29551
29574
|
return __generator(this, function (_b) {
|
|
29552
29575
|
switch (_b.label) {
|
|
29553
29576
|
case 0:
|
|
@@ -29561,8 +29584,8 @@ var AssetManager = /** @class */ (function () {
|
|
|
29561
29584
|
}
|
|
29562
29585
|
});
|
|
29563
29586
|
_a = jsonScene.plugins, plugins = _a === void 0 ? [] : _a, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
29564
|
-
|
|
29565
|
-
return [4 /*yield*/,
|
|
29587
|
+
pluginSystem = new PluginSystem(plugins);
|
|
29588
|
+
return [4 /*yield*/, pluginSystem.processRawJSON(jsonScene, this.options)];
|
|
29566
29589
|
case 1:
|
|
29567
29590
|
_b.sent();
|
|
29568
29591
|
renderLevel = this.options.renderLevel;
|
|
@@ -29579,6 +29602,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29579
29602
|
return [2 /*return*/, {
|
|
29580
29603
|
usedImages: usedImages,
|
|
29581
29604
|
jsonScene: jsonScene,
|
|
29605
|
+
pluginSystem: pluginSystem,
|
|
29582
29606
|
}];
|
|
29583
29607
|
}
|
|
29584
29608
|
});
|
|
@@ -29962,7 +29986,8 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
29962
29986
|
}
|
|
29963
29987
|
else {
|
|
29964
29988
|
item = createVFXItem(this.itemProps[i], this.composition);
|
|
29965
|
-
|
|
29989
|
+
// 相机不跟随合成移动
|
|
29990
|
+
item.transform.parentTransform = VFXItem.isCamera(item) ? new Transform() : this.transform;
|
|
29966
29991
|
}
|
|
29967
29992
|
if (VFXItem.isExtraCamera(item)) {
|
|
29968
29993
|
this.extraCamera = item;
|
|
@@ -30148,7 +30173,7 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
30148
30173
|
if (!parentItem) {
|
|
30149
30174
|
itemNode.parentId = undefined;
|
|
30150
30175
|
item.parent = undefined;
|
|
30151
|
-
item.transform.parentTransform = this.transform;
|
|
30176
|
+
item.transform.parentTransform = VFXItem.isExtraCamera(item) ? new Transform() : this.transform;
|
|
30152
30177
|
}
|
|
30153
30178
|
else {
|
|
30154
30179
|
var parentNode = this.itemCacheMap.get(parentItem.id);
|
|
@@ -35783,7 +35808,7 @@ var Player = /** @class */ (function () {
|
|
|
35783
35808
|
Player.prototype.createComposition = function (url, options) {
|
|
35784
35809
|
if (options === void 0) { options = {}; }
|
|
35785
35810
|
return __awaiter(this, void 0, void 0, function () {
|
|
35786
|
-
var renderer, last, opts,
|
|
35811
|
+
var renderer, last, opts, source, scene, composition, firstFrameTime;
|
|
35787
35812
|
var _this = this;
|
|
35788
35813
|
return __generator(this, function (_a) {
|
|
35789
35814
|
switch (_a.label) {
|
|
@@ -35804,14 +35829,9 @@ var Player = /** @class */ (function () {
|
|
|
35804
35829
|
else {
|
|
35805
35830
|
this.assetManager = new AssetManager(opts);
|
|
35806
35831
|
}
|
|
35807
|
-
|
|
35808
|
-
|
|
35809
|
-
return [3 /*break*/, 3];
|
|
35810
|
-
case 1: return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
35811
|
-
case 2:
|
|
35832
|
+
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
35833
|
+
case 1:
|
|
35812
35834
|
scene = _a.sent();
|
|
35813
|
-
_a.label = 3;
|
|
35814
|
-
case 3:
|
|
35815
35835
|
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);
|
|
35816
35836
|
if (this.ticker) {
|
|
35817
35837
|
if (composition.renderLevel === RenderLevel$1.B) {
|
|
@@ -35823,7 +35843,7 @@ var Player = /** @class */ (function () {
|
|
|
35823
35843
|
resolve(null);
|
|
35824
35844
|
});
|
|
35825
35845
|
})];
|
|
35826
|
-
case
|
|
35846
|
+
case 2:
|
|
35827
35847
|
_a.sent();
|
|
35828
35848
|
if (opts.autoplay) {
|
|
35829
35849
|
this.autoPlaying = true;
|
|
@@ -35981,38 +36001,29 @@ var Player = /** @class */ (function () {
|
|
|
35981
36001
|
var _this = this;
|
|
35982
36002
|
var _a, _b, _c;
|
|
35983
36003
|
dt = Math.min(dt, 33) * this.speed;
|
|
35984
|
-
var removed = false;
|
|
35985
36004
|
var comps = this.compositions;
|
|
35986
36005
|
var skipRender = false;
|
|
35987
36006
|
comps.sort(function (a, b) { return a.getIndex() - b.getIndex(); });
|
|
35988
|
-
|
|
36007
|
+
this.compositions = [];
|
|
36008
|
+
for (var i = 0; i < comps.length; i++) {
|
|
36009
|
+
var composition = comps[i];
|
|
35989
36010
|
if (composition.textureOffloaded) {
|
|
35990
36011
|
skipRender = true;
|
|
35991
36012
|
console.error({
|
|
35992
36013
|
content: "Composition ".concat(composition.name, " texture offloaded, skip render."),
|
|
35993
36014
|
type: LOG_TYPE,
|
|
35994
36015
|
});
|
|
36016
|
+
this.compositions.push(composition);
|
|
36017
|
+
continue;
|
|
35995
36018
|
}
|
|
35996
|
-
if (composition.isDestroyed) {
|
|
35997
|
-
delete comps[i];
|
|
35998
|
-
removed = true;
|
|
35999
|
-
return;
|
|
36000
|
-
}
|
|
36001
|
-
if (composition.renderer) {
|
|
36019
|
+
if (!composition.isDestroyed && composition.renderer) {
|
|
36002
36020
|
composition.update(dt);
|
|
36003
36021
|
}
|
|
36004
|
-
if (composition.isDestroyed) {
|
|
36005
|
-
|
|
36006
|
-
removed = true;
|
|
36007
|
-
return;
|
|
36022
|
+
if (!composition.isDestroyed) {
|
|
36023
|
+
this.compositions.push(composition);
|
|
36008
36024
|
}
|
|
36009
|
-
});
|
|
36010
|
-
if (removed) {
|
|
36011
|
-
comps = comps.filter(function (comp) { return comp; });
|
|
36012
|
-
comps.map(function (comp, index) { return comp.setIndex(index); });
|
|
36013
|
-
this.compositions = comps;
|
|
36014
36025
|
}
|
|
36015
|
-
this.baseCompositionIndex =
|
|
36026
|
+
this.baseCompositionIndex = this.compositions.length;
|
|
36016
36027
|
if (skipRender) {
|
|
36017
36028
|
(_a = this.handleRenderError) === null || _a === void 0 ? void 0 : _a.call(this, new Error('play when texture offloaded'));
|
|
36018
36029
|
return (_b = this.ticker) === null || _b === void 0 ? void 0 : _b.pause();
|
|
@@ -36022,7 +36033,7 @@ var Player = /** @class */ (function () {
|
|
|
36022
36033
|
var gl = this.renderer.context.gl;
|
|
36023
36034
|
var time = (level === 2 && this.reportGPUTime) ? gpuTimer(gl) : undefined;
|
|
36024
36035
|
time === null || time === void 0 ? void 0 : time.begin();
|
|
36025
|
-
if (this.compositions.length || forceRender) {
|
|
36036
|
+
if (this.compositions.length || this.compositions.length < comps.length || forceRender) {
|
|
36026
36037
|
this.renderer.setFrameBuffer(null);
|
|
36027
36038
|
this.renderer.clear({
|
|
36028
36039
|
stencilAction: exports.TextureLoadAction.clear,
|
|
@@ -36368,9 +36379,9 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
36368
36379
|
Engine.create = function (gl) {
|
|
36369
36380
|
return new GLEngine(gl);
|
|
36370
36381
|
};
|
|
36371
|
-
var version = "1.1.
|
|
36382
|
+
var version = "1.1.4";
|
|
36372
36383
|
console.info({
|
|
36373
|
-
content: '[Galacean Effects Player] version: ' + "1.1.
|
|
36384
|
+
content: '[Galacean Effects Player] version: ' + "1.1.4",
|
|
36374
36385
|
type: LOG_TYPE,
|
|
36375
36386
|
});
|
|
36376
36387
|
|