@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/weapp.mjs
CHANGED
|
@@ -14723,6 +14723,9 @@ var VFXItem = /** @class */ (function () {
|
|
|
14723
14723
|
VFXItem.isTree = function (item) {
|
|
14724
14724
|
return item.type === ItemType$1.tree;
|
|
14725
14725
|
};
|
|
14726
|
+
VFXItem.isCamera = function (item) {
|
|
14727
|
+
return item.type === ItemType$1.camera;
|
|
14728
|
+
};
|
|
14726
14729
|
VFXItem.isExtraCamera = function (item) {
|
|
14727
14730
|
return item.id === 'extra-camera' && item.name === 'extra-camera';
|
|
14728
14731
|
};
|
|
@@ -14923,10 +14926,11 @@ var VFXItem = /** @class */ (function () {
|
|
|
14923
14926
|
}
|
|
14924
14927
|
else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
14925
14928
|
this._contentVisible = false;
|
|
14929
|
+
shouldUpdate = true;
|
|
14930
|
+
dt = 0;
|
|
14926
14931
|
// 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
|
|
14927
14932
|
if (this.type === ItemType$1.composition) {
|
|
14928
14933
|
this.handleVisibleChanged(false);
|
|
14929
|
-
this.onItemUpdate(0, lifetime);
|
|
14930
14934
|
}
|
|
14931
14935
|
}
|
|
14932
14936
|
lifetime = Math.min(lifetime, 1);
|
|
@@ -15510,10 +15514,6 @@ var CameraVFXItem = /** @class */ (function (_super) {
|
|
|
15510
15514
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.update(lifetime);
|
|
15511
15515
|
this.updateCamera();
|
|
15512
15516
|
};
|
|
15513
|
-
// override onEnd () {
|
|
15514
|
-
// this.controller?.update(1);
|
|
15515
|
-
// this.updateCamera();
|
|
15516
|
-
// }
|
|
15517
15517
|
CameraVFXItem.prototype.updateCamera = function () {
|
|
15518
15518
|
if (this.controller && this.composition) {
|
|
15519
15519
|
var camera = this.composition.camera;
|
|
@@ -23558,7 +23558,7 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23558
23558
|
configurable: true
|
|
23559
23559
|
});
|
|
23560
23560
|
ParticleSystem.prototype.updateEmitterTransform = function (time) {
|
|
23561
|
-
var parentTransform = this.parentTransform;
|
|
23561
|
+
var parentTransform = this.transform.parentTransform;
|
|
23562
23562
|
var _a = this.basicTransform, path = _a.path, position = _a.position;
|
|
23563
23563
|
var selfPos = position.clone();
|
|
23564
23564
|
if (path) {
|
|
@@ -23568,9 +23568,9 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23568
23568
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
23569
23569
|
if (this.options.particleFollowParent && parentTransform) {
|
|
23570
23570
|
var tempMatrix = parentTransform.getWorldMatrix();
|
|
23571
|
-
this.particleMesh.mesh.worldMatrix = tempMatrix
|
|
23571
|
+
this.particleMesh.mesh.worldMatrix = tempMatrix;
|
|
23572
23572
|
if (this.trailMesh) {
|
|
23573
|
-
this.trailMesh.mesh.worldMatrix = tempMatrix
|
|
23573
|
+
this.trailMesh.mesh.worldMatrix = tempMatrix;
|
|
23574
23574
|
}
|
|
23575
23575
|
}
|
|
23576
23576
|
};
|
|
@@ -23589,8 +23589,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23589
23589
|
link.pushNode(linkContent);
|
|
23590
23590
|
this.particleMesh.setPoint(point, pointIndex);
|
|
23591
23591
|
this.clearPointTrail(pointIndex);
|
|
23592
|
-
if (this.
|
|
23593
|
-
this.trailMesh.setPointStartPos(pointIndex, this.parentTransform.position.clone());
|
|
23592
|
+
if (this.trailMesh) {
|
|
23593
|
+
this.trailMesh.setPointStartPos(pointIndex, this.transform.parentTransform.position.clone());
|
|
23594
23594
|
}
|
|
23595
23595
|
};
|
|
23596
23596
|
ParticleSystem.prototype.setVisible = function (visible) {
|
|
@@ -23628,7 +23628,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23628
23628
|
}
|
|
23629
23629
|
};
|
|
23630
23630
|
ParticleSystem.prototype.setParentTransform = function (transform) {
|
|
23631
|
-
this.parentTransform = transform;
|
|
23631
|
+
// this.transform.parentTransform = transform;
|
|
23632
|
+
// this.parentTransform = transform;
|
|
23632
23633
|
};
|
|
23633
23634
|
ParticleSystem.prototype.getTextures = function () {
|
|
23634
23635
|
var e_1, _a, e_2, _b;
|
|
@@ -23921,8 +23922,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23921
23922
|
if (trails.sizeAffectsLifetime) {
|
|
23922
23923
|
lifetime *= size[0];
|
|
23923
23924
|
}
|
|
23924
|
-
if (trails.parentAffectsPosition && this.parentTransform) {
|
|
23925
|
-
position.add(this.parentTransform.position);
|
|
23925
|
+
if (trails.parentAffectsPosition && this.transform.parentTransform) {
|
|
23926
|
+
position.add(this.transform.parentTransform.position);
|
|
23926
23927
|
var pos = this.trailMesh.getPointStartPos(pointIndex);
|
|
23927
23928
|
if (pos) {
|
|
23928
23929
|
position.subtract(pos);
|
|
@@ -24162,12 +24163,11 @@ var ParticleVFXItem = /** @class */ (function (_super) {
|
|
|
24162
24163
|
ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
|
|
24163
24164
|
var _a;
|
|
24164
24165
|
if (this.content) {
|
|
24165
|
-
var hide = !this.
|
|
24166
|
+
var hide = !this.visible;
|
|
24166
24167
|
var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
|
|
24167
24168
|
if (!hide && parentItem) {
|
|
24168
24169
|
var parentData = parentItem.getRenderData();
|
|
24169
24170
|
if (parentData) {
|
|
24170
|
-
this.content.setParentTransform(parentData.transform);
|
|
24171
24171
|
if (!parentData.visible) {
|
|
24172
24172
|
hide = false;
|
|
24173
24173
|
}
|
|
@@ -29170,7 +29170,6 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29170
29170
|
}
|
|
29171
29171
|
var cachedTextures = textureOptions.map(function (option) { return option && (option instanceof Texture ? option : Texture.create(engine, option)); });
|
|
29172
29172
|
// 缓存创建的Texture对象
|
|
29173
|
-
// @ts-expect-error
|
|
29174
29173
|
scene.textureOptions = cachedTextures;
|
|
29175
29174
|
cachedTextures === null || cachedTextures === void 0 ? void 0 : cachedTextures.forEach(function (tex) { return tex === null || tex === void 0 ? void 0 : tex.initialize(); });
|
|
29176
29175
|
try {
|
|
@@ -29400,24 +29399,24 @@ var AssetManager = /** @class */ (function () {
|
|
|
29400
29399
|
this.timeout = timeout;
|
|
29401
29400
|
};
|
|
29402
29401
|
/**
|
|
29403
|
-
*
|
|
29404
|
-
* 通过 json 创建出场景对象,并进行提前编译等工作
|
|
29402
|
+
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
29405
29403
|
* @param url - json 的 URL 链接或者 json 对象
|
|
29406
29404
|
* @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
|
|
29407
29405
|
* @param options - 扩展参数
|
|
29408
29406
|
* @returns
|
|
29409
29407
|
*/
|
|
29410
29408
|
AssetManager.prototype.loadScene = function (url, renderer, options) {
|
|
29411
|
-
var _a, _b;
|
|
29409
|
+
var _a, _b, _c;
|
|
29412
29410
|
return __awaiter(this, void 0, void 0, function () {
|
|
29413
|
-
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29411
|
+
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29414
29412
|
var _this = this;
|
|
29415
|
-
return __generator(this, function (
|
|
29413
|
+
return __generator(this, function (_d) {
|
|
29416
29414
|
timeLabel = "Load asset: ".concat(isString(url) ? url : this.id);
|
|
29417
29415
|
startTime = performance.now();
|
|
29418
29416
|
timeInfos = [];
|
|
29419
29417
|
gpuInstance = renderer === null || renderer === void 0 ? void 0 : renderer.engine.gpuCapability;
|
|
29420
29418
|
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;
|
|
29419
|
+
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
29421
29420
|
cancelLoading = false;
|
|
29422
29421
|
waitPromise = new Promise(function (resolve, reject) {
|
|
29423
29422
|
return loadTimer = window$1.setTimeout(function () {
|
|
@@ -29442,10 +29441,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
29442
29441
|
});
|
|
29443
29442
|
}); };
|
|
29444
29443
|
loadResourcePromise = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
29445
|
-
var
|
|
29444
|
+
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;
|
|
29446
29445
|
var _this = this;
|
|
29447
|
-
return __generator(this, function (
|
|
29448
|
-
switch (
|
|
29446
|
+
return __generator(this, function (_e) {
|
|
29447
|
+
switch (_e.label) {
|
|
29449
29448
|
case 0:
|
|
29450
29449
|
if (!isObject(url)) return [3 /*break*/, 1];
|
|
29451
29450
|
// TODO: 原 JSONLoader contructor 判断是否兼容
|
|
@@ -29458,42 +29457,66 @@ var AssetManager = /** @class */ (function () {
|
|
|
29458
29457
|
this.baseUrl = url;
|
|
29459
29458
|
return [4 /*yield*/, hookTimeInfo('loadJSON', function () { return _this.loadJSON(url); })];
|
|
29460
29459
|
case 2:
|
|
29461
|
-
rawJSON =
|
|
29462
|
-
|
|
29463
|
-
case 3:
|
|
29460
|
+
rawJSON = _e.sent();
|
|
29461
|
+
_e.label = 3;
|
|
29462
|
+
case 3:
|
|
29463
|
+
if (!isScene(rawJSON)) return [3 /*break*/, 6];
|
|
29464
|
+
// 已经加载过的 可能需要更新数据模板
|
|
29465
|
+
scene = __assign$1({}, rawJSON);
|
|
29466
|
+
if (!(this.options && this.options.variables && Object.keys(this.options.variables).length !== 0)) return [3 /*break*/, 5];
|
|
29467
|
+
rawImages = rawJSON.jsonScene.images;
|
|
29468
|
+
images_1 = scene.images;
|
|
29469
|
+
for (i = 0; i < rawImages.length; i++) {
|
|
29470
|
+
// 仅重新加载数据模板对应的图片
|
|
29471
|
+
if (images_1[i] instanceof HTMLCanvasElement) {
|
|
29472
|
+
images_1[i] = rawImages[i];
|
|
29473
|
+
}
|
|
29474
|
+
}
|
|
29475
|
+
_a = scene;
|
|
29476
|
+
return [4 /*yield*/, hookTimeInfo('processImages', function () { return _this.processImages(images_1, scene.usedImages, compressedTexture); })];
|
|
29464
29477
|
case 4:
|
|
29465
|
-
_a =
|
|
29466
|
-
|
|
29478
|
+
_a.images = _e.sent();
|
|
29479
|
+
// 更新 TextureOptions 中的 image 指向
|
|
29480
|
+
for (i = 0; i < scene.images.length; i++) {
|
|
29481
|
+
scene.textureOptions[i].image = scene.images[i];
|
|
29482
|
+
}
|
|
29483
|
+
_e.label = 5;
|
|
29484
|
+
case 5: return [3 /*break*/, 12];
|
|
29485
|
+
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
29486
|
+
case 7:
|
|
29487
|
+
_b = _e.sent(), usedImages_1 = _b.usedImages, jsonScene_1 = _b.jsonScene, pluginSystem_1 = _b.pluginSystem;
|
|
29488
|
+
_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;
|
|
29467
29489
|
return [4 /*yield*/, Promise.all([
|
|
29468
|
-
hookTimeInfo('processBins', function () { return _this.processBins(
|
|
29469
|
-
hookTimeInfo('processImages', function () {
|
|
29470
|
-
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(
|
|
29490
|
+
hookTimeInfo('processBins', function () { return _this.processBins(bins_1); }),
|
|
29491
|
+
hookTimeInfo('processImages', function () { return _this.processImages(images_2, usedImages_1, compressedTexture); }),
|
|
29492
|
+
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(compositions_1, pluginSystem_1, renderer, options); }),
|
|
29471
29493
|
])];
|
|
29472
|
-
case
|
|
29473
|
-
|
|
29474
|
-
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(
|
|
29475
|
-
case
|
|
29476
|
-
|
|
29477
|
-
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(
|
|
29478
|
-
case
|
|
29479
|
-
loadedTextures =
|
|
29494
|
+
case 8:
|
|
29495
|
+
_d = __read$3.apply(void 0, [_e.sent(), 2]), loadedBins_1 = _d[0], loadedImages_1 = _d[1];
|
|
29496
|
+
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(fonts_1); })];
|
|
29497
|
+
case 9:
|
|
29498
|
+
_e.sent();
|
|
29499
|
+
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
29500
|
+
case 10:
|
|
29501
|
+
loadedTextures = _e.sent();
|
|
29480
29502
|
scene = {
|
|
29481
|
-
jsonScene: jsonScene,
|
|
29482
|
-
images: loadedImages,
|
|
29483
|
-
textureOptions: loadedTextures,
|
|
29484
|
-
bins: loadedBins,
|
|
29485
|
-
storage: {},
|
|
29486
|
-
pluginSystem: this.pluginSystem,
|
|
29487
|
-
renderLevel: this.options.renderLevel,
|
|
29488
|
-
totalTime: 0,
|
|
29489
|
-
startTime: 0,
|
|
29490
29503
|
url: url,
|
|
29504
|
+
renderLevel: this.options.renderLevel,
|
|
29505
|
+
storage: {},
|
|
29506
|
+
pluginSystem: pluginSystem_1,
|
|
29507
|
+
jsonScene: jsonScene_1,
|
|
29508
|
+
usedImages: usedImages_1,
|
|
29509
|
+
images: loadedImages_1,
|
|
29510
|
+
textureOptions: loadedTextures,
|
|
29511
|
+
bins: loadedBins_1,
|
|
29491
29512
|
};
|
|
29492
29513
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29493
|
-
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return
|
|
29494
|
-
case
|
|
29514
|
+
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return pluginSystem_1.loadResources(scene, _this.options); })];
|
|
29515
|
+
case 11:
|
|
29495
29516
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29496
|
-
|
|
29517
|
+
_e.sent();
|
|
29518
|
+
_e.label = 12;
|
|
29519
|
+
case 12:
|
|
29497
29520
|
totalTime = performance.now() - startTime;
|
|
29498
29521
|
console.info({
|
|
29499
29522
|
content: "".concat(timeLabel, ": ").concat(totalTime.toFixed(4), "ms, ").concat(timeInfos.join(' ')),
|
|
@@ -29510,7 +29533,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29510
29533
|
});
|
|
29511
29534
|
});
|
|
29512
29535
|
};
|
|
29513
|
-
AssetManager.prototype.precompile = function (compositions, renderer, options) {
|
|
29536
|
+
AssetManager.prototype.precompile = function (compositions, pluginSystem, renderer, options) {
|
|
29514
29537
|
return __awaiter(this, void 0, void 0, function () {
|
|
29515
29538
|
var shaderLibrary;
|
|
29516
29539
|
return __generator(this, function (_a) {
|
|
@@ -29520,7 +29543,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29520
29543
|
return [2 /*return*/];
|
|
29521
29544
|
}
|
|
29522
29545
|
shaderLibrary = renderer === null || renderer === void 0 ? void 0 : renderer.getShaderLibrary();
|
|
29523
|
-
return [4 /*yield*/,
|
|
29546
|
+
return [4 /*yield*/, (pluginSystem === null || pluginSystem === void 0 ? void 0 : pluginSystem.precompile(compositions, renderer, options))];
|
|
29524
29547
|
case 1:
|
|
29525
29548
|
_a.sent();
|
|
29526
29549
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
@@ -29537,7 +29560,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29537
29560
|
};
|
|
29538
29561
|
AssetManager.prototype.processJSON = function (json) {
|
|
29539
29562
|
return __awaiter(this, void 0, void 0, function () {
|
|
29540
|
-
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, renderLevel, usedImages;
|
|
29563
|
+
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, pluginSystem, renderLevel, usedImages;
|
|
29541
29564
|
return __generator(this, function (_b) {
|
|
29542
29565
|
switch (_b.label) {
|
|
29543
29566
|
case 0:
|
|
@@ -29551,8 +29574,8 @@ var AssetManager = /** @class */ (function () {
|
|
|
29551
29574
|
}
|
|
29552
29575
|
});
|
|
29553
29576
|
_a = jsonScene.plugins, plugins = _a === void 0 ? [] : _a, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
29554
|
-
|
|
29555
|
-
return [4 /*yield*/,
|
|
29577
|
+
pluginSystem = new PluginSystem(plugins);
|
|
29578
|
+
return [4 /*yield*/, pluginSystem.processRawJSON(jsonScene, this.options)];
|
|
29556
29579
|
case 1:
|
|
29557
29580
|
_b.sent();
|
|
29558
29581
|
renderLevel = this.options.renderLevel;
|
|
@@ -29569,6 +29592,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29569
29592
|
return [2 /*return*/, {
|
|
29570
29593
|
usedImages: usedImages,
|
|
29571
29594
|
jsonScene: jsonScene,
|
|
29595
|
+
pluginSystem: pluginSystem,
|
|
29572
29596
|
}];
|
|
29573
29597
|
}
|
|
29574
29598
|
});
|
|
@@ -29952,7 +29976,8 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
29952
29976
|
}
|
|
29953
29977
|
else {
|
|
29954
29978
|
item = createVFXItem(this.itemProps[i], this.composition);
|
|
29955
|
-
|
|
29979
|
+
// 相机不跟随合成移动
|
|
29980
|
+
item.transform.parentTransform = VFXItem.isCamera(item) ? new Transform() : this.transform;
|
|
29956
29981
|
}
|
|
29957
29982
|
if (VFXItem.isExtraCamera(item)) {
|
|
29958
29983
|
this.extraCamera = item;
|
|
@@ -30138,7 +30163,7 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
30138
30163
|
if (!parentItem) {
|
|
30139
30164
|
itemNode.parentId = undefined;
|
|
30140
30165
|
item.parent = undefined;
|
|
30141
|
-
item.transform.parentTransform = this.transform;
|
|
30166
|
+
item.transform.parentTransform = VFXItem.isExtraCamera(item) ? new Transform() : this.transform;
|
|
30142
30167
|
}
|
|
30143
30168
|
else {
|
|
30144
30169
|
var parentNode = this.itemCacheMap.get(parentItem.id);
|
|
@@ -35773,7 +35798,7 @@ var Player = /** @class */ (function () {
|
|
|
35773
35798
|
Player.prototype.createComposition = function (url, options) {
|
|
35774
35799
|
if (options === void 0) { options = {}; }
|
|
35775
35800
|
return __awaiter(this, void 0, void 0, function () {
|
|
35776
|
-
var renderer, last, opts,
|
|
35801
|
+
var renderer, last, opts, source, scene, composition, firstFrameTime;
|
|
35777
35802
|
var _this = this;
|
|
35778
35803
|
return __generator(this, function (_a) {
|
|
35779
35804
|
switch (_a.label) {
|
|
@@ -35794,14 +35819,9 @@ var Player = /** @class */ (function () {
|
|
|
35794
35819
|
else {
|
|
35795
35820
|
this.assetManager = new AssetManager(opts);
|
|
35796
35821
|
}
|
|
35797
|
-
|
|
35798
|
-
|
|
35799
|
-
return [3 /*break*/, 3];
|
|
35800
|
-
case 1: return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
35801
|
-
case 2:
|
|
35822
|
+
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
35823
|
+
case 1:
|
|
35802
35824
|
scene = _a.sent();
|
|
35803
|
-
_a.label = 3;
|
|
35804
|
-
case 3:
|
|
35805
35825
|
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);
|
|
35806
35826
|
if (this.ticker) {
|
|
35807
35827
|
if (composition.renderLevel === RenderLevel$1.B) {
|
|
@@ -35813,7 +35833,7 @@ var Player = /** @class */ (function () {
|
|
|
35813
35833
|
resolve(null);
|
|
35814
35834
|
});
|
|
35815
35835
|
})];
|
|
35816
|
-
case
|
|
35836
|
+
case 2:
|
|
35817
35837
|
_a.sent();
|
|
35818
35838
|
if (opts.autoplay) {
|
|
35819
35839
|
this.autoPlaying = true;
|
|
@@ -35971,38 +35991,29 @@ var Player = /** @class */ (function () {
|
|
|
35971
35991
|
var _this = this;
|
|
35972
35992
|
var _a, _b, _c;
|
|
35973
35993
|
dt = Math.min(dt, 33) * this.speed;
|
|
35974
|
-
var removed = false;
|
|
35975
35994
|
var comps = this.compositions;
|
|
35976
35995
|
var skipRender = false;
|
|
35977
35996
|
comps.sort(function (a, b) { return a.getIndex() - b.getIndex(); });
|
|
35978
|
-
|
|
35997
|
+
this.compositions = [];
|
|
35998
|
+
for (var i = 0; i < comps.length; i++) {
|
|
35999
|
+
var composition = comps[i];
|
|
35979
36000
|
if (composition.textureOffloaded) {
|
|
35980
36001
|
skipRender = true;
|
|
35981
36002
|
console.error({
|
|
35982
36003
|
content: "Composition ".concat(composition.name, " texture offloaded, skip render."),
|
|
35983
36004
|
type: LOG_TYPE,
|
|
35984
36005
|
});
|
|
36006
|
+
this.compositions.push(composition);
|
|
36007
|
+
continue;
|
|
35985
36008
|
}
|
|
35986
|
-
if (composition.isDestroyed) {
|
|
35987
|
-
delete comps[i];
|
|
35988
|
-
removed = true;
|
|
35989
|
-
return;
|
|
35990
|
-
}
|
|
35991
|
-
if (composition.renderer) {
|
|
36009
|
+
if (!composition.isDestroyed && composition.renderer) {
|
|
35992
36010
|
composition.update(dt);
|
|
35993
36011
|
}
|
|
35994
|
-
if (composition.isDestroyed) {
|
|
35995
|
-
|
|
35996
|
-
removed = true;
|
|
35997
|
-
return;
|
|
36012
|
+
if (!composition.isDestroyed) {
|
|
36013
|
+
this.compositions.push(composition);
|
|
35998
36014
|
}
|
|
35999
|
-
});
|
|
36000
|
-
if (removed) {
|
|
36001
|
-
comps = comps.filter(function (comp) { return comp; });
|
|
36002
|
-
comps.map(function (comp, index) { return comp.setIndex(index); });
|
|
36003
|
-
this.compositions = comps;
|
|
36004
36015
|
}
|
|
36005
|
-
this.baseCompositionIndex =
|
|
36016
|
+
this.baseCompositionIndex = this.compositions.length;
|
|
36006
36017
|
if (skipRender) {
|
|
36007
36018
|
(_a = this.handleRenderError) === null || _a === void 0 ? void 0 : _a.call(this, new Error('play when texture offloaded'));
|
|
36008
36019
|
return (_b = this.ticker) === null || _b === void 0 ? void 0 : _b.pause();
|
|
@@ -36012,7 +36023,7 @@ var Player = /** @class */ (function () {
|
|
|
36012
36023
|
var gl = this.renderer.context.gl;
|
|
36013
36024
|
var time = (level === 2 && this.reportGPUTime) ? gpuTimer(gl) : undefined;
|
|
36014
36025
|
time === null || time === void 0 ? void 0 : time.begin();
|
|
36015
|
-
if (this.compositions.length || forceRender) {
|
|
36026
|
+
if (this.compositions.length || this.compositions.length < comps.length || forceRender) {
|
|
36016
36027
|
this.renderer.setFrameBuffer(null);
|
|
36017
36028
|
this.renderer.clear({
|
|
36018
36029
|
stencilAction: TextureLoadAction.clear,
|
|
@@ -36358,9 +36369,9 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
36358
36369
|
Engine.create = function (gl) {
|
|
36359
36370
|
return new GLEngine(gl);
|
|
36360
36371
|
};
|
|
36361
|
-
var version = "1.1.
|
|
36372
|
+
var version = "1.1.4";
|
|
36362
36373
|
console.info({
|
|
36363
|
-
content: '[Galacean Effects Player] version: ' + "1.1.
|
|
36374
|
+
content: '[Galacean Effects Player] version: ' + "1.1.4",
|
|
36364
36375
|
type: LOG_TYPE,
|
|
36365
36376
|
});
|
|
36366
36377
|
|