@galacean/effects-core 2.8.0-alpha.3 → 2.8.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset-manager.d.ts +2 -1
- package/dist/downloader.d.ts +1 -1
- package/dist/index.js +694 -513
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +692 -513
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-system.d.ts +4 -4
- package/dist/plugins/cal/calculate-loader.d.ts +2 -2
- package/dist/plugins/camera/camera-vfx-item-loader.d.ts +2 -2
- package/dist/plugins/interact/interact-loader.d.ts +2 -2
- package/dist/plugins/particle/particle-loader.d.ts +2 -2
- package/dist/plugins/particle/particle-system.d.ts +2 -1
- package/dist/plugins/plugin.d.ts +24 -19
- package/dist/plugins/sprite/sprite-item.d.ts +0 -1
- package/dist/plugins/sprite/sprite-loader.d.ts +2 -2
- package/dist/plugins/text/text-item.d.ts +16 -1
- package/dist/plugins/text/text-loader.d.ts +2 -2
- package/dist/scene.d.ts +5 -0
- package/dist/utils/hevc-video.d.ts +13 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.8.0-alpha.
|
|
6
|
+
* Version: v2.8.0-alpha.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -2668,355 +2668,6 @@ function asserts(condition, msg) {
|
|
|
2668
2668
|
return /^[^\d.][\w-]*$/.test(fontFamily);
|
|
2669
2669
|
}
|
|
2670
2670
|
|
|
2671
|
-
/**
|
|
2672
|
-
* Simple implementation of the deferred pattern.
|
|
2673
|
-
* An object that exposes a promise and functions to resolve and reject it.
|
|
2674
|
-
*/ var Deferred = function Deferred() {
|
|
2675
|
-
var _this = this;
|
|
2676
|
-
this.promise = new Promise(function(resolve, reject) {
|
|
2677
|
-
_this.resolve = resolve;
|
|
2678
|
-
_this.reject = reject;
|
|
2679
|
-
});
|
|
2680
|
-
};
|
|
2681
|
-
|
|
2682
|
-
var prefix = "[Galacean Effects]";
|
|
2683
|
-
var localLogger;
|
|
2684
|
-
function format(message) {
|
|
2685
|
-
return [
|
|
2686
|
-
"%c" + prefix,
|
|
2687
|
-
"color: #AA0100",
|
|
2688
|
-
"" + message
|
|
2689
|
-
];
|
|
2690
|
-
}
|
|
2691
|
-
function error(message) {
|
|
2692
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2693
|
-
args[_key - 1] = arguments[_key];
|
|
2694
|
-
}
|
|
2695
|
-
var _console;
|
|
2696
|
-
(_console = console).error.apply(_console, [].concat(format(message), [
|
|
2697
|
-
args
|
|
2698
|
-
]));
|
|
2699
|
-
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
2700
|
-
}
|
|
2701
|
-
/**
|
|
2702
|
-
* info 会转换成浏览器的 console.debug
|
|
2703
|
-
* @param message
|
|
2704
|
-
* @param args
|
|
2705
|
-
*/ function info(message) {
|
|
2706
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2707
|
-
args[_key - 1] = arguments[_key];
|
|
2708
|
-
}
|
|
2709
|
-
var _console;
|
|
2710
|
-
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
2711
|
-
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
2712
|
-
}
|
|
2713
|
-
function warn(message) {
|
|
2714
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2715
|
-
args[_key - 1] = arguments[_key];
|
|
2716
|
-
}
|
|
2717
|
-
var _console;
|
|
2718
|
-
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
2719
|
-
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
2720
|
-
}
|
|
2721
|
-
/**
|
|
2722
|
-
* 注册自定义埋点函数
|
|
2723
|
-
*
|
|
2724
|
-
* @param fn
|
|
2725
|
-
*/ function register(fn) {
|
|
2726
|
-
if (fn && isFunction(fn)) {
|
|
2727
|
-
localLogger = fn;
|
|
2728
|
-
}
|
|
2729
|
-
}
|
|
2730
|
-
var logger = {
|
|
2731
|
-
error: error,
|
|
2732
|
-
info: info,
|
|
2733
|
-
warn: warn,
|
|
2734
|
-
register: register
|
|
2735
|
-
};
|
|
2736
|
-
|
|
2737
|
-
exports.DestroyOptions = void 0;
|
|
2738
|
-
(function(DestroyOptions) {
|
|
2739
|
-
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
2740
|
-
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
2741
|
-
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
2742
|
-
})(exports.DestroyOptions || (exports.DestroyOptions = {}));
|
|
2743
|
-
function noop() {}
|
|
2744
|
-
/**
|
|
2745
|
-
* 判断对象是否是`String`类型
|
|
2746
|
-
*
|
|
2747
|
-
* @static
|
|
2748
|
-
* @function isString
|
|
2749
|
-
* @param obj - 要判断的对象
|
|
2750
|
-
* @return
|
|
2751
|
-
*/ function isString(obj) {
|
|
2752
|
-
return typeof obj === "string";
|
|
2753
|
-
}
|
|
2754
|
-
/**
|
|
2755
|
-
* 判断对象是否是`Array`类型
|
|
2756
|
-
*
|
|
2757
|
-
* @static
|
|
2758
|
-
* @function isArray
|
|
2759
|
-
* @param obj - 要判断的对象
|
|
2760
|
-
* @return
|
|
2761
|
-
*/ var isArray = Array.isArray || function(obj) {
|
|
2762
|
-
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
2763
|
-
};
|
|
2764
|
-
/**
|
|
2765
|
-
* 判断对象是否是函数类型
|
|
2766
|
-
*
|
|
2767
|
-
* @static
|
|
2768
|
-
* @function isFunction
|
|
2769
|
-
* @param obj - 要判断的对象
|
|
2770
|
-
* @return
|
|
2771
|
-
*/ function isFunction(obj) {
|
|
2772
|
-
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
2773
|
-
}
|
|
2774
|
-
/**
|
|
2775
|
-
* 判断对象是否是`Object`类型
|
|
2776
|
-
*
|
|
2777
|
-
* @static
|
|
2778
|
-
* @function isObject
|
|
2779
|
-
* @param obj - 要判断的对象
|
|
2780
|
-
* @return
|
|
2781
|
-
*/ function isObject(obj) {
|
|
2782
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* 判断对象是否是`Plain Object`类型
|
|
2786
|
-
*
|
|
2787
|
-
* @param obj - 要判断的对象
|
|
2788
|
-
* @returns
|
|
2789
|
-
*/ function isPlainObject(obj) {
|
|
2790
|
-
if (obj === null || typeof obj !== "object") {
|
|
2791
|
-
return false;
|
|
2792
|
-
}
|
|
2793
|
-
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
2794
|
-
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
2795
|
-
return false;
|
|
2796
|
-
}
|
|
2797
|
-
var proto = Object.getPrototypeOf(obj);
|
|
2798
|
-
if (proto === null) {
|
|
2799
|
-
return true;
|
|
2800
|
-
} // Object.create(null)
|
|
2801
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
2802
|
-
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
2803
|
-
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
2804
|
-
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
2805
|
-
}
|
|
2806
|
-
function isCanvas(canvas) {
|
|
2807
|
-
var _canvas_tagName;
|
|
2808
|
-
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
2809
|
-
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
2810
|
-
}
|
|
2811
|
-
function isPowerOfTwo(value) {
|
|
2812
|
-
return (value & value - 1) === 0 && value !== 0;
|
|
2813
|
-
}
|
|
2814
|
-
/**
|
|
2815
|
-
* 生成一个位于 min 和 max 之间的随机数
|
|
2816
|
-
* @param min
|
|
2817
|
-
* @param max
|
|
2818
|
-
* @returns
|
|
2819
|
-
*/ function randomInRange(min, max) {
|
|
2820
|
-
return min + Math.random() * (max - min);
|
|
2821
|
-
}
|
|
2822
|
-
function throwDestroyedError() {
|
|
2823
|
-
throw new Error("Destroyed item cannot be used again.");
|
|
2824
|
-
}
|
|
2825
|
-
function generateGUID() {
|
|
2826
|
-
return v4().replace(/-/g, "");
|
|
2827
|
-
}
|
|
2828
|
-
function base64ToFile(base64, filename, contentType) {
|
|
2829
|
-
if (filename === void 0) filename = "base64File";
|
|
2830
|
-
if (contentType === void 0) contentType = "";
|
|
2831
|
-
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
2832
|
-
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
2833
|
-
// 将 base64 编码的字符串转换为二进制字符串
|
|
2834
|
-
var byteCharacters = atob(base64WithoutPrefix);
|
|
2835
|
-
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
2836
|
-
var byteArrays = [];
|
|
2837
|
-
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
2838
|
-
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
2839
|
-
var slice = byteCharacters.slice(offset, offset + 512);
|
|
2840
|
-
var byteNumbers = new Array(slice.length);
|
|
2841
|
-
for(var i = 0; i < slice.length; i++){
|
|
2842
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
2843
|
-
}
|
|
2844
|
-
var byteArray = new Uint8Array(byteNumbers);
|
|
2845
|
-
byteArrays.push(byteArray);
|
|
2846
|
-
}
|
|
2847
|
-
// 使用字节数组创建 Blob 对象
|
|
2848
|
-
var blob = new Blob(byteArrays, {
|
|
2849
|
-
type: contentType
|
|
2850
|
-
});
|
|
2851
|
-
// 创建 File 对象
|
|
2852
|
-
var file = new File([
|
|
2853
|
-
blob
|
|
2854
|
-
], filename, {
|
|
2855
|
-
type: contentType
|
|
2856
|
-
});
|
|
2857
|
-
return file;
|
|
2858
|
-
}
|
|
2859
|
-
function applyMixins(derivedCtrl, baseCtrls) {
|
|
2860
|
-
baseCtrls.forEach(function(baseCtrl) {
|
|
2861
|
-
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
2862
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
2863
|
-
if (!propertyDescriptor) {
|
|
2864
|
-
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
2865
|
-
}
|
|
2866
|
-
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
2867
|
-
});
|
|
2868
|
-
});
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
var pluginLoaderMap = {};
|
|
2872
|
-
var plugins = [];
|
|
2873
|
-
/**
|
|
2874
|
-
* 注册 plugin
|
|
2875
|
-
* @param name
|
|
2876
|
-
* @param pluginClass class of plugin
|
|
2877
|
-
* @param itemClass class of item
|
|
2878
|
-
* @param isDefault load
|
|
2879
|
-
*/ function registerPlugin(name, pluginClass) {
|
|
2880
|
-
if (pluginLoaderMap[name]) {
|
|
2881
|
-
logger.error("Duplicate registration for plugin " + name + ".");
|
|
2882
|
-
}
|
|
2883
|
-
pluginLoaderMap[name] = pluginClass;
|
|
2884
|
-
var pluginInstance = new pluginClass();
|
|
2885
|
-
pluginInstance.name = name;
|
|
2886
|
-
pluginInstance.initialize();
|
|
2887
|
-
plugins.push(pluginInstance);
|
|
2888
|
-
plugins.sort(function(a, b) {
|
|
2889
|
-
return a.order - b.order;
|
|
2890
|
-
});
|
|
2891
|
-
}
|
|
2892
|
-
/**
|
|
2893
|
-
* 注销 plugin
|
|
2894
|
-
*/ function unregisterPlugin(name) {
|
|
2895
|
-
delete pluginLoaderMap[name];
|
|
2896
|
-
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
2897
|
-
return plugin.name === name;
|
|
2898
|
-
});
|
|
2899
|
-
if (pluginIndex !== -1) {
|
|
2900
|
-
plugins.splice(pluginIndex, 1);
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
var PluginSystem = /*#__PURE__*/ function() {
|
|
2904
|
-
function PluginSystem() {}
|
|
2905
|
-
PluginSystem.getPlugins = function getPlugins() {
|
|
2906
|
-
return plugins;
|
|
2907
|
-
};
|
|
2908
|
-
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2909
|
-
plugins.forEach(function(loader) {
|
|
2910
|
-
return loader.onCompositionConstructed(composition, scene);
|
|
2911
|
-
});
|
|
2912
|
-
};
|
|
2913
|
-
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2914
|
-
plugins.forEach(function(loader) {
|
|
2915
|
-
return loader.onCompositionDestroyed(comp);
|
|
2916
|
-
});
|
|
2917
|
-
};
|
|
2918
|
-
PluginSystem.processAssets = function processAssets(scene, options) {
|
|
2919
|
-
return _async_to_generator(function() {
|
|
2920
|
-
return __generator(this, function(_state) {
|
|
2921
|
-
return [
|
|
2922
|
-
2,
|
|
2923
|
-
Promise.all(plugins.map(function(plugin) {
|
|
2924
|
-
return plugin.processAssets(scene, options);
|
|
2925
|
-
}))
|
|
2926
|
-
];
|
|
2927
|
-
});
|
|
2928
|
-
})();
|
|
2929
|
-
};
|
|
2930
|
-
PluginSystem.loadResources = function loadResources(scene, options, engine) {
|
|
2931
|
-
plugins.forEach(function(loader) {
|
|
2932
|
-
return loader.prepareResource(scene, options, engine);
|
|
2933
|
-
});
|
|
2934
|
-
};
|
|
2935
|
-
return PluginSystem;
|
|
2936
|
-
}();
|
|
2937
|
-
var pluginInfoMap = {
|
|
2938
|
-
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
2939
|
-
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
2940
|
-
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
2941
|
-
"ffd": "@galacean/effects-plugin-ffd",
|
|
2942
|
-
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
2943
|
-
"model": "@galacean/effects-plugin-model",
|
|
2944
|
-
"video": "@galacean/effects-plugin-multimedia",
|
|
2945
|
-
"audio": "@galacean/effects-plugin-multimedia",
|
|
2946
|
-
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
2947
|
-
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
2948
|
-
"spine": "@galacean/effects-plugin-spine"
|
|
2949
|
-
};
|
|
2950
|
-
function getPluginUsageInfo(name) {
|
|
2951
|
-
var info = pluginInfoMap[name];
|
|
2952
|
-
if (info) {
|
|
2953
|
-
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
2954
|
-
} else {
|
|
2955
|
-
return "";
|
|
2956
|
-
}
|
|
2957
|
-
}
|
|
2958
|
-
|
|
2959
|
-
/**
|
|
2960
|
-
* 抽象插件类
|
|
2961
|
-
* 注册合成不同生命周期的回调函数
|
|
2962
|
-
*/ var AbstractPlugin = /*#__PURE__*/ function() {
|
|
2963
|
-
function AbstractPlugin() {
|
|
2964
|
-
this.order = 100;
|
|
2965
|
-
this.name = "";
|
|
2966
|
-
}
|
|
2967
|
-
var _proto = AbstractPlugin.prototype;
|
|
2968
|
-
_proto.initialize = function initialize() {};
|
|
2969
|
-
/**
|
|
2970
|
-
* loadScene 函数调用的时候会触发此函数,
|
|
2971
|
-
* 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
|
|
2972
|
-
* @param scene
|
|
2973
|
-
* @param options
|
|
2974
|
-
* @returns
|
|
2975
|
-
*/ _proto.processAssets = function processAssets(scene, options) {
|
|
2976
|
-
return _async_to_generator(function() {
|
|
2977
|
-
return __generator(this, function(_state) {
|
|
2978
|
-
return [
|
|
2979
|
-
2
|
|
2980
|
-
];
|
|
2981
|
-
});
|
|
2982
|
-
})();
|
|
2983
|
-
};
|
|
2984
|
-
/**
|
|
2985
|
-
* loadScene 函数调用的时候会触发此函数,
|
|
2986
|
-
* 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
|
|
2987
|
-
* 如果 promise 被 reject, loadScene 函数同样会被 reject,表示场景加载失败。
|
|
2988
|
-
* 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
|
|
2989
|
-
* 此阶段晚于 processAssets
|
|
2990
|
-
* @param {Scene} scene
|
|
2991
|
-
* @param {SceneLoadOptions} options
|
|
2992
|
-
*/ _proto.prepareResource = function prepareResource(scene, options, engine) {};
|
|
2993
|
-
_proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
|
|
2994
|
-
_proto.onCompositionDestroyed = function onCompositionDestroyed(composition) {};
|
|
2995
|
-
return AbstractPlugin;
|
|
2996
|
-
}();
|
|
2997
|
-
|
|
2998
|
-
function _set_prototype_of(o, p) {
|
|
2999
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
3000
|
-
o.__proto__ = p;
|
|
3001
|
-
return o;
|
|
3002
|
-
};
|
|
3003
|
-
return _set_prototype_of(o, p);
|
|
3004
|
-
}
|
|
3005
|
-
|
|
3006
|
-
function _inherits(subClass, superClass) {
|
|
3007
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
3008
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
3009
|
-
}
|
|
3010
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
3011
|
-
constructor: {
|
|
3012
|
-
value: subClass,
|
|
3013
|
-
writable: true,
|
|
3014
|
-
configurable: true
|
|
3015
|
-
}
|
|
3016
|
-
});
|
|
3017
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
2671
|
/**
|
|
3021
2672
|
* JSON 版本
|
|
3022
2673
|
*/ var JSONSceneVersion;
|
|
@@ -3764,6 +3415,17 @@ var NodeDataType;
|
|
|
3764
3415
|
MultimediaType["video"] = "video";
|
|
3765
3416
|
MultimediaType["audio"] = "audio";
|
|
3766
3417
|
})(MultimediaType || (MultimediaType = {}));
|
|
3418
|
+
var HevcVideoCodec;
|
|
3419
|
+
(function(HevcVideoCodec) {
|
|
3420
|
+
HevcVideoCodec["L30"] = "hev1.1.0.L30.B0";
|
|
3421
|
+
HevcVideoCodec["L60"] = "hev1.1.0.L60.B0";
|
|
3422
|
+
HevcVideoCodec["L63"] = "hev1.1.0.L63.B0";
|
|
3423
|
+
HevcVideoCodec["L90"] = "hev1.1.0.L90.B0";
|
|
3424
|
+
HevcVideoCodec["L93"] = "hev1.1.0.L93.B0";
|
|
3425
|
+
HevcVideoCodec["L120"] = "hev1.1.0.L120.B0";
|
|
3426
|
+
HevcVideoCodec["L150"] = "hev1.1.0.L150.B0";
|
|
3427
|
+
HevcVideoCodec["L180"] = "hev1.1.0.L180.B0";
|
|
3428
|
+
})(HevcVideoCodec || (HevcVideoCodec = {}));
|
|
3767
3429
|
|
|
3768
3430
|
var DataType;
|
|
3769
3431
|
(function(DataType) {
|
|
@@ -3969,6 +3631,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3969
3631
|
get NodeDataType () { return NodeDataType; },
|
|
3970
3632
|
get BackgroundType () { return BackgroundType; },
|
|
3971
3633
|
get MultimediaType () { return MultimediaType; },
|
|
3634
|
+
get HevcVideoCodec () { return HevcVideoCodec; },
|
|
3972
3635
|
get DataType () { return DataType; },
|
|
3973
3636
|
get GeometryType () { return GeometryType; },
|
|
3974
3637
|
get VertexFormatType () { return VertexFormatType; },
|
|
@@ -3976,6 +3639,391 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3976
3639
|
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
3977
3640
|
});
|
|
3978
3641
|
|
|
3642
|
+
/**
|
|
3643
|
+
* Check if the browser can play the given HEVC codec.
|
|
3644
|
+
* @param codec - The HEVC codec to check.
|
|
3645
|
+
* @returns True if the browser can probably or maybe play the codec, false otherwise.
|
|
3646
|
+
*/ function canPlayHevcCodec(codec) {
|
|
3647
|
+
var video = document.createElement("video");
|
|
3648
|
+
var contentType = 'video/mp4; codecs="' + codec + '"';
|
|
3649
|
+
var result = video.canPlayType(contentType);
|
|
3650
|
+
return result === "probably" || result === "maybe";
|
|
3651
|
+
}
|
|
3652
|
+
/**
|
|
3653
|
+
* Parse the given codec string into a HEVC video codec enum value.
|
|
3654
|
+
* @param codec - The codec string to parse.
|
|
3655
|
+
* @returns The corresponding HEVC video codec enum value, or undefined if the codec is invalid.
|
|
3656
|
+
*/ function parseCodec(codec) {
|
|
3657
|
+
// 传入的是完整的枚举值
|
|
3658
|
+
if (isCodecValue(codec)) {
|
|
3659
|
+
return codec;
|
|
3660
|
+
}
|
|
3661
|
+
// 传入的是枚举名称
|
|
3662
|
+
if (isCodecKey(codec)) {
|
|
3663
|
+
return HevcVideoCodec[codec];
|
|
3664
|
+
}
|
|
3665
|
+
return undefined;
|
|
3666
|
+
}
|
|
3667
|
+
function isCodecValue(codec) {
|
|
3668
|
+
return Object.keys(HevcVideoCodec).some(function(key) {
|
|
3669
|
+
return HevcVideoCodec[key] === codec;
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
function isCodecKey(codec) {
|
|
3673
|
+
return codec in HevcVideoCodec;
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
/**
|
|
3677
|
+
* Simple implementation of the deferred pattern.
|
|
3678
|
+
* An object that exposes a promise and functions to resolve and reject it.
|
|
3679
|
+
*/ var Deferred = function Deferred() {
|
|
3680
|
+
var _this = this;
|
|
3681
|
+
this.promise = new Promise(function(resolve, reject) {
|
|
3682
|
+
_this.resolve = resolve;
|
|
3683
|
+
_this.reject = reject;
|
|
3684
|
+
});
|
|
3685
|
+
};
|
|
3686
|
+
|
|
3687
|
+
var prefix = "[Galacean Effects]";
|
|
3688
|
+
var localLogger;
|
|
3689
|
+
function format(message) {
|
|
3690
|
+
return [
|
|
3691
|
+
"%c" + prefix,
|
|
3692
|
+
"color: #AA0100",
|
|
3693
|
+
"" + message
|
|
3694
|
+
];
|
|
3695
|
+
}
|
|
3696
|
+
function error(message) {
|
|
3697
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3698
|
+
args[_key - 1] = arguments[_key];
|
|
3699
|
+
}
|
|
3700
|
+
var _console;
|
|
3701
|
+
(_console = console).error.apply(_console, [].concat(format(message), [
|
|
3702
|
+
args
|
|
3703
|
+
]));
|
|
3704
|
+
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
3705
|
+
}
|
|
3706
|
+
/**
|
|
3707
|
+
* info 会转换成浏览器的 console.debug
|
|
3708
|
+
* @param message
|
|
3709
|
+
* @param args
|
|
3710
|
+
*/ function info(message) {
|
|
3711
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3712
|
+
args[_key - 1] = arguments[_key];
|
|
3713
|
+
}
|
|
3714
|
+
var _console;
|
|
3715
|
+
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
3716
|
+
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
3717
|
+
}
|
|
3718
|
+
function warn(message) {
|
|
3719
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3720
|
+
args[_key - 1] = arguments[_key];
|
|
3721
|
+
}
|
|
3722
|
+
var _console;
|
|
3723
|
+
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
3724
|
+
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
3725
|
+
}
|
|
3726
|
+
/**
|
|
3727
|
+
* 注册自定义埋点函数
|
|
3728
|
+
*
|
|
3729
|
+
* @param fn
|
|
3730
|
+
*/ function register(fn) {
|
|
3731
|
+
if (fn && isFunction(fn)) {
|
|
3732
|
+
localLogger = fn;
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
var logger = {
|
|
3736
|
+
error: error,
|
|
3737
|
+
info: info,
|
|
3738
|
+
warn: warn,
|
|
3739
|
+
register: register
|
|
3740
|
+
};
|
|
3741
|
+
|
|
3742
|
+
exports.DestroyOptions = void 0;
|
|
3743
|
+
(function(DestroyOptions) {
|
|
3744
|
+
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
3745
|
+
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
3746
|
+
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
3747
|
+
})(exports.DestroyOptions || (exports.DestroyOptions = {}));
|
|
3748
|
+
function noop() {}
|
|
3749
|
+
/**
|
|
3750
|
+
* 判断对象是否是`String`类型
|
|
3751
|
+
*
|
|
3752
|
+
* @static
|
|
3753
|
+
* @function isString
|
|
3754
|
+
* @param obj - 要判断的对象
|
|
3755
|
+
* @return
|
|
3756
|
+
*/ function isString(obj) {
|
|
3757
|
+
return typeof obj === "string";
|
|
3758
|
+
}
|
|
3759
|
+
/**
|
|
3760
|
+
* 判断对象是否是`Array`类型
|
|
3761
|
+
*
|
|
3762
|
+
* @static
|
|
3763
|
+
* @function isArray
|
|
3764
|
+
* @param obj - 要判断的对象
|
|
3765
|
+
* @return
|
|
3766
|
+
*/ var isArray = Array.isArray || function(obj) {
|
|
3767
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
3768
|
+
};
|
|
3769
|
+
/**
|
|
3770
|
+
* 判断对象是否是函数类型
|
|
3771
|
+
*
|
|
3772
|
+
* @static
|
|
3773
|
+
* @function isFunction
|
|
3774
|
+
* @param obj - 要判断的对象
|
|
3775
|
+
* @return
|
|
3776
|
+
*/ function isFunction(obj) {
|
|
3777
|
+
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
3778
|
+
}
|
|
3779
|
+
/**
|
|
3780
|
+
* 判断对象是否是`Object`类型
|
|
3781
|
+
*
|
|
3782
|
+
* @static
|
|
3783
|
+
* @function isObject
|
|
3784
|
+
* @param obj - 要判断的对象
|
|
3785
|
+
* @return
|
|
3786
|
+
*/ function isObject(obj) {
|
|
3787
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
3788
|
+
}
|
|
3789
|
+
/**
|
|
3790
|
+
* 判断对象是否是`Plain Object`类型
|
|
3791
|
+
*
|
|
3792
|
+
* @param obj - 要判断的对象
|
|
3793
|
+
* @returns
|
|
3794
|
+
*/ function isPlainObject(obj) {
|
|
3795
|
+
if (obj === null || typeof obj !== "object") {
|
|
3796
|
+
return false;
|
|
3797
|
+
}
|
|
3798
|
+
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
3799
|
+
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
3800
|
+
return false;
|
|
3801
|
+
}
|
|
3802
|
+
var proto = Object.getPrototypeOf(obj);
|
|
3803
|
+
if (proto === null) {
|
|
3804
|
+
return true;
|
|
3805
|
+
} // Object.create(null)
|
|
3806
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
3807
|
+
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
3808
|
+
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
3809
|
+
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
3810
|
+
}
|
|
3811
|
+
function isCanvas(canvas) {
|
|
3812
|
+
var _canvas_tagName;
|
|
3813
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
3814
|
+
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
3815
|
+
}
|
|
3816
|
+
function isPowerOfTwo(value) {
|
|
3817
|
+
return (value & value - 1) === 0 && value !== 0;
|
|
3818
|
+
}
|
|
3819
|
+
/**
|
|
3820
|
+
* 生成一个位于 min 和 max 之间的随机数
|
|
3821
|
+
* @param min
|
|
3822
|
+
* @param max
|
|
3823
|
+
* @returns
|
|
3824
|
+
*/ function randomInRange(min, max) {
|
|
3825
|
+
return min + Math.random() * (max - min);
|
|
3826
|
+
}
|
|
3827
|
+
function throwDestroyedError() {
|
|
3828
|
+
throw new Error("Destroyed item cannot be used again.");
|
|
3829
|
+
}
|
|
3830
|
+
function generateGUID() {
|
|
3831
|
+
return v4().replace(/-/g, "");
|
|
3832
|
+
}
|
|
3833
|
+
function base64ToFile(base64, filename, contentType) {
|
|
3834
|
+
if (filename === void 0) filename = "base64File";
|
|
3835
|
+
if (contentType === void 0) contentType = "";
|
|
3836
|
+
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
3837
|
+
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
3838
|
+
// 将 base64 编码的字符串转换为二进制字符串
|
|
3839
|
+
var byteCharacters = atob(base64WithoutPrefix);
|
|
3840
|
+
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
3841
|
+
var byteArrays = [];
|
|
3842
|
+
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
3843
|
+
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
3844
|
+
var slice = byteCharacters.slice(offset, offset + 512);
|
|
3845
|
+
var byteNumbers = new Array(slice.length);
|
|
3846
|
+
for(var i = 0; i < slice.length; i++){
|
|
3847
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
3848
|
+
}
|
|
3849
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
3850
|
+
byteArrays.push(byteArray);
|
|
3851
|
+
}
|
|
3852
|
+
// 使用字节数组创建 Blob 对象
|
|
3853
|
+
var blob = new Blob(byteArrays, {
|
|
3854
|
+
type: contentType
|
|
3855
|
+
});
|
|
3856
|
+
// 创建 File 对象
|
|
3857
|
+
var file = new File([
|
|
3858
|
+
blob
|
|
3859
|
+
], filename, {
|
|
3860
|
+
type: contentType
|
|
3861
|
+
});
|
|
3862
|
+
return file;
|
|
3863
|
+
}
|
|
3864
|
+
function applyMixins(derivedCtrl, baseCtrls) {
|
|
3865
|
+
baseCtrls.forEach(function(baseCtrl) {
|
|
3866
|
+
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
3867
|
+
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
3868
|
+
if (!propertyDescriptor) {
|
|
3869
|
+
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
3870
|
+
}
|
|
3871
|
+
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
3872
|
+
});
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
var pluginLoaderMap = {};
|
|
3877
|
+
var plugins = [];
|
|
3878
|
+
/**
|
|
3879
|
+
* 注册 plugin
|
|
3880
|
+
* @param name
|
|
3881
|
+
* @param pluginClass class of plugin
|
|
3882
|
+
* @param itemClass class of item
|
|
3883
|
+
* @param isDefault load
|
|
3884
|
+
*/ function registerPlugin(name, pluginClass) {
|
|
3885
|
+
if (pluginLoaderMap[name]) {
|
|
3886
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
3887
|
+
}
|
|
3888
|
+
pluginLoaderMap[name] = pluginClass;
|
|
3889
|
+
var pluginInstance = new pluginClass();
|
|
3890
|
+
pluginInstance.name = name;
|
|
3891
|
+
plugins.push(pluginInstance);
|
|
3892
|
+
plugins.sort(function(a, b) {
|
|
3893
|
+
return a.order - b.order;
|
|
3894
|
+
});
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* 注销 plugin
|
|
3898
|
+
*/ function unregisterPlugin(name) {
|
|
3899
|
+
delete pluginLoaderMap[name];
|
|
3900
|
+
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
3901
|
+
return plugin.name === name;
|
|
3902
|
+
});
|
|
3903
|
+
if (pluginIndex !== -1) {
|
|
3904
|
+
plugins.splice(pluginIndex, 1);
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
var PluginSystem = /*#__PURE__*/ function() {
|
|
3908
|
+
function PluginSystem() {}
|
|
3909
|
+
PluginSystem.getPlugins = function getPlugins() {
|
|
3910
|
+
return plugins;
|
|
3911
|
+
};
|
|
3912
|
+
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
3913
|
+
plugins.forEach(function(loader) {
|
|
3914
|
+
return loader.onCompositionCreated(composition, scene);
|
|
3915
|
+
});
|
|
3916
|
+
};
|
|
3917
|
+
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
3918
|
+
plugins.forEach(function(loader) {
|
|
3919
|
+
return loader.onCompositionDestroy(comp);
|
|
3920
|
+
});
|
|
3921
|
+
};
|
|
3922
|
+
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
3923
|
+
return _async_to_generator(function() {
|
|
3924
|
+
return __generator(this, function(_state) {
|
|
3925
|
+
return [
|
|
3926
|
+
2,
|
|
3927
|
+
Promise.all(plugins.map(function(plugin) {
|
|
3928
|
+
return plugin.onAssetsLoadStart(scene, options);
|
|
3929
|
+
}))
|
|
3930
|
+
];
|
|
3931
|
+
});
|
|
3932
|
+
})();
|
|
3933
|
+
};
|
|
3934
|
+
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
3935
|
+
plugins.forEach(function(loader) {
|
|
3936
|
+
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
3937
|
+
});
|
|
3938
|
+
};
|
|
3939
|
+
return PluginSystem;
|
|
3940
|
+
}();
|
|
3941
|
+
var pluginInfoMap = {
|
|
3942
|
+
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
3943
|
+
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
3944
|
+
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
3945
|
+
"ffd": "@galacean/effects-plugin-ffd",
|
|
3946
|
+
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
3947
|
+
"model": "@galacean/effects-plugin-model",
|
|
3948
|
+
"video": "@galacean/effects-plugin-multimedia",
|
|
3949
|
+
"audio": "@galacean/effects-plugin-multimedia",
|
|
3950
|
+
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
3951
|
+
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
3952
|
+
"spine": "@galacean/effects-plugin-spine"
|
|
3953
|
+
};
|
|
3954
|
+
function getPluginUsageInfo(name) {
|
|
3955
|
+
var info = pluginInfoMap[name];
|
|
3956
|
+
if (info) {
|
|
3957
|
+
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
3958
|
+
} else {
|
|
3959
|
+
return "";
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
/**
|
|
3964
|
+
* 抽象插件类
|
|
3965
|
+
* 注册合成不同生命周期的回调函数
|
|
3966
|
+
*/ var Plugin = /*#__PURE__*/ function() {
|
|
3967
|
+
function Plugin() {
|
|
3968
|
+
this.order = 100;
|
|
3969
|
+
this.name = "Plugin";
|
|
3970
|
+
}
|
|
3971
|
+
var _proto = Plugin.prototype;
|
|
3972
|
+
/**
|
|
3973
|
+
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
3974
|
+
* 此阶段适合发起异步资源请求。
|
|
3975
|
+
* @param scene - 场景对象
|
|
3976
|
+
* @param options - 场景加载选项
|
|
3977
|
+
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
3978
|
+
return _async_to_generator(function() {
|
|
3979
|
+
return __generator(this, function(_state) {
|
|
3980
|
+
return [
|
|
3981
|
+
2
|
|
3982
|
+
];
|
|
3983
|
+
});
|
|
3984
|
+
})();
|
|
3985
|
+
};
|
|
3986
|
+
/**
|
|
3987
|
+
* 场景资源加载完成后触发。
|
|
3988
|
+
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
3989
|
+
* @param scene - 场景对象
|
|
3990
|
+
* @param options - 场景加载选项
|
|
3991
|
+
* @param engine - 引擎实例
|
|
3992
|
+
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
3993
|
+
/**
|
|
3994
|
+
* 合成创建完成后触发。
|
|
3995
|
+
* @param composition - 合成对象
|
|
3996
|
+
* @param scene - 场景对象
|
|
3997
|
+
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
3998
|
+
/**
|
|
3999
|
+
* 合成销毁时触发。
|
|
4000
|
+
* @param composition - 合成对象
|
|
4001
|
+
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
4002
|
+
return Plugin;
|
|
4003
|
+
}();
|
|
4004
|
+
|
|
4005
|
+
function _set_prototype_of(o, p) {
|
|
4006
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
4007
|
+
o.__proto__ = p;
|
|
4008
|
+
return o;
|
|
4009
|
+
};
|
|
4010
|
+
return _set_prototype_of(o, p);
|
|
4011
|
+
}
|
|
4012
|
+
|
|
4013
|
+
function _inherits(subClass, superClass) {
|
|
4014
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
4015
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
4016
|
+
}
|
|
4017
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
4018
|
+
constructor: {
|
|
4019
|
+
value: subClass,
|
|
4020
|
+
writable: true,
|
|
4021
|
+
configurable: true
|
|
4022
|
+
}
|
|
4023
|
+
});
|
|
4024
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
4025
|
+
}
|
|
4026
|
+
|
|
3979
4027
|
function _array_like_to_array(arr, len) {
|
|
3980
4028
|
if (len == null || len > arr.length) len = arr.length;
|
|
3981
4029
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -10652,6 +10700,9 @@ var DrawObjectPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10652
10700
|
stencilAction: exports.TextureLoadAction.clear
|
|
10653
10701
|
});
|
|
10654
10702
|
}
|
|
10703
|
+
this.meshes.sort(function(a, b) {
|
|
10704
|
+
return a.priority - b.priority;
|
|
10705
|
+
});
|
|
10655
10706
|
renderer.renderMeshes(this.meshes);
|
|
10656
10707
|
};
|
|
10657
10708
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
@@ -16589,13 +16640,49 @@ exports.CameraController = __decorate([
|
|
|
16589
16640
|
effectsClass(DataType.CameraController)
|
|
16590
16641
|
], exports.CameraController);
|
|
16591
16642
|
|
|
16592
|
-
|
|
16593
|
-
|
|
16643
|
+
function _get_prototype_of(o) {
|
|
16644
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
16645
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
16646
|
+
};
|
|
16647
|
+
return _get_prototype_of(o);
|
|
16648
|
+
}
|
|
16649
|
+
|
|
16650
|
+
function _is_native_function(fn) {
|
|
16651
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
16652
|
+
}
|
|
16653
|
+
|
|
16654
|
+
function _wrap_native_super(Class) {
|
|
16655
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
16656
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
16657
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
16658
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
16659
|
+
if (typeof _cache !== "undefined") {
|
|
16660
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
16661
|
+
_cache.set(Class, Wrapper);
|
|
16662
|
+
}
|
|
16663
|
+
function Wrapper() {
|
|
16664
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
16665
|
+
}
|
|
16666
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
16667
|
+
constructor: {
|
|
16668
|
+
value: Wrapper,
|
|
16669
|
+
enumerable: false,
|
|
16670
|
+
writable: true,
|
|
16671
|
+
configurable: true
|
|
16672
|
+
}
|
|
16673
|
+
});
|
|
16674
|
+
return _set_prototype_of(Wrapper, Class);
|
|
16675
|
+
};
|
|
16676
|
+
return _wrap_native_super(Class);
|
|
16677
|
+
}
|
|
16678
|
+
|
|
16679
|
+
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
16680
|
+
_inherits(CameraVFXItemLoader, Plugin);
|
|
16594
16681
|
function CameraVFXItemLoader() {
|
|
16595
|
-
return
|
|
16682
|
+
return Plugin.apply(this, arguments);
|
|
16596
16683
|
}
|
|
16597
16684
|
return CameraVFXItemLoader;
|
|
16598
|
-
}(
|
|
16685
|
+
}(_wrap_native_super(Plugin));
|
|
16599
16686
|
|
|
16600
16687
|
exports.HitTestType = void 0;
|
|
16601
16688
|
(function(HitTestType) {
|
|
@@ -16879,13 +16966,13 @@ function getCoord(event) {
|
|
|
16879
16966
|
};
|
|
16880
16967
|
}
|
|
16881
16968
|
|
|
16882
|
-
var InteractLoader = /*#__PURE__*/ function(
|
|
16883
|
-
_inherits(InteractLoader,
|
|
16969
|
+
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
16970
|
+
_inherits(InteractLoader, Plugin);
|
|
16884
16971
|
function InteractLoader() {
|
|
16885
|
-
return
|
|
16972
|
+
return Plugin.apply(this, arguments);
|
|
16886
16973
|
}
|
|
16887
16974
|
return InteractLoader;
|
|
16888
|
-
}(
|
|
16975
|
+
}(_wrap_native_super(Plugin));
|
|
16889
16976
|
|
|
16890
16977
|
var vertex = "\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n}\n";
|
|
16891
16978
|
var fragment = "\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n";
|
|
@@ -17484,16 +17571,16 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
17484
17571
|
return MeshCollider;
|
|
17485
17572
|
}();
|
|
17486
17573
|
|
|
17487
|
-
var SpriteLoader = /*#__PURE__*/ function(
|
|
17488
|
-
_inherits(SpriteLoader,
|
|
17574
|
+
var SpriteLoader = /*#__PURE__*/ function(Plugin) {
|
|
17575
|
+
_inherits(SpriteLoader, Plugin);
|
|
17489
17576
|
function SpriteLoader() {
|
|
17490
17577
|
var _this;
|
|
17491
|
-
_this =
|
|
17578
|
+
_this = Plugin.apply(this, arguments) || this;
|
|
17492
17579
|
_this.name = "sprite";
|
|
17493
17580
|
return _this;
|
|
17494
17581
|
}
|
|
17495
17582
|
return SpriteLoader;
|
|
17496
|
-
}(
|
|
17583
|
+
}(_wrap_native_super(Plugin));
|
|
17497
17584
|
|
|
17498
17585
|
/**
|
|
17499
17586
|
* 动画图可播放节点对象
|
|
@@ -19984,7 +20071,7 @@ function calculateDirection(prePoint, point, nextPoint) {
|
|
|
19984
20071
|
if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
|
|
19985
20072
|
particleSystem.reset();
|
|
19986
20073
|
}
|
|
19987
|
-
particleSystem.
|
|
20074
|
+
particleSystem.simulate(this.time - particleSystem.time);
|
|
19988
20075
|
}
|
|
19989
20076
|
this.lastTime = this.time;
|
|
19990
20077
|
};
|
|
@@ -21435,126 +21522,133 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21435
21522
|
this.initEmitterTransform();
|
|
21436
21523
|
};
|
|
21437
21524
|
_proto.onUpdate = function onUpdate(dt) {
|
|
21438
|
-
this.
|
|
21525
|
+
if (!this.frozen) {
|
|
21526
|
+
this.update(dt);
|
|
21527
|
+
}
|
|
21528
|
+
};
|
|
21529
|
+
_proto.simulate = function simulate(time) {
|
|
21530
|
+
this.update(time * 1000);
|
|
21531
|
+
this.frozen = true;
|
|
21439
21532
|
};
|
|
21440
21533
|
_proto.update = function update(delta) {
|
|
21441
21534
|
var _this = this;
|
|
21442
|
-
if (this.started
|
|
21443
|
-
|
|
21444
|
-
|
|
21445
|
-
|
|
21446
|
-
|
|
21447
|
-
|
|
21448
|
-
|
|
21449
|
-
|
|
21450
|
-
|
|
21451
|
-
|
|
21452
|
-
|
|
21453
|
-
|
|
21454
|
-
|
|
21455
|
-
|
|
21456
|
-
|
|
21457
|
-
|
|
21458
|
-
|
|
21459
|
-
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21535
|
+
if (!this.started) {
|
|
21536
|
+
return;
|
|
21537
|
+
}
|
|
21538
|
+
var now = this.time + delta / 1000;
|
|
21539
|
+
var options = this.options;
|
|
21540
|
+
var loopStartTime = this.loopStartTime;
|
|
21541
|
+
var emission = this.emission;
|
|
21542
|
+
this.time = now;
|
|
21543
|
+
this.upDirectionWorld = null;
|
|
21544
|
+
this.renderer.updateTime(now, delta);
|
|
21545
|
+
var link = this.particleLink;
|
|
21546
|
+
var emitterLifetime = (now - loopStartTime) / this.item.duration;
|
|
21547
|
+
var timePassed = this.timePassed;
|
|
21548
|
+
var trailUpdated = false;
|
|
21549
|
+
var updateTrail = function() {
|
|
21550
|
+
if (_this.trails && !trailUpdated) {
|
|
21551
|
+
trailUpdated = true;
|
|
21552
|
+
link.forEach(function(param) {
|
|
21553
|
+
var time = param[0], pointIndex = param[1], delay = param[2], point = param[3];
|
|
21554
|
+
if (time < timePassed) {
|
|
21555
|
+
_this.clearPointTrail(pointIndex);
|
|
21556
|
+
} else if (timePassed > delay) {
|
|
21557
|
+
_this.updatePointTrail(pointIndex, emitterLifetime, point, delay);
|
|
21558
|
+
}
|
|
21559
|
+
});
|
|
21560
|
+
}
|
|
21561
|
+
};
|
|
21562
|
+
if (!this.ended) {
|
|
21563
|
+
var duration = this.item.duration;
|
|
21564
|
+
var lifetime = this.lifetime;
|
|
21565
|
+
if (timePassed < duration) {
|
|
21566
|
+
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21567
|
+
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21568
|
+
var maxEmissionCount = pointCount;
|
|
21569
|
+
var timeDelta = interval / pointCount;
|
|
21570
|
+
var meshTime = now;
|
|
21571
|
+
var maxCount = options.maxCount;
|
|
21572
|
+
this.updateEmitterTransform(timePassed);
|
|
21573
|
+
var shouldSkipGenerate = function() {
|
|
21574
|
+
var first = link.first;
|
|
21575
|
+
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21576
|
+
};
|
|
21577
|
+
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21578
|
+
if (shouldSkipGenerate()) {
|
|
21579
|
+
break;
|
|
21580
|
+
}
|
|
21581
|
+
var p = this.createPoint(lifetime);
|
|
21582
|
+
p.delay += meshTime + i * timeDelta;
|
|
21583
|
+
this.addParticle(p, maxCount);
|
|
21584
|
+
this.lastEmitTime = timePassed;
|
|
21465
21585
|
}
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
if (timePassed < duration) {
|
|
21471
|
-
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21472
|
-
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21473
|
-
var maxEmissionCount = pointCount;
|
|
21474
|
-
var timeDelta = interval / pointCount;
|
|
21475
|
-
var meshTime = now;
|
|
21476
|
-
var maxCount = options.maxCount;
|
|
21477
|
-
this.updateEmitterTransform(timePassed);
|
|
21478
|
-
var shouldSkipGenerate = function() {
|
|
21479
|
-
var first = link.first;
|
|
21480
|
-
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21481
|
-
};
|
|
21482
|
-
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21483
|
-
if (shouldSkipGenerate()) {
|
|
21484
|
-
break;
|
|
21485
|
-
}
|
|
21486
|
-
var p = this.createPoint(lifetime);
|
|
21487
|
-
p.delay += meshTime + i * timeDelta;
|
|
21488
|
-
this.addParticle(p, maxCount);
|
|
21489
|
-
this.lastEmitTime = timePassed;
|
|
21586
|
+
var bursts = emission.bursts;
|
|
21587
|
+
for(var j = (bursts == null ? void 0 : bursts.length) - 1, cursor = 0; j >= 0 && cursor < maxCount; j--){
|
|
21588
|
+
if (shouldSkipGenerate()) {
|
|
21589
|
+
break;
|
|
21490
21590
|
}
|
|
21491
|
-
var
|
|
21492
|
-
|
|
21493
|
-
|
|
21494
|
-
|
|
21591
|
+
var burst = bursts[j];
|
|
21592
|
+
var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
|
|
21593
|
+
if (opts) {
|
|
21594
|
+
var originVec = [
|
|
21595
|
+
0,
|
|
21596
|
+
0,
|
|
21597
|
+
0
|
|
21598
|
+
];
|
|
21599
|
+
var offsets = emission.burstOffsets[j];
|
|
21600
|
+
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21601
|
+
if (burst.once) {
|
|
21602
|
+
this.removeBurst(j);
|
|
21495
21603
|
}
|
|
21496
|
-
var
|
|
21497
|
-
|
|
21498
|
-
|
|
21499
|
-
|
|
21500
|
-
0,
|
|
21501
|
-
0,
|
|
21502
|
-
0
|
|
21503
|
-
];
|
|
21504
|
-
var offsets = emission.burstOffsets[j];
|
|
21505
|
-
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21506
|
-
if (burst.once) {
|
|
21507
|
-
this.removeBurst(j);
|
|
21508
|
-
}
|
|
21509
|
-
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21510
|
-
var _p_transform;
|
|
21511
|
-
if (shouldSkipGenerate()) {
|
|
21512
|
-
break;
|
|
21513
|
-
}
|
|
21514
|
-
var p1 = this.initPoint(this.shape.generate({
|
|
21515
|
-
total: opts.total,
|
|
21516
|
-
index: opts.index,
|
|
21517
|
-
burstIndex: i1,
|
|
21518
|
-
burstCount: opts.count
|
|
21519
|
-
}));
|
|
21520
|
-
p1.delay += meshTime;
|
|
21521
|
-
cursor++;
|
|
21522
|
-
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21523
|
-
this.addParticle(p1, maxCount);
|
|
21604
|
+
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21605
|
+
var _p_transform;
|
|
21606
|
+
if (shouldSkipGenerate()) {
|
|
21607
|
+
break;
|
|
21524
21608
|
}
|
|
21609
|
+
var p1 = this.initPoint(this.shape.generate({
|
|
21610
|
+
total: opts.total,
|
|
21611
|
+
index: opts.index,
|
|
21612
|
+
burstIndex: i1,
|
|
21613
|
+
burstCount: opts.count
|
|
21614
|
+
}));
|
|
21615
|
+
p1.delay += meshTime;
|
|
21616
|
+
cursor++;
|
|
21617
|
+
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21618
|
+
this.addParticle(p1, maxCount);
|
|
21525
21619
|
}
|
|
21526
21620
|
}
|
|
21527
|
-
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21528
|
-
updateTrail();
|
|
21529
|
-
this.loopStartTime = now - duration;
|
|
21530
|
-
this.lastEmitTime -= duration;
|
|
21531
|
-
this.time -= duration;
|
|
21532
|
-
emission.bursts.forEach(function(b) {
|
|
21533
|
-
return b.reset();
|
|
21534
|
-
});
|
|
21535
|
-
this.particleLink.forEach(function(content) {
|
|
21536
|
-
content[0] -= duration;
|
|
21537
|
-
content[2] -= duration;
|
|
21538
|
-
content[3].delay -= duration;
|
|
21539
|
-
});
|
|
21540
|
-
this.renderer.minusTimeForLoop(duration);
|
|
21541
|
-
} else {
|
|
21542
|
-
this.ended = true;
|
|
21543
|
-
var endBehavior = this.item.endBehavior;
|
|
21544
|
-
if (endBehavior === EndBehavior.freeze) {
|
|
21545
|
-
this.frozen = true;
|
|
21546
|
-
}
|
|
21547
21621
|
}
|
|
21548
|
-
} else if (this.item.endBehavior
|
|
21549
|
-
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21622
|
+
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21623
|
+
updateTrail();
|
|
21624
|
+
this.loopStartTime = now - duration;
|
|
21625
|
+
this.lastEmitTime -= duration;
|
|
21626
|
+
this.time -= duration;
|
|
21627
|
+
emission.bursts.forEach(function(b) {
|
|
21628
|
+
return b.reset();
|
|
21629
|
+
});
|
|
21630
|
+
this.particleLink.forEach(function(content) {
|
|
21631
|
+
content[0] -= duration;
|
|
21632
|
+
content[2] -= duration;
|
|
21633
|
+
content[3].delay -= duration;
|
|
21634
|
+
});
|
|
21635
|
+
this.renderer.minusTimeForLoop(duration);
|
|
21636
|
+
} else {
|
|
21637
|
+
this.ended = true;
|
|
21638
|
+
var endBehavior = this.item.endBehavior;
|
|
21639
|
+
if (endBehavior === EndBehavior.freeze) {
|
|
21640
|
+
this.frozen = true;
|
|
21641
|
+
}
|
|
21642
|
+
}
|
|
21643
|
+
} else if (this.item.endBehavior !== EndBehavior.restart) {
|
|
21644
|
+
if (EndBehavior.destroy === this.item.endBehavior) {
|
|
21645
|
+
var node = link.last;
|
|
21646
|
+
if (node && node.content[0] < this.time) {
|
|
21647
|
+
this.destroyed = true;
|
|
21554
21648
|
}
|
|
21555
21649
|
}
|
|
21556
|
-
updateTrail();
|
|
21557
21650
|
}
|
|
21651
|
+
updateTrail();
|
|
21558
21652
|
};
|
|
21559
21653
|
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
21560
21654
|
if (!this.isActiveAndEnabled) {
|
|
@@ -25594,7 +25688,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25594
25688
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25595
25689
|
_this.time = 0;
|
|
25596
25690
|
_this.duration = 1;
|
|
25597
|
-
_this.loop = true;
|
|
25598
25691
|
/**
|
|
25599
25692
|
* @internal
|
|
25600
25693
|
*/ _this.splits = singleSplits;
|
|
@@ -25609,11 +25702,13 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25609
25702
|
var _this = this;
|
|
25610
25703
|
var time = this.time;
|
|
25611
25704
|
var duration = this.duration;
|
|
25612
|
-
|
|
25705
|
+
var textureAnimation = this.textureSheetAnimation;
|
|
25706
|
+
var _textureAnimation_loop;
|
|
25707
|
+
var loop = (_textureAnimation_loop = textureAnimation == null ? void 0 : textureAnimation.loop) != null ? _textureAnimation_loop : true;
|
|
25708
|
+
if (time > duration && loop) {
|
|
25613
25709
|
time = time % duration;
|
|
25614
25710
|
}
|
|
25615
25711
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
25616
|
-
var ta = this.textureSheetAnimation;
|
|
25617
25712
|
var video = this.renderer.texture.source.video;
|
|
25618
25713
|
if (video) {
|
|
25619
25714
|
if (time === 0) {
|
|
@@ -25625,9 +25720,9 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25625
25720
|
}
|
|
25626
25721
|
this.renderer.texture.uploadCurrentVideoFrame();
|
|
25627
25722
|
}
|
|
25628
|
-
if (
|
|
25723
|
+
if (textureAnimation) {
|
|
25629
25724
|
var _this_material_getVector4;
|
|
25630
|
-
var total =
|
|
25725
|
+
var total = textureAnimation.total || textureAnimation.row * textureAnimation.col;
|
|
25631
25726
|
var texRectX = 0;
|
|
25632
25727
|
var texRectY = 0;
|
|
25633
25728
|
var texRectW = 1;
|
|
@@ -25648,20 +25743,20 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25648
25743
|
}
|
|
25649
25744
|
var dx, dy;
|
|
25650
25745
|
if (flip) {
|
|
25651
|
-
dx = 1 /
|
|
25652
|
-
dy = 1 /
|
|
25746
|
+
dx = 1 / textureAnimation.row * texRectW;
|
|
25747
|
+
dy = 1 / textureAnimation.col * texRectH;
|
|
25653
25748
|
} else {
|
|
25654
|
-
dx = 1 /
|
|
25655
|
-
dy = 1 /
|
|
25749
|
+
dx = 1 / textureAnimation.col * texRectW;
|
|
25750
|
+
dy = 1 / textureAnimation.row * texRectH;
|
|
25656
25751
|
}
|
|
25657
25752
|
var texOffset;
|
|
25658
|
-
if (
|
|
25753
|
+
if (textureAnimation.animate) {
|
|
25659
25754
|
var frameIndex = Math.round(life * (total - 1));
|
|
25660
|
-
var yIndex = Math.floor(frameIndex /
|
|
25661
|
-
var xIndex = frameIndex - yIndex *
|
|
25755
|
+
var yIndex = Math.floor(frameIndex / textureAnimation.col);
|
|
25756
|
+
var xIndex = frameIndex - yIndex * textureAnimation.col;
|
|
25662
25757
|
texOffset = flip ? [
|
|
25663
25758
|
dx * yIndex,
|
|
25664
|
-
dy * (
|
|
25759
|
+
dy * (textureAnimation.col - xIndex)
|
|
25665
25760
|
] : [
|
|
25666
25761
|
dx * xIndex,
|
|
25667
25762
|
dy * (1 + yIndex)
|
|
@@ -25849,8 +25944,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25849
25944
|
var _data_duration;
|
|
25850
25945
|
//@ts-expect-error
|
|
25851
25946
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
25852
|
-
var _data_loop;
|
|
25853
|
-
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
25854
25947
|
};
|
|
25855
25948
|
return SpriteComponent;
|
|
25856
25949
|
}(MaskableGraphic);
|
|
@@ -25858,21 +25951,21 @@ exports.SpriteComponent = __decorate([
|
|
|
25858
25951
|
effectsClass(DataType.SpriteComponent)
|
|
25859
25952
|
], exports.SpriteComponent);
|
|
25860
25953
|
|
|
25861
|
-
var ParticleLoader = /*#__PURE__*/ function(
|
|
25862
|
-
_inherits(ParticleLoader,
|
|
25954
|
+
var ParticleLoader = /*#__PURE__*/ function(Plugin) {
|
|
25955
|
+
_inherits(ParticleLoader, Plugin);
|
|
25863
25956
|
function ParticleLoader() {
|
|
25864
|
-
return
|
|
25957
|
+
return Plugin.apply(this, arguments);
|
|
25865
25958
|
}
|
|
25866
25959
|
return ParticleLoader;
|
|
25867
|
-
}(
|
|
25960
|
+
}(_wrap_native_super(Plugin));
|
|
25868
25961
|
|
|
25869
|
-
var CalculateLoader = /*#__PURE__*/ function(
|
|
25870
|
-
_inherits(CalculateLoader,
|
|
25962
|
+
var CalculateLoader = /*#__PURE__*/ function(Plugin) {
|
|
25963
|
+
_inherits(CalculateLoader, Plugin);
|
|
25871
25964
|
function CalculateLoader() {
|
|
25872
|
-
return
|
|
25965
|
+
return Plugin.apply(this, arguments);
|
|
25873
25966
|
}
|
|
25874
25967
|
return CalculateLoader;
|
|
25875
|
-
}(
|
|
25968
|
+
}(_wrap_native_super(Plugin));
|
|
25876
25969
|
|
|
25877
25970
|
// Based on:
|
|
25878
25971
|
/**
|
|
@@ -28974,6 +29067,12 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
28974
29067
|
/**
|
|
28975
29068
|
* 每一行文本的最大宽度
|
|
28976
29069
|
*/ _this.maxLineWidth = 0;
|
|
29070
|
+
/**
|
|
29071
|
+
* 初始文本宽度,用于计算缩放比例
|
|
29072
|
+
*/ _this.baseTextWidth = 0;
|
|
29073
|
+
/**
|
|
29074
|
+
* 初始 `transform.size.x`,用于按比例更新显示宽度
|
|
29075
|
+
*/ _this.baseScaleX = 1;
|
|
28977
29076
|
_this.name = "MText" + seed$1++;
|
|
28978
29077
|
// 初始化canvas资源
|
|
28979
29078
|
_this.canvas = canvasPool.getCanvas();
|
|
@@ -28999,10 +29098,11 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
28999
29098
|
text: "默认文本",
|
|
29000
29099
|
fontFamily: "AlibabaSans-BoldItalic",
|
|
29001
29100
|
fontSize: 40,
|
|
29101
|
+
// 统一使用 0-1 颜色值
|
|
29002
29102
|
textColor: [
|
|
29003
|
-
|
|
29004
|
-
|
|
29005
|
-
|
|
29103
|
+
1,
|
|
29104
|
+
1,
|
|
29105
|
+
1,
|
|
29006
29106
|
1
|
|
29007
29107
|
],
|
|
29008
29108
|
fontWeight: TextWeight.normal,
|
|
@@ -29039,6 +29139,10 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29039
29139
|
// TextComponentBase
|
|
29040
29140
|
this.updateWithOptions(options);
|
|
29041
29141
|
this.renderText(options);
|
|
29142
|
+
// 记录初始的 textWidth 和 x 缩放,用于后续按比例更新显示宽度
|
|
29143
|
+
// 添加兜底值 1 防止除 0
|
|
29144
|
+
this.baseTextWidth = options.textWidth || this.textLayout.width || 1;
|
|
29145
|
+
this.baseScaleX = this.item.transform.size.x;
|
|
29042
29146
|
// 恢复默认颜色
|
|
29043
29147
|
this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
29044
29148
|
};
|
|
@@ -29237,9 +29341,9 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29237
29341
|
if (style.isOutlined) {
|
|
29238
29342
|
_this.setupOutline();
|
|
29239
29343
|
}
|
|
29240
|
-
//
|
|
29344
|
+
// textColor 统一是 0-1,写入 canvas 时乘 255
|
|
29241
29345
|
var _style_textColor = style.textColor, r = _style_textColor[0], g = _style_textColor[1], b = _style_textColor[2], a = _style_textColor[3];
|
|
29242
|
-
context.fillStyle = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
|
|
29346
|
+
context.fillStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
29243
29347
|
var charsInfo = [];
|
|
29244
29348
|
var x = 0;
|
|
29245
29349
|
var y = layout.getOffsetY(style, _this.lineCount, lineHeight, fontSize);
|
|
@@ -29301,6 +29405,31 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29301
29405
|
layout.autoWidth = normalizedValue;
|
|
29302
29406
|
this.isDirty = true;
|
|
29303
29407
|
};
|
|
29408
|
+
/**
|
|
29409
|
+
* 设置文本框宽度
|
|
29410
|
+
* 手动设置宽度时会自动关闭 `autoWidth`
|
|
29411
|
+
* 同时会按比例更新 `transform.size.x`,让 UI 框宽度也跟着变化
|
|
29412
|
+
* @param value - 文本框宽度
|
|
29413
|
+
*/ _proto.setTextWidth = function setTextWidth(value) {
|
|
29414
|
+
var width = Math.max(0, Number(value) || 0);
|
|
29415
|
+
var layout = this.textLayout;
|
|
29416
|
+
// 宽度没变且已是非 autoWidth 模式,直接返回
|
|
29417
|
+
if (layout.width === width && layout.autoWidth === false) {
|
|
29418
|
+
return;
|
|
29419
|
+
}
|
|
29420
|
+
// 手动设置宽度时关闭 autoWidth
|
|
29421
|
+
layout.autoWidth = false;
|
|
29422
|
+
layout.width = width;
|
|
29423
|
+
// 按当前 overflow 模式重新计算行数和 maxLineWidth
|
|
29424
|
+
this.lineCount = this.getLineCount(this.text || "");
|
|
29425
|
+
this.isDirty = true;
|
|
29426
|
+
// 同步更新外层显示宽度(按比例缩放 transform)
|
|
29427
|
+
// 这样 UI 框的视觉宽度也会跟着文本宽度变化
|
|
29428
|
+
if (this.baseTextWidth > 0) {
|
|
29429
|
+
var scale = width / this.baseTextWidth;
|
|
29430
|
+
this.item.transform.size.x = this.baseScaleX * scale;
|
|
29431
|
+
}
|
|
29432
|
+
};
|
|
29304
29433
|
_proto.setFontSize = function setFontSize(value) {
|
|
29305
29434
|
if (this.textStyle.fontSize === value) {
|
|
29306
29435
|
return;
|
|
@@ -29368,13 +29497,13 @@ applyMixins(exports.TextComponent, [
|
|
|
29368
29497
|
]);
|
|
29369
29498
|
|
|
29370
29499
|
// TODO: 注册必须用
|
|
29371
|
-
var TextLoader = /*#__PURE__*/ function(
|
|
29372
|
-
_inherits(TextLoader,
|
|
29500
|
+
var TextLoader = /*#__PURE__*/ function(Plugin) {
|
|
29501
|
+
_inherits(TextLoader, Plugin);
|
|
29373
29502
|
function TextLoader() {
|
|
29374
|
-
return
|
|
29503
|
+
return Plugin.apply(this, arguments);
|
|
29375
29504
|
}
|
|
29376
29505
|
return TextLoader;
|
|
29377
|
-
}(
|
|
29506
|
+
}(_wrap_native_super(Plugin));
|
|
29378
29507
|
|
|
29379
29508
|
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
29380
29509
|
_inherits(Asset, EffectsObject);
|
|
@@ -30431,6 +30560,10 @@ function version35Migration(json) {
|
|
|
30431
30560
|
if (component.dataType === DataType.TextComponent || component.dataType === DataType.RichTextComponent && component.options) {
|
|
30432
30561
|
ensureTextVerticalAlign(component.options);
|
|
30433
30562
|
}
|
|
30563
|
+
// 处理文本颜色从 0-255 到 0-1 的转换
|
|
30564
|
+
if (component.dataType === DataType.TextComponent) {
|
|
30565
|
+
convertTextColorTo01(component.options);
|
|
30566
|
+
}
|
|
30434
30567
|
}
|
|
30435
30568
|
}
|
|
30436
30569
|
//@ts-expect-error
|
|
@@ -30450,6 +30583,22 @@ function version35Migration(json) {
|
|
|
30450
30583
|
options.TextVerticalAlign = options.textBaseline;
|
|
30451
30584
|
}
|
|
30452
30585
|
}
|
|
30586
|
+
/**
|
|
30587
|
+
* 将文本颜色从 0-255 转换到 0-1
|
|
30588
|
+
*/ function convertTextColorTo01(options) {
|
|
30589
|
+
if (!options || !options.textColor) {
|
|
30590
|
+
return;
|
|
30591
|
+
}
|
|
30592
|
+
var textColor = options.textColor;
|
|
30593
|
+
var _textColor_;
|
|
30594
|
+
// 将 RGB 从 0-255 转换到 0-1(alpha 通道已经是 0-1,不需要转换)
|
|
30595
|
+
options.textColor = [
|
|
30596
|
+
textColor[0] / 255.0,
|
|
30597
|
+
textColor[1] / 255.0,
|
|
30598
|
+
textColor[2] / 255.0,
|
|
30599
|
+
(_textColor_ = textColor[3]) != null ? _textColor_ : 1
|
|
30600
|
+
];
|
|
30601
|
+
}
|
|
30453
30602
|
/**
|
|
30454
30603
|
* 根据形状获取形状几何体数据
|
|
30455
30604
|
* @param shape - 形状
|
|
@@ -31226,6 +31375,7 @@ function getStandardParticleContent(particle) {
|
|
|
31226
31375
|
}
|
|
31227
31376
|
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
31228
31377
|
if (textureSheetAnimation) {
|
|
31378
|
+
// @ts-expect-error
|
|
31229
31379
|
ret.textureSheetAnimation = {
|
|
31230
31380
|
row: textureSheetAnimation.row,
|
|
31231
31381
|
col: textureSheetAnimation.col,
|
|
@@ -31355,6 +31505,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31355
31505
|
var ret = getStandardNullContent(sprite, transform);
|
|
31356
31506
|
var texAni = sprite.textureSheetAnimation;
|
|
31357
31507
|
if (texAni) {
|
|
31508
|
+
// @ts-expect-error
|
|
31358
31509
|
ret.textureSheetAnimation = {
|
|
31359
31510
|
row: texAni.row,
|
|
31360
31511
|
col: texAni.col,
|
|
@@ -31372,7 +31523,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31372
31523
|
return ret;
|
|
31373
31524
|
}
|
|
31374
31525
|
|
|
31375
|
-
var version$1 = "2.8.0-alpha.
|
|
31526
|
+
var version$1 = "2.8.0-alpha.5";
|
|
31376
31527
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31377
31528
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31378
31529
|
var reverseParticle = false;
|
|
@@ -32012,8 +32163,8 @@ var seed = 1;
|
|
|
32012
32163
|
};
|
|
32013
32164
|
return [
|
|
32014
32165
|
4,
|
|
32015
|
-
hookTimeInfo("plugin:
|
|
32016
|
-
return _this.
|
|
32166
|
+
hookTimeInfo("plugin:onAssetsLoadStart", function() {
|
|
32167
|
+
return _this.onPluginSceneLoadStart(scene);
|
|
32017
32168
|
})
|
|
32018
32169
|
];
|
|
32019
32170
|
case 6:
|
|
@@ -32021,7 +32172,7 @@ var seed = 1;
|
|
|
32021
32172
|
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
32022
32173
|
return [
|
|
32023
32174
|
4,
|
|
32024
|
-
Promise.all([
|
|
32175
|
+
Promise.all([].concat([
|
|
32025
32176
|
hookTimeInfo("processBins", function() {
|
|
32026
32177
|
return _this.processBins(bins);
|
|
32027
32178
|
}),
|
|
@@ -32031,7 +32182,11 @@ var seed = 1;
|
|
|
32031
32182
|
hookTimeInfo("processFontURL", function() {
|
|
32032
32183
|
return _this.processFontURL(fonts);
|
|
32033
32184
|
})
|
|
32034
|
-
]
|
|
32185
|
+
], _this.options.useHevcVideo ? [
|
|
32186
|
+
hookTimeInfo("processVideoURL", function() {
|
|
32187
|
+
return _this.processVideoURL(jsonScene);
|
|
32188
|
+
})
|
|
32189
|
+
] : []))
|
|
32035
32190
|
];
|
|
32036
32191
|
case 7:
|
|
32037
32192
|
_ref = _state.sent(), loadedBins = _ref[0], loadedImages = _ref[1];
|
|
@@ -32301,7 +32456,7 @@ var seed = 1;
|
|
|
32301
32456
|
});
|
|
32302
32457
|
})();
|
|
32303
32458
|
};
|
|
32304
|
-
_proto.
|
|
32459
|
+
_proto.onPluginSceneLoadStart = function onPluginSceneLoadStart(scene) {
|
|
32305
32460
|
var _this = this;
|
|
32306
32461
|
return _async_to_generator(function() {
|
|
32307
32462
|
return __generator(this, function(_state) {
|
|
@@ -32309,7 +32464,7 @@ var seed = 1;
|
|
|
32309
32464
|
case 0:
|
|
32310
32465
|
return [
|
|
32311
32466
|
4,
|
|
32312
|
-
PluginSystem.
|
|
32467
|
+
PluginSystem.onAssetsLoadStart(scene, _this.options)
|
|
32313
32468
|
];
|
|
32314
32469
|
case 1:
|
|
32315
32470
|
_state.sent();
|
|
@@ -32417,6 +32572,30 @@ var seed = 1;
|
|
|
32417
32572
|
});
|
|
32418
32573
|
})();
|
|
32419
32574
|
};
|
|
32575
|
+
_proto.processVideoURL = function processVideoURL(jsonScene) {
|
|
32576
|
+
return _async_to_generator(function() {
|
|
32577
|
+
return __generator(this, function(_state) {
|
|
32578
|
+
if (!(jsonScene == null ? void 0 : jsonScene.videos) || !Array.isArray(jsonScene.videos)) {
|
|
32579
|
+
return [
|
|
32580
|
+
2
|
|
32581
|
+
];
|
|
32582
|
+
}
|
|
32583
|
+
jsonScene.videos.forEach(function(video) {
|
|
32584
|
+
var hevc = video.hevc;
|
|
32585
|
+
if (!(hevc == null ? void 0 : hevc.url) || !(hevc == null ? void 0 : hevc.codec)) {
|
|
32586
|
+
return;
|
|
32587
|
+
}
|
|
32588
|
+
var codec = parseCodec(hevc.codec);
|
|
32589
|
+
if (codec && canPlayHevcCodec(codec)) {
|
|
32590
|
+
video.url = hevc.url;
|
|
32591
|
+
}
|
|
32592
|
+
});
|
|
32593
|
+
return [
|
|
32594
|
+
2
|
|
32595
|
+
];
|
|
32596
|
+
});
|
|
32597
|
+
})();
|
|
32598
|
+
};
|
|
32420
32599
|
_proto.loadJSON = function loadJSON(url) {
|
|
32421
32600
|
var _this = this;
|
|
32422
32601
|
return _async_to_generator(function() {
|
|
@@ -35010,8 +35189,8 @@ var SceneLoader = /*#__PURE__*/ function() {
|
|
|
35010
35189
|
case 1:
|
|
35011
35190
|
loadedScene = _state.sent();
|
|
35012
35191
|
engine.clearResources();
|
|
35013
|
-
// 触发插件系统 pluginSystem 的回调
|
|
35014
|
-
PluginSystem.
|
|
35192
|
+
// 触发插件系统 pluginSystem 的回调 onAssetsLoadFinish
|
|
35193
|
+
PluginSystem.onAssetsLoadFinish(loadedScene, assetManager.options, engine);
|
|
35015
35194
|
engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
|
|
35016
35195
|
engine.assetService.updateTextVariables(loadedScene, options.variables);
|
|
35017
35196
|
engine.assetService.initializeTexture(loadedScene);
|
|
@@ -35073,10 +35252,9 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35073
35252
|
registerPlugin("particle", ParticleLoader);
|
|
35074
35253
|
registerPlugin("cal", CalculateLoader);
|
|
35075
35254
|
registerPlugin("interact", InteractLoader);
|
|
35076
|
-
var version = "2.8.0-alpha.
|
|
35255
|
+
var version = "2.8.0-alpha.5";
|
|
35077
35256
|
logger.info("Core version: " + version + ".");
|
|
35078
35257
|
|
|
35079
|
-
exports.AbstractPlugin = AbstractPlugin;
|
|
35080
35258
|
exports.ActivationMixerPlayable = ActivationMixerPlayable;
|
|
35081
35259
|
exports.ActivationPlayable = ActivationPlayable;
|
|
35082
35260
|
exports.AndNode = AndNode;
|
|
@@ -35176,6 +35354,7 @@ exports.PathSegments = PathSegments;
|
|
|
35176
35354
|
exports.Playable = Playable;
|
|
35177
35355
|
exports.PlayableAsset = PlayableAsset;
|
|
35178
35356
|
exports.PlayableOutput = PlayableOutput;
|
|
35357
|
+
exports.Plugin = Plugin;
|
|
35179
35358
|
exports.PluginSystem = PluginSystem;
|
|
35180
35359
|
exports.PointerEventData = PointerEventData;
|
|
35181
35360
|
exports.PolyStar = PolyStar;
|
|
@@ -35252,6 +35431,7 @@ exports.asserts = asserts;
|
|
|
35252
35431
|
exports.base64ToFile = base64ToFile;
|
|
35253
35432
|
exports.buildLine = buildLine;
|
|
35254
35433
|
exports.calculateTranslation = calculateTranslation;
|
|
35434
|
+
exports.canPlayHevcCodec = canPlayHevcCodec;
|
|
35255
35435
|
exports.canUseBOM = canUseBOM;
|
|
35256
35436
|
exports.canvasPool = canvasPool;
|
|
35257
35437
|
exports.closePointEps = closePointEps;
|
|
@@ -35345,6 +35525,7 @@ exports.noop = noop;
|
|
|
35345
35525
|
exports.normalizeColor = normalizeColor;
|
|
35346
35526
|
exports.numberToFix = numberToFix;
|
|
35347
35527
|
exports.oldBezierKeyFramesToNew = oldBezierKeyFramesToNew;
|
|
35528
|
+
exports.parseCodec = parseCodec;
|
|
35348
35529
|
exports.parsePercent = parsePercent$1;
|
|
35349
35530
|
exports.particleFrag = particleFrag;
|
|
35350
35531
|
exports.particleOriginTranslateMap = particleOriginTranslateMap$1;
|