@galacean/effects-threejs 2.0.0-alpha.13 → 2.0.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +790 -771
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +788 -770
- package/dist/index.mjs.map +1 -1
- package/dist/three-composition.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.15
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -765,6 +765,11 @@ function noop() {}
|
|
|
765
765
|
*/ function isObject(obj) {
|
|
766
766
|
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
767
767
|
}
|
|
768
|
+
function isCanvas(canvas) {
|
|
769
|
+
var _canvas_tagName;
|
|
770
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
771
|
+
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
772
|
+
}
|
|
768
773
|
function deepClone(obj) {
|
|
769
774
|
if (isArray(obj)) {
|
|
770
775
|
return obj.map(deepClone);
|
|
@@ -792,6 +797,37 @@ function throwDestroyedError() {
|
|
|
792
797
|
function generateGUID() {
|
|
793
798
|
return v4().replace(/-/g, "");
|
|
794
799
|
}
|
|
800
|
+
function base64ToFile(base64, filename, contentType) {
|
|
801
|
+
if (filename === void 0) filename = "base64File";
|
|
802
|
+
if (contentType === void 0) contentType = "";
|
|
803
|
+
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
804
|
+
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
805
|
+
// 将 base64 编码的字符串转换为二进制字符串
|
|
806
|
+
var byteCharacters = atob(base64WithoutPrefix);
|
|
807
|
+
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
808
|
+
var byteArrays = [];
|
|
809
|
+
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
810
|
+
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
811
|
+
var slice = byteCharacters.slice(offset, offset + 512);
|
|
812
|
+
var byteNumbers = new Array(slice.length);
|
|
813
|
+
for(var i = 0; i < slice.length; i++){
|
|
814
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
815
|
+
}
|
|
816
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
817
|
+
byteArrays.push(byteArray);
|
|
818
|
+
}
|
|
819
|
+
// 使用字节数组创建 Blob 对象
|
|
820
|
+
var blob = new Blob(byteArrays, {
|
|
821
|
+
type: contentType
|
|
822
|
+
});
|
|
823
|
+
// 创建 File 对象
|
|
824
|
+
var file = new File([
|
|
825
|
+
blob
|
|
826
|
+
], filename, {
|
|
827
|
+
type: contentType
|
|
828
|
+
});
|
|
829
|
+
return file;
|
|
830
|
+
}
|
|
795
831
|
|
|
796
832
|
function _defineProperties(target, props) {
|
|
797
833
|
for(var i = 0; i < props.length; i++){
|
|
@@ -18520,7 +18556,7 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
18520
18556
|
_proto.processFrame = function processFrame(context) {};
|
|
18521
18557
|
return ActivationPlayable;
|
|
18522
18558
|
}(Playable);
|
|
18523
|
-
|
|
18559
|
+
exports.ActivationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
18524
18560
|
_inherits(ActivationPlayableAsset, PlayableAsset);
|
|
18525
18561
|
function ActivationPlayableAsset() {
|
|
18526
18562
|
return PlayableAsset.apply(this, arguments);
|
|
@@ -18531,6 +18567,9 @@ var ActivationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18531
18567
|
};
|
|
18532
18568
|
return ActivationPlayableAsset;
|
|
18533
18569
|
}(PlayableAsset);
|
|
18570
|
+
exports.ActivationPlayableAsset = __decorate([
|
|
18571
|
+
effectsClass("ActivationPlayableAsset")
|
|
18572
|
+
], exports.ActivationPlayableAsset);
|
|
18534
18573
|
exports.AnimationClip = /*#__PURE__*/ function(EffectsObject) {
|
|
18535
18574
|
_inherits(AnimationClip, EffectsObject);
|
|
18536
18575
|
function AnimationClip() {
|
|
@@ -18660,17 +18699,15 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18660
18699
|
return _this;
|
|
18661
18700
|
}
|
|
18662
18701
|
var _proto = TrackAsset.prototype;
|
|
18663
|
-
|
|
18664
|
-
|
|
18702
|
+
/**
|
|
18703
|
+
* 重写该方法以获取自定义对象绑定
|
|
18704
|
+
*/ _proto.resolveBinding = function resolveBinding(parentBinding) {
|
|
18705
|
+
return parentBinding;
|
|
18665
18706
|
};
|
|
18666
18707
|
/**
|
|
18667
|
-
*
|
|
18668
|
-
*/ _proto.
|
|
18669
|
-
|
|
18670
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
18671
|
-
var subTrack = _step.value;
|
|
18672
|
-
subTrack.initializeBindingRecursive(this.binding);
|
|
18673
|
-
}
|
|
18708
|
+
* 重写该方法以创建自定义混合器
|
|
18709
|
+
*/ _proto.createTrackMixer = function createTrackMixer(graph) {
|
|
18710
|
+
return new Playable(graph);
|
|
18674
18711
|
};
|
|
18675
18712
|
_proto.createOutput = function createOutput() {
|
|
18676
18713
|
var output = new PlayableOutput();
|
|
@@ -18701,17 +18738,15 @@ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18701
18738
|
}
|
|
18702
18739
|
return mixer;
|
|
18703
18740
|
};
|
|
18704
|
-
/**
|
|
18705
|
-
* 重写该方法以创建自定义混合器
|
|
18706
|
-
*/ _proto.createTrackMixer = function createTrackMixer(graph) {
|
|
18707
|
-
return new Playable(graph);
|
|
18708
|
-
};
|
|
18709
18741
|
_proto.createPlayable = function createPlayable(graph) {
|
|
18710
18742
|
return new Playable(graph);
|
|
18711
18743
|
};
|
|
18712
18744
|
_proto.getChildTracks = function getChildTracks() {
|
|
18713
18745
|
return this.children;
|
|
18714
18746
|
};
|
|
18747
|
+
_proto.addChild = function addChild(child) {
|
|
18748
|
+
this.children.push(child);
|
|
18749
|
+
};
|
|
18715
18750
|
_proto.createClip = function createClip(classConstructor, name) {
|
|
18716
18751
|
var newClip = new exports.TimelineClip();
|
|
18717
18752
|
newClip.asset = new classConstructor(this.engine);
|
|
@@ -18789,9 +18824,10 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18789
18824
|
var weight = 1.0;
|
|
18790
18825
|
var ended = false;
|
|
18791
18826
|
var started = false;
|
|
18827
|
+
var boundItem = this.track.binding;
|
|
18792
18828
|
if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
|
|
18793
|
-
var
|
|
18794
|
-
if (exports.VFXItem.isParticle(
|
|
18829
|
+
var _boundItem_getComponent;
|
|
18830
|
+
if (exports.VFXItem.isParticle(boundItem) && !((_boundItem_getComponent = boundItem.getComponent(exports.ParticleSystem)) == null ? void 0 : _boundItem_getComponent.destroyed)) {
|
|
18795
18831
|
weight = 1.0;
|
|
18796
18832
|
} else {
|
|
18797
18833
|
weight = 0.0;
|
|
@@ -18807,7 +18843,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18807
18843
|
this.playable.play();
|
|
18808
18844
|
}
|
|
18809
18845
|
this.parentMixer.setInputWeight(this.playable, weight);
|
|
18810
|
-
var boundItem = this.track.binding;
|
|
18811
18846
|
// 判断动画是否结束
|
|
18812
18847
|
if (ended && !boundItem.ended) {
|
|
18813
18848
|
boundItem.ended = true;
|
|
@@ -18844,6 +18879,45 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18844
18879
|
return RuntimeClip;
|
|
18845
18880
|
}();
|
|
18846
18881
|
|
|
18882
|
+
exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
18883
|
+
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
18884
|
+
function ObjectBindingTrack() {
|
|
18885
|
+
return TrackAsset1.apply(this, arguments);
|
|
18886
|
+
}
|
|
18887
|
+
var _proto = ObjectBindingTrack.prototype;
|
|
18888
|
+
_proto.create = function create(timelineAsset) {
|
|
18889
|
+
var boundItem = this.binding;
|
|
18890
|
+
// 添加粒子动画 clip
|
|
18891
|
+
if (boundItem.getComponent(exports.ParticleSystem)) {
|
|
18892
|
+
var particleTrack = timelineAsset.createTrack(exports.TrackAsset, this, "ParticleTrack");
|
|
18893
|
+
particleTrack.binding = this.binding;
|
|
18894
|
+
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
18895
|
+
particleClip.start = boundItem.start;
|
|
18896
|
+
particleClip.duration = boundItem.duration;
|
|
18897
|
+
particleClip.endBehaviour = boundItem.endBehavior;
|
|
18898
|
+
}
|
|
18899
|
+
};
|
|
18900
|
+
_proto.fromData = function fromData(data) {
|
|
18901
|
+
TrackAsset1.prototype.fromData.call(this, data);
|
|
18902
|
+
this.data = data;
|
|
18903
|
+
};
|
|
18904
|
+
return ObjectBindingTrack;
|
|
18905
|
+
}(exports.TrackAsset);
|
|
18906
|
+
exports.ObjectBindingTrack = __decorate([
|
|
18907
|
+
effectsClass("ObjectBindingTrack")
|
|
18908
|
+
], exports.ObjectBindingTrack);
|
|
18909
|
+
|
|
18910
|
+
exports.TransformTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
18911
|
+
_inherits(TransformTrack, TrackAsset);
|
|
18912
|
+
function TransformTrack() {
|
|
18913
|
+
return TrackAsset.apply(this, arguments);
|
|
18914
|
+
}
|
|
18915
|
+
return TransformTrack;
|
|
18916
|
+
}(exports.TrackAsset);
|
|
18917
|
+
exports.TransformTrack = __decorate([
|
|
18918
|
+
effectsClass("TransformTrack")
|
|
18919
|
+
], exports.TransformTrack);
|
|
18920
|
+
|
|
18847
18921
|
var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
18848
18922
|
_inherits(ActivationMixerPlayable, Playable);
|
|
18849
18923
|
function ActivationMixerPlayable() {
|
|
@@ -18907,85 +18981,6 @@ exports.ActivationTrack = __decorate([
|
|
|
18907
18981
|
effectsClass("ActivationTrack")
|
|
18908
18982
|
], exports.ActivationTrack);
|
|
18909
18983
|
|
|
18910
|
-
exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
18911
|
-
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
18912
|
-
function ObjectBindingTrack() {
|
|
18913
|
-
var _this;
|
|
18914
|
-
_this = TrackAsset1.apply(this, arguments) || this;
|
|
18915
|
-
_this.trackSeed = 0;
|
|
18916
|
-
return _this;
|
|
18917
|
-
}
|
|
18918
|
-
var _proto = ObjectBindingTrack.prototype;
|
|
18919
|
-
_proto.create = function create() {
|
|
18920
|
-
this.options = {
|
|
18921
|
-
start: this.binding.start,
|
|
18922
|
-
duration: this.binding.duration,
|
|
18923
|
-
looping: this.binding.endBehavior === ItemEndBehavior.loop,
|
|
18924
|
-
endBehavior: this.binding.endBehavior || ItemEndBehavior.destroy
|
|
18925
|
-
};
|
|
18926
|
-
this.id = this.binding.id;
|
|
18927
|
-
this.name = this.binding.name;
|
|
18928
|
-
var activationTrack = this.createTrack(exports.ActivationTrack, "ActivationTrack");
|
|
18929
|
-
activationTrack.binding = this.binding;
|
|
18930
|
-
activationTrack.createClip(ActivationPlayableAsset, "ActivationTimelineClip");
|
|
18931
|
-
// 添加粒子动画 clip
|
|
18932
|
-
if (this.binding.getComponent(exports.ParticleSystem)) {
|
|
18933
|
-
var particleTrack = this.createTrack(exports.TrackAsset, "ParticleTrack");
|
|
18934
|
-
particleTrack.binding = this.binding;
|
|
18935
|
-
particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
18936
|
-
}
|
|
18937
|
-
// TODO TimelineClip 需要传入 start 和 duration 数据
|
|
18938
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
18939
|
-
var track = _step.value;
|
|
18940
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
18941
|
-
var clip = _step1.value;
|
|
18942
|
-
clip.start = this.binding.start;
|
|
18943
|
-
clip.duration = this.binding.duration;
|
|
18944
|
-
clip.endBehaviour = this.binding.endBehavior;
|
|
18945
|
-
}
|
|
18946
|
-
}
|
|
18947
|
-
};
|
|
18948
|
-
_proto.toLocalTime = function toLocalTime(time) {
|
|
18949
|
-
var localTime = time - this.options.start;
|
|
18950
|
-
var duration = this.options.duration;
|
|
18951
|
-
if (localTime - duration > 0.001) {
|
|
18952
|
-
if (this.options.endBehavior === END_BEHAVIOR_RESTART) {
|
|
18953
|
-
localTime = localTime % duration;
|
|
18954
|
-
} else if (this.options.endBehavior === END_BEHAVIOR_FREEZE) {
|
|
18955
|
-
localTime = Math.min(duration, localTime);
|
|
18956
|
-
}
|
|
18957
|
-
}
|
|
18958
|
-
return localTime;
|
|
18959
|
-
};
|
|
18960
|
-
_proto.createTrack = function createTrack(classConstructor, name) {
|
|
18961
|
-
var newTrack = new classConstructor(this.engine);
|
|
18962
|
-
newTrack.binding = this.binding;
|
|
18963
|
-
newTrack.id = (this.trackSeed++).toString();
|
|
18964
|
-
newTrack.name = name ? name : "Track" + newTrack.id;
|
|
18965
|
-
this.children.push(newTrack);
|
|
18966
|
-
return newTrack;
|
|
18967
|
-
};
|
|
18968
|
-
_proto.fromData = function fromData(data) {
|
|
18969
|
-
TrackAsset1.prototype.fromData.call(this, data);
|
|
18970
|
-
this.data = data;
|
|
18971
|
-
};
|
|
18972
|
-
return ObjectBindingTrack;
|
|
18973
|
-
}(exports.TrackAsset);
|
|
18974
|
-
exports.ObjectBindingTrack = __decorate([
|
|
18975
|
-
effectsClass("ObjectBindingTrack")
|
|
18976
|
-
], exports.ObjectBindingTrack);
|
|
18977
|
-
|
|
18978
|
-
exports.TransformTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
18979
|
-
_inherits(TransformTrack, TrackAsset);
|
|
18980
|
-
function TransformTrack() {
|
|
18981
|
-
return TrackAsset.apply(this, arguments);
|
|
18982
|
-
}
|
|
18983
|
-
return TransformTrack;
|
|
18984
|
-
}(exports.TrackAsset);
|
|
18985
|
-
exports.TransformTrack = __decorate([
|
|
18986
|
-
effectsClass("TransformTrack")
|
|
18987
|
-
], exports.TransformTrack);
|
|
18988
|
-
|
|
18989
18984
|
exports.SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
18990
18985
|
_inherits(SpriteColorTrack, TrackAsset);
|
|
18991
18986
|
function SpriteColorTrack() {
|
|
@@ -19007,17 +19002,29 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
19007
19002
|
}
|
|
19008
19003
|
var _proto = TimelineAsset.prototype;
|
|
19009
19004
|
_proto.createPlayable = function createPlayable(graph) {
|
|
19010
|
-
this.graph = graph;
|
|
19011
19005
|
var timelinePlayable = new TimelinePlayable(graph);
|
|
19012
19006
|
timelinePlayable.setTraversalMode(PlayableTraversalMode.Passthrough);
|
|
19007
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
19008
|
+
var track = _step.value;
|
|
19009
|
+
if (_instanceof1(track, exports.ObjectBindingTrack)) {
|
|
19010
|
+
track.create(this);
|
|
19011
|
+
}
|
|
19012
|
+
}
|
|
19013
19013
|
timelinePlayable.compileTracks(graph, this.tracks);
|
|
19014
19014
|
return timelinePlayable;
|
|
19015
19015
|
};
|
|
19016
|
-
_proto.
|
|
19017
|
-
|
|
19016
|
+
_proto.createTrack = function createTrack(classConstructor, parent, name) {
|
|
19017
|
+
var newTrack = new classConstructor(this.engine);
|
|
19018
|
+
newTrack.name = name ? name : classConstructor.name;
|
|
19019
|
+
parent.addChild(newTrack);
|
|
19020
|
+
return newTrack;
|
|
19018
19021
|
};
|
|
19022
|
+
_proto.fromData = function fromData(data) {};
|
|
19019
19023
|
return TimelineAsset;
|
|
19020
19024
|
}(PlayableAsset);
|
|
19025
|
+
__decorate([
|
|
19026
|
+
serialize()
|
|
19027
|
+
], exports.TimelineAsset.prototype, "tracks", void 0);
|
|
19021
19028
|
exports.TimelineAsset = __decorate([
|
|
19022
19029
|
effectsClass("TimelineAsset")
|
|
19023
19030
|
], exports.TimelineAsset);
|
|
@@ -19027,7 +19034,6 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19027
19034
|
var _this;
|
|
19028
19035
|
_this = Playable.apply(this, arguments) || this;
|
|
19029
19036
|
_this.clips = [];
|
|
19030
|
-
_this.masterTracks = [];
|
|
19031
19037
|
return _this;
|
|
19032
19038
|
}
|
|
19033
19039
|
var _proto = TimelinePlayable.prototype;
|
|
@@ -19044,25 +19050,18 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19044
19050
|
};
|
|
19045
19051
|
_proto.compileTracks = function compileTracks(graph, tracks) {
|
|
19046
19052
|
this.sortTracks(tracks);
|
|
19047
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
19048
|
-
var track = _step.value;
|
|
19049
|
-
if (_instanceof1(track, exports.ObjectBindingTrack)) {
|
|
19050
|
-
track.create();
|
|
19051
|
-
}
|
|
19052
|
-
this.masterTracks.push(track);
|
|
19053
|
-
}
|
|
19054
19053
|
var outputTrack = [];
|
|
19055
|
-
for(var
|
|
19056
|
-
var masterTrack =
|
|
19054
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
19055
|
+
var masterTrack = _step.value;
|
|
19057
19056
|
outputTrack.push(masterTrack);
|
|
19058
19057
|
this.addSubTracksRecursive(masterTrack, outputTrack);
|
|
19059
19058
|
}
|
|
19060
|
-
for(var
|
|
19061
|
-
var
|
|
19062
|
-
var trackMixPlayable =
|
|
19059
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
|
|
19060
|
+
var track = _step1.value;
|
|
19061
|
+
var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
|
|
19063
19062
|
this.addInput(trackMixPlayable, 0);
|
|
19064
|
-
var trackOutput =
|
|
19065
|
-
trackOutput.setUserData(
|
|
19063
|
+
var trackOutput = track.createOutput();
|
|
19064
|
+
trackOutput.setUserData(track.binding);
|
|
19066
19065
|
graph.addOutput(trackOutput);
|
|
19067
19066
|
trackOutput.setSourcePlayeble(this, this.getInputCount() - 1);
|
|
19068
19067
|
}
|
|
@@ -19106,98 +19105,375 @@ function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
|
19106
19105
|
return false;
|
|
19107
19106
|
}
|
|
19108
19107
|
function compareTracks(a, b) {
|
|
19109
|
-
|
|
19108
|
+
var bindingA = a.track.binding;
|
|
19109
|
+
var bindingB = b.track.binding;
|
|
19110
|
+
if (!_instanceof1(bindingA, exports.VFXItem) || !_instanceof1(bindingB, exports.VFXItem)) {
|
|
19111
|
+
return a.originalIndex - b.originalIndex;
|
|
19112
|
+
}
|
|
19113
|
+
if (isAncestor(bindingA, bindingB)) {
|
|
19110
19114
|
return -1;
|
|
19111
|
-
} else if (isAncestor(
|
|
19115
|
+
} else if (isAncestor(bindingB, bindingA)) {
|
|
19112
19116
|
return 1;
|
|
19113
19117
|
} else {
|
|
19114
19118
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
19115
19119
|
}
|
|
19116
19120
|
}
|
|
19117
19121
|
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
// } else {
|
|
19135
|
-
// if (textWidth) {
|
|
19136
|
-
// this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
|
|
19137
|
-
// this.width = textWidth;
|
|
19138
|
-
// } else {
|
|
19139
|
-
// this.width = basicScale[0] * 100;
|
|
19140
|
-
// }
|
|
19141
|
-
// this.height = basicScale[1] * 100;
|
|
19142
|
-
// }
|
|
19143
|
-
this.width = textWidth;
|
|
19144
|
-
this.height = textHeight;
|
|
19145
|
-
this.letterSpace = letterSpace;
|
|
19146
|
-
this.overFlow = textOverflow;
|
|
19147
|
-
this.textBaseline = textBaseline;
|
|
19148
|
-
this.textAlign = textAlign;
|
|
19149
|
-
this.lineHeight = lineHeight;
|
|
19122
|
+
/**
|
|
19123
|
+
* @since 2.0.0
|
|
19124
|
+
* @internal
|
|
19125
|
+
*/ var CompositionComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
19126
|
+
_inherits(CompositionComponent, ItemBehaviour);
|
|
19127
|
+
function CompositionComponent() {
|
|
19128
|
+
var _this;
|
|
19129
|
+
_this = ItemBehaviour.apply(this, arguments) || this;
|
|
19130
|
+
_this.time = 0;
|
|
19131
|
+
_this.startTime = 0;
|
|
19132
|
+
_this.items = [] // 场景的所有元素
|
|
19133
|
+
;
|
|
19134
|
+
_this.reusable = false;
|
|
19135
|
+
_this.sceneBindings = [];
|
|
19136
|
+
_this.graph = new PlayableGraph();
|
|
19137
|
+
return _this;
|
|
19150
19138
|
}
|
|
19151
|
-
var _proto =
|
|
19152
|
-
_proto.
|
|
19153
|
-
var
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
break;
|
|
19162
|
-
case TextBaseline.bottom:
|
|
19163
|
-
offsetY = this.height - offset / 2;
|
|
19164
|
-
break;
|
|
19139
|
+
var _proto = CompositionComponent.prototype;
|
|
19140
|
+
_proto.start = function start() {
|
|
19141
|
+
var _this_item_props = this.item.props, _this_item_props_startTime = _this_item_props.startTime, startTime = _this_item_props_startTime === void 0 ? 0 : _this_item_props_startTime;
|
|
19142
|
+
this.startTime = startTime;
|
|
19143
|
+
this.resolveBindings();
|
|
19144
|
+
this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
|
|
19145
|
+
this.timelinePlayable.play();
|
|
19146
|
+
// 重播不销毁元素
|
|
19147
|
+
if (this.item.endBehavior !== ItemEndBehavior.destroy) {
|
|
19148
|
+
this.setReusable(true);
|
|
19165
19149
|
}
|
|
19166
|
-
return offsetY;
|
|
19167
19150
|
};
|
|
19168
|
-
_proto.
|
|
19169
|
-
var
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19151
|
+
_proto.setReusable = function setReusable(value) {
|
|
19152
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step; !(_step = _iterator()).done;){
|
|
19153
|
+
var track = _step.value;
|
|
19154
|
+
var binding = track.binding;
|
|
19155
|
+
if (_instanceof1(binding, exports.VFXItem)) {
|
|
19156
|
+
if (_instanceof1(track, exports.ObjectBindingTrack)) {
|
|
19157
|
+
binding.reusable = value;
|
|
19158
|
+
}
|
|
19159
|
+
var subCompositionComponent = binding.getComponent(CompositionComponent);
|
|
19160
|
+
if (subCompositionComponent) {
|
|
19161
|
+
subCompositionComponent.setReusable(value);
|
|
19162
|
+
}
|
|
19163
|
+
}
|
|
19180
19164
|
}
|
|
19181
|
-
return offsetX;
|
|
19182
19165
|
};
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
* @param width 文本框宽度
|
|
19186
|
-
* @param height 文本框高度
|
|
19187
|
-
*/ _proto.setSize = function setSize(width, height) {
|
|
19188
|
-
this.width = width;
|
|
19189
|
-
this.height = height;
|
|
19166
|
+
_proto.getReusable = function getReusable() {
|
|
19167
|
+
return this.reusable;
|
|
19190
19168
|
};
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
|
|
19200
|
-
|
|
19169
|
+
_proto.update = function update(dt) {
|
|
19170
|
+
var time = this.time;
|
|
19171
|
+
// 主合成 rootItem 没有绑定轨道,增加结束行为判断。
|
|
19172
|
+
if (this.item.isEnded(this.time) && !this.item.parent) {
|
|
19173
|
+
this.item.ended = true;
|
|
19174
|
+
}
|
|
19175
|
+
this.timelinePlayable.setTime(time);
|
|
19176
|
+
this.graph.evaluate(dt);
|
|
19177
|
+
};
|
|
19178
|
+
_proto.createContent = function createContent() {
|
|
19179
|
+
var sceneBindings = [];
|
|
19180
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.data.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
19181
|
+
var sceneBindingData = _step.value;
|
|
19182
|
+
sceneBindings.push({
|
|
19183
|
+
key: this.engine.assetLoader.loadGUID(sceneBindingData.key.id),
|
|
19184
|
+
value: this.engine.assetLoader.loadGUID(sceneBindingData.value.id)
|
|
19185
|
+
});
|
|
19186
|
+
}
|
|
19187
|
+
this.sceneBindings = sceneBindings;
|
|
19188
|
+
var timelineAsset = this.data.timelineAsset ? this.engine.assetLoader.loadGUID(this.data.timelineAsset.id) : new exports.TimelineAsset(this.engine);
|
|
19189
|
+
this.timelineAsset = timelineAsset;
|
|
19190
|
+
var items = this.items;
|
|
19191
|
+
this.items.length = 0;
|
|
19192
|
+
if (this.item.composition) {
|
|
19193
|
+
var assetLoader = this.item.engine.assetLoader;
|
|
19194
|
+
var itemProps = this.item.props.items ? this.item.props.items : [];
|
|
19195
|
+
for(var i = 0; i < itemProps.length; i++){
|
|
19196
|
+
var item = void 0;
|
|
19197
|
+
var itemData = itemProps[i];
|
|
19198
|
+
// 设置预合成作为元素时的时长、结束行为和渲染延时
|
|
19199
|
+
if (exports.Item.isComposition(itemData)) {
|
|
19200
|
+
var refId = itemData.content.options.refId;
|
|
19201
|
+
var props = this.item.composition.refCompositionProps.get(refId);
|
|
19202
|
+
if (!props) {
|
|
19203
|
+
throw new Error("引用的Id: " + refId + " 的预合成不存在");
|
|
19204
|
+
}
|
|
19205
|
+
// endBehaviour 类型需优化
|
|
19206
|
+
props.content = itemData.content;
|
|
19207
|
+
item = assetLoader.loadGUID(itemData.id);
|
|
19208
|
+
item.composition = this.item.composition;
|
|
19209
|
+
var compositionComponent = item.addComponent(CompositionComponent);
|
|
19210
|
+
compositionComponent.data = props;
|
|
19211
|
+
compositionComponent.refId = refId;
|
|
19212
|
+
item.transform.parentTransform = this.transform;
|
|
19213
|
+
this.item.composition.refContent.push(item);
|
|
19214
|
+
if (item.endBehavior === ItemEndBehavior.loop) {
|
|
19215
|
+
this.item.composition.autoRefTex = false;
|
|
19216
|
+
}
|
|
19217
|
+
compositionComponent.createContent();
|
|
19218
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositionComponent.items), _step1; !(_step1 = _iterator1()).done;){
|
|
19219
|
+
var vfxItem = _step1.value;
|
|
19220
|
+
vfxItem.setInstanceId(generateGUID());
|
|
19221
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
19222
|
+
var component = _step2.value;
|
|
19223
|
+
component.setInstanceId(generateGUID());
|
|
19224
|
+
}
|
|
19225
|
+
}
|
|
19226
|
+
} else {
|
|
19227
|
+
item = assetLoader.loadGUID(itemData.id);
|
|
19228
|
+
item.composition = this.item.composition;
|
|
19229
|
+
}
|
|
19230
|
+
item.parent = this.item;
|
|
19231
|
+
// 相机不跟随合成移动
|
|
19232
|
+
item.transform.parentTransform = itemData.type === ItemType.camera ? new Transform() : this.transform;
|
|
19233
|
+
if (exports.VFXItem.isExtraCamera(item)) {
|
|
19234
|
+
this.item.composition.extraCamera = item;
|
|
19235
|
+
}
|
|
19236
|
+
items.push(item);
|
|
19237
|
+
}
|
|
19238
|
+
}
|
|
19239
|
+
};
|
|
19240
|
+
_proto.onDestroy = function onDestroy() {
|
|
19241
|
+
if (this.item.composition) {
|
|
19242
|
+
if (this.items) {
|
|
19243
|
+
this.items.forEach(function(item) {
|
|
19244
|
+
return item.dispose();
|
|
19245
|
+
});
|
|
19246
|
+
this.items.length = 0;
|
|
19247
|
+
}
|
|
19248
|
+
}
|
|
19249
|
+
};
|
|
19250
|
+
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
19251
|
+
var _this, _loop = function(i) {
|
|
19252
|
+
var item = _this.items[i];
|
|
19253
|
+
if (item.getVisible() && !item.ended && !exports.VFXItem.isComposition(item) && !skip(item)) {
|
|
19254
|
+
var hitParams = item.getHitTestParams(force);
|
|
19255
|
+
if (hitParams) {
|
|
19256
|
+
var success = false;
|
|
19257
|
+
var intersectPoint = new Vector3();
|
|
19258
|
+
if (hitParams.type === exports.HitTestType.triangle) {
|
|
19259
|
+
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
19260
|
+
for(var j = 0; j < triangles.length; j++){
|
|
19261
|
+
var triangle = triangles[j];
|
|
19262
|
+
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
19263
|
+
success = true;
|
|
19264
|
+
hitPositions.push(intersectPoint);
|
|
19265
|
+
break;
|
|
19266
|
+
}
|
|
19267
|
+
}
|
|
19268
|
+
} else if (hitParams.type === exports.HitTestType.box) {
|
|
19269
|
+
var center = hitParams.center, size = hitParams.size;
|
|
19270
|
+
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
19271
|
+
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
19272
|
+
if (ray.intersectBox({
|
|
19273
|
+
min: boxMin,
|
|
19274
|
+
max: boxMax
|
|
19275
|
+
}, intersectPoint)) {
|
|
19276
|
+
success = true;
|
|
19277
|
+
hitPositions.push(intersectPoint);
|
|
19278
|
+
}
|
|
19279
|
+
} else if (hitParams.type === exports.HitTestType.sphere) {
|
|
19280
|
+
var center1 = hitParams.center, radius = hitParams.radius;
|
|
19281
|
+
if (ray.intersectSphere({
|
|
19282
|
+
center: center1,
|
|
19283
|
+
radius: radius
|
|
19284
|
+
}, intersectPoint)) {
|
|
19285
|
+
success = true;
|
|
19286
|
+
hitPositions.push(intersectPoint);
|
|
19287
|
+
}
|
|
19288
|
+
} else if (hitParams.type === exports.HitTestType.custom) {
|
|
19289
|
+
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
19290
|
+
if (tempPosition && tempPosition.length > 0) {
|
|
19291
|
+
tempPosition.forEach(function(pos) {
|
|
19292
|
+
hitPositions.push(pos);
|
|
19293
|
+
});
|
|
19294
|
+
success = true;
|
|
19295
|
+
}
|
|
19296
|
+
}
|
|
19297
|
+
if (success) {
|
|
19298
|
+
var region = {
|
|
19299
|
+
compContent: _this.item,
|
|
19300
|
+
id: item.id,
|
|
19301
|
+
name: item.name,
|
|
19302
|
+
position: hitPositions[hitPositions.length - 1],
|
|
19303
|
+
parentId: item.parentId,
|
|
19304
|
+
hitPositions: hitPositions,
|
|
19305
|
+
behavior: hitParams.behavior
|
|
19306
|
+
};
|
|
19307
|
+
regions.push(region);
|
|
19308
|
+
if (stop(region)) {
|
|
19309
|
+
return {
|
|
19310
|
+
v: regions
|
|
19311
|
+
};
|
|
19312
|
+
}
|
|
19313
|
+
}
|
|
19314
|
+
}
|
|
19315
|
+
}
|
|
19316
|
+
};
|
|
19317
|
+
var hitPositions = [];
|
|
19318
|
+
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
19319
|
+
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
19320
|
+
var maxCount = (options == null ? void 0 : options.maxCount) || this.items.length;
|
|
19321
|
+
for(var i = 0; i < this.items.length && regions.length < maxCount; i++){
|
|
19322
|
+
var _ret = (_this = this, _loop(i));
|
|
19323
|
+
if (_type_of(_ret) === "object") return _ret.v;
|
|
19324
|
+
}
|
|
19325
|
+
return regions;
|
|
19326
|
+
};
|
|
19327
|
+
_proto.fromData = function fromData(data) {};
|
|
19328
|
+
_proto.resolveBindings = function resolveBindings() {
|
|
19329
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
19330
|
+
var sceneBinding = _step.value;
|
|
19331
|
+
sceneBinding.key.binding = sceneBinding.value;
|
|
19332
|
+
}
|
|
19333
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step1; !(_step1 = _iterator1()).done;){
|
|
19334
|
+
var masterTrack = _step1.value;
|
|
19335
|
+
this.resolveTrackBindingsWithRoot(masterTrack);
|
|
19336
|
+
}
|
|
19337
|
+
};
|
|
19338
|
+
_proto.resolveTrackBindingsWithRoot = function resolveTrackBindingsWithRoot(track) {
|
|
19339
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
19340
|
+
var subTrack = _step.value;
|
|
19341
|
+
subTrack.binding = subTrack.resolveBinding(track.binding);
|
|
19342
|
+
this.resolveTrackBindingsWithRoot(subTrack);
|
|
19343
|
+
}
|
|
19344
|
+
};
|
|
19345
|
+
return CompositionComponent;
|
|
19346
|
+
}(ItemBehaviour);
|
|
19347
|
+
|
|
19348
|
+
exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
19349
|
+
_inherits(SubCompositionTrack, TrackAsset);
|
|
19350
|
+
function SubCompositionTrack() {
|
|
19351
|
+
return TrackAsset.apply(this, arguments);
|
|
19352
|
+
}
|
|
19353
|
+
var _proto = SubCompositionTrack.prototype;
|
|
19354
|
+
_proto.resolveBinding = function resolveBinding(parentBinding) {
|
|
19355
|
+
if (!_instanceof1(parentBinding, exports.VFXItem)) {
|
|
19356
|
+
throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
|
|
19357
|
+
}
|
|
19358
|
+
return parentBinding.getComponent(CompositionComponent);
|
|
19359
|
+
};
|
|
19360
|
+
return SubCompositionTrack;
|
|
19361
|
+
}(exports.TrackAsset);
|
|
19362
|
+
exports.SubCompositionTrack = __decorate([
|
|
19363
|
+
effectsClass("SubCompositionTrack")
|
|
19364
|
+
], exports.SubCompositionTrack);
|
|
19365
|
+
|
|
19366
|
+
var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
19367
|
+
_inherits(SubCompositionClipPlayable, Playable);
|
|
19368
|
+
function SubCompositionClipPlayable() {
|
|
19369
|
+
return Playable.apply(this, arguments);
|
|
19370
|
+
}
|
|
19371
|
+
var _proto = SubCompositionClipPlayable.prototype;
|
|
19372
|
+
_proto.processFrame = function processFrame(context) {
|
|
19373
|
+
var boundObject = context.output.getUserData();
|
|
19374
|
+
boundObject.time = this.getTime();
|
|
19375
|
+
};
|
|
19376
|
+
return SubCompositionClipPlayable;
|
|
19377
|
+
}(Playable);
|
|
19378
|
+
|
|
19379
|
+
exports.SubCompositionPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
19380
|
+
_inherits(SubCompositionPlayableAsset, PlayableAsset);
|
|
19381
|
+
function SubCompositionPlayableAsset() {
|
|
19382
|
+
return PlayableAsset.apply(this, arguments);
|
|
19383
|
+
}
|
|
19384
|
+
var _proto = SubCompositionPlayableAsset.prototype;
|
|
19385
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
19386
|
+
return new SubCompositionClipPlayable(graph);
|
|
19387
|
+
};
|
|
19388
|
+
return SubCompositionPlayableAsset;
|
|
19389
|
+
}(PlayableAsset);
|
|
19390
|
+
exports.SubCompositionPlayableAsset = __decorate([
|
|
19391
|
+
effectsClass("SubCompositionPlayableAsset")
|
|
19392
|
+
], exports.SubCompositionPlayableAsset);
|
|
19393
|
+
|
|
19394
|
+
function _possible_constructor_return(self, call) {
|
|
19395
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
|
|
19396
|
+
return _assert_this_initialized(self);
|
|
19397
|
+
}
|
|
19398
|
+
|
|
19399
|
+
var TextLayout = /*#__PURE__*/ function() {
|
|
19400
|
+
function TextLayout(options) {
|
|
19401
|
+
this.width = 0;
|
|
19402
|
+
this.height = 0;
|
|
19403
|
+
var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, text = options.text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
|
|
19404
|
+
var tempWidth = fontSize + letterSpace;
|
|
19405
|
+
this.autoWidth = autoWidth;
|
|
19406
|
+
this.maxTextWidth = text.length * tempWidth;
|
|
19407
|
+
// if (autoWidth) {
|
|
19408
|
+
// this.width = this.maxTextWidth + this.lineWidth;
|
|
19409
|
+
// this.height = fontSize + this.lineHeight;
|
|
19410
|
+
// } else {
|
|
19411
|
+
// if (textWidth) {
|
|
19412
|
+
// this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
|
|
19413
|
+
// this.width = textWidth;
|
|
19414
|
+
// } else {
|
|
19415
|
+
// this.width = basicScale[0] * 100;
|
|
19416
|
+
// }
|
|
19417
|
+
// this.height = basicScale[1] * 100;
|
|
19418
|
+
// }
|
|
19419
|
+
this.width = textWidth;
|
|
19420
|
+
this.height = textHeight;
|
|
19421
|
+
this.letterSpace = letterSpace;
|
|
19422
|
+
this.overFlow = textOverflow;
|
|
19423
|
+
this.textBaseline = textBaseline;
|
|
19424
|
+
this.textAlign = textAlign;
|
|
19425
|
+
this.lineHeight = lineHeight;
|
|
19426
|
+
}
|
|
19427
|
+
var _proto = TextLayout.prototype;
|
|
19428
|
+
_proto.getOffsetY = function getOffsetY(style) {
|
|
19429
|
+
var offsetY = 0;
|
|
19430
|
+
var offset = (style.fontSize + style.outlineWidth) * style.fontScale;
|
|
19431
|
+
switch(this.textBaseline){
|
|
19432
|
+
case TextBaseline.top:
|
|
19433
|
+
offsetY = offset;
|
|
19434
|
+
break;
|
|
19435
|
+
case TextBaseline.middle:
|
|
19436
|
+
offsetY = (this.height + offset) / 2; // fonSize;
|
|
19437
|
+
break;
|
|
19438
|
+
case TextBaseline.bottom:
|
|
19439
|
+
offsetY = this.height - offset / 2;
|
|
19440
|
+
break;
|
|
19441
|
+
}
|
|
19442
|
+
return offsetY;
|
|
19443
|
+
};
|
|
19444
|
+
_proto.getOffsetX = function getOffsetX(style, maxWidth) {
|
|
19445
|
+
var offsetX = 0;
|
|
19446
|
+
switch(this.textAlign){
|
|
19447
|
+
case TextAlignment.left:
|
|
19448
|
+
offsetX = style.outlineWidth * style.fontScale;
|
|
19449
|
+
break;
|
|
19450
|
+
case TextAlignment.middle:
|
|
19451
|
+
offsetX = (this.width * style.fontScale - maxWidth) / 2;
|
|
19452
|
+
break;
|
|
19453
|
+
case TextAlignment.right:
|
|
19454
|
+
offsetX = this.width * style.fontScale - maxWidth;
|
|
19455
|
+
break;
|
|
19456
|
+
}
|
|
19457
|
+
return offsetX;
|
|
19458
|
+
};
|
|
19459
|
+
/**
|
|
19460
|
+
* 设置文本框的宽度和高度
|
|
19461
|
+
* @param width 文本框宽度
|
|
19462
|
+
* @param height 文本框高度
|
|
19463
|
+
*/ _proto.setSize = function setSize(width, height) {
|
|
19464
|
+
this.width = width;
|
|
19465
|
+
this.height = height;
|
|
19466
|
+
};
|
|
19467
|
+
return TextLayout;
|
|
19468
|
+
}();
|
|
19469
|
+
|
|
19470
|
+
var TextStyle = function TextStyle(options) {
|
|
19471
|
+
/**
|
|
19472
|
+
* 是否有下划线(暂时无效)
|
|
19473
|
+
*/ this.isUnderline = false // ttf
|
|
19474
|
+
;
|
|
19475
|
+
/**
|
|
19476
|
+
* 下划线高度(暂时无效)
|
|
19201
19477
|
*/ this.underlineHeight = 1 // ttf
|
|
19202
19478
|
;
|
|
19203
19479
|
/**
|
|
@@ -20694,6 +20970,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20694
20970
|
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
20695
20971
|
return _instanceof1(value, Object) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
20696
20972
|
};
|
|
20973
|
+
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
20974
|
+
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
20975
|
+
};
|
|
20697
20976
|
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
|
|
20698
20977
|
if (level > 14) {
|
|
20699
20978
|
console.error("序列化数据的内嵌对象层数大于上限");
|
|
@@ -20711,7 +20990,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20711
20990
|
// TODO json 数据避免传 typedArray
|
|
20712
20991
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
20713
20992
|
return engine.assetLoader.loadGUID(property.id);
|
|
20714
|
-
} else if (_instanceof1(property, EffectsObject) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
20993
|
+
} else if (_instanceof1(property, EffectsObject) || SerializationHelper.checkImageSource(property) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
20715
20994
|
return property;
|
|
20716
20995
|
} else if (_instanceof1(property, Object)) {
|
|
20717
20996
|
var res1;
|
|
@@ -20799,7 +21078,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20799
21078
|
res1
|
|
20800
21079
|
];
|
|
20801
21080
|
case 8:
|
|
20802
|
-
if (_instanceof1(property, EffectsObject) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
21081
|
+
if (_instanceof1(property, EffectsObject) || SerializationHelper.checkImageSource(property) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
20803
21082
|
return [
|
|
20804
21083
|
2,
|
|
20805
21084
|
property
|
|
@@ -20922,9 +21201,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20922
21201
|
effectsObject = Geometry.create(this.engine);
|
|
20923
21202
|
break;
|
|
20924
21203
|
case DataType.Texture:
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
return effectsObject;
|
|
21204
|
+
effectsObject = Texture.create(this.engine);
|
|
21205
|
+
break;
|
|
20928
21206
|
default:
|
|
20929
21207
|
{
|
|
20930
21208
|
var classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
@@ -20995,12 +21273,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20995
21273
|
effectsObject = Geometry.create(_this.engine);
|
|
20996
21274
|
break;
|
|
20997
21275
|
case DataType.Texture:
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
return [
|
|
21001
|
-
2,
|
|
21002
|
-
effectsObject
|
|
21003
|
-
];
|
|
21276
|
+
effectsObject = Texture.create(_this.engine);
|
|
21277
|
+
break;
|
|
21004
21278
|
default:
|
|
21005
21279
|
{
|
|
21006
21280
|
classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
@@ -21920,8 +22194,15 @@ function getStandardCameraContent(model) {
|
|
|
21920
22194
|
id: item.id
|
|
21921
22195
|
};
|
|
21922
22196
|
});
|
|
22197
|
+
var compositionData = _extends({}, composition, {
|
|
22198
|
+
timelineAsset: {
|
|
22199
|
+
id: ""
|
|
22200
|
+
},
|
|
22201
|
+
sceneBindings: []
|
|
22202
|
+
});
|
|
22203
|
+
result.compositions.push(compositionData);
|
|
21923
22204
|
// 生成时间轴数据
|
|
21924
|
-
convertTimelineAsset(
|
|
22205
|
+
convertTimelineAsset(compositionData, guidToItemMap, result);
|
|
21925
22206
|
};
|
|
21926
22207
|
var // 更正 spine 数据中的 images 属性
|
|
21927
22208
|
_json_spines;
|
|
@@ -21929,6 +22210,7 @@ function getStandardCameraContent(model) {
|
|
|
21929
22210
|
_result;
|
|
21930
22211
|
var result = _extends({}, json, {
|
|
21931
22212
|
items: [],
|
|
22213
|
+
compositions: [],
|
|
21932
22214
|
components: [],
|
|
21933
22215
|
materials: [],
|
|
21934
22216
|
shaders: [],
|
|
@@ -22085,7 +22367,7 @@ function getStandardCameraContent(model) {
|
|
|
22085
22367
|
content1.renderer.anchor = convertAnchor(renderer1.anchor, renderer1.particleOrigin);
|
|
22086
22368
|
}
|
|
22087
22369
|
// 修复相机K帧缺失 asMovement 参数
|
|
22088
|
-
if (item.type === ItemType.camera) {
|
|
22370
|
+
if (item.type === ItemType.camera && item.content.positionOverLifetime && Object.keys(item.content.positionOverLifetime).length !== 0) {
|
|
22089
22371
|
item.content.positionOverLifetime.asMovement = true;
|
|
22090
22372
|
}
|
|
22091
22373
|
// 动画数据转化 TODO: 动画数据移到 TimelineComponentData
|
|
@@ -22138,10 +22420,7 @@ function getStandardCameraContent(model) {
|
|
|
22138
22420
|
item.type = "orientation-transformer";
|
|
22139
22421
|
}
|
|
22140
22422
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22141
|
-
if (item.type === ItemType.sprite || item.type === ItemType.particle || item.type === ItemType.mesh || item.type === ItemType.skybox || item.type === ItemType.light ||
|
|
22142
|
-
item.type === "camera" || item.type === ItemType.tree || item.type === ItemType.interact || item.type === ItemType.camera || item.type === ItemType.text || item.type === ItemType.spine || // @ts-expect-error
|
|
22143
|
-
item.type === "editor-gizmo" || // @ts-expect-error
|
|
22144
|
-
item.type === "orientation-transformer") {
|
|
22423
|
+
if (item.type === ItemType.sprite || item.type === ItemType.particle || item.type === ItemType.mesh || item.type === ItemType.skybox || item.type === ItemType.light || item.type === "camera" || item.type === ItemType.tree || item.type === ItemType.interact || item.type === ItemType.camera || item.type === ItemType.text || item.type === ItemType.spine || item.type === "editor-gizmo" || item.type === "orientation-transformer") {
|
|
22145
22424
|
item.components = [];
|
|
22146
22425
|
result.components.push(item.content);
|
|
22147
22426
|
item.content.id = generateGUID();
|
|
@@ -22173,15 +22452,12 @@ function getStandardCameraContent(model) {
|
|
|
22173
22452
|
case ItemType.light:
|
|
22174
22453
|
item.content.dataType = DataType.LightComponent;
|
|
22175
22454
|
break;
|
|
22176
|
-
// @ts-expect-error
|
|
22177
22455
|
case "camera":
|
|
22178
22456
|
item.content.dataType = DataType.CameraComponent;
|
|
22179
22457
|
break;
|
|
22180
|
-
// @ts-expect-error
|
|
22181
22458
|
case "editor-gizmo":
|
|
22182
22459
|
item.content.dataType = "GizmoComponent";
|
|
22183
22460
|
break;
|
|
22184
|
-
// @ts-expect-error
|
|
22185
22461
|
case "orientation-transformer":
|
|
22186
22462
|
item.content.dataType = "OrientationComponent";
|
|
22187
22463
|
break;
|
|
@@ -22250,8 +22526,32 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22250
22526
|
var itemDataPath = _step.value;
|
|
22251
22527
|
var item = guidToItemMap[itemDataPath.id];
|
|
22252
22528
|
var subTrackDatas = [];
|
|
22529
|
+
var newActivationPlayableAsset = {
|
|
22530
|
+
id: generateGUID(),
|
|
22531
|
+
dataType: "ActivationPlayableAsset"
|
|
22532
|
+
};
|
|
22533
|
+
playableAssetDatas.push(newActivationPlayableAsset);
|
|
22534
|
+
var newActivationTrackData = {
|
|
22535
|
+
id: generateGUID(),
|
|
22536
|
+
dataType: "ActivationTrack",
|
|
22537
|
+
children: [],
|
|
22538
|
+
clips: [
|
|
22539
|
+
{
|
|
22540
|
+
start: item.delay,
|
|
22541
|
+
duration: item.duration,
|
|
22542
|
+
endBehaviour: item.endBehavior,
|
|
22543
|
+
asset: {
|
|
22544
|
+
id: newActivationPlayableAsset.id
|
|
22545
|
+
}
|
|
22546
|
+
}
|
|
22547
|
+
]
|
|
22548
|
+
};
|
|
22549
|
+
subTrackDatas.push({
|
|
22550
|
+
id: newActivationTrackData.id
|
|
22551
|
+
});
|
|
22552
|
+
trackDatas.push(newActivationTrackData);
|
|
22253
22553
|
if (item.type !== ItemType.particle) {
|
|
22254
|
-
var
|
|
22554
|
+
var newTransformPlayableAssetData = {
|
|
22255
22555
|
id: generateGUID(),
|
|
22256
22556
|
dataType: "TransformPlayableAsset",
|
|
22257
22557
|
//@ts-expect-error
|
|
@@ -22261,15 +22561,18 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22261
22561
|
//@ts-expect-error
|
|
22262
22562
|
positionOverLifetime: item.content.positionOverLifetime
|
|
22263
22563
|
};
|
|
22264
|
-
playableAssetDatas.push(
|
|
22564
|
+
playableAssetDatas.push(newTransformPlayableAssetData);
|
|
22265
22565
|
var newTrackData = {
|
|
22266
22566
|
id: generateGUID(),
|
|
22267
22567
|
dataType: "TransformTrack",
|
|
22268
22568
|
children: [],
|
|
22269
22569
|
clips: [
|
|
22270
22570
|
{
|
|
22571
|
+
start: item.delay,
|
|
22572
|
+
duration: item.duration,
|
|
22573
|
+
endBehaviour: item.endBehavior,
|
|
22271
22574
|
asset: {
|
|
22272
|
-
id:
|
|
22575
|
+
id: newTransformPlayableAssetData.id
|
|
22273
22576
|
}
|
|
22274
22577
|
}
|
|
22275
22578
|
]
|
|
@@ -22280,21 +22583,24 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22280
22583
|
trackDatas.push(newTrackData);
|
|
22281
22584
|
}
|
|
22282
22585
|
if (item.type === ItemType.sprite) {
|
|
22283
|
-
var
|
|
22586
|
+
var newSpriteColorPlayableAssetData = {
|
|
22284
22587
|
id: generateGUID(),
|
|
22285
22588
|
dataType: "SpriteColorPlayableAsset",
|
|
22286
22589
|
colorOverLifetime: item.content.colorOverLifetime,
|
|
22287
22590
|
startColor: item.content.options.startColor
|
|
22288
22591
|
};
|
|
22289
|
-
playableAssetDatas.push(
|
|
22592
|
+
playableAssetDatas.push(newSpriteColorPlayableAssetData);
|
|
22290
22593
|
var newTrackData1 = {
|
|
22291
22594
|
id: generateGUID(),
|
|
22292
22595
|
dataType: "SpriteColorTrack",
|
|
22293
22596
|
children: [],
|
|
22294
22597
|
clips: [
|
|
22295
22598
|
{
|
|
22599
|
+
start: item.delay,
|
|
22600
|
+
duration: item.duration,
|
|
22601
|
+
endBehaviour: item.endBehavior,
|
|
22296
22602
|
asset: {
|
|
22297
|
-
id:
|
|
22603
|
+
id: newSpriteColorPlayableAssetData.id
|
|
22298
22604
|
}
|
|
22299
22605
|
}
|
|
22300
22606
|
]
|
|
@@ -22304,6 +22610,32 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22304
22610
|
});
|
|
22305
22611
|
trackDatas.push(newTrackData1);
|
|
22306
22612
|
}
|
|
22613
|
+
if (item.type === ItemType.composition) {
|
|
22614
|
+
var newSubCompositionPlayableAssetData = {
|
|
22615
|
+
id: generateGUID(),
|
|
22616
|
+
dataType: "SubCompositionPlayableAsset"
|
|
22617
|
+
};
|
|
22618
|
+
playableAssetDatas.push(newSubCompositionPlayableAssetData);
|
|
22619
|
+
var newTrackData2 = {
|
|
22620
|
+
id: generateGUID(),
|
|
22621
|
+
dataType: "SubCompositionTrack",
|
|
22622
|
+
children: [],
|
|
22623
|
+
clips: [
|
|
22624
|
+
{
|
|
22625
|
+
start: item.delay,
|
|
22626
|
+
duration: item.duration,
|
|
22627
|
+
endBehaviour: item.endBehavior,
|
|
22628
|
+
asset: {
|
|
22629
|
+
id: newSubCompositionPlayableAssetData.id
|
|
22630
|
+
}
|
|
22631
|
+
}
|
|
22632
|
+
]
|
|
22633
|
+
};
|
|
22634
|
+
subTrackDatas.push({
|
|
22635
|
+
id: newTrackData2.id
|
|
22636
|
+
});
|
|
22637
|
+
trackDatas.push(newTrackData2);
|
|
22638
|
+
}
|
|
22307
22639
|
var bindingTrackData = {
|
|
22308
22640
|
id: generateGUID(),
|
|
22309
22641
|
dataType: "ObjectBindingTrack",
|
|
@@ -22330,11 +22662,9 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22330
22662
|
id: trackData.id
|
|
22331
22663
|
});
|
|
22332
22664
|
}
|
|
22333
|
-
//@ts-expect-error
|
|
22334
22665
|
composition.timelineAsset = {
|
|
22335
22666
|
id: timelineAssetData.id
|
|
22336
22667
|
};
|
|
22337
|
-
//@ts-expect-error
|
|
22338
22668
|
composition.sceneBindings = sceneBindings;
|
|
22339
22669
|
if (!jsonScene.animations) {
|
|
22340
22670
|
jsonScene.animations = [];
|
|
@@ -23579,42 +23909,6 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
23579
23909
|
}
|
|
23580
23910
|
throw new Error("Invalid texture options");
|
|
23581
23911
|
}
|
|
23582
|
-
function base64ToFile(base64, filename, contentType) {
|
|
23583
|
-
if (filename === void 0) filename = "base64File";
|
|
23584
|
-
if (contentType === void 0) contentType = "";
|
|
23585
|
-
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
23586
|
-
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
23587
|
-
// 将 base64 编码的字符串转换为二进制字符串
|
|
23588
|
-
var byteCharacters = atob(base64WithoutPrefix);
|
|
23589
|
-
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
23590
|
-
var byteArrays = [];
|
|
23591
|
-
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
23592
|
-
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
23593
|
-
var slice = byteCharacters.slice(offset, offset + 512);
|
|
23594
|
-
var byteNumbers = new Array(slice.length);
|
|
23595
|
-
for(var i = 0; i < slice.length; i++){
|
|
23596
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
23597
|
-
}
|
|
23598
|
-
var byteArray = new Uint8Array(byteNumbers);
|
|
23599
|
-
byteArrays.push(byteArray);
|
|
23600
|
-
}
|
|
23601
|
-
// 使用字节数组创建 Blob 对象
|
|
23602
|
-
var blob = new Blob(byteArrays, {
|
|
23603
|
-
type: contentType
|
|
23604
|
-
});
|
|
23605
|
-
// 创建 File 对象
|
|
23606
|
-
var file = new File([
|
|
23607
|
-
blob
|
|
23608
|
-
], filename, {
|
|
23609
|
-
type: contentType
|
|
23610
|
-
});
|
|
23611
|
-
return file;
|
|
23612
|
-
}
|
|
23613
|
-
function isCanvas(canvas) {
|
|
23614
|
-
var _canvas_tagName;
|
|
23615
|
-
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
23616
|
-
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
23617
|
-
}
|
|
23618
23912
|
|
|
23619
23913
|
var tmpScale = new Vector3(1, 1, 1);
|
|
23620
23914
|
/**
|
|
@@ -23892,257 +24186,213 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23892
24186
|
return Camera;
|
|
23893
24187
|
}();
|
|
23894
24188
|
|
|
24189
|
+
var listOrder = 0;
|
|
23895
24190
|
/**
|
|
23896
|
-
*
|
|
23897
|
-
|
|
23898
|
-
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
|
|
23902
|
-
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
23911
|
-
|
|
24191
|
+
* 合成资源管理
|
|
24192
|
+
*/ var CompositionSourceManager = /*#__PURE__*/ function() {
|
|
24193
|
+
function CompositionSourceManager(scene, engine) {
|
|
24194
|
+
this.refCompositions = new Map();
|
|
24195
|
+
this.refCompositionProps = new Map();
|
|
24196
|
+
this.mask = 0;
|
|
24197
|
+
this.engine = engine;
|
|
24198
|
+
// 资源
|
|
24199
|
+
var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
|
|
24200
|
+
var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
|
|
24201
|
+
if (!textureOptions) {
|
|
24202
|
+
throw new Error("scene.textures expected");
|
|
24203
|
+
}
|
|
24204
|
+
var cachedTextures = textureOptions;
|
|
24205
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
|
|
24206
|
+
var comp = _step.value;
|
|
24207
|
+
if (comp.id === compositionId) {
|
|
24208
|
+
this.composition = comp;
|
|
24209
|
+
} else {
|
|
24210
|
+
this.refCompositions.set(comp.id, comp);
|
|
24211
|
+
}
|
|
24212
|
+
}
|
|
24213
|
+
if (!this.composition) {
|
|
24214
|
+
throw new Error("Invalid composition id: " + compositionId);
|
|
24215
|
+
}
|
|
24216
|
+
this.jsonScene = jsonScene;
|
|
24217
|
+
this.renderLevel = renderLevel;
|
|
24218
|
+
this.pluginSystem = pluginSystem;
|
|
24219
|
+
this.totalTime = totalTime != null ? totalTime : 0;
|
|
24220
|
+
this.imgUsage = imgUsage != null ? imgUsage : {};
|
|
24221
|
+
this.textures = cachedTextures;
|
|
24222
|
+
listOrder = 0;
|
|
24223
|
+
this.sourceContent = this.getContent(this.composition);
|
|
23912
24224
|
}
|
|
23913
|
-
var _proto =
|
|
23914
|
-
_proto.
|
|
23915
|
-
|
|
23916
|
-
|
|
23917
|
-
|
|
23918
|
-
|
|
23919
|
-
|
|
23920
|
-
|
|
24225
|
+
var _proto = CompositionSourceManager.prototype;
|
|
24226
|
+
_proto.getContent = function getContent(composition) {
|
|
24227
|
+
// TODO: specification 中补充 globalVolume 类型
|
|
24228
|
+
// @ts-expect-error
|
|
24229
|
+
var id = composition.id, duration = composition.duration, name = composition.name, endBehavior = composition.endBehavior, camera = composition.camera, globalVolume = composition.globalVolume, _composition_startTime = composition.startTime, startTime = _composition_startTime === void 0 ? 0 : _composition_startTime;
|
|
24230
|
+
var items = this.assembleItems(composition);
|
|
24231
|
+
return _extends({}, composition, {
|
|
24232
|
+
id: id,
|
|
24233
|
+
duration: duration,
|
|
24234
|
+
name: name,
|
|
24235
|
+
endBehavior: isNaN(endBehavior) ? END_BEHAVIOR_PAUSE : endBehavior,
|
|
24236
|
+
// looping,
|
|
24237
|
+
items: items,
|
|
24238
|
+
camera: camera,
|
|
24239
|
+
startTime: startTime,
|
|
24240
|
+
globalVolume: globalVolume
|
|
24241
|
+
});
|
|
24242
|
+
};
|
|
24243
|
+
_proto.assembleItems = function assembleItems(composition) {
|
|
24244
|
+
var _this = this;
|
|
24245
|
+
var items = [];
|
|
24246
|
+
this.mask++;
|
|
24247
|
+
var componentMap = {};
|
|
24248
|
+
//@ts-expect-error
|
|
24249
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.jsonScene.components), _step; !(_step = _iterator()).done;){
|
|
24250
|
+
var component = _step.value;
|
|
24251
|
+
componentMap[component.id] = component;
|
|
23921
24252
|
}
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
23926
|
-
var
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
|
|
24253
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(composition.items), _step1; !(_step1 = _iterator1()).done;){
|
|
24254
|
+
var itemDataPath = _step1.value;
|
|
24255
|
+
//@ts-expect-error
|
|
24256
|
+
var sourceItemData = this.engine.jsonSceneData[itemDataPath.id];
|
|
24257
|
+
var itemProps = sourceItemData;
|
|
24258
|
+
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
24259
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
24260
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
24261
|
+
var componentPath = _step2.value;
|
|
24262
|
+
var componentData = componentMap[componentPath.id];
|
|
24263
|
+
this.preProcessItemContent(componentData);
|
|
24264
|
+
}
|
|
24265
|
+
} else {
|
|
24266
|
+
var renderContent = itemProps.content;
|
|
24267
|
+
if (renderContent) {
|
|
24268
|
+
this.preProcessItemContent(renderContent);
|
|
24269
|
+
}
|
|
23931
24270
|
}
|
|
23932
|
-
|
|
23933
|
-
|
|
23934
|
-
|
|
24271
|
+
itemProps.listIndex = listOrder++;
|
|
24272
|
+
// 处理预合成的渲染顺序
|
|
24273
|
+
if (itemProps.type === ItemType.composition) {
|
|
24274
|
+
var refId = sourceItemData.content.options.refId;
|
|
24275
|
+
if (!this.refCompositions.get(refId)) {
|
|
24276
|
+
throw new Error("Invalid Ref Composition id: " + refId);
|
|
24277
|
+
}
|
|
24278
|
+
var ref = this.getContent(this.refCompositions.get(refId));
|
|
24279
|
+
if (!this.refCompositionProps.has(refId)) {
|
|
24280
|
+
this.refCompositionProps.set(refId, ref);
|
|
24281
|
+
}
|
|
24282
|
+
ref.items.forEach(function(item) {
|
|
24283
|
+
_this.processMask(item.content);
|
|
24284
|
+
});
|
|
24285
|
+
itemProps.items = ref.items;
|
|
23935
24286
|
}
|
|
24287
|
+
items.push(itemProps);
|
|
23936
24288
|
}
|
|
23937
|
-
this.masterTracks.push(track);
|
|
23938
|
-
}
|
|
23939
|
-
};
|
|
23940
|
-
_proto.initializeTrackBindings = function initializeTrackBindings(masterTracks) {
|
|
23941
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(masterTracks), _step; !(_step = _iterator()).done;){
|
|
23942
|
-
var track = _step.value;
|
|
23943
|
-
track.initializeBindingRecursive(track.binding);
|
|
23944
24289
|
}
|
|
24290
|
+
return items;
|
|
23945
24291
|
};
|
|
23946
|
-
_proto.
|
|
23947
|
-
|
|
23948
|
-
|
|
23949
|
-
|
|
23950
|
-
|
|
23951
|
-
|
|
23952
|
-
|
|
23953
|
-
|
|
23954
|
-
|
|
23955
|
-
|
|
23956
|
-
|
|
23957
|
-
if (
|
|
23958
|
-
|
|
23959
|
-
subCompostionComponent.time = subCompositionTrack.toLocalTime(time);
|
|
24292
|
+
_proto.preProcessItemContent = function preProcessItemContent(renderContent) {
|
|
24293
|
+
if (renderContent.renderer) {
|
|
24294
|
+
renderContent.renderer = this.changeTex(renderContent.renderer);
|
|
24295
|
+
if (!renderContent.renderer.mask) {
|
|
24296
|
+
this.processMask(renderContent.renderer);
|
|
24297
|
+
}
|
|
24298
|
+
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
24299
|
+
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
24300
|
+
var _this_jsonScene;
|
|
24301
|
+
// TODO: scene.shapes 类型问题?
|
|
24302
|
+
renderContent.renderer.shape = getGeometryByShape((_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[renderContent.renderer.shape], split);
|
|
24303
|
+
} else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
|
|
24304
|
+
renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
|
|
23960
24305
|
}
|
|
23961
24306
|
}
|
|
24307
|
+
if (renderContent.trails) {
|
|
24308
|
+
renderContent.trails = this.changeTex(renderContent.trails);
|
|
24309
|
+
}
|
|
23962
24310
|
};
|
|
23963
|
-
|
|
23964
|
-
|
|
23965
|
-
|
|
23966
|
-
this.item.ended = false;
|
|
23967
|
-
};
|
|
23968
|
-
_proto.createContent = function createContent() {
|
|
23969
|
-
var sceneBindings = [];
|
|
23970
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.data.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
23971
|
-
var sceneBindingData = _step.value;
|
|
23972
|
-
sceneBindings.push({
|
|
23973
|
-
key: this.engine.assetLoader.loadGUID(sceneBindingData.key.id),
|
|
23974
|
-
value: this.engine.assetLoader.loadGUID(sceneBindingData.value.id)
|
|
23975
|
-
});
|
|
24311
|
+
_proto.changeTex = function changeTex(renderer) {
|
|
24312
|
+
if (!renderer.texture) {
|
|
24313
|
+
return renderer;
|
|
23976
24314
|
}
|
|
23977
|
-
|
|
23978
|
-
var
|
|
23979
|
-
|
|
23980
|
-
|
|
23981
|
-
|
|
23982
|
-
if (this.item.composition) {
|
|
23983
|
-
var assetLoader = this.item.engine.assetLoader;
|
|
23984
|
-
var itemProps = this.item.props.items ? this.item.props.items : [];
|
|
23985
|
-
for(var i = 0; i < itemProps.length; i++){
|
|
23986
|
-
var item = void 0;
|
|
23987
|
-
var itemData = itemProps[i];
|
|
23988
|
-
// 设置预合成作为元素时的时长、结束行为和渲染延时
|
|
23989
|
-
if (exports.Item.isComposition(itemData)) {
|
|
23990
|
-
var refId = itemData.content.options.refId;
|
|
23991
|
-
var props = this.item.composition.refCompositionProps.get(refId);
|
|
23992
|
-
if (!props) {
|
|
23993
|
-
throw new Error("引用的Id: " + refId + " 的预合成不存在");
|
|
23994
|
-
}
|
|
23995
|
-
// endBehaviour 类型需优化
|
|
23996
|
-
props.content = itemData.content;
|
|
23997
|
-
item = assetLoader.loadGUID(itemData.id);
|
|
23998
|
-
item.composition = this.item.composition;
|
|
23999
|
-
var compositionComponent = item.addComponent(CompositionComponent);
|
|
24000
|
-
compositionComponent.data = props;
|
|
24001
|
-
compositionComponent.refId = refId;
|
|
24002
|
-
item.transform.parentTransform = this.transform;
|
|
24003
|
-
this.item.composition.refContent.push(item);
|
|
24004
|
-
if (item.endBehavior === ItemEndBehavior.loop) {
|
|
24005
|
-
this.item.composition.autoRefTex = false;
|
|
24006
|
-
}
|
|
24007
|
-
compositionComponent.createContent();
|
|
24008
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositionComponent.items), _step1; !(_step1 = _iterator1()).done;){
|
|
24009
|
-
var vfxItem = _step1.value;
|
|
24010
|
-
vfxItem.setInstanceId(generateGUID());
|
|
24011
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
24012
|
-
var component = _step2.value;
|
|
24013
|
-
component.setInstanceId(generateGUID());
|
|
24014
|
-
}
|
|
24015
|
-
}
|
|
24016
|
-
} else {
|
|
24017
|
-
item = assetLoader.loadGUID(itemData.id);
|
|
24018
|
-
item.composition = this.item.composition;
|
|
24019
|
-
}
|
|
24020
|
-
item.parent = this.item;
|
|
24021
|
-
// 相机不跟随合成移动
|
|
24022
|
-
item.transform.parentTransform = itemData.type === ItemType.camera ? new Transform() : this.transform;
|
|
24023
|
-
if (exports.VFXItem.isExtraCamera(item)) {
|
|
24024
|
-
this.item.composition.extraCamera = item;
|
|
24025
|
-
}
|
|
24026
|
-
items.push(item);
|
|
24027
|
-
}
|
|
24315
|
+
//@ts-expect-error
|
|
24316
|
+
var texIdx = renderer.texture.id;
|
|
24317
|
+
if (texIdx !== undefined) {
|
|
24318
|
+
//@ts-expect-error
|
|
24319
|
+
this.addTextureUsage(texIdx) || texIdx;
|
|
24028
24320
|
}
|
|
24321
|
+
return renderer;
|
|
24029
24322
|
};
|
|
24030
|
-
_proto.
|
|
24031
|
-
|
|
24032
|
-
|
|
24033
|
-
|
|
24034
|
-
|
|
24035
|
-
|
|
24036
|
-
|
|
24323
|
+
_proto.addTextureUsage = function addTextureUsage(texIdx) {
|
|
24324
|
+
var texId = texIdx;
|
|
24325
|
+
var _this_imgUsage;
|
|
24326
|
+
// FIXME: imageUsage 取自 scene.imgUsage,类型为 Record<string, number[]>,这里给的 number,类型对不上
|
|
24327
|
+
var imageUsage = (_this_imgUsage = this.imgUsage) != null ? _this_imgUsage : {};
|
|
24328
|
+
if (texId && imageUsage) {
|
|
24329
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
24330
|
+
if (!imageUsage.hasOwnProperty(texId)) {
|
|
24331
|
+
imageUsage[texId] = 0;
|
|
24037
24332
|
}
|
|
24333
|
+
imageUsage[texId]++;
|
|
24038
24334
|
}
|
|
24039
24335
|
};
|
|
24040
|
-
|
|
24041
|
-
|
|
24042
|
-
|
|
24043
|
-
|
|
24044
|
-
|
|
24045
|
-
|
|
24046
|
-
|
|
24047
|
-
|
|
24048
|
-
|
|
24049
|
-
|
|
24050
|
-
|
|
24051
|
-
|
|
24052
|
-
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
24053
|
-
success = true;
|
|
24054
|
-
hitPositions.push(intersectPoint);
|
|
24055
|
-
break;
|
|
24056
|
-
}
|
|
24057
|
-
}
|
|
24058
|
-
} else if (hitParams.type === exports.HitTestType.box) {
|
|
24059
|
-
var center = hitParams.center, size = hitParams.size;
|
|
24060
|
-
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
24061
|
-
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
24062
|
-
if (ray.intersectBox({
|
|
24063
|
-
min: boxMin,
|
|
24064
|
-
max: boxMax
|
|
24065
|
-
}, intersectPoint)) {
|
|
24066
|
-
success = true;
|
|
24067
|
-
hitPositions.push(intersectPoint);
|
|
24068
|
-
}
|
|
24069
|
-
} else if (hitParams.type === exports.HitTestType.sphere) {
|
|
24070
|
-
var center1 = hitParams.center, radius = hitParams.radius;
|
|
24071
|
-
if (ray.intersectSphere({
|
|
24072
|
-
center: center1,
|
|
24073
|
-
radius: radius
|
|
24074
|
-
}, intersectPoint)) {
|
|
24075
|
-
success = true;
|
|
24076
|
-
hitPositions.push(intersectPoint);
|
|
24077
|
-
}
|
|
24078
|
-
} else if (hitParams.type === exports.HitTestType.custom) {
|
|
24079
|
-
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
24080
|
-
if (tempPosition && tempPosition.length > 0) {
|
|
24081
|
-
tempPosition.forEach(function(pos) {
|
|
24082
|
-
hitPositions.push(pos);
|
|
24083
|
-
});
|
|
24084
|
-
success = true;
|
|
24085
|
-
}
|
|
24086
|
-
}
|
|
24087
|
-
if (success) {
|
|
24088
|
-
var region = {
|
|
24089
|
-
compContent: _this.item,
|
|
24090
|
-
id: item.id,
|
|
24091
|
-
name: item.name,
|
|
24092
|
-
position: hitPositions[hitPositions.length - 1],
|
|
24093
|
-
parentId: item.parentId,
|
|
24094
|
-
hitPositions: hitPositions,
|
|
24095
|
-
behavior: hitParams.behavior
|
|
24096
|
-
};
|
|
24097
|
-
regions.push(region);
|
|
24098
|
-
if (stop(region)) {
|
|
24099
|
-
return {
|
|
24100
|
-
v: regions
|
|
24101
|
-
};
|
|
24102
|
-
}
|
|
24103
|
-
}
|
|
24104
|
-
}
|
|
24336
|
+
/**
|
|
24337
|
+
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
24338
|
+
*/ _proto.processMask = function processMask(renderer) {
|
|
24339
|
+
var maskMode = renderer.maskMode;
|
|
24340
|
+
if (maskMode === MaskMode.NONE) {
|
|
24341
|
+
return;
|
|
24342
|
+
}
|
|
24343
|
+
if (!renderer.mask) {
|
|
24344
|
+
if (maskMode === MaskMode.MASK) {
|
|
24345
|
+
renderer.mask = ++this.mask;
|
|
24346
|
+
} else if (maskMode === MaskMode.OBSCURED || maskMode === MaskMode.REVERSE_OBSCURED) {
|
|
24347
|
+
renderer.mask = this.mask;
|
|
24105
24348
|
}
|
|
24106
|
-
};
|
|
24107
|
-
var hitPositions = [];
|
|
24108
|
-
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
24109
|
-
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
24110
|
-
var maxCount = (options == null ? void 0 : options.maxCount) || this.items.length;
|
|
24111
|
-
for(var i = 0; i < this.items.length && regions.length < maxCount; i++){
|
|
24112
|
-
var _ret = (_this = this, _loop(i));
|
|
24113
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
24114
24349
|
}
|
|
24115
|
-
return regions;
|
|
24116
24350
|
};
|
|
24117
|
-
_proto.
|
|
24118
|
-
|
|
24351
|
+
_proto.dispose = function dispose() {
|
|
24352
|
+
this.textures = [];
|
|
24353
|
+
this.composition = undefined;
|
|
24354
|
+
this.jsonScene = undefined;
|
|
24355
|
+
this.totalTime = 0;
|
|
24356
|
+
this.pluginSystem = undefined;
|
|
24357
|
+
this.sourceContent = undefined;
|
|
24358
|
+
this.refCompositions.clear();
|
|
24359
|
+
this.refCompositionProps.clear();
|
|
24119
24360
|
};
|
|
24120
|
-
return
|
|
24121
|
-
}(
|
|
24361
|
+
return CompositionSourceManager;
|
|
24362
|
+
}();
|
|
24122
24363
|
|
|
24123
24364
|
/**
|
|
24124
24365
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24125
24366
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
24126
24367
|
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
24127
24368
|
*/ var Composition = /*#__PURE__*/ function() {
|
|
24128
|
-
function Composition(props, scene
|
|
24369
|
+
function Composition(props, scene) {
|
|
24129
24370
|
var _this = this;
|
|
24130
|
-
|
|
24131
|
-
this./**
|
|
24371
|
+
/**
|
|
24132
24372
|
* 动画播放速度
|
|
24133
|
-
*/ speed = 1;
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24373
|
+
*/ this.speed = 1;
|
|
24374
|
+
/**
|
|
24375
|
+
* 用于保存与当前合成相关的插件数据
|
|
24376
|
+
*/ this.loaderData = {};
|
|
24377
|
+
/**
|
|
24378
|
+
* 预合成数组
|
|
24379
|
+
*/ this.refContent = [];
|
|
24380
|
+
/**
|
|
24137
24381
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
24138
|
-
*/ refCompositionProps = new Map();
|
|
24382
|
+
*/ this.refCompositionProps = new Map();
|
|
24139
24383
|
this.editorScaleRatio = 1.0;
|
|
24384
|
+
// TODO: 待优化
|
|
24140
24385
|
this.assigned = false;
|
|
24141
|
-
|
|
24142
|
-
|
|
24386
|
+
/**
|
|
24387
|
+
* 销毁状态位
|
|
24388
|
+
*/ this.destroyed = false;
|
|
24389
|
+
/**
|
|
24390
|
+
* 合成暂停/播放 标识
|
|
24391
|
+
*/ this.paused = false;
|
|
24143
24392
|
this.lastVideoUpdateTime = 0;
|
|
24144
24393
|
this.postLoaders = [];
|
|
24145
24394
|
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, onPlayerPause = props.onPlayerPause, onMessageItem = props.onMessageItem, onEnd = props.onEnd, event = props.event, width = props.width, height = props.height;
|
|
24395
|
+
this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
24146
24396
|
scene.jsonScene.imgUsage = undefined;
|
|
24147
24397
|
if (reusable) {
|
|
24148
24398
|
this.keepResource = true;
|
|
@@ -24153,19 +24403,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24153
24403
|
assertExist(sourceContent);
|
|
24154
24404
|
this.renderer = renderer;
|
|
24155
24405
|
this.refCompositionProps = refCompositionProps;
|
|
24156
|
-
|
|
24157
|
-
|
|
24158
|
-
|
|
24159
|
-
|
|
24160
|
-
vfxItem.composition = this;
|
|
24161
|
-
this.rootComposition = vfxItem.addComponent(CompositionComponent);
|
|
24406
|
+
this.rootItem = new exports.VFXItem(this.getEngine(), sourceContent);
|
|
24407
|
+
this.rootItem.name = "rootItem";
|
|
24408
|
+
this.rootItem.composition = this;
|
|
24409
|
+
this.rootComposition = this.rootItem.addComponent(CompositionComponent);
|
|
24162
24410
|
this.rootComposition.data = sourceContent;
|
|
24163
24411
|
var imageUsage = !reusable && imgUsage;
|
|
24164
|
-
this.transform = new Transform({
|
|
24165
|
-
name: this.name
|
|
24166
|
-
});
|
|
24167
|
-
this.transform.engine = this.getEngine();
|
|
24168
|
-
vfxItem.transform = this.transform;
|
|
24169
24412
|
this.globalVolume = sourceContent.globalVolume;
|
|
24170
24413
|
this.width = width;
|
|
24171
24414
|
this.height = height;
|
|
@@ -24183,8 +24426,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24183
24426
|
this.reusable = reusable;
|
|
24184
24427
|
this.speed = speed;
|
|
24185
24428
|
this.renderLevel = renderLevel;
|
|
24186
|
-
this.autoRefTex = !this.keepResource && imageUsage &&
|
|
24187
|
-
this.rootItem = vfxItem;
|
|
24429
|
+
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
|
|
24188
24430
|
this.name = sourceContent.name;
|
|
24189
24431
|
this.pluginSystem = pluginSystem;
|
|
24190
24432
|
this.pluginSystem.initializeComposition(this, scene);
|
|
@@ -24217,16 +24459,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24217
24459
|
/**
|
|
24218
24460
|
* 重新开始合成
|
|
24219
24461
|
*/ _proto.restart = function restart() {
|
|
24220
|
-
// const contentItems = this.rootComposition.items;
|
|
24221
|
-
// contentItems.forEach(item => item.dispose());
|
|
24222
|
-
// contentItems.length = 0;
|
|
24223
|
-
this.prepareRender();
|
|
24224
24462
|
this.reset();
|
|
24225
|
-
this.transform.setValid(true);
|
|
24226
|
-
this.rootComposition.resetStatus();
|
|
24227
24463
|
this.forwardTime(this.startTime);
|
|
24228
|
-
// this.content.onUpdate(0);
|
|
24229
|
-
// this.loaderData.spriteGroup.onUpdate(0);
|
|
24230
24464
|
};
|
|
24231
24465
|
/**
|
|
24232
24466
|
* 设置当前合成的渲染顺序
|
|
@@ -24354,28 +24588,9 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24354
24588
|
/**
|
|
24355
24589
|
* 重置状态函数
|
|
24356
24590
|
*/ _proto.reset = function reset() {
|
|
24357
|
-
var _this = this;
|
|
24358
|
-
var vfxItem = new exports.VFXItem(this.getEngine(), this.compositionSourceManager.sourceContent);
|
|
24359
|
-
// TODO 编辑器数据传入 composition type 后移除
|
|
24360
|
-
vfxItem.type = ItemType.composition;
|
|
24361
|
-
vfxItem.composition = this;
|
|
24362
|
-
this.rootComposition = vfxItem.addComponent(CompositionComponent);
|
|
24363
|
-
this.rootComposition.data = this.compositionSourceManager.sourceContent;
|
|
24364
|
-
this.transform = new Transform({
|
|
24365
|
-
name: this.name
|
|
24366
|
-
});
|
|
24367
|
-
this.transform.engine = this.getEngine();
|
|
24368
|
-
vfxItem.transform = this.transform;
|
|
24369
|
-
this.rootItem = vfxItem;
|
|
24370
24591
|
this.rendererOptions = null;
|
|
24371
24592
|
this.globalTime = 0;
|
|
24372
|
-
this.
|
|
24373
|
-
this.buildItemTree(this.rootItem);
|
|
24374
|
-
this.rootItem.onEnd = function() {
|
|
24375
|
-
window.setTimeout(function() {
|
|
24376
|
-
_this.onEnd == null ? void 0 : _this.onEnd.call(_this, _this);
|
|
24377
|
-
}, 0);
|
|
24378
|
-
};
|
|
24593
|
+
this.rootItem.ended = false;
|
|
24379
24594
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
24380
24595
|
};
|
|
24381
24596
|
_proto.prepareRender = function prepareRender() {
|
|
@@ -24421,7 +24636,6 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24421
24636
|
}
|
|
24422
24637
|
var _this_rootItem = this.rootItem, ended = _this_rootItem.ended, endBehavior = _this_rootItem.endBehavior;
|
|
24423
24638
|
// TODO: 合成结束行为
|
|
24424
|
-
// @ts-expect-error
|
|
24425
24639
|
return ended && (!endBehavior || endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY);
|
|
24426
24640
|
};
|
|
24427
24641
|
/**
|
|
@@ -24517,7 +24731,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24517
24731
|
var child = _step2.value;
|
|
24518
24732
|
if (exports.VFXItem.isComposition(child)) {
|
|
24519
24733
|
if (child.ended && child.endBehavior === ItemEndBehavior.loop) {
|
|
24520
|
-
child.
|
|
24734
|
+
child.ended = false;
|
|
24521
24735
|
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
24522
24736
|
this.callUpdate(child, 0);
|
|
24523
24737
|
} else {
|
|
@@ -24924,6 +25138,14 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24924
25138
|
})();
|
|
24925
25139
|
};
|
|
24926
25140
|
_create_class(Composition, [
|
|
25141
|
+
{
|
|
25142
|
+
key: "transform",
|
|
25143
|
+
get: /**
|
|
25144
|
+
* 所有合成 Item 的根变换
|
|
25145
|
+
*/ function get() {
|
|
25146
|
+
return this.rootItem.transform;
|
|
25147
|
+
}
|
|
25148
|
+
},
|
|
24927
25149
|
{
|
|
24928
25150
|
key: "textures",
|
|
24929
25151
|
get: /**
|
|
@@ -24969,189 +25191,6 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24969
25191
|
return Composition;
|
|
24970
25192
|
}();
|
|
24971
25193
|
|
|
24972
|
-
var listOrder = 0;
|
|
24973
|
-
/**
|
|
24974
|
-
* 合成资源管理
|
|
24975
|
-
*/ var CompositionSourceManager = /*#__PURE__*/ function() {
|
|
24976
|
-
function CompositionSourceManager(scene, engine) {
|
|
24977
|
-
this.refCompositions = new Map();
|
|
24978
|
-
this.refCompositionProps = new Map();
|
|
24979
|
-
this.mask = 0;
|
|
24980
|
-
this.engine = engine;
|
|
24981
|
-
// 资源
|
|
24982
|
-
var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
|
|
24983
|
-
var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
|
|
24984
|
-
if (!textureOptions) {
|
|
24985
|
-
throw new Error("scene.textures expected");
|
|
24986
|
-
}
|
|
24987
|
-
var cachedTextures = textureOptions;
|
|
24988
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
|
|
24989
|
-
var comp = _step.value;
|
|
24990
|
-
if (comp.id === compositionId) {
|
|
24991
|
-
this.composition = comp;
|
|
24992
|
-
} else {
|
|
24993
|
-
this.refCompositions.set(comp.id, comp);
|
|
24994
|
-
}
|
|
24995
|
-
}
|
|
24996
|
-
if (!this.composition) {
|
|
24997
|
-
throw new Error("Invalid composition id: " + compositionId);
|
|
24998
|
-
}
|
|
24999
|
-
this.jsonScene = jsonScene;
|
|
25000
|
-
this.renderLevel = renderLevel;
|
|
25001
|
-
this.pluginSystem = pluginSystem;
|
|
25002
|
-
this.totalTime = totalTime != null ? totalTime : 0;
|
|
25003
|
-
this.imgUsage = imgUsage != null ? imgUsage : {};
|
|
25004
|
-
this.textures = cachedTextures;
|
|
25005
|
-
listOrder = 0;
|
|
25006
|
-
this.sourceContent = this.getContent(this.composition);
|
|
25007
|
-
}
|
|
25008
|
-
var _proto = CompositionSourceManager.prototype;
|
|
25009
|
-
_proto.getContent = function getContent(composition) {
|
|
25010
|
-
// TODO: specification 中补充 globalVolume 类型
|
|
25011
|
-
// @ts-expect-error
|
|
25012
|
-
var id = composition.id, duration = composition.duration, name = composition.name, endBehavior = composition.endBehavior, camera = composition.camera, globalVolume = composition.globalVolume, _composition_startTime = composition.startTime, startTime = _composition_startTime === void 0 ? 0 : _composition_startTime, timelineAsset = composition.timelineAsset;
|
|
25013
|
-
var items = this.assembleItems(composition);
|
|
25014
|
-
//@ts-expect-error
|
|
25015
|
-
if (!composition.sceneBindings) {
|
|
25016
|
-
//@ts-expect-error
|
|
25017
|
-
composition.sceneBindings = [];
|
|
25018
|
-
}
|
|
25019
|
-
return {
|
|
25020
|
-
id: id,
|
|
25021
|
-
duration: duration,
|
|
25022
|
-
name: name,
|
|
25023
|
-
endBehavior: isNaN(endBehavior) ? END_BEHAVIOR_PAUSE : endBehavior,
|
|
25024
|
-
// looping,
|
|
25025
|
-
items: items,
|
|
25026
|
-
camera: camera,
|
|
25027
|
-
startTime: startTime,
|
|
25028
|
-
globalVolume: globalVolume,
|
|
25029
|
-
timelineAsset: timelineAsset,
|
|
25030
|
-
//@ts-expect-error
|
|
25031
|
-
sceneBindings: composition.sceneBindings
|
|
25032
|
-
};
|
|
25033
|
-
};
|
|
25034
|
-
_proto.assembleItems = function assembleItems(composition) {
|
|
25035
|
-
var _this = this;
|
|
25036
|
-
var items = [];
|
|
25037
|
-
this.mask++;
|
|
25038
|
-
var componentMap = {};
|
|
25039
|
-
//@ts-expect-error
|
|
25040
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.jsonScene.components), _step; !(_step = _iterator()).done;){
|
|
25041
|
-
var component = _step.value;
|
|
25042
|
-
componentMap[component.id] = component;
|
|
25043
|
-
}
|
|
25044
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(composition.items), _step1; !(_step1 = _iterator1()).done;){
|
|
25045
|
-
var itemDataPath = _step1.value;
|
|
25046
|
-
//@ts-expect-error
|
|
25047
|
-
var sourceItemData = this.engine.jsonSceneData[itemDataPath.id];
|
|
25048
|
-
var itemProps = sourceItemData;
|
|
25049
|
-
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
25050
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
25051
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
25052
|
-
var componentPath = _step2.value;
|
|
25053
|
-
var componentData = componentMap[componentPath.id];
|
|
25054
|
-
this.preProcessItemContent(componentData);
|
|
25055
|
-
}
|
|
25056
|
-
} else {
|
|
25057
|
-
var renderContent = itemProps.content;
|
|
25058
|
-
if (renderContent) {
|
|
25059
|
-
this.preProcessItemContent(renderContent);
|
|
25060
|
-
}
|
|
25061
|
-
}
|
|
25062
|
-
itemProps.listIndex = listOrder++;
|
|
25063
|
-
// 处理预合成的渲染顺序
|
|
25064
|
-
if (itemProps.type === ItemType.composition) {
|
|
25065
|
-
var refId = sourceItemData.content.options.refId;
|
|
25066
|
-
if (!this.refCompositions.get(refId)) {
|
|
25067
|
-
throw new Error("Invalid Ref Composition id: " + refId);
|
|
25068
|
-
}
|
|
25069
|
-
var ref = this.getContent(this.refCompositions.get(refId));
|
|
25070
|
-
if (!this.refCompositionProps.has(refId)) {
|
|
25071
|
-
this.refCompositionProps.set(refId, ref);
|
|
25072
|
-
}
|
|
25073
|
-
ref.items.forEach(function(item) {
|
|
25074
|
-
_this.processMask(item.content);
|
|
25075
|
-
});
|
|
25076
|
-
itemProps.items = ref.items;
|
|
25077
|
-
}
|
|
25078
|
-
items.push(itemProps);
|
|
25079
|
-
}
|
|
25080
|
-
}
|
|
25081
|
-
return items;
|
|
25082
|
-
};
|
|
25083
|
-
_proto.preProcessItemContent = function preProcessItemContent(renderContent) {
|
|
25084
|
-
if (renderContent.renderer) {
|
|
25085
|
-
renderContent.renderer = this.changeTex(renderContent.renderer);
|
|
25086
|
-
if (!renderContent.renderer.mask) {
|
|
25087
|
-
this.processMask(renderContent.renderer);
|
|
25088
|
-
}
|
|
25089
|
-
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
25090
|
-
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
25091
|
-
var _this_jsonScene;
|
|
25092
|
-
// TODO: scene.shapes 类型问题?
|
|
25093
|
-
renderContent.renderer.shape = getGeometryByShape((_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[renderContent.renderer.shape], split);
|
|
25094
|
-
} else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
|
|
25095
|
-
renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
|
|
25096
|
-
}
|
|
25097
|
-
}
|
|
25098
|
-
if (renderContent.trails) {
|
|
25099
|
-
renderContent.trails = this.changeTex(renderContent.trails);
|
|
25100
|
-
}
|
|
25101
|
-
};
|
|
25102
|
-
_proto.changeTex = function changeTex(renderer) {
|
|
25103
|
-
if (!renderer.texture) {
|
|
25104
|
-
return renderer;
|
|
25105
|
-
}
|
|
25106
|
-
//@ts-expect-error
|
|
25107
|
-
var texIdx = renderer.texture.id;
|
|
25108
|
-
if (texIdx !== undefined) {
|
|
25109
|
-
//@ts-expect-error
|
|
25110
|
-
this.addTextureUsage(texIdx) || texIdx;
|
|
25111
|
-
}
|
|
25112
|
-
return renderer;
|
|
25113
|
-
};
|
|
25114
|
-
_proto.addTextureUsage = function addTextureUsage(texIdx) {
|
|
25115
|
-
var texId = texIdx;
|
|
25116
|
-
var _this_imgUsage;
|
|
25117
|
-
// FIXME: imageUsage 取自 scene.imgUsage,类型为 Record<string, number[]>,这里给的 number,类型对不上
|
|
25118
|
-
var imageUsage = (_this_imgUsage = this.imgUsage) != null ? _this_imgUsage : {};
|
|
25119
|
-
if (texId && imageUsage) {
|
|
25120
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
25121
|
-
if (!imageUsage.hasOwnProperty(texId)) {
|
|
25122
|
-
imageUsage[texId] = 0;
|
|
25123
|
-
}
|
|
25124
|
-
imageUsage[texId]++;
|
|
25125
|
-
}
|
|
25126
|
-
};
|
|
25127
|
-
/**
|
|
25128
|
-
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
25129
|
-
*/ _proto.processMask = function processMask(renderer) {
|
|
25130
|
-
var maskMode = renderer.maskMode;
|
|
25131
|
-
if (maskMode === MaskMode.NONE) {
|
|
25132
|
-
return;
|
|
25133
|
-
}
|
|
25134
|
-
if (!renderer.mask) {
|
|
25135
|
-
if (maskMode === MaskMode.MASK) {
|
|
25136
|
-
renderer.mask = ++this.mask;
|
|
25137
|
-
} else if (maskMode === MaskMode.OBSCURED || maskMode === MaskMode.REVERSE_OBSCURED) {
|
|
25138
|
-
renderer.mask = this.mask;
|
|
25139
|
-
}
|
|
25140
|
-
}
|
|
25141
|
-
};
|
|
25142
|
-
_proto.dispose = function dispose() {
|
|
25143
|
-
this.textures = [];
|
|
25144
|
-
this.composition = undefined;
|
|
25145
|
-
this.jsonScene = undefined;
|
|
25146
|
-
this.totalTime = 0;
|
|
25147
|
-
this.pluginSystem = undefined;
|
|
25148
|
-
this.sourceContent = undefined;
|
|
25149
|
-
this.refCompositions.clear();
|
|
25150
|
-
this.refCompositionProps.clear();
|
|
25151
|
-
};
|
|
25152
|
-
return CompositionSourceManager;
|
|
25153
|
-
}();
|
|
25154
|
-
|
|
25155
25194
|
/**
|
|
25156
25195
|
* Engine 基类,负责维护所有 GPU 资源的管理及销毁
|
|
25157
25196
|
*/ var Engine = /*#__PURE__*/ function() {
|
|
@@ -25192,61 +25231,46 @@ var listOrder = 0;
|
|
|
25192
25231
|
delete this.objectInstance[id];
|
|
25193
25232
|
};
|
|
25194
25233
|
_proto.addPackageDatas = function addPackageDatas(scene) {
|
|
25195
|
-
var jsonScene = scene.jsonScene;
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
|
|
25204
|
-
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
|
|
25218
|
-
|
|
25219
|
-
|
|
25220
|
-
|
|
25221
|
-
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
|
|
25227
|
-
|
|
25228
|
-
var animationData = _step5.value;
|
|
25229
|
-
this.addEffectsObjectData(animationData);
|
|
25230
|
-
}
|
|
25231
|
-
}
|
|
25232
|
-
if (jsonScene.bins) {
|
|
25233
|
-
for(var i = 0; i < jsonScene.bins.length; i++){
|
|
25234
|
-
var binaryData = jsonScene.bins[i];
|
|
25235
|
-
var binaryBuffer = scene.bins[i];
|
|
25236
|
-
//@ts-expect-error
|
|
25237
|
-
binaryData.buffer = binaryBuffer;
|
|
25234
|
+
var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
|
|
25235
|
+
var _jsonScene_items = jsonScene.items, items = _jsonScene_items === void 0 ? [] : _jsonScene_items, _jsonScene_materials = jsonScene.materials, materials = _jsonScene_materials === void 0 ? [] : _jsonScene_materials, _jsonScene_shaders = jsonScene.shaders, shaders = _jsonScene_shaders === void 0 ? [] : _jsonScene_shaders, _jsonScene_geometries = jsonScene.geometries, geometries = _jsonScene_geometries === void 0 ? [] : _jsonScene_geometries, _jsonScene_components = jsonScene.components, components = _jsonScene_components === void 0 ? [] : _jsonScene_components, _jsonScene_animations = jsonScene.animations, animations = _jsonScene_animations === void 0 ? [] : _jsonScene_animations, _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins;
|
|
25236
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
25237
|
+
var vfxItemData = _step.value;
|
|
25238
|
+
this.addEffectsObjectData(vfxItemData);
|
|
25239
|
+
}
|
|
25240
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(materials), _step1; !(_step1 = _iterator1()).done;){
|
|
25241
|
+
var materialData = _step1.value;
|
|
25242
|
+
this.addEffectsObjectData(materialData);
|
|
25243
|
+
}
|
|
25244
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shaders), _step2; !(_step2 = _iterator2()).done;){
|
|
25245
|
+
var shaderData = _step2.value;
|
|
25246
|
+
this.addEffectsObjectData(shaderData);
|
|
25247
|
+
}
|
|
25248
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(geometries), _step3; !(_step3 = _iterator3()).done;){
|
|
25249
|
+
var geometryData = _step3.value;
|
|
25250
|
+
this.addEffectsObjectData(geometryData);
|
|
25251
|
+
}
|
|
25252
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(components), _step4; !(_step4 = _iterator4()).done;){
|
|
25253
|
+
var componentData = _step4.value;
|
|
25254
|
+
this.addEffectsObjectData(componentData);
|
|
25255
|
+
}
|
|
25256
|
+
for(var _iterator5 = _create_for_of_iterator_helper_loose(animations), _step5; !(_step5 = _iterator5()).done;){
|
|
25257
|
+
var animationData = _step5.value;
|
|
25258
|
+
this.addEffectsObjectData(animationData);
|
|
25259
|
+
}
|
|
25260
|
+
for(var i = 0; i < bins.length; i++){
|
|
25261
|
+
var binaryData = bins[i];
|
|
25262
|
+
var binaryBuffer = scene.bins[i];
|
|
25263
|
+
//@ts-expect-error
|
|
25264
|
+
binaryData.buffer = binaryBuffer;
|
|
25265
|
+
//@ts-expect-error
|
|
25266
|
+
if (binaryData.id) {
|
|
25238
25267
|
//@ts-expect-error
|
|
25239
|
-
|
|
25240
|
-
//@ts-expect-error
|
|
25241
|
-
this.addEffectsObjectData(binaryData);
|
|
25242
|
-
}
|
|
25268
|
+
this.addEffectsObjectData(binaryData);
|
|
25243
25269
|
}
|
|
25244
25270
|
}
|
|
25245
|
-
|
|
25246
|
-
|
|
25247
|
-
|
|
25248
|
-
this.addEffectsObjectData(textureData);
|
|
25249
|
-
}
|
|
25271
|
+
for(var _iterator6 = _create_for_of_iterator_helper_loose(textureOptions), _step6; !(_step6 = _iterator6()).done;){
|
|
25272
|
+
var textureData = _step6.value;
|
|
25273
|
+
this.addEffectsObjectData(textureData);
|
|
25250
25274
|
}
|
|
25251
25275
|
};
|
|
25252
25276
|
_proto.createVFXItems = function createVFXItems(scene) {
|
|
@@ -25266,9 +25290,7 @@ var listOrder = 0;
|
|
|
25266
25290
|
];
|
|
25267
25291
|
itemData = _step.value;
|
|
25268
25292
|
itemType = itemData.type;
|
|
25269
|
-
if (
|
|
25270
|
-
(itemType === "ECS" || // @ts-expect-error
|
|
25271
|
-
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)) {
|
|
25293
|
+
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)) {
|
|
25272
25294
|
return [
|
|
25273
25295
|
3,
|
|
25274
25296
|
3
|
|
@@ -25385,19 +25407,19 @@ var listOrder = 0;
|
|
|
25385
25407
|
logger.warn("Release GPU memory: " + info.join(", "));
|
|
25386
25408
|
}
|
|
25387
25409
|
this.renderPasses.forEach(function(pass) {
|
|
25388
|
-
pass.dispose();
|
|
25410
|
+
return pass.dispose();
|
|
25389
25411
|
});
|
|
25390
25412
|
this.meshes.forEach(function(mesh) {
|
|
25391
|
-
mesh.dispose();
|
|
25413
|
+
return mesh.dispose();
|
|
25392
25414
|
});
|
|
25393
25415
|
this.geometries.forEach(function(geo) {
|
|
25394
|
-
geo.dispose();
|
|
25416
|
+
return geo.dispose();
|
|
25395
25417
|
});
|
|
25396
25418
|
this.materials.forEach(function(mat) {
|
|
25397
|
-
mat.dispose();
|
|
25419
|
+
return mat.dispose();
|
|
25398
25420
|
});
|
|
25399
25421
|
this.textures.forEach(function(tex) {
|
|
25400
|
-
tex.dispose();
|
|
25422
|
+
return tex.dispose();
|
|
25401
25423
|
});
|
|
25402
25424
|
this.textures = [];
|
|
25403
25425
|
this.materials = [];
|
|
@@ -26710,11 +26732,8 @@ var seed = 1;
|
|
|
26710
26732
|
* composition 抽象类的实现
|
|
26711
26733
|
*/ var ThreeComposition = /*#__PURE__*/ function(Composition) {
|
|
26712
26734
|
_inherits(ThreeComposition, Composition);
|
|
26713
|
-
function ThreeComposition(props, scene
|
|
26714
|
-
|
|
26715
|
-
_this = Composition.call(this, props, scene, compositionSourceManager) || this;
|
|
26716
|
-
_this.rootItem.getComponent(CompositionComponent).resetStatus();
|
|
26717
|
-
return _this;
|
|
26735
|
+
function ThreeComposition(props, scene) {
|
|
26736
|
+
return Composition.call(this, props, scene);
|
|
26718
26737
|
}
|
|
26719
26738
|
var _proto = ThreeComposition.prototype;
|
|
26720
26739
|
/**
|
|
@@ -26906,7 +26925,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26906
26925
|
if (options === void 0) options = {};
|
|
26907
26926
|
var _this = this;
|
|
26908
26927
|
return _async_to_generator(function() {
|
|
26909
|
-
var last, opts, source, scene, engine, i,
|
|
26928
|
+
var last, opts, source, scene, engine, i, composition, firstFrameTime;
|
|
26910
26929
|
return __generator(this, function(_state) {
|
|
26911
26930
|
switch(_state.label){
|
|
26912
26931
|
case 0:
|
|
@@ -26943,7 +26962,6 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26943
26962
|
scene.textureOptions[i] = engine.assetLoader.loadGUID(scene.textureOptions[i].id);
|
|
26944
26963
|
scene.textureOptions[i].initialize();
|
|
26945
26964
|
}
|
|
26946
|
-
compositionSourceManager = new CompositionSourceManager(scene, engine);
|
|
26947
26965
|
if (!engine.database) return [
|
|
26948
26966
|
3,
|
|
26949
26967
|
3
|
|
@@ -26960,7 +26978,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26960
26978
|
width: _this.width,
|
|
26961
26979
|
height: _this.height,
|
|
26962
26980
|
renderer: _this.renderer
|
|
26963
|
-
}), scene
|
|
26981
|
+
}), scene);
|
|
26964
26982
|
_this.renderer.engine.setOptions({
|
|
26965
26983
|
threeCamera: _this.camera,
|
|
26966
26984
|
threeGroup: _this,
|
|
@@ -27139,12 +27157,11 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27139
27157
|
*/ Mesh.create = function(engine, props) {
|
|
27140
27158
|
return new ThreeMesh(engine, props);
|
|
27141
27159
|
};
|
|
27142
|
-
var version = "2.0.0-alpha.
|
|
27160
|
+
var version = "2.0.0-alpha.15";
|
|
27143
27161
|
logger.info("THREEJS plugin version: " + version);
|
|
27144
27162
|
|
|
27145
27163
|
exports.AbstractPlugin = AbstractPlugin;
|
|
27146
27164
|
exports.ActivationPlayable = ActivationPlayable;
|
|
27147
|
-
exports.ActivationPlayableAsset = ActivationPlayableAsset;
|
|
27148
27165
|
exports.AnimationClipPlayable = AnimationClipPlayable;
|
|
27149
27166
|
exports.AssetLoader = AssetLoader;
|
|
27150
27167
|
exports.AssetManager = AssetManager;
|
|
@@ -27252,6 +27269,7 @@ exports.addItem = addItem;
|
|
|
27252
27269
|
exports.addItemWithOrder = addItemWithOrder;
|
|
27253
27270
|
exports.assertExist = assertExist;
|
|
27254
27271
|
exports.asserts = asserts;
|
|
27272
|
+
exports.base64ToFile = base64ToFile;
|
|
27255
27273
|
exports.blend = blend;
|
|
27256
27274
|
exports.calculateTranslation = calculateTranslation;
|
|
27257
27275
|
exports.canvasPool = canvasPool;
|
|
@@ -27320,6 +27338,7 @@ exports.interpolateColor = interpolateColor;
|
|
|
27320
27338
|
exports.isAlipayMiniApp = isAlipayMiniApp;
|
|
27321
27339
|
exports.isAndroid = isAndroid;
|
|
27322
27340
|
exports.isArray = isArray;
|
|
27341
|
+
exports.isCanvas = isCanvas;
|
|
27323
27342
|
exports.isFunction = isFunction;
|
|
27324
27343
|
exports.isIOS = isIOS;
|
|
27325
27344
|
exports.isObject = isObject;
|