@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.mjs
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
|
import * as THREE from 'three';
|
|
@@ -741,6 +741,11 @@ function noop() {}
|
|
|
741
741
|
*/ function isObject(obj) {
|
|
742
742
|
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
743
743
|
}
|
|
744
|
+
function isCanvas(canvas) {
|
|
745
|
+
var _canvas_tagName;
|
|
746
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
747
|
+
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
748
|
+
}
|
|
744
749
|
function deepClone(obj) {
|
|
745
750
|
if (isArray(obj)) {
|
|
746
751
|
return obj.map(deepClone);
|
|
@@ -768,6 +773,37 @@ function throwDestroyedError() {
|
|
|
768
773
|
function generateGUID() {
|
|
769
774
|
return v4().replace(/-/g, "");
|
|
770
775
|
}
|
|
776
|
+
function base64ToFile(base64, filename, contentType) {
|
|
777
|
+
if (filename === void 0) filename = "base64File";
|
|
778
|
+
if (contentType === void 0) contentType = "";
|
|
779
|
+
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
780
|
+
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
781
|
+
// 将 base64 编码的字符串转换为二进制字符串
|
|
782
|
+
var byteCharacters = atob(base64WithoutPrefix);
|
|
783
|
+
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
784
|
+
var byteArrays = [];
|
|
785
|
+
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
786
|
+
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
787
|
+
var slice = byteCharacters.slice(offset, offset + 512);
|
|
788
|
+
var byteNumbers = new Array(slice.length);
|
|
789
|
+
for(var i = 0; i < slice.length; i++){
|
|
790
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
791
|
+
}
|
|
792
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
793
|
+
byteArrays.push(byteArray);
|
|
794
|
+
}
|
|
795
|
+
// 使用字节数组创建 Blob 对象
|
|
796
|
+
var blob = new Blob(byteArrays, {
|
|
797
|
+
type: contentType
|
|
798
|
+
});
|
|
799
|
+
// 创建 File 对象
|
|
800
|
+
var file = new File([
|
|
801
|
+
blob
|
|
802
|
+
], filename, {
|
|
803
|
+
type: contentType
|
|
804
|
+
});
|
|
805
|
+
return file;
|
|
806
|
+
}
|
|
771
807
|
|
|
772
808
|
function _defineProperties(target, props) {
|
|
773
809
|
for(var i = 0; i < props.length; i++){
|
|
@@ -18507,6 +18543,9 @@ var ActivationPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18507
18543
|
};
|
|
18508
18544
|
return ActivationPlayableAsset;
|
|
18509
18545
|
}(PlayableAsset);
|
|
18546
|
+
ActivationPlayableAsset = __decorate([
|
|
18547
|
+
effectsClass("ActivationPlayableAsset")
|
|
18548
|
+
], ActivationPlayableAsset);
|
|
18510
18549
|
var AnimationClip = /*#__PURE__*/ function(EffectsObject) {
|
|
18511
18550
|
_inherits(AnimationClip, EffectsObject);
|
|
18512
18551
|
function AnimationClip() {
|
|
@@ -18636,17 +18675,15 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18636
18675
|
return _this;
|
|
18637
18676
|
}
|
|
18638
18677
|
var _proto = TrackAsset.prototype;
|
|
18639
|
-
|
|
18640
|
-
|
|
18678
|
+
/**
|
|
18679
|
+
* 重写该方法以获取自定义对象绑定
|
|
18680
|
+
*/ _proto.resolveBinding = function resolveBinding(parentBinding) {
|
|
18681
|
+
return parentBinding;
|
|
18641
18682
|
};
|
|
18642
18683
|
/**
|
|
18643
|
-
*
|
|
18644
|
-
*/ _proto.
|
|
18645
|
-
|
|
18646
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
18647
|
-
var subTrack = _step.value;
|
|
18648
|
-
subTrack.initializeBindingRecursive(this.binding);
|
|
18649
|
-
}
|
|
18684
|
+
* 重写该方法以创建自定义混合器
|
|
18685
|
+
*/ _proto.createTrackMixer = function createTrackMixer(graph) {
|
|
18686
|
+
return new Playable(graph);
|
|
18650
18687
|
};
|
|
18651
18688
|
_proto.createOutput = function createOutput() {
|
|
18652
18689
|
var output = new PlayableOutput();
|
|
@@ -18677,17 +18714,15 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18677
18714
|
}
|
|
18678
18715
|
return mixer;
|
|
18679
18716
|
};
|
|
18680
|
-
/**
|
|
18681
|
-
* 重写该方法以创建自定义混合器
|
|
18682
|
-
*/ _proto.createTrackMixer = function createTrackMixer(graph) {
|
|
18683
|
-
return new Playable(graph);
|
|
18684
|
-
};
|
|
18685
18717
|
_proto.createPlayable = function createPlayable(graph) {
|
|
18686
18718
|
return new Playable(graph);
|
|
18687
18719
|
};
|
|
18688
18720
|
_proto.getChildTracks = function getChildTracks() {
|
|
18689
18721
|
return this.children;
|
|
18690
18722
|
};
|
|
18723
|
+
_proto.addChild = function addChild(child) {
|
|
18724
|
+
this.children.push(child);
|
|
18725
|
+
};
|
|
18691
18726
|
_proto.createClip = function createClip(classConstructor, name) {
|
|
18692
18727
|
var newClip = new TimelineClip();
|
|
18693
18728
|
newClip.asset = new classConstructor(this.engine);
|
|
@@ -18765,9 +18800,10 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18765
18800
|
var weight = 1.0;
|
|
18766
18801
|
var ended = false;
|
|
18767
18802
|
var started = false;
|
|
18803
|
+
var boundItem = this.track.binding;
|
|
18768
18804
|
if (localTime > clip.start + clip.duration + 0.001 && clip.endBehaviour === ItemEndBehavior.destroy) {
|
|
18769
|
-
var
|
|
18770
|
-
if (VFXItem.isParticle(
|
|
18805
|
+
var _boundItem_getComponent;
|
|
18806
|
+
if (VFXItem.isParticle(boundItem) && !((_boundItem_getComponent = boundItem.getComponent(ParticleSystem)) == null ? void 0 : _boundItem_getComponent.destroyed)) {
|
|
18771
18807
|
weight = 1.0;
|
|
18772
18808
|
} else {
|
|
18773
18809
|
weight = 0.0;
|
|
@@ -18783,7 +18819,6 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18783
18819
|
this.playable.play();
|
|
18784
18820
|
}
|
|
18785
18821
|
this.parentMixer.setInputWeight(this.playable, weight);
|
|
18786
|
-
var boundItem = this.track.binding;
|
|
18787
18822
|
// 判断动画是否结束
|
|
18788
18823
|
if (ended && !boundItem.ended) {
|
|
18789
18824
|
boundItem.ended = true;
|
|
@@ -18820,6 +18855,45 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18820
18855
|
return RuntimeClip;
|
|
18821
18856
|
}();
|
|
18822
18857
|
|
|
18858
|
+
var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
18859
|
+
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
18860
|
+
function ObjectBindingTrack() {
|
|
18861
|
+
return TrackAsset1.apply(this, arguments);
|
|
18862
|
+
}
|
|
18863
|
+
var _proto = ObjectBindingTrack.prototype;
|
|
18864
|
+
_proto.create = function create(timelineAsset) {
|
|
18865
|
+
var boundItem = this.binding;
|
|
18866
|
+
// 添加粒子动画 clip
|
|
18867
|
+
if (boundItem.getComponent(ParticleSystem)) {
|
|
18868
|
+
var particleTrack = timelineAsset.createTrack(TrackAsset, this, "ParticleTrack");
|
|
18869
|
+
particleTrack.binding = this.binding;
|
|
18870
|
+
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
18871
|
+
particleClip.start = boundItem.start;
|
|
18872
|
+
particleClip.duration = boundItem.duration;
|
|
18873
|
+
particleClip.endBehaviour = boundItem.endBehavior;
|
|
18874
|
+
}
|
|
18875
|
+
};
|
|
18876
|
+
_proto.fromData = function fromData(data) {
|
|
18877
|
+
TrackAsset1.prototype.fromData.call(this, data);
|
|
18878
|
+
this.data = data;
|
|
18879
|
+
};
|
|
18880
|
+
return ObjectBindingTrack;
|
|
18881
|
+
}(TrackAsset);
|
|
18882
|
+
ObjectBindingTrack = __decorate([
|
|
18883
|
+
effectsClass("ObjectBindingTrack")
|
|
18884
|
+
], ObjectBindingTrack);
|
|
18885
|
+
|
|
18886
|
+
var TransformTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
18887
|
+
_inherits(TransformTrack, TrackAsset);
|
|
18888
|
+
function TransformTrack() {
|
|
18889
|
+
return TrackAsset.apply(this, arguments);
|
|
18890
|
+
}
|
|
18891
|
+
return TransformTrack;
|
|
18892
|
+
}(TrackAsset);
|
|
18893
|
+
TransformTrack = __decorate([
|
|
18894
|
+
effectsClass("TransformTrack")
|
|
18895
|
+
], TransformTrack);
|
|
18896
|
+
|
|
18823
18897
|
var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
18824
18898
|
_inherits(ActivationMixerPlayable, Playable);
|
|
18825
18899
|
function ActivationMixerPlayable() {
|
|
@@ -18883,85 +18957,6 @@ ActivationTrack = __decorate([
|
|
|
18883
18957
|
effectsClass("ActivationTrack")
|
|
18884
18958
|
], ActivationTrack);
|
|
18885
18959
|
|
|
18886
|
-
var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
18887
|
-
_inherits(ObjectBindingTrack, TrackAsset1);
|
|
18888
|
-
function ObjectBindingTrack() {
|
|
18889
|
-
var _this;
|
|
18890
|
-
_this = TrackAsset1.apply(this, arguments) || this;
|
|
18891
|
-
_this.trackSeed = 0;
|
|
18892
|
-
return _this;
|
|
18893
|
-
}
|
|
18894
|
-
var _proto = ObjectBindingTrack.prototype;
|
|
18895
|
-
_proto.create = function create() {
|
|
18896
|
-
this.options = {
|
|
18897
|
-
start: this.binding.start,
|
|
18898
|
-
duration: this.binding.duration,
|
|
18899
|
-
looping: this.binding.endBehavior === ItemEndBehavior.loop,
|
|
18900
|
-
endBehavior: this.binding.endBehavior || ItemEndBehavior.destroy
|
|
18901
|
-
};
|
|
18902
|
-
this.id = this.binding.id;
|
|
18903
|
-
this.name = this.binding.name;
|
|
18904
|
-
var activationTrack = this.createTrack(ActivationTrack, "ActivationTrack");
|
|
18905
|
-
activationTrack.binding = this.binding;
|
|
18906
|
-
activationTrack.createClip(ActivationPlayableAsset, "ActivationTimelineClip");
|
|
18907
|
-
// 添加粒子动画 clip
|
|
18908
|
-
if (this.binding.getComponent(ParticleSystem)) {
|
|
18909
|
-
var particleTrack = this.createTrack(TrackAsset, "ParticleTrack");
|
|
18910
|
-
particleTrack.binding = this.binding;
|
|
18911
|
-
particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
18912
|
-
}
|
|
18913
|
-
// TODO TimelineClip 需要传入 start 和 duration 数据
|
|
18914
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
18915
|
-
var track = _step.value;
|
|
18916
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(track.getClips()), _step1; !(_step1 = _iterator1()).done;){
|
|
18917
|
-
var clip = _step1.value;
|
|
18918
|
-
clip.start = this.binding.start;
|
|
18919
|
-
clip.duration = this.binding.duration;
|
|
18920
|
-
clip.endBehaviour = this.binding.endBehavior;
|
|
18921
|
-
}
|
|
18922
|
-
}
|
|
18923
|
-
};
|
|
18924
|
-
_proto.toLocalTime = function toLocalTime(time) {
|
|
18925
|
-
var localTime = time - this.options.start;
|
|
18926
|
-
var duration = this.options.duration;
|
|
18927
|
-
if (localTime - duration > 0.001) {
|
|
18928
|
-
if (this.options.endBehavior === END_BEHAVIOR_RESTART) {
|
|
18929
|
-
localTime = localTime % duration;
|
|
18930
|
-
} else if (this.options.endBehavior === END_BEHAVIOR_FREEZE) {
|
|
18931
|
-
localTime = Math.min(duration, localTime);
|
|
18932
|
-
}
|
|
18933
|
-
}
|
|
18934
|
-
return localTime;
|
|
18935
|
-
};
|
|
18936
|
-
_proto.createTrack = function createTrack(classConstructor, name) {
|
|
18937
|
-
var newTrack = new classConstructor(this.engine);
|
|
18938
|
-
newTrack.binding = this.binding;
|
|
18939
|
-
newTrack.id = (this.trackSeed++).toString();
|
|
18940
|
-
newTrack.name = name ? name : "Track" + newTrack.id;
|
|
18941
|
-
this.children.push(newTrack);
|
|
18942
|
-
return newTrack;
|
|
18943
|
-
};
|
|
18944
|
-
_proto.fromData = function fromData(data) {
|
|
18945
|
-
TrackAsset1.prototype.fromData.call(this, data);
|
|
18946
|
-
this.data = data;
|
|
18947
|
-
};
|
|
18948
|
-
return ObjectBindingTrack;
|
|
18949
|
-
}(TrackAsset);
|
|
18950
|
-
ObjectBindingTrack = __decorate([
|
|
18951
|
-
effectsClass("ObjectBindingTrack")
|
|
18952
|
-
], ObjectBindingTrack);
|
|
18953
|
-
|
|
18954
|
-
var TransformTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
18955
|
-
_inherits(TransformTrack, TrackAsset);
|
|
18956
|
-
function TransformTrack() {
|
|
18957
|
-
return TrackAsset.apply(this, arguments);
|
|
18958
|
-
}
|
|
18959
|
-
return TransformTrack;
|
|
18960
|
-
}(TrackAsset);
|
|
18961
|
-
TransformTrack = __decorate([
|
|
18962
|
-
effectsClass("TransformTrack")
|
|
18963
|
-
], TransformTrack);
|
|
18964
|
-
|
|
18965
18960
|
var SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
18966
18961
|
_inherits(SpriteColorTrack, TrackAsset);
|
|
18967
18962
|
function SpriteColorTrack() {
|
|
@@ -18983,17 +18978,29 @@ var TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18983
18978
|
}
|
|
18984
18979
|
var _proto = TimelineAsset.prototype;
|
|
18985
18980
|
_proto.createPlayable = function createPlayable(graph) {
|
|
18986
|
-
this.graph = graph;
|
|
18987
18981
|
var timelinePlayable = new TimelinePlayable(graph);
|
|
18988
18982
|
timelinePlayable.setTraversalMode(PlayableTraversalMode.Passthrough);
|
|
18983
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
18984
|
+
var track = _step.value;
|
|
18985
|
+
if (_instanceof1(track, ObjectBindingTrack)) {
|
|
18986
|
+
track.create(this);
|
|
18987
|
+
}
|
|
18988
|
+
}
|
|
18989
18989
|
timelinePlayable.compileTracks(graph, this.tracks);
|
|
18990
18990
|
return timelinePlayable;
|
|
18991
18991
|
};
|
|
18992
|
-
_proto.
|
|
18993
|
-
|
|
18992
|
+
_proto.createTrack = function createTrack(classConstructor, parent, name) {
|
|
18993
|
+
var newTrack = new classConstructor(this.engine);
|
|
18994
|
+
newTrack.name = name ? name : classConstructor.name;
|
|
18995
|
+
parent.addChild(newTrack);
|
|
18996
|
+
return newTrack;
|
|
18994
18997
|
};
|
|
18998
|
+
_proto.fromData = function fromData(data) {};
|
|
18995
18999
|
return TimelineAsset;
|
|
18996
19000
|
}(PlayableAsset);
|
|
19001
|
+
__decorate([
|
|
19002
|
+
serialize()
|
|
19003
|
+
], TimelineAsset.prototype, "tracks", void 0);
|
|
18997
19004
|
TimelineAsset = __decorate([
|
|
18998
19005
|
effectsClass("TimelineAsset")
|
|
18999
19006
|
], TimelineAsset);
|
|
@@ -19003,7 +19010,6 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19003
19010
|
var _this;
|
|
19004
19011
|
_this = Playable.apply(this, arguments) || this;
|
|
19005
19012
|
_this.clips = [];
|
|
19006
|
-
_this.masterTracks = [];
|
|
19007
19013
|
return _this;
|
|
19008
19014
|
}
|
|
19009
19015
|
var _proto = TimelinePlayable.prototype;
|
|
@@ -19020,25 +19026,18 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
|
|
|
19020
19026
|
};
|
|
19021
19027
|
_proto.compileTracks = function compileTracks(graph, tracks) {
|
|
19022
19028
|
this.sortTracks(tracks);
|
|
19023
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
19024
|
-
var track = _step.value;
|
|
19025
|
-
if (_instanceof1(track, ObjectBindingTrack)) {
|
|
19026
|
-
track.create();
|
|
19027
|
-
}
|
|
19028
|
-
this.masterTracks.push(track);
|
|
19029
|
-
}
|
|
19030
19029
|
var outputTrack = [];
|
|
19031
|
-
for(var
|
|
19032
|
-
var masterTrack =
|
|
19030
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(tracks), _step; !(_step = _iterator()).done;){
|
|
19031
|
+
var masterTrack = _step.value;
|
|
19033
19032
|
outputTrack.push(masterTrack);
|
|
19034
19033
|
this.addSubTracksRecursive(masterTrack, outputTrack);
|
|
19035
19034
|
}
|
|
19036
|
-
for(var
|
|
19037
|
-
var
|
|
19038
|
-
var trackMixPlayable =
|
|
19035
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(outputTrack), _step1; !(_step1 = _iterator1()).done;){
|
|
19036
|
+
var track = _step1.value;
|
|
19037
|
+
var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
|
|
19039
19038
|
this.addInput(trackMixPlayable, 0);
|
|
19040
|
-
var trackOutput =
|
|
19041
|
-
trackOutput.setUserData(
|
|
19039
|
+
var trackOutput = track.createOutput();
|
|
19040
|
+
trackOutput.setUserData(track.binding);
|
|
19042
19041
|
graph.addOutput(trackOutput);
|
|
19043
19042
|
trackOutput.setSourcePlayeble(this, this.getInputCount() - 1);
|
|
19044
19043
|
}
|
|
@@ -19082,98 +19081,375 @@ function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
|
19082
19081
|
return false;
|
|
19083
19082
|
}
|
|
19084
19083
|
function compareTracks(a, b) {
|
|
19085
|
-
|
|
19084
|
+
var bindingA = a.track.binding;
|
|
19085
|
+
var bindingB = b.track.binding;
|
|
19086
|
+
if (!_instanceof1(bindingA, VFXItem) || !_instanceof1(bindingB, VFXItem)) {
|
|
19087
|
+
return a.originalIndex - b.originalIndex;
|
|
19088
|
+
}
|
|
19089
|
+
if (isAncestor(bindingA, bindingB)) {
|
|
19086
19090
|
return -1;
|
|
19087
|
-
} else if (isAncestor(
|
|
19091
|
+
} else if (isAncestor(bindingB, bindingA)) {
|
|
19088
19092
|
return 1;
|
|
19089
19093
|
} else {
|
|
19090
19094
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
19091
19095
|
}
|
|
19092
19096
|
}
|
|
19093
19097
|
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
// } else {
|
|
19111
|
-
// if (textWidth) {
|
|
19112
|
-
// this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
|
|
19113
|
-
// this.width = textWidth;
|
|
19114
|
-
// } else {
|
|
19115
|
-
// this.width = basicScale[0] * 100;
|
|
19116
|
-
// }
|
|
19117
|
-
// this.height = basicScale[1] * 100;
|
|
19118
|
-
// }
|
|
19119
|
-
this.width = textWidth;
|
|
19120
|
-
this.height = textHeight;
|
|
19121
|
-
this.letterSpace = letterSpace;
|
|
19122
|
-
this.overFlow = textOverflow;
|
|
19123
|
-
this.textBaseline = textBaseline;
|
|
19124
|
-
this.textAlign = textAlign;
|
|
19125
|
-
this.lineHeight = lineHeight;
|
|
19098
|
+
/**
|
|
19099
|
+
* @since 2.0.0
|
|
19100
|
+
* @internal
|
|
19101
|
+
*/ var CompositionComponent = /*#__PURE__*/ function(ItemBehaviour) {
|
|
19102
|
+
_inherits(CompositionComponent, ItemBehaviour);
|
|
19103
|
+
function CompositionComponent() {
|
|
19104
|
+
var _this;
|
|
19105
|
+
_this = ItemBehaviour.apply(this, arguments) || this;
|
|
19106
|
+
_this.time = 0;
|
|
19107
|
+
_this.startTime = 0;
|
|
19108
|
+
_this.items = [] // 场景的所有元素
|
|
19109
|
+
;
|
|
19110
|
+
_this.reusable = false;
|
|
19111
|
+
_this.sceneBindings = [];
|
|
19112
|
+
_this.graph = new PlayableGraph();
|
|
19113
|
+
return _this;
|
|
19126
19114
|
}
|
|
19127
|
-
var _proto =
|
|
19128
|
-
_proto.
|
|
19129
|
-
var
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
break;
|
|
19138
|
-
case TextBaseline.bottom:
|
|
19139
|
-
offsetY = this.height - offset / 2;
|
|
19140
|
-
break;
|
|
19115
|
+
var _proto = CompositionComponent.prototype;
|
|
19116
|
+
_proto.start = function start() {
|
|
19117
|
+
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;
|
|
19118
|
+
this.startTime = startTime;
|
|
19119
|
+
this.resolveBindings();
|
|
19120
|
+
this.timelinePlayable = this.timelineAsset.createPlayable(this.graph);
|
|
19121
|
+
this.timelinePlayable.play();
|
|
19122
|
+
// 重播不销毁元素
|
|
19123
|
+
if (this.item.endBehavior !== ItemEndBehavior.destroy) {
|
|
19124
|
+
this.setReusable(true);
|
|
19141
19125
|
}
|
|
19142
|
-
return offsetY;
|
|
19143
19126
|
};
|
|
19144
|
-
_proto.
|
|
19145
|
-
var
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19127
|
+
_proto.setReusable = function setReusable(value) {
|
|
19128
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step; !(_step = _iterator()).done;){
|
|
19129
|
+
var track = _step.value;
|
|
19130
|
+
var binding = track.binding;
|
|
19131
|
+
if (_instanceof1(binding, VFXItem)) {
|
|
19132
|
+
if (_instanceof1(track, ObjectBindingTrack)) {
|
|
19133
|
+
binding.reusable = value;
|
|
19134
|
+
}
|
|
19135
|
+
var subCompositionComponent = binding.getComponent(CompositionComponent);
|
|
19136
|
+
if (subCompositionComponent) {
|
|
19137
|
+
subCompositionComponent.setReusable(value);
|
|
19138
|
+
}
|
|
19139
|
+
}
|
|
19156
19140
|
}
|
|
19157
|
-
return offsetX;
|
|
19158
19141
|
};
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
* @param width 文本框宽度
|
|
19162
|
-
* @param height 文本框高度
|
|
19163
|
-
*/ _proto.setSize = function setSize(width, height) {
|
|
19164
|
-
this.width = width;
|
|
19165
|
-
this.height = height;
|
|
19142
|
+
_proto.getReusable = function getReusable() {
|
|
19143
|
+
return this.reusable;
|
|
19166
19144
|
};
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19145
|
+
_proto.update = function update(dt) {
|
|
19146
|
+
var time = this.time;
|
|
19147
|
+
// 主合成 rootItem 没有绑定轨道,增加结束行为判断。
|
|
19148
|
+
if (this.item.isEnded(this.time) && !this.item.parent) {
|
|
19149
|
+
this.item.ended = true;
|
|
19150
|
+
}
|
|
19151
|
+
this.timelinePlayable.setTime(time);
|
|
19152
|
+
this.graph.evaluate(dt);
|
|
19153
|
+
};
|
|
19154
|
+
_proto.createContent = function createContent() {
|
|
19155
|
+
var sceneBindings = [];
|
|
19156
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.data.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
19157
|
+
var sceneBindingData = _step.value;
|
|
19158
|
+
sceneBindings.push({
|
|
19159
|
+
key: this.engine.assetLoader.loadGUID(sceneBindingData.key.id),
|
|
19160
|
+
value: this.engine.assetLoader.loadGUID(sceneBindingData.value.id)
|
|
19161
|
+
});
|
|
19162
|
+
}
|
|
19163
|
+
this.sceneBindings = sceneBindings;
|
|
19164
|
+
var timelineAsset = this.data.timelineAsset ? this.engine.assetLoader.loadGUID(this.data.timelineAsset.id) : new TimelineAsset(this.engine);
|
|
19165
|
+
this.timelineAsset = timelineAsset;
|
|
19166
|
+
var items = this.items;
|
|
19167
|
+
this.items.length = 0;
|
|
19168
|
+
if (this.item.composition) {
|
|
19169
|
+
var assetLoader = this.item.engine.assetLoader;
|
|
19170
|
+
var itemProps = this.item.props.items ? this.item.props.items : [];
|
|
19171
|
+
for(var i = 0; i < itemProps.length; i++){
|
|
19172
|
+
var item = void 0;
|
|
19173
|
+
var itemData = itemProps[i];
|
|
19174
|
+
// 设置预合成作为元素时的时长、结束行为和渲染延时
|
|
19175
|
+
if (Item.isComposition(itemData)) {
|
|
19176
|
+
var refId = itemData.content.options.refId;
|
|
19177
|
+
var props = this.item.composition.refCompositionProps.get(refId);
|
|
19178
|
+
if (!props) {
|
|
19179
|
+
throw new Error("引用的Id: " + refId + " 的预合成不存在");
|
|
19180
|
+
}
|
|
19181
|
+
// endBehaviour 类型需优化
|
|
19182
|
+
props.content = itemData.content;
|
|
19183
|
+
item = assetLoader.loadGUID(itemData.id);
|
|
19184
|
+
item.composition = this.item.composition;
|
|
19185
|
+
var compositionComponent = item.addComponent(CompositionComponent);
|
|
19186
|
+
compositionComponent.data = props;
|
|
19187
|
+
compositionComponent.refId = refId;
|
|
19188
|
+
item.transform.parentTransform = this.transform;
|
|
19189
|
+
this.item.composition.refContent.push(item);
|
|
19190
|
+
if (item.endBehavior === ItemEndBehavior.loop) {
|
|
19191
|
+
this.item.composition.autoRefTex = false;
|
|
19192
|
+
}
|
|
19193
|
+
compositionComponent.createContent();
|
|
19194
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositionComponent.items), _step1; !(_step1 = _iterator1()).done;){
|
|
19195
|
+
var vfxItem = _step1.value;
|
|
19196
|
+
vfxItem.setInstanceId(generateGUID());
|
|
19197
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
19198
|
+
var component = _step2.value;
|
|
19199
|
+
component.setInstanceId(generateGUID());
|
|
19200
|
+
}
|
|
19201
|
+
}
|
|
19202
|
+
} else {
|
|
19203
|
+
item = assetLoader.loadGUID(itemData.id);
|
|
19204
|
+
item.composition = this.item.composition;
|
|
19205
|
+
}
|
|
19206
|
+
item.parent = this.item;
|
|
19207
|
+
// 相机不跟随合成移动
|
|
19208
|
+
item.transform.parentTransform = itemData.type === ItemType.camera ? new Transform() : this.transform;
|
|
19209
|
+
if (VFXItem.isExtraCamera(item)) {
|
|
19210
|
+
this.item.composition.extraCamera = item;
|
|
19211
|
+
}
|
|
19212
|
+
items.push(item);
|
|
19213
|
+
}
|
|
19214
|
+
}
|
|
19215
|
+
};
|
|
19216
|
+
_proto.onDestroy = function onDestroy() {
|
|
19217
|
+
if (this.item.composition) {
|
|
19218
|
+
if (this.items) {
|
|
19219
|
+
this.items.forEach(function(item) {
|
|
19220
|
+
return item.dispose();
|
|
19221
|
+
});
|
|
19222
|
+
this.items.length = 0;
|
|
19223
|
+
}
|
|
19224
|
+
}
|
|
19225
|
+
};
|
|
19226
|
+
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
19227
|
+
var _this, _loop = function(i) {
|
|
19228
|
+
var item = _this.items[i];
|
|
19229
|
+
if (item.getVisible() && !item.ended && !VFXItem.isComposition(item) && !skip(item)) {
|
|
19230
|
+
var hitParams = item.getHitTestParams(force);
|
|
19231
|
+
if (hitParams) {
|
|
19232
|
+
var success = false;
|
|
19233
|
+
var intersectPoint = new Vector3();
|
|
19234
|
+
if (hitParams.type === HitTestType.triangle) {
|
|
19235
|
+
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
19236
|
+
for(var j = 0; j < triangles.length; j++){
|
|
19237
|
+
var triangle = triangles[j];
|
|
19238
|
+
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
19239
|
+
success = true;
|
|
19240
|
+
hitPositions.push(intersectPoint);
|
|
19241
|
+
break;
|
|
19242
|
+
}
|
|
19243
|
+
}
|
|
19244
|
+
} else if (hitParams.type === HitTestType.box) {
|
|
19245
|
+
var center = hitParams.center, size = hitParams.size;
|
|
19246
|
+
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
19247
|
+
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
19248
|
+
if (ray.intersectBox({
|
|
19249
|
+
min: boxMin,
|
|
19250
|
+
max: boxMax
|
|
19251
|
+
}, intersectPoint)) {
|
|
19252
|
+
success = true;
|
|
19253
|
+
hitPositions.push(intersectPoint);
|
|
19254
|
+
}
|
|
19255
|
+
} else if (hitParams.type === HitTestType.sphere) {
|
|
19256
|
+
var center1 = hitParams.center, radius = hitParams.radius;
|
|
19257
|
+
if (ray.intersectSphere({
|
|
19258
|
+
center: center1,
|
|
19259
|
+
radius: radius
|
|
19260
|
+
}, intersectPoint)) {
|
|
19261
|
+
success = true;
|
|
19262
|
+
hitPositions.push(intersectPoint);
|
|
19263
|
+
}
|
|
19264
|
+
} else if (hitParams.type === HitTestType.custom) {
|
|
19265
|
+
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
19266
|
+
if (tempPosition && tempPosition.length > 0) {
|
|
19267
|
+
tempPosition.forEach(function(pos) {
|
|
19268
|
+
hitPositions.push(pos);
|
|
19269
|
+
});
|
|
19270
|
+
success = true;
|
|
19271
|
+
}
|
|
19272
|
+
}
|
|
19273
|
+
if (success) {
|
|
19274
|
+
var region = {
|
|
19275
|
+
compContent: _this.item,
|
|
19276
|
+
id: item.id,
|
|
19277
|
+
name: item.name,
|
|
19278
|
+
position: hitPositions[hitPositions.length - 1],
|
|
19279
|
+
parentId: item.parentId,
|
|
19280
|
+
hitPositions: hitPositions,
|
|
19281
|
+
behavior: hitParams.behavior
|
|
19282
|
+
};
|
|
19283
|
+
regions.push(region);
|
|
19284
|
+
if (stop(region)) {
|
|
19285
|
+
return {
|
|
19286
|
+
v: regions
|
|
19287
|
+
};
|
|
19288
|
+
}
|
|
19289
|
+
}
|
|
19290
|
+
}
|
|
19291
|
+
}
|
|
19292
|
+
};
|
|
19293
|
+
var hitPositions = [];
|
|
19294
|
+
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
19295
|
+
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
19296
|
+
var maxCount = (options == null ? void 0 : options.maxCount) || this.items.length;
|
|
19297
|
+
for(var i = 0; i < this.items.length && regions.length < maxCount; i++){
|
|
19298
|
+
var _ret = (_this = this, _loop(i));
|
|
19299
|
+
if (_type_of(_ret) === "object") return _ret.v;
|
|
19300
|
+
}
|
|
19301
|
+
return regions;
|
|
19302
|
+
};
|
|
19303
|
+
_proto.fromData = function fromData(data) {};
|
|
19304
|
+
_proto.resolveBindings = function resolveBindings() {
|
|
19305
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
19306
|
+
var sceneBinding = _step.value;
|
|
19307
|
+
sceneBinding.key.binding = sceneBinding.value;
|
|
19308
|
+
}
|
|
19309
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.timelineAsset.tracks), _step1; !(_step1 = _iterator1()).done;){
|
|
19310
|
+
var masterTrack = _step1.value;
|
|
19311
|
+
this.resolveTrackBindingsWithRoot(masterTrack);
|
|
19312
|
+
}
|
|
19313
|
+
};
|
|
19314
|
+
_proto.resolveTrackBindingsWithRoot = function resolveTrackBindingsWithRoot(track) {
|
|
19315
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(track.getChildTracks()), _step; !(_step = _iterator()).done;){
|
|
19316
|
+
var subTrack = _step.value;
|
|
19317
|
+
subTrack.binding = subTrack.resolveBinding(track.binding);
|
|
19318
|
+
this.resolveTrackBindingsWithRoot(subTrack);
|
|
19319
|
+
}
|
|
19320
|
+
};
|
|
19321
|
+
return CompositionComponent;
|
|
19322
|
+
}(ItemBehaviour);
|
|
19323
|
+
|
|
19324
|
+
var SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
19325
|
+
_inherits(SubCompositionTrack, TrackAsset);
|
|
19326
|
+
function SubCompositionTrack() {
|
|
19327
|
+
return TrackAsset.apply(this, arguments);
|
|
19328
|
+
}
|
|
19329
|
+
var _proto = SubCompositionTrack.prototype;
|
|
19330
|
+
_proto.resolveBinding = function resolveBinding(parentBinding) {
|
|
19331
|
+
if (!_instanceof1(parentBinding, VFXItem)) {
|
|
19332
|
+
throw new Error("SubCompositionTrack needs to be set under the VFXItem track");
|
|
19333
|
+
}
|
|
19334
|
+
return parentBinding.getComponent(CompositionComponent);
|
|
19335
|
+
};
|
|
19336
|
+
return SubCompositionTrack;
|
|
19337
|
+
}(TrackAsset);
|
|
19338
|
+
SubCompositionTrack = __decorate([
|
|
19339
|
+
effectsClass("SubCompositionTrack")
|
|
19340
|
+
], SubCompositionTrack);
|
|
19341
|
+
|
|
19342
|
+
var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
19343
|
+
_inherits(SubCompositionClipPlayable, Playable);
|
|
19344
|
+
function SubCompositionClipPlayable() {
|
|
19345
|
+
return Playable.apply(this, arguments);
|
|
19346
|
+
}
|
|
19347
|
+
var _proto = SubCompositionClipPlayable.prototype;
|
|
19348
|
+
_proto.processFrame = function processFrame(context) {
|
|
19349
|
+
var boundObject = context.output.getUserData();
|
|
19350
|
+
boundObject.time = this.getTime();
|
|
19351
|
+
};
|
|
19352
|
+
return SubCompositionClipPlayable;
|
|
19353
|
+
}(Playable);
|
|
19354
|
+
|
|
19355
|
+
var SubCompositionPlayableAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
19356
|
+
_inherits(SubCompositionPlayableAsset, PlayableAsset);
|
|
19357
|
+
function SubCompositionPlayableAsset() {
|
|
19358
|
+
return PlayableAsset.apply(this, arguments);
|
|
19359
|
+
}
|
|
19360
|
+
var _proto = SubCompositionPlayableAsset.prototype;
|
|
19361
|
+
_proto.createPlayable = function createPlayable(graph) {
|
|
19362
|
+
return new SubCompositionClipPlayable(graph);
|
|
19363
|
+
};
|
|
19364
|
+
return SubCompositionPlayableAsset;
|
|
19365
|
+
}(PlayableAsset);
|
|
19366
|
+
SubCompositionPlayableAsset = __decorate([
|
|
19367
|
+
effectsClass("SubCompositionPlayableAsset")
|
|
19368
|
+
], SubCompositionPlayableAsset);
|
|
19369
|
+
|
|
19370
|
+
function _possible_constructor_return(self, call) {
|
|
19371
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
|
|
19372
|
+
return _assert_this_initialized(self);
|
|
19373
|
+
}
|
|
19374
|
+
|
|
19375
|
+
var TextLayout = /*#__PURE__*/ function() {
|
|
19376
|
+
function TextLayout(options) {
|
|
19377
|
+
this.width = 0;
|
|
19378
|
+
this.height = 0;
|
|
19379
|
+
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;
|
|
19380
|
+
var tempWidth = fontSize + letterSpace;
|
|
19381
|
+
this.autoWidth = autoWidth;
|
|
19382
|
+
this.maxTextWidth = text.length * tempWidth;
|
|
19383
|
+
// if (autoWidth) {
|
|
19384
|
+
// this.width = this.maxTextWidth + this.lineWidth;
|
|
19385
|
+
// this.height = fontSize + this.lineHeight;
|
|
19386
|
+
// } else {
|
|
19387
|
+
// if (textWidth) {
|
|
19388
|
+
// this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
|
|
19389
|
+
// this.width = textWidth;
|
|
19390
|
+
// } else {
|
|
19391
|
+
// this.width = basicScale[0] * 100;
|
|
19392
|
+
// }
|
|
19393
|
+
// this.height = basicScale[1] * 100;
|
|
19394
|
+
// }
|
|
19395
|
+
this.width = textWidth;
|
|
19396
|
+
this.height = textHeight;
|
|
19397
|
+
this.letterSpace = letterSpace;
|
|
19398
|
+
this.overFlow = textOverflow;
|
|
19399
|
+
this.textBaseline = textBaseline;
|
|
19400
|
+
this.textAlign = textAlign;
|
|
19401
|
+
this.lineHeight = lineHeight;
|
|
19402
|
+
}
|
|
19403
|
+
var _proto = TextLayout.prototype;
|
|
19404
|
+
_proto.getOffsetY = function getOffsetY(style) {
|
|
19405
|
+
var offsetY = 0;
|
|
19406
|
+
var offset = (style.fontSize + style.outlineWidth) * style.fontScale;
|
|
19407
|
+
switch(this.textBaseline){
|
|
19408
|
+
case TextBaseline.top:
|
|
19409
|
+
offsetY = offset;
|
|
19410
|
+
break;
|
|
19411
|
+
case TextBaseline.middle:
|
|
19412
|
+
offsetY = (this.height + offset) / 2; // fonSize;
|
|
19413
|
+
break;
|
|
19414
|
+
case TextBaseline.bottom:
|
|
19415
|
+
offsetY = this.height - offset / 2;
|
|
19416
|
+
break;
|
|
19417
|
+
}
|
|
19418
|
+
return offsetY;
|
|
19419
|
+
};
|
|
19420
|
+
_proto.getOffsetX = function getOffsetX(style, maxWidth) {
|
|
19421
|
+
var offsetX = 0;
|
|
19422
|
+
switch(this.textAlign){
|
|
19423
|
+
case TextAlignment.left:
|
|
19424
|
+
offsetX = style.outlineWidth * style.fontScale;
|
|
19425
|
+
break;
|
|
19426
|
+
case TextAlignment.middle:
|
|
19427
|
+
offsetX = (this.width * style.fontScale - maxWidth) / 2;
|
|
19428
|
+
break;
|
|
19429
|
+
case TextAlignment.right:
|
|
19430
|
+
offsetX = this.width * style.fontScale - maxWidth;
|
|
19431
|
+
break;
|
|
19432
|
+
}
|
|
19433
|
+
return offsetX;
|
|
19434
|
+
};
|
|
19435
|
+
/**
|
|
19436
|
+
* 设置文本框的宽度和高度
|
|
19437
|
+
* @param width 文本框宽度
|
|
19438
|
+
* @param height 文本框高度
|
|
19439
|
+
*/ _proto.setSize = function setSize(width, height) {
|
|
19440
|
+
this.width = width;
|
|
19441
|
+
this.height = height;
|
|
19442
|
+
};
|
|
19443
|
+
return TextLayout;
|
|
19444
|
+
}();
|
|
19445
|
+
|
|
19446
|
+
var TextStyle = function TextStyle(options) {
|
|
19447
|
+
/**
|
|
19448
|
+
* 是否有下划线(暂时无效)
|
|
19449
|
+
*/ this.isUnderline = false // ttf
|
|
19450
|
+
;
|
|
19451
|
+
/**
|
|
19452
|
+
* 下划线高度(暂时无效)
|
|
19177
19453
|
*/ this.underlineHeight = 1 // ttf
|
|
19178
19454
|
;
|
|
19179
19455
|
/**
|
|
@@ -20670,6 +20946,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20670
20946
|
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
20671
20947
|
return _instanceof1(value, Object) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
20672
20948
|
};
|
|
20949
|
+
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
20950
|
+
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
20951
|
+
};
|
|
20673
20952
|
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
|
|
20674
20953
|
if (level > 14) {
|
|
20675
20954
|
console.error("序列化数据的内嵌对象层数大于上限");
|
|
@@ -20687,7 +20966,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20687
20966
|
// TODO json 数据避免传 typedArray
|
|
20688
20967
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
20689
20968
|
return engine.assetLoader.loadGUID(property.id);
|
|
20690
|
-
} else if (_instanceof1(property, EffectsObject) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
20969
|
+
} else if (_instanceof1(property, EffectsObject) || SerializationHelper.checkImageSource(property) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
20691
20970
|
return property;
|
|
20692
20971
|
} else if (_instanceof1(property, Object)) {
|
|
20693
20972
|
var res1;
|
|
@@ -20775,7 +21054,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20775
21054
|
res1
|
|
20776
21055
|
];
|
|
20777
21056
|
case 8:
|
|
20778
|
-
if (_instanceof1(property, EffectsObject) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
21057
|
+
if (_instanceof1(property, EffectsObject) || SerializationHelper.checkImageSource(property) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
20779
21058
|
return [
|
|
20780
21059
|
2,
|
|
20781
21060
|
property
|
|
@@ -20898,9 +21177,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20898
21177
|
effectsObject = Geometry.create(this.engine);
|
|
20899
21178
|
break;
|
|
20900
21179
|
case DataType.Texture:
|
|
20901
|
-
|
|
20902
|
-
|
|
20903
|
-
return effectsObject;
|
|
21180
|
+
effectsObject = Texture.create(this.engine);
|
|
21181
|
+
break;
|
|
20904
21182
|
default:
|
|
20905
21183
|
{
|
|
20906
21184
|
var classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
@@ -20971,12 +21249,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20971
21249
|
effectsObject = Geometry.create(_this.engine);
|
|
20972
21250
|
break;
|
|
20973
21251
|
case DataType.Texture:
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
return [
|
|
20977
|
-
2,
|
|
20978
|
-
effectsObject
|
|
20979
|
-
];
|
|
21252
|
+
effectsObject = Texture.create(_this.engine);
|
|
21253
|
+
break;
|
|
20980
21254
|
default:
|
|
20981
21255
|
{
|
|
20982
21256
|
classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
@@ -21896,8 +22170,15 @@ function getStandardCameraContent(model) {
|
|
|
21896
22170
|
id: item.id
|
|
21897
22171
|
};
|
|
21898
22172
|
});
|
|
22173
|
+
var compositionData = _extends({}, composition, {
|
|
22174
|
+
timelineAsset: {
|
|
22175
|
+
id: ""
|
|
22176
|
+
},
|
|
22177
|
+
sceneBindings: []
|
|
22178
|
+
});
|
|
22179
|
+
result.compositions.push(compositionData);
|
|
21899
22180
|
// 生成时间轴数据
|
|
21900
|
-
convertTimelineAsset(
|
|
22181
|
+
convertTimelineAsset(compositionData, guidToItemMap, result);
|
|
21901
22182
|
};
|
|
21902
22183
|
var // 更正 spine 数据中的 images 属性
|
|
21903
22184
|
_json_spines;
|
|
@@ -21905,6 +22186,7 @@ function getStandardCameraContent(model) {
|
|
|
21905
22186
|
_result;
|
|
21906
22187
|
var result = _extends({}, json, {
|
|
21907
22188
|
items: [],
|
|
22189
|
+
compositions: [],
|
|
21908
22190
|
components: [],
|
|
21909
22191
|
materials: [],
|
|
21910
22192
|
shaders: [],
|
|
@@ -22061,7 +22343,7 @@ function getStandardCameraContent(model) {
|
|
|
22061
22343
|
content1.renderer.anchor = convertAnchor(renderer1.anchor, renderer1.particleOrigin);
|
|
22062
22344
|
}
|
|
22063
22345
|
// 修复相机K帧缺失 asMovement 参数
|
|
22064
|
-
if (item.type === ItemType.camera) {
|
|
22346
|
+
if (item.type === ItemType.camera && item.content.positionOverLifetime && Object.keys(item.content.positionOverLifetime).length !== 0) {
|
|
22065
22347
|
item.content.positionOverLifetime.asMovement = true;
|
|
22066
22348
|
}
|
|
22067
22349
|
// 动画数据转化 TODO: 动画数据移到 TimelineComponentData
|
|
@@ -22114,10 +22396,7 @@ function getStandardCameraContent(model) {
|
|
|
22114
22396
|
item.type = "orientation-transformer";
|
|
22115
22397
|
}
|
|
22116
22398
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22117
|
-
if (item.type === ItemType.sprite || item.type === ItemType.particle || item.type === ItemType.mesh || item.type === ItemType.skybox || item.type === ItemType.light ||
|
|
22118
|
-
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
|
|
22119
|
-
item.type === "editor-gizmo" || // @ts-expect-error
|
|
22120
|
-
item.type === "orientation-transformer") {
|
|
22399
|
+
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") {
|
|
22121
22400
|
item.components = [];
|
|
22122
22401
|
result.components.push(item.content);
|
|
22123
22402
|
item.content.id = generateGUID();
|
|
@@ -22149,15 +22428,12 @@ function getStandardCameraContent(model) {
|
|
|
22149
22428
|
case ItemType.light:
|
|
22150
22429
|
item.content.dataType = DataType.LightComponent;
|
|
22151
22430
|
break;
|
|
22152
|
-
// @ts-expect-error
|
|
22153
22431
|
case "camera":
|
|
22154
22432
|
item.content.dataType = DataType.CameraComponent;
|
|
22155
22433
|
break;
|
|
22156
|
-
// @ts-expect-error
|
|
22157
22434
|
case "editor-gizmo":
|
|
22158
22435
|
item.content.dataType = "GizmoComponent";
|
|
22159
22436
|
break;
|
|
22160
|
-
// @ts-expect-error
|
|
22161
22437
|
case "orientation-transformer":
|
|
22162
22438
|
item.content.dataType = "OrientationComponent";
|
|
22163
22439
|
break;
|
|
@@ -22226,8 +22502,32 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22226
22502
|
var itemDataPath = _step.value;
|
|
22227
22503
|
var item = guidToItemMap[itemDataPath.id];
|
|
22228
22504
|
var subTrackDatas = [];
|
|
22505
|
+
var newActivationPlayableAsset = {
|
|
22506
|
+
id: generateGUID(),
|
|
22507
|
+
dataType: "ActivationPlayableAsset"
|
|
22508
|
+
};
|
|
22509
|
+
playableAssetDatas.push(newActivationPlayableAsset);
|
|
22510
|
+
var newActivationTrackData = {
|
|
22511
|
+
id: generateGUID(),
|
|
22512
|
+
dataType: "ActivationTrack",
|
|
22513
|
+
children: [],
|
|
22514
|
+
clips: [
|
|
22515
|
+
{
|
|
22516
|
+
start: item.delay,
|
|
22517
|
+
duration: item.duration,
|
|
22518
|
+
endBehaviour: item.endBehavior,
|
|
22519
|
+
asset: {
|
|
22520
|
+
id: newActivationPlayableAsset.id
|
|
22521
|
+
}
|
|
22522
|
+
}
|
|
22523
|
+
]
|
|
22524
|
+
};
|
|
22525
|
+
subTrackDatas.push({
|
|
22526
|
+
id: newActivationTrackData.id
|
|
22527
|
+
});
|
|
22528
|
+
trackDatas.push(newActivationTrackData);
|
|
22229
22529
|
if (item.type !== ItemType.particle) {
|
|
22230
|
-
var
|
|
22530
|
+
var newTransformPlayableAssetData = {
|
|
22231
22531
|
id: generateGUID(),
|
|
22232
22532
|
dataType: "TransformPlayableAsset",
|
|
22233
22533
|
//@ts-expect-error
|
|
@@ -22237,15 +22537,18 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22237
22537
|
//@ts-expect-error
|
|
22238
22538
|
positionOverLifetime: item.content.positionOverLifetime
|
|
22239
22539
|
};
|
|
22240
|
-
playableAssetDatas.push(
|
|
22540
|
+
playableAssetDatas.push(newTransformPlayableAssetData);
|
|
22241
22541
|
var newTrackData = {
|
|
22242
22542
|
id: generateGUID(),
|
|
22243
22543
|
dataType: "TransformTrack",
|
|
22244
22544
|
children: [],
|
|
22245
22545
|
clips: [
|
|
22246
22546
|
{
|
|
22547
|
+
start: item.delay,
|
|
22548
|
+
duration: item.duration,
|
|
22549
|
+
endBehaviour: item.endBehavior,
|
|
22247
22550
|
asset: {
|
|
22248
|
-
id:
|
|
22551
|
+
id: newTransformPlayableAssetData.id
|
|
22249
22552
|
}
|
|
22250
22553
|
}
|
|
22251
22554
|
]
|
|
@@ -22256,21 +22559,24 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22256
22559
|
trackDatas.push(newTrackData);
|
|
22257
22560
|
}
|
|
22258
22561
|
if (item.type === ItemType.sprite) {
|
|
22259
|
-
var
|
|
22562
|
+
var newSpriteColorPlayableAssetData = {
|
|
22260
22563
|
id: generateGUID(),
|
|
22261
22564
|
dataType: "SpriteColorPlayableAsset",
|
|
22262
22565
|
colorOverLifetime: item.content.colorOverLifetime,
|
|
22263
22566
|
startColor: item.content.options.startColor
|
|
22264
22567
|
};
|
|
22265
|
-
playableAssetDatas.push(
|
|
22568
|
+
playableAssetDatas.push(newSpriteColorPlayableAssetData);
|
|
22266
22569
|
var newTrackData1 = {
|
|
22267
22570
|
id: generateGUID(),
|
|
22268
22571
|
dataType: "SpriteColorTrack",
|
|
22269
22572
|
children: [],
|
|
22270
22573
|
clips: [
|
|
22271
22574
|
{
|
|
22575
|
+
start: item.delay,
|
|
22576
|
+
duration: item.duration,
|
|
22577
|
+
endBehaviour: item.endBehavior,
|
|
22272
22578
|
asset: {
|
|
22273
|
-
id:
|
|
22579
|
+
id: newSpriteColorPlayableAssetData.id
|
|
22274
22580
|
}
|
|
22275
22581
|
}
|
|
22276
22582
|
]
|
|
@@ -22280,6 +22586,32 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22280
22586
|
});
|
|
22281
22587
|
trackDatas.push(newTrackData1);
|
|
22282
22588
|
}
|
|
22589
|
+
if (item.type === ItemType.composition) {
|
|
22590
|
+
var newSubCompositionPlayableAssetData = {
|
|
22591
|
+
id: generateGUID(),
|
|
22592
|
+
dataType: "SubCompositionPlayableAsset"
|
|
22593
|
+
};
|
|
22594
|
+
playableAssetDatas.push(newSubCompositionPlayableAssetData);
|
|
22595
|
+
var newTrackData2 = {
|
|
22596
|
+
id: generateGUID(),
|
|
22597
|
+
dataType: "SubCompositionTrack",
|
|
22598
|
+
children: [],
|
|
22599
|
+
clips: [
|
|
22600
|
+
{
|
|
22601
|
+
start: item.delay,
|
|
22602
|
+
duration: item.duration,
|
|
22603
|
+
endBehaviour: item.endBehavior,
|
|
22604
|
+
asset: {
|
|
22605
|
+
id: newSubCompositionPlayableAssetData.id
|
|
22606
|
+
}
|
|
22607
|
+
}
|
|
22608
|
+
]
|
|
22609
|
+
};
|
|
22610
|
+
subTrackDatas.push({
|
|
22611
|
+
id: newTrackData2.id
|
|
22612
|
+
});
|
|
22613
|
+
trackDatas.push(newTrackData2);
|
|
22614
|
+
}
|
|
22283
22615
|
var bindingTrackData = {
|
|
22284
22616
|
id: generateGUID(),
|
|
22285
22617
|
dataType: "ObjectBindingTrack",
|
|
@@ -22306,11 +22638,9 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22306
22638
|
id: trackData.id
|
|
22307
22639
|
});
|
|
22308
22640
|
}
|
|
22309
|
-
//@ts-expect-error
|
|
22310
22641
|
composition.timelineAsset = {
|
|
22311
22642
|
id: timelineAssetData.id
|
|
22312
22643
|
};
|
|
22313
|
-
//@ts-expect-error
|
|
22314
22644
|
composition.sceneBindings = sceneBindings;
|
|
22315
22645
|
if (!jsonScene.animations) {
|
|
22316
22646
|
jsonScene.animations = [];
|
|
@@ -23555,42 +23885,6 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
23555
23885
|
}
|
|
23556
23886
|
throw new Error("Invalid texture options");
|
|
23557
23887
|
}
|
|
23558
|
-
function base64ToFile(base64, filename, contentType) {
|
|
23559
|
-
if (filename === void 0) filename = "base64File";
|
|
23560
|
-
if (contentType === void 0) contentType = "";
|
|
23561
|
-
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
23562
|
-
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
23563
|
-
// 将 base64 编码的字符串转换为二进制字符串
|
|
23564
|
-
var byteCharacters = atob(base64WithoutPrefix);
|
|
23565
|
-
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
23566
|
-
var byteArrays = [];
|
|
23567
|
-
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
23568
|
-
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
23569
|
-
var slice = byteCharacters.slice(offset, offset + 512);
|
|
23570
|
-
var byteNumbers = new Array(slice.length);
|
|
23571
|
-
for(var i = 0; i < slice.length; i++){
|
|
23572
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
23573
|
-
}
|
|
23574
|
-
var byteArray = new Uint8Array(byteNumbers);
|
|
23575
|
-
byteArrays.push(byteArray);
|
|
23576
|
-
}
|
|
23577
|
-
// 使用字节数组创建 Blob 对象
|
|
23578
|
-
var blob = new Blob(byteArrays, {
|
|
23579
|
-
type: contentType
|
|
23580
|
-
});
|
|
23581
|
-
// 创建 File 对象
|
|
23582
|
-
var file = new File([
|
|
23583
|
-
blob
|
|
23584
|
-
], filename, {
|
|
23585
|
-
type: contentType
|
|
23586
|
-
});
|
|
23587
|
-
return file;
|
|
23588
|
-
}
|
|
23589
|
-
function isCanvas(canvas) {
|
|
23590
|
-
var _canvas_tagName;
|
|
23591
|
-
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
23592
|
-
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
23593
|
-
}
|
|
23594
23888
|
|
|
23595
23889
|
var tmpScale = new Vector3(1, 1, 1);
|
|
23596
23890
|
/**
|
|
@@ -23868,257 +24162,213 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23868
24162
|
return Camera;
|
|
23869
24163
|
}();
|
|
23870
24164
|
|
|
24165
|
+
var listOrder = 0;
|
|
23871
24166
|
/**
|
|
23872
|
-
*
|
|
23873
|
-
|
|
23874
|
-
|
|
23875
|
-
|
|
23876
|
-
|
|
23877
|
-
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
|
|
23887
|
-
|
|
24167
|
+
* 合成资源管理
|
|
24168
|
+
*/ var CompositionSourceManager = /*#__PURE__*/ function() {
|
|
24169
|
+
function CompositionSourceManager(scene, engine) {
|
|
24170
|
+
this.refCompositions = new Map();
|
|
24171
|
+
this.refCompositionProps = new Map();
|
|
24172
|
+
this.mask = 0;
|
|
24173
|
+
this.engine = engine;
|
|
24174
|
+
// 资源
|
|
24175
|
+
var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
|
|
24176
|
+
var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
|
|
24177
|
+
if (!textureOptions) {
|
|
24178
|
+
throw new Error("scene.textures expected");
|
|
24179
|
+
}
|
|
24180
|
+
var cachedTextures = textureOptions;
|
|
24181
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
|
|
24182
|
+
var comp = _step.value;
|
|
24183
|
+
if (comp.id === compositionId) {
|
|
24184
|
+
this.composition = comp;
|
|
24185
|
+
} else {
|
|
24186
|
+
this.refCompositions.set(comp.id, comp);
|
|
24187
|
+
}
|
|
24188
|
+
}
|
|
24189
|
+
if (!this.composition) {
|
|
24190
|
+
throw new Error("Invalid composition id: " + compositionId);
|
|
24191
|
+
}
|
|
24192
|
+
this.jsonScene = jsonScene;
|
|
24193
|
+
this.renderLevel = renderLevel;
|
|
24194
|
+
this.pluginSystem = pluginSystem;
|
|
24195
|
+
this.totalTime = totalTime != null ? totalTime : 0;
|
|
24196
|
+
this.imgUsage = imgUsage != null ? imgUsage : {};
|
|
24197
|
+
this.textures = cachedTextures;
|
|
24198
|
+
listOrder = 0;
|
|
24199
|
+
this.sourceContent = this.getContent(this.composition);
|
|
23888
24200
|
}
|
|
23889
|
-
var _proto =
|
|
23890
|
-
_proto.
|
|
23891
|
-
|
|
23892
|
-
|
|
23893
|
-
|
|
23894
|
-
|
|
23895
|
-
|
|
23896
|
-
|
|
24201
|
+
var _proto = CompositionSourceManager.prototype;
|
|
24202
|
+
_proto.getContent = function getContent(composition) {
|
|
24203
|
+
// TODO: specification 中补充 globalVolume 类型
|
|
24204
|
+
// @ts-expect-error
|
|
24205
|
+
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;
|
|
24206
|
+
var items = this.assembleItems(composition);
|
|
24207
|
+
return _extends({}, composition, {
|
|
24208
|
+
id: id,
|
|
24209
|
+
duration: duration,
|
|
24210
|
+
name: name,
|
|
24211
|
+
endBehavior: isNaN(endBehavior) ? END_BEHAVIOR_PAUSE : endBehavior,
|
|
24212
|
+
// looping,
|
|
24213
|
+
items: items,
|
|
24214
|
+
camera: camera,
|
|
24215
|
+
startTime: startTime,
|
|
24216
|
+
globalVolume: globalVolume
|
|
24217
|
+
});
|
|
24218
|
+
};
|
|
24219
|
+
_proto.assembleItems = function assembleItems(composition) {
|
|
24220
|
+
var _this = this;
|
|
24221
|
+
var items = [];
|
|
24222
|
+
this.mask++;
|
|
24223
|
+
var componentMap = {};
|
|
24224
|
+
//@ts-expect-error
|
|
24225
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.jsonScene.components), _step; !(_step = _iterator()).done;){
|
|
24226
|
+
var component = _step.value;
|
|
24227
|
+
componentMap[component.id] = component;
|
|
23897
24228
|
}
|
|
23898
|
-
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
|
|
23902
|
-
var
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
24229
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(composition.items), _step1; !(_step1 = _iterator1()).done;){
|
|
24230
|
+
var itemDataPath = _step1.value;
|
|
24231
|
+
//@ts-expect-error
|
|
24232
|
+
var sourceItemData = this.engine.jsonSceneData[itemDataPath.id];
|
|
24233
|
+
var itemProps = sourceItemData;
|
|
24234
|
+
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
24235
|
+
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
24236
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
24237
|
+
var componentPath = _step2.value;
|
|
24238
|
+
var componentData = componentMap[componentPath.id];
|
|
24239
|
+
this.preProcessItemContent(componentData);
|
|
24240
|
+
}
|
|
24241
|
+
} else {
|
|
24242
|
+
var renderContent = itemProps.content;
|
|
24243
|
+
if (renderContent) {
|
|
24244
|
+
this.preProcessItemContent(renderContent);
|
|
24245
|
+
}
|
|
23907
24246
|
}
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
24247
|
+
itemProps.listIndex = listOrder++;
|
|
24248
|
+
// 处理预合成的渲染顺序
|
|
24249
|
+
if (itemProps.type === ItemType.composition) {
|
|
24250
|
+
var refId = sourceItemData.content.options.refId;
|
|
24251
|
+
if (!this.refCompositions.get(refId)) {
|
|
24252
|
+
throw new Error("Invalid Ref Composition id: " + refId);
|
|
24253
|
+
}
|
|
24254
|
+
var ref = this.getContent(this.refCompositions.get(refId));
|
|
24255
|
+
if (!this.refCompositionProps.has(refId)) {
|
|
24256
|
+
this.refCompositionProps.set(refId, ref);
|
|
24257
|
+
}
|
|
24258
|
+
ref.items.forEach(function(item) {
|
|
24259
|
+
_this.processMask(item.content);
|
|
24260
|
+
});
|
|
24261
|
+
itemProps.items = ref.items;
|
|
23911
24262
|
}
|
|
24263
|
+
items.push(itemProps);
|
|
23912
24264
|
}
|
|
23913
|
-
this.masterTracks.push(track);
|
|
23914
|
-
}
|
|
23915
|
-
};
|
|
23916
|
-
_proto.initializeTrackBindings = function initializeTrackBindings(masterTracks) {
|
|
23917
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(masterTracks), _step; !(_step = _iterator()).done;){
|
|
23918
|
-
var track = _step.value;
|
|
23919
|
-
track.initializeBindingRecursive(track.binding);
|
|
23920
24265
|
}
|
|
24266
|
+
return items;
|
|
23921
24267
|
};
|
|
23922
|
-
_proto.
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
|
|
23931
|
-
|
|
23932
|
-
|
|
23933
|
-
if (
|
|
23934
|
-
|
|
23935
|
-
subCompostionComponent.time = subCompositionTrack.toLocalTime(time);
|
|
24268
|
+
_proto.preProcessItemContent = function preProcessItemContent(renderContent) {
|
|
24269
|
+
if (renderContent.renderer) {
|
|
24270
|
+
renderContent.renderer = this.changeTex(renderContent.renderer);
|
|
24271
|
+
if (!renderContent.renderer.mask) {
|
|
24272
|
+
this.processMask(renderContent.renderer);
|
|
24273
|
+
}
|
|
24274
|
+
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
24275
|
+
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
24276
|
+
var _this_jsonScene;
|
|
24277
|
+
// TODO: scene.shapes 类型问题?
|
|
24278
|
+
renderContent.renderer.shape = getGeometryByShape((_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[renderContent.renderer.shape], split);
|
|
24279
|
+
} else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
|
|
24280
|
+
renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
|
|
23936
24281
|
}
|
|
23937
24282
|
}
|
|
24283
|
+
if (renderContent.trails) {
|
|
24284
|
+
renderContent.trails = this.changeTex(renderContent.trails);
|
|
24285
|
+
}
|
|
23938
24286
|
};
|
|
23939
|
-
|
|
23940
|
-
|
|
23941
|
-
|
|
23942
|
-
this.item.ended = false;
|
|
23943
|
-
};
|
|
23944
|
-
_proto.createContent = function createContent() {
|
|
23945
|
-
var sceneBindings = [];
|
|
23946
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.data.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
23947
|
-
var sceneBindingData = _step.value;
|
|
23948
|
-
sceneBindings.push({
|
|
23949
|
-
key: this.engine.assetLoader.loadGUID(sceneBindingData.key.id),
|
|
23950
|
-
value: this.engine.assetLoader.loadGUID(sceneBindingData.value.id)
|
|
23951
|
-
});
|
|
24287
|
+
_proto.changeTex = function changeTex(renderer) {
|
|
24288
|
+
if (!renderer.texture) {
|
|
24289
|
+
return renderer;
|
|
23952
24290
|
}
|
|
23953
|
-
|
|
23954
|
-
var
|
|
23955
|
-
|
|
23956
|
-
|
|
23957
|
-
|
|
23958
|
-
if (this.item.composition) {
|
|
23959
|
-
var assetLoader = this.item.engine.assetLoader;
|
|
23960
|
-
var itemProps = this.item.props.items ? this.item.props.items : [];
|
|
23961
|
-
for(var i = 0; i < itemProps.length; i++){
|
|
23962
|
-
var item = void 0;
|
|
23963
|
-
var itemData = itemProps[i];
|
|
23964
|
-
// 设置预合成作为元素时的时长、结束行为和渲染延时
|
|
23965
|
-
if (Item.isComposition(itemData)) {
|
|
23966
|
-
var refId = itemData.content.options.refId;
|
|
23967
|
-
var props = this.item.composition.refCompositionProps.get(refId);
|
|
23968
|
-
if (!props) {
|
|
23969
|
-
throw new Error("引用的Id: " + refId + " 的预合成不存在");
|
|
23970
|
-
}
|
|
23971
|
-
// endBehaviour 类型需优化
|
|
23972
|
-
props.content = itemData.content;
|
|
23973
|
-
item = assetLoader.loadGUID(itemData.id);
|
|
23974
|
-
item.composition = this.item.composition;
|
|
23975
|
-
var compositionComponent = item.addComponent(CompositionComponent);
|
|
23976
|
-
compositionComponent.data = props;
|
|
23977
|
-
compositionComponent.refId = refId;
|
|
23978
|
-
item.transform.parentTransform = this.transform;
|
|
23979
|
-
this.item.composition.refContent.push(item);
|
|
23980
|
-
if (item.endBehavior === ItemEndBehavior.loop) {
|
|
23981
|
-
this.item.composition.autoRefTex = false;
|
|
23982
|
-
}
|
|
23983
|
-
compositionComponent.createContent();
|
|
23984
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositionComponent.items), _step1; !(_step1 = _iterator1()).done;){
|
|
23985
|
-
var vfxItem = _step1.value;
|
|
23986
|
-
vfxItem.setInstanceId(generateGUID());
|
|
23987
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
23988
|
-
var component = _step2.value;
|
|
23989
|
-
component.setInstanceId(generateGUID());
|
|
23990
|
-
}
|
|
23991
|
-
}
|
|
23992
|
-
} else {
|
|
23993
|
-
item = assetLoader.loadGUID(itemData.id);
|
|
23994
|
-
item.composition = this.item.composition;
|
|
23995
|
-
}
|
|
23996
|
-
item.parent = this.item;
|
|
23997
|
-
// 相机不跟随合成移动
|
|
23998
|
-
item.transform.parentTransform = itemData.type === ItemType.camera ? new Transform() : this.transform;
|
|
23999
|
-
if (VFXItem.isExtraCamera(item)) {
|
|
24000
|
-
this.item.composition.extraCamera = item;
|
|
24001
|
-
}
|
|
24002
|
-
items.push(item);
|
|
24003
|
-
}
|
|
24291
|
+
//@ts-expect-error
|
|
24292
|
+
var texIdx = renderer.texture.id;
|
|
24293
|
+
if (texIdx !== undefined) {
|
|
24294
|
+
//@ts-expect-error
|
|
24295
|
+
this.addTextureUsage(texIdx) || texIdx;
|
|
24004
24296
|
}
|
|
24297
|
+
return renderer;
|
|
24005
24298
|
};
|
|
24006
|
-
_proto.
|
|
24007
|
-
|
|
24008
|
-
|
|
24009
|
-
|
|
24010
|
-
|
|
24011
|
-
|
|
24012
|
-
|
|
24299
|
+
_proto.addTextureUsage = function addTextureUsage(texIdx) {
|
|
24300
|
+
var texId = texIdx;
|
|
24301
|
+
var _this_imgUsage;
|
|
24302
|
+
// FIXME: imageUsage 取自 scene.imgUsage,类型为 Record<string, number[]>,这里给的 number,类型对不上
|
|
24303
|
+
var imageUsage = (_this_imgUsage = this.imgUsage) != null ? _this_imgUsage : {};
|
|
24304
|
+
if (texId && imageUsage) {
|
|
24305
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
24306
|
+
if (!imageUsage.hasOwnProperty(texId)) {
|
|
24307
|
+
imageUsage[texId] = 0;
|
|
24013
24308
|
}
|
|
24309
|
+
imageUsage[texId]++;
|
|
24014
24310
|
}
|
|
24015
24311
|
};
|
|
24016
|
-
|
|
24017
|
-
|
|
24018
|
-
|
|
24019
|
-
|
|
24020
|
-
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
|
|
24024
|
-
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
24029
|
-
success = true;
|
|
24030
|
-
hitPositions.push(intersectPoint);
|
|
24031
|
-
break;
|
|
24032
|
-
}
|
|
24033
|
-
}
|
|
24034
|
-
} else if (hitParams.type === HitTestType.box) {
|
|
24035
|
-
var center = hitParams.center, size = hitParams.size;
|
|
24036
|
-
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
24037
|
-
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
24038
|
-
if (ray.intersectBox({
|
|
24039
|
-
min: boxMin,
|
|
24040
|
-
max: boxMax
|
|
24041
|
-
}, intersectPoint)) {
|
|
24042
|
-
success = true;
|
|
24043
|
-
hitPositions.push(intersectPoint);
|
|
24044
|
-
}
|
|
24045
|
-
} else if (hitParams.type === HitTestType.sphere) {
|
|
24046
|
-
var center1 = hitParams.center, radius = hitParams.radius;
|
|
24047
|
-
if (ray.intersectSphere({
|
|
24048
|
-
center: center1,
|
|
24049
|
-
radius: radius
|
|
24050
|
-
}, intersectPoint)) {
|
|
24051
|
-
success = true;
|
|
24052
|
-
hitPositions.push(intersectPoint);
|
|
24053
|
-
}
|
|
24054
|
-
} else if (hitParams.type === HitTestType.custom) {
|
|
24055
|
-
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
24056
|
-
if (tempPosition && tempPosition.length > 0) {
|
|
24057
|
-
tempPosition.forEach(function(pos) {
|
|
24058
|
-
hitPositions.push(pos);
|
|
24059
|
-
});
|
|
24060
|
-
success = true;
|
|
24061
|
-
}
|
|
24062
|
-
}
|
|
24063
|
-
if (success) {
|
|
24064
|
-
var region = {
|
|
24065
|
-
compContent: _this.item,
|
|
24066
|
-
id: item.id,
|
|
24067
|
-
name: item.name,
|
|
24068
|
-
position: hitPositions[hitPositions.length - 1],
|
|
24069
|
-
parentId: item.parentId,
|
|
24070
|
-
hitPositions: hitPositions,
|
|
24071
|
-
behavior: hitParams.behavior
|
|
24072
|
-
};
|
|
24073
|
-
regions.push(region);
|
|
24074
|
-
if (stop(region)) {
|
|
24075
|
-
return {
|
|
24076
|
-
v: regions
|
|
24077
|
-
};
|
|
24078
|
-
}
|
|
24079
|
-
}
|
|
24080
|
-
}
|
|
24312
|
+
/**
|
|
24313
|
+
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
24314
|
+
*/ _proto.processMask = function processMask(renderer) {
|
|
24315
|
+
var maskMode = renderer.maskMode;
|
|
24316
|
+
if (maskMode === MaskMode.NONE) {
|
|
24317
|
+
return;
|
|
24318
|
+
}
|
|
24319
|
+
if (!renderer.mask) {
|
|
24320
|
+
if (maskMode === MaskMode.MASK) {
|
|
24321
|
+
renderer.mask = ++this.mask;
|
|
24322
|
+
} else if (maskMode === MaskMode.OBSCURED || maskMode === MaskMode.REVERSE_OBSCURED) {
|
|
24323
|
+
renderer.mask = this.mask;
|
|
24081
24324
|
}
|
|
24082
|
-
};
|
|
24083
|
-
var hitPositions = [];
|
|
24084
|
-
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
24085
|
-
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
24086
|
-
var maxCount = (options == null ? void 0 : options.maxCount) || this.items.length;
|
|
24087
|
-
for(var i = 0; i < this.items.length && regions.length < maxCount; i++){
|
|
24088
|
-
var _ret = (_this = this, _loop(i));
|
|
24089
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
24090
24325
|
}
|
|
24091
|
-
return regions;
|
|
24092
24326
|
};
|
|
24093
|
-
_proto.
|
|
24094
|
-
|
|
24327
|
+
_proto.dispose = function dispose() {
|
|
24328
|
+
this.textures = [];
|
|
24329
|
+
this.composition = undefined;
|
|
24330
|
+
this.jsonScene = undefined;
|
|
24331
|
+
this.totalTime = 0;
|
|
24332
|
+
this.pluginSystem = undefined;
|
|
24333
|
+
this.sourceContent = undefined;
|
|
24334
|
+
this.refCompositions.clear();
|
|
24335
|
+
this.refCompositionProps.clear();
|
|
24095
24336
|
};
|
|
24096
|
-
return
|
|
24097
|
-
}(
|
|
24337
|
+
return CompositionSourceManager;
|
|
24338
|
+
}();
|
|
24098
24339
|
|
|
24099
24340
|
/**
|
|
24100
24341
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24101
24342
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
24102
24343
|
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
24103
24344
|
*/ var Composition = /*#__PURE__*/ function() {
|
|
24104
|
-
function Composition(props, scene
|
|
24345
|
+
function Composition(props, scene) {
|
|
24105
24346
|
var _this = this;
|
|
24106
|
-
|
|
24107
|
-
this./**
|
|
24347
|
+
/**
|
|
24108
24348
|
* 动画播放速度
|
|
24109
|
-
*/ speed = 1;
|
|
24110
|
-
|
|
24111
|
-
|
|
24112
|
-
|
|
24349
|
+
*/ this.speed = 1;
|
|
24350
|
+
/**
|
|
24351
|
+
* 用于保存与当前合成相关的插件数据
|
|
24352
|
+
*/ this.loaderData = {};
|
|
24353
|
+
/**
|
|
24354
|
+
* 预合成数组
|
|
24355
|
+
*/ this.refContent = [];
|
|
24356
|
+
/**
|
|
24113
24357
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
24114
|
-
*/ refCompositionProps = new Map();
|
|
24358
|
+
*/ this.refCompositionProps = new Map();
|
|
24115
24359
|
this.editorScaleRatio = 1.0;
|
|
24360
|
+
// TODO: 待优化
|
|
24116
24361
|
this.assigned = false;
|
|
24117
|
-
|
|
24118
|
-
|
|
24362
|
+
/**
|
|
24363
|
+
* 销毁状态位
|
|
24364
|
+
*/ this.destroyed = false;
|
|
24365
|
+
/**
|
|
24366
|
+
* 合成暂停/播放 标识
|
|
24367
|
+
*/ this.paused = false;
|
|
24119
24368
|
this.lastVideoUpdateTime = 0;
|
|
24120
24369
|
this.postLoaders = [];
|
|
24121
24370
|
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;
|
|
24371
|
+
this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
24122
24372
|
scene.jsonScene.imgUsage = undefined;
|
|
24123
24373
|
if (reusable) {
|
|
24124
24374
|
this.keepResource = true;
|
|
@@ -24129,19 +24379,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24129
24379
|
assertExist(sourceContent);
|
|
24130
24380
|
this.renderer = renderer;
|
|
24131
24381
|
this.refCompositionProps = refCompositionProps;
|
|
24132
|
-
|
|
24133
|
-
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
vfxItem.composition = this;
|
|
24137
|
-
this.rootComposition = vfxItem.addComponent(CompositionComponent);
|
|
24382
|
+
this.rootItem = new VFXItem(this.getEngine(), sourceContent);
|
|
24383
|
+
this.rootItem.name = "rootItem";
|
|
24384
|
+
this.rootItem.composition = this;
|
|
24385
|
+
this.rootComposition = this.rootItem.addComponent(CompositionComponent);
|
|
24138
24386
|
this.rootComposition.data = sourceContent;
|
|
24139
24387
|
var imageUsage = !reusable && imgUsage;
|
|
24140
|
-
this.transform = new Transform({
|
|
24141
|
-
name: this.name
|
|
24142
|
-
});
|
|
24143
|
-
this.transform.engine = this.getEngine();
|
|
24144
|
-
vfxItem.transform = this.transform;
|
|
24145
24388
|
this.globalVolume = sourceContent.globalVolume;
|
|
24146
24389
|
this.width = width;
|
|
24147
24390
|
this.height = height;
|
|
@@ -24159,8 +24402,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24159
24402
|
this.reusable = reusable;
|
|
24160
24403
|
this.speed = speed;
|
|
24161
24404
|
this.renderLevel = renderLevel;
|
|
24162
|
-
this.autoRefTex = !this.keepResource && imageUsage &&
|
|
24163
|
-
this.rootItem = vfxItem;
|
|
24405
|
+
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
|
|
24164
24406
|
this.name = sourceContent.name;
|
|
24165
24407
|
this.pluginSystem = pluginSystem;
|
|
24166
24408
|
this.pluginSystem.initializeComposition(this, scene);
|
|
@@ -24193,16 +24435,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24193
24435
|
/**
|
|
24194
24436
|
* 重新开始合成
|
|
24195
24437
|
*/ _proto.restart = function restart() {
|
|
24196
|
-
// const contentItems = this.rootComposition.items;
|
|
24197
|
-
// contentItems.forEach(item => item.dispose());
|
|
24198
|
-
// contentItems.length = 0;
|
|
24199
|
-
this.prepareRender();
|
|
24200
24438
|
this.reset();
|
|
24201
|
-
this.transform.setValid(true);
|
|
24202
|
-
this.rootComposition.resetStatus();
|
|
24203
24439
|
this.forwardTime(this.startTime);
|
|
24204
|
-
// this.content.onUpdate(0);
|
|
24205
|
-
// this.loaderData.spriteGroup.onUpdate(0);
|
|
24206
24440
|
};
|
|
24207
24441
|
/**
|
|
24208
24442
|
* 设置当前合成的渲染顺序
|
|
@@ -24330,28 +24564,9 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24330
24564
|
/**
|
|
24331
24565
|
* 重置状态函数
|
|
24332
24566
|
*/ _proto.reset = function reset() {
|
|
24333
|
-
var _this = this;
|
|
24334
|
-
var vfxItem = new VFXItem(this.getEngine(), this.compositionSourceManager.sourceContent);
|
|
24335
|
-
// TODO 编辑器数据传入 composition type 后移除
|
|
24336
|
-
vfxItem.type = ItemType.composition;
|
|
24337
|
-
vfxItem.composition = this;
|
|
24338
|
-
this.rootComposition = vfxItem.addComponent(CompositionComponent);
|
|
24339
|
-
this.rootComposition.data = this.compositionSourceManager.sourceContent;
|
|
24340
|
-
this.transform = new Transform({
|
|
24341
|
-
name: this.name
|
|
24342
|
-
});
|
|
24343
|
-
this.transform.engine = this.getEngine();
|
|
24344
|
-
vfxItem.transform = this.transform;
|
|
24345
|
-
this.rootItem = vfxItem;
|
|
24346
24567
|
this.rendererOptions = null;
|
|
24347
24568
|
this.globalTime = 0;
|
|
24348
|
-
this.
|
|
24349
|
-
this.buildItemTree(this.rootItem);
|
|
24350
|
-
this.rootItem.onEnd = function() {
|
|
24351
|
-
window.setTimeout(function() {
|
|
24352
|
-
_this.onEnd == null ? void 0 : _this.onEnd.call(_this, _this);
|
|
24353
|
-
}, 0);
|
|
24354
|
-
};
|
|
24569
|
+
this.rootItem.ended = false;
|
|
24355
24570
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
24356
24571
|
};
|
|
24357
24572
|
_proto.prepareRender = function prepareRender() {
|
|
@@ -24397,7 +24612,6 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24397
24612
|
}
|
|
24398
24613
|
var _this_rootItem = this.rootItem, ended = _this_rootItem.ended, endBehavior = _this_rootItem.endBehavior;
|
|
24399
24614
|
// TODO: 合成结束行为
|
|
24400
|
-
// @ts-expect-error
|
|
24401
24615
|
return ended && (!endBehavior || endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY);
|
|
24402
24616
|
};
|
|
24403
24617
|
/**
|
|
@@ -24493,7 +24707,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24493
24707
|
var child = _step2.value;
|
|
24494
24708
|
if (VFXItem.isComposition(child)) {
|
|
24495
24709
|
if (child.ended && child.endBehavior === ItemEndBehavior.loop) {
|
|
24496
|
-
child.
|
|
24710
|
+
child.ended = false;
|
|
24497
24711
|
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
24498
24712
|
this.callUpdate(child, 0);
|
|
24499
24713
|
} else {
|
|
@@ -24900,6 +25114,14 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24900
25114
|
})();
|
|
24901
25115
|
};
|
|
24902
25116
|
_create_class(Composition, [
|
|
25117
|
+
{
|
|
25118
|
+
key: "transform",
|
|
25119
|
+
get: /**
|
|
25120
|
+
* 所有合成 Item 的根变换
|
|
25121
|
+
*/ function get() {
|
|
25122
|
+
return this.rootItem.transform;
|
|
25123
|
+
}
|
|
25124
|
+
},
|
|
24903
25125
|
{
|
|
24904
25126
|
key: "textures",
|
|
24905
25127
|
get: /**
|
|
@@ -24945,189 +25167,6 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24945
25167
|
return Composition;
|
|
24946
25168
|
}();
|
|
24947
25169
|
|
|
24948
|
-
var listOrder = 0;
|
|
24949
|
-
/**
|
|
24950
|
-
* 合成资源管理
|
|
24951
|
-
*/ var CompositionSourceManager = /*#__PURE__*/ function() {
|
|
24952
|
-
function CompositionSourceManager(scene, engine) {
|
|
24953
|
-
this.refCompositions = new Map();
|
|
24954
|
-
this.refCompositionProps = new Map();
|
|
24955
|
-
this.mask = 0;
|
|
24956
|
-
this.engine = engine;
|
|
24957
|
-
// 资源
|
|
24958
|
-
var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
|
|
24959
|
-
var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
|
|
24960
|
-
if (!textureOptions) {
|
|
24961
|
-
throw new Error("scene.textures expected");
|
|
24962
|
-
}
|
|
24963
|
-
var cachedTextures = textureOptions;
|
|
24964
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
|
|
24965
|
-
var comp = _step.value;
|
|
24966
|
-
if (comp.id === compositionId) {
|
|
24967
|
-
this.composition = comp;
|
|
24968
|
-
} else {
|
|
24969
|
-
this.refCompositions.set(comp.id, comp);
|
|
24970
|
-
}
|
|
24971
|
-
}
|
|
24972
|
-
if (!this.composition) {
|
|
24973
|
-
throw new Error("Invalid composition id: " + compositionId);
|
|
24974
|
-
}
|
|
24975
|
-
this.jsonScene = jsonScene;
|
|
24976
|
-
this.renderLevel = renderLevel;
|
|
24977
|
-
this.pluginSystem = pluginSystem;
|
|
24978
|
-
this.totalTime = totalTime != null ? totalTime : 0;
|
|
24979
|
-
this.imgUsage = imgUsage != null ? imgUsage : {};
|
|
24980
|
-
this.textures = cachedTextures;
|
|
24981
|
-
listOrder = 0;
|
|
24982
|
-
this.sourceContent = this.getContent(this.composition);
|
|
24983
|
-
}
|
|
24984
|
-
var _proto = CompositionSourceManager.prototype;
|
|
24985
|
-
_proto.getContent = function getContent(composition) {
|
|
24986
|
-
// TODO: specification 中补充 globalVolume 类型
|
|
24987
|
-
// @ts-expect-error
|
|
24988
|
-
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;
|
|
24989
|
-
var items = this.assembleItems(composition);
|
|
24990
|
-
//@ts-expect-error
|
|
24991
|
-
if (!composition.sceneBindings) {
|
|
24992
|
-
//@ts-expect-error
|
|
24993
|
-
composition.sceneBindings = [];
|
|
24994
|
-
}
|
|
24995
|
-
return {
|
|
24996
|
-
id: id,
|
|
24997
|
-
duration: duration,
|
|
24998
|
-
name: name,
|
|
24999
|
-
endBehavior: isNaN(endBehavior) ? END_BEHAVIOR_PAUSE : endBehavior,
|
|
25000
|
-
// looping,
|
|
25001
|
-
items: items,
|
|
25002
|
-
camera: camera,
|
|
25003
|
-
startTime: startTime,
|
|
25004
|
-
globalVolume: globalVolume,
|
|
25005
|
-
timelineAsset: timelineAsset,
|
|
25006
|
-
//@ts-expect-error
|
|
25007
|
-
sceneBindings: composition.sceneBindings
|
|
25008
|
-
};
|
|
25009
|
-
};
|
|
25010
|
-
_proto.assembleItems = function assembleItems(composition) {
|
|
25011
|
-
var _this = this;
|
|
25012
|
-
var items = [];
|
|
25013
|
-
this.mask++;
|
|
25014
|
-
var componentMap = {};
|
|
25015
|
-
//@ts-expect-error
|
|
25016
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.jsonScene.components), _step; !(_step = _iterator()).done;){
|
|
25017
|
-
var component = _step.value;
|
|
25018
|
-
componentMap[component.id] = component;
|
|
25019
|
-
}
|
|
25020
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(composition.items), _step1; !(_step1 = _iterator1()).done;){
|
|
25021
|
-
var itemDataPath = _step1.value;
|
|
25022
|
-
//@ts-expect-error
|
|
25023
|
-
var sourceItemData = this.engine.jsonSceneData[itemDataPath.id];
|
|
25024
|
-
var itemProps = sourceItemData;
|
|
25025
|
-
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
25026
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
25027
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
25028
|
-
var componentPath = _step2.value;
|
|
25029
|
-
var componentData = componentMap[componentPath.id];
|
|
25030
|
-
this.preProcessItemContent(componentData);
|
|
25031
|
-
}
|
|
25032
|
-
} else {
|
|
25033
|
-
var renderContent = itemProps.content;
|
|
25034
|
-
if (renderContent) {
|
|
25035
|
-
this.preProcessItemContent(renderContent);
|
|
25036
|
-
}
|
|
25037
|
-
}
|
|
25038
|
-
itemProps.listIndex = listOrder++;
|
|
25039
|
-
// 处理预合成的渲染顺序
|
|
25040
|
-
if (itemProps.type === ItemType.composition) {
|
|
25041
|
-
var refId = sourceItemData.content.options.refId;
|
|
25042
|
-
if (!this.refCompositions.get(refId)) {
|
|
25043
|
-
throw new Error("Invalid Ref Composition id: " + refId);
|
|
25044
|
-
}
|
|
25045
|
-
var ref = this.getContent(this.refCompositions.get(refId));
|
|
25046
|
-
if (!this.refCompositionProps.has(refId)) {
|
|
25047
|
-
this.refCompositionProps.set(refId, ref);
|
|
25048
|
-
}
|
|
25049
|
-
ref.items.forEach(function(item) {
|
|
25050
|
-
_this.processMask(item.content);
|
|
25051
|
-
});
|
|
25052
|
-
itemProps.items = ref.items;
|
|
25053
|
-
}
|
|
25054
|
-
items.push(itemProps);
|
|
25055
|
-
}
|
|
25056
|
-
}
|
|
25057
|
-
return items;
|
|
25058
|
-
};
|
|
25059
|
-
_proto.preProcessItemContent = function preProcessItemContent(renderContent) {
|
|
25060
|
-
if (renderContent.renderer) {
|
|
25061
|
-
renderContent.renderer = this.changeTex(renderContent.renderer);
|
|
25062
|
-
if (!renderContent.renderer.mask) {
|
|
25063
|
-
this.processMask(renderContent.renderer);
|
|
25064
|
-
}
|
|
25065
|
-
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
25066
|
-
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
25067
|
-
var _this_jsonScene;
|
|
25068
|
-
// TODO: scene.shapes 类型问题?
|
|
25069
|
-
renderContent.renderer.shape = getGeometryByShape((_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[renderContent.renderer.shape], split);
|
|
25070
|
-
} else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
|
|
25071
|
-
renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
|
|
25072
|
-
}
|
|
25073
|
-
}
|
|
25074
|
-
if (renderContent.trails) {
|
|
25075
|
-
renderContent.trails = this.changeTex(renderContent.trails);
|
|
25076
|
-
}
|
|
25077
|
-
};
|
|
25078
|
-
_proto.changeTex = function changeTex(renderer) {
|
|
25079
|
-
if (!renderer.texture) {
|
|
25080
|
-
return renderer;
|
|
25081
|
-
}
|
|
25082
|
-
//@ts-expect-error
|
|
25083
|
-
var texIdx = renderer.texture.id;
|
|
25084
|
-
if (texIdx !== undefined) {
|
|
25085
|
-
//@ts-expect-error
|
|
25086
|
-
this.addTextureUsage(texIdx) || texIdx;
|
|
25087
|
-
}
|
|
25088
|
-
return renderer;
|
|
25089
|
-
};
|
|
25090
|
-
_proto.addTextureUsage = function addTextureUsage(texIdx) {
|
|
25091
|
-
var texId = texIdx;
|
|
25092
|
-
var _this_imgUsage;
|
|
25093
|
-
// FIXME: imageUsage 取自 scene.imgUsage,类型为 Record<string, number[]>,这里给的 number,类型对不上
|
|
25094
|
-
var imageUsage = (_this_imgUsage = this.imgUsage) != null ? _this_imgUsage : {};
|
|
25095
|
-
if (texId && imageUsage) {
|
|
25096
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
25097
|
-
if (!imageUsage.hasOwnProperty(texId)) {
|
|
25098
|
-
imageUsage[texId] = 0;
|
|
25099
|
-
}
|
|
25100
|
-
imageUsage[texId]++;
|
|
25101
|
-
}
|
|
25102
|
-
};
|
|
25103
|
-
/**
|
|
25104
|
-
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
25105
|
-
*/ _proto.processMask = function processMask(renderer) {
|
|
25106
|
-
var maskMode = renderer.maskMode;
|
|
25107
|
-
if (maskMode === MaskMode.NONE) {
|
|
25108
|
-
return;
|
|
25109
|
-
}
|
|
25110
|
-
if (!renderer.mask) {
|
|
25111
|
-
if (maskMode === MaskMode.MASK) {
|
|
25112
|
-
renderer.mask = ++this.mask;
|
|
25113
|
-
} else if (maskMode === MaskMode.OBSCURED || maskMode === MaskMode.REVERSE_OBSCURED) {
|
|
25114
|
-
renderer.mask = this.mask;
|
|
25115
|
-
}
|
|
25116
|
-
}
|
|
25117
|
-
};
|
|
25118
|
-
_proto.dispose = function dispose() {
|
|
25119
|
-
this.textures = [];
|
|
25120
|
-
this.composition = undefined;
|
|
25121
|
-
this.jsonScene = undefined;
|
|
25122
|
-
this.totalTime = 0;
|
|
25123
|
-
this.pluginSystem = undefined;
|
|
25124
|
-
this.sourceContent = undefined;
|
|
25125
|
-
this.refCompositions.clear();
|
|
25126
|
-
this.refCompositionProps.clear();
|
|
25127
|
-
};
|
|
25128
|
-
return CompositionSourceManager;
|
|
25129
|
-
}();
|
|
25130
|
-
|
|
25131
25170
|
/**
|
|
25132
25171
|
* Engine 基类,负责维护所有 GPU 资源的管理及销毁
|
|
25133
25172
|
*/ var Engine = /*#__PURE__*/ function() {
|
|
@@ -25168,61 +25207,46 @@ var listOrder = 0;
|
|
|
25168
25207
|
delete this.objectInstance[id];
|
|
25169
25208
|
};
|
|
25170
25209
|
_proto.addPackageDatas = function addPackageDatas(scene) {
|
|
25171
|
-
var jsonScene = scene.jsonScene;
|
|
25172
|
-
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
25177
|
-
|
|
25178
|
-
|
|
25179
|
-
|
|
25180
|
-
|
|
25181
|
-
|
|
25182
|
-
|
|
25183
|
-
|
|
25184
|
-
|
|
25185
|
-
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
-
|
|
25191
|
-
|
|
25192
|
-
|
|
25193
|
-
|
|
25194
|
-
|
|
25195
|
-
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
|
|
25204
|
-
var animationData = _step5.value;
|
|
25205
|
-
this.addEffectsObjectData(animationData);
|
|
25206
|
-
}
|
|
25207
|
-
}
|
|
25208
|
-
if (jsonScene.bins) {
|
|
25209
|
-
for(var i = 0; i < jsonScene.bins.length; i++){
|
|
25210
|
-
var binaryData = jsonScene.bins[i];
|
|
25211
|
-
var binaryBuffer = scene.bins[i];
|
|
25212
|
-
//@ts-expect-error
|
|
25213
|
-
binaryData.buffer = binaryBuffer;
|
|
25210
|
+
var jsonScene = scene.jsonScene, _scene_textureOptions = scene.textureOptions, textureOptions = _scene_textureOptions === void 0 ? [] : _scene_textureOptions;
|
|
25211
|
+
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;
|
|
25212
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
25213
|
+
var vfxItemData = _step.value;
|
|
25214
|
+
this.addEffectsObjectData(vfxItemData);
|
|
25215
|
+
}
|
|
25216
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(materials), _step1; !(_step1 = _iterator1()).done;){
|
|
25217
|
+
var materialData = _step1.value;
|
|
25218
|
+
this.addEffectsObjectData(materialData);
|
|
25219
|
+
}
|
|
25220
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shaders), _step2; !(_step2 = _iterator2()).done;){
|
|
25221
|
+
var shaderData = _step2.value;
|
|
25222
|
+
this.addEffectsObjectData(shaderData);
|
|
25223
|
+
}
|
|
25224
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(geometries), _step3; !(_step3 = _iterator3()).done;){
|
|
25225
|
+
var geometryData = _step3.value;
|
|
25226
|
+
this.addEffectsObjectData(geometryData);
|
|
25227
|
+
}
|
|
25228
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(components), _step4; !(_step4 = _iterator4()).done;){
|
|
25229
|
+
var componentData = _step4.value;
|
|
25230
|
+
this.addEffectsObjectData(componentData);
|
|
25231
|
+
}
|
|
25232
|
+
for(var _iterator5 = _create_for_of_iterator_helper_loose(animations), _step5; !(_step5 = _iterator5()).done;){
|
|
25233
|
+
var animationData = _step5.value;
|
|
25234
|
+
this.addEffectsObjectData(animationData);
|
|
25235
|
+
}
|
|
25236
|
+
for(var i = 0; i < bins.length; i++){
|
|
25237
|
+
var binaryData = bins[i];
|
|
25238
|
+
var binaryBuffer = scene.bins[i];
|
|
25239
|
+
//@ts-expect-error
|
|
25240
|
+
binaryData.buffer = binaryBuffer;
|
|
25241
|
+
//@ts-expect-error
|
|
25242
|
+
if (binaryData.id) {
|
|
25214
25243
|
//@ts-expect-error
|
|
25215
|
-
|
|
25216
|
-
//@ts-expect-error
|
|
25217
|
-
this.addEffectsObjectData(binaryData);
|
|
25218
|
-
}
|
|
25244
|
+
this.addEffectsObjectData(binaryData);
|
|
25219
25245
|
}
|
|
25220
25246
|
}
|
|
25221
|
-
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
this.addEffectsObjectData(textureData);
|
|
25225
|
-
}
|
|
25247
|
+
for(var _iterator6 = _create_for_of_iterator_helper_loose(textureOptions), _step6; !(_step6 = _iterator6()).done;){
|
|
25248
|
+
var textureData = _step6.value;
|
|
25249
|
+
this.addEffectsObjectData(textureData);
|
|
25226
25250
|
}
|
|
25227
25251
|
};
|
|
25228
25252
|
_proto.createVFXItems = function createVFXItems(scene) {
|
|
@@ -25242,9 +25266,7 @@ var listOrder = 0;
|
|
|
25242
25266
|
];
|
|
25243
25267
|
itemData = _step.value;
|
|
25244
25268
|
itemType = itemData.type;
|
|
25245
|
-
if (
|
|
25246
|
-
(itemType === "ECS" || // @ts-expect-error
|
|
25247
|
-
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)) {
|
|
25269
|
+
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)) {
|
|
25248
25270
|
return [
|
|
25249
25271
|
3,
|
|
25250
25272
|
3
|
|
@@ -25361,19 +25383,19 @@ var listOrder = 0;
|
|
|
25361
25383
|
logger.warn("Release GPU memory: " + info.join(", "));
|
|
25362
25384
|
}
|
|
25363
25385
|
this.renderPasses.forEach(function(pass) {
|
|
25364
|
-
pass.dispose();
|
|
25386
|
+
return pass.dispose();
|
|
25365
25387
|
});
|
|
25366
25388
|
this.meshes.forEach(function(mesh) {
|
|
25367
|
-
mesh.dispose();
|
|
25389
|
+
return mesh.dispose();
|
|
25368
25390
|
});
|
|
25369
25391
|
this.geometries.forEach(function(geo) {
|
|
25370
|
-
geo.dispose();
|
|
25392
|
+
return geo.dispose();
|
|
25371
25393
|
});
|
|
25372
25394
|
this.materials.forEach(function(mat) {
|
|
25373
|
-
mat.dispose();
|
|
25395
|
+
return mat.dispose();
|
|
25374
25396
|
});
|
|
25375
25397
|
this.textures.forEach(function(tex) {
|
|
25376
|
-
tex.dispose();
|
|
25398
|
+
return tex.dispose();
|
|
25377
25399
|
});
|
|
25378
25400
|
this.textures = [];
|
|
25379
25401
|
this.materials = [];
|
|
@@ -26686,11 +26708,8 @@ var seed = 1;
|
|
|
26686
26708
|
* composition 抽象类的实现
|
|
26687
26709
|
*/ var ThreeComposition = /*#__PURE__*/ function(Composition) {
|
|
26688
26710
|
_inherits(ThreeComposition, Composition);
|
|
26689
|
-
function ThreeComposition(props, scene
|
|
26690
|
-
|
|
26691
|
-
_this = Composition.call(this, props, scene, compositionSourceManager) || this;
|
|
26692
|
-
_this.rootItem.getComponent(CompositionComponent).resetStatus();
|
|
26693
|
-
return _this;
|
|
26711
|
+
function ThreeComposition(props, scene) {
|
|
26712
|
+
return Composition.call(this, props, scene);
|
|
26694
26713
|
}
|
|
26695
26714
|
var _proto = ThreeComposition.prototype;
|
|
26696
26715
|
/**
|
|
@@ -26882,7 +26901,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26882
26901
|
if (options === void 0) options = {};
|
|
26883
26902
|
var _this = this;
|
|
26884
26903
|
return _async_to_generator(function() {
|
|
26885
|
-
var last, opts, source, scene, engine, i,
|
|
26904
|
+
var last, opts, source, scene, engine, i, composition, firstFrameTime;
|
|
26886
26905
|
return __generator(this, function(_state) {
|
|
26887
26906
|
switch(_state.label){
|
|
26888
26907
|
case 0:
|
|
@@ -26919,7 +26938,6 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26919
26938
|
scene.textureOptions[i] = engine.assetLoader.loadGUID(scene.textureOptions[i].id);
|
|
26920
26939
|
scene.textureOptions[i].initialize();
|
|
26921
26940
|
}
|
|
26922
|
-
compositionSourceManager = new CompositionSourceManager(scene, engine);
|
|
26923
26941
|
if (!engine.database) return [
|
|
26924
26942
|
3,
|
|
26925
26943
|
3
|
|
@@ -26936,7 +26954,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26936
26954
|
width: _this.width,
|
|
26937
26955
|
height: _this.height,
|
|
26938
26956
|
renderer: _this.renderer
|
|
26939
|
-
}), scene
|
|
26957
|
+
}), scene);
|
|
26940
26958
|
_this.renderer.engine.setOptions({
|
|
26941
26959
|
threeCamera: _this.camera,
|
|
26942
26960
|
threeGroup: _this,
|
|
@@ -27115,8 +27133,8 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27115
27133
|
*/ Mesh.create = function(engine, props) {
|
|
27116
27134
|
return new ThreeMesh(engine, props);
|
|
27117
27135
|
};
|
|
27118
|
-
var version = "2.0.0-alpha.
|
|
27136
|
+
var version = "2.0.0-alpha.15";
|
|
27119
27137
|
logger.info("THREEJS plugin version: " + version);
|
|
27120
27138
|
|
|
27121
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, deepClone, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, random, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|
|
27139
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, deepClone, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, random, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|
|
27122
27140
|
//# sourceMappingURL=index.mjs.map
|