@galacean/effects-core 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/composition-source-manager.d.ts +2 -2
- package/dist/composition.d.ts +0 -4
- package/dist/index.js +69 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -42
- package/dist/index.mjs.map +1 -1
- package/dist/pass-render-level.d.ts +3 -1
- package/dist/plugins/cal/calculate-vfx-item.d.ts +1 -1
- package/dist/plugins/particle/particle-system.d.ts +1 -1
- package/dist/plugins/sprite/sprite-item.d.ts +1 -1
- package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +0 -1
- package/dist/scene.d.ts +5 -3
- package/dist/utils/index.d.ts +3 -0
- package/dist/vfx-item.d.ts +8 -7
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core 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
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -12774,13 +12774,16 @@ const tempColor = [
|
|
|
12774
12774
|
let seed$3 = 0;
|
|
12775
12775
|
class SpriteColorPlayable extends Playable {
|
|
12776
12776
|
processFrame(context) {
|
|
12777
|
-
const
|
|
12777
|
+
const boundObject = context.output.getUserData();
|
|
12778
|
+
if (!(boundObject instanceof VFXItem)) {
|
|
12779
|
+
return;
|
|
12780
|
+
}
|
|
12778
12781
|
if (!this.spriteMaterial) {
|
|
12779
|
-
this.spriteMaterial =
|
|
12782
|
+
this.spriteMaterial = boundObject.getComponent(SpriteComponent).material;
|
|
12780
12783
|
}
|
|
12781
12784
|
let colorInc = vecFill(tempColor, 1);
|
|
12782
12785
|
let colorChanged;
|
|
12783
|
-
const life = this.time /
|
|
12786
|
+
const life = this.time / boundObject.duration;
|
|
12784
12787
|
const opacityOverLifetime = this.opacityOverLifetime;
|
|
12785
12788
|
const colorOverLifetime = this.colorOverLifetime;
|
|
12786
12789
|
if (colorOverLifetime) {
|
|
@@ -12879,7 +12882,6 @@ class SpriteComponent extends RendererComponent {
|
|
|
12879
12882
|
renderer.drawGeometry(geo, material);
|
|
12880
12883
|
}
|
|
12881
12884
|
start() {
|
|
12882
|
-
this.priority = this.item.listIndex;
|
|
12883
12885
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
12884
12886
|
}
|
|
12885
12887
|
update(dt) {
|
|
@@ -15248,7 +15250,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
|
|
|
15248
15250
|
* @internal
|
|
15249
15251
|
*/ class ParticleSystemRenderer extends RendererComponent {
|
|
15250
15252
|
start() {
|
|
15251
|
-
this._priority = this.item.
|
|
15253
|
+
this._priority = this.item.renderOrder;
|
|
15252
15254
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
15253
15255
|
for (const mesh of this.meshes){
|
|
15254
15256
|
mesh.start();
|
|
@@ -16278,13 +16280,13 @@ function randomArrItem(arr, keepArr) {
|
|
|
16278
16280
|
* @internal
|
|
16279
16281
|
*/ class ParticleBehaviourPlayable extends Playable {
|
|
16280
16282
|
start(context) {
|
|
16281
|
-
const
|
|
16282
|
-
if (this.particleSystem) {
|
|
16283
|
+
const boundObject = context.output.getUserData();
|
|
16284
|
+
if (this.particleSystem || !(boundObject instanceof VFXItem)) {
|
|
16283
16285
|
return;
|
|
16284
16286
|
}
|
|
16285
|
-
this.particleSystem =
|
|
16287
|
+
this.particleSystem = boundObject.getComponent(ParticleSystem);
|
|
16286
16288
|
if (this.particleSystem) {
|
|
16287
|
-
this.particleSystem.name =
|
|
16289
|
+
this.particleSystem.name = boundObject.name;
|
|
16288
16290
|
this.particleSystem.start();
|
|
16289
16291
|
this.particleSystem.initEmitterTransform();
|
|
16290
16292
|
}
|
|
@@ -17404,10 +17406,13 @@ const tempPos = new Vector3();
|
|
|
17404
17406
|
}
|
|
17405
17407
|
processFrame(context) {
|
|
17406
17408
|
if (!this.binding) {
|
|
17407
|
-
|
|
17408
|
-
|
|
17409
|
+
const boundObject = context.output.getUserData();
|
|
17410
|
+
if (boundObject instanceof VFXItem) {
|
|
17411
|
+
this.binding = boundObject;
|
|
17412
|
+
this.start();
|
|
17413
|
+
}
|
|
17409
17414
|
}
|
|
17410
|
-
if (this.binding.composition) {
|
|
17415
|
+
if (this.binding && this.binding.composition) {
|
|
17411
17416
|
this.sampleAnimation();
|
|
17412
17417
|
}
|
|
17413
17418
|
}
|
|
@@ -17575,9 +17580,12 @@ AnimationClip = __decorate([
|
|
|
17575
17580
|
], AnimationClip);
|
|
17576
17581
|
class AnimationClipPlayable extends Playable {
|
|
17577
17582
|
processFrame(context) {
|
|
17578
|
-
const
|
|
17579
|
-
if (
|
|
17580
|
-
|
|
17583
|
+
const boundObject = context.output.getUserData();
|
|
17584
|
+
if (!(boundObject instanceof VFXItem)) {
|
|
17585
|
+
return;
|
|
17586
|
+
}
|
|
17587
|
+
if (boundObject.composition) {
|
|
17588
|
+
this.clip.sampleAnimation(boundObject, this.time);
|
|
17581
17589
|
}
|
|
17582
17590
|
}
|
|
17583
17591
|
}
|
|
@@ -17787,13 +17795,11 @@ TransformTrack = __decorate([
|
|
|
17787
17795
|
|
|
17788
17796
|
class ActivationMixerPlayable extends Playable {
|
|
17789
17797
|
processFrame(context) {
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
}
|
|
17793
|
-
if (!this.bindingItem) {
|
|
17798
|
+
const boundObject = context.output.getUserData();
|
|
17799
|
+
if (!(boundObject instanceof VFXItem)) {
|
|
17794
17800
|
return;
|
|
17795
17801
|
}
|
|
17796
|
-
const
|
|
17802
|
+
const boundItem = boundObject;
|
|
17797
17803
|
let hasInput = false;
|
|
17798
17804
|
for(let i = 0; i < this.getInputCount(); i++){
|
|
17799
17805
|
if (this.getInputWeight(i) > 0) {
|
|
@@ -17802,11 +17808,11 @@ class ActivationMixerPlayable extends Playable {
|
|
|
17802
17808
|
}
|
|
17803
17809
|
}
|
|
17804
17810
|
if (hasInput) {
|
|
17805
|
-
|
|
17806
|
-
this.showRendererComponents(
|
|
17811
|
+
boundItem.transform.setValid(true);
|
|
17812
|
+
this.showRendererComponents(boundItem);
|
|
17807
17813
|
} else {
|
|
17808
|
-
|
|
17809
|
-
this.hideRendererComponents(
|
|
17814
|
+
boundItem.transform.setValid(false);
|
|
17815
|
+
this.hideRendererComponents(boundItem);
|
|
17810
17816
|
}
|
|
17811
17817
|
}
|
|
17812
17818
|
hideRendererComponents(item) {
|
|
@@ -18173,7 +18179,9 @@ SubCompositionTrack = __decorate([
|
|
|
18173
18179
|
class SubCompositionClipPlayable extends Playable {
|
|
18174
18180
|
processFrame(context) {
|
|
18175
18181
|
const boundObject = context.output.getUserData();
|
|
18176
|
-
boundObject
|
|
18182
|
+
if (boundObject instanceof CompositionComponent) {
|
|
18183
|
+
boundObject.time = this.getTime();
|
|
18184
|
+
}
|
|
18177
18185
|
}
|
|
18178
18186
|
}
|
|
18179
18187
|
|
|
@@ -18898,6 +18906,19 @@ class VFXItem extends EffectsObject {
|
|
|
18898
18906
|
return (_this_composition_reusable = (_this_composition = this.composition) == null ? void 0 : _this_composition.reusable) != null ? _this_composition_reusable : false;
|
|
18899
18907
|
}
|
|
18900
18908
|
/**
|
|
18909
|
+
* 元素在合成中的索引
|
|
18910
|
+
*/ get renderOrder() {
|
|
18911
|
+
return this.listIndex;
|
|
18912
|
+
}
|
|
18913
|
+
set renderOrder(value) {
|
|
18914
|
+
if (this.listIndex !== value) {
|
|
18915
|
+
this.listIndex = value;
|
|
18916
|
+
for (const rendererComponent of this.rendererComponents){
|
|
18917
|
+
rendererComponent.priority = value;
|
|
18918
|
+
}
|
|
18919
|
+
}
|
|
18920
|
+
}
|
|
18921
|
+
/**
|
|
18901
18922
|
* 设置元素的动画速度
|
|
18902
18923
|
* @param speed - 速度
|
|
18903
18924
|
*/ setSpeed(speed) {
|
|
@@ -19154,7 +19175,7 @@ class VFXItem extends EffectsObject {
|
|
|
19154
19175
|
this.parentId = parentId;
|
|
19155
19176
|
this.duration = duration;
|
|
19156
19177
|
this.endBehavior = endBehavior;
|
|
19157
|
-
this.
|
|
19178
|
+
this.renderOrder = listIndex;
|
|
19158
19179
|
//@ts-expect-error
|
|
19159
19180
|
this.oldId = data.oldId;
|
|
19160
19181
|
if (!data.content) {
|
|
@@ -19630,9 +19651,8 @@ class SerializationHelper {
|
|
|
19630
19651
|
console.error('序列化数据的内嵌对象层数大于上限');
|
|
19631
19652
|
return;
|
|
19632
19653
|
}
|
|
19633
|
-
|
|
19634
|
-
|
|
19635
|
-
} else if (property instanceof Array) {
|
|
19654
|
+
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
19655
|
+
if (property instanceof Array) {
|
|
19636
19656
|
const res = [];
|
|
19637
19657
|
for (const value of property){
|
|
19638
19658
|
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type));
|
|
@@ -19641,9 +19661,7 @@ class SerializationHelper {
|
|
|
19641
19661
|
// TODO json 数据避免传 typedArray
|
|
19642
19662
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
19643
19663
|
return engine.assetLoader.loadGUID(property.id);
|
|
19644
|
-
} else if (property instanceof
|
|
19645
|
-
return property;
|
|
19646
|
-
} else if (property instanceof Object) {
|
|
19664
|
+
} else if (property instanceof Object && property.constructor === Object) {
|
|
19647
19665
|
let res;
|
|
19648
19666
|
if (type) {
|
|
19649
19667
|
const classConstructor = effectsClassStore[type];
|
|
@@ -19656,6 +19674,8 @@ class SerializationHelper {
|
|
|
19656
19674
|
res[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
19657
19675
|
}
|
|
19658
19676
|
return res;
|
|
19677
|
+
} else {
|
|
19678
|
+
return property;
|
|
19659
19679
|
}
|
|
19660
19680
|
}
|
|
19661
19681
|
static deserializePropertyAsync(property, engine, level, type) {
|
|
@@ -19664,9 +19684,7 @@ class SerializationHelper {
|
|
|
19664
19684
|
console.error('序列化数据的内嵌对象层数大于上限');
|
|
19665
19685
|
return;
|
|
19666
19686
|
}
|
|
19667
|
-
if (
|
|
19668
|
-
return property;
|
|
19669
|
-
} else if (property instanceof Array) {
|
|
19687
|
+
if (property instanceof Array) {
|
|
19670
19688
|
const res = [];
|
|
19671
19689
|
for (const value of property){
|
|
19672
19690
|
res.push((yield SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)));
|
|
@@ -19676,9 +19694,7 @@ class SerializationHelper {
|
|
|
19676
19694
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
19677
19695
|
const res = yield engine.assetLoader.loadGUIDAsync(property.id);
|
|
19678
19696
|
return res;
|
|
19679
|
-
} else if (property instanceof
|
|
19680
|
-
return property;
|
|
19681
|
-
} else if (property instanceof Object) {
|
|
19697
|
+
} else if (property instanceof Object && property.constructor === Object) {
|
|
19682
19698
|
let res;
|
|
19683
19699
|
if (type) {
|
|
19684
19700
|
const classConstructor = effectsClassStore[type];
|
|
@@ -19691,6 +19707,8 @@ class SerializationHelper {
|
|
|
19691
19707
|
res[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
19692
19708
|
}
|
|
19693
19709
|
return res;
|
|
19710
|
+
} else {
|
|
19711
|
+
return property;
|
|
19694
19712
|
}
|
|
19695
19713
|
})();
|
|
19696
19714
|
}
|
|
@@ -21509,7 +21527,17 @@ function getStandardItem(item, opt = {}) {
|
|
|
21509
21527
|
}
|
|
21510
21528
|
}
|
|
21511
21529
|
|
|
21512
|
-
|
|
21530
|
+
/**
|
|
21531
|
+
* 机型和渲染等级对应表
|
|
21532
|
+
*
|
|
21533
|
+
* 机型:B-低端机、A-中端机、S-高端机
|
|
21534
|
+
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
21535
|
+
*
|
|
21536
|
+
* - S(高端机):高、全部、中高
|
|
21537
|
+
* - A(中端机):中、全部、中高
|
|
21538
|
+
* - B(低端机):低、全部
|
|
21539
|
+
* - undefined(全部机型)
|
|
21540
|
+
*/ const renderLevelPassSet = {
|
|
21513
21541
|
[RenderLevel.S]: [
|
|
21514
21542
|
RenderLevel.S,
|
|
21515
21543
|
RenderLevel.BPlus,
|
|
@@ -23183,7 +23211,7 @@ let listOrder = 0;
|
|
|
23183
23211
|
scene.textures = undefined;
|
|
23184
23212
|
scene.consumed = true;
|
|
23185
23213
|
}
|
|
23186
|
-
const { sourceContent, pluginSystem, imgUsage, totalTime,
|
|
23214
|
+
const { sourceContent, pluginSystem, imgUsage, totalTime, refCompositionProps } = this.compositionSourceManager;
|
|
23187
23215
|
assertExist(sourceContent);
|
|
23188
23216
|
this.renderer = renderer;
|
|
23189
23217
|
this.refCompositionProps = refCompositionProps;
|
|
@@ -23209,7 +23237,6 @@ let listOrder = 0;
|
|
|
23209
23237
|
};
|
|
23210
23238
|
this.reusable = reusable;
|
|
23211
23239
|
this.speed = speed;
|
|
23212
|
-
this.renderLevel = renderLevel;
|
|
23213
23240
|
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
|
|
23214
23241
|
this.name = sourceContent.name;
|
|
23215
23242
|
this.pluginSystem = pluginSystem;
|