@galacean/effects-threejs 2.0.0-alpha.15 → 2.0.0-alpha.16
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 +90 -67
- 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 +90 -67
- 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.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.16
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -13713,13 +13713,16 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13713
13713
|
}
|
|
13714
13714
|
var _proto = SpriteColorPlayable.prototype;
|
|
13715
13715
|
_proto.processFrame = function processFrame(context) {
|
|
13716
|
-
var
|
|
13716
|
+
var boundObject = context.output.getUserData();
|
|
13717
|
+
if (!_instanceof1(boundObject, exports.VFXItem)) {
|
|
13718
|
+
return;
|
|
13719
|
+
}
|
|
13717
13720
|
if (!this.spriteMaterial) {
|
|
13718
|
-
this.spriteMaterial =
|
|
13721
|
+
this.spriteMaterial = boundObject.getComponent(exports.SpriteComponent).material;
|
|
13719
13722
|
}
|
|
13720
13723
|
var colorInc = vecFill(tempColor, 1);
|
|
13721
13724
|
var colorChanged;
|
|
13722
|
-
var life = this.time /
|
|
13725
|
+
var life = this.time / boundObject.duration;
|
|
13723
13726
|
var opacityOverLifetime = this.opacityOverLifetime;
|
|
13724
13727
|
var colorOverLifetime = this.colorOverLifetime;
|
|
13725
13728
|
if (colorOverLifetime) {
|
|
@@ -13849,7 +13852,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13849
13852
|
renderer.drawGeometry(geo, material);
|
|
13850
13853
|
};
|
|
13851
13854
|
_proto.start = function start() {
|
|
13852
|
-
this.priority = this.item.listIndex;
|
|
13853
13855
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
13854
13856
|
};
|
|
13855
13857
|
_proto.update = function update(dt) {
|
|
@@ -16253,7 +16255,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env, gpuCapability)
|
|
|
16253
16255
|
}
|
|
16254
16256
|
var _proto = ParticleSystemRenderer.prototype;
|
|
16255
16257
|
_proto.start = function start() {
|
|
16256
|
-
this._priority = this.item.
|
|
16258
|
+
this._priority = this.item.renderOrder;
|
|
16257
16259
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
16258
16260
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
16259
16261
|
var mesh = _step.value;
|
|
@@ -17303,13 +17305,13 @@ function randomArrItem(arr, keepArr) {
|
|
|
17303
17305
|
}
|
|
17304
17306
|
var _proto = ParticleBehaviourPlayable.prototype;
|
|
17305
17307
|
_proto.start = function start(context) {
|
|
17306
|
-
var
|
|
17307
|
-
if (this.particleSystem) {
|
|
17308
|
+
var boundObject = context.output.getUserData();
|
|
17309
|
+
if (this.particleSystem || !_instanceof1(boundObject, exports.VFXItem)) {
|
|
17308
17310
|
return;
|
|
17309
17311
|
}
|
|
17310
|
-
this.particleSystem =
|
|
17312
|
+
this.particleSystem = boundObject.getComponent(exports.ParticleSystem);
|
|
17311
17313
|
if (this.particleSystem) {
|
|
17312
|
-
this.particleSystem.name =
|
|
17314
|
+
this.particleSystem.name = boundObject.name;
|
|
17313
17315
|
this.particleSystem.start();
|
|
17314
17316
|
this.particleSystem.initEmitterTransform();
|
|
17315
17317
|
}
|
|
@@ -18467,10 +18469,13 @@ var tempPos = new Vector3();
|
|
|
18467
18469
|
};
|
|
18468
18470
|
_proto.processFrame = function processFrame(context) {
|
|
18469
18471
|
if (!this.binding) {
|
|
18470
|
-
|
|
18471
|
-
|
|
18472
|
+
var boundObject = context.output.getUserData();
|
|
18473
|
+
if (_instanceof1(boundObject, exports.VFXItem)) {
|
|
18474
|
+
this.binding = boundObject;
|
|
18475
|
+
this.start();
|
|
18476
|
+
}
|
|
18472
18477
|
}
|
|
18473
|
-
if (this.binding.composition) {
|
|
18478
|
+
if (this.binding && this.binding.composition) {
|
|
18474
18479
|
this.sampleAnimation();
|
|
18475
18480
|
}
|
|
18476
18481
|
};
|
|
@@ -18679,9 +18684,12 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18679
18684
|
}
|
|
18680
18685
|
var _proto = AnimationClipPlayable.prototype;
|
|
18681
18686
|
_proto.processFrame = function processFrame(context) {
|
|
18682
|
-
var
|
|
18683
|
-
if (
|
|
18684
|
-
|
|
18687
|
+
var boundObject = context.output.getUserData();
|
|
18688
|
+
if (!_instanceof1(boundObject, exports.VFXItem)) {
|
|
18689
|
+
return;
|
|
18690
|
+
}
|
|
18691
|
+
if (boundObject.composition) {
|
|
18692
|
+
this.clip.sampleAnimation(boundObject, this.time);
|
|
18685
18693
|
}
|
|
18686
18694
|
};
|
|
18687
18695
|
return AnimationClipPlayable;
|
|
@@ -18925,13 +18933,11 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18925
18933
|
}
|
|
18926
18934
|
var _proto = ActivationMixerPlayable.prototype;
|
|
18927
18935
|
_proto.processFrame = function processFrame(context) {
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
}
|
|
18931
|
-
if (!this.bindingItem) {
|
|
18936
|
+
var boundObject = context.output.getUserData();
|
|
18937
|
+
if (!_instanceof1(boundObject, exports.VFXItem)) {
|
|
18932
18938
|
return;
|
|
18933
18939
|
}
|
|
18934
|
-
var
|
|
18940
|
+
var boundItem = boundObject;
|
|
18935
18941
|
var hasInput = false;
|
|
18936
18942
|
for(var i = 0; i < this.getInputCount(); i++){
|
|
18937
18943
|
if (this.getInputWeight(i) > 0) {
|
|
@@ -18940,11 +18946,11 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18940
18946
|
}
|
|
18941
18947
|
}
|
|
18942
18948
|
if (hasInput) {
|
|
18943
|
-
|
|
18944
|
-
this.showRendererComponents(
|
|
18949
|
+
boundItem.transform.setValid(true);
|
|
18950
|
+
this.showRendererComponents(boundItem);
|
|
18945
18951
|
} else {
|
|
18946
|
-
|
|
18947
|
-
this.hideRendererComponents(
|
|
18952
|
+
boundItem.transform.setValid(false);
|
|
18953
|
+
this.hideRendererComponents(boundItem);
|
|
18948
18954
|
}
|
|
18949
18955
|
};
|
|
18950
18956
|
_proto.hideRendererComponents = function hideRendererComponents(item) {
|
|
@@ -19371,7 +19377,9 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19371
19377
|
var _proto = SubCompositionClipPlayable.prototype;
|
|
19372
19378
|
_proto.processFrame = function processFrame(context) {
|
|
19373
19379
|
var boundObject = context.output.getUserData();
|
|
19374
|
-
boundObject
|
|
19380
|
+
if (_instanceof1(boundObject, CompositionComponent)) {
|
|
19381
|
+
boundObject.time = this.getTime();
|
|
19382
|
+
}
|
|
19375
19383
|
};
|
|
19376
19384
|
return SubCompositionClipPlayable;
|
|
19377
19385
|
}(Playable);
|
|
@@ -20398,7 +20406,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20398
20406
|
this.parentId = parentId;
|
|
20399
20407
|
this.duration = duration;
|
|
20400
20408
|
this.endBehavior = endBehavior;
|
|
20401
|
-
this.
|
|
20409
|
+
this.renderOrder = listIndex;
|
|
20402
20410
|
//@ts-expect-error
|
|
20403
20411
|
this.oldId = data.oldId;
|
|
20404
20412
|
if (!data.content) {
|
|
@@ -20530,6 +20538,23 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20530
20538
|
var _this_composition_reusable;
|
|
20531
20539
|
return (_this_composition_reusable = (_this_composition = this.composition) == null ? void 0 : _this_composition.reusable) != null ? _this_composition_reusable : false;
|
|
20532
20540
|
}
|
|
20541
|
+
},
|
|
20542
|
+
{
|
|
20543
|
+
key: "renderOrder",
|
|
20544
|
+
get: /**
|
|
20545
|
+
* 元素在合成中的索引
|
|
20546
|
+
*/ function get() {
|
|
20547
|
+
return this.listIndex;
|
|
20548
|
+
},
|
|
20549
|
+
set: function set(value) {
|
|
20550
|
+
if (this.listIndex !== value) {
|
|
20551
|
+
this.listIndex = value;
|
|
20552
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.rendererComponents), _step; !(_step = _iterator()).done;){
|
|
20553
|
+
var rendererComponent = _step.value;
|
|
20554
|
+
rendererComponent.priority = value;
|
|
20555
|
+
}
|
|
20556
|
+
}
|
|
20557
|
+
}
|
|
20533
20558
|
}
|
|
20534
20559
|
]);
|
|
20535
20560
|
return VFXItem;
|
|
@@ -20978,9 +21003,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20978
21003
|
console.error("序列化数据的内嵌对象层数大于上限");
|
|
20979
21004
|
return;
|
|
20980
21005
|
}
|
|
20981
|
-
|
|
20982
|
-
|
|
20983
|
-
} else if (_instanceof1(property, Array)) {
|
|
21006
|
+
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
21007
|
+
if (_instanceof1(property, Array)) {
|
|
20984
21008
|
var res = [];
|
|
20985
21009
|
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
20986
21010
|
var value = _step.value;
|
|
@@ -20990,9 +21014,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20990
21014
|
// TODO json 数据避免传 typedArray
|
|
20991
21015
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
20992
21016
|
return engine.assetLoader.loadGUID(property.id);
|
|
20993
|
-
} else if (_instanceof1(property,
|
|
20994
|
-
return property;
|
|
20995
|
-
} else if (_instanceof1(property, Object)) {
|
|
21017
|
+
} else if (_instanceof1(property, Object) && property.constructor === Object) {
|
|
20996
21018
|
var res1;
|
|
20997
21019
|
if (type) {
|
|
20998
21020
|
var classConstructor = effectsClassStore[type];
|
|
@@ -21006,6 +21028,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21006
21028
|
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21007
21029
|
}
|
|
21008
21030
|
return res1;
|
|
21031
|
+
} else {
|
|
21032
|
+
return property;
|
|
21009
21033
|
}
|
|
21010
21034
|
};
|
|
21011
21035
|
SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
|
|
@@ -21020,26 +21044,17 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21020
21044
|
2
|
|
21021
21045
|
];
|
|
21022
21046
|
}
|
|
21023
|
-
if (!(typeof property === "number" || typeof property === "string" || typeof property === "boolean")) return [
|
|
21024
|
-
3,
|
|
21025
|
-
1
|
|
21026
|
-
];
|
|
21027
|
-
return [
|
|
21028
|
-
2,
|
|
21029
|
-
property
|
|
21030
|
-
];
|
|
21031
|
-
case 1:
|
|
21032
21047
|
if (!_instanceof1(property, Array)) return [
|
|
21033
21048
|
3,
|
|
21034
|
-
|
|
21049
|
+
5
|
|
21035
21050
|
];
|
|
21036
21051
|
res = [];
|
|
21037
21052
|
_iterator = _create_for_of_iterator_helper_loose(property);
|
|
21038
|
-
_state.label =
|
|
21039
|
-
case
|
|
21053
|
+
_state.label = 1;
|
|
21054
|
+
case 1:
|
|
21040
21055
|
if (!!(_step = _iterator()).done) return [
|
|
21041
21056
|
3,
|
|
21042
|
-
|
|
21057
|
+
4
|
|
21043
21058
|
];
|
|
21044
21059
|
value = _step.value;
|
|
21045
21060
|
_ = res.push;
|
|
@@ -21047,43 +21062,38 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21047
21062
|
4,
|
|
21048
21063
|
SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)
|
|
21049
21064
|
];
|
|
21050
|
-
case
|
|
21065
|
+
case 2:
|
|
21051
21066
|
_.apply(res, [
|
|
21052
21067
|
_state.sent()
|
|
21053
21068
|
]);
|
|
21054
|
-
_state.label =
|
|
21055
|
-
case
|
|
21069
|
+
_state.label = 3;
|
|
21070
|
+
case 3:
|
|
21056
21071
|
return [
|
|
21057
21072
|
3,
|
|
21058
|
-
|
|
21073
|
+
1
|
|
21059
21074
|
];
|
|
21060
|
-
case
|
|
21075
|
+
case 4:
|
|
21061
21076
|
return [
|
|
21062
21077
|
2,
|
|
21063
21078
|
res
|
|
21064
21079
|
];
|
|
21065
|
-
case
|
|
21080
|
+
case 5:
|
|
21066
21081
|
if (!SerializationHelper.checkDataPath(property)) return [
|
|
21067
21082
|
3,
|
|
21068
|
-
|
|
21083
|
+
7
|
|
21069
21084
|
];
|
|
21070
21085
|
return [
|
|
21071
21086
|
4,
|
|
21072
21087
|
engine.assetLoader.loadGUIDAsync(property.id)
|
|
21073
21088
|
];
|
|
21074
|
-
case
|
|
21089
|
+
case 6:
|
|
21075
21090
|
res1 = _state.sent();
|
|
21076
21091
|
return [
|
|
21077
21092
|
2,
|
|
21078
21093
|
res1
|
|
21079
21094
|
];
|
|
21080
|
-
case
|
|
21081
|
-
if (_instanceof1(property,
|
|
21082
|
-
return [
|
|
21083
|
-
2,
|
|
21084
|
-
property
|
|
21085
|
-
];
|
|
21086
|
-
} else if (_instanceof1(property, Object)) {
|
|
21095
|
+
case 7:
|
|
21096
|
+
if (_instanceof1(property, Object) && property.constructor === Object) {
|
|
21087
21097
|
if (type) {
|
|
21088
21098
|
classConstructor = effectsClassStore[type];
|
|
21089
21099
|
res2 = new classConstructor();
|
|
@@ -21099,9 +21109,13 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21099
21109
|
2,
|
|
21100
21110
|
res2
|
|
21101
21111
|
];
|
|
21112
|
+
} else {
|
|
21113
|
+
return [
|
|
21114
|
+
2,
|
|
21115
|
+
property
|
|
21116
|
+
];
|
|
21102
21117
|
}
|
|
21103
|
-
|
|
21104
|
-
case 9:
|
|
21118
|
+
case 8:
|
|
21105
21119
|
return [
|
|
21106
21120
|
2
|
|
21107
21121
|
];
|
|
@@ -22995,7 +23009,17 @@ function getStandardItem(item, opt) {
|
|
|
22995
23009
|
}
|
|
22996
23010
|
|
|
22997
23011
|
var _obj$1;
|
|
22998
|
-
|
|
23012
|
+
/**
|
|
23013
|
+
* 机型和渲染等级对应表
|
|
23014
|
+
*
|
|
23015
|
+
* 机型:B-低端机、A-中端机、S-高端机
|
|
23016
|
+
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
23017
|
+
*
|
|
23018
|
+
* - S(高端机):高、全部、中高
|
|
23019
|
+
* - A(中端机):中、全部、中高
|
|
23020
|
+
* - B(低端机):低、全部
|
|
23021
|
+
* - undefined(全部机型)
|
|
23022
|
+
*/ var renderLevelPassSet = (_obj$1 = {}, _obj$1[RenderLevel.S] = [
|
|
22999
23023
|
RenderLevel.S,
|
|
23000
23024
|
RenderLevel.BPlus,
|
|
23001
23025
|
RenderLevel.APlus
|
|
@@ -24399,7 +24423,7 @@ var listOrder = 0;
|
|
|
24399
24423
|
scene.textures = undefined;
|
|
24400
24424
|
scene.consumed = true;
|
|
24401
24425
|
}
|
|
24402
|
-
var _this_compositionSourceManager = this.compositionSourceManager, sourceContent = _this_compositionSourceManager.sourceContent, pluginSystem = _this_compositionSourceManager.pluginSystem, imgUsage = _this_compositionSourceManager.imgUsage, totalTime = _this_compositionSourceManager.totalTime,
|
|
24426
|
+
var _this_compositionSourceManager = this.compositionSourceManager, sourceContent = _this_compositionSourceManager.sourceContent, pluginSystem = _this_compositionSourceManager.pluginSystem, imgUsage = _this_compositionSourceManager.imgUsage, totalTime = _this_compositionSourceManager.totalTime, refCompositionProps = _this_compositionSourceManager.refCompositionProps;
|
|
24403
24427
|
assertExist(sourceContent);
|
|
24404
24428
|
this.renderer = renderer;
|
|
24405
24429
|
this.refCompositionProps = refCompositionProps;
|
|
@@ -24425,7 +24449,6 @@ var listOrder = 0;
|
|
|
24425
24449
|
};
|
|
24426
24450
|
this.reusable = reusable;
|
|
24427
24451
|
this.speed = speed;
|
|
24428
|
-
this.renderLevel = renderLevel;
|
|
24429
24452
|
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
|
|
24430
24453
|
this.name = sourceContent.name;
|
|
24431
24454
|
this.pluginSystem = pluginSystem;
|
|
@@ -27157,7 +27180,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27157
27180
|
*/ Mesh.create = function(engine, props) {
|
|
27158
27181
|
return new ThreeMesh(engine, props);
|
|
27159
27182
|
};
|
|
27160
|
-
var version = "2.0.0-alpha.
|
|
27183
|
+
var version = "2.0.0-alpha.16";
|
|
27161
27184
|
logger.info("THREEJS plugin version: " + version);
|
|
27162
27185
|
|
|
27163
27186
|
exports.AbstractPlugin = AbstractPlugin;
|