@galacean/effects-threejs 2.0.0-alpha.14 → 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 +760 -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 +759 -772
- 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++){
|
|
@@ -18639,17 +18675,15 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18639
18675
|
return _this;
|
|
18640
18676
|
}
|
|
18641
18677
|
var _proto = TrackAsset.prototype;
|
|
18642
|
-
|
|
18643
|
-
|
|
18678
|
+
/**
|
|
18679
|
+
* 重写该方法以获取自定义对象绑定
|
|
18680
|
+
*/ _proto.resolveBinding = function resolveBinding(parentBinding) {
|
|
18681
|
+
return parentBinding;
|
|
18644
18682
|
};
|
|
18645
18683
|
/**
|
|
18646
|
-
*
|
|
18647
|
-
*/ _proto.
|
|
18648
|
-
|
|
18649
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
18650
|
-
var subTrack = _step.value;
|
|
18651
|
-
subTrack.initializeBindingRecursive(this.binding);
|
|
18652
|
-
}
|
|
18684
|
+
* 重写该方法以创建自定义混合器
|
|
18685
|
+
*/ _proto.createTrackMixer = function createTrackMixer(graph) {
|
|
18686
|
+
return new Playable(graph);
|
|
18653
18687
|
};
|
|
18654
18688
|
_proto.createOutput = function createOutput() {
|
|
18655
18689
|
var output = new PlayableOutput();
|
|
@@ -18680,11 +18714,6 @@ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18680
18714
|
}
|
|
18681
18715
|
return mixer;
|
|
18682
18716
|
};
|
|
18683
|
-
/**
|
|
18684
|
-
* 重写该方法以创建自定义混合器
|
|
18685
|
-
*/ _proto.createTrackMixer = function createTrackMixer(graph) {
|
|
18686
|
-
return new Playable(graph);
|
|
18687
|
-
};
|
|
18688
18717
|
_proto.createPlayable = function createPlayable(graph) {
|
|
18689
18718
|
return new Playable(graph);
|
|
18690
18719
|
};
|
|
@@ -18834,13 +18863,6 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
|
18834
18863
|
var _proto = ObjectBindingTrack.prototype;
|
|
18835
18864
|
_proto.create = function create(timelineAsset) {
|
|
18836
18865
|
var boundItem = this.binding;
|
|
18837
|
-
this.options = {
|
|
18838
|
-
start: boundItem.start,
|
|
18839
|
-
duration: boundItem.duration,
|
|
18840
|
-
looping: boundItem.endBehavior === ItemEndBehavior.loop,
|
|
18841
|
-
endBehavior: boundItem.endBehavior || ItemEndBehavior.destroy
|
|
18842
|
-
};
|
|
18843
|
-
this.name = boundItem.name;
|
|
18844
18866
|
// 添加粒子动画 clip
|
|
18845
18867
|
if (boundItem.getComponent(ParticleSystem)) {
|
|
18846
18868
|
var particleTrack = timelineAsset.createTrack(TrackAsset, this, "ParticleTrack");
|
|
@@ -18851,18 +18873,6 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
|
18851
18873
|
particleClip.endBehaviour = boundItem.endBehavior;
|
|
18852
18874
|
}
|
|
18853
18875
|
};
|
|
18854
|
-
_proto.toLocalTime = function toLocalTime(time) {
|
|
18855
|
-
var localTime = time - this.options.start;
|
|
18856
|
-
var duration = this.options.duration;
|
|
18857
|
-
if (localTime - duration > 0.001) {
|
|
18858
|
-
if (this.options.endBehavior === END_BEHAVIOR_RESTART) {
|
|
18859
|
-
localTime = localTime % duration;
|
|
18860
|
-
} else if (this.options.endBehavior === END_BEHAVIOR_FREEZE) {
|
|
18861
|
-
localTime = Math.min(duration, localTime);
|
|
18862
|
-
}
|
|
18863
|
-
}
|
|
18864
|
-
return localTime;
|
|
18865
|
-
};
|
|
18866
18876
|
_proto.fromData = function fromData(data) {
|
|
18867
18877
|
TrackAsset1.prototype.fromData.call(this, data);
|
|
18868
18878
|
this.data = data;
|
|
@@ -18938,9 +18948,6 @@ var ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
18938
18948
|
return TrackAsset.apply(this, arguments);
|
|
18939
18949
|
}
|
|
18940
18950
|
var _proto = ActivationTrack.prototype;
|
|
18941
|
-
_proto.initializeBinding = function initializeBinding(parentBinding) {
|
|
18942
|
-
this.binding = parentBinding;
|
|
18943
|
-
};
|
|
18944
18951
|
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
18945
18952
|
return new ActivationMixerPlayable(graph);
|
|
18946
18953
|
};
|
|
@@ -18971,7 +18978,6 @@ var TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
|
|
|
18971
18978
|
}
|
|
18972
18979
|
var _proto = TimelineAsset.prototype;
|
|
18973
18980
|
_proto.createPlayable = function createPlayable(graph) {
|
|
18974
|
-
this.graph = graph;
|
|
18975
18981
|
var timelinePlayable = new TimelinePlayable(graph);
|
|
18976
18982
|
timelinePlayable.setTraversalMode(PlayableTraversalMode.Passthrough);
|
|
18977
18983
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
|
|
@@ -19089,176 +19095,448 @@ function compareTracks(a, b) {
|
|
|
19089
19095
|
}
|
|
19090
19096
|
}
|
|
19091
19097
|
|
|
19092
|
-
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
// } else {
|
|
19109
|
-
// if (textWidth) {
|
|
19110
|
-
// this.maxCharCount = Math.floor((textWidth - this.lineWidth) / (tempWidth));
|
|
19111
|
-
// this.width = textWidth;
|
|
19112
|
-
// } else {
|
|
19113
|
-
// this.width = basicScale[0] * 100;
|
|
19114
|
-
// }
|
|
19115
|
-
// this.height = basicScale[1] * 100;
|
|
19116
|
-
// }
|
|
19117
|
-
this.width = textWidth;
|
|
19118
|
-
this.height = textHeight;
|
|
19119
|
-
this.letterSpace = letterSpace;
|
|
19120
|
-
this.overFlow = textOverflow;
|
|
19121
|
-
this.textBaseline = textBaseline;
|
|
19122
|
-
this.textAlign = textAlign;
|
|
19123
|
-
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;
|
|
19124
19114
|
}
|
|
19125
|
-
var _proto =
|
|
19126
|
-
_proto.
|
|
19127
|
-
var
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
break;
|
|
19136
|
-
case TextBaseline.bottom:
|
|
19137
|
-
offsetY = this.height - offset / 2;
|
|
19138
|
-
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);
|
|
19139
19125
|
}
|
|
19140
|
-
return offsetY;
|
|
19141
19126
|
};
|
|
19142
|
-
_proto.
|
|
19143
|
-
var
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
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
|
+
}
|
|
19154
19140
|
}
|
|
19155
|
-
return offsetX;
|
|
19156
|
-
};
|
|
19157
|
-
/**
|
|
19158
|
-
* 设置文本框的宽度和高度
|
|
19159
|
-
* @param width 文本框宽度
|
|
19160
|
-
* @param height 文本框高度
|
|
19161
|
-
*/ _proto.setSize = function setSize(width, height) {
|
|
19162
|
-
this.width = width;
|
|
19163
|
-
this.height = height;
|
|
19164
19141
|
};
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
var TextStyle = function TextStyle(options) {
|
|
19169
|
-
/**
|
|
19170
|
-
* 是否有下划线(暂时无效)
|
|
19171
|
-
*/ this.isUnderline = false // ttf
|
|
19172
|
-
;
|
|
19173
|
-
/**
|
|
19174
|
-
* 下划线高度(暂时无效)
|
|
19175
|
-
*/ this.underlineHeight = 1 // ttf
|
|
19176
|
-
;
|
|
19177
|
-
/**
|
|
19178
|
-
* 是否有外描边
|
|
19179
|
-
*/ this.isOutlined = false // both // ttf & char
|
|
19180
|
-
;
|
|
19181
|
-
/**
|
|
19182
|
-
* 外描边宽度
|
|
19183
|
-
*/ this.outlineWidth = 0 // both // ttf & char
|
|
19184
|
-
;
|
|
19185
|
-
/**
|
|
19186
|
-
* 是否有阴影
|
|
19187
|
-
*/ this.hasShadow = false // ttf
|
|
19188
|
-
;
|
|
19189
|
-
this.fontDesc = "" // both
|
|
19190
|
-
;
|
|
19191
|
-
/**
|
|
19192
|
-
* 字体倍数
|
|
19193
|
-
*/ this.fontScale = 2;
|
|
19194
|
-
this.fontOffset = 0;
|
|
19195
|
-
var _options_textColor = options.textColor, textColor = _options_textColor === void 0 ? [
|
|
19196
|
-
1,
|
|
19197
|
-
1,
|
|
19198
|
-
1,
|
|
19199
|
-
1
|
|
19200
|
-
] : _options_textColor, _options_fontSize = options.fontSize, fontSize = _options_fontSize === void 0 ? 40 : _options_fontSize, outline = options.outline, shadow = options.shadow, _options_fontWeight = options.fontWeight, fontWeight = _options_fontWeight === void 0 ? "normal" : _options_fontWeight, _options_fontStyle = options.fontStyle, fontStyle = _options_fontStyle === void 0 ? "normal" : _options_fontStyle, _options_fontFamily = options.fontFamily, fontFamily = _options_fontFamily === void 0 ? "sans-serif" : _options_fontFamily;
|
|
19201
|
-
this.textColor = textColor;
|
|
19202
|
-
//@ts-expect-error
|
|
19203
|
-
this.textWeight = fontWeight;
|
|
19204
|
-
//@ts-expect-error
|
|
19205
|
-
this.fontStyle = fontStyle;
|
|
19206
|
-
this.fontFamily = fontFamily;
|
|
19207
|
-
this.fontSize = fontSize; // 暂时取消字号限制 Math.min(fontSize, this.maxFontSize);
|
|
19208
|
-
if (outline) {
|
|
19209
|
-
this.isOutlined = true;
|
|
19210
|
-
var _outline_outlineColor;
|
|
19211
|
-
this.outlineColor = (_outline_outlineColor = outline.outlineColor) != null ? _outline_outlineColor : [
|
|
19212
|
-
1,
|
|
19213
|
-
1,
|
|
19214
|
-
1,
|
|
19215
|
-
1
|
|
19216
|
-
];
|
|
19217
|
-
var _outline_outlineWidth;
|
|
19218
|
-
this.outlineWidth = (_outline_outlineWidth = outline.outlineWidth) != null ? _outline_outlineWidth : 1;
|
|
19219
|
-
this.fontOffset += this.outlineWidth;
|
|
19220
|
-
}
|
|
19221
|
-
if (shadow) {
|
|
19222
|
-
this.hasShadow = true;
|
|
19223
|
-
var _shadow_shadowBlur;
|
|
19224
|
-
this.shadowBlur = (_shadow_shadowBlur = shadow.shadowBlur) != null ? _shadow_shadowBlur : 2;
|
|
19225
|
-
var _shadow_shadowColor;
|
|
19226
|
-
this.shadowColor = (_shadow_shadowColor = shadow.shadowColor) != null ? _shadow_shadowColor : [
|
|
19227
|
-
0,
|
|
19228
|
-
0,
|
|
19229
|
-
0,
|
|
19230
|
-
1
|
|
19231
|
-
];
|
|
19232
|
-
var _shadow_shadowOffsetX;
|
|
19233
|
-
this.shadowOffsetX = (_shadow_shadowOffsetX = shadow.shadowOffsetX) != null ? _shadow_shadowOffsetX : 0;
|
|
19234
|
-
var _shadow_shadowOffsetY;
|
|
19235
|
-
this.shadowOffsetY = (_shadow_shadowOffsetY = shadow.shadowOffsetY) != null ? _shadow_shadowOffsetY : 0;
|
|
19236
|
-
}
|
|
19237
|
-
if (this.fontStyle !== FontStyle.normal) {
|
|
19238
|
-
// 0.0174532925 = 3.141592653 / 180
|
|
19239
|
-
this.fontOffset += this.fontSize * Math.tan(12 * 0.0174532925);
|
|
19240
|
-
}
|
|
19241
|
-
};
|
|
19242
|
-
|
|
19243
|
-
var CanvasPool = /*#__PURE__*/ function() {
|
|
19244
|
-
function CanvasPool() {
|
|
19245
|
-
this.elements = [];
|
|
19246
|
-
}
|
|
19247
|
-
var _proto = CanvasPool.prototype;
|
|
19248
|
-
_proto.dispose = function dispose() {
|
|
19249
|
-
this.elements.forEach(function(e) {
|
|
19250
|
-
return e.remove();
|
|
19251
|
-
});
|
|
19252
|
-
// clearing the array
|
|
19253
|
-
this.elements.length = 0;
|
|
19142
|
+
_proto.getReusable = function getReusable() {
|
|
19143
|
+
return this.reusable;
|
|
19254
19144
|
};
|
|
19255
|
-
_proto.
|
|
19256
|
-
|
|
19257
|
-
|
|
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;
|
|
19258
19150
|
}
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
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
|
+
* 下划线高度(暂时无效)
|
|
19453
|
+
*/ this.underlineHeight = 1 // ttf
|
|
19454
|
+
;
|
|
19455
|
+
/**
|
|
19456
|
+
* 是否有外描边
|
|
19457
|
+
*/ this.isOutlined = false // both // ttf & char
|
|
19458
|
+
;
|
|
19459
|
+
/**
|
|
19460
|
+
* 外描边宽度
|
|
19461
|
+
*/ this.outlineWidth = 0 // both // ttf & char
|
|
19462
|
+
;
|
|
19463
|
+
/**
|
|
19464
|
+
* 是否有阴影
|
|
19465
|
+
*/ this.hasShadow = false // ttf
|
|
19466
|
+
;
|
|
19467
|
+
this.fontDesc = "" // both
|
|
19468
|
+
;
|
|
19469
|
+
/**
|
|
19470
|
+
* 字体倍数
|
|
19471
|
+
*/ this.fontScale = 2;
|
|
19472
|
+
this.fontOffset = 0;
|
|
19473
|
+
var _options_textColor = options.textColor, textColor = _options_textColor === void 0 ? [
|
|
19474
|
+
1,
|
|
19475
|
+
1,
|
|
19476
|
+
1,
|
|
19477
|
+
1
|
|
19478
|
+
] : _options_textColor, _options_fontSize = options.fontSize, fontSize = _options_fontSize === void 0 ? 40 : _options_fontSize, outline = options.outline, shadow = options.shadow, _options_fontWeight = options.fontWeight, fontWeight = _options_fontWeight === void 0 ? "normal" : _options_fontWeight, _options_fontStyle = options.fontStyle, fontStyle = _options_fontStyle === void 0 ? "normal" : _options_fontStyle, _options_fontFamily = options.fontFamily, fontFamily = _options_fontFamily === void 0 ? "sans-serif" : _options_fontFamily;
|
|
19479
|
+
this.textColor = textColor;
|
|
19480
|
+
//@ts-expect-error
|
|
19481
|
+
this.textWeight = fontWeight;
|
|
19482
|
+
//@ts-expect-error
|
|
19483
|
+
this.fontStyle = fontStyle;
|
|
19484
|
+
this.fontFamily = fontFamily;
|
|
19485
|
+
this.fontSize = fontSize; // 暂时取消字号限制 Math.min(fontSize, this.maxFontSize);
|
|
19486
|
+
if (outline) {
|
|
19487
|
+
this.isOutlined = true;
|
|
19488
|
+
var _outline_outlineColor;
|
|
19489
|
+
this.outlineColor = (_outline_outlineColor = outline.outlineColor) != null ? _outline_outlineColor : [
|
|
19490
|
+
1,
|
|
19491
|
+
1,
|
|
19492
|
+
1,
|
|
19493
|
+
1
|
|
19494
|
+
];
|
|
19495
|
+
var _outline_outlineWidth;
|
|
19496
|
+
this.outlineWidth = (_outline_outlineWidth = outline.outlineWidth) != null ? _outline_outlineWidth : 1;
|
|
19497
|
+
this.fontOffset += this.outlineWidth;
|
|
19498
|
+
}
|
|
19499
|
+
if (shadow) {
|
|
19500
|
+
this.hasShadow = true;
|
|
19501
|
+
var _shadow_shadowBlur;
|
|
19502
|
+
this.shadowBlur = (_shadow_shadowBlur = shadow.shadowBlur) != null ? _shadow_shadowBlur : 2;
|
|
19503
|
+
var _shadow_shadowColor;
|
|
19504
|
+
this.shadowColor = (_shadow_shadowColor = shadow.shadowColor) != null ? _shadow_shadowColor : [
|
|
19505
|
+
0,
|
|
19506
|
+
0,
|
|
19507
|
+
0,
|
|
19508
|
+
1
|
|
19509
|
+
];
|
|
19510
|
+
var _shadow_shadowOffsetX;
|
|
19511
|
+
this.shadowOffsetX = (_shadow_shadowOffsetX = shadow.shadowOffsetX) != null ? _shadow_shadowOffsetX : 0;
|
|
19512
|
+
var _shadow_shadowOffsetY;
|
|
19513
|
+
this.shadowOffsetY = (_shadow_shadowOffsetY = shadow.shadowOffsetY) != null ? _shadow_shadowOffsetY : 0;
|
|
19514
|
+
}
|
|
19515
|
+
if (this.fontStyle !== FontStyle.normal) {
|
|
19516
|
+
// 0.0174532925 = 3.141592653 / 180
|
|
19517
|
+
this.fontOffset += this.fontSize * Math.tan(12 * 0.0174532925);
|
|
19518
|
+
}
|
|
19519
|
+
};
|
|
19520
|
+
|
|
19521
|
+
var CanvasPool = /*#__PURE__*/ function() {
|
|
19522
|
+
function CanvasPool() {
|
|
19523
|
+
this.elements = [];
|
|
19524
|
+
}
|
|
19525
|
+
var _proto = CanvasPool.prototype;
|
|
19526
|
+
_proto.dispose = function dispose() {
|
|
19527
|
+
this.elements.forEach(function(e) {
|
|
19528
|
+
return e.remove();
|
|
19529
|
+
});
|
|
19530
|
+
// clearing the array
|
|
19531
|
+
this.elements.length = 0;
|
|
19532
|
+
};
|
|
19533
|
+
_proto.getCanvas = function getCanvas() {
|
|
19534
|
+
if (this.elements.length !== 0) {
|
|
19535
|
+
return this.elements.shift();
|
|
19536
|
+
}
|
|
19537
|
+
if (getConfig(TEMPLATE_USE_OFFSCREEN_CANVAS)) {
|
|
19538
|
+
// @ts-expect-error
|
|
19539
|
+
return window._createOffscreenCanvas(10, 10);
|
|
19262
19540
|
} else {
|
|
19263
19541
|
// in hongmeng system, create too many canvas will case render error
|
|
19264
19542
|
var defCanvas = document.createElement("canvas");
|
|
@@ -20668,6 +20946,9 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20668
20946
|
SerializationHelper.checkGLTFNode = function checkGLTFNode(value) {
|
|
20669
20947
|
return _instanceof1(value, Object) && value.nodeIndex !== undefined && value.isJoint !== undefined;
|
|
20670
20948
|
};
|
|
20949
|
+
SerializationHelper.checkImageSource = function checkImageSource(value) {
|
|
20950
|
+
return isCanvas(value) || _instanceof1(value, HTMLImageElement);
|
|
20951
|
+
};
|
|
20671
20952
|
SerializationHelper.deserializeProperty = function deserializeProperty(property, engine, level, type) {
|
|
20672
20953
|
if (level > 14) {
|
|
20673
20954
|
console.error("序列化数据的内嵌对象层数大于上限");
|
|
@@ -20685,7 +20966,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20685
20966
|
// TODO json 数据避免传 typedArray
|
|
20686
20967
|
} else if (SerializationHelper.checkDataPath(property)) {
|
|
20687
20968
|
return engine.assetLoader.loadGUID(property.id);
|
|
20688
|
-
} 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)) {
|
|
20689
20970
|
return property;
|
|
20690
20971
|
} else if (_instanceof1(property, Object)) {
|
|
20691
20972
|
var res1;
|
|
@@ -20773,7 +21054,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20773
21054
|
res1
|
|
20774
21055
|
];
|
|
20775
21056
|
case 8:
|
|
20776
|
-
if (_instanceof1(property, EffectsObject) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
21057
|
+
if (_instanceof1(property, EffectsObject) || SerializationHelper.checkImageSource(property) || SerializationHelper.checkTypedArray(property) || SerializationHelper.checkGLTFNode(property)) {
|
|
20777
21058
|
return [
|
|
20778
21059
|
2,
|
|
20779
21060
|
property
|
|
@@ -20896,9 +21177,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20896
21177
|
effectsObject = Geometry.create(this.engine);
|
|
20897
21178
|
break;
|
|
20898
21179
|
case DataType.Texture:
|
|
20899
|
-
|
|
20900
|
-
|
|
20901
|
-
return effectsObject;
|
|
21180
|
+
effectsObject = Texture.create(this.engine);
|
|
21181
|
+
break;
|
|
20902
21182
|
default:
|
|
20903
21183
|
{
|
|
20904
21184
|
var classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
@@ -20969,12 +21249,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20969
21249
|
effectsObject = Geometry.create(_this.engine);
|
|
20970
21250
|
break;
|
|
20971
21251
|
case DataType.Texture:
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
return [
|
|
20975
|
-
2,
|
|
20976
|
-
effectsObject
|
|
20977
|
-
];
|
|
21252
|
+
effectsObject = Texture.create(_this.engine);
|
|
21253
|
+
break;
|
|
20978
21254
|
default:
|
|
20979
21255
|
{
|
|
20980
21256
|
classConstructor = AssetLoader.getClass(effectsObjectData.dataType);
|
|
@@ -21894,8 +22170,15 @@ function getStandardCameraContent(model) {
|
|
|
21894
22170
|
id: item.id
|
|
21895
22171
|
};
|
|
21896
22172
|
});
|
|
22173
|
+
var compositionData = _extends({}, composition, {
|
|
22174
|
+
timelineAsset: {
|
|
22175
|
+
id: ""
|
|
22176
|
+
},
|
|
22177
|
+
sceneBindings: []
|
|
22178
|
+
});
|
|
22179
|
+
result.compositions.push(compositionData);
|
|
21897
22180
|
// 生成时间轴数据
|
|
21898
|
-
convertTimelineAsset(
|
|
22181
|
+
convertTimelineAsset(compositionData, guidToItemMap, result);
|
|
21899
22182
|
};
|
|
21900
22183
|
var // 更正 spine 数据中的 images 属性
|
|
21901
22184
|
_json_spines;
|
|
@@ -21903,6 +22186,7 @@ function getStandardCameraContent(model) {
|
|
|
21903
22186
|
_result;
|
|
21904
22187
|
var result = _extends({}, json, {
|
|
21905
22188
|
items: [],
|
|
22189
|
+
compositions: [],
|
|
21906
22190
|
components: [],
|
|
21907
22191
|
materials: [],
|
|
21908
22192
|
shaders: [],
|
|
@@ -22112,10 +22396,7 @@ function getStandardCameraContent(model) {
|
|
|
22112
22396
|
item.type = "orientation-transformer";
|
|
22113
22397
|
}
|
|
22114
22398
|
// item 的 content 转为 component data 加入 JSONScene.components
|
|
22115
|
-
if (item.type === ItemType.sprite || item.type === ItemType.particle || item.type === ItemType.mesh || item.type === ItemType.skybox || item.type === ItemType.light ||
|
|
22116
|
-
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
|
|
22117
|
-
item.type === "editor-gizmo" || // @ts-expect-error
|
|
22118
|
-
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") {
|
|
22119
22400
|
item.components = [];
|
|
22120
22401
|
result.components.push(item.content);
|
|
22121
22402
|
item.content.id = generateGUID();
|
|
@@ -22147,15 +22428,12 @@ function getStandardCameraContent(model) {
|
|
|
22147
22428
|
case ItemType.light:
|
|
22148
22429
|
item.content.dataType = DataType.LightComponent;
|
|
22149
22430
|
break;
|
|
22150
|
-
// @ts-expect-error
|
|
22151
22431
|
case "camera":
|
|
22152
22432
|
item.content.dataType = DataType.CameraComponent;
|
|
22153
22433
|
break;
|
|
22154
|
-
// @ts-expect-error
|
|
22155
22434
|
case "editor-gizmo":
|
|
22156
22435
|
item.content.dataType = "GizmoComponent";
|
|
22157
22436
|
break;
|
|
22158
|
-
// @ts-expect-error
|
|
22159
22437
|
case "orientation-transformer":
|
|
22160
22438
|
item.content.dataType = "OrientationComponent";
|
|
22161
22439
|
break;
|
|
@@ -22308,6 +22586,32 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22308
22586
|
});
|
|
22309
22587
|
trackDatas.push(newTrackData1);
|
|
22310
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
|
+
}
|
|
22311
22615
|
var bindingTrackData = {
|
|
22312
22616
|
id: generateGUID(),
|
|
22313
22617
|
dataType: "ObjectBindingTrack",
|
|
@@ -22334,11 +22638,9 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22334
22638
|
id: trackData.id
|
|
22335
22639
|
});
|
|
22336
22640
|
}
|
|
22337
|
-
//@ts-expect-error
|
|
22338
22641
|
composition.timelineAsset = {
|
|
22339
22642
|
id: timelineAssetData.id
|
|
22340
22643
|
};
|
|
22341
|
-
//@ts-expect-error
|
|
22342
22644
|
composition.sceneBindings = sceneBindings;
|
|
22343
22645
|
if (!jsonScene.animations) {
|
|
22344
22646
|
jsonScene.animations = [];
|
|
@@ -23583,42 +23885,6 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
23583
23885
|
}
|
|
23584
23886
|
throw new Error("Invalid texture options");
|
|
23585
23887
|
}
|
|
23586
|
-
function base64ToFile(base64, filename, contentType) {
|
|
23587
|
-
if (filename === void 0) filename = "base64File";
|
|
23588
|
-
if (contentType === void 0) contentType = "";
|
|
23589
|
-
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
23590
|
-
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
23591
|
-
// 将 base64 编码的字符串转换为二进制字符串
|
|
23592
|
-
var byteCharacters = atob(base64WithoutPrefix);
|
|
23593
|
-
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
23594
|
-
var byteArrays = [];
|
|
23595
|
-
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
23596
|
-
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
23597
|
-
var slice = byteCharacters.slice(offset, offset + 512);
|
|
23598
|
-
var byteNumbers = new Array(slice.length);
|
|
23599
|
-
for(var i = 0; i < slice.length; i++){
|
|
23600
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
23601
|
-
}
|
|
23602
|
-
var byteArray = new Uint8Array(byteNumbers);
|
|
23603
|
-
byteArrays.push(byteArray);
|
|
23604
|
-
}
|
|
23605
|
-
// 使用字节数组创建 Blob 对象
|
|
23606
|
-
var blob = new Blob(byteArrays, {
|
|
23607
|
-
type: contentType
|
|
23608
|
-
});
|
|
23609
|
-
// 创建 File 对象
|
|
23610
|
-
var file = new File([
|
|
23611
|
-
blob
|
|
23612
|
-
], filename, {
|
|
23613
|
-
type: contentType
|
|
23614
|
-
});
|
|
23615
|
-
return file;
|
|
23616
|
-
}
|
|
23617
|
-
function isCanvas(canvas) {
|
|
23618
|
-
var _canvas_tagName;
|
|
23619
|
-
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
23620
|
-
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
23621
|
-
}
|
|
23622
23888
|
|
|
23623
23889
|
var tmpScale = new Vector3(1, 1, 1);
|
|
23624
23890
|
/**
|
|
@@ -23896,260 +24162,213 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
23896
24162
|
return Camera;
|
|
23897
24163
|
}();
|
|
23898
24164
|
|
|
24165
|
+
var listOrder = 0;
|
|
23899
24166
|
/**
|
|
23900
|
-
*
|
|
23901
|
-
|
|
23902
|
-
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
|
|
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);
|
|
23916
24200
|
}
|
|
23917
|
-
var _proto =
|
|
23918
|
-
_proto.
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
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;
|
|
23925
24228
|
}
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
var
|
|
23931
|
-
|
|
23932
|
-
|
|
23933
|
-
|
|
23934
|
-
|
|
23935
|
-
|
|
23936
|
-
|
|
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
|
+
}
|
|
24246
|
+
}
|
|
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);
|
|
23937
24253
|
}
|
|
23938
|
-
var
|
|
23939
|
-
if (
|
|
23940
|
-
|
|
24254
|
+
var ref = this.getContent(this.refCompositions.get(refId));
|
|
24255
|
+
if (!this.refCompositionProps.has(refId)) {
|
|
24256
|
+
this.refCompositionProps.set(refId, ref);
|
|
23941
24257
|
}
|
|
24258
|
+
ref.items.forEach(function(item) {
|
|
24259
|
+
_this.processMask(item.content);
|
|
24260
|
+
});
|
|
24261
|
+
itemProps.items = ref.items;
|
|
23942
24262
|
}
|
|
24263
|
+
items.push(itemProps);
|
|
23943
24264
|
}
|
|
23944
|
-
this.masterTracks.push(track);
|
|
23945
|
-
}
|
|
23946
|
-
};
|
|
23947
|
-
_proto.initializeTrackBindings = function initializeTrackBindings(masterTracks) {
|
|
23948
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(masterTracks), _step; !(_step = _iterator()).done;){
|
|
23949
|
-
var track = _step.value;
|
|
23950
|
-
track.initializeBindingRecursive(track.binding);
|
|
23951
24265
|
}
|
|
24266
|
+
return items;
|
|
23952
24267
|
};
|
|
23953
|
-
_proto.
|
|
23954
|
-
|
|
23955
|
-
|
|
23956
|
-
|
|
23957
|
-
|
|
23958
|
-
|
|
23959
|
-
|
|
23960
|
-
|
|
23961
|
-
|
|
23962
|
-
|
|
23963
|
-
|
|
23964
|
-
if (
|
|
23965
|
-
|
|
23966
|
-
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);
|
|
23967
24281
|
}
|
|
23968
24282
|
}
|
|
24283
|
+
if (renderContent.trails) {
|
|
24284
|
+
renderContent.trails = this.changeTex(renderContent.trails);
|
|
24285
|
+
}
|
|
23969
24286
|
};
|
|
23970
|
-
|
|
23971
|
-
|
|
23972
|
-
|
|
23973
|
-
this.item.ended = false;
|
|
23974
|
-
};
|
|
23975
|
-
_proto.createContent = function createContent() {
|
|
23976
|
-
var sceneBindings = [];
|
|
23977
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.data.sceneBindings), _step; !(_step = _iterator()).done;){
|
|
23978
|
-
var sceneBindingData = _step.value;
|
|
23979
|
-
sceneBindings.push({
|
|
23980
|
-
key: this.engine.assetLoader.loadGUID(sceneBindingData.key.id),
|
|
23981
|
-
value: this.engine.assetLoader.loadGUID(sceneBindingData.value.id)
|
|
23982
|
-
});
|
|
24287
|
+
_proto.changeTex = function changeTex(renderer) {
|
|
24288
|
+
if (!renderer.texture) {
|
|
24289
|
+
return renderer;
|
|
23983
24290
|
}
|
|
23984
|
-
|
|
23985
|
-
var
|
|
23986
|
-
|
|
23987
|
-
|
|
23988
|
-
|
|
23989
|
-
if (this.item.composition) {
|
|
23990
|
-
var assetLoader = this.item.engine.assetLoader;
|
|
23991
|
-
var itemProps = this.item.props.items ? this.item.props.items : [];
|
|
23992
|
-
for(var i = 0; i < itemProps.length; i++){
|
|
23993
|
-
var item = void 0;
|
|
23994
|
-
var itemData = itemProps[i];
|
|
23995
|
-
// 设置预合成作为元素时的时长、结束行为和渲染延时
|
|
23996
|
-
if (Item.isComposition(itemData)) {
|
|
23997
|
-
var refId = itemData.content.options.refId;
|
|
23998
|
-
var props = this.item.composition.refCompositionProps.get(refId);
|
|
23999
|
-
if (!props) {
|
|
24000
|
-
throw new Error("引用的Id: " + refId + " 的预合成不存在");
|
|
24001
|
-
}
|
|
24002
|
-
// endBehaviour 类型需优化
|
|
24003
|
-
props.content = itemData.content;
|
|
24004
|
-
item = assetLoader.loadGUID(itemData.id);
|
|
24005
|
-
item.composition = this.item.composition;
|
|
24006
|
-
var compositionComponent = item.addComponent(CompositionComponent);
|
|
24007
|
-
compositionComponent.data = props;
|
|
24008
|
-
compositionComponent.refId = refId;
|
|
24009
|
-
item.transform.parentTransform = this.transform;
|
|
24010
|
-
this.item.composition.refContent.push(item);
|
|
24011
|
-
if (item.endBehavior === ItemEndBehavior.loop) {
|
|
24012
|
-
this.item.composition.autoRefTex = false;
|
|
24013
|
-
}
|
|
24014
|
-
compositionComponent.createContent();
|
|
24015
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(compositionComponent.items), _step1; !(_step1 = _iterator1()).done;){
|
|
24016
|
-
var vfxItem = _step1.value;
|
|
24017
|
-
vfxItem.setInstanceId(generateGUID());
|
|
24018
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(vfxItem.components), _step2; !(_step2 = _iterator2()).done;){
|
|
24019
|
-
var component = _step2.value;
|
|
24020
|
-
component.setInstanceId(generateGUID());
|
|
24021
|
-
}
|
|
24022
|
-
}
|
|
24023
|
-
} else {
|
|
24024
|
-
item = assetLoader.loadGUID(itemData.id);
|
|
24025
|
-
item.composition = this.item.composition;
|
|
24026
|
-
}
|
|
24027
|
-
item.parent = this.item;
|
|
24028
|
-
// 相机不跟随合成移动
|
|
24029
|
-
item.transform.parentTransform = itemData.type === ItemType.camera ? new Transform() : this.transform;
|
|
24030
|
-
if (VFXItem.isExtraCamera(item)) {
|
|
24031
|
-
this.item.composition.extraCamera = item;
|
|
24032
|
-
}
|
|
24033
|
-
items.push(item);
|
|
24034
|
-
}
|
|
24291
|
+
//@ts-expect-error
|
|
24292
|
+
var texIdx = renderer.texture.id;
|
|
24293
|
+
if (texIdx !== undefined) {
|
|
24294
|
+
//@ts-expect-error
|
|
24295
|
+
this.addTextureUsage(texIdx) || texIdx;
|
|
24035
24296
|
}
|
|
24297
|
+
return renderer;
|
|
24036
24298
|
};
|
|
24037
|
-
_proto.
|
|
24038
|
-
|
|
24039
|
-
|
|
24040
|
-
|
|
24041
|
-
|
|
24042
|
-
|
|
24043
|
-
|
|
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;
|
|
24044
24308
|
}
|
|
24309
|
+
imageUsage[texId]++;
|
|
24045
24310
|
}
|
|
24046
24311
|
};
|
|
24047
|
-
|
|
24048
|
-
|
|
24049
|
-
|
|
24050
|
-
|
|
24051
|
-
|
|
24052
|
-
|
|
24053
|
-
|
|
24054
|
-
|
|
24055
|
-
|
|
24056
|
-
|
|
24057
|
-
|
|
24058
|
-
|
|
24059
|
-
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
24060
|
-
success = true;
|
|
24061
|
-
hitPositions.push(intersectPoint);
|
|
24062
|
-
break;
|
|
24063
|
-
}
|
|
24064
|
-
}
|
|
24065
|
-
} else if (hitParams.type === HitTestType.box) {
|
|
24066
|
-
var center = hitParams.center, size = hitParams.size;
|
|
24067
|
-
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
24068
|
-
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
24069
|
-
if (ray.intersectBox({
|
|
24070
|
-
min: boxMin,
|
|
24071
|
-
max: boxMax
|
|
24072
|
-
}, intersectPoint)) {
|
|
24073
|
-
success = true;
|
|
24074
|
-
hitPositions.push(intersectPoint);
|
|
24075
|
-
}
|
|
24076
|
-
} else if (hitParams.type === HitTestType.sphere) {
|
|
24077
|
-
var center1 = hitParams.center, radius = hitParams.radius;
|
|
24078
|
-
if (ray.intersectSphere({
|
|
24079
|
-
center: center1,
|
|
24080
|
-
radius: radius
|
|
24081
|
-
}, intersectPoint)) {
|
|
24082
|
-
success = true;
|
|
24083
|
-
hitPositions.push(intersectPoint);
|
|
24084
|
-
}
|
|
24085
|
-
} else if (hitParams.type === HitTestType.custom) {
|
|
24086
|
-
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
24087
|
-
if (tempPosition && tempPosition.length > 0) {
|
|
24088
|
-
tempPosition.forEach(function(pos) {
|
|
24089
|
-
hitPositions.push(pos);
|
|
24090
|
-
});
|
|
24091
|
-
success = true;
|
|
24092
|
-
}
|
|
24093
|
-
}
|
|
24094
|
-
if (success) {
|
|
24095
|
-
var region = {
|
|
24096
|
-
compContent: _this.item,
|
|
24097
|
-
id: item.id,
|
|
24098
|
-
name: item.name,
|
|
24099
|
-
position: hitPositions[hitPositions.length - 1],
|
|
24100
|
-
parentId: item.parentId,
|
|
24101
|
-
hitPositions: hitPositions,
|
|
24102
|
-
behavior: hitParams.behavior
|
|
24103
|
-
};
|
|
24104
|
-
regions.push(region);
|
|
24105
|
-
if (stop(region)) {
|
|
24106
|
-
return {
|
|
24107
|
-
v: regions
|
|
24108
|
-
};
|
|
24109
|
-
}
|
|
24110
|
-
}
|
|
24111
|
-
}
|
|
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;
|
|
24112
24324
|
}
|
|
24113
|
-
};
|
|
24114
|
-
var hitPositions = [];
|
|
24115
|
-
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
24116
|
-
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
24117
|
-
var maxCount = (options == null ? void 0 : options.maxCount) || this.items.length;
|
|
24118
|
-
for(var i = 0; i < this.items.length && regions.length < maxCount; i++){
|
|
24119
|
-
var _ret = (_this = this, _loop(i));
|
|
24120
|
-
if (_type_of(_ret) === "object") return _ret.v;
|
|
24121
24325
|
}
|
|
24122
|
-
return regions;
|
|
24123
24326
|
};
|
|
24124
|
-
_proto.
|
|
24125
|
-
|
|
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();
|
|
24126
24336
|
};
|
|
24127
|
-
return
|
|
24128
|
-
}(
|
|
24337
|
+
return CompositionSourceManager;
|
|
24338
|
+
}();
|
|
24129
24339
|
|
|
24130
24340
|
/**
|
|
24131
24341
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24132
24342
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
24133
24343
|
* 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
|
|
24134
24344
|
*/ var Composition = /*#__PURE__*/ function() {
|
|
24135
|
-
function Composition(props, scene
|
|
24345
|
+
function Composition(props, scene) {
|
|
24136
24346
|
var _this = this;
|
|
24137
|
-
|
|
24138
|
-
this./**
|
|
24347
|
+
/**
|
|
24139
24348
|
* 动画播放速度
|
|
24140
|
-
*/ speed = 1;
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24349
|
+
*/ this.speed = 1;
|
|
24350
|
+
/**
|
|
24351
|
+
* 用于保存与当前合成相关的插件数据
|
|
24352
|
+
*/ this.loaderData = {};
|
|
24353
|
+
/**
|
|
24354
|
+
* 预合成数组
|
|
24355
|
+
*/ this.refContent = [];
|
|
24356
|
+
/**
|
|
24144
24357
|
* 预合成的合成属性,在 content 中会被其元素属性覆盖
|
|
24145
|
-
*/ refCompositionProps = new Map();
|
|
24358
|
+
*/ this.refCompositionProps = new Map();
|
|
24146
24359
|
this.editorScaleRatio = 1.0;
|
|
24360
|
+
// TODO: 待优化
|
|
24147
24361
|
this.assigned = false;
|
|
24148
|
-
|
|
24149
|
-
|
|
24362
|
+
/**
|
|
24363
|
+
* 销毁状态位
|
|
24364
|
+
*/ this.destroyed = false;
|
|
24365
|
+
/**
|
|
24366
|
+
* 合成暂停/播放 标识
|
|
24367
|
+
*/ this.paused = false;
|
|
24150
24368
|
this.lastVideoUpdateTime = 0;
|
|
24151
24369
|
this.postLoaders = [];
|
|
24152
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);
|
|
24153
24372
|
scene.jsonScene.imgUsage = undefined;
|
|
24154
24373
|
if (reusable) {
|
|
24155
24374
|
this.keepResource = true;
|
|
@@ -24160,19 +24379,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24160
24379
|
assertExist(sourceContent);
|
|
24161
24380
|
this.renderer = renderer;
|
|
24162
24381
|
this.refCompositionProps = refCompositionProps;
|
|
24163
|
-
|
|
24164
|
-
|
|
24165
|
-
|
|
24166
|
-
|
|
24167
|
-
vfxItem.composition = this;
|
|
24168
|
-
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);
|
|
24169
24386
|
this.rootComposition.data = sourceContent;
|
|
24170
24387
|
var imageUsage = !reusable && imgUsage;
|
|
24171
|
-
this.transform = new Transform({
|
|
24172
|
-
name: this.name
|
|
24173
|
-
});
|
|
24174
|
-
this.transform.engine = this.getEngine();
|
|
24175
|
-
vfxItem.transform = this.transform;
|
|
24176
24388
|
this.globalVolume = sourceContent.globalVolume;
|
|
24177
24389
|
this.width = width;
|
|
24178
24390
|
this.height = height;
|
|
@@ -24190,8 +24402,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24190
24402
|
this.reusable = reusable;
|
|
24191
24403
|
this.speed = speed;
|
|
24192
24404
|
this.renderLevel = renderLevel;
|
|
24193
|
-
this.autoRefTex = !this.keepResource && imageUsage &&
|
|
24194
|
-
this.rootItem = vfxItem;
|
|
24405
|
+
this.autoRefTex = !this.keepResource && imageUsage && this.rootItem.endBehavior !== ItemEndBehavior.loop;
|
|
24195
24406
|
this.name = sourceContent.name;
|
|
24196
24407
|
this.pluginSystem = pluginSystem;
|
|
24197
24408
|
this.pluginSystem.initializeComposition(this, scene);
|
|
@@ -24224,16 +24435,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24224
24435
|
/**
|
|
24225
24436
|
* 重新开始合成
|
|
24226
24437
|
*/ _proto.restart = function restart() {
|
|
24227
|
-
// const contentItems = this.rootComposition.items;
|
|
24228
|
-
// contentItems.forEach(item => item.dispose());
|
|
24229
|
-
// contentItems.length = 0;
|
|
24230
|
-
this.prepareRender();
|
|
24231
24438
|
this.reset();
|
|
24232
|
-
this.transform.setValid(true);
|
|
24233
|
-
this.rootComposition.resetStatus();
|
|
24234
24439
|
this.forwardTime(this.startTime);
|
|
24235
|
-
// this.content.onUpdate(0);
|
|
24236
|
-
// this.loaderData.spriteGroup.onUpdate(0);
|
|
24237
24440
|
};
|
|
24238
24441
|
/**
|
|
24239
24442
|
* 设置当前合成的渲染顺序
|
|
@@ -24361,28 +24564,9 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24361
24564
|
/**
|
|
24362
24565
|
* 重置状态函数
|
|
24363
24566
|
*/ _proto.reset = function reset() {
|
|
24364
|
-
var _this = this;
|
|
24365
|
-
var vfxItem = new VFXItem(this.getEngine(), this.compositionSourceManager.sourceContent);
|
|
24366
|
-
// TODO 编辑器数据传入 composition type 后移除
|
|
24367
|
-
vfxItem.type = ItemType.composition;
|
|
24368
|
-
vfxItem.composition = this;
|
|
24369
|
-
this.rootComposition = vfxItem.addComponent(CompositionComponent);
|
|
24370
|
-
this.rootComposition.data = this.compositionSourceManager.sourceContent;
|
|
24371
|
-
this.transform = new Transform({
|
|
24372
|
-
name: this.name
|
|
24373
|
-
});
|
|
24374
|
-
this.transform.engine = this.getEngine();
|
|
24375
|
-
vfxItem.transform = this.transform;
|
|
24376
|
-
this.rootItem = vfxItem;
|
|
24377
24567
|
this.rendererOptions = null;
|
|
24378
24568
|
this.globalTime = 0;
|
|
24379
|
-
this.
|
|
24380
|
-
this.buildItemTree(this.rootItem);
|
|
24381
|
-
this.rootItem.onEnd = function() {
|
|
24382
|
-
window.setTimeout(function() {
|
|
24383
|
-
_this.onEnd == null ? void 0 : _this.onEnd.call(_this, _this);
|
|
24384
|
-
}, 0);
|
|
24385
|
-
};
|
|
24569
|
+
this.rootItem.ended = false;
|
|
24386
24570
|
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
24387
24571
|
};
|
|
24388
24572
|
_proto.prepareRender = function prepareRender() {
|
|
@@ -24428,7 +24612,6 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24428
24612
|
}
|
|
24429
24613
|
var _this_rootItem = this.rootItem, ended = _this_rootItem.ended, endBehavior = _this_rootItem.endBehavior;
|
|
24430
24614
|
// TODO: 合成结束行为
|
|
24431
|
-
// @ts-expect-error
|
|
24432
24615
|
return ended && (!endBehavior || endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY);
|
|
24433
24616
|
};
|
|
24434
24617
|
/**
|
|
@@ -24524,7 +24707,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24524
24707
|
var child = _step2.value;
|
|
24525
24708
|
if (VFXItem.isComposition(child)) {
|
|
24526
24709
|
if (child.ended && child.endBehavior === ItemEndBehavior.loop) {
|
|
24527
|
-
child.
|
|
24710
|
+
child.ended = false;
|
|
24528
24711
|
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
24529
24712
|
this.callUpdate(child, 0);
|
|
24530
24713
|
} else {
|
|
@@ -24931,6 +25114,14 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24931
25114
|
})();
|
|
24932
25115
|
};
|
|
24933
25116
|
_create_class(Composition, [
|
|
25117
|
+
{
|
|
25118
|
+
key: "transform",
|
|
25119
|
+
get: /**
|
|
25120
|
+
* 所有合成 Item 的根变换
|
|
25121
|
+
*/ function get() {
|
|
25122
|
+
return this.rootItem.transform;
|
|
25123
|
+
}
|
|
25124
|
+
},
|
|
24934
25125
|
{
|
|
24935
25126
|
key: "textures",
|
|
24936
25127
|
get: /**
|
|
@@ -24976,189 +25167,6 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24976
25167
|
return Composition;
|
|
24977
25168
|
}();
|
|
24978
25169
|
|
|
24979
|
-
var listOrder = 0;
|
|
24980
|
-
/**
|
|
24981
|
-
* 合成资源管理
|
|
24982
|
-
*/ var CompositionSourceManager = /*#__PURE__*/ function() {
|
|
24983
|
-
function CompositionSourceManager(scene, engine) {
|
|
24984
|
-
this.refCompositions = new Map();
|
|
24985
|
-
this.refCompositionProps = new Map();
|
|
24986
|
-
this.mask = 0;
|
|
24987
|
-
this.engine = engine;
|
|
24988
|
-
// 资源
|
|
24989
|
-
var jsonScene = scene.jsonScene, renderLevel = scene.renderLevel, textureOptions = scene.textureOptions, pluginSystem = scene.pluginSystem, totalTime = scene.totalTime;
|
|
24990
|
-
var compositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, compositionId = jsonScene.compositionId;
|
|
24991
|
-
if (!textureOptions) {
|
|
24992
|
-
throw new Error("scene.textures expected");
|
|
24993
|
-
}
|
|
24994
|
-
var cachedTextures = textureOptions;
|
|
24995
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(compositions), _step; !(_step = _iterator()).done;){
|
|
24996
|
-
var comp = _step.value;
|
|
24997
|
-
if (comp.id === compositionId) {
|
|
24998
|
-
this.composition = comp;
|
|
24999
|
-
} else {
|
|
25000
|
-
this.refCompositions.set(comp.id, comp);
|
|
25001
|
-
}
|
|
25002
|
-
}
|
|
25003
|
-
if (!this.composition) {
|
|
25004
|
-
throw new Error("Invalid composition id: " + compositionId);
|
|
25005
|
-
}
|
|
25006
|
-
this.jsonScene = jsonScene;
|
|
25007
|
-
this.renderLevel = renderLevel;
|
|
25008
|
-
this.pluginSystem = pluginSystem;
|
|
25009
|
-
this.totalTime = totalTime != null ? totalTime : 0;
|
|
25010
|
-
this.imgUsage = imgUsage != null ? imgUsage : {};
|
|
25011
|
-
this.textures = cachedTextures;
|
|
25012
|
-
listOrder = 0;
|
|
25013
|
-
this.sourceContent = this.getContent(this.composition);
|
|
25014
|
-
}
|
|
25015
|
-
var _proto = CompositionSourceManager.prototype;
|
|
25016
|
-
_proto.getContent = function getContent(composition) {
|
|
25017
|
-
// TODO: specification 中补充 globalVolume 类型
|
|
25018
|
-
// @ts-expect-error
|
|
25019
|
-
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;
|
|
25020
|
-
var items = this.assembleItems(composition);
|
|
25021
|
-
//@ts-expect-error
|
|
25022
|
-
if (!composition.sceneBindings) {
|
|
25023
|
-
//@ts-expect-error
|
|
25024
|
-
composition.sceneBindings = [];
|
|
25025
|
-
}
|
|
25026
|
-
return {
|
|
25027
|
-
id: id,
|
|
25028
|
-
duration: duration,
|
|
25029
|
-
name: name,
|
|
25030
|
-
endBehavior: isNaN(endBehavior) ? END_BEHAVIOR_PAUSE : endBehavior,
|
|
25031
|
-
// looping,
|
|
25032
|
-
items: items,
|
|
25033
|
-
camera: camera,
|
|
25034
|
-
startTime: startTime,
|
|
25035
|
-
globalVolume: globalVolume,
|
|
25036
|
-
timelineAsset: timelineAsset,
|
|
25037
|
-
//@ts-expect-error
|
|
25038
|
-
sceneBindings: composition.sceneBindings
|
|
25039
|
-
};
|
|
25040
|
-
};
|
|
25041
|
-
_proto.assembleItems = function assembleItems(composition) {
|
|
25042
|
-
var _this = this;
|
|
25043
|
-
var items = [];
|
|
25044
|
-
this.mask++;
|
|
25045
|
-
var componentMap = {};
|
|
25046
|
-
//@ts-expect-error
|
|
25047
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.jsonScene.components), _step; !(_step = _iterator()).done;){
|
|
25048
|
-
var component = _step.value;
|
|
25049
|
-
componentMap[component.id] = component;
|
|
25050
|
-
}
|
|
25051
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(composition.items), _step1; !(_step1 = _iterator1()).done;){
|
|
25052
|
-
var itemDataPath = _step1.value;
|
|
25053
|
-
//@ts-expect-error
|
|
25054
|
-
var sourceItemData = this.engine.jsonSceneData[itemDataPath.id];
|
|
25055
|
-
var itemProps = sourceItemData;
|
|
25056
|
-
if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
|
|
25057
|
-
if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle) {
|
|
25058
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
|
|
25059
|
-
var componentPath = _step2.value;
|
|
25060
|
-
var componentData = componentMap[componentPath.id];
|
|
25061
|
-
this.preProcessItemContent(componentData);
|
|
25062
|
-
}
|
|
25063
|
-
} else {
|
|
25064
|
-
var renderContent = itemProps.content;
|
|
25065
|
-
if (renderContent) {
|
|
25066
|
-
this.preProcessItemContent(renderContent);
|
|
25067
|
-
}
|
|
25068
|
-
}
|
|
25069
|
-
itemProps.listIndex = listOrder++;
|
|
25070
|
-
// 处理预合成的渲染顺序
|
|
25071
|
-
if (itemProps.type === ItemType.composition) {
|
|
25072
|
-
var refId = sourceItemData.content.options.refId;
|
|
25073
|
-
if (!this.refCompositions.get(refId)) {
|
|
25074
|
-
throw new Error("Invalid Ref Composition id: " + refId);
|
|
25075
|
-
}
|
|
25076
|
-
var ref = this.getContent(this.refCompositions.get(refId));
|
|
25077
|
-
if (!this.refCompositionProps.has(refId)) {
|
|
25078
|
-
this.refCompositionProps.set(refId, ref);
|
|
25079
|
-
}
|
|
25080
|
-
ref.items.forEach(function(item) {
|
|
25081
|
-
_this.processMask(item.content);
|
|
25082
|
-
});
|
|
25083
|
-
itemProps.items = ref.items;
|
|
25084
|
-
}
|
|
25085
|
-
items.push(itemProps);
|
|
25086
|
-
}
|
|
25087
|
-
}
|
|
25088
|
-
return items;
|
|
25089
|
-
};
|
|
25090
|
-
_proto.preProcessItemContent = function preProcessItemContent(renderContent) {
|
|
25091
|
-
if (renderContent.renderer) {
|
|
25092
|
-
renderContent.renderer = this.changeTex(renderContent.renderer);
|
|
25093
|
-
if (!renderContent.renderer.mask) {
|
|
25094
|
-
this.processMask(renderContent.renderer);
|
|
25095
|
-
}
|
|
25096
|
-
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
25097
|
-
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
25098
|
-
var _this_jsonScene;
|
|
25099
|
-
// TODO: scene.shapes 类型问题?
|
|
25100
|
-
renderContent.renderer.shape = getGeometryByShape((_this_jsonScene = this.jsonScene) == null ? void 0 : _this_jsonScene.shapes[renderContent.renderer.shape], split);
|
|
25101
|
-
} else if (renderContent.renderer.shape && isObject(renderContent.renderer.shape)) {
|
|
25102
|
-
renderContent.renderer.shape = getGeometryByShape(renderContent.renderer.shape, split);
|
|
25103
|
-
}
|
|
25104
|
-
}
|
|
25105
|
-
if (renderContent.trails) {
|
|
25106
|
-
renderContent.trails = this.changeTex(renderContent.trails);
|
|
25107
|
-
}
|
|
25108
|
-
};
|
|
25109
|
-
_proto.changeTex = function changeTex(renderer) {
|
|
25110
|
-
if (!renderer.texture) {
|
|
25111
|
-
return renderer;
|
|
25112
|
-
}
|
|
25113
|
-
//@ts-expect-error
|
|
25114
|
-
var texIdx = renderer.texture.id;
|
|
25115
|
-
if (texIdx !== undefined) {
|
|
25116
|
-
//@ts-expect-error
|
|
25117
|
-
this.addTextureUsage(texIdx) || texIdx;
|
|
25118
|
-
}
|
|
25119
|
-
return renderer;
|
|
25120
|
-
};
|
|
25121
|
-
_proto.addTextureUsage = function addTextureUsage(texIdx) {
|
|
25122
|
-
var texId = texIdx;
|
|
25123
|
-
var _this_imgUsage;
|
|
25124
|
-
// FIXME: imageUsage 取自 scene.imgUsage,类型为 Record<string, number[]>,这里给的 number,类型对不上
|
|
25125
|
-
var imageUsage = (_this_imgUsage = this.imgUsage) != null ? _this_imgUsage : {};
|
|
25126
|
-
if (texId && imageUsage) {
|
|
25127
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
25128
|
-
if (!imageUsage.hasOwnProperty(texId)) {
|
|
25129
|
-
imageUsage[texId] = 0;
|
|
25130
|
-
}
|
|
25131
|
-
imageUsage[texId]++;
|
|
25132
|
-
}
|
|
25133
|
-
};
|
|
25134
|
-
/**
|
|
25135
|
-
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
25136
|
-
*/ _proto.processMask = function processMask(renderer) {
|
|
25137
|
-
var maskMode = renderer.maskMode;
|
|
25138
|
-
if (maskMode === MaskMode.NONE) {
|
|
25139
|
-
return;
|
|
25140
|
-
}
|
|
25141
|
-
if (!renderer.mask) {
|
|
25142
|
-
if (maskMode === MaskMode.MASK) {
|
|
25143
|
-
renderer.mask = ++this.mask;
|
|
25144
|
-
} else if (maskMode === MaskMode.OBSCURED || maskMode === MaskMode.REVERSE_OBSCURED) {
|
|
25145
|
-
renderer.mask = this.mask;
|
|
25146
|
-
}
|
|
25147
|
-
}
|
|
25148
|
-
};
|
|
25149
|
-
_proto.dispose = function dispose() {
|
|
25150
|
-
this.textures = [];
|
|
25151
|
-
this.composition = undefined;
|
|
25152
|
-
this.jsonScene = undefined;
|
|
25153
|
-
this.totalTime = 0;
|
|
25154
|
-
this.pluginSystem = undefined;
|
|
25155
|
-
this.sourceContent = undefined;
|
|
25156
|
-
this.refCompositions.clear();
|
|
25157
|
-
this.refCompositionProps.clear();
|
|
25158
|
-
};
|
|
25159
|
-
return CompositionSourceManager;
|
|
25160
|
-
}();
|
|
25161
|
-
|
|
25162
25170
|
/**
|
|
25163
25171
|
* Engine 基类,负责维护所有 GPU 资源的管理及销毁
|
|
25164
25172
|
*/ var Engine = /*#__PURE__*/ function() {
|
|
@@ -25199,61 +25207,46 @@ var listOrder = 0;
|
|
|
25199
25207
|
delete this.objectInstance[id];
|
|
25200
25208
|
};
|
|
25201
25209
|
_proto.addPackageDatas = function addPackageDatas(scene) {
|
|
25202
|
-
var jsonScene = scene.jsonScene;
|
|
25203
|
-
|
|
25204
|
-
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
|
|
25218
|
-
|
|
25219
|
-
|
|
25220
|
-
|
|
25221
|
-
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
|
|
25227
|
-
|
|
25228
|
-
|
|
25229
|
-
|
|
25230
|
-
|
|
25231
|
-
|
|
25232
|
-
|
|
25233
|
-
|
|
25234
|
-
|
|
25235
|
-
var animationData = _step5.value;
|
|
25236
|
-
this.addEffectsObjectData(animationData);
|
|
25237
|
-
}
|
|
25238
|
-
}
|
|
25239
|
-
if (jsonScene.bins) {
|
|
25240
|
-
for(var i = 0; i < jsonScene.bins.length; i++){
|
|
25241
|
-
var binaryData = jsonScene.bins[i];
|
|
25242
|
-
var binaryBuffer = scene.bins[i];
|
|
25243
|
-
//@ts-expect-error
|
|
25244
|
-
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) {
|
|
25245
25243
|
//@ts-expect-error
|
|
25246
|
-
|
|
25247
|
-
//@ts-expect-error
|
|
25248
|
-
this.addEffectsObjectData(binaryData);
|
|
25249
|
-
}
|
|
25244
|
+
this.addEffectsObjectData(binaryData);
|
|
25250
25245
|
}
|
|
25251
25246
|
}
|
|
25252
|
-
|
|
25253
|
-
|
|
25254
|
-
|
|
25255
|
-
this.addEffectsObjectData(textureData);
|
|
25256
|
-
}
|
|
25247
|
+
for(var _iterator6 = _create_for_of_iterator_helper_loose(textureOptions), _step6; !(_step6 = _iterator6()).done;){
|
|
25248
|
+
var textureData = _step6.value;
|
|
25249
|
+
this.addEffectsObjectData(textureData);
|
|
25257
25250
|
}
|
|
25258
25251
|
};
|
|
25259
25252
|
_proto.createVFXItems = function createVFXItems(scene) {
|
|
@@ -25273,9 +25266,7 @@ var listOrder = 0;
|
|
|
25273
25266
|
];
|
|
25274
25267
|
itemData = _step.value;
|
|
25275
25268
|
itemType = itemData.type;
|
|
25276
|
-
if (
|
|
25277
|
-
(itemType === "ECS" || // @ts-expect-error
|
|
25278
|
-
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)) {
|
|
25279
25270
|
return [
|
|
25280
25271
|
3,
|
|
25281
25272
|
3
|
|
@@ -25392,19 +25383,19 @@ var listOrder = 0;
|
|
|
25392
25383
|
logger.warn("Release GPU memory: " + info.join(", "));
|
|
25393
25384
|
}
|
|
25394
25385
|
this.renderPasses.forEach(function(pass) {
|
|
25395
|
-
pass.dispose();
|
|
25386
|
+
return pass.dispose();
|
|
25396
25387
|
});
|
|
25397
25388
|
this.meshes.forEach(function(mesh) {
|
|
25398
|
-
mesh.dispose();
|
|
25389
|
+
return mesh.dispose();
|
|
25399
25390
|
});
|
|
25400
25391
|
this.geometries.forEach(function(geo) {
|
|
25401
|
-
geo.dispose();
|
|
25392
|
+
return geo.dispose();
|
|
25402
25393
|
});
|
|
25403
25394
|
this.materials.forEach(function(mat) {
|
|
25404
|
-
mat.dispose();
|
|
25395
|
+
return mat.dispose();
|
|
25405
25396
|
});
|
|
25406
25397
|
this.textures.forEach(function(tex) {
|
|
25407
|
-
tex.dispose();
|
|
25398
|
+
return tex.dispose();
|
|
25408
25399
|
});
|
|
25409
25400
|
this.textures = [];
|
|
25410
25401
|
this.materials = [];
|
|
@@ -26717,11 +26708,8 @@ var seed = 1;
|
|
|
26717
26708
|
* composition 抽象类的实现
|
|
26718
26709
|
*/ var ThreeComposition = /*#__PURE__*/ function(Composition) {
|
|
26719
26710
|
_inherits(ThreeComposition, Composition);
|
|
26720
|
-
function ThreeComposition(props, scene
|
|
26721
|
-
|
|
26722
|
-
_this = Composition.call(this, props, scene, compositionSourceManager) || this;
|
|
26723
|
-
_this.rootItem.getComponent(CompositionComponent).resetStatus();
|
|
26724
|
-
return _this;
|
|
26711
|
+
function ThreeComposition(props, scene) {
|
|
26712
|
+
return Composition.call(this, props, scene);
|
|
26725
26713
|
}
|
|
26726
26714
|
var _proto = ThreeComposition.prototype;
|
|
26727
26715
|
/**
|
|
@@ -26913,7 +26901,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26913
26901
|
if (options === void 0) options = {};
|
|
26914
26902
|
var _this = this;
|
|
26915
26903
|
return _async_to_generator(function() {
|
|
26916
|
-
var last, opts, source, scene, engine, i,
|
|
26904
|
+
var last, opts, source, scene, engine, i, composition, firstFrameTime;
|
|
26917
26905
|
return __generator(this, function(_state) {
|
|
26918
26906
|
switch(_state.label){
|
|
26919
26907
|
case 0:
|
|
@@ -26950,7 +26938,6 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26950
26938
|
scene.textureOptions[i] = engine.assetLoader.loadGUID(scene.textureOptions[i].id);
|
|
26951
26939
|
scene.textureOptions[i].initialize();
|
|
26952
26940
|
}
|
|
26953
|
-
compositionSourceManager = new CompositionSourceManager(scene, engine);
|
|
26954
26941
|
if (!engine.database) return [
|
|
26955
26942
|
3,
|
|
26956
26943
|
3
|
|
@@ -26967,7 +26954,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
26967
26954
|
width: _this.width,
|
|
26968
26955
|
height: _this.height,
|
|
26969
26956
|
renderer: _this.renderer
|
|
26970
|
-
}), scene
|
|
26957
|
+
}), scene);
|
|
26971
26958
|
_this.renderer.engine.setOptions({
|
|
26972
26959
|
threeCamera: _this.camera,
|
|
26973
26960
|
threeGroup: _this,
|
|
@@ -27146,8 +27133,8 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27146
27133
|
*/ Mesh.create = function(engine, props) {
|
|
27147
27134
|
return new ThreeMesh(engine, props);
|
|
27148
27135
|
};
|
|
27149
|
-
var version = "2.0.0-alpha.
|
|
27136
|
+
var version = "2.0.0-alpha.15";
|
|
27150
27137
|
logger.info("THREEJS plugin version: " + version);
|
|
27151
27138
|
|
|
27152
|
-
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 };
|
|
27153
27140
|
//# sourceMappingURL=index.mjs.map
|