@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
|
@@ -3,7 +3,7 @@ import type { SceneBindingData } from './comp-vfx-item';
|
|
|
3
3
|
import type { Engine } from './engine';
|
|
4
4
|
import type { PluginSystem } from './plugin-system';
|
|
5
5
|
import type { GlobalVolume } from './render';
|
|
6
|
-
import type { Scene } from './scene';
|
|
6
|
+
import type { Scene, SceneRenderLevel } from './scene';
|
|
7
7
|
import type { Texture } from './texture';
|
|
8
8
|
import type { Disposable } from './utils';
|
|
9
9
|
import type { VFXItemProps } from './vfx-item';
|
|
@@ -27,7 +27,7 @@ export declare class CompositionSourceManager implements Disposable {
|
|
|
27
27
|
refCompositions: Map<string, spec.CompositionData>;
|
|
28
28
|
sourceContent?: ContentOptions;
|
|
29
29
|
refCompositionProps: Map<string, VFXItemProps>;
|
|
30
|
-
renderLevel?:
|
|
30
|
+
renderLevel?: SceneRenderLevel;
|
|
31
31
|
pluginSystem?: PluginSystem;
|
|
32
32
|
totalTime: number;
|
|
33
33
|
imgUsage: Record<string, number[]>;
|
package/dist/composition.d.ts
CHANGED
|
@@ -120,10 +120,6 @@ export declare class Composition implements Disposable, LostHandler {
|
|
|
120
120
|
* 用于保存与当前合成相关的插件数据
|
|
121
121
|
*/
|
|
122
122
|
readonly loaderData: Record<string, any>;
|
|
123
|
-
/**
|
|
124
|
-
* 渲染等级:S,A+,A,B+,B
|
|
125
|
-
*/
|
|
126
|
-
readonly renderLevel?: spec.RenderLevel;
|
|
127
123
|
/**
|
|
128
124
|
* 场景加载和首帧渲染时间
|
|
129
125
|
*/
|
package/dist/index.js
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
|
'use strict';
|
|
@@ -12778,13 +12778,16 @@ const tempColor = [
|
|
|
12778
12778
|
let seed$3 = 0;
|
|
12779
12779
|
class SpriteColorPlayable extends Playable {
|
|
12780
12780
|
processFrame(context) {
|
|
12781
|
-
const
|
|
12781
|
+
const boundObject = context.output.getUserData();
|
|
12782
|
+
if (!(boundObject instanceof VFXItem)) {
|
|
12783
|
+
return;
|
|
12784
|
+
}
|
|
12782
12785
|
if (!this.spriteMaterial) {
|
|
12783
|
-
this.spriteMaterial =
|
|
12786
|
+
this.spriteMaterial = boundObject.getComponent(SpriteComponent).material;
|
|
12784
12787
|
}
|
|
12785
12788
|
let colorInc = vecFill(tempColor, 1);
|
|
12786
12789
|
let colorChanged;
|
|
12787
|
-
const life = this.time /
|
|
12790
|
+
const life = this.time / boundObject.duration;
|
|
12788
12791
|
const opacityOverLifetime = this.opacityOverLifetime;
|
|
12789
12792
|
const colorOverLifetime = this.colorOverLifetime;
|
|
12790
12793
|
if (colorOverLifetime) {
|
|
@@ -12883,7 +12886,6 @@ class SpriteComponent extends RendererComponent {
|
|
|
12883
12886
|
renderer.drawGeometry(geo, material);
|
|
12884
12887
|
}
|
|
12885
12888
|
start() {
|
|
12886
|
-
this.priority = this.item.listIndex;
|
|
12887
12889
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
12888
12890
|
}
|
|
12889
12891
|
update(dt) {
|
|
@@ -15252,7 +15254,7 @@ function getTrailMeshShader(trails, particleMaxCount, name, env = '', gpuCapabil
|
|
|
15252
15254
|
* @internal
|
|
15253
15255
|
*/ class ParticleSystemRenderer extends RendererComponent {
|
|
15254
15256
|
start() {
|
|
15255
|
-
this._priority = this.item.
|
|
15257
|
+
this._priority = this.item.renderOrder;
|
|
15256
15258
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
15257
15259
|
for (const mesh of this.meshes){
|
|
15258
15260
|
mesh.start();
|
|
@@ -16282,13 +16284,13 @@ function randomArrItem(arr, keepArr) {
|
|
|
16282
16284
|
* @internal
|
|
16283
16285
|
*/ class ParticleBehaviourPlayable extends Playable {
|
|
16284
16286
|
start(context) {
|
|
16285
|
-
const
|
|
16286
|
-
if (this.particleSystem) {
|
|
16287
|
+
const boundObject = context.output.getUserData();
|
|
16288
|
+
if (this.particleSystem || !(boundObject instanceof VFXItem)) {
|
|
16287
16289
|
return;
|
|
16288
16290
|
}
|
|
16289
|
-
this.particleSystem =
|
|
16291
|
+
this.particleSystem = boundObject.getComponent(ParticleSystem);
|
|
16290
16292
|
if (this.particleSystem) {
|
|
16291
|
-
this.particleSystem.name =
|
|
16293
|
+
this.particleSystem.name = boundObject.name;
|
|
16292
16294
|
this.particleSystem.start();
|
|
16293
16295
|
this.particleSystem.initEmitterTransform();
|
|
16294
16296
|
}
|
|
@@ -17408,10 +17410,13 @@ const tempPos = new Vector3();
|
|
|
17408
17410
|
}
|
|
17409
17411
|
processFrame(context) {
|
|
17410
17412
|
if (!this.binding) {
|
|
17411
|
-
|
|
17412
|
-
|
|
17413
|
+
const boundObject = context.output.getUserData();
|
|
17414
|
+
if (boundObject instanceof VFXItem) {
|
|
17415
|
+
this.binding = boundObject;
|
|
17416
|
+
this.start();
|
|
17417
|
+
}
|
|
17413
17418
|
}
|
|
17414
|
-
if (this.binding.composition) {
|
|
17419
|
+
if (this.binding && this.binding.composition) {
|
|
17415
17420
|
this.sampleAnimation();
|
|
17416
17421
|
}
|
|
17417
17422
|
}
|
|
@@ -17579,9 +17584,12 @@ AnimationClip = __decorate([
|
|
|
17579
17584
|
], AnimationClip);
|
|
17580
17585
|
class AnimationClipPlayable extends Playable {
|
|
17581
17586
|
processFrame(context) {
|
|
17582
|
-
const
|
|
17583
|
-
if (
|
|
17584
|
-
|
|
17587
|
+
const boundObject = context.output.getUserData();
|
|
17588
|
+
if (!(boundObject instanceof VFXItem)) {
|
|
17589
|
+
return;
|
|
17590
|
+
}
|
|
17591
|
+
if (boundObject.composition) {
|
|
17592
|
+
this.clip.sampleAnimation(boundObject, this.time);
|
|
17585
17593
|
}
|
|
17586
17594
|
}
|
|
17587
17595
|
}
|
|
@@ -17791,13 +17799,11 @@ TransformTrack = __decorate([
|
|
|
17791
17799
|
|
|
17792
17800
|
class ActivationMixerPlayable extends Playable {
|
|
17793
17801
|
processFrame(context) {
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
}
|
|
17797
|
-
if (!this.bindingItem) {
|
|
17802
|
+
const boundObject = context.output.getUserData();
|
|
17803
|
+
if (!(boundObject instanceof VFXItem)) {
|
|
17798
17804
|
return;
|
|
17799
17805
|
}
|
|
17800
|
-
const
|
|
17806
|
+
const boundItem = boundObject;
|
|
17801
17807
|
let hasInput = false;
|
|
17802
17808
|
for(let i = 0; i < this.getInputCount(); i++){
|
|
17803
17809
|
if (this.getInputWeight(i) > 0) {
|
|
@@ -17806,11 +17812,11 @@ class ActivationMixerPlayable extends Playable {
|
|
|
17806
17812
|
}
|
|
17807
17813
|
}
|
|
17808
17814
|
if (hasInput) {
|
|
17809
|
-
|
|
17810
|
-
this.showRendererComponents(
|
|
17815
|
+
boundItem.transform.setValid(true);
|
|
17816
|
+
this.showRendererComponents(boundItem);
|
|
17811
17817
|
} else {
|
|
17812
|
-
|
|
17813
|
-
this.hideRendererComponents(
|
|
17818
|
+
boundItem.transform.setValid(false);
|
|
17819
|
+
this.hideRendererComponents(boundItem);
|
|
17814
17820
|
}
|
|
17815
17821
|
}
|
|
17816
17822
|
hideRendererComponents(item) {
|
|
@@ -18177,7 +18183,9 @@ SubCompositionTrack = __decorate([
|
|
|
18177
18183
|
class SubCompositionClipPlayable extends Playable {
|
|
18178
18184
|
processFrame(context) {
|
|
18179
18185
|
const boundObject = context.output.getUserData();
|
|
18180
|
-
boundObject
|
|
18186
|
+
if (boundObject instanceof CompositionComponent) {
|
|
18187
|
+
boundObject.time = this.getTime();
|
|
18188
|
+
}
|
|
18181
18189
|
}
|
|
18182
18190
|
}
|
|
18183
18191
|
|
|
@@ -18902,6 +18910,19 @@ class VFXItem extends EffectsObject {
|
|
|
18902
18910
|
return (_this_composition_reusable = (_this_composition = this.composition) == null ? void 0 : _this_composition.reusable) != null ? _this_composition_reusable : false;
|
|
18903
18911
|
}
|
|
18904
18912
|
/**
|
|
18913
|
+
* 元素在合成中的索引
|
|
18914
|
+
*/ get renderOrder() {
|
|
18915
|
+
return this.listIndex;
|
|
18916
|
+
}
|
|
18917
|
+
set renderOrder(value) {
|
|
18918
|
+
if (this.listIndex !== value) {
|
|
18919
|
+
this.listIndex = value;
|
|
18920
|
+
for (const rendererComponent of this.rendererComponents){
|
|
18921
|
+
rendererComponent.priority = value;
|
|
18922
|
+
}
|
|
18923
|
+
}
|
|
18924
|
+
}
|
|
18925
|
+
/**
|
|
18905
18926
|
* 设置元素的动画速度
|
|
18906
18927
|
* @param speed - 速度
|
|
18907
18928
|
*/ setSpeed(speed) {
|
|
@@ -19158,7 +19179,7 @@ class VFXItem extends EffectsObject {
|
|
|
19158
19179
|
this.parentId = parentId;
|
|
19159
19180
|
this.duration = duration;
|
|
19160
19181
|
this.endBehavior = endBehavior;
|
|
19161
|
-
this.
|
|
19182
|
+
this.renderOrder = listIndex;
|
|
19162
19183
|
//@ts-expect-error
|
|
19163
19184
|
this.oldId = data.oldId;
|
|
19164
19185
|
if (!data.content) {
|
|
@@ -19634,9 +19655,8 @@ class SerializationHelper {
|
|
|
19634
19655
|
console.error('序列化数据的内嵌对象层数大于上限');
|
|
19635
19656
|
return;
|
|
19636
19657
|
}
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
} else if (property instanceof Array) {
|
|
19658
|
+
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
19659
|
+
if (property instanceof Array) {
|
|
19640
19660
|
const res = [];
|
|
19641
19661
|
for (const value of property){
|
|
19642
19662
|
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type));
|
|
@@ -19645,9 +19665,7 @@ class SerializationHelper {
|
|
|
19645
19665
|
// TODO json 数据避免传 typedArray
|
|
19646
19666
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
19647
19667
|
return engine.assetLoader.loadGUID(property.id);
|
|
19648
|
-
} else if (property instanceof
|
|
19649
|
-
return property;
|
|
19650
|
-
} else if (property instanceof Object) {
|
|
19668
|
+
} else if (property instanceof Object && property.constructor === Object) {
|
|
19651
19669
|
let res;
|
|
19652
19670
|
if (type) {
|
|
19653
19671
|
const classConstructor = effectsClassStore[type];
|
|
@@ -19660,6 +19678,8 @@ class SerializationHelper {
|
|
|
19660
19678
|
res[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
19661
19679
|
}
|
|
19662
19680
|
return res;
|
|
19681
|
+
} else {
|
|
19682
|
+
return property;
|
|
19663
19683
|
}
|
|
19664
19684
|
}
|
|
19665
19685
|
static deserializePropertyAsync(property, engine, level, type) {
|
|
@@ -19668,9 +19688,7 @@ class SerializationHelper {
|
|
|
19668
19688
|
console.error('序列化数据的内嵌对象层数大于上限');
|
|
19669
19689
|
return;
|
|
19670
19690
|
}
|
|
19671
|
-
if (
|
|
19672
|
-
return property;
|
|
19673
|
-
} else if (property instanceof Array) {
|
|
19691
|
+
if (property instanceof Array) {
|
|
19674
19692
|
const res = [];
|
|
19675
19693
|
for (const value of property){
|
|
19676
19694
|
res.push((yield SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)));
|
|
@@ -19680,9 +19698,7 @@ class SerializationHelper {
|
|
|
19680
19698
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
19681
19699
|
const res = yield engine.assetLoader.loadGUIDAsync(property.id);
|
|
19682
19700
|
return res;
|
|
19683
|
-
} else if (property instanceof
|
|
19684
|
-
return property;
|
|
19685
|
-
} else if (property instanceof Object) {
|
|
19701
|
+
} else if (property instanceof Object && property.constructor === Object) {
|
|
19686
19702
|
let res;
|
|
19687
19703
|
if (type) {
|
|
19688
19704
|
const classConstructor = effectsClassStore[type];
|
|
@@ -19695,6 +19711,8 @@ class SerializationHelper {
|
|
|
19695
19711
|
res[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
19696
19712
|
}
|
|
19697
19713
|
return res;
|
|
19714
|
+
} else {
|
|
19715
|
+
return property;
|
|
19698
19716
|
}
|
|
19699
19717
|
})();
|
|
19700
19718
|
}
|
|
@@ -21513,7 +21531,17 @@ function getStandardItem(item, opt = {}) {
|
|
|
21513
21531
|
}
|
|
21514
21532
|
}
|
|
21515
21533
|
|
|
21516
|
-
|
|
21534
|
+
/**
|
|
21535
|
+
* 机型和渲染等级对应表
|
|
21536
|
+
*
|
|
21537
|
+
* 机型:B-低端机、A-中端机、S-高端机
|
|
21538
|
+
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
21539
|
+
*
|
|
21540
|
+
* - S(高端机):高、全部、中高
|
|
21541
|
+
* - A(中端机):中、全部、中高
|
|
21542
|
+
* - B(低端机):低、全部
|
|
21543
|
+
* - undefined(全部机型)
|
|
21544
|
+
*/ const renderLevelPassSet = {
|
|
21517
21545
|
[RenderLevel.S]: [
|
|
21518
21546
|
RenderLevel.S,
|
|
21519
21547
|
RenderLevel.BPlus,
|
|
@@ -23187,7 +23215,7 @@ let listOrder = 0;
|
|
|
23187
23215
|
scene.textures = undefined;
|
|
23188
23216
|
scene.consumed = true;
|
|
23189
23217
|
}
|
|
23190
|
-
const { sourceContent, pluginSystem, imgUsage, totalTime,
|
|
23218
|
+
const { sourceContent, pluginSystem, imgUsage, totalTime, refCompositionProps } = this.compositionSourceManager;
|
|
23191
23219
|
assertExist(sourceContent);
|
|
23192
23220
|
this.renderer = renderer;
|
|
23193
23221
|
this.refCompositionProps = refCompositionProps;
|
|
@@ -23213,7 +23241,6 @@ let listOrder = 0;
|
|
|
23213
23241
|
};
|
|
23214
23242
|
this.reusable = reusable;
|
|
23215
23243
|
this.speed = speed;
|
|
23216
|
-
this.renderLevel = renderLevel;
|
|
23217
23244
|
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
|
|
23218
23245
|
this.name = sourceContent.name;
|
|
23219
23246
|
this.pluginSystem = pluginSystem;
|