@galacean/effects-threejs 1.1.2 → 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 +112 -83
- 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 +112 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin 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';
|
|
@@ -9349,11 +9349,9 @@ var Matrix4 = /** @class */ (function () {
|
|
|
9349
9349
|
var vX = Matrix4.tempVec0;
|
|
9350
9350
|
var vY = Matrix4.tempVec1;
|
|
9351
9351
|
var vZ = Matrix4.tempVec2;
|
|
9352
|
-
vZ.subtractVectors(
|
|
9352
|
+
vZ.subtractVectors(eye, target);
|
|
9353
9353
|
vZ.normalize();
|
|
9354
|
-
|
|
9355
|
-
vY.normalize();
|
|
9356
|
-
vX.crossVectors(vY, vZ);
|
|
9354
|
+
vX.crossVectors(up, vZ);
|
|
9357
9355
|
vX.normalize();
|
|
9358
9356
|
vY.crossVectors(vZ, vX);
|
|
9359
9357
|
var te = this.elements;
|
|
@@ -14757,6 +14755,9 @@ var VFXItem = /** @class */ (function () {
|
|
|
14757
14755
|
VFXItem.isTree = function (item) {
|
|
14758
14756
|
return item.type === ItemType$1.tree;
|
|
14759
14757
|
};
|
|
14758
|
+
VFXItem.isCamera = function (item) {
|
|
14759
|
+
return item.type === ItemType$1.camera;
|
|
14760
|
+
};
|
|
14760
14761
|
VFXItem.isExtraCamera = function (item) {
|
|
14761
14762
|
return item.id === 'extra-camera' && item.name === 'extra-camera';
|
|
14762
14763
|
};
|
|
@@ -14957,10 +14958,11 @@ var VFXItem = /** @class */ (function () {
|
|
|
14957
14958
|
}
|
|
14958
14959
|
else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
14959
14960
|
this._contentVisible = false;
|
|
14961
|
+
shouldUpdate = true;
|
|
14962
|
+
dt = 0;
|
|
14960
14963
|
// 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
|
|
14961
14964
|
if (this.type === ItemType$1.composition) {
|
|
14962
14965
|
this.handleVisibleChanged(false);
|
|
14963
|
-
this.onItemUpdate(0, lifetime);
|
|
14964
14966
|
}
|
|
14965
14967
|
}
|
|
14966
14968
|
lifetime = Math.min(lifetime, 1);
|
|
@@ -15544,10 +15546,6 @@ var CameraVFXItem = /** @class */ (function (_super) {
|
|
|
15544
15546
|
(_a = this.controller) === null || _a === void 0 ? void 0 : _a.update(lifetime);
|
|
15545
15547
|
this.updateCamera();
|
|
15546
15548
|
};
|
|
15547
|
-
// override onEnd () {
|
|
15548
|
-
// this.controller?.update(1);
|
|
15549
|
-
// this.updateCamera();
|
|
15550
|
-
// }
|
|
15551
15549
|
CameraVFXItem.prototype.updateCamera = function () {
|
|
15552
15550
|
if (this.controller && this.composition) {
|
|
15553
15551
|
var camera = this.composition.camera;
|
|
@@ -16042,7 +16040,7 @@ function loadImage(source) {
|
|
|
16042
16040
|
}
|
|
16043
16041
|
// 2. 非法类型
|
|
16044
16042
|
if (!url) {
|
|
16045
|
-
throw new Error("Invalid url type: ".concat(source));
|
|
16043
|
+
throw new Error("Invalid url type: ".concat(JSON.stringify(source)));
|
|
16046
16044
|
}
|
|
16047
16045
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
16048
16046
|
var img = new Image();
|
|
@@ -16061,7 +16059,7 @@ function loadImage(source) {
|
|
|
16061
16059
|
if (revokeURL) {
|
|
16062
16060
|
URL.revokeObjectURL(url);
|
|
16063
16061
|
}
|
|
16064
|
-
return reject("Load image fail: ".concat(e));
|
|
16062
|
+
return reject("Load image fail: ".concat(JSON.stringify(e)));
|
|
16065
16063
|
};
|
|
16066
16064
|
img.src = url;
|
|
16067
16065
|
})];
|
|
@@ -23592,7 +23590,7 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23592
23590
|
configurable: true
|
|
23593
23591
|
});
|
|
23594
23592
|
ParticleSystem.prototype.updateEmitterTransform = function (time) {
|
|
23595
|
-
var parentTransform = this.parentTransform;
|
|
23593
|
+
var parentTransform = this.transform.parentTransform;
|
|
23596
23594
|
var _a = this.basicTransform, path = _a.path, position = _a.position;
|
|
23597
23595
|
var selfPos = position.clone();
|
|
23598
23596
|
if (path) {
|
|
@@ -23602,9 +23600,9 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23602
23600
|
this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
|
|
23603
23601
|
if (this.options.particleFollowParent && parentTransform) {
|
|
23604
23602
|
var tempMatrix = parentTransform.getWorldMatrix();
|
|
23605
|
-
this.particleMesh.mesh.worldMatrix = tempMatrix
|
|
23603
|
+
this.particleMesh.mesh.worldMatrix = tempMatrix;
|
|
23606
23604
|
if (this.trailMesh) {
|
|
23607
|
-
this.trailMesh.mesh.worldMatrix = tempMatrix
|
|
23605
|
+
this.trailMesh.mesh.worldMatrix = tempMatrix;
|
|
23608
23606
|
}
|
|
23609
23607
|
}
|
|
23610
23608
|
};
|
|
@@ -23623,8 +23621,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23623
23621
|
link.pushNode(linkContent);
|
|
23624
23622
|
this.particleMesh.setPoint(point, pointIndex);
|
|
23625
23623
|
this.clearPointTrail(pointIndex);
|
|
23626
|
-
if (this.
|
|
23627
|
-
this.trailMesh.setPointStartPos(pointIndex, this.parentTransform.position.clone());
|
|
23624
|
+
if (this.trailMesh) {
|
|
23625
|
+
this.trailMesh.setPointStartPos(pointIndex, this.transform.parentTransform.position.clone());
|
|
23628
23626
|
}
|
|
23629
23627
|
};
|
|
23630
23628
|
ParticleSystem.prototype.setVisible = function (visible) {
|
|
@@ -23662,7 +23660,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23662
23660
|
}
|
|
23663
23661
|
};
|
|
23664
23662
|
ParticleSystem.prototype.setParentTransform = function (transform) {
|
|
23665
|
-
this.parentTransform = transform;
|
|
23663
|
+
// this.transform.parentTransform = transform;
|
|
23664
|
+
// this.parentTransform = transform;
|
|
23666
23665
|
};
|
|
23667
23666
|
ParticleSystem.prototype.getTextures = function () {
|
|
23668
23667
|
var e_1, _a, e_2, _b;
|
|
@@ -23955,8 +23954,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
23955
23954
|
if (trails.sizeAffectsLifetime) {
|
|
23956
23955
|
lifetime *= size[0];
|
|
23957
23956
|
}
|
|
23958
|
-
if (trails.parentAffectsPosition && this.parentTransform) {
|
|
23959
|
-
position.add(this.parentTransform.position);
|
|
23957
|
+
if (trails.parentAffectsPosition && this.transform.parentTransform) {
|
|
23958
|
+
position.add(this.transform.parentTransform.position);
|
|
23960
23959
|
var pos = this.trailMesh.getPointStartPos(pointIndex);
|
|
23961
23960
|
if (pos) {
|
|
23962
23961
|
position.subtract(pos);
|
|
@@ -24196,12 +24195,11 @@ var ParticleVFXItem = /** @class */ (function (_super) {
|
|
|
24196
24195
|
ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
|
|
24197
24196
|
var _a;
|
|
24198
24197
|
if (this.content) {
|
|
24199
|
-
var hide = !this.
|
|
24198
|
+
var hide = !this.visible;
|
|
24200
24199
|
var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
|
|
24201
24200
|
if (!hide && parentItem) {
|
|
24202
24201
|
var parentData = parentItem.getRenderData();
|
|
24203
24202
|
if (parentData) {
|
|
24204
|
-
this.content.setParentTransform(parentData.transform);
|
|
24205
24203
|
if (!parentData.visible) {
|
|
24206
24204
|
hide = false;
|
|
24207
24205
|
}
|
|
@@ -29204,7 +29202,6 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29204
29202
|
}
|
|
29205
29203
|
var cachedTextures = textureOptions.map(function (option) { return option && (option instanceof Texture ? option : Texture.create(engine, option)); });
|
|
29206
29204
|
// 缓存创建的Texture对象
|
|
29207
|
-
// @ts-expect-error
|
|
29208
29205
|
scene.textureOptions = cachedTextures;
|
|
29209
29206
|
cachedTextures === null || cachedTextures === void 0 ? void 0 : cachedTextures.forEach(function (tex) { return tex === null || tex === void 0 ? void 0 : tex.initialize(); });
|
|
29210
29207
|
try {
|
|
@@ -29258,7 +29255,6 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29258
29255
|
CompositionSourceManager.prototype.assembleItems = function (composition) {
|
|
29259
29256
|
var _this = this;
|
|
29260
29257
|
var items = [];
|
|
29261
|
-
this.mask++;
|
|
29262
29258
|
composition.items.forEach(function (item) {
|
|
29263
29259
|
var _a;
|
|
29264
29260
|
var option = {};
|
|
@@ -29274,9 +29270,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29274
29270
|
option.type = type;
|
|
29275
29271
|
if (renderContent.renderer) {
|
|
29276
29272
|
renderContent.renderer = _this.changeTex(renderContent.renderer);
|
|
29277
|
-
|
|
29278
|
-
_this.processMask(renderContent.renderer, _this.mask);
|
|
29279
|
-
}
|
|
29273
|
+
_this.processMask(renderContent.renderer);
|
|
29280
29274
|
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
29281
29275
|
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
29282
29276
|
// TODO: scene.shapes 类型问题?
|
|
@@ -29321,7 +29315,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29321
29315
|
}
|
|
29322
29316
|
// 处理预合成的渲染顺序
|
|
29323
29317
|
if (option.type === ItemType$1.composition) {
|
|
29324
|
-
|
|
29318
|
+
++_this.mask;
|
|
29325
29319
|
var refId = item.content.options.refId;
|
|
29326
29320
|
if (!_this.refCompositions.get(refId)) {
|
|
29327
29321
|
throw new Error('Invalid Ref Composition id: ' + refId);
|
|
@@ -29332,7 +29326,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29332
29326
|
}
|
|
29333
29327
|
ref.items.forEach(function (item) {
|
|
29334
29328
|
item.listIndex = listOrder++;
|
|
29335
|
-
_this.processMask(item.content
|
|
29329
|
+
_this.processMask(item.content);
|
|
29336
29330
|
});
|
|
29337
29331
|
option.items = ref.items;
|
|
29338
29332
|
}
|
|
@@ -29371,11 +29365,17 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29371
29365
|
/**
|
|
29372
29366
|
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
29373
29367
|
*/
|
|
29374
|
-
CompositionSourceManager.prototype.processMask = function (renderer
|
|
29368
|
+
CompositionSourceManager.prototype.processMask = function (renderer) {
|
|
29369
|
+
if (renderer.maskMode === MaskMode$1.NONE) {
|
|
29370
|
+
return;
|
|
29371
|
+
}
|
|
29375
29372
|
if (!renderer.mask) {
|
|
29376
29373
|
var maskMode = renderer.maskMode;
|
|
29377
|
-
if (maskMode
|
|
29378
|
-
renderer.mask =
|
|
29374
|
+
if (maskMode === MaskMode$1.MASK) {
|
|
29375
|
+
renderer.mask = ++this.mask;
|
|
29376
|
+
}
|
|
29377
|
+
else if (maskMode === MaskMode$1.OBSCURED || maskMode === MaskMode$1.REVERSE_OBSCURED) {
|
|
29378
|
+
renderer.mask = this.mask;
|
|
29379
29379
|
}
|
|
29380
29380
|
}
|
|
29381
29381
|
};
|
|
@@ -29431,29 +29431,29 @@ var AssetManager = /** @class */ (function () {
|
|
|
29431
29431
|
this.timeout = timeout;
|
|
29432
29432
|
};
|
|
29433
29433
|
/**
|
|
29434
|
-
*
|
|
29435
|
-
* 通过 json 创建出场景对象,并进行提前编译等工作
|
|
29434
|
+
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
29436
29435
|
* @param url - json 的 URL 链接或者 json 对象
|
|
29437
29436
|
* @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
|
|
29438
29437
|
* @param options - 扩展参数
|
|
29439
29438
|
* @returns
|
|
29440
29439
|
*/
|
|
29441
29440
|
AssetManager.prototype.loadScene = function (url, renderer, options) {
|
|
29442
|
-
var _a, _b;
|
|
29441
|
+
var _a, _b, _c;
|
|
29443
29442
|
return __awaiter(this, void 0, void 0, function () {
|
|
29444
|
-
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29443
|
+
var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
29445
29444
|
var _this = this;
|
|
29446
|
-
return __generator(this, function (
|
|
29445
|
+
return __generator(this, function (_d) {
|
|
29447
29446
|
timeLabel = "Load asset: ".concat(isString(url) ? url : this.id);
|
|
29448
29447
|
startTime = performance.now();
|
|
29449
29448
|
timeInfos = [];
|
|
29450
29449
|
gpuInstance = renderer === null || renderer === void 0 ? void 0 : renderer.engine.gpuCapability;
|
|
29451
29450
|
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;
|
|
29451
|
+
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
29452
29452
|
cancelLoading = false;
|
|
29453
29453
|
waitPromise = new Promise(function (resolve, reject) {
|
|
29454
29454
|
return loadTimer = window.setTimeout(function () {
|
|
29455
29455
|
cancelLoading = true;
|
|
29456
|
-
reject("Load time out: ".concat(url));
|
|
29456
|
+
reject("Load time out: ".concat(JSON.stringify(url)));
|
|
29457
29457
|
}, _this.timeout * 1000);
|
|
29458
29458
|
});
|
|
29459
29459
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -29473,10 +29473,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
29473
29473
|
});
|
|
29474
29474
|
}); };
|
|
29475
29475
|
loadResourcePromise = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
29476
|
-
var
|
|
29476
|
+
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;
|
|
29477
29477
|
var _this = this;
|
|
29478
|
-
return __generator(this, function (
|
|
29479
|
-
switch (
|
|
29478
|
+
return __generator(this, function (_e) {
|
|
29479
|
+
switch (_e.label) {
|
|
29480
29480
|
case 0:
|
|
29481
29481
|
if (!isObject(url)) return [3 /*break*/, 1];
|
|
29482
29482
|
// TODO: 原 JSONLoader contructor 判断是否兼容
|
|
@@ -29489,42 +29489,66 @@ var AssetManager = /** @class */ (function () {
|
|
|
29489
29489
|
this.baseUrl = url;
|
|
29490
29490
|
return [4 /*yield*/, hookTimeInfo('loadJSON', function () { return _this.loadJSON(url); })];
|
|
29491
29491
|
case 2:
|
|
29492
|
-
rawJSON =
|
|
29493
|
-
|
|
29494
|
-
case 3:
|
|
29492
|
+
rawJSON = _e.sent();
|
|
29493
|
+
_e.label = 3;
|
|
29494
|
+
case 3:
|
|
29495
|
+
if (!isScene(rawJSON)) return [3 /*break*/, 6];
|
|
29496
|
+
// 已经加载过的 可能需要更新数据模板
|
|
29497
|
+
scene = __assign$1({}, rawJSON);
|
|
29498
|
+
if (!(this.options && this.options.variables && Object.keys(this.options.variables).length !== 0)) return [3 /*break*/, 5];
|
|
29499
|
+
rawImages = rawJSON.jsonScene.images;
|
|
29500
|
+
images_1 = scene.images;
|
|
29501
|
+
for (i = 0; i < rawImages.length; i++) {
|
|
29502
|
+
// 仅重新加载数据模板对应的图片
|
|
29503
|
+
if (images_1[i] instanceof HTMLCanvasElement) {
|
|
29504
|
+
images_1[i] = rawImages[i];
|
|
29505
|
+
}
|
|
29506
|
+
}
|
|
29507
|
+
_a = scene;
|
|
29508
|
+
return [4 /*yield*/, hookTimeInfo('processImages', function () { return _this.processImages(images_1, scene.usedImages, compressedTexture); })];
|
|
29495
29509
|
case 4:
|
|
29496
|
-
_a =
|
|
29497
|
-
|
|
29510
|
+
_a.images = _e.sent();
|
|
29511
|
+
// 更新 TextureOptions 中的 image 指向
|
|
29512
|
+
for (i = 0; i < scene.images.length; i++) {
|
|
29513
|
+
scene.textureOptions[i].image = scene.images[i];
|
|
29514
|
+
}
|
|
29515
|
+
_e.label = 5;
|
|
29516
|
+
case 5: return [3 /*break*/, 12];
|
|
29517
|
+
case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
|
|
29518
|
+
case 7:
|
|
29519
|
+
_b = _e.sent(), usedImages_1 = _b.usedImages, jsonScene_1 = _b.jsonScene, pluginSystem_1 = _b.pluginSystem;
|
|
29520
|
+
_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;
|
|
29498
29521
|
return [4 /*yield*/, Promise.all([
|
|
29499
|
-
hookTimeInfo('processBins', function () { return _this.processBins(
|
|
29500
|
-
hookTimeInfo('processImages', function () {
|
|
29501
|
-
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(
|
|
29522
|
+
hookTimeInfo('processBins', function () { return _this.processBins(bins_1); }),
|
|
29523
|
+
hookTimeInfo('processImages', function () { return _this.processImages(images_2, usedImages_1, compressedTexture); }),
|
|
29524
|
+
hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(compositions_1, pluginSystem_1, renderer, options); }),
|
|
29502
29525
|
])];
|
|
29503
|
-
case
|
|
29504
|
-
|
|
29505
|
-
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(
|
|
29506
|
-
case
|
|
29507
|
-
|
|
29508
|
-
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(
|
|
29509
|
-
case
|
|
29510
|
-
loadedTextures =
|
|
29526
|
+
case 8:
|
|
29527
|
+
_d = __read$3.apply(void 0, [_e.sent(), 2]), loadedBins_1 = _d[0], loadedImages_1 = _d[1];
|
|
29528
|
+
return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(fonts_1); })];
|
|
29529
|
+
case 9:
|
|
29530
|
+
_e.sent();
|
|
29531
|
+
return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
|
|
29532
|
+
case 10:
|
|
29533
|
+
loadedTextures = _e.sent();
|
|
29511
29534
|
scene = {
|
|
29512
|
-
jsonScene: jsonScene,
|
|
29513
|
-
images: loadedImages,
|
|
29514
|
-
textureOptions: loadedTextures,
|
|
29515
|
-
bins: loadedBins,
|
|
29516
|
-
storage: {},
|
|
29517
|
-
pluginSystem: this.pluginSystem,
|
|
29518
|
-
renderLevel: this.options.renderLevel,
|
|
29519
|
-
totalTime: 0,
|
|
29520
|
-
startTime: 0,
|
|
29521
29535
|
url: url,
|
|
29536
|
+
renderLevel: this.options.renderLevel,
|
|
29537
|
+
storage: {},
|
|
29538
|
+
pluginSystem: pluginSystem_1,
|
|
29539
|
+
jsonScene: jsonScene_1,
|
|
29540
|
+
usedImages: usedImages_1,
|
|
29541
|
+
images: loadedImages_1,
|
|
29542
|
+
textureOptions: loadedTextures,
|
|
29543
|
+
bins: loadedBins_1,
|
|
29522
29544
|
};
|
|
29523
29545
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29524
|
-
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return
|
|
29525
|
-
case
|
|
29546
|
+
return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return pluginSystem_1.loadResources(scene, _this.options); })];
|
|
29547
|
+
case 11:
|
|
29526
29548
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29527
|
-
|
|
29549
|
+
_e.sent();
|
|
29550
|
+
_e.label = 12;
|
|
29551
|
+
case 12:
|
|
29528
29552
|
totalTime = performance.now() - startTime;
|
|
29529
29553
|
console.info({
|
|
29530
29554
|
content: "".concat(timeLabel, ": ").concat(totalTime.toFixed(4), "ms, ").concat(timeInfos.join(' ')),
|
|
@@ -29541,7 +29565,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29541
29565
|
});
|
|
29542
29566
|
});
|
|
29543
29567
|
};
|
|
29544
|
-
AssetManager.prototype.precompile = function (compositions, renderer, options) {
|
|
29568
|
+
AssetManager.prototype.precompile = function (compositions, pluginSystem, renderer, options) {
|
|
29545
29569
|
return __awaiter(this, void 0, void 0, function () {
|
|
29546
29570
|
var shaderLibrary;
|
|
29547
29571
|
return __generator(this, function (_a) {
|
|
@@ -29551,7 +29575,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29551
29575
|
return [2 /*return*/];
|
|
29552
29576
|
}
|
|
29553
29577
|
shaderLibrary = renderer === null || renderer === void 0 ? void 0 : renderer.getShaderLibrary();
|
|
29554
|
-
return [4 /*yield*/,
|
|
29578
|
+
return [4 /*yield*/, (pluginSystem === null || pluginSystem === void 0 ? void 0 : pluginSystem.precompile(compositions, renderer, options))];
|
|
29555
29579
|
case 1:
|
|
29556
29580
|
_a.sent();
|
|
29557
29581
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
@@ -29568,7 +29592,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29568
29592
|
};
|
|
29569
29593
|
AssetManager.prototype.processJSON = function (json) {
|
|
29570
29594
|
return __awaiter(this, void 0, void 0, function () {
|
|
29571
|
-
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, renderLevel, usedImages;
|
|
29595
|
+
var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, pluginSystem, renderLevel, usedImages;
|
|
29572
29596
|
return __generator(this, function (_b) {
|
|
29573
29597
|
switch (_b.label) {
|
|
29574
29598
|
case 0:
|
|
@@ -29582,8 +29606,8 @@ var AssetManager = /** @class */ (function () {
|
|
|
29582
29606
|
}
|
|
29583
29607
|
});
|
|
29584
29608
|
_a = jsonScene.plugins, plugins = _a === void 0 ? [] : _a, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
|
|
29585
|
-
|
|
29586
|
-
return [4 /*yield*/,
|
|
29609
|
+
pluginSystem = new PluginSystem(plugins);
|
|
29610
|
+
return [4 /*yield*/, pluginSystem.processRawJSON(jsonScene, this.options)];
|
|
29587
29611
|
case 1:
|
|
29588
29612
|
_b.sent();
|
|
29589
29613
|
renderLevel = this.options.renderLevel;
|
|
@@ -29600,6 +29624,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29600
29624
|
return [2 /*return*/, {
|
|
29601
29625
|
usedImages: usedImages,
|
|
29602
29626
|
jsonScene: jsonScene,
|
|
29627
|
+
pluginSystem: pluginSystem,
|
|
29603
29628
|
}];
|
|
29604
29629
|
}
|
|
29605
29630
|
});
|
|
@@ -29618,7 +29643,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29618
29643
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
29619
29644
|
return _this.loadBins(bin.url);
|
|
29620
29645
|
}
|
|
29621
|
-
throw new Error("Invalid bins source: ".concat(bins));
|
|
29646
|
+
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
29622
29647
|
});
|
|
29623
29648
|
return [2 /*return*/, Promise.all(jobs)];
|
|
29624
29649
|
});
|
|
@@ -29654,7 +29679,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29654
29679
|
case 3:
|
|
29655
29680
|
_b.sent();
|
|
29656
29681
|
console.warn({
|
|
29657
|
-
content: "Invalid fonts source: ".concat(font.fontURL),
|
|
29682
|
+
content: "Invalid fonts source: ".concat(JSON.stringify(font.fontURL)),
|
|
29658
29683
|
type: LOG_TYPE,
|
|
29659
29684
|
});
|
|
29660
29685
|
return [3 /*break*/, 4];
|
|
@@ -29823,7 +29848,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29823
29848
|
return __generator(this, function (_a) {
|
|
29824
29849
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
29825
29850
|
_this.downloader.downloadJSON(url, resolve, function (status, responseText) {
|
|
29826
|
-
reject("Couldn't load JSON ".concat(url, ": status ").concat(status, ", ").concat(responseText));
|
|
29851
|
+
reject("Couldn't load JSON ".concat(JSON.stringify(url), ": status ").concat(status, ", ").concat(responseText));
|
|
29827
29852
|
});
|
|
29828
29853
|
})];
|
|
29829
29854
|
});
|
|
@@ -29835,7 +29860,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29835
29860
|
return __generator(this, function (_a) {
|
|
29836
29861
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
29837
29862
|
_this.downloader.downloadBinary(url, resolve, function (status, responseText) {
|
|
29838
|
-
reject("Couldn't load bins ".concat(url, ": status ").concat(status, ", ").concat(responseText));
|
|
29863
|
+
reject("Couldn't load bins ".concat(JSON.stringify(url), ": status ").concat(status, ", ").concat(responseText));
|
|
29839
29864
|
});
|
|
29840
29865
|
})];
|
|
29841
29866
|
});
|
|
@@ -29983,7 +30008,8 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
29983
30008
|
}
|
|
29984
30009
|
else {
|
|
29985
30010
|
item = createVFXItem(this.itemProps[i], this.composition);
|
|
29986
|
-
|
|
30011
|
+
// 相机不跟随合成移动
|
|
30012
|
+
item.transform.parentTransform = VFXItem.isCamera(item) ? new Transform() : this.transform;
|
|
29987
30013
|
}
|
|
29988
30014
|
if (VFXItem.isExtraCamera(item)) {
|
|
29989
30015
|
this.extraCamera = item;
|
|
@@ -30169,7 +30195,7 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
30169
30195
|
if (!parentItem) {
|
|
30170
30196
|
itemNode.parentId = undefined;
|
|
30171
30197
|
item.parent = undefined;
|
|
30172
|
-
item.transform.parentTransform = this.transform;
|
|
30198
|
+
item.transform.parentTransform = VFXItem.isExtraCamera(item) ? new Transform() : this.transform;
|
|
30173
30199
|
}
|
|
30174
30200
|
else {
|
|
30175
30201
|
var parentNode = this.itemCacheMap.get(parentItem.id);
|
|
@@ -31181,7 +31207,10 @@ var Ticker = /** @class */ (function () {
|
|
|
31181
31207
|
};
|
|
31182
31208
|
Ticker.prototype.setFPS = function (fps) {
|
|
31183
31209
|
this.targetFPS = clamp$1(fps, 1, 120);
|
|
31184
|
-
|
|
31210
|
+
// 注意:-2 的原因是保证帧率稳定
|
|
31211
|
+
// interval 在 fps 为 60 的时候设成 15 累计误差会很大,设成 14 较稳定
|
|
31212
|
+
// requestanimationFrame 在不同的刷新率下时间间隔不一样,120hz 的误差在 8 以内,60hz 的误差在 16 以内
|
|
31213
|
+
this.interval = Math.floor(1000 / fps) - 2;
|
|
31185
31214
|
};
|
|
31186
31215
|
/**
|
|
31187
31216
|
* 获取定时器暂停标志位
|
|
@@ -32781,9 +32810,9 @@ Geometry.create = function (engine, options) {
|
|
|
32781
32810
|
Mesh.create = function (engine, props) {
|
|
32782
32811
|
return new ThreeMesh(engine, props);
|
|
32783
32812
|
};
|
|
32784
|
-
var version = "1.1.
|
|
32813
|
+
var version = "1.1.4";
|
|
32785
32814
|
console.info({
|
|
32786
|
-
content: '[Galacean Effects THREEJS] version: ' + "1.1.
|
|
32815
|
+
content: '[Galacean Effects THREEJS] version: ' + "1.1.4",
|
|
32787
32816
|
type: LOG_TYPE,
|
|
32788
32817
|
});
|
|
32789
32818
|
|