@galacean/effects-threejs 2.4.6 → 2.4.8
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 +57 -91
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +57 -91
- 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: v2.4.
|
|
6
|
+
* Version: v2.4.8
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -20161,7 +20161,7 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
20161
20161
|
this.playable.play();
|
|
20162
20162
|
}
|
|
20163
20163
|
this.parentMixer.setClipWeight(this.playable, weight);
|
|
20164
|
-
var clipTime =
|
|
20164
|
+
var clipTime = clip.toLocalTime(localTime);
|
|
20165
20165
|
this.playable.setTime(clipTime);
|
|
20166
20166
|
// 判断动画是否结束
|
|
20167
20167
|
if (ended) {
|
|
@@ -21161,13 +21161,12 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21161
21161
|
_this._textures = [];
|
|
21162
21162
|
var _props_reusable = props.reusable, reusable = _props_reusable === void 0 ? false : _props_reusable, _props_speed = props.speed, speed = _props_speed === void 0 ? 1 : _props_speed, _props_baseRenderOrder = props.baseRenderOrder, baseRenderOrder = _props_baseRenderOrder === void 0 ? 0 : _props_baseRenderOrder, renderer = props.renderer, event = props.event, width = props.width, height = props.height, handleItemMessage = props.handleItemMessage;
|
|
21163
21163
|
_this.renderer = renderer;
|
|
21164
|
-
_this._textures = scene.
|
|
21164
|
+
_this._textures = scene.textures;
|
|
21165
21165
|
var _scene_jsonScene_renderSettings_postProcessingEnabled;
|
|
21166
21166
|
_this.postProcessingEnabled = (_scene_jsonScene_renderSettings_postProcessingEnabled = (_scene_jsonScene_renderSettings = scene.jsonScene.renderSettings) == null ? void 0 : _scene_jsonScene_renderSettings.postProcessingEnabled) != null ? _scene_jsonScene_renderSettings_postProcessingEnabled : false;
|
|
21167
21167
|
_this.getEngine().renderLevel = scene.renderLevel;
|
|
21168
21168
|
if (reusable) {
|
|
21169
21169
|
_this.keepResource = true;
|
|
21170
|
-
scene.textures = undefined;
|
|
21171
21170
|
scene.consumed = true;
|
|
21172
21171
|
}
|
|
21173
21172
|
var sourceContent = scene.jsonScene.compositions[0];
|
|
@@ -21351,11 +21350,12 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21351
21350
|
* 前进合成到指定时间
|
|
21352
21351
|
* @param time - 相对0时刻的时间
|
|
21353
21352
|
*/ _proto.forwardTime = function forwardTime(time) {
|
|
21354
|
-
var deltaTime = time * 1000 - this.
|
|
21353
|
+
var deltaTime = time * 1000 - this.time * 1000;
|
|
21355
21354
|
var reverse = deltaTime < 0;
|
|
21356
21355
|
var step = 15;
|
|
21357
21356
|
var t = Math.abs(deltaTime);
|
|
21358
21357
|
var ss = reverse ? -step : step;
|
|
21358
|
+
// FIXME Update 中可能会修改合成时间,这边需要优化更新逻辑
|
|
21359
21359
|
for(t; t > step; t -= step){
|
|
21360
21360
|
this.update(ss);
|
|
21361
21361
|
}
|
|
@@ -21395,13 +21395,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21395
21395
|
this.callAwake(this.rootItem);
|
|
21396
21396
|
this.rootItem.beginPlay();
|
|
21397
21397
|
}
|
|
21398
|
-
var
|
|
21399
|
-
this.
|
|
21398
|
+
var previousCompositionTime = this.time;
|
|
21399
|
+
this.updateCompositionTime(deltaTime * this.speed / 1000);
|
|
21400
|
+
var deltaTimeInMs = (this.time - previousCompositionTime) * 1000;
|
|
21400
21401
|
this.updateVideo();
|
|
21401
21402
|
// 更新 model-tree-plugin
|
|
21402
|
-
this.updatePluginLoaders(
|
|
21403
|
-
this.sceneTicking.update.tick(
|
|
21404
|
-
this.sceneTicking.lateUpdate.tick(
|
|
21403
|
+
this.updatePluginLoaders(deltaTimeInMs);
|
|
21404
|
+
this.sceneTicking.update.tick(deltaTimeInMs);
|
|
21405
|
+
this.sceneTicking.lateUpdate.tick(deltaTimeInMs);
|
|
21405
21406
|
this.updateCamera();
|
|
21406
21407
|
this.prepareRender();
|
|
21407
21408
|
if (this.isEnded && !this.isEndCalled) {
|
|
@@ -21417,14 +21418,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21417
21418
|
_proto.shouldDispose = function shouldDispose() {
|
|
21418
21419
|
return this.isEnded && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
21419
21420
|
};
|
|
21420
|
-
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
21421
|
-
var startTimeInMs = this.startTime * 1000;
|
|
21422
|
-
var now = this.rootComposition.time * 1000;
|
|
21423
|
-
if (t < 0 && now + t < startTimeInMs) {
|
|
21424
|
-
return startTimeInMs - now;
|
|
21425
|
-
}
|
|
21426
|
-
return t;
|
|
21427
|
-
};
|
|
21428
21421
|
_proto.callAwake = function callAwake(item) {
|
|
21429
21422
|
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
21430
21423
|
var component = _step.value;
|
|
@@ -21469,14 +21462,18 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21469
21462
|
};
|
|
21470
21463
|
/**
|
|
21471
21464
|
* 更新主合成组件
|
|
21472
|
-
*/ _proto.
|
|
21465
|
+
*/ _proto.updateCompositionTime = function updateCompositionTime(deltaTime) {
|
|
21473
21466
|
if (this.rootComposition.state === PlayState.Paused || !this.rootComposition.isActiveAndEnabled) {
|
|
21474
21467
|
return;
|
|
21475
21468
|
}
|
|
21476
|
-
|
|
21477
|
-
var
|
|
21469
|
+
// 相对于合成开始时间的时间
|
|
21470
|
+
var localTime = this.time + deltaTime - this.startTime;
|
|
21471
|
+
if (deltaTime < 0 && localTime < 0) {
|
|
21472
|
+
localTime = 0;
|
|
21473
|
+
}
|
|
21478
21474
|
var duration = this.rootItem.duration;
|
|
21479
21475
|
var endBehavior = this.rootItem.endBehavior;
|
|
21476
|
+
var isEnded = false;
|
|
21480
21477
|
if (localTime - duration > 0.001) {
|
|
21481
21478
|
isEnded = true;
|
|
21482
21479
|
switch(endBehavior){
|
|
@@ -21501,7 +21498,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21501
21498
|
}
|
|
21502
21499
|
}
|
|
21503
21500
|
}
|
|
21504
|
-
this.rootComposition.time = localTime;
|
|
21501
|
+
this.rootComposition.time = localTime + this.startTime;
|
|
21505
21502
|
// end state changed, handle onEnd flags
|
|
21506
21503
|
if (this.isEnded !== isEnded) {
|
|
21507
21504
|
if (isEnded) {
|
|
@@ -26284,8 +26281,9 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
26284
26281
|
this.isDirty = true;
|
|
26285
26282
|
};
|
|
26286
26283
|
/**
|
|
26287
|
-
*
|
|
26288
|
-
* @param value
|
|
26284
|
+
* 设置字体样式
|
|
26285
|
+
* @param value 设置字体样式
|
|
26286
|
+
* @default "normal"
|
|
26289
26287
|
* @returns
|
|
26290
26288
|
*/ _proto.setFontStyle = function setFontStyle(value) {
|
|
26291
26289
|
if (this.textStyle.fontStyle === value) {
|
|
@@ -27436,7 +27434,6 @@ function getStandardInteractContent(ui) {
|
|
|
27436
27434
|
var currentMaskComponent;
|
|
27437
27435
|
var componentMap = new Map();
|
|
27438
27436
|
var itemMap = new Map();
|
|
27439
|
-
var refCompositions = new Map();
|
|
27440
27437
|
/**
|
|
27441
27438
|
* 3.1 版本数据适配
|
|
27442
27439
|
* - 富文本插件名称的适配
|
|
@@ -27484,27 +27481,20 @@ var refCompositions = new Map();
|
|
|
27484
27481
|
function version32Migration(json) {
|
|
27485
27482
|
componentMap.clear();
|
|
27486
27483
|
itemMap.clear();
|
|
27487
|
-
refCompositions.clear();
|
|
27488
27484
|
var compositions = json.compositions, items = json.items, components = json.components;
|
|
27489
27485
|
// 处理旧蒙版数据
|
|
27490
|
-
var mainComp = compositions[0];
|
|
27491
27486
|
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
27492
27487
|
var component = _step.value;
|
|
27493
27488
|
componentMap.set(component.id, component);
|
|
27494
27489
|
}
|
|
27495
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(
|
|
27496
|
-
var
|
|
27497
|
-
if (comp.id === json.compositionId) {
|
|
27498
|
-
mainComp = comp;
|
|
27499
|
-
} else {
|
|
27500
|
-
refCompositions.set(comp.id, comp);
|
|
27501
|
-
}
|
|
27502
|
-
}
|
|
27503
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(items), _step2; !(_step2 = _iterator2()).done;){
|
|
27504
|
-
var item = _step2.value;
|
|
27490
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(items), _step1; !(_step1 = _iterator1()).done;){
|
|
27491
|
+
var item = _step1.value;
|
|
27505
27492
|
itemMap.set(item.id, item);
|
|
27506
27493
|
}
|
|
27507
|
-
|
|
27494
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(compositions), _step2; !(_step2 = _iterator2()).done;){
|
|
27495
|
+
var comp = _step2.value;
|
|
27496
|
+
processContent(comp);
|
|
27497
|
+
}
|
|
27508
27498
|
return json;
|
|
27509
27499
|
}
|
|
27510
27500
|
function version33Migration(json) {
|
|
@@ -27589,12 +27579,6 @@ function processContent(composition) {
|
|
|
27589
27579
|
processMask(component);
|
|
27590
27580
|
}
|
|
27591
27581
|
}
|
|
27592
|
-
// 处理预合成的渲染顺序
|
|
27593
|
-
if (itemProps.type === ItemType.composition) {
|
|
27594
|
-
var refId = itemProps.content.options.refId;
|
|
27595
|
-
var comp = refCompositions.get(refId);
|
|
27596
|
-
comp && processContent(comp);
|
|
27597
|
-
}
|
|
27598
27582
|
}
|
|
27599
27583
|
}
|
|
27600
27584
|
function processMask(renderContent) {
|
|
@@ -28983,7 +28967,7 @@ var seed$1 = 1;
|
|
|
28983
28967
|
});
|
|
28984
28968
|
});
|
|
28985
28969
|
loadResourcePromise = /*#__PURE__*/ _async_to_generator(function() {
|
|
28986
|
-
var scene, link,
|
|
28970
|
+
var scene, link, _ref, jsonScene, pluginSystem, _jsonScene_bins, bins, images, fonts, _ref1, loadedBins, loadedImages, loadedTextures, totalTime;
|
|
28987
28971
|
return __generator(this, function(_state) {
|
|
28988
28972
|
switch(_state.label){
|
|
28989
28973
|
case 0:
|
|
@@ -29014,37 +28998,23 @@ var seed$1 = 1;
|
|
|
29014
28998
|
case 3:
|
|
29015
28999
|
if (!exports.Scene.isJSONObject(rawJSON)) return [
|
|
29016
29000
|
3,
|
|
29017
|
-
|
|
29001
|
+
4
|
|
29018
29002
|
];
|
|
29019
|
-
// 已经加载过的 可能需要更新数据模板
|
|
29020
29003
|
scene = _extends({}, rawJSON);
|
|
29021
|
-
jsonScene = scene.jsonScene, pluginSystem = scene.pluginSystem, loadedImages = scene.images;
|
|
29022
|
-
images = jsonScene.images;
|
|
29023
|
-
_this.assignImagesToAssets(images, loadedImages);
|
|
29024
|
-
return [
|
|
29025
|
-
4,
|
|
29026
|
-
Promise.all([
|
|
29027
|
-
hookTimeInfo("plugin:processAssets", function() {
|
|
29028
|
-
return _this.processPluginAssets(jsonScene, pluginSystem, options);
|
|
29029
|
-
})
|
|
29030
|
-
])
|
|
29031
|
-
];
|
|
29032
|
-
case 4:
|
|
29033
|
-
_state.sent();
|
|
29034
29004
|
return [
|
|
29035
29005
|
3,
|
|
29036
|
-
|
|
29006
|
+
9
|
|
29037
29007
|
];
|
|
29038
|
-
case
|
|
29008
|
+
case 4:
|
|
29039
29009
|
return [
|
|
29040
29010
|
4,
|
|
29041
29011
|
hookTimeInfo("processJSON", function() {
|
|
29042
29012
|
return _this.processJSON(rawJSON);
|
|
29043
29013
|
})
|
|
29044
29014
|
];
|
|
29045
|
-
case
|
|
29046
|
-
_ref = _state.sent(),
|
|
29047
|
-
_jsonScene_bins =
|
|
29015
|
+
case 5:
|
|
29016
|
+
_ref = _state.sent(), jsonScene = _ref.jsonScene, pluginSystem = _ref.pluginSystem;
|
|
29017
|
+
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
29048
29018
|
return [
|
|
29049
29019
|
4,
|
|
29050
29020
|
Promise.all([
|
|
@@ -29052,48 +29022,50 @@ var seed$1 = 1;
|
|
|
29052
29022
|
return _this.processBins(bins);
|
|
29053
29023
|
}),
|
|
29054
29024
|
hookTimeInfo("processImages", function() {
|
|
29055
|
-
return _this.processImages(
|
|
29025
|
+
return _this.processImages(images, compressedTexture);
|
|
29056
29026
|
}),
|
|
29057
29027
|
hookTimeInfo("plugin:processAssets", function() {
|
|
29058
|
-
return _this.processPluginAssets(
|
|
29028
|
+
return _this.processPluginAssets(jsonScene, pluginSystem, options);
|
|
29059
29029
|
}),
|
|
29060
29030
|
hookTimeInfo("processFontURL", function() {
|
|
29061
29031
|
return _this.processFontURL(fonts);
|
|
29062
29032
|
})
|
|
29063
29033
|
])
|
|
29064
29034
|
];
|
|
29065
|
-
case
|
|
29066
|
-
_ref1 = _state.sent(), loadedBins = _ref1[0],
|
|
29035
|
+
case 6:
|
|
29036
|
+
_ref1 = _state.sent(), loadedBins = _ref1[0], loadedImages = _ref1[1];
|
|
29067
29037
|
return [
|
|
29068
29038
|
4,
|
|
29069
29039
|
hookTimeInfo("processTextures", function() {
|
|
29070
|
-
return _this.processTextures(
|
|
29040
|
+
return _this.processTextures(loadedImages, loadedBins, jsonScene);
|
|
29071
29041
|
})
|
|
29072
29042
|
];
|
|
29073
|
-
case
|
|
29043
|
+
case 7:
|
|
29074
29044
|
loadedTextures = _state.sent();
|
|
29075
29045
|
scene = {
|
|
29076
29046
|
timeInfos: timeInfos,
|
|
29077
29047
|
url: url,
|
|
29078
29048
|
renderLevel: _this.options.renderLevel,
|
|
29079
29049
|
storage: {},
|
|
29080
|
-
pluginSystem:
|
|
29081
|
-
jsonScene:
|
|
29050
|
+
pluginSystem: pluginSystem,
|
|
29051
|
+
jsonScene: jsonScene,
|
|
29082
29052
|
bins: loadedBins,
|
|
29083
|
-
|
|
29084
|
-
|
|
29053
|
+
textureOptions: loadedTextures,
|
|
29054
|
+
textures: [],
|
|
29055
|
+
images: loadedImages,
|
|
29056
|
+
assets: _this.assets
|
|
29085
29057
|
};
|
|
29086
29058
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
29087
29059
|
return [
|
|
29088
29060
|
4,
|
|
29089
29061
|
hookTimeInfo("plugin:prepareResource", function() {
|
|
29090
|
-
return
|
|
29062
|
+
return pluginSystem.loadResources(scene, _this.options);
|
|
29091
29063
|
})
|
|
29092
29064
|
];
|
|
29093
|
-
case
|
|
29065
|
+
case 8:
|
|
29094
29066
|
_state.sent();
|
|
29095
|
-
_state.label =
|
|
29096
|
-
case
|
|
29067
|
+
_state.label = 9;
|
|
29068
|
+
case 9:
|
|
29097
29069
|
totalTime = performance.now() - startTime;
|
|
29098
29070
|
logger.info("Load asset: totalTime: " + totalTime.toFixed(4) + "ms " + timeInfoMessages.join(" ") + ", url: " + assetUrl + ".");
|
|
29099
29071
|
window.clearTimeout(loadTimer);
|
|
@@ -29688,16 +29660,10 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
29688
29660
|
};
|
|
29689
29661
|
_proto.initializeTexture = function initializeTexture(scene) {
|
|
29690
29662
|
for(var i = 0; i < scene.textureOptions.length; i++){
|
|
29691
|
-
|
|
29692
|
-
|
|
29693
|
-
|
|
29694
|
-
|
|
29695
|
-
textureOptions = this.engine.findObject({
|
|
29696
|
-
id: scene.textureOptions[i].id
|
|
29697
|
-
});
|
|
29698
|
-
scene.textureOptions[i] = textureOptions;
|
|
29699
|
-
}
|
|
29700
|
-
textureOptions.initialize();
|
|
29663
|
+
scene.textures[i] = this.engine.findObject({
|
|
29664
|
+
id: scene.textureOptions[i].id
|
|
29665
|
+
});
|
|
29666
|
+
scene.textures[i].initialize();
|
|
29701
29667
|
}
|
|
29702
29668
|
};
|
|
29703
29669
|
_proto.prepareAssets = function prepareAssets(scene, assets) {
|
|
@@ -31682,7 +31648,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
31682
31648
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
31683
31649
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
31684
31650
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
31685
|
-
var version$1 = "2.4.
|
|
31651
|
+
var version$1 = "2.4.8";
|
|
31686
31652
|
logger.info("Core version: " + version$1 + ".");
|
|
31687
31653
|
|
|
31688
31654
|
var _obj;
|
|
@@ -33284,7 +33250,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33284
33250
|
*/ Mesh.create = function(engine, props) {
|
|
33285
33251
|
return new ThreeMesh(engine, props);
|
|
33286
33252
|
};
|
|
33287
|
-
var version = "2.4.
|
|
33253
|
+
var version = "2.4.8";
|
|
33288
33254
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33289
33255
|
|
|
33290
33256
|
exports.AbstractPlugin = AbstractPlugin;
|