@galacean/effects-core 2.4.0-beta.0 → 2.4.0-beta.2
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/asset-loader.d.ts +1 -2
- package/dist/binary-asset.d.ts +0 -2
- package/dist/comp-vfx-item.d.ts +2 -2
- package/dist/components/base-render-component.d.ts +1 -0
- package/dist/components/component.d.ts +1 -0
- package/dist/components/post-process-volume.d.ts +2 -2
- package/dist/components/renderer-component.d.ts +0 -5
- package/dist/composition.d.ts +2 -8
- package/dist/effects-object.d.ts +1 -1
- package/dist/engine.d.ts +5 -3
- package/dist/fallback/migration.d.ts +1 -0
- package/dist/index.js +752 -1028
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +748 -1022
- package/dist/index.mjs.map +1 -1
- package/dist/material/mask-ref-manager.d.ts +4 -1
- package/dist/material/material.d.ts +6 -1
- package/dist/material/types.d.ts +2 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +2 -2
- package/dist/plugins/interact/interact-item.d.ts +1 -0
- package/dist/plugins/particle/particle-system-renderer.d.ts +2 -0
- package/dist/plugins/particle/particle-system.d.ts +1 -1
- package/dist/plugins/particle/trail-mesh.d.ts +1 -1
- package/dist/serialization-helper.d.ts +0 -4
- package/dist/vfx-item.d.ts +10 -4
- package/package.json +2 -2
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.4.0-beta.
|
|
6
|
+
* Version: v2.4.0-beta.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -2004,7 +2004,7 @@ function getDirectStore(target) {
|
|
|
2004
2004
|
function EffectsObject(engine) {
|
|
2005
2005
|
this.engine = engine;
|
|
2006
2006
|
this.guid = generateGUID();
|
|
2007
|
-
this.
|
|
2007
|
+
this.defination = {};
|
|
2008
2008
|
this.engine.addInstance(this);
|
|
2009
2009
|
}
|
|
2010
2010
|
var _proto = EffectsObject.prototype;
|
|
@@ -2029,11 +2029,7 @@ function getDirectStore(target) {
|
|
|
2029
2029
|
* 反序列化函数
|
|
2030
2030
|
*
|
|
2031
2031
|
* @param data - 对象的序列化的数据
|
|
2032
|
-
*/ _proto.fromData = function fromData(data) {
|
|
2033
|
-
if (data.id) {
|
|
2034
|
-
this.setInstanceId(data.id);
|
|
2035
|
-
}
|
|
2036
|
-
};
|
|
2032
|
+
*/ _proto.fromData = function fromData(data) {};
|
|
2037
2033
|
/**
|
|
2038
2034
|
*
|
|
2039
2035
|
*/ _proto.dispose = function dispose() {};
|
|
@@ -2129,9 +2125,6 @@ function getDirectStore(target) {
|
|
|
2129
2125
|
};
|
|
2130
2126
|
_proto.fromData = function fromData(data) {
|
|
2131
2127
|
EffectsObject.prototype.fromData.call(this, data);
|
|
2132
|
-
if (data.item) {
|
|
2133
|
-
this.item = data.item;
|
|
2134
|
-
}
|
|
2135
2128
|
};
|
|
2136
2129
|
_proto.dispose = function dispose() {
|
|
2137
2130
|
if (this.isEnableCalled) {
|
|
@@ -2196,11 +2189,15 @@ function getDirectStore(target) {
|
|
|
2196
2189
|
]);
|
|
2197
2190
|
return Component;
|
|
2198
2191
|
}(EffectsObject);
|
|
2192
|
+
__decorate([
|
|
2193
|
+
serialize()
|
|
2194
|
+
], Component.prototype, "item", void 0);
|
|
2199
2195
|
__decorate([
|
|
2200
2196
|
serialize()
|
|
2201
2197
|
], Component.prototype, "_enabled", void 0);
|
|
2202
2198
|
/**
|
|
2203
2199
|
* @since 2.0.0
|
|
2200
|
+
* @deprecated 2.4.0 Please use Component instead
|
|
2204
2201
|
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
2205
2202
|
_inherits(Behaviour, Component);
|
|
2206
2203
|
function Behaviour() {
|
|
@@ -2230,10 +2227,6 @@ __decorate([
|
|
|
2230
2227
|
}
|
|
2231
2228
|
var _proto = RendererComponent.prototype;
|
|
2232
2229
|
_proto.render = function render(renderer) {};
|
|
2233
|
-
_proto.setVFXItem = function setVFXItem(item) {
|
|
2234
|
-
Component.prototype.setVFXItem.call(this, item);
|
|
2235
|
-
this.item.rendererComponents.push(this);
|
|
2236
|
-
};
|
|
2237
2230
|
_proto.onEnable = function onEnable() {
|
|
2238
2231
|
var _this_item_composition;
|
|
2239
2232
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.addMeshToDefaultRenderPass(this);
|
|
@@ -2242,18 +2235,6 @@ __decorate([
|
|
|
2242
2235
|
var _this_item_composition;
|
|
2243
2236
|
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.renderFrame.removeMeshFromDefaultRenderPass(this);
|
|
2244
2237
|
};
|
|
2245
|
-
_proto.fromData = function fromData(data) {
|
|
2246
|
-
Component.prototype.fromData.call(this, data);
|
|
2247
|
-
};
|
|
2248
|
-
_proto.toData = function toData() {
|
|
2249
|
-
Component.prototype.toData.call(this);
|
|
2250
|
-
};
|
|
2251
|
-
_proto.dispose = function dispose() {
|
|
2252
|
-
if (this.item) {
|
|
2253
|
-
removeItem(this.item.rendererComponents, this);
|
|
2254
|
-
}
|
|
2255
|
-
Component.prototype.dispose.call(this);
|
|
2256
|
-
};
|
|
2257
2238
|
_create_class(RendererComponent, [
|
|
2258
2239
|
{
|
|
2259
2240
|
key: "priority",
|
|
@@ -3876,11 +3857,11 @@ exports.EffectComponent = __decorate([
|
|
|
3876
3857
|
effectsClass(DataType.EffectComponent)
|
|
3877
3858
|
], exports.EffectComponent);
|
|
3878
3859
|
|
|
3879
|
-
exports.PostProcessVolume = /*#__PURE__*/ function(
|
|
3880
|
-
_inherits(PostProcessVolume,
|
|
3860
|
+
exports.PostProcessVolume = /*#__PURE__*/ function(Component) {
|
|
3861
|
+
_inherits(PostProcessVolume, Component);
|
|
3881
3862
|
function PostProcessVolume(engine) {
|
|
3882
3863
|
var _this;
|
|
3883
|
-
_this =
|
|
3864
|
+
_this = Component.call(this, engine) || this;
|
|
3884
3865
|
_this.bloom = {
|
|
3885
3866
|
threshold: 0,
|
|
3886
3867
|
intensity: 0,
|
|
@@ -3911,7 +3892,7 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
3911
3892
|
}
|
|
3912
3893
|
};
|
|
3913
3894
|
return PostProcessVolume;
|
|
3914
|
-
}(
|
|
3895
|
+
}(Component);
|
|
3915
3896
|
__decorate([
|
|
3916
3897
|
serialize()
|
|
3917
3898
|
], exports.PostProcessVolume.prototype, "bloom", void 0);
|
|
@@ -6144,12 +6125,7 @@ function setMaskMode(material, maskMode, colorMask) {
|
|
|
6144
6125
|
glContext.REPLACE
|
|
6145
6126
|
];
|
|
6146
6127
|
// 关闭/开启蒙版元素的颜色写入
|
|
6147
|
-
material.colorMask =
|
|
6148
|
-
colorMask,
|
|
6149
|
-
colorMask,
|
|
6150
|
-
colorMask,
|
|
6151
|
-
colorMask
|
|
6152
|
-
];
|
|
6128
|
+
material.colorMask = colorMask;
|
|
6153
6129
|
break;
|
|
6154
6130
|
case exports.MaskMode.OBSCURED:
|
|
6155
6131
|
material.stencilTest = true;
|
|
@@ -7621,13 +7597,6 @@ exports.MaterialRenderType = void 0;
|
|
|
7621
7597
|
set: /**
|
|
7622
7598
|
* 设置 Material 的通过 alpha 值决定临时覆盖值计算的开关
|
|
7623
7599
|
* @param value - 是否开启 alpha 抖动
|
|
7624
|
-
*/ function set(value) {}
|
|
7625
|
-
},
|
|
7626
|
-
{
|
|
7627
|
-
key: "colorMask",
|
|
7628
|
-
set: /**
|
|
7629
|
-
* 设置 Material 颜色缓冲区的写入开关
|
|
7630
|
-
* @param value
|
|
7631
7600
|
*/ function set(value) {}
|
|
7632
7601
|
},
|
|
7633
7602
|
{
|
|
@@ -7686,10 +7655,15 @@ var MaskProcessor = /*#__PURE__*/ function() {
|
|
|
7686
7655
|
} else if (mode === ObscuredMode.OBSCURED || mode === ObscuredMode.REVERSE_OBSCURED) {
|
|
7687
7656
|
maskMode = mode === ObscuredMode.OBSCURED ? exports.MaskMode.OBSCURED : exports.MaskMode.REVERSE_OBSCURED;
|
|
7688
7657
|
this.maskRef = ref.maskManager.getRefValue();
|
|
7658
|
+
this.maskable = ref;
|
|
7689
7659
|
}
|
|
7690
7660
|
}
|
|
7691
7661
|
return maskMode;
|
|
7692
7662
|
};
|
|
7663
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7664
|
+
var _this_maskable;
|
|
7665
|
+
(_this_maskable = this.maskable) == null ? void 0 : _this_maskable.drawStencilMask(renderer);
|
|
7666
|
+
};
|
|
7693
7667
|
return MaskProcessor;
|
|
7694
7668
|
}();
|
|
7695
7669
|
|
|
@@ -12596,17 +12570,16 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12596
12570
|
if (!this.getVisible()) {
|
|
12597
12571
|
return;
|
|
12598
12572
|
}
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
}
|
|
12573
|
+
this.maskManager.drawStencilMask(renderer);
|
|
12574
|
+
this.draw(renderer);
|
|
12575
|
+
};
|
|
12576
|
+
/**
|
|
12577
|
+
* @internal
|
|
12578
|
+
*/ _proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
12579
|
+
var previousColorMask = this.material.colorMask;
|
|
12580
|
+
this.material.colorMask = false;
|
|
12581
|
+
this.draw(renderer);
|
|
12582
|
+
this.material.colorMask = previousColorMask;
|
|
12610
12583
|
};
|
|
12611
12584
|
_proto.onStart = function onStart() {
|
|
12612
12585
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
@@ -12744,10 +12717,27 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12744
12717
|
}
|
|
12745
12718
|
return material;
|
|
12746
12719
|
};
|
|
12720
|
+
_proto.draw = function draw(renderer) {
|
|
12721
|
+
if (renderer.renderingData.currentFrame.globalUniforms) {
|
|
12722
|
+
renderer.setGlobalMatrix("effects_ObjectToWorld", this.transform.getWorldMatrix());
|
|
12723
|
+
}
|
|
12724
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
12725
|
+
var material = this.materials[i];
|
|
12726
|
+
material.setVector2("_Size", this.transform.size);
|
|
12727
|
+
if (this.renderer.renderMode === RenderMode.BILLBOARD || this.renderer.renderMode === RenderMode.VERTICAL_BILLBOARD || this.renderer.renderMode === RenderMode.HORIZONTAL_BILLBOARD) {
|
|
12728
|
+
material.setVector3("_Scale", this.transform.scale);
|
|
12729
|
+
}
|
|
12730
|
+
renderer.drawGeometry(this.geometry, material, i);
|
|
12731
|
+
}
|
|
12732
|
+
};
|
|
12747
12733
|
_proto.fromData = function fromData(data) {
|
|
12748
12734
|
RendererComponent.prototype.fromData.call(this, data);
|
|
12749
12735
|
var _data_renderer;
|
|
12750
12736
|
var renderer = (_data_renderer = data.renderer) != null ? _data_renderer : {};
|
|
12737
|
+
var maskProps = data.mask;
|
|
12738
|
+
if (maskProps && maskProps.ref) {
|
|
12739
|
+
maskProps.ref = this.engine.findObject(maskProps.ref);
|
|
12740
|
+
}
|
|
12751
12741
|
var maskMode = this.maskManager.getMaskMode(data);
|
|
12752
12742
|
// TODO 新蒙板上线后移除
|
|
12753
12743
|
//-------------------------------------------------------------------------
|
|
@@ -12755,15 +12745,15 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
|
|
|
12755
12745
|
//@ts-expect-error
|
|
12756
12746
|
var split = data.splits && !data.textureSheetAnimation ? data.splits[0] : undefined;
|
|
12757
12747
|
var shapeGeometry = undefined;
|
|
12758
|
-
if (shapeData !== undefined && !("aPoint" in shapeData && "index" in shapeData)) {
|
|
12748
|
+
if (shapeData !== undefined && shapeData !== null && !("aPoint" in shapeData && "index" in shapeData)) {
|
|
12759
12749
|
shapeGeometry = getGeometryByShape(shapeData, split);
|
|
12760
12750
|
}
|
|
12761
|
-
var _renderer_renderMode, _renderer_blending,
|
|
12751
|
+
var _renderer_renderMode, _renderer_blending, _renderer_side;
|
|
12762
12752
|
//-------------------------------------------------------------------------
|
|
12763
12753
|
this.renderer = {
|
|
12764
12754
|
renderMode: (_renderer_renderMode = renderer.renderMode) != null ? _renderer_renderMode : RenderMode.MESH,
|
|
12765
12755
|
blending: (_renderer_blending = renderer.blending) != null ? _renderer_blending : BlendingMode.ALPHA,
|
|
12766
|
-
texture:
|
|
12756
|
+
texture: renderer.texture ? this.engine.findObject(renderer.texture) : this.engine.emptyTexture,
|
|
12767
12757
|
occlusion: !!renderer.occlusion,
|
|
12768
12758
|
transparentOcclusion: !!renderer.transparentOcclusion || maskMode === exports.MaskMode.MASK,
|
|
12769
12759
|
side: (_renderer_side = renderer.side) != null ? _renderer_side : SideMode.DOUBLE,
|
|
@@ -12980,14 +12970,14 @@ exports.ShapeComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
12980
12970
|
var control2 = easingIns[pointIndex.easingIn];
|
|
12981
12971
|
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
|
|
12982
12972
|
}
|
|
12983
|
-
var pointIndex1 = indices[0];
|
|
12984
|
-
var lastPointIndex1 = indices[indices.length - 1];
|
|
12985
|
-
var point1 = points[pointIndex1.point];
|
|
12986
|
-
var lastPoint1 = points[lastPointIndex1.point];
|
|
12987
|
-
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
12988
|
-
var control21 = easingIns[pointIndex1.easingIn];
|
|
12989
|
-
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
12990
12973
|
if (shape.close) {
|
|
12974
|
+
var pointIndex1 = indices[0];
|
|
12975
|
+
var lastPointIndex1 = indices[indices.length - 1];
|
|
12976
|
+
var point1 = points[pointIndex1.point];
|
|
12977
|
+
var lastPoint1 = points[lastPointIndex1.point];
|
|
12978
|
+
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
12979
|
+
var control21 = easingIns[pointIndex1.easingIn];
|
|
12980
|
+
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
12991
12981
|
this.graphicsPath.closePath();
|
|
12992
12982
|
}
|
|
12993
12983
|
}
|
|
@@ -13117,6 +13107,10 @@ exports.ShapeComponent = /*#__PURE__*/ function(BaseRenderComponent) {
|
|
|
13117
13107
|
break;
|
|
13118
13108
|
}
|
|
13119
13109
|
}
|
|
13110
|
+
var maskProps = data.mask;
|
|
13111
|
+
if (maskProps && maskProps.ref) {
|
|
13112
|
+
maskProps.ref = this.engine.findObject(maskProps.ref);
|
|
13113
|
+
}
|
|
13120
13114
|
var maskMode = this.maskManager.getMaskMode(data);
|
|
13121
13115
|
var maskRef = this.maskManager.getRefValue();
|
|
13122
13116
|
this.material.stencilRef = maskRef !== undefined ? [
|
|
@@ -13266,11 +13260,11 @@ exports.Fake3DAnimationMode = void 0;
|
|
|
13266
13260
|
Fake3DAnimationMode[Fake3DAnimationMode["Linear"] = 1] = "Linear";
|
|
13267
13261
|
})(exports.Fake3DAnimationMode || (exports.Fake3DAnimationMode = {}));
|
|
13268
13262
|
|
|
13269
|
-
exports.CameraController = /*#__PURE__*/ function(
|
|
13270
|
-
_inherits(CameraController,
|
|
13263
|
+
exports.CameraController = /*#__PURE__*/ function(Component) {
|
|
13264
|
+
_inherits(CameraController, Component);
|
|
13271
13265
|
function CameraController(engine, props) {
|
|
13272
13266
|
var _this;
|
|
13273
|
-
_this =
|
|
13267
|
+
_this = Component.call(this, engine) || this;
|
|
13274
13268
|
if (props) {
|
|
13275
13269
|
_this.fromData(props);
|
|
13276
13270
|
}
|
|
@@ -13291,11 +13285,11 @@ exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
13291
13285
|
}
|
|
13292
13286
|
};
|
|
13293
13287
|
_proto.fromData = function fromData(data) {
|
|
13294
|
-
|
|
13288
|
+
Component.prototype.fromData.call(this, data);
|
|
13295
13289
|
this.options = data.options;
|
|
13296
13290
|
};
|
|
13297
13291
|
return CameraController;
|
|
13298
|
-
}(
|
|
13292
|
+
}(Component);
|
|
13299
13293
|
exports.CameraController = __decorate([
|
|
13300
13294
|
effectsClass(DataType.CameraController)
|
|
13301
13295
|
], exports.CameraController);
|
|
@@ -15376,6 +15370,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15376
15370
|
};
|
|
15377
15371
|
_this.duringPlay = false;
|
|
15378
15372
|
/** 是否响应点击和拖拽交互事件 */ _this._interactive = true;
|
|
15373
|
+
_this.lastTime = -1;
|
|
15379
15374
|
_this.getHitTestParams = function(force) {
|
|
15380
15375
|
if (!_this.clickable) {
|
|
15381
15376
|
return;
|
|
@@ -15466,11 +15461,21 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
15466
15461
|
var _this_previewContent;
|
|
15467
15462
|
this.duringPlay = true;
|
|
15468
15463
|
// trigger messageBegin when item enter
|
|
15469
|
-
if (this.
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15464
|
+
if (this.lastTime <= this.item.time) {
|
|
15465
|
+
if (this.item.time >= 0 && this.lastTime < 0) {
|
|
15466
|
+
var _this_item_composition;
|
|
15467
|
+
var options = this.item.props.content.options;
|
|
15468
|
+
(_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
|
|
15469
|
+
}
|
|
15470
|
+
} else {
|
|
15471
|
+
// loop trigger
|
|
15472
|
+
if (this.item.time >= 0) {
|
|
15473
|
+
var _this_item_composition1;
|
|
15474
|
+
var options1 = this.item.props.content.options;
|
|
15475
|
+
(_this_item_composition1 = this.item.composition) == null ? void 0 : _this_item_composition1.addInteractiveItem(this.item, options1.type);
|
|
15476
|
+
}
|
|
15473
15477
|
}
|
|
15478
|
+
this.lastTime = this.item.time;
|
|
15474
15479
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
15475
15480
|
if (!this.dragEvent || !this.bouncingArg) {
|
|
15476
15481
|
return;
|
|
@@ -18602,6 +18607,7 @@ function modifyMaxKeyframeShader(shader, maxVertex, maxFrag) {
|
|
|
18602
18607
|
this.particleMesh.mesh.material.setVector4("uParams", uParams.set(time, this.item.duration, 0, 0));
|
|
18603
18608
|
};
|
|
18604
18609
|
_proto.render = function render(renderer) {
|
|
18610
|
+
this.maskManager.drawStencilMask(renderer);
|
|
18605
18611
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
18606
18612
|
var mesh = _step.value;
|
|
18607
18613
|
mesh.render(renderer);
|
|
@@ -19443,7 +19449,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19443
19449
|
mask: maskProps.maskRef,
|
|
19444
19450
|
maskMode: maskProps.maskMode,
|
|
19445
19451
|
forceTarget: forceTarget,
|
|
19446
|
-
diffuse: renderer.texture,
|
|
19452
|
+
diffuse: renderer.texture ? this.engine.findObject(renderer.texture) : undefined,
|
|
19447
19453
|
sizeOverLifetime: sizeOverLifetimeGetter,
|
|
19448
19454
|
anchor: anchor
|
|
19449
19455
|
};
|
|
@@ -19530,7 +19536,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19530
19536
|
maxTrailCount: options.maxCount,
|
|
19531
19537
|
pointCountPerTrail: Math.round(trails.maxPointPerTrail) || 32,
|
|
19532
19538
|
blending: trails.blending,
|
|
19533
|
-
texture: trails.texture,
|
|
19539
|
+
texture: trails.texture ? this.engine.findObject(trails.texture) : undefined,
|
|
19534
19540
|
opacityOverLifetime: createValueGetter(trails.opacityOverLifetime || 1),
|
|
19535
19541
|
widthOverTrail: createValueGetter(trails.widthOverTrail || 1),
|
|
19536
19542
|
// order: vfxItem.listIndex + (trails.orderOffset || 0),
|
|
@@ -19551,6 +19557,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19551
19557
|
}
|
|
19552
19558
|
this.renderer = new ParticleSystemRenderer(this.engine, particleMeshProps, trailMeshProps);
|
|
19553
19559
|
this.renderer.item = this.item;
|
|
19560
|
+
this.renderer.maskManager = this.maskManager;
|
|
19554
19561
|
this.meshes = this.renderer.meshes;
|
|
19555
19562
|
var interaction = props.interaction;
|
|
19556
19563
|
if (interaction) {
|
|
@@ -19569,8 +19576,9 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
19569
19576
|
var maskRef = 0;
|
|
19570
19577
|
if (data.mask) {
|
|
19571
19578
|
var _data_mask = data.mask, mode = _data_mask.mode, ref = _data_mask.ref;
|
|
19579
|
+
var refComponent = this.engine.findObject(ref);
|
|
19572
19580
|
maskMode = mode;
|
|
19573
|
-
maskRef =
|
|
19581
|
+
maskRef = refComponent.maskManager.getRefValue();
|
|
19574
19582
|
}
|
|
19575
19583
|
return {
|
|
19576
19584
|
maskMode: maskMode,
|
|
@@ -19858,7 +19866,7 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19858
19866
|
var _proto = SubCompositionClipPlayable.prototype;
|
|
19859
19867
|
_proto.processFrame = function processFrame(context) {
|
|
19860
19868
|
var boundObject = context.output.getUserData();
|
|
19861
|
-
if (_instanceof1(boundObject, CompositionComponent)) {
|
|
19869
|
+
if (_instanceof1(boundObject, exports.CompositionComponent)) {
|
|
19862
19870
|
boundObject.time = this.getTime();
|
|
19863
19871
|
}
|
|
19864
19872
|
};
|
|
@@ -19873,7 +19881,7 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
|
|
|
19873
19881
|
var _proto = SubCompositionMixerPlayable.prototype;
|
|
19874
19882
|
_proto.evaluate = function evaluate(context) {
|
|
19875
19883
|
var boundObject = context.output.getUserData();
|
|
19876
|
-
if (!_instanceof1(boundObject, CompositionComponent)) {
|
|
19884
|
+
if (!_instanceof1(boundObject, exports.CompositionComponent)) {
|
|
19877
19885
|
return;
|
|
19878
19886
|
}
|
|
19879
19887
|
var compositionComponent = boundObject;
|
|
@@ -20241,7 +20249,7 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
20241
20249
|
if (!this.parent || !_instanceof1(this.parent.boundObject, exports.VFXItem)) {
|
|
20242
20250
|
throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");
|
|
20243
20251
|
}
|
|
20244
|
-
this.boundObject = this.parent.boundObject.getComponent(CompositionComponent);
|
|
20252
|
+
this.boundObject = this.parent.boundObject.getComponent(exports.CompositionComponent);
|
|
20245
20253
|
};
|
|
20246
20254
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
20247
20255
|
return new SubCompositionMixerPlayable(graph);
|
|
@@ -20658,13 +20666,11 @@ exports.Vector2PropertyPlayableAsset = __decorate([
|
|
|
20658
20666
|
effectsClass(DataType.Vector2PropertyPlayableAsset)
|
|
20659
20667
|
], exports.Vector2PropertyPlayableAsset);
|
|
20660
20668
|
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
*/ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
|
|
20664
|
-
_inherits(CompositionComponent, Behaviour);
|
|
20669
|
+
exports.CompositionComponent = /*#__PURE__*/ function(Component) {
|
|
20670
|
+
_inherits(CompositionComponent, Component);
|
|
20665
20671
|
function CompositionComponent() {
|
|
20666
20672
|
var _this;
|
|
20667
|
-
_this =
|
|
20673
|
+
_this = Component.apply(this, arguments) || this;
|
|
20668
20674
|
_this.time = 0;
|
|
20669
20675
|
_this.startTime = 0;
|
|
20670
20676
|
_this.items = [] // 场景的所有元素
|
|
@@ -20840,13 +20846,10 @@ exports.Vector2PropertyPlayableAsset = __decorate([
|
|
|
20840
20846
|
return startOrder;
|
|
20841
20847
|
};
|
|
20842
20848
|
_proto.fromData = function fromData(data) {
|
|
20843
|
-
|
|
20849
|
+
Component.prototype.fromData.call(this, data);
|
|
20844
20850
|
var compositionData = data;
|
|
20845
|
-
this.items = compositionData.items;
|
|
20846
20851
|
var _compositionData_startTime;
|
|
20847
20852
|
this.startTime = (_compositionData_startTime = compositionData.startTime) != null ? _compositionData_startTime : 0;
|
|
20848
|
-
this.sceneBindings = compositionData.sceneBindings;
|
|
20849
|
-
this.timelineAsset = compositionData.timelineAsset;
|
|
20850
20853
|
};
|
|
20851
20854
|
_proto.resolveBindings = function resolveBindings() {
|
|
20852
20855
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
@@ -20869,7 +20872,19 @@ exports.Vector2PropertyPlayableAsset = __decorate([
|
|
|
20869
20872
|
}
|
|
20870
20873
|
};
|
|
20871
20874
|
return CompositionComponent;
|
|
20872
|
-
}(
|
|
20875
|
+
}(Component);
|
|
20876
|
+
__decorate([
|
|
20877
|
+
serialize()
|
|
20878
|
+
], exports.CompositionComponent.prototype, "items", void 0);
|
|
20879
|
+
__decorate([
|
|
20880
|
+
serialize()
|
|
20881
|
+
], exports.CompositionComponent.prototype, "sceneBindings", void 0);
|
|
20882
|
+
__decorate([
|
|
20883
|
+
serialize()
|
|
20884
|
+
], exports.CompositionComponent.prototype, "timelineAsset", void 0);
|
|
20885
|
+
exports.CompositionComponent = __decorate([
|
|
20886
|
+
effectsClass("CompositionComponent")
|
|
20887
|
+
], exports.CompositionComponent);
|
|
20873
20888
|
|
|
20874
20889
|
/**
|
|
20875
20890
|
*
|
|
@@ -21061,631 +21076,161 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
21061
21076
|
// }
|
|
21062
21077
|
(TickData);
|
|
21063
21078
|
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21079
|
+
/**
|
|
21080
|
+
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
21081
|
+
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
21082
|
+
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
21083
|
+
*/ var Composition = /*#__PURE__*/ function(EventEmitter) {
|
|
21084
|
+
_inherits(Composition, EventEmitter);
|
|
21085
|
+
function Composition(props, scene) {
|
|
21086
|
+
var _this;
|
|
21087
|
+
var _scene_jsonScene_renderSettings;
|
|
21088
|
+
_this = EventEmitter.call(this) || this;
|
|
21089
|
+
/**
|
|
21090
|
+
*
|
|
21091
|
+
*/ _this.sceneTicking = new SceneTicking();
|
|
21092
|
+
/**
|
|
21093
|
+
* 动画播放速度
|
|
21094
|
+
*/ _this.speed = 1;
|
|
21095
|
+
/**
|
|
21096
|
+
* 合成是否结束
|
|
21097
|
+
*/ _this.isEnded = false;
|
|
21098
|
+
/**
|
|
21099
|
+
* 用于保存与当前合成相关的插件数据
|
|
21100
|
+
*/ _this.loaderData = {};
|
|
21101
|
+
/**
|
|
21102
|
+
* 预合成数组
|
|
21103
|
+
*/ _this.refContent = [];
|
|
21104
|
+
/**
|
|
21105
|
+
* 是否开启后处理
|
|
21106
|
+
*/ _this.postProcessingEnabled = false;
|
|
21107
|
+
// TODO: 待优化
|
|
21108
|
+
_this.assigned = false;
|
|
21109
|
+
/**
|
|
21110
|
+
* 销毁状态位
|
|
21111
|
+
*/ _this.destroyed = false;
|
|
21112
|
+
_this.postLoaders = [];
|
|
21113
|
+
/**
|
|
21114
|
+
* 合成暂停/播放 标识
|
|
21115
|
+
*/ _this.paused = false;
|
|
21116
|
+
_this.lastVideoUpdateTime = 0;
|
|
21117
|
+
_this.isEndCalled = false;
|
|
21118
|
+
_this._textures = [];
|
|
21119
|
+
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;
|
|
21120
|
+
_this.renderer = renderer;
|
|
21121
|
+
_this._textures = scene.textureOptions;
|
|
21122
|
+
var _scene_jsonScene_renderSettings_postProcessingEnabled;
|
|
21123
|
+
_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;
|
|
21124
|
+
_this.getEngine().renderLevel = scene.renderLevel;
|
|
21125
|
+
if (reusable) {
|
|
21126
|
+
_this.keepResource = true;
|
|
21127
|
+
scene.textures = undefined;
|
|
21128
|
+
scene.consumed = true;
|
|
21069
21129
|
}
|
|
21070
|
-
|
|
21071
|
-
|
|
21072
|
-
|
|
21073
|
-
|
|
21074
|
-
|
|
21075
|
-
var key = _step.value;
|
|
21076
|
-
// TODO 待移除,序列化属性通过 effectsObject 对象直接获取
|
|
21077
|
-
var value = effectsObject.taggedProperties[key];
|
|
21078
|
-
if (value === undefined) {
|
|
21079
|
-
value = effectsObject[key];
|
|
21080
|
-
}
|
|
21081
|
-
if (EffectsObject.is(value)) {
|
|
21082
|
-
SerializationHelper.collectSerializableObject(value, res);
|
|
21083
|
-
} else if (isArray(value)) {
|
|
21084
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
21085
|
-
var arrayValue = _step1.value;
|
|
21086
|
-
if (EffectsObject.is(arrayValue)) {
|
|
21087
|
-
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
21088
|
-
}
|
|
21089
|
-
}
|
|
21090
|
-
} else if (isObject(value)) {
|
|
21091
|
-
// 非 EffectsObject 对象只递归一层
|
|
21092
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
|
|
21093
|
-
var objectKey = _step2.value;
|
|
21094
|
-
var objectValue = value[objectKey];
|
|
21095
|
-
if (EffectsObject.is(objectValue)) {
|
|
21096
|
-
SerializationHelper.collectSerializableObject(objectValue, res);
|
|
21097
|
-
}
|
|
21098
|
-
}
|
|
21099
|
-
}
|
|
21130
|
+
var sourceContent = scene.jsonScene.compositions[0];
|
|
21131
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(scene.jsonScene.compositions), _step; !(_step = _iterator()).done;){
|
|
21132
|
+
var composition = _step.value;
|
|
21133
|
+
if (composition.id === scene.jsonScene.compositionId) {
|
|
21134
|
+
sourceContent = composition;
|
|
21100
21135
|
}
|
|
21101
21136
|
}
|
|
21137
|
+
assertExist(sourceContent);
|
|
21138
|
+
// Instantiate composition rootItem
|
|
21139
|
+
_this.rootItem = new exports.VFXItem(_this.getEngine());
|
|
21140
|
+
_this.rootItem.name = "rootItem";
|
|
21141
|
+
_this.rootItem.duration = sourceContent.duration;
|
|
21142
|
+
_this.rootItem.endBehavior = sourceContent.endBehavior;
|
|
21143
|
+
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
21144
|
+
// Create rootItem components
|
|
21145
|
+
//@ts-expect-error TODO update spec.
|
|
21146
|
+
var componentPaths = sourceContent.components;
|
|
21147
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(componentPaths), _step1; !(_step1 = _iterator1()).done;){
|
|
21148
|
+
var componentPath = _step1.value;
|
|
21149
|
+
var component = _this.getEngine().findObject(componentPath);
|
|
21150
|
+
_this.rootItem.components.push(component);
|
|
21151
|
+
component.item = _this.rootItem;
|
|
21152
|
+
}
|
|
21153
|
+
_this.rootComposition = _this.rootItem.getComponent(exports.CompositionComponent);
|
|
21154
|
+
_this.width = width;
|
|
21155
|
+
_this.height = height;
|
|
21156
|
+
_this.renderOrder = baseRenderOrder;
|
|
21157
|
+
_this.id = sourceContent.id;
|
|
21158
|
+
_this.renderer = renderer;
|
|
21159
|
+
_this.event = event;
|
|
21160
|
+
var _scene_startTime, _scene_totalTime;
|
|
21161
|
+
_this.statistic = {
|
|
21162
|
+
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
21163
|
+
loadTime: (_scene_totalTime = scene.totalTime) != null ? _scene_totalTime : 0,
|
|
21164
|
+
compileTime: 0,
|
|
21165
|
+
firstFrameTime: 0
|
|
21166
|
+
};
|
|
21167
|
+
_this.reusable = reusable;
|
|
21168
|
+
_this.speed = speed;
|
|
21169
|
+
_this.name = sourceContent.name;
|
|
21170
|
+
_this.pluginSystem = scene.pluginSystem;
|
|
21171
|
+
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
21172
|
+
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
21173
|
+
aspect: width / height
|
|
21174
|
+
}));
|
|
21175
|
+
_this.url = scene.url;
|
|
21176
|
+
_this.assigned = true;
|
|
21177
|
+
_this.interactive = true;
|
|
21178
|
+
_this.handleItemMessage = handleItemMessage;
|
|
21179
|
+
_this.createRenderFrame();
|
|
21180
|
+
_this.rendererOptions = null;
|
|
21181
|
+
Composition.buildItemTree(_this.rootItem);
|
|
21182
|
+
_this.rootComposition.setChildrenRenderOrder(0);
|
|
21183
|
+
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
21184
|
+
return _this;
|
|
21185
|
+
}
|
|
21186
|
+
var _proto = Composition.prototype;
|
|
21187
|
+
/**
|
|
21188
|
+
* 获取合成的时长
|
|
21189
|
+
*/ _proto.getDuration = function getDuration() {
|
|
21190
|
+
return this.rootItem.duration;
|
|
21102
21191
|
};
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
var serializedDatas = _extends({}, engine.jsonSceneData);
|
|
21109
|
-
// 递归收集所有需要序列化的对象
|
|
21110
|
-
SerializationHelper.collectSerializableObject(effectsObject, serializableMap);
|
|
21111
|
-
// 依次序列化
|
|
21112
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializableMap)), _step; !(_step = _iterator()).done;){
|
|
21113
|
-
var guid = _step.value;
|
|
21114
|
-
var serializeObject = serializableMap[guid];
|
|
21115
|
-
if (!serializedDatas[serializeObject.getInstanceId()]) {
|
|
21116
|
-
serializedDatas[serializeObject.getInstanceId()] = {};
|
|
21117
|
-
}
|
|
21118
|
-
SerializationHelper.serialize(serializeObject, serializedDatas[serializeObject.getInstanceId()]);
|
|
21119
|
-
}
|
|
21120
|
-
return serializedDatas;
|
|
21192
|
+
/**
|
|
21193
|
+
* 重新开始合成
|
|
21194
|
+
*/ _proto.restart = function restart() {
|
|
21195
|
+
this.reset();
|
|
21196
|
+
this.forwardTime(this.startTime);
|
|
21121
21197
|
};
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
|
|
21140
|
-
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
21147
|
-
|
|
21148
|
-
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
|
|
21155
|
-
|
|
21156
|
-
|
|
21157
|
-
|
|
21158
|
-
// TODO json 数据避免传 typedArray
|
|
21159
|
-
serializedData[key1] = value1;
|
|
21160
|
-
} else if (isArray(value1)) {
|
|
21161
|
-
if (!serializedData[key1]) {
|
|
21162
|
-
serializedData[key1] = [];
|
|
21163
|
-
}
|
|
21164
|
-
SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
|
|
21165
|
-
} else if (EffectsObject.is(value1)) {
|
|
21166
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21167
|
-
serializedData[key1] = {
|
|
21168
|
-
id: value1.getInstanceId()
|
|
21169
|
-
};
|
|
21170
|
-
} else if (isObject(value1)) {
|
|
21171
|
-
if (!serializedData[key1]) {
|
|
21172
|
-
serializedData[key1] = {};
|
|
21173
|
-
}
|
|
21174
|
-
SerializationHelper.serializeObjectProperty(value1, serializedData[key1], 0);
|
|
21175
|
-
}
|
|
21176
|
-
}
|
|
21177
|
-
return serializedData;
|
|
21178
|
-
};
|
|
21179
|
-
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
21180
|
-
var taggedProperties = effectsObject.taggedProperties;
|
|
21181
|
-
var serializedProperties = getMergedStore(effectsObject);
|
|
21182
|
-
var engine = effectsObject.engine;
|
|
21183
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData)), _step; !(_step = _iterator()).done;){
|
|
21184
|
-
var key = _step.value;
|
|
21185
|
-
if (serializedProperties && serializedProperties[key]) {
|
|
21186
|
-
continue;
|
|
21187
|
-
}
|
|
21188
|
-
var value = serializedData[key];
|
|
21189
|
-
taggedProperties[key] = SerializationHelper.deserializeProperty(value, engine, 0);
|
|
21190
|
-
}
|
|
21191
|
-
if (serializedProperties) {
|
|
21192
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step1; !(_step1 = _iterator1()).done;){
|
|
21193
|
-
var key1 = _step1.value;
|
|
21194
|
-
var value1 = serializedData[key1];
|
|
21195
|
-
if (value1 === undefined) {
|
|
21196
|
-
continue;
|
|
21197
|
-
}
|
|
21198
|
-
var propertyType = serializedProperties[key1].type;
|
|
21199
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
21200
|
-
// @ts-expect-error
|
|
21201
|
-
effectsObject[key1] = SerializationHelper.deserializeProperty(value1, engine, 0, propertyType);
|
|
21202
|
-
}
|
|
21203
|
-
}
|
|
21204
|
-
effectsObject.fromData(taggedProperties);
|
|
21205
|
-
};
|
|
21206
|
-
SerializationHelper.deserializeAsync = function deserializeAsync(serializedData, effectsObject) {
|
|
21207
|
-
return _async_to_generator(function() {
|
|
21208
|
-
var taggedProperties, serializedProperties, engine, _iterator, _step, key, value, _iterator1, _step1, key1, value1, propertyType;
|
|
21209
|
-
return __generator(this, function(_state) {
|
|
21210
|
-
switch(_state.label){
|
|
21211
|
-
case 0:
|
|
21212
|
-
taggedProperties = effectsObject.taggedProperties;
|
|
21213
|
-
serializedProperties = getMergedStore(effectsObject);
|
|
21214
|
-
engine = effectsObject.engine;
|
|
21215
|
-
_iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData));
|
|
21216
|
-
_state.label = 1;
|
|
21217
|
-
case 1:
|
|
21218
|
-
if (!!(_step = _iterator()).done) return [
|
|
21219
|
-
3,
|
|
21220
|
-
4
|
|
21221
|
-
];
|
|
21222
|
-
key = _step.value;
|
|
21223
|
-
if (serializedProperties && serializedProperties[key]) {
|
|
21224
|
-
return [
|
|
21225
|
-
3,
|
|
21226
|
-
3
|
|
21227
|
-
];
|
|
21228
|
-
}
|
|
21229
|
-
value = serializedData[key];
|
|
21230
|
-
return [
|
|
21231
|
-
4,
|
|
21232
|
-
SerializationHelper.deserializePropertyAsync(value, engine, 0)
|
|
21233
|
-
];
|
|
21234
|
-
case 2:
|
|
21235
|
-
taggedProperties[key] = _state.sent();
|
|
21236
|
-
_state.label = 3;
|
|
21237
|
-
case 3:
|
|
21238
|
-
return [
|
|
21239
|
-
3,
|
|
21240
|
-
1
|
|
21241
|
-
];
|
|
21242
|
-
case 4:
|
|
21243
|
-
if (!serializedProperties) return [
|
|
21244
|
-
3,
|
|
21245
|
-
8
|
|
21246
|
-
];
|
|
21247
|
-
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties));
|
|
21248
|
-
_state.label = 5;
|
|
21249
|
-
case 5:
|
|
21250
|
-
if (!!(_step1 = _iterator1()).done) return [
|
|
21251
|
-
3,
|
|
21252
|
-
8
|
|
21253
|
-
];
|
|
21254
|
-
key1 = _step1.value;
|
|
21255
|
-
value1 = serializedData[key1];
|
|
21256
|
-
if (value1 === undefined) {
|
|
21257
|
-
return [
|
|
21258
|
-
3,
|
|
21259
|
-
7
|
|
21260
|
-
];
|
|
21261
|
-
}
|
|
21262
|
-
propertyType = serializedProperties[key1].type;
|
|
21263
|
-
return [
|
|
21264
|
-
4,
|
|
21265
|
-
SerializationHelper.deserializePropertyAsync(value1, engine, 0, propertyType)
|
|
21266
|
-
];
|
|
21267
|
-
case 6:
|
|
21268
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
21269
|
-
// @ts-expect-error
|
|
21270
|
-
effectsObject[key1] = _state.sent();
|
|
21271
|
-
_state.label = 7;
|
|
21272
|
-
case 7:
|
|
21273
|
-
return [
|
|
21274
|
-
3,
|
|
21275
|
-
5
|
|
21276
|
-
];
|
|
21277
|
-
case 8:
|
|
21278
|
-
effectsObject.fromData(taggedProperties);
|
|
21279
|
-
return [
|
|
21280
|
-
2
|
|
21281
|
-
];
|
|
21282
|
-
}
|
|
21283
|
-
});
|
|
21284
|
-
})();
|
|
21285
|
-
};
|
|
21286
|
-
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
21287
|
-
return _instanceof1(obj, Int8Array) || _instanceof1(obj, Uint8Array) || _instanceof1(obj, Uint8ClampedArray) || _instanceof1(obj, Int16Array) || _instanceof1(obj, Uint16Array) || _instanceof1(obj, Int32Array) || _instanceof1(obj, Uint32Array) || _instanceof1(obj, Float32Array) || _instanceof1(obj, Float64Array) || _instanceof1(obj, ArrayBuffer);
|
|
21288
|
-
};
|
|
21289
|
-
// check value is { id: 7e69662e964e4892ae8933f24562395b }
|
|
21290
|
-
SerializationHelper.checkDataPath = function checkDataPath(value) {
|
|
21291
|
-
return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
|
|
21292
|
-
};
|
|
21293
|
-
// TODO 测试函数,2.0 上线后移除
|
|
21294
|
-
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
21295
|
-
return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
21296
|
-
};
|
|
21297
|
-
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
21298
|
-
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
21299
|
-
};
|
|
21300
|
-
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
|
|
21301
|
-
if (level > 14) {
|
|
21302
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21303
|
-
return;
|
|
21304
|
-
}
|
|
21305
|
-
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
21306
|
-
if (isArray(property)) {
|
|
21307
|
-
var res = [];
|
|
21308
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
21309
|
-
var value = _step.value;
|
|
21310
|
-
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type));
|
|
21311
|
-
}
|
|
21312
|
-
return res;
|
|
21313
|
-
// TODO json 数据避免传 typedArray
|
|
21314
|
-
} else if (SerializationHelper.checkDataPath(property)) {
|
|
21315
|
-
return engine.assetLoader.loadGUID(property.id);
|
|
21316
|
-
} else if (isObject(property) && property.constructor === Object) {
|
|
21317
|
-
var res1;
|
|
21318
|
-
if (type) {
|
|
21319
|
-
res1 = new type();
|
|
21320
|
-
} else {
|
|
21321
|
-
res1 = {};
|
|
21322
|
-
}
|
|
21323
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
|
|
21324
|
-
var key = _step1.value;
|
|
21325
|
-
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1);
|
|
21326
|
-
}
|
|
21327
|
-
return res1;
|
|
21328
|
-
} else {
|
|
21329
|
-
return property;
|
|
21330
|
-
}
|
|
21331
|
-
};
|
|
21332
|
-
SerializationHelper.deserializePropertyAsync = function deserializePropertyAsync(property, engine, level, type) {
|
|
21333
|
-
return _async_to_generator(function() {
|
|
21334
|
-
var res, _iterator, _step, value, _, res1, res2, _iterator1, _step1, key;
|
|
21335
|
-
return __generator(this, function(_state) {
|
|
21336
|
-
switch(_state.label){
|
|
21337
|
-
case 0:
|
|
21338
|
-
if (level > 14) {
|
|
21339
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21340
|
-
return [
|
|
21341
|
-
2
|
|
21342
|
-
];
|
|
21343
|
-
}
|
|
21344
|
-
if (!isArray(property)) return [
|
|
21345
|
-
3,
|
|
21346
|
-
5
|
|
21347
|
-
];
|
|
21348
|
-
res = [];
|
|
21349
|
-
_iterator = _create_for_of_iterator_helper_loose(property);
|
|
21350
|
-
_state.label = 1;
|
|
21351
|
-
case 1:
|
|
21352
|
-
if (!!(_step = _iterator()).done) return [
|
|
21353
|
-
3,
|
|
21354
|
-
4
|
|
21355
|
-
];
|
|
21356
|
-
value = _step.value;
|
|
21357
|
-
_ = res.push;
|
|
21358
|
-
return [
|
|
21359
|
-
4,
|
|
21360
|
-
SerializationHelper.deserializePropertyAsync(value, engine, level + 1, type)
|
|
21361
|
-
];
|
|
21362
|
-
case 2:
|
|
21363
|
-
_.apply(res, [
|
|
21364
|
-
_state.sent()
|
|
21365
|
-
]);
|
|
21366
|
-
_state.label = 3;
|
|
21367
|
-
case 3:
|
|
21368
|
-
return [
|
|
21369
|
-
3,
|
|
21370
|
-
1
|
|
21371
|
-
];
|
|
21372
|
-
case 4:
|
|
21373
|
-
return [
|
|
21374
|
-
2,
|
|
21375
|
-
res
|
|
21376
|
-
];
|
|
21377
|
-
case 5:
|
|
21378
|
-
if (!SerializationHelper.checkDataPath(property)) return [
|
|
21379
|
-
3,
|
|
21380
|
-
7
|
|
21381
|
-
];
|
|
21382
|
-
return [
|
|
21383
|
-
4,
|
|
21384
|
-
engine.assetLoader.loadGUIDAsync(property.id)
|
|
21385
|
-
];
|
|
21386
|
-
case 6:
|
|
21387
|
-
res1 = _state.sent();
|
|
21388
|
-
return [
|
|
21389
|
-
2,
|
|
21390
|
-
res1
|
|
21391
|
-
];
|
|
21392
|
-
case 7:
|
|
21393
|
-
if (!(isObject(property) && property.constructor === Object)) return [
|
|
21394
|
-
3,
|
|
21395
|
-
12
|
|
21396
|
-
];
|
|
21397
|
-
if (type) {
|
|
21398
|
-
res2 = new type();
|
|
21399
|
-
} else {
|
|
21400
|
-
res2 = {};
|
|
21401
|
-
}
|
|
21402
|
-
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property));
|
|
21403
|
-
_state.label = 8;
|
|
21404
|
-
case 8:
|
|
21405
|
-
if (!!(_step1 = _iterator1()).done) return [
|
|
21406
|
-
3,
|
|
21407
|
-
11
|
|
21408
|
-
];
|
|
21409
|
-
key = _step1.value;
|
|
21410
|
-
return [
|
|
21411
|
-
4,
|
|
21412
|
-
SerializationHelper.deserializePropertyAsync(property[key], engine, level + 1)
|
|
21413
|
-
];
|
|
21414
|
-
case 9:
|
|
21415
|
-
res2[key] = _state.sent();
|
|
21416
|
-
_state.label = 10;
|
|
21417
|
-
case 10:
|
|
21418
|
-
return [
|
|
21419
|
-
3,
|
|
21420
|
-
8
|
|
21421
|
-
];
|
|
21422
|
-
case 11:
|
|
21423
|
-
return [
|
|
21424
|
-
2,
|
|
21425
|
-
res2
|
|
21426
|
-
];
|
|
21427
|
-
case 12:
|
|
21428
|
-
return [
|
|
21429
|
-
2,
|
|
21430
|
-
property
|
|
21431
|
-
];
|
|
21432
|
-
case 13:
|
|
21433
|
-
return [
|
|
21434
|
-
2
|
|
21435
|
-
];
|
|
21436
|
-
}
|
|
21437
|
-
});
|
|
21438
|
-
})();
|
|
21439
|
-
};
|
|
21440
|
-
SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
|
|
21441
|
-
if (level > 14) {
|
|
21442
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21443
|
-
return;
|
|
21444
|
-
}
|
|
21445
|
-
if (!serializedData) {
|
|
21446
|
-
serializedData = {};
|
|
21447
|
-
}
|
|
21448
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(objectProperty)), _step; !(_step = _iterator()).done;){
|
|
21449
|
-
var key = _step.value;
|
|
21450
|
-
var value = objectProperty[key];
|
|
21451
|
-
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
|
|
21452
|
-
// TODO json 数据避免传 typedArray
|
|
21453
|
-
serializedData[key] = value;
|
|
21454
|
-
} else if (isArray(value)) {
|
|
21455
|
-
if (!serializedData[key]) {
|
|
21456
|
-
serializedData[key] = [];
|
|
21457
|
-
}
|
|
21458
|
-
SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
|
|
21459
|
-
} else if (EffectsObject.is(value)) {
|
|
21460
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21461
|
-
serializedData[key] = {
|
|
21462
|
-
id: value.getInstanceId()
|
|
21463
|
-
};
|
|
21464
|
-
} else if (isObject(value)) {
|
|
21465
|
-
if (!serializedData[key]) {
|
|
21466
|
-
serializedData[key] = {};
|
|
21467
|
-
}
|
|
21468
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[key], level + 1);
|
|
21469
|
-
}
|
|
21470
|
-
}
|
|
21471
|
-
};
|
|
21472
|
-
SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
|
|
21473
|
-
if (level > 14) {
|
|
21474
|
-
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
21475
|
-
return;
|
|
21476
|
-
}
|
|
21477
|
-
if (!serializedData) {
|
|
21478
|
-
serializedData = [];
|
|
21479
|
-
}
|
|
21480
|
-
for(var i = 0; i < arrayProperty.length; i++){
|
|
21481
|
-
var value = arrayProperty[i];
|
|
21482
|
-
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
|
|
21483
|
-
// TODO json 数据避免传 typedArray
|
|
21484
|
-
serializedData[i] = value;
|
|
21485
|
-
} else if (isArray(value)) {
|
|
21486
|
-
if (!serializedData[i]) {
|
|
21487
|
-
serializedData[i] = [];
|
|
21488
|
-
}
|
|
21489
|
-
SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
|
|
21490
|
-
} else if (EffectsObject.is(value)) {
|
|
21491
|
-
// TODO 处理 EffectsObject 递归序列化
|
|
21492
|
-
serializedData[i] = {
|
|
21493
|
-
id: value.getInstanceId()
|
|
21494
|
-
};
|
|
21495
|
-
} else if (isObject(value)) {
|
|
21496
|
-
if (!serializedData[i]) {
|
|
21497
|
-
serializedData[i] = {};
|
|
21498
|
-
}
|
|
21499
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[i], level + 1);
|
|
21500
|
-
}
|
|
21501
|
-
}
|
|
21502
|
-
};
|
|
21503
|
-
return SerializationHelper;
|
|
21504
|
-
}();
|
|
21505
|
-
|
|
21506
|
-
var _obj$1;
|
|
21507
|
-
/**
|
|
21508
|
-
* 机型和渲染等级对应表
|
|
21509
|
-
*
|
|
21510
|
-
* 机型:B-低端机、A-中端机、S-高端机
|
|
21511
|
-
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
21512
|
-
*
|
|
21513
|
-
* - S(高端机):高、全部、中高
|
|
21514
|
-
* - A(中端机):中、全部、中高
|
|
21515
|
-
* - B(低端机):低、全部
|
|
21516
|
-
* - undefined(全部机型)
|
|
21517
|
-
*/ var renderLevelPassSet = (_obj$1 = {}, _obj$1[RenderLevel.S] = [
|
|
21518
|
-
RenderLevel.S,
|
|
21519
|
-
RenderLevel.BPlus,
|
|
21520
|
-
RenderLevel.APlus
|
|
21521
|
-
], _obj$1[RenderLevel.A] = [
|
|
21522
|
-
RenderLevel.A,
|
|
21523
|
-
RenderLevel.BPlus,
|
|
21524
|
-
RenderLevel.APlus
|
|
21525
|
-
], _obj$1[RenderLevel.B] = [
|
|
21526
|
-
RenderLevel.B,
|
|
21527
|
-
RenderLevel.BPlus
|
|
21528
|
-
], _obj$1);
|
|
21529
|
-
function passRenderLevel(l, renderLevel) {
|
|
21530
|
-
if (!l || !renderLevel) {
|
|
21531
|
-
return true;
|
|
21532
|
-
}
|
|
21533
|
-
var arr = renderLevelPassSet[renderLevel];
|
|
21534
|
-
if (arr) {
|
|
21535
|
-
return arr.includes(l);
|
|
21536
|
-
}
|
|
21537
|
-
return false;
|
|
21538
|
-
}
|
|
21539
|
-
|
|
21540
|
-
/**
|
|
21541
|
-
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
21542
|
-
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
21543
|
-
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
21544
|
-
*/ var Composition = /*#__PURE__*/ function(EventEmitter) {
|
|
21545
|
-
_inherits(Composition, EventEmitter);
|
|
21546
|
-
function Composition(props, scene) {
|
|
21547
|
-
var _this;
|
|
21548
|
-
var _scene_jsonScene_renderSettings;
|
|
21549
|
-
_this = EventEmitter.call(this) || this;
|
|
21550
|
-
/**
|
|
21551
|
-
*
|
|
21552
|
-
*/ _this.sceneTicking = new SceneTicking();
|
|
21553
|
-
/**
|
|
21554
|
-
* 动画播放速度
|
|
21555
|
-
*/ _this.speed = 1;
|
|
21556
|
-
/**
|
|
21557
|
-
* 合成是否结束
|
|
21558
|
-
*/ _this.isEnded = false;
|
|
21559
|
-
/**
|
|
21560
|
-
* 用于保存与当前合成相关的插件数据
|
|
21561
|
-
*/ _this.loaderData = {};
|
|
21562
|
-
/**
|
|
21563
|
-
* 预合成数组
|
|
21564
|
-
*/ _this.refContent = [];
|
|
21565
|
-
/**
|
|
21566
|
-
* 是否开启后处理
|
|
21567
|
-
*/ _this.postProcessingEnabled = false;
|
|
21568
|
-
// TODO: 待优化
|
|
21569
|
-
_this.assigned = false;
|
|
21570
|
-
/**
|
|
21571
|
-
* 销毁状态位
|
|
21572
|
-
*/ _this.destroyed = false;
|
|
21573
|
-
_this.postLoaders = [];
|
|
21574
|
-
/**
|
|
21575
|
-
* 合成暂停/播放 标识
|
|
21576
|
-
*/ _this.paused = false;
|
|
21577
|
-
_this.lastVideoUpdateTime = 0;
|
|
21578
|
-
_this.isEndCalled = false;
|
|
21579
|
-
_this._textures = [];
|
|
21580
|
-
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;
|
|
21581
|
-
_this.renderer = renderer;
|
|
21582
|
-
_this._textures = scene.textureOptions;
|
|
21583
|
-
var _scene_jsonScene_renderSettings_postProcessingEnabled;
|
|
21584
|
-
_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;
|
|
21585
|
-
_this.getEngine().renderLevel = scene.renderLevel;
|
|
21586
|
-
if (reusable) {
|
|
21587
|
-
_this.keepResource = true;
|
|
21588
|
-
scene.textures = undefined;
|
|
21589
|
-
scene.consumed = true;
|
|
21590
|
-
}
|
|
21591
|
-
var sourceContent = scene.jsonScene.compositions[0];
|
|
21592
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(scene.jsonScene.compositions), _step; !(_step = _iterator()).done;){
|
|
21593
|
-
var composition = _step.value;
|
|
21594
|
-
if (composition.id === scene.jsonScene.compositionId) {
|
|
21595
|
-
sourceContent = composition;
|
|
21596
|
-
}
|
|
21597
|
-
}
|
|
21598
|
-
assertExist(sourceContent);
|
|
21599
|
-
// Instantiate composition rootItem
|
|
21600
|
-
_this.rootItem = new exports.VFXItem(_this.getEngine());
|
|
21601
|
-
_this.rootItem.name = "rootItem";
|
|
21602
|
-
_this.rootItem.duration = sourceContent.duration;
|
|
21603
|
-
_this.rootItem.endBehavior = sourceContent.endBehavior;
|
|
21604
|
-
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
21605
|
-
// Create rootCompositionComponent
|
|
21606
|
-
_this.rootComposition = _this.rootItem.addComponent(CompositionComponent);
|
|
21607
|
-
filterItemsByRenderLevel(sourceContent, _this.getEngine(), scene.renderLevel);
|
|
21608
|
-
SerializationHelper.deserialize(sourceContent, _this.rootComposition);
|
|
21609
|
-
_this.width = width;
|
|
21610
|
-
_this.height = height;
|
|
21611
|
-
_this.renderOrder = baseRenderOrder;
|
|
21612
|
-
_this.id = sourceContent.id;
|
|
21613
|
-
_this.renderer = renderer;
|
|
21614
|
-
_this.event = event;
|
|
21615
|
-
var _scene_startTime, _scene_totalTime;
|
|
21616
|
-
_this.statistic = {
|
|
21617
|
-
loadStart: (_scene_startTime = scene.startTime) != null ? _scene_startTime : 0,
|
|
21618
|
-
loadTime: (_scene_totalTime = scene.totalTime) != null ? _scene_totalTime : 0,
|
|
21619
|
-
compileTime: 0,
|
|
21620
|
-
firstFrameTime: 0
|
|
21621
|
-
};
|
|
21622
|
-
_this.reusable = reusable;
|
|
21623
|
-
_this.speed = speed;
|
|
21624
|
-
_this.name = sourceContent.name;
|
|
21625
|
-
_this.pluginSystem = scene.pluginSystem;
|
|
21626
|
-
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
21627
|
-
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
21628
|
-
aspect: width / height
|
|
21629
|
-
}));
|
|
21630
|
-
_this.url = scene.url;
|
|
21631
|
-
_this.assigned = true;
|
|
21632
|
-
_this.interactive = true;
|
|
21633
|
-
_this.handleItemMessage = handleItemMessage;
|
|
21634
|
-
_this.createRenderFrame();
|
|
21635
|
-
_this.rendererOptions = null;
|
|
21636
|
-
_this.buildItemTree(_this.rootItem);
|
|
21637
|
-
_this.rootComposition.setChildrenRenderOrder(0);
|
|
21638
|
-
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
21639
|
-
return _this;
|
|
21640
|
-
}
|
|
21641
|
-
var _proto = Composition.prototype;
|
|
21642
|
-
/**
|
|
21643
|
-
* 获取合成的时长
|
|
21644
|
-
*/ _proto.getDuration = function getDuration() {
|
|
21645
|
-
return this.rootItem.duration;
|
|
21646
|
-
};
|
|
21647
|
-
/**
|
|
21648
|
-
* 重新开始合成
|
|
21649
|
-
*/ _proto.restart = function restart() {
|
|
21650
|
-
this.reset();
|
|
21651
|
-
this.forwardTime(this.startTime);
|
|
21652
|
-
};
|
|
21653
|
-
/**
|
|
21654
|
-
* 设置当前合成的渲染顺序
|
|
21655
|
-
* @param index - 序号,大的后绘制
|
|
21656
|
-
*/ _proto.setIndex = function setIndex(index) {
|
|
21657
|
-
this.renderOrder = index;
|
|
21658
|
-
};
|
|
21659
|
-
/**
|
|
21660
|
-
* 获取当前合成的渲染顺序
|
|
21661
|
-
* @returns
|
|
21662
|
-
*/ _proto.getIndex = function getIndex() {
|
|
21663
|
-
return this.renderOrder;
|
|
21664
|
-
};
|
|
21665
|
-
/**
|
|
21666
|
-
* 设置合成的动画速度
|
|
21667
|
-
* @param speed - 速度
|
|
21668
|
-
*/ _proto.setSpeed = function setSpeed(speed) {
|
|
21669
|
-
this.speed = speed;
|
|
21670
|
-
};
|
|
21671
|
-
/**
|
|
21672
|
-
* 设置合成的可见性
|
|
21673
|
-
* @since 2.0.0
|
|
21674
|
-
* @param visible - 是否可见
|
|
21675
|
-
*/ _proto.setVisible = function setVisible(visible) {
|
|
21676
|
-
this.rootItem.setVisible(visible);
|
|
21677
|
-
};
|
|
21678
|
-
/**
|
|
21679
|
-
* 获取合成的动画速度
|
|
21680
|
-
* @returns
|
|
21681
|
-
*/ _proto.getSpeed = function getSpeed() {
|
|
21682
|
-
return this.speed;
|
|
21683
|
-
};
|
|
21684
|
-
/**
|
|
21685
|
-
*
|
|
21686
|
-
*/ _proto.play = function play() {
|
|
21687
|
-
if (this.isEnded && this.reusable) {
|
|
21688
|
-
this.restart();
|
|
21198
|
+
/**
|
|
21199
|
+
* 设置当前合成的渲染顺序
|
|
21200
|
+
* @param index - 序号,大的后绘制
|
|
21201
|
+
*/ _proto.setIndex = function setIndex(index) {
|
|
21202
|
+
this.renderOrder = index;
|
|
21203
|
+
};
|
|
21204
|
+
/**
|
|
21205
|
+
* 获取当前合成的渲染顺序
|
|
21206
|
+
* @returns
|
|
21207
|
+
*/ _proto.getIndex = function getIndex() {
|
|
21208
|
+
return this.renderOrder;
|
|
21209
|
+
};
|
|
21210
|
+
/**
|
|
21211
|
+
* 设置合成的动画速度
|
|
21212
|
+
* @param speed - 速度
|
|
21213
|
+
*/ _proto.setSpeed = function setSpeed(speed) {
|
|
21214
|
+
this.speed = speed;
|
|
21215
|
+
};
|
|
21216
|
+
/**
|
|
21217
|
+
* 设置合成的可见性
|
|
21218
|
+
* @since 2.0.0
|
|
21219
|
+
* @param visible - 是否可见
|
|
21220
|
+
*/ _proto.setVisible = function setVisible(visible) {
|
|
21221
|
+
this.rootItem.setVisible(visible);
|
|
21222
|
+
};
|
|
21223
|
+
/**
|
|
21224
|
+
* 获取合成的动画速度
|
|
21225
|
+
* @returns
|
|
21226
|
+
*/ _proto.getSpeed = function getSpeed() {
|
|
21227
|
+
return this.speed;
|
|
21228
|
+
};
|
|
21229
|
+
/**
|
|
21230
|
+
*
|
|
21231
|
+
*/ _proto.play = function play() {
|
|
21232
|
+
if (this.isEnded && this.reusable) {
|
|
21233
|
+
this.restart();
|
|
21689
21234
|
}
|
|
21690
21235
|
if (this.rootComposition.isStartCalled) {
|
|
21691
21236
|
this.gotoAndPlay(this.time - this.startTime);
|
|
@@ -21851,38 +21396,6 @@ function passRenderLevel(l, renderLevel) {
|
|
|
21851
21396
|
}
|
|
21852
21397
|
};
|
|
21853
21398
|
/**
|
|
21854
|
-
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
21855
|
-
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
21856
|
-
if (!compVFXItem.composition) {
|
|
21857
|
-
return;
|
|
21858
|
-
}
|
|
21859
|
-
var itemMap = new Map();
|
|
21860
|
-
var contentItems = compVFXItem.getComponent(CompositionComponent).items;
|
|
21861
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(contentItems), _step; !(_step = _iterator()).done;){
|
|
21862
|
-
var item = _step.value;
|
|
21863
|
-
itemMap.set(item.id, item);
|
|
21864
|
-
}
|
|
21865
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(contentItems), _step1; !(_step1 = _iterator1()).done;){
|
|
21866
|
-
var item1 = _step1.value;
|
|
21867
|
-
if (item1.parentId === undefined) {
|
|
21868
|
-
item1.setParent(compVFXItem);
|
|
21869
|
-
} else {
|
|
21870
|
-
var parent = itemMap.get(item1.parentId);
|
|
21871
|
-
if (parent) {
|
|
21872
|
-
item1.setParent(parent);
|
|
21873
|
-
} else {
|
|
21874
|
-
throw new Error("The element references a non-existent element, please check the data.");
|
|
21875
|
-
}
|
|
21876
|
-
}
|
|
21877
|
-
}
|
|
21878
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(contentItems), _step2; !(_step2 = _iterator2()).done;){
|
|
21879
|
-
var item2 = _step2.value;
|
|
21880
|
-
if (exports.VFXItem.isComposition(item2)) {
|
|
21881
|
-
this.buildItemTree(item2);
|
|
21882
|
-
}
|
|
21883
|
-
}
|
|
21884
|
-
};
|
|
21885
|
-
/**
|
|
21886
21399
|
* 更新视频数据到纹理
|
|
21887
21400
|
* @override
|
|
21888
21401
|
*/ _proto.updateVideo = function updateVideo() {
|
|
@@ -21993,7 +21506,7 @@ function passRenderLevel(l, renderLevel) {
|
|
|
21993
21506
|
var ray = this.getHitTestRay(x, y);
|
|
21994
21507
|
this.refContent.forEach(function(ref) {
|
|
21995
21508
|
var _ref_getComponent;
|
|
21996
|
-
(_ref_getComponent = ref.getComponent(CompositionComponent)) == null ? void 0 : _ref_getComponent.hitTest(ray, x, y, regions, force, options);
|
|
21509
|
+
(_ref_getComponent = ref.getComponent(exports.CompositionComponent)) == null ? void 0 : _ref_getComponent.hitTest(ray, x, y, regions, force, options);
|
|
21997
21510
|
});
|
|
21998
21511
|
return regions;
|
|
21999
21512
|
};
|
|
@@ -22046,7 +21559,7 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22046
21559
|
// 预合成元素销毁时销毁其中的item
|
|
22047
21560
|
if (item.type == ItemType.composition) {
|
|
22048
21561
|
if (item.endBehavior !== EndBehavior.freeze) {
|
|
22049
|
-
var contentItems = item.getComponent(CompositionComponent).items;
|
|
21562
|
+
var contentItems = item.getComponent(exports.CompositionComponent).items;
|
|
22050
21563
|
contentItems.forEach(function(it) {
|
|
22051
21564
|
return _this.pluginSystem.plugins.forEach(function(loader) {
|
|
22052
21565
|
return loader.onCompositionItemRemoved(_this, it);
|
|
@@ -22238,8 +21751,32 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22238
21751
|
2
|
|
22239
21752
|
];
|
|
22240
21753
|
}
|
|
22241
|
-
});
|
|
22242
|
-
})();
|
|
21754
|
+
});
|
|
21755
|
+
})();
|
|
21756
|
+
};
|
|
21757
|
+
/**
|
|
21758
|
+
* @internal
|
|
21759
|
+
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
21760
|
+
*/ Composition.buildItemTree = function buildItemTree(compVFXItem) {
|
|
21761
|
+
var itemMap = new Map();
|
|
21762
|
+
var contentItems = compVFXItem.getComponent(exports.CompositionComponent).items;
|
|
21763
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(contentItems), _step; !(_step = _iterator()).done;){
|
|
21764
|
+
var item = _step.value;
|
|
21765
|
+
itemMap.set(item.id, item);
|
|
21766
|
+
}
|
|
21767
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(contentItems), _step1; !(_step1 = _iterator1()).done;){
|
|
21768
|
+
var item1 = _step1.value;
|
|
21769
|
+
if (item1.parentId === undefined) {
|
|
21770
|
+
item1.setParent(compVFXItem);
|
|
21771
|
+
} else {
|
|
21772
|
+
var parent = itemMap.get(item1.parentId);
|
|
21773
|
+
if (parent) {
|
|
21774
|
+
item1.setParent(parent);
|
|
21775
|
+
} else {
|
|
21776
|
+
throw new Error("The element references a non-existent element, please check the data.");
|
|
21777
|
+
}
|
|
21778
|
+
}
|
|
21779
|
+
}
|
|
22243
21780
|
};
|
|
22244
21781
|
_create_class(Composition, [
|
|
22245
21782
|
{
|
|
@@ -22302,25 +21839,6 @@ function passRenderLevel(l, renderLevel) {
|
|
|
22302
21839
|
]);
|
|
22303
21840
|
return Composition;
|
|
22304
21841
|
}(EventEmitter);
|
|
22305
|
-
function filterItemsByRenderLevel(composition, engine, renderLevel) {
|
|
22306
|
-
var items = [];
|
|
22307
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(composition.items), _step; !(_step = _iterator()).done;){
|
|
22308
|
-
var itemDataPath = _step.value;
|
|
22309
|
-
var itemProps = engine.findEffectsObjectData(itemDataPath.id);
|
|
22310
|
-
if (passRenderLevel(itemProps.renderLevel, renderLevel)) {
|
|
22311
|
-
items.push(itemDataPath);
|
|
22312
|
-
} else {
|
|
22313
|
-
// 非预合成元素未达到渲染等级的转化为空节点。
|
|
22314
|
-
// 预合成元素有根据 item type 的子元素加载判断,没法保留空节点,这边先整体过滤掉。
|
|
22315
|
-
if (itemProps.type !== ItemType.composition) {
|
|
22316
|
-
itemProps.components = [];
|
|
22317
|
-
items.push(itemDataPath);
|
|
22318
|
-
}
|
|
22319
|
-
}
|
|
22320
|
-
}
|
|
22321
|
-
composition.items = items;
|
|
22322
|
-
return composition;
|
|
22323
|
-
}
|
|
22324
21842
|
|
|
22325
21843
|
exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
22326
21844
|
_inherits(VFXItem, EffectsObject);
|
|
@@ -22333,7 +21851,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22333
21851
|
*/ _this.transform = new Transform();
|
|
22334
21852
|
/**
|
|
22335
21853
|
* 元素动画的当前时间
|
|
22336
|
-
*/ _this.time =
|
|
21854
|
+
*/ _this.time = -1;
|
|
22337
21855
|
/**
|
|
22338
21856
|
* 元素动画的持续时间
|
|
22339
21857
|
*/ _this.duration = 0;
|
|
@@ -22344,9 +21862,8 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22344
21862
|
* 元素动画结束时行为(如何处理元素)
|
|
22345
21863
|
*/ _this.endBehavior = EndBehavior.forward;
|
|
22346
21864
|
_this.type = ItemType.base;
|
|
22347
|
-
_this.isDuringPlay = false;
|
|
22348
21865
|
_this.components = [];
|
|
22349
|
-
_this.
|
|
21866
|
+
_this.isDuringPlay = false;
|
|
22350
21867
|
/**
|
|
22351
21868
|
* 元素是否激活
|
|
22352
21869
|
*/ _this.active = true;
|
|
@@ -22614,6 +22131,25 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22614
22131
|
return undefined;
|
|
22615
22132
|
};
|
|
22616
22133
|
/**
|
|
22134
|
+
* 复制 VFXItem,返回一个新的 VFXItem
|
|
22135
|
+
* @since 2.4.0
|
|
22136
|
+
* @returns 复制的新 VFXItem
|
|
22137
|
+
*/ _proto.duplicate = function duplicate() {
|
|
22138
|
+
var previousObjectIDMap = new Map();
|
|
22139
|
+
this.gatherPreviousObjectID(previousObjectIDMap);
|
|
22140
|
+
// 重新设置当前元素和组件的 ID 以及子元素和子元素组件的 ID,避免实例化新的对象时产生碰撞
|
|
22141
|
+
this.resetGUID();
|
|
22142
|
+
var newItem = this.engine.findObject({
|
|
22143
|
+
id: this.defination.id
|
|
22144
|
+
});
|
|
22145
|
+
newItem.resetGUID();
|
|
22146
|
+
this.resetGUID(previousObjectIDMap);
|
|
22147
|
+
if (this.composition) {
|
|
22148
|
+
newItem.setParent(this.composition.rootItem);
|
|
22149
|
+
}
|
|
22150
|
+
return newItem;
|
|
22151
|
+
};
|
|
22152
|
+
/**
|
|
22617
22153
|
* @internal
|
|
22618
22154
|
*/ _proto.beginPlay = function beginPlay() {
|
|
22619
22155
|
this.isDuringPlay = true;
|
|
@@ -22708,19 +22244,18 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22708
22244
|
if (duration < 0) {
|
|
22709
22245
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
22710
22246
|
}
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
var
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
this.
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22721
|
-
|
|
22247
|
+
if (data.components) {
|
|
22248
|
+
this.components.length = 0;
|
|
22249
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(data.components), _step; !(_step = _iterator()).done;){
|
|
22250
|
+
var componentPath = _step.value;
|
|
22251
|
+
var component = this.engine.findObject(componentPath);
|
|
22252
|
+
this.components.push(component);
|
|
22253
|
+
// TODO ParticleSystemRenderer 现在是动态生成的,后面需要在 json 中单独表示为一个组件
|
|
22254
|
+
if (_instanceof1(component, exports.ParticleSystem)) {
|
|
22255
|
+
if (!this.components.includes(component.renderer)) {
|
|
22256
|
+
this.components.push(component.renderer);
|
|
22257
|
+
}
|
|
22722
22258
|
}
|
|
22723
|
-
this.rendererComponents.push(component.renderer);
|
|
22724
22259
|
}
|
|
22725
22260
|
}
|
|
22726
22261
|
if (VFXItem.isComposition(this)) {
|
|
@@ -22729,24 +22264,24 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22729
22264
|
};
|
|
22730
22265
|
_proto.toData = function toData() {
|
|
22731
22266
|
var _this_parent;
|
|
22732
|
-
this.
|
|
22733
|
-
this.
|
|
22734
|
-
this.
|
|
22267
|
+
this.defination.id = this.guid;
|
|
22268
|
+
this.defination.transform = this.transform.toData();
|
|
22269
|
+
this.defination.dataType = DataType.VFXItemData;
|
|
22735
22270
|
if (((_this_parent = this.parent) == null ? void 0 : _this_parent.name) !== "rootItem") {
|
|
22736
22271
|
var _this_parent1;
|
|
22737
|
-
this.
|
|
22272
|
+
this.defination.parentId = (_this_parent1 = this.parent) == null ? void 0 : _this_parent1.guid;
|
|
22738
22273
|
}
|
|
22739
22274
|
// TODO 统一 sprite 等其他组件的序列化逻辑
|
|
22740
|
-
if (!this.
|
|
22741
|
-
this.
|
|
22275
|
+
if (!this.defination.components) {
|
|
22276
|
+
this.defination.components = [];
|
|
22742
22277
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22743
22278
|
var component = _step.value;
|
|
22744
22279
|
if (_instanceof1(component, exports.EffectComponent)) {
|
|
22745
|
-
this.
|
|
22280
|
+
this.defination.components.push(component);
|
|
22746
22281
|
}
|
|
22747
22282
|
}
|
|
22748
22283
|
}
|
|
22749
|
-
this.
|
|
22284
|
+
this.defination.content = {};
|
|
22750
22285
|
};
|
|
22751
22286
|
_proto.translateByPixel = function translateByPixel(x, y) {
|
|
22752
22287
|
if (this.composition) {
|
|
@@ -22803,17 +22338,52 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22803
22338
|
if (!props) {
|
|
22804
22339
|
throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
|
|
22805
22340
|
}
|
|
22806
|
-
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
var
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22341
|
+
//@ts-expect-error TODO update spec.
|
|
22342
|
+
var componentPaths = props.components;
|
|
22343
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(componentPaths), _step; !(_step = _iterator()).done;){
|
|
22344
|
+
var componentPath = _step.value;
|
|
22345
|
+
var component = this.engine.findObject(componentPath);
|
|
22346
|
+
component.item = this;
|
|
22347
|
+
this.components.push(component);
|
|
22348
|
+
component.setInstanceId(generateGUID());
|
|
22349
|
+
if (_instanceof1(component, exports.CompositionComponent)) {
|
|
22350
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(component.items), _step1; !(_step1 = _iterator1()).done;){
|
|
22351
|
+
var vfxItem = _step1.value;
|
|
22352
|
+
vfxItem.setInstanceId(generateGUID());
|
|
22353
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
22354
|
+
var component1 = _step2.value;
|
|
22355
|
+
component1.setInstanceId(generateGUID());
|
|
22356
|
+
}
|
|
22357
|
+
}
|
|
22815
22358
|
}
|
|
22816
22359
|
}
|
|
22360
|
+
Composition.buildItemTree(this);
|
|
22361
|
+
};
|
|
22362
|
+
_proto.resetGUID = function resetGUID(previousObjectIDMap) {
|
|
22363
|
+
var _previousObjectIDMap_get;
|
|
22364
|
+
var itemGUID = (_previousObjectIDMap_get = previousObjectIDMap == null ? void 0 : previousObjectIDMap.get(this)) != null ? _previousObjectIDMap_get : generateGUID();
|
|
22365
|
+
this.setInstanceId(itemGUID);
|
|
22366
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22367
|
+
var component = _step.value;
|
|
22368
|
+
var _previousObjectIDMap_get1;
|
|
22369
|
+
var componentGUID = (_previousObjectIDMap_get1 = previousObjectIDMap == null ? void 0 : previousObjectIDMap.get(component)) != null ? _previousObjectIDMap_get1 : generateGUID();
|
|
22370
|
+
component.setInstanceId(componentGUID);
|
|
22371
|
+
}
|
|
22372
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
22373
|
+
var child = _step1.value;
|
|
22374
|
+
child.resetGUID(previousObjectIDMap);
|
|
22375
|
+
}
|
|
22376
|
+
};
|
|
22377
|
+
_proto.gatherPreviousObjectID = function gatherPreviousObjectID(previousObjectIDMap) {
|
|
22378
|
+
previousObjectIDMap.set(this, this.getInstanceId());
|
|
22379
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22380
|
+
var component = _step.value;
|
|
22381
|
+
previousObjectIDMap.set(component, component.getInstanceId());
|
|
22382
|
+
}
|
|
22383
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.children), _step1; !(_step1 = _iterator1()).done;){
|
|
22384
|
+
var child = _step1.value;
|
|
22385
|
+
child.gatherPreviousObjectID(previousObjectIDMap);
|
|
22386
|
+
}
|
|
22817
22387
|
};
|
|
22818
22388
|
/**
|
|
22819
22389
|
*
|
|
@@ -22920,9 +22490,11 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22920
22490
|
set: function set(value) {
|
|
22921
22491
|
if (this.listIndex !== value) {
|
|
22922
22492
|
this.listIndex = value;
|
|
22923
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.
|
|
22924
|
-
var
|
|
22925
|
-
|
|
22493
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
22494
|
+
var component = _step.value;
|
|
22495
|
+
if (_instanceof1(component, RendererComponent)) {
|
|
22496
|
+
component.priority = value;
|
|
22497
|
+
}
|
|
22926
22498
|
}
|
|
22927
22499
|
}
|
|
22928
22500
|
}
|
|
@@ -22946,9 +22518,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
22946
22518
|
]);
|
|
22947
22519
|
return VFXItem;
|
|
22948
22520
|
}(EffectsObject);
|
|
22949
|
-
__decorate([
|
|
22950
|
-
serialize()
|
|
22951
|
-
], exports.VFXItem.prototype, "components", void 0);
|
|
22952
22521
|
exports.VFXItem = __decorate([
|
|
22953
22522
|
effectsClass(DataType.VFXItemData)
|
|
22954
22523
|
], exports.VFXItem);
|
|
@@ -26963,66 +26532,255 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
26963
26532
|
if (fontStyle !== FontStyle.normal) {
|
|
26964
26533
|
fontDesc = fontStyle + " " + fontDesc;
|
|
26965
26534
|
}
|
|
26966
|
-
return fontDesc;
|
|
26535
|
+
return fontDesc;
|
|
26536
|
+
};
|
|
26537
|
+
_proto.setupOutline = function setupOutline() {
|
|
26538
|
+
var context = this.context;
|
|
26539
|
+
var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, outlineWidth = _this_textStyle.outlineWidth;
|
|
26540
|
+
var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
|
|
26541
|
+
if (context) {
|
|
26542
|
+
context.strokeStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
26543
|
+
context.lineWidth = outlineWidth * 2;
|
|
26544
|
+
}
|
|
26545
|
+
};
|
|
26546
|
+
_proto.setupShadow = function setupShadow() {
|
|
26547
|
+
var context = this.context;
|
|
26548
|
+
var _this_textStyle = this.textStyle, outlineColor = _this_textStyle.outlineColor, shadowBlur = _this_textStyle.shadowBlur, shadowOffsetX = _this_textStyle.shadowOffsetX, shadowOffsetY = _this_textStyle.shadowOffsetY;
|
|
26549
|
+
var r = outlineColor[0], g = outlineColor[1], b = outlineColor[2], a = outlineColor[3];
|
|
26550
|
+
if (context) {
|
|
26551
|
+
context.shadowColor = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
26552
|
+
context.shadowBlur = shadowBlur;
|
|
26553
|
+
context.shadowOffsetX = shadowOffsetX;
|
|
26554
|
+
context.shadowOffsetY = -shadowOffsetY;
|
|
26555
|
+
}
|
|
26556
|
+
};
|
|
26557
|
+
return TextComponentBase;
|
|
26558
|
+
}();
|
|
26559
|
+
applyMixins(exports.TextComponent, [
|
|
26560
|
+
TextComponentBase
|
|
26561
|
+
]);
|
|
26562
|
+
|
|
26563
|
+
// TODO: 注册必须用
|
|
26564
|
+
var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
26565
|
+
_inherits(TextLoader, AbstractPlugin);
|
|
26566
|
+
function TextLoader() {
|
|
26567
|
+
return AbstractPlugin.apply(this, arguments);
|
|
26568
|
+
}
|
|
26569
|
+
return TextLoader;
|
|
26570
|
+
}(AbstractPlugin);
|
|
26571
|
+
|
|
26572
|
+
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
26573
|
+
_inherits(Asset, EffectsObject);
|
|
26574
|
+
function Asset() {
|
|
26575
|
+
return EffectsObject.apply(this, arguments);
|
|
26576
|
+
}
|
|
26577
|
+
return Asset;
|
|
26578
|
+
}(EffectsObject);
|
|
26579
|
+
|
|
26580
|
+
exports.BinaryAsset = /*#__PURE__*/ function(EffectsObject) {
|
|
26581
|
+
_inherits(BinaryAsset, EffectsObject);
|
|
26582
|
+
function BinaryAsset() {
|
|
26583
|
+
return EffectsObject.apply(this, arguments);
|
|
26584
|
+
}
|
|
26585
|
+
return BinaryAsset;
|
|
26586
|
+
}(EffectsObject);
|
|
26587
|
+
__decorate([
|
|
26588
|
+
serialize()
|
|
26589
|
+
], exports.BinaryAsset.prototype, "buffer", void 0);
|
|
26590
|
+
exports.BinaryAsset = __decorate([
|
|
26591
|
+
effectsClass(DataType.BinaryAsset)
|
|
26592
|
+
], exports.BinaryAsset);
|
|
26593
|
+
|
|
26594
|
+
var SerializationHelper = /*#__PURE__*/ function() {
|
|
26595
|
+
function SerializationHelper() {}
|
|
26596
|
+
SerializationHelper.serialize = function serialize(effectsObject, serializedData) {
|
|
26597
|
+
effectsObject.toData();
|
|
26598
|
+
if (!serializedData) {
|
|
26599
|
+
serializedData = {};
|
|
26600
|
+
}
|
|
26601
|
+
var serializedProperties = getMergedStore(effectsObject);
|
|
26602
|
+
if (serializedProperties) {
|
|
26603
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
26604
|
+
var key = _step.value;
|
|
26605
|
+
var value = effectsObject[key];
|
|
26606
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
|
|
26607
|
+
// TODO json 数据避免传 typedArray
|
|
26608
|
+
serializedData[key] = value;
|
|
26609
|
+
} else if (isArray(value)) {
|
|
26610
|
+
if (!serializedData[key]) {
|
|
26611
|
+
serializedData[key] = [];
|
|
26612
|
+
}
|
|
26613
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
|
|
26614
|
+
} else if (EffectsObject.is(value)) {
|
|
26615
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26616
|
+
serializedData[key] = {
|
|
26617
|
+
id: value.getInstanceId()
|
|
26618
|
+
};
|
|
26619
|
+
} else if (isObject(value)) {
|
|
26620
|
+
if (!serializedData[key]) {
|
|
26621
|
+
serializedData[key] = {};
|
|
26622
|
+
}
|
|
26623
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
26624
|
+
}
|
|
26625
|
+
}
|
|
26626
|
+
}
|
|
26627
|
+
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
26628
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(effectsObject.defination)), _step1; !(_step1 = _iterator1()).done;){
|
|
26629
|
+
var key1 = _step1.value;
|
|
26630
|
+
var value1 = effectsObject.defination[key1];
|
|
26631
|
+
if (typeof value1 === "number" || typeof value1 === "string" || typeof value1 === "boolean" || SerializationHelper.checkTypedArray(value1)) {
|
|
26632
|
+
// TODO json 数据避免传 typedArray
|
|
26633
|
+
serializedData[key1] = value1;
|
|
26634
|
+
} else if (isArray(value1)) {
|
|
26635
|
+
if (!serializedData[key1]) {
|
|
26636
|
+
serializedData[key1] = [];
|
|
26637
|
+
}
|
|
26638
|
+
SerializationHelper.serializeArrayProperty(value1, serializedData[key1], 0);
|
|
26639
|
+
} else if (EffectsObject.is(value1)) {
|
|
26640
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26641
|
+
serializedData[key1] = {
|
|
26642
|
+
id: value1.getInstanceId()
|
|
26643
|
+
};
|
|
26644
|
+
} else if (isObject(value1)) {
|
|
26645
|
+
if (!serializedData[key1]) {
|
|
26646
|
+
serializedData[key1] = {};
|
|
26647
|
+
}
|
|
26648
|
+
SerializationHelper.serializeObjectProperty(value1, serializedData[key1], 0);
|
|
26649
|
+
}
|
|
26650
|
+
}
|
|
26651
|
+
return serializedData;
|
|
26652
|
+
};
|
|
26653
|
+
SerializationHelper.deserialize = function deserialize(serializedData, effectsObject) {
|
|
26654
|
+
effectsObject.defination = serializedData;
|
|
26655
|
+
var serializedProperties = getMergedStore(effectsObject);
|
|
26656
|
+
var engine = effectsObject.engine;
|
|
26657
|
+
if (serializedProperties) {
|
|
26658
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
26659
|
+
var key = _step.value;
|
|
26660
|
+
var value = serializedData[key];
|
|
26661
|
+
if (value === undefined) {
|
|
26662
|
+
continue;
|
|
26663
|
+
}
|
|
26664
|
+
var propertyType = serializedProperties[key].type;
|
|
26665
|
+
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
26666
|
+
effectsObject[key] = SerializationHelper.deserializeProperty(value, engine, 0, propertyType);
|
|
26667
|
+
}
|
|
26668
|
+
}
|
|
26669
|
+
effectsObject.fromData(effectsObject.defination);
|
|
26670
|
+
};
|
|
26671
|
+
SerializationHelper.checkTypedArray = function checkTypedArray(obj) {
|
|
26672
|
+
return _instanceof1(obj, Int8Array) || _instanceof1(obj, Uint8Array) || _instanceof1(obj, Uint8ClampedArray) || _instanceof1(obj, Int16Array) || _instanceof1(obj, Uint16Array) || _instanceof1(obj, Int32Array) || _instanceof1(obj, Uint32Array) || _instanceof1(obj, Float32Array) || _instanceof1(obj, Float64Array) || _instanceof1(obj, ArrayBuffer);
|
|
26673
|
+
};
|
|
26674
|
+
// check value is { id: 7e69662e964e4892ae8933f24562395b }
|
|
26675
|
+
SerializationHelper.checkDataPath = function checkDataPath(value) {
|
|
26676
|
+
return !!(isObject(value) && Object.keys(value).length === 1 && "id" in value && isString(value.id) && value.id.length === 32);
|
|
26677
|
+
};
|
|
26678
|
+
// TODO 测试函数,2.0 上线后移除
|
|
26679
|
+
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
26680
|
+
return isObject(value) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
26681
|
+
};
|
|
26682
|
+
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
26683
|
+
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
26684
|
+
};
|
|
26685
|
+
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type, overrideDataPath) {
|
|
26686
|
+
if (overrideDataPath === void 0) overrideDataPath = true;
|
|
26687
|
+
if (level > 14) {
|
|
26688
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26689
|
+
return;
|
|
26690
|
+
}
|
|
26691
|
+
// 加载并链接 DataPath 字段表示的 EffectsObject 引用。Class 对象 copy [key, value] 会丢失对象信息,因此只递归数组对象和普通 js Object 结构对象。
|
|
26692
|
+
if (isArray(property)) {
|
|
26693
|
+
var res = [];
|
|
26694
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(property), _step; !(_step = _iterator()).done;){
|
|
26695
|
+
var value = _step.value;
|
|
26696
|
+
res.push(SerializationHelper.deserializeProperty(value, engine, level + 1, type, overrideDataPath));
|
|
26697
|
+
}
|
|
26698
|
+
return res;
|
|
26699
|
+
// TODO json 数据避免传 typedArray
|
|
26700
|
+
} else if (SerializationHelper.checkDataPath(property)) {
|
|
26701
|
+
var referenceObject = engine.findObject(property);
|
|
26702
|
+
return overrideDataPath ? referenceObject : property;
|
|
26703
|
+
} else if (isObject(property) && property.constructor === Object) {
|
|
26704
|
+
var res1;
|
|
26705
|
+
if (type) {
|
|
26706
|
+
res1 = new type();
|
|
26707
|
+
} else {
|
|
26708
|
+
res1 = {};
|
|
26709
|
+
}
|
|
26710
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(property)), _step1; !(_step1 = _iterator1()).done;){
|
|
26711
|
+
var key = _step1.value;
|
|
26712
|
+
res1[key] = SerializationHelper.deserializeProperty(property[key], engine, level + 1, undefined, overrideDataPath);
|
|
26713
|
+
}
|
|
26714
|
+
return res1;
|
|
26715
|
+
} else {
|
|
26716
|
+
return property;
|
|
26717
|
+
}
|
|
26718
|
+
};
|
|
26719
|
+
SerializationHelper.serializeObjectProperty = function serializeObjectProperty(objectProperty, serializedData, level) {
|
|
26720
|
+
if (level > 14) {
|
|
26721
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26722
|
+
return;
|
|
26723
|
+
}
|
|
26724
|
+
if (!serializedData) {
|
|
26725
|
+
serializedData = {};
|
|
26726
|
+
}
|
|
26727
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(objectProperty)), _step; !(_step = _iterator()).done;){
|
|
26728
|
+
var key = _step.value;
|
|
26729
|
+
var value = objectProperty[key];
|
|
26730
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(objectProperty)) {
|
|
26731
|
+
// TODO json 数据避免传 typedArray
|
|
26732
|
+
serializedData[key] = value;
|
|
26733
|
+
} else if (isArray(value)) {
|
|
26734
|
+
if (!serializedData[key]) {
|
|
26735
|
+
serializedData[key] = [];
|
|
26736
|
+
}
|
|
26737
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], level + 1);
|
|
26738
|
+
} else if (EffectsObject.is(value)) {
|
|
26739
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26740
|
+
serializedData[key] = {
|
|
26741
|
+
id: value.getInstanceId()
|
|
26742
|
+
};
|
|
26743
|
+
} else if (isObject(value)) {
|
|
26744
|
+
if (!serializedData[key]) {
|
|
26745
|
+
serializedData[key] = {};
|
|
26746
|
+
}
|
|
26747
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], level + 1);
|
|
26748
|
+
}
|
|
26749
|
+
}
|
|
26967
26750
|
};
|
|
26968
|
-
|
|
26969
|
-
|
|
26970
|
-
|
|
26971
|
-
|
|
26972
|
-
if (context) {
|
|
26973
|
-
context.strokeStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
26974
|
-
context.lineWidth = outlineWidth * 2;
|
|
26751
|
+
SerializationHelper.serializeArrayProperty = function serializeArrayProperty(arrayProperty, serializedData, level) {
|
|
26752
|
+
if (level > 14) {
|
|
26753
|
+
console.error("The nested object layers of the serialized data exceed the maximum limit.");
|
|
26754
|
+
return;
|
|
26975
26755
|
}
|
|
26976
|
-
|
|
26977
|
-
|
|
26978
|
-
|
|
26979
|
-
var
|
|
26980
|
-
|
|
26981
|
-
|
|
26982
|
-
|
|
26983
|
-
|
|
26984
|
-
|
|
26985
|
-
|
|
26756
|
+
if (!serializedData) {
|
|
26757
|
+
serializedData = [];
|
|
26758
|
+
}
|
|
26759
|
+
for(var i = 0; i < arrayProperty.length; i++){
|
|
26760
|
+
var value = arrayProperty[i];
|
|
26761
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(arrayProperty)) {
|
|
26762
|
+
// TODO json 数据避免传 typedArray
|
|
26763
|
+
serializedData[i] = value;
|
|
26764
|
+
} else if (isArray(value)) {
|
|
26765
|
+
if (!serializedData[i]) {
|
|
26766
|
+
serializedData[i] = [];
|
|
26767
|
+
}
|
|
26768
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[i], level + 1);
|
|
26769
|
+
} else if (EffectsObject.is(value)) {
|
|
26770
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
26771
|
+
serializedData[i] = {
|
|
26772
|
+
id: value.getInstanceId()
|
|
26773
|
+
};
|
|
26774
|
+
} else if (isObject(value)) {
|
|
26775
|
+
if (!serializedData[i]) {
|
|
26776
|
+
serializedData[i] = {};
|
|
26777
|
+
}
|
|
26778
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[i], level + 1);
|
|
26779
|
+
}
|
|
26986
26780
|
}
|
|
26987
26781
|
};
|
|
26988
|
-
return
|
|
26782
|
+
return SerializationHelper;
|
|
26989
26783
|
}();
|
|
26990
|
-
applyMixins(exports.TextComponent, [
|
|
26991
|
-
TextComponentBase
|
|
26992
|
-
]);
|
|
26993
|
-
|
|
26994
|
-
// TODO: 注册必须用
|
|
26995
|
-
var TextLoader = /*#__PURE__*/ function(AbstractPlugin) {
|
|
26996
|
-
_inherits(TextLoader, AbstractPlugin);
|
|
26997
|
-
function TextLoader() {
|
|
26998
|
-
return AbstractPlugin.apply(this, arguments);
|
|
26999
|
-
}
|
|
27000
|
-
return TextLoader;
|
|
27001
|
-
}(AbstractPlugin);
|
|
27002
|
-
|
|
27003
|
-
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
27004
|
-
_inherits(Asset, EffectsObject);
|
|
27005
|
-
function Asset() {
|
|
27006
|
-
return EffectsObject.apply(this, arguments);
|
|
27007
|
-
}
|
|
27008
|
-
return Asset;
|
|
27009
|
-
}(EffectsObject);
|
|
27010
|
-
|
|
27011
|
-
exports.BinaryAsset = /*#__PURE__*/ function(EffectsObject) {
|
|
27012
|
-
_inherits(BinaryAsset, EffectsObject);
|
|
27013
|
-
function BinaryAsset() {
|
|
27014
|
-
return EffectsObject.apply(this, arguments);
|
|
27015
|
-
}
|
|
27016
|
-
var _proto = BinaryAsset.prototype;
|
|
27017
|
-
_proto.fromData = function fromData(data) {};
|
|
27018
|
-
return BinaryAsset;
|
|
27019
|
-
}(EffectsObject);
|
|
27020
|
-
__decorate([
|
|
27021
|
-
serialize()
|
|
27022
|
-
], exports.BinaryAsset.prototype, "buffer", void 0);
|
|
27023
|
-
exports.BinaryAsset = __decorate([
|
|
27024
|
-
effectsClass(DataType.BinaryAsset)
|
|
27025
|
-
], exports.BinaryAsset);
|
|
27026
26784
|
|
|
27027
26785
|
/**
|
|
27028
26786
|
* @since 2.0.0
|
|
@@ -27031,9 +26789,10 @@ exports.BinaryAsset = __decorate([
|
|
|
27031
26789
|
this.engine = engine;
|
|
27032
26790
|
}
|
|
27033
26791
|
var _proto = AssetLoader.prototype;
|
|
27034
|
-
_proto.loadGUID = function loadGUID(
|
|
27035
|
-
|
|
27036
|
-
|
|
26792
|
+
_proto.loadGUID = function loadGUID(dataPath) {
|
|
26793
|
+
var guid = dataPath.id;
|
|
26794
|
+
if (!dataPath) {
|
|
26795
|
+
return null;
|
|
27037
26796
|
}
|
|
27038
26797
|
var effectsObjectData = this.findData(guid);
|
|
27039
26798
|
var effectsObject;
|
|
@@ -27068,92 +26827,6 @@ exports.BinaryAsset = __decorate([
|
|
|
27068
26827
|
SerializationHelper.deserialize(effectsObjectData, effectsObject);
|
|
27069
26828
|
return effectsObject;
|
|
27070
26829
|
};
|
|
27071
|
-
// 加载本地文件资产
|
|
27072
|
-
_proto.loadGUIDAsync = function loadGUIDAsync(guid) {
|
|
27073
|
-
var _this = this;
|
|
27074
|
-
return _async_to_generator(function() {
|
|
27075
|
-
var effectsObjectData, effectsObject, classConstructor;
|
|
27076
|
-
return __generator(this, function(_state) {
|
|
27077
|
-
switch(_state.label){
|
|
27078
|
-
case 0:
|
|
27079
|
-
if (_this.engine.objectInstance[guid]) {
|
|
27080
|
-
return [
|
|
27081
|
-
2,
|
|
27082
|
-
_this.engine.objectInstance[guid]
|
|
27083
|
-
];
|
|
27084
|
-
}
|
|
27085
|
-
effectsObjectData = _this.findData(guid);
|
|
27086
|
-
if (!!effectsObjectData) return [
|
|
27087
|
-
3,
|
|
27088
|
-
2
|
|
27089
|
-
];
|
|
27090
|
-
if (!_this.engine.database) {
|
|
27091
|
-
console.error("Object data with uuid: " + guid + " not found.");
|
|
27092
|
-
return [
|
|
27093
|
-
2,
|
|
27094
|
-
undefined
|
|
27095
|
-
];
|
|
27096
|
-
}
|
|
27097
|
-
return [
|
|
27098
|
-
4,
|
|
27099
|
-
_this.engine.database.loadGUID(guid)
|
|
27100
|
-
];
|
|
27101
|
-
case 1:
|
|
27102
|
-
effectsObject = _state.sent();
|
|
27103
|
-
if (!effectsObject) {
|
|
27104
|
-
console.error("Disk data with uuid: " + guid + " not found.");
|
|
27105
|
-
return [
|
|
27106
|
-
2,
|
|
27107
|
-
undefined
|
|
27108
|
-
];
|
|
27109
|
-
}
|
|
27110
|
-
_this.engine.addInstance(effectsObject);
|
|
27111
|
-
return [
|
|
27112
|
-
2,
|
|
27113
|
-
effectsObject
|
|
27114
|
-
];
|
|
27115
|
-
case 2:
|
|
27116
|
-
switch(effectsObjectData.dataType){
|
|
27117
|
-
case DataType.Material:
|
|
27118
|
-
effectsObject = Material.create(_this.engine);
|
|
27119
|
-
break;
|
|
27120
|
-
case DataType.Geometry:
|
|
27121
|
-
effectsObject = Geometry.create(_this.engine);
|
|
27122
|
-
break;
|
|
27123
|
-
case DataType.Texture:
|
|
27124
|
-
effectsObject = Texture.create(_this.engine);
|
|
27125
|
-
break;
|
|
27126
|
-
default:
|
|
27127
|
-
{
|
|
27128
|
-
classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
27129
|
-
if (classConstructor) {
|
|
27130
|
-
effectsObject = new classConstructor(_this.engine);
|
|
27131
|
-
}
|
|
27132
|
-
}
|
|
27133
|
-
}
|
|
27134
|
-
if (!effectsObject) {
|
|
27135
|
-
console.error("Constructor for DataType: " + effectsObjectData.dataType + " not found.");
|
|
27136
|
-
return [
|
|
27137
|
-
2,
|
|
27138
|
-
undefined
|
|
27139
|
-
];
|
|
27140
|
-
}
|
|
27141
|
-
effectsObject.setInstanceId(effectsObjectData.id);
|
|
27142
|
-
_this.engine.addInstance(effectsObject);
|
|
27143
|
-
return [
|
|
27144
|
-
4,
|
|
27145
|
-
SerializationHelper.deserializeAsync(effectsObjectData, effectsObject)
|
|
27146
|
-
];
|
|
27147
|
-
case 3:
|
|
27148
|
-
_state.sent();
|
|
27149
|
-
return [
|
|
27150
|
-
2,
|
|
27151
|
-
effectsObject
|
|
27152
|
-
];
|
|
27153
|
-
}
|
|
27154
|
-
});
|
|
27155
|
-
})();
|
|
27156
|
-
};
|
|
27157
26830
|
_proto.findData = function findData(uuid) {
|
|
27158
26831
|
return this.engine.jsonSceneData[uuid];
|
|
27159
26832
|
};
|
|
@@ -27503,35 +27176,35 @@ function rotationZYXFromQuat(out, quat) {
|
|
|
27503
27176
|
];
|
|
27504
27177
|
}
|
|
27505
27178
|
}
|
|
27506
|
-
var _obj;
|
|
27507
|
-
var particleOriginTranslateMap = (_obj = {}, _obj[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
27179
|
+
var _obj$1;
|
|
27180
|
+
var particleOriginTranslateMap = (_obj$1 = {}, _obj$1[ParticleOrigin.PARTICLE_ORIGIN_CENTER] = [
|
|
27508
27181
|
0,
|
|
27509
27182
|
0
|
|
27510
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
27183
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_CENTER_BOTTOM] = [
|
|
27511
27184
|
0,
|
|
27512
27185
|
-0.5
|
|
27513
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
27186
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_CENTER_TOP] = [
|
|
27514
27187
|
0,
|
|
27515
27188
|
0.5
|
|
27516
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
27189
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_LEFT_TOP] = [
|
|
27517
27190
|
-0.5,
|
|
27518
27191
|
0.5
|
|
27519
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
27192
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_LEFT_CENTER] = [
|
|
27520
27193
|
-0.5,
|
|
27521
27194
|
0
|
|
27522
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
27195
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_LEFT_BOTTOM] = [
|
|
27523
27196
|
-0.5,
|
|
27524
27197
|
-0.5
|
|
27525
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
27198
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_CENTER] = [
|
|
27526
27199
|
0.5,
|
|
27527
27200
|
0
|
|
27528
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
27201
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_BOTTOM] = [
|
|
27529
27202
|
0.5,
|
|
27530
27203
|
-0.5
|
|
27531
|
-
], _obj[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
27204
|
+
], _obj$1[ParticleOrigin.PARTICLE_ORIGIN_RIGHT_TOP] = [
|
|
27532
27205
|
0.5,
|
|
27533
27206
|
0.5
|
|
27534
|
-
], _obj);
|
|
27207
|
+
], _obj$1);
|
|
27535
27208
|
function getBezierCurveFromHermite(m0, m1, p0, p3) {
|
|
27536
27209
|
var xStart = p0[0];
|
|
27537
27210
|
var yStart = p0[1];
|
|
@@ -27770,28 +27443,6 @@ var refCompositions = new Map();
|
|
|
27770
27443
|
}
|
|
27771
27444
|
}
|
|
27772
27445
|
}
|
|
27773
|
-
// Composition id 转 guid
|
|
27774
|
-
var compositionId = json.compositionId;
|
|
27775
|
-
var compositionIdToGUIDMap = {};
|
|
27776
|
-
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
27777
|
-
var composition = _step3.value;
|
|
27778
|
-
var guid = generateGUID();
|
|
27779
|
-
compositionIdToGUIDMap[composition.id] = guid;
|
|
27780
|
-
if (composition.id === compositionId) {
|
|
27781
|
-
json.compositionId = guid;
|
|
27782
|
-
}
|
|
27783
|
-
composition.id = guid;
|
|
27784
|
-
}
|
|
27785
|
-
// 预合成元素 refId 同步改为生成的合成 guid
|
|
27786
|
-
for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
|
|
27787
|
-
var item = _step4.value;
|
|
27788
|
-
if (item.content) {
|
|
27789
|
-
var compositionOptions = item.content.options;
|
|
27790
|
-
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
27791
|
-
compositionOptions.refId = compositionIdToGUIDMap[compositionOptions.refId];
|
|
27792
|
-
}
|
|
27793
|
-
}
|
|
27794
|
-
}
|
|
27795
27446
|
return json;
|
|
27796
27447
|
}
|
|
27797
27448
|
function version32Migration(json) {
|
|
@@ -27818,21 +27469,68 @@ function version32Migration(json) {
|
|
|
27818
27469
|
itemMap.set(item.id, item);
|
|
27819
27470
|
}
|
|
27820
27471
|
processContent(mainComp);
|
|
27472
|
+
return json;
|
|
27473
|
+
}
|
|
27474
|
+
function version33Migration(json) {
|
|
27821
27475
|
// 老 shape 数据兼容
|
|
27822
|
-
for(var
|
|
27823
|
-
var
|
|
27824
|
-
if (
|
|
27825
|
-
var spriteComponent = componentMap.get(
|
|
27476
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(json.items), _step; !(_step = _iterator()).done;){
|
|
27477
|
+
var item = _step.value;
|
|
27478
|
+
if (item.type === ItemType.sprite) {
|
|
27479
|
+
var spriteComponent = componentMap.get(item.components[0].id);
|
|
27826
27480
|
if (spriteComponent) {
|
|
27827
27481
|
var shape = spriteComponent.renderer.shape;
|
|
27828
27482
|
var shapeData = void 0;
|
|
27829
27483
|
if (Number.isInteger(shape)) {
|
|
27830
27484
|
shapeData = json.shapes[shape];
|
|
27485
|
+
} else {
|
|
27486
|
+
shapeData = shape;
|
|
27831
27487
|
}
|
|
27832
27488
|
spriteComponent.renderer.shape = shapeData;
|
|
27833
27489
|
}
|
|
27834
27490
|
}
|
|
27835
27491
|
}
|
|
27492
|
+
// Composition id 转 guid, Composition 分离 CompositionComponent
|
|
27493
|
+
var compositionId = json.compositionId;
|
|
27494
|
+
var compositionIdToGUIDMap = {};
|
|
27495
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(json.compositions), _step1; !(_step1 = _iterator1()).done;){
|
|
27496
|
+
var composition = _step1.value;
|
|
27497
|
+
var guid = generateGUID();
|
|
27498
|
+
compositionIdToGUIDMap[composition.id] = guid;
|
|
27499
|
+
if (composition.id === compositionId) {
|
|
27500
|
+
json.compositionId = guid;
|
|
27501
|
+
}
|
|
27502
|
+
composition.id = guid;
|
|
27503
|
+
var compositionComponent = {
|
|
27504
|
+
id: generateGUID(),
|
|
27505
|
+
dataType: "CompositionComponent",
|
|
27506
|
+
items: composition.items,
|
|
27507
|
+
timelineAsset: composition.timelineAsset,
|
|
27508
|
+
sceneBindings: composition.sceneBindings,
|
|
27509
|
+
startTime: composition.startTime
|
|
27510
|
+
};
|
|
27511
|
+
//@ts-expect-error
|
|
27512
|
+
composition.timelineAsset = undefined;
|
|
27513
|
+
//@ts-expect-error
|
|
27514
|
+
composition.sceneBindings = undefined;
|
|
27515
|
+
composition.startTime = undefined;
|
|
27516
|
+
//@ts-expect-error
|
|
27517
|
+
composition.components = [
|
|
27518
|
+
{
|
|
27519
|
+
id: compositionComponent.id
|
|
27520
|
+
}
|
|
27521
|
+
];
|
|
27522
|
+
json.components.push(compositionComponent);
|
|
27523
|
+
}
|
|
27524
|
+
// 预合成元素 refId 同步改为生成的合成 guid
|
|
27525
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(json.items), _step2; !(_step2 = _iterator2()).done;){
|
|
27526
|
+
var item1 = _step2.value;
|
|
27527
|
+
if (item1.content) {
|
|
27528
|
+
var compositionOptions = item1.content.options;
|
|
27529
|
+
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
27530
|
+
compositionOptions.refId = compositionIdToGUIDMap[compositionOptions.refId];
|
|
27531
|
+
}
|
|
27532
|
+
}
|
|
27533
|
+
}
|
|
27836
27534
|
return json;
|
|
27837
27535
|
}
|
|
27838
27536
|
function processContent(composition) {
|
|
@@ -28706,7 +28404,7 @@ function getStandardJSON(json) {
|
|
|
28706
28404
|
if (v0.test(json.version)) {
|
|
28707
28405
|
var _exec;
|
|
28708
28406
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
28709
|
-
return version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json)))));
|
|
28407
|
+
return version33Migration(version32Migration(version31Migration(version30Migration(version21Migration(getStandardJSONFromV0(json))))));
|
|
28710
28408
|
}
|
|
28711
28409
|
reverseParticle = false;
|
|
28712
28410
|
var vs = standardVersion.exec(json.version) || [];
|
|
@@ -28731,6 +28429,9 @@ function getStandardJSON(json) {
|
|
|
28731
28429
|
if (minorVersion < 3) {
|
|
28732
28430
|
json = version32Migration(json);
|
|
28733
28431
|
}
|
|
28432
|
+
if (minorVersion < 4) {
|
|
28433
|
+
json = version33Migration(json);
|
|
28434
|
+
}
|
|
28734
28435
|
}
|
|
28735
28436
|
return json;
|
|
28736
28437
|
}
|
|
@@ -29014,6 +28715,40 @@ function getStandardItem(item, opt) {
|
|
|
29014
28715
|
}
|
|
29015
28716
|
}
|
|
29016
28717
|
|
|
28718
|
+
var _obj;
|
|
28719
|
+
/**
|
|
28720
|
+
* 机型和渲染等级对应表
|
|
28721
|
+
*
|
|
28722
|
+
* 机型:B-低端机、A-中端机、S-高端机
|
|
28723
|
+
* 渲染等级:B-低、A-中、S-高、A+-中高、B+-全部
|
|
28724
|
+
*
|
|
28725
|
+
* - S(高端机):高、全部、中高
|
|
28726
|
+
* - A(中端机):中、全部、中高
|
|
28727
|
+
* - B(低端机):低、全部
|
|
28728
|
+
* - undefined(全部机型)
|
|
28729
|
+
*/ var renderLevelPassSet = (_obj = {}, _obj[RenderLevel.S] = [
|
|
28730
|
+
RenderLevel.S,
|
|
28731
|
+
RenderLevel.BPlus,
|
|
28732
|
+
RenderLevel.APlus
|
|
28733
|
+
], _obj[RenderLevel.A] = [
|
|
28734
|
+
RenderLevel.A,
|
|
28735
|
+
RenderLevel.BPlus,
|
|
28736
|
+
RenderLevel.APlus
|
|
28737
|
+
], _obj[RenderLevel.B] = [
|
|
28738
|
+
RenderLevel.B,
|
|
28739
|
+
RenderLevel.BPlus
|
|
28740
|
+
], _obj);
|
|
28741
|
+
function passRenderLevel(l, renderLevel) {
|
|
28742
|
+
if (!l || !renderLevel) {
|
|
28743
|
+
return true;
|
|
28744
|
+
}
|
|
28745
|
+
var arr = renderLevelPassSet[renderLevel];
|
|
28746
|
+
if (arr) {
|
|
28747
|
+
return arr.includes(l);
|
|
28748
|
+
}
|
|
28749
|
+
return false;
|
|
28750
|
+
}
|
|
28751
|
+
|
|
29017
28752
|
exports.Scene = void 0;
|
|
29018
28753
|
(function(Scene) {
|
|
29019
28754
|
function isJSONObject(scene) {
|
|
@@ -29913,7 +29648,9 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
|
|
|
29913
29648
|
if (_instanceof1(textureOptions, Texture)) {
|
|
29914
29649
|
this.engine.addInstance(textureOptions);
|
|
29915
29650
|
} else {
|
|
29916
|
-
textureOptions = this.engine.
|
|
29651
|
+
textureOptions = this.engine.findObject({
|
|
29652
|
+
id: scene.textureOptions[i].id
|
|
29653
|
+
});
|
|
29917
29654
|
scene.textureOptions[i] = textureOptions;
|
|
29918
29655
|
}
|
|
29919
29656
|
textureOptions.initialize();
|
|
@@ -31560,8 +31297,18 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31560
31297
|
_proto.addInstance = function addInstance(effectsObject) {
|
|
31561
31298
|
this.objectInstance[effectsObject.getInstanceId()] = effectsObject;
|
|
31562
31299
|
};
|
|
31563
|
-
|
|
31564
|
-
|
|
31300
|
+
/**
|
|
31301
|
+
* @ignore
|
|
31302
|
+
*/ _proto.findObject = function findObject(guid) {
|
|
31303
|
+
// 编辑器可能传 Class 对象,这边判断处理一下直接返回原对象。
|
|
31304
|
+
if (!(isObject(guid) && guid.constructor === Object)) {
|
|
31305
|
+
return guid;
|
|
31306
|
+
}
|
|
31307
|
+
if (this.objectInstance[guid.id]) {
|
|
31308
|
+
return this.objectInstance[guid.id];
|
|
31309
|
+
}
|
|
31310
|
+
var result = this.assetLoader.loadGUID(guid);
|
|
31311
|
+
return result;
|
|
31565
31312
|
};
|
|
31566
31313
|
_proto.removeInstance = function removeInstance(id) {
|
|
31567
31314
|
delete this.objectInstance[id];
|
|
@@ -31575,6 +31322,10 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31575
31322
|
}
|
|
31576
31323
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(items), _step1; !(_step1 = _iterator1()).done;){
|
|
31577
31324
|
var vfxItemData = _step1.value;
|
|
31325
|
+
if (!passRenderLevel(vfxItemData.renderLevel, scene.renderLevel)) {
|
|
31326
|
+
vfxItemData.components = [];
|
|
31327
|
+
vfxItemData.type = ItemType.null;
|
|
31328
|
+
}
|
|
31578
31329
|
this.addEffectsObjectData(vfxItemData);
|
|
31579
31330
|
}
|
|
31580
31331
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(materials), _step2; !(_step2 = _iterator2()).done;){
|
|
@@ -31629,45 +31380,20 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
31629
31380
|
return _async_to_generator(function() {
|
|
31630
31381
|
var jsonScene, _iterator, _step, itemData, itemType;
|
|
31631
31382
|
return __generator(this, function(_state) {
|
|
31632
|
-
|
|
31633
|
-
|
|
31634
|
-
|
|
31635
|
-
|
|
31636
|
-
|
|
31637
|
-
|
|
31638
|
-
|
|
31639
|
-
|
|
31640
|
-
|
|
31641
|
-
|
|
31642
|
-
itemData = _step.value;
|
|
31643
|
-
itemType = itemData.type;
|
|
31644
|
-
if (!(itemType === "ECS" || itemType === "camera" || itemType === ItemType.sprite || itemType === ItemType.particle || itemType === ItemType.mesh || itemType === ItemType.skybox || itemType === ItemType.light || itemType === ItemType.tree || itemType === ItemType.interact || itemType === ItemType.camera)) {
|
|
31645
|
-
return [
|
|
31646
|
-
3,
|
|
31647
|
-
3
|
|
31648
|
-
];
|
|
31649
|
-
}
|
|
31650
|
-
if (!_this.database) return [
|
|
31651
|
-
3,
|
|
31652
|
-
3
|
|
31653
|
-
];
|
|
31654
|
-
return [
|
|
31655
|
-
4,
|
|
31656
|
-
_this.assetLoader.loadGUIDAsync(itemData.id)
|
|
31657
|
-
];
|
|
31658
|
-
case 2:
|
|
31659
|
-
_state.sent();
|
|
31660
|
-
_state.label = 3;
|
|
31661
|
-
case 3:
|
|
31662
|
-
return [
|
|
31663
|
-
3,
|
|
31664
|
-
1
|
|
31665
|
-
];
|
|
31666
|
-
case 4:
|
|
31667
|
-
return [
|
|
31668
|
-
2
|
|
31669
|
-
];
|
|
31383
|
+
jsonScene = scene.jsonScene;
|
|
31384
|
+
for(_iterator = _create_for_of_iterator_helper_loose(jsonScene.items); !(_step = _iterator()).done;){
|
|
31385
|
+
itemData = _step.value;
|
|
31386
|
+
itemType = itemData.type;
|
|
31387
|
+
if (!(itemType === "ECS" || itemType === "camera" || itemType === ItemType.sprite || itemType === ItemType.particle || itemType === ItemType.mesh || itemType === ItemType.skybox || itemType === ItemType.light || itemType === ItemType.tree || itemType === ItemType.interact || itemType === ItemType.camera)) {
|
|
31388
|
+
continue;
|
|
31389
|
+
}
|
|
31390
|
+
if (_this.database) {
|
|
31391
|
+
_this.assetLoader.loadGUID(itemData);
|
|
31392
|
+
}
|
|
31670
31393
|
}
|
|
31394
|
+
return [
|
|
31395
|
+
2
|
|
31396
|
+
];
|
|
31671
31397
|
});
|
|
31672
31398
|
})();
|
|
31673
31399
|
};
|
|
@@ -31915,7 +31641,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
31915
31641
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
31916
31642
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
31917
31643
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
31918
|
-
var version = "2.4.0-beta.
|
|
31644
|
+
var version = "2.4.0-beta.2";
|
|
31919
31645
|
logger.info("Core version: " + version + ".");
|
|
31920
31646
|
|
|
31921
31647
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -31940,7 +31666,6 @@ exports.CameraVFXItemLoader = CameraVFXItemLoader;
|
|
|
31940
31666
|
exports.ColorCurve = ColorCurve;
|
|
31941
31667
|
exports.Component = Component;
|
|
31942
31668
|
exports.Composition = Composition;
|
|
31943
|
-
exports.CompositionComponent = CompositionComponent;
|
|
31944
31669
|
exports.DEFAULT_FONTS = DEFAULT_FONTS;
|
|
31945
31670
|
exports.DEFAULT_FPS = DEFAULT_FPS;
|
|
31946
31671
|
exports.Database = Database;
|
|
@@ -32064,7 +31789,6 @@ exports.effectsClassStore = effectsClassStore;
|
|
|
32064
31789
|
exports.enlargeBuffer = enlargeBuffer;
|
|
32065
31790
|
exports.ensureFixedNumber = ensureFixedNumber;
|
|
32066
31791
|
exports.ensureVec3 = ensureVec3;
|
|
32067
|
-
exports.filterItemsByRenderLevel = filterItemsByRenderLevel;
|
|
32068
31792
|
exports.findPreviousRenderPass = findPreviousRenderPass;
|
|
32069
31793
|
exports.gaussianDownFrag = gaussianDown_frag;
|
|
32070
31794
|
exports.gaussianDownHFrag = gaussianDownHFrag;
|