@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.mjs
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
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -2664,355 +2664,6 @@ function asserts(condition, msg) {
|
|
|
2664
2664
|
return /^[^\d.][\w-]*$/.test(fontFamily);
|
|
2665
2665
|
}
|
|
2666
2666
|
|
|
2667
|
-
/**
|
|
2668
|
-
* Simple implementation of the deferred pattern.
|
|
2669
|
-
* An object that exposes a promise and functions to resolve and reject it.
|
|
2670
|
-
*/ var Deferred = function Deferred() {
|
|
2671
|
-
var _this = this;
|
|
2672
|
-
this.promise = new Promise(function(resolve, reject) {
|
|
2673
|
-
_this.resolve = resolve;
|
|
2674
|
-
_this.reject = reject;
|
|
2675
|
-
});
|
|
2676
|
-
};
|
|
2677
|
-
|
|
2678
|
-
var prefix = "[Galacean Effects]";
|
|
2679
|
-
var localLogger;
|
|
2680
|
-
function format(message) {
|
|
2681
|
-
return [
|
|
2682
|
-
"%c" + prefix,
|
|
2683
|
-
"color: #AA0100",
|
|
2684
|
-
"" + message
|
|
2685
|
-
];
|
|
2686
|
-
}
|
|
2687
|
-
function error(message) {
|
|
2688
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2689
|
-
args[_key - 1] = arguments[_key];
|
|
2690
|
-
}
|
|
2691
|
-
var _console;
|
|
2692
|
-
(_console = console).error.apply(_console, [].concat(format(message), [
|
|
2693
|
-
args
|
|
2694
|
-
]));
|
|
2695
|
-
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
2696
|
-
}
|
|
2697
|
-
/**
|
|
2698
|
-
* info 会转换成浏览器的 console.debug
|
|
2699
|
-
* @param message
|
|
2700
|
-
* @param args
|
|
2701
|
-
*/ function info(message) {
|
|
2702
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2703
|
-
args[_key - 1] = arguments[_key];
|
|
2704
|
-
}
|
|
2705
|
-
var _console;
|
|
2706
|
-
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
2707
|
-
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
2708
|
-
}
|
|
2709
|
-
function warn(message) {
|
|
2710
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2711
|
-
args[_key - 1] = arguments[_key];
|
|
2712
|
-
}
|
|
2713
|
-
var _console;
|
|
2714
|
-
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
2715
|
-
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
2716
|
-
}
|
|
2717
|
-
/**
|
|
2718
|
-
* 注册自定义埋点函数
|
|
2719
|
-
*
|
|
2720
|
-
* @param fn
|
|
2721
|
-
*/ function register(fn) {
|
|
2722
|
-
if (fn && isFunction(fn)) {
|
|
2723
|
-
localLogger = fn;
|
|
2724
|
-
}
|
|
2725
|
-
}
|
|
2726
|
-
var logger = {
|
|
2727
|
-
error: error,
|
|
2728
|
-
info: info,
|
|
2729
|
-
warn: warn,
|
|
2730
|
-
register: register
|
|
2731
|
-
};
|
|
2732
|
-
|
|
2733
|
-
var DestroyOptions;
|
|
2734
|
-
(function(DestroyOptions) {
|
|
2735
|
-
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
2736
|
-
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
2737
|
-
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
2738
|
-
})(DestroyOptions || (DestroyOptions = {}));
|
|
2739
|
-
function noop() {}
|
|
2740
|
-
/**
|
|
2741
|
-
* 判断对象是否是`String`类型
|
|
2742
|
-
*
|
|
2743
|
-
* @static
|
|
2744
|
-
* @function isString
|
|
2745
|
-
* @param obj - 要判断的对象
|
|
2746
|
-
* @return
|
|
2747
|
-
*/ function isString(obj) {
|
|
2748
|
-
return typeof obj === "string";
|
|
2749
|
-
}
|
|
2750
|
-
/**
|
|
2751
|
-
* 判断对象是否是`Array`类型
|
|
2752
|
-
*
|
|
2753
|
-
* @static
|
|
2754
|
-
* @function isArray
|
|
2755
|
-
* @param obj - 要判断的对象
|
|
2756
|
-
* @return
|
|
2757
|
-
*/ var isArray = Array.isArray || function(obj) {
|
|
2758
|
-
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
2759
|
-
};
|
|
2760
|
-
/**
|
|
2761
|
-
* 判断对象是否是函数类型
|
|
2762
|
-
*
|
|
2763
|
-
* @static
|
|
2764
|
-
* @function isFunction
|
|
2765
|
-
* @param obj - 要判断的对象
|
|
2766
|
-
* @return
|
|
2767
|
-
*/ function isFunction(obj) {
|
|
2768
|
-
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
2769
|
-
}
|
|
2770
|
-
/**
|
|
2771
|
-
* 判断对象是否是`Object`类型
|
|
2772
|
-
*
|
|
2773
|
-
* @static
|
|
2774
|
-
* @function isObject
|
|
2775
|
-
* @param obj - 要判断的对象
|
|
2776
|
-
* @return
|
|
2777
|
-
*/ function isObject(obj) {
|
|
2778
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
2779
|
-
}
|
|
2780
|
-
/**
|
|
2781
|
-
* 判断对象是否是`Plain Object`类型
|
|
2782
|
-
*
|
|
2783
|
-
* @param obj - 要判断的对象
|
|
2784
|
-
* @returns
|
|
2785
|
-
*/ function isPlainObject(obj) {
|
|
2786
|
-
if (obj === null || typeof obj !== "object") {
|
|
2787
|
-
return false;
|
|
2788
|
-
}
|
|
2789
|
-
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
2790
|
-
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
2791
|
-
return false;
|
|
2792
|
-
}
|
|
2793
|
-
var proto = Object.getPrototypeOf(obj);
|
|
2794
|
-
if (proto === null) {
|
|
2795
|
-
return true;
|
|
2796
|
-
} // Object.create(null)
|
|
2797
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
2798
|
-
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
2799
|
-
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
2800
|
-
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
2801
|
-
}
|
|
2802
|
-
function isCanvas(canvas) {
|
|
2803
|
-
var _canvas_tagName;
|
|
2804
|
-
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
2805
|
-
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
2806
|
-
}
|
|
2807
|
-
function isPowerOfTwo(value) {
|
|
2808
|
-
return (value & value - 1) === 0 && value !== 0;
|
|
2809
|
-
}
|
|
2810
|
-
/**
|
|
2811
|
-
* 生成一个位于 min 和 max 之间的随机数
|
|
2812
|
-
* @param min
|
|
2813
|
-
* @param max
|
|
2814
|
-
* @returns
|
|
2815
|
-
*/ function randomInRange(min, max) {
|
|
2816
|
-
return min + Math.random() * (max - min);
|
|
2817
|
-
}
|
|
2818
|
-
function throwDestroyedError() {
|
|
2819
|
-
throw new Error("Destroyed item cannot be used again.");
|
|
2820
|
-
}
|
|
2821
|
-
function generateGUID() {
|
|
2822
|
-
return v4().replace(/-/g, "");
|
|
2823
|
-
}
|
|
2824
|
-
function base64ToFile(base64, filename, contentType) {
|
|
2825
|
-
if (filename === void 0) filename = "base64File";
|
|
2826
|
-
if (contentType === void 0) contentType = "";
|
|
2827
|
-
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
2828
|
-
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
2829
|
-
// 将 base64 编码的字符串转换为二进制字符串
|
|
2830
|
-
var byteCharacters = atob(base64WithoutPrefix);
|
|
2831
|
-
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
2832
|
-
var byteArrays = [];
|
|
2833
|
-
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
2834
|
-
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
2835
|
-
var slice = byteCharacters.slice(offset, offset + 512);
|
|
2836
|
-
var byteNumbers = new Array(slice.length);
|
|
2837
|
-
for(var i = 0; i < slice.length; i++){
|
|
2838
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
2839
|
-
}
|
|
2840
|
-
var byteArray = new Uint8Array(byteNumbers);
|
|
2841
|
-
byteArrays.push(byteArray);
|
|
2842
|
-
}
|
|
2843
|
-
// 使用字节数组创建 Blob 对象
|
|
2844
|
-
var blob = new Blob(byteArrays, {
|
|
2845
|
-
type: contentType
|
|
2846
|
-
});
|
|
2847
|
-
// 创建 File 对象
|
|
2848
|
-
var file = new File([
|
|
2849
|
-
blob
|
|
2850
|
-
], filename, {
|
|
2851
|
-
type: contentType
|
|
2852
|
-
});
|
|
2853
|
-
return file;
|
|
2854
|
-
}
|
|
2855
|
-
function applyMixins(derivedCtrl, baseCtrls) {
|
|
2856
|
-
baseCtrls.forEach(function(baseCtrl) {
|
|
2857
|
-
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
2858
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
2859
|
-
if (!propertyDescriptor) {
|
|
2860
|
-
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
2861
|
-
}
|
|
2862
|
-
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
2863
|
-
});
|
|
2864
|
-
});
|
|
2865
|
-
}
|
|
2866
|
-
|
|
2867
|
-
var pluginLoaderMap = {};
|
|
2868
|
-
var plugins = [];
|
|
2869
|
-
/**
|
|
2870
|
-
* 注册 plugin
|
|
2871
|
-
* @param name
|
|
2872
|
-
* @param pluginClass class of plugin
|
|
2873
|
-
* @param itemClass class of item
|
|
2874
|
-
* @param isDefault load
|
|
2875
|
-
*/ function registerPlugin(name, pluginClass) {
|
|
2876
|
-
if (pluginLoaderMap[name]) {
|
|
2877
|
-
logger.error("Duplicate registration for plugin " + name + ".");
|
|
2878
|
-
}
|
|
2879
|
-
pluginLoaderMap[name] = pluginClass;
|
|
2880
|
-
var pluginInstance = new pluginClass();
|
|
2881
|
-
pluginInstance.name = name;
|
|
2882
|
-
pluginInstance.initialize();
|
|
2883
|
-
plugins.push(pluginInstance);
|
|
2884
|
-
plugins.sort(function(a, b) {
|
|
2885
|
-
return a.order - b.order;
|
|
2886
|
-
});
|
|
2887
|
-
}
|
|
2888
|
-
/**
|
|
2889
|
-
* 注销 plugin
|
|
2890
|
-
*/ function unregisterPlugin(name) {
|
|
2891
|
-
delete pluginLoaderMap[name];
|
|
2892
|
-
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
2893
|
-
return plugin.name === name;
|
|
2894
|
-
});
|
|
2895
|
-
if (pluginIndex !== -1) {
|
|
2896
|
-
plugins.splice(pluginIndex, 1);
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
var PluginSystem = /*#__PURE__*/ function() {
|
|
2900
|
-
function PluginSystem() {}
|
|
2901
|
-
PluginSystem.getPlugins = function getPlugins() {
|
|
2902
|
-
return plugins;
|
|
2903
|
-
};
|
|
2904
|
-
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2905
|
-
plugins.forEach(function(loader) {
|
|
2906
|
-
return loader.onCompositionConstructed(composition, scene);
|
|
2907
|
-
});
|
|
2908
|
-
};
|
|
2909
|
-
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2910
|
-
plugins.forEach(function(loader) {
|
|
2911
|
-
return loader.onCompositionDestroyed(comp);
|
|
2912
|
-
});
|
|
2913
|
-
};
|
|
2914
|
-
PluginSystem.processAssets = function processAssets(scene, options) {
|
|
2915
|
-
return _async_to_generator(function() {
|
|
2916
|
-
return __generator(this, function(_state) {
|
|
2917
|
-
return [
|
|
2918
|
-
2,
|
|
2919
|
-
Promise.all(plugins.map(function(plugin) {
|
|
2920
|
-
return plugin.processAssets(scene, options);
|
|
2921
|
-
}))
|
|
2922
|
-
];
|
|
2923
|
-
});
|
|
2924
|
-
})();
|
|
2925
|
-
};
|
|
2926
|
-
PluginSystem.loadResources = function loadResources(scene, options, engine) {
|
|
2927
|
-
plugins.forEach(function(loader) {
|
|
2928
|
-
return loader.prepareResource(scene, options, engine);
|
|
2929
|
-
});
|
|
2930
|
-
};
|
|
2931
|
-
return PluginSystem;
|
|
2932
|
-
}();
|
|
2933
|
-
var pluginInfoMap = {
|
|
2934
|
-
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
2935
|
-
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
2936
|
-
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
2937
|
-
"ffd": "@galacean/effects-plugin-ffd",
|
|
2938
|
-
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
2939
|
-
"model": "@galacean/effects-plugin-model",
|
|
2940
|
-
"video": "@galacean/effects-plugin-multimedia",
|
|
2941
|
-
"audio": "@galacean/effects-plugin-multimedia",
|
|
2942
|
-
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
2943
|
-
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
2944
|
-
"spine": "@galacean/effects-plugin-spine"
|
|
2945
|
-
};
|
|
2946
|
-
function getPluginUsageInfo(name) {
|
|
2947
|
-
var info = pluginInfoMap[name];
|
|
2948
|
-
if (info) {
|
|
2949
|
-
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
2950
|
-
} else {
|
|
2951
|
-
return "";
|
|
2952
|
-
}
|
|
2953
|
-
}
|
|
2954
|
-
|
|
2955
|
-
/**
|
|
2956
|
-
* 抽象插件类
|
|
2957
|
-
* 注册合成不同生命周期的回调函数
|
|
2958
|
-
*/ var AbstractPlugin = /*#__PURE__*/ function() {
|
|
2959
|
-
function AbstractPlugin() {
|
|
2960
|
-
this.order = 100;
|
|
2961
|
-
this.name = "";
|
|
2962
|
-
}
|
|
2963
|
-
var _proto = AbstractPlugin.prototype;
|
|
2964
|
-
_proto.initialize = function initialize() {};
|
|
2965
|
-
/**
|
|
2966
|
-
* loadScene 函数调用的时候会触发此函数,
|
|
2967
|
-
* 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
|
|
2968
|
-
* @param scene
|
|
2969
|
-
* @param options
|
|
2970
|
-
* @returns
|
|
2971
|
-
*/ _proto.processAssets = function processAssets(scene, options) {
|
|
2972
|
-
return _async_to_generator(function() {
|
|
2973
|
-
return __generator(this, function(_state) {
|
|
2974
|
-
return [
|
|
2975
|
-
2
|
|
2976
|
-
];
|
|
2977
|
-
});
|
|
2978
|
-
})();
|
|
2979
|
-
};
|
|
2980
|
-
/**
|
|
2981
|
-
* loadScene 函数调用的时候会触发此函数,
|
|
2982
|
-
* 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
|
|
2983
|
-
* 如果 promise 被 reject, loadScene 函数同样会被 reject,表示场景加载失败。
|
|
2984
|
-
* 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
|
|
2985
|
-
* 此阶段晚于 processAssets
|
|
2986
|
-
* @param {Scene} scene
|
|
2987
|
-
* @param {SceneLoadOptions} options
|
|
2988
|
-
*/ _proto.prepareResource = function prepareResource(scene, options, engine) {};
|
|
2989
|
-
_proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
|
|
2990
|
-
_proto.onCompositionDestroyed = function onCompositionDestroyed(composition) {};
|
|
2991
|
-
return AbstractPlugin;
|
|
2992
|
-
}();
|
|
2993
|
-
|
|
2994
|
-
function _set_prototype_of(o, p) {
|
|
2995
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
2996
|
-
o.__proto__ = p;
|
|
2997
|
-
return o;
|
|
2998
|
-
};
|
|
2999
|
-
return _set_prototype_of(o, p);
|
|
3000
|
-
}
|
|
3001
|
-
|
|
3002
|
-
function _inherits(subClass, superClass) {
|
|
3003
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
3004
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
3005
|
-
}
|
|
3006
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
3007
|
-
constructor: {
|
|
3008
|
-
value: subClass,
|
|
3009
|
-
writable: true,
|
|
3010
|
-
configurable: true
|
|
3011
|
-
}
|
|
3012
|
-
});
|
|
3013
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
3014
|
-
}
|
|
3015
|
-
|
|
3016
2667
|
/**
|
|
3017
2668
|
* JSON 版本
|
|
3018
2669
|
*/ var JSONSceneVersion;
|
|
@@ -3760,6 +3411,17 @@ var NodeDataType;
|
|
|
3760
3411
|
MultimediaType["video"] = "video";
|
|
3761
3412
|
MultimediaType["audio"] = "audio";
|
|
3762
3413
|
})(MultimediaType || (MultimediaType = {}));
|
|
3414
|
+
var HevcVideoCodec;
|
|
3415
|
+
(function(HevcVideoCodec) {
|
|
3416
|
+
HevcVideoCodec["L30"] = "hev1.1.0.L30.B0";
|
|
3417
|
+
HevcVideoCodec["L60"] = "hev1.1.0.L60.B0";
|
|
3418
|
+
HevcVideoCodec["L63"] = "hev1.1.0.L63.B0";
|
|
3419
|
+
HevcVideoCodec["L90"] = "hev1.1.0.L90.B0";
|
|
3420
|
+
HevcVideoCodec["L93"] = "hev1.1.0.L93.B0";
|
|
3421
|
+
HevcVideoCodec["L120"] = "hev1.1.0.L120.B0";
|
|
3422
|
+
HevcVideoCodec["L150"] = "hev1.1.0.L150.B0";
|
|
3423
|
+
HevcVideoCodec["L180"] = "hev1.1.0.L180.B0";
|
|
3424
|
+
})(HevcVideoCodec || (HevcVideoCodec = {}));
|
|
3763
3425
|
|
|
3764
3426
|
var DataType;
|
|
3765
3427
|
(function(DataType) {
|
|
@@ -3965,6 +3627,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3965
3627
|
get NodeDataType () { return NodeDataType; },
|
|
3966
3628
|
get BackgroundType () { return BackgroundType; },
|
|
3967
3629
|
get MultimediaType () { return MultimediaType; },
|
|
3630
|
+
get HevcVideoCodec () { return HevcVideoCodec; },
|
|
3968
3631
|
get DataType () { return DataType; },
|
|
3969
3632
|
get GeometryType () { return GeometryType; },
|
|
3970
3633
|
get VertexFormatType () { return VertexFormatType; },
|
|
@@ -3972,6 +3635,391 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3972
3635
|
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
3973
3636
|
});
|
|
3974
3637
|
|
|
3638
|
+
/**
|
|
3639
|
+
* Check if the browser can play the given HEVC codec.
|
|
3640
|
+
* @param codec - The HEVC codec to check.
|
|
3641
|
+
* @returns True if the browser can probably or maybe play the codec, false otherwise.
|
|
3642
|
+
*/ function canPlayHevcCodec(codec) {
|
|
3643
|
+
var video = document.createElement("video");
|
|
3644
|
+
var contentType = 'video/mp4; codecs="' + codec + '"';
|
|
3645
|
+
var result = video.canPlayType(contentType);
|
|
3646
|
+
return result === "probably" || result === "maybe";
|
|
3647
|
+
}
|
|
3648
|
+
/**
|
|
3649
|
+
* Parse the given codec string into a HEVC video codec enum value.
|
|
3650
|
+
* @param codec - The codec string to parse.
|
|
3651
|
+
* @returns The corresponding HEVC video codec enum value, or undefined if the codec is invalid.
|
|
3652
|
+
*/ function parseCodec(codec) {
|
|
3653
|
+
// 传入的是完整的枚举值
|
|
3654
|
+
if (isCodecValue(codec)) {
|
|
3655
|
+
return codec;
|
|
3656
|
+
}
|
|
3657
|
+
// 传入的是枚举名称
|
|
3658
|
+
if (isCodecKey(codec)) {
|
|
3659
|
+
return HevcVideoCodec[codec];
|
|
3660
|
+
}
|
|
3661
|
+
return undefined;
|
|
3662
|
+
}
|
|
3663
|
+
function isCodecValue(codec) {
|
|
3664
|
+
return Object.keys(HevcVideoCodec).some(function(key) {
|
|
3665
|
+
return HevcVideoCodec[key] === codec;
|
|
3666
|
+
});
|
|
3667
|
+
}
|
|
3668
|
+
function isCodecKey(codec) {
|
|
3669
|
+
return codec in HevcVideoCodec;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
/**
|
|
3673
|
+
* Simple implementation of the deferred pattern.
|
|
3674
|
+
* An object that exposes a promise and functions to resolve and reject it.
|
|
3675
|
+
*/ var Deferred = function Deferred() {
|
|
3676
|
+
var _this = this;
|
|
3677
|
+
this.promise = new Promise(function(resolve, reject) {
|
|
3678
|
+
_this.resolve = resolve;
|
|
3679
|
+
_this.reject = reject;
|
|
3680
|
+
});
|
|
3681
|
+
};
|
|
3682
|
+
|
|
3683
|
+
var prefix = "[Galacean Effects]";
|
|
3684
|
+
var localLogger;
|
|
3685
|
+
function format(message) {
|
|
3686
|
+
return [
|
|
3687
|
+
"%c" + prefix,
|
|
3688
|
+
"color: #AA0100",
|
|
3689
|
+
"" + message
|
|
3690
|
+
];
|
|
3691
|
+
}
|
|
3692
|
+
function error(message) {
|
|
3693
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3694
|
+
args[_key - 1] = arguments[_key];
|
|
3695
|
+
}
|
|
3696
|
+
var _console;
|
|
3697
|
+
(_console = console).error.apply(_console, [].concat(format(message), [
|
|
3698
|
+
args
|
|
3699
|
+
]));
|
|
3700
|
+
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
3701
|
+
}
|
|
3702
|
+
/**
|
|
3703
|
+
* info 会转换成浏览器的 console.debug
|
|
3704
|
+
* @param message
|
|
3705
|
+
* @param args
|
|
3706
|
+
*/ function info(message) {
|
|
3707
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3708
|
+
args[_key - 1] = arguments[_key];
|
|
3709
|
+
}
|
|
3710
|
+
var _console;
|
|
3711
|
+
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
3712
|
+
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
3713
|
+
}
|
|
3714
|
+
function warn(message) {
|
|
3715
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3716
|
+
args[_key - 1] = arguments[_key];
|
|
3717
|
+
}
|
|
3718
|
+
var _console;
|
|
3719
|
+
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
3720
|
+
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
3721
|
+
}
|
|
3722
|
+
/**
|
|
3723
|
+
* 注册自定义埋点函数
|
|
3724
|
+
*
|
|
3725
|
+
* @param fn
|
|
3726
|
+
*/ function register(fn) {
|
|
3727
|
+
if (fn && isFunction(fn)) {
|
|
3728
|
+
localLogger = fn;
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3731
|
+
var logger = {
|
|
3732
|
+
error: error,
|
|
3733
|
+
info: info,
|
|
3734
|
+
warn: warn,
|
|
3735
|
+
register: register
|
|
3736
|
+
};
|
|
3737
|
+
|
|
3738
|
+
var DestroyOptions;
|
|
3739
|
+
(function(DestroyOptions) {
|
|
3740
|
+
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
3741
|
+
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
3742
|
+
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
3743
|
+
})(DestroyOptions || (DestroyOptions = {}));
|
|
3744
|
+
function noop() {}
|
|
3745
|
+
/**
|
|
3746
|
+
* 判断对象是否是`String`类型
|
|
3747
|
+
*
|
|
3748
|
+
* @static
|
|
3749
|
+
* @function isString
|
|
3750
|
+
* @param obj - 要判断的对象
|
|
3751
|
+
* @return
|
|
3752
|
+
*/ function isString(obj) {
|
|
3753
|
+
return typeof obj === "string";
|
|
3754
|
+
}
|
|
3755
|
+
/**
|
|
3756
|
+
* 判断对象是否是`Array`类型
|
|
3757
|
+
*
|
|
3758
|
+
* @static
|
|
3759
|
+
* @function isArray
|
|
3760
|
+
* @param obj - 要判断的对象
|
|
3761
|
+
* @return
|
|
3762
|
+
*/ var isArray = Array.isArray || function(obj) {
|
|
3763
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
3764
|
+
};
|
|
3765
|
+
/**
|
|
3766
|
+
* 判断对象是否是函数类型
|
|
3767
|
+
*
|
|
3768
|
+
* @static
|
|
3769
|
+
* @function isFunction
|
|
3770
|
+
* @param obj - 要判断的对象
|
|
3771
|
+
* @return
|
|
3772
|
+
*/ function isFunction(obj) {
|
|
3773
|
+
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
3774
|
+
}
|
|
3775
|
+
/**
|
|
3776
|
+
* 判断对象是否是`Object`类型
|
|
3777
|
+
*
|
|
3778
|
+
* @static
|
|
3779
|
+
* @function isObject
|
|
3780
|
+
* @param obj - 要判断的对象
|
|
3781
|
+
* @return
|
|
3782
|
+
*/ function isObject(obj) {
|
|
3783
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
3784
|
+
}
|
|
3785
|
+
/**
|
|
3786
|
+
* 判断对象是否是`Plain Object`类型
|
|
3787
|
+
*
|
|
3788
|
+
* @param obj - 要判断的对象
|
|
3789
|
+
* @returns
|
|
3790
|
+
*/ function isPlainObject(obj) {
|
|
3791
|
+
if (obj === null || typeof obj !== "object") {
|
|
3792
|
+
return false;
|
|
3793
|
+
}
|
|
3794
|
+
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
3795
|
+
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
3796
|
+
return false;
|
|
3797
|
+
}
|
|
3798
|
+
var proto = Object.getPrototypeOf(obj);
|
|
3799
|
+
if (proto === null) {
|
|
3800
|
+
return true;
|
|
3801
|
+
} // Object.create(null)
|
|
3802
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
3803
|
+
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
3804
|
+
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
3805
|
+
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
3806
|
+
}
|
|
3807
|
+
function isCanvas(canvas) {
|
|
3808
|
+
var _canvas_tagName;
|
|
3809
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
3810
|
+
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
3811
|
+
}
|
|
3812
|
+
function isPowerOfTwo(value) {
|
|
3813
|
+
return (value & value - 1) === 0 && value !== 0;
|
|
3814
|
+
}
|
|
3815
|
+
/**
|
|
3816
|
+
* 生成一个位于 min 和 max 之间的随机数
|
|
3817
|
+
* @param min
|
|
3818
|
+
* @param max
|
|
3819
|
+
* @returns
|
|
3820
|
+
*/ function randomInRange(min, max) {
|
|
3821
|
+
return min + Math.random() * (max - min);
|
|
3822
|
+
}
|
|
3823
|
+
function throwDestroyedError() {
|
|
3824
|
+
throw new Error("Destroyed item cannot be used again.");
|
|
3825
|
+
}
|
|
3826
|
+
function generateGUID() {
|
|
3827
|
+
return v4().replace(/-/g, "");
|
|
3828
|
+
}
|
|
3829
|
+
function base64ToFile(base64, filename, contentType) {
|
|
3830
|
+
if (filename === void 0) filename = "base64File";
|
|
3831
|
+
if (contentType === void 0) contentType = "";
|
|
3832
|
+
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
3833
|
+
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
3834
|
+
// 将 base64 编码的字符串转换为二进制字符串
|
|
3835
|
+
var byteCharacters = atob(base64WithoutPrefix);
|
|
3836
|
+
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
3837
|
+
var byteArrays = [];
|
|
3838
|
+
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
3839
|
+
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
3840
|
+
var slice = byteCharacters.slice(offset, offset + 512);
|
|
3841
|
+
var byteNumbers = new Array(slice.length);
|
|
3842
|
+
for(var i = 0; i < slice.length; i++){
|
|
3843
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
3844
|
+
}
|
|
3845
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
3846
|
+
byteArrays.push(byteArray);
|
|
3847
|
+
}
|
|
3848
|
+
// 使用字节数组创建 Blob 对象
|
|
3849
|
+
var blob = new Blob(byteArrays, {
|
|
3850
|
+
type: contentType
|
|
3851
|
+
});
|
|
3852
|
+
// 创建 File 对象
|
|
3853
|
+
var file = new File([
|
|
3854
|
+
blob
|
|
3855
|
+
], filename, {
|
|
3856
|
+
type: contentType
|
|
3857
|
+
});
|
|
3858
|
+
return file;
|
|
3859
|
+
}
|
|
3860
|
+
function applyMixins(derivedCtrl, baseCtrls) {
|
|
3861
|
+
baseCtrls.forEach(function(baseCtrl) {
|
|
3862
|
+
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
3863
|
+
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
3864
|
+
if (!propertyDescriptor) {
|
|
3865
|
+
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
3866
|
+
}
|
|
3867
|
+
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
3868
|
+
});
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
var pluginLoaderMap = {};
|
|
3873
|
+
var plugins = [];
|
|
3874
|
+
/**
|
|
3875
|
+
* 注册 plugin
|
|
3876
|
+
* @param name
|
|
3877
|
+
* @param pluginClass class of plugin
|
|
3878
|
+
* @param itemClass class of item
|
|
3879
|
+
* @param isDefault load
|
|
3880
|
+
*/ function registerPlugin(name, pluginClass) {
|
|
3881
|
+
if (pluginLoaderMap[name]) {
|
|
3882
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
3883
|
+
}
|
|
3884
|
+
pluginLoaderMap[name] = pluginClass;
|
|
3885
|
+
var pluginInstance = new pluginClass();
|
|
3886
|
+
pluginInstance.name = name;
|
|
3887
|
+
plugins.push(pluginInstance);
|
|
3888
|
+
plugins.sort(function(a, b) {
|
|
3889
|
+
return a.order - b.order;
|
|
3890
|
+
});
|
|
3891
|
+
}
|
|
3892
|
+
/**
|
|
3893
|
+
* 注销 plugin
|
|
3894
|
+
*/ function unregisterPlugin(name) {
|
|
3895
|
+
delete pluginLoaderMap[name];
|
|
3896
|
+
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
3897
|
+
return plugin.name === name;
|
|
3898
|
+
});
|
|
3899
|
+
if (pluginIndex !== -1) {
|
|
3900
|
+
plugins.splice(pluginIndex, 1);
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
var PluginSystem = /*#__PURE__*/ function() {
|
|
3904
|
+
function PluginSystem() {}
|
|
3905
|
+
PluginSystem.getPlugins = function getPlugins() {
|
|
3906
|
+
return plugins;
|
|
3907
|
+
};
|
|
3908
|
+
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
3909
|
+
plugins.forEach(function(loader) {
|
|
3910
|
+
return loader.onCompositionCreated(composition, scene);
|
|
3911
|
+
});
|
|
3912
|
+
};
|
|
3913
|
+
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
3914
|
+
plugins.forEach(function(loader) {
|
|
3915
|
+
return loader.onCompositionDestroy(comp);
|
|
3916
|
+
});
|
|
3917
|
+
};
|
|
3918
|
+
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
3919
|
+
return _async_to_generator(function() {
|
|
3920
|
+
return __generator(this, function(_state) {
|
|
3921
|
+
return [
|
|
3922
|
+
2,
|
|
3923
|
+
Promise.all(plugins.map(function(plugin) {
|
|
3924
|
+
return plugin.onAssetsLoadStart(scene, options);
|
|
3925
|
+
}))
|
|
3926
|
+
];
|
|
3927
|
+
});
|
|
3928
|
+
})();
|
|
3929
|
+
};
|
|
3930
|
+
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
3931
|
+
plugins.forEach(function(loader) {
|
|
3932
|
+
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
3933
|
+
});
|
|
3934
|
+
};
|
|
3935
|
+
return PluginSystem;
|
|
3936
|
+
}();
|
|
3937
|
+
var pluginInfoMap = {
|
|
3938
|
+
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
3939
|
+
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
3940
|
+
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
3941
|
+
"ffd": "@galacean/effects-plugin-ffd",
|
|
3942
|
+
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
3943
|
+
"model": "@galacean/effects-plugin-model",
|
|
3944
|
+
"video": "@galacean/effects-plugin-multimedia",
|
|
3945
|
+
"audio": "@galacean/effects-plugin-multimedia",
|
|
3946
|
+
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
3947
|
+
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
3948
|
+
"spine": "@galacean/effects-plugin-spine"
|
|
3949
|
+
};
|
|
3950
|
+
function getPluginUsageInfo(name) {
|
|
3951
|
+
var info = pluginInfoMap[name];
|
|
3952
|
+
if (info) {
|
|
3953
|
+
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
3954
|
+
} else {
|
|
3955
|
+
return "";
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
/**
|
|
3960
|
+
* 抽象插件类
|
|
3961
|
+
* 注册合成不同生命周期的回调函数
|
|
3962
|
+
*/ var Plugin = /*#__PURE__*/ function() {
|
|
3963
|
+
function Plugin() {
|
|
3964
|
+
this.order = 100;
|
|
3965
|
+
this.name = "Plugin";
|
|
3966
|
+
}
|
|
3967
|
+
var _proto = Plugin.prototype;
|
|
3968
|
+
/**
|
|
3969
|
+
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
3970
|
+
* 此阶段适合发起异步资源请求。
|
|
3971
|
+
* @param scene - 场景对象
|
|
3972
|
+
* @param options - 场景加载选项
|
|
3973
|
+
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
3974
|
+
return _async_to_generator(function() {
|
|
3975
|
+
return __generator(this, function(_state) {
|
|
3976
|
+
return [
|
|
3977
|
+
2
|
|
3978
|
+
];
|
|
3979
|
+
});
|
|
3980
|
+
})();
|
|
3981
|
+
};
|
|
3982
|
+
/**
|
|
3983
|
+
* 场景资源加载完成后触发。
|
|
3984
|
+
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
3985
|
+
* @param scene - 场景对象
|
|
3986
|
+
* @param options - 场景加载选项
|
|
3987
|
+
* @param engine - 引擎实例
|
|
3988
|
+
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
3989
|
+
/**
|
|
3990
|
+
* 合成创建完成后触发。
|
|
3991
|
+
* @param composition - 合成对象
|
|
3992
|
+
* @param scene - 场景对象
|
|
3993
|
+
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
3994
|
+
/**
|
|
3995
|
+
* 合成销毁时触发。
|
|
3996
|
+
* @param composition - 合成对象
|
|
3997
|
+
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
3998
|
+
return Plugin;
|
|
3999
|
+
}();
|
|
4000
|
+
|
|
4001
|
+
function _set_prototype_of(o, p) {
|
|
4002
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
4003
|
+
o.__proto__ = p;
|
|
4004
|
+
return o;
|
|
4005
|
+
};
|
|
4006
|
+
return _set_prototype_of(o, p);
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
function _inherits(subClass, superClass) {
|
|
4010
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
4011
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
4012
|
+
}
|
|
4013
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
4014
|
+
constructor: {
|
|
4015
|
+
value: subClass,
|
|
4016
|
+
writable: true,
|
|
4017
|
+
configurable: true
|
|
4018
|
+
}
|
|
4019
|
+
});
|
|
4020
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
4021
|
+
}
|
|
4022
|
+
|
|
3975
4023
|
function _array_like_to_array(arr, len) {
|
|
3976
4024
|
if (len == null || len > arr.length) len = arr.length;
|
|
3977
4025
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -10648,6 +10696,9 @@ var DrawObjectPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
10648
10696
|
stencilAction: TextureLoadAction.clear
|
|
10649
10697
|
});
|
|
10650
10698
|
}
|
|
10699
|
+
this.meshes.sort(function(a, b) {
|
|
10700
|
+
return a.priority - b.priority;
|
|
10701
|
+
});
|
|
10651
10702
|
renderer.renderMeshes(this.meshes);
|
|
10652
10703
|
};
|
|
10653
10704
|
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
@@ -16585,13 +16636,49 @@ CameraController = __decorate([
|
|
|
16585
16636
|
effectsClass(DataType.CameraController)
|
|
16586
16637
|
], CameraController);
|
|
16587
16638
|
|
|
16588
|
-
|
|
16589
|
-
|
|
16639
|
+
function _get_prototype_of(o) {
|
|
16640
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
16641
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
16642
|
+
};
|
|
16643
|
+
return _get_prototype_of(o);
|
|
16644
|
+
}
|
|
16645
|
+
|
|
16646
|
+
function _is_native_function(fn) {
|
|
16647
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
16648
|
+
}
|
|
16649
|
+
|
|
16650
|
+
function _wrap_native_super(Class) {
|
|
16651
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
16652
|
+
_wrap_native_super = function _wrap_native_super(Class) {
|
|
16653
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
16654
|
+
if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
|
|
16655
|
+
if (typeof _cache !== "undefined") {
|
|
16656
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
16657
|
+
_cache.set(Class, Wrapper);
|
|
16658
|
+
}
|
|
16659
|
+
function Wrapper() {
|
|
16660
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
16661
|
+
}
|
|
16662
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
16663
|
+
constructor: {
|
|
16664
|
+
value: Wrapper,
|
|
16665
|
+
enumerable: false,
|
|
16666
|
+
writable: true,
|
|
16667
|
+
configurable: true
|
|
16668
|
+
}
|
|
16669
|
+
});
|
|
16670
|
+
return _set_prototype_of(Wrapper, Class);
|
|
16671
|
+
};
|
|
16672
|
+
return _wrap_native_super(Class);
|
|
16673
|
+
}
|
|
16674
|
+
|
|
16675
|
+
var CameraVFXItemLoader = /*#__PURE__*/ function(Plugin) {
|
|
16676
|
+
_inherits(CameraVFXItemLoader, Plugin);
|
|
16590
16677
|
function CameraVFXItemLoader() {
|
|
16591
|
-
return
|
|
16678
|
+
return Plugin.apply(this, arguments);
|
|
16592
16679
|
}
|
|
16593
16680
|
return CameraVFXItemLoader;
|
|
16594
|
-
}(
|
|
16681
|
+
}(_wrap_native_super(Plugin));
|
|
16595
16682
|
|
|
16596
16683
|
var HitTestType;
|
|
16597
16684
|
(function(HitTestType) {
|
|
@@ -16875,13 +16962,13 @@ function getCoord(event) {
|
|
|
16875
16962
|
};
|
|
16876
16963
|
}
|
|
16877
16964
|
|
|
16878
|
-
var InteractLoader = /*#__PURE__*/ function(
|
|
16879
|
-
_inherits(InteractLoader,
|
|
16965
|
+
var InteractLoader = /*#__PURE__*/ function(Plugin) {
|
|
16966
|
+
_inherits(InteractLoader, Plugin);
|
|
16880
16967
|
function InteractLoader() {
|
|
16881
|
-
return
|
|
16968
|
+
return Plugin.apply(this, arguments);
|
|
16882
16969
|
}
|
|
16883
16970
|
return InteractLoader;
|
|
16884
|
-
}(
|
|
16971
|
+
}(_wrap_native_super(Plugin));
|
|
16885
16972
|
|
|
16886
16973
|
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";
|
|
16887
16974
|
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";
|
|
@@ -17480,16 +17567,16 @@ function shouldIgnoreBouncing(arg, mul) {
|
|
|
17480
17567
|
return MeshCollider;
|
|
17481
17568
|
}();
|
|
17482
17569
|
|
|
17483
|
-
var SpriteLoader = /*#__PURE__*/ function(
|
|
17484
|
-
_inherits(SpriteLoader,
|
|
17570
|
+
var SpriteLoader = /*#__PURE__*/ function(Plugin) {
|
|
17571
|
+
_inherits(SpriteLoader, Plugin);
|
|
17485
17572
|
function SpriteLoader() {
|
|
17486
17573
|
var _this;
|
|
17487
|
-
_this =
|
|
17574
|
+
_this = Plugin.apply(this, arguments) || this;
|
|
17488
17575
|
_this.name = "sprite";
|
|
17489
17576
|
return _this;
|
|
17490
17577
|
}
|
|
17491
17578
|
return SpriteLoader;
|
|
17492
|
-
}(
|
|
17579
|
+
}(_wrap_native_super(Plugin));
|
|
17493
17580
|
|
|
17494
17581
|
/**
|
|
17495
17582
|
* 动画图可播放节点对象
|
|
@@ -19980,7 +20067,7 @@ function calculateDirection(prePoint, point, nextPoint) {
|
|
|
19980
20067
|
if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
|
|
19981
20068
|
particleSystem.reset();
|
|
19982
20069
|
}
|
|
19983
|
-
particleSystem.
|
|
20070
|
+
particleSystem.simulate(this.time - particleSystem.time);
|
|
19984
20071
|
}
|
|
19985
20072
|
this.lastTime = this.time;
|
|
19986
20073
|
};
|
|
@@ -21431,126 +21518,133 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21431
21518
|
this.initEmitterTransform();
|
|
21432
21519
|
};
|
|
21433
21520
|
_proto.onUpdate = function onUpdate(dt) {
|
|
21434
|
-
this.
|
|
21521
|
+
if (!this.frozen) {
|
|
21522
|
+
this.update(dt);
|
|
21523
|
+
}
|
|
21524
|
+
};
|
|
21525
|
+
_proto.simulate = function simulate(time) {
|
|
21526
|
+
this.update(time * 1000);
|
|
21527
|
+
this.frozen = true;
|
|
21435
21528
|
};
|
|
21436
21529
|
_proto.update = function update(delta) {
|
|
21437
21530
|
var _this = this;
|
|
21438
|
-
if (this.started
|
|
21439
|
-
|
|
21440
|
-
|
|
21441
|
-
|
|
21442
|
-
|
|
21443
|
-
|
|
21444
|
-
|
|
21445
|
-
|
|
21446
|
-
|
|
21447
|
-
|
|
21448
|
-
|
|
21449
|
-
|
|
21450
|
-
|
|
21451
|
-
|
|
21452
|
-
|
|
21453
|
-
|
|
21454
|
-
|
|
21455
|
-
|
|
21456
|
-
|
|
21457
|
-
|
|
21458
|
-
|
|
21459
|
-
|
|
21460
|
-
|
|
21531
|
+
if (!this.started) {
|
|
21532
|
+
return;
|
|
21533
|
+
}
|
|
21534
|
+
var now = this.time + delta / 1000;
|
|
21535
|
+
var options = this.options;
|
|
21536
|
+
var loopStartTime = this.loopStartTime;
|
|
21537
|
+
var emission = this.emission;
|
|
21538
|
+
this.time = now;
|
|
21539
|
+
this.upDirectionWorld = null;
|
|
21540
|
+
this.renderer.updateTime(now, delta);
|
|
21541
|
+
var link = this.particleLink;
|
|
21542
|
+
var emitterLifetime = (now - loopStartTime) / this.item.duration;
|
|
21543
|
+
var timePassed = this.timePassed;
|
|
21544
|
+
var trailUpdated = false;
|
|
21545
|
+
var updateTrail = function() {
|
|
21546
|
+
if (_this.trails && !trailUpdated) {
|
|
21547
|
+
trailUpdated = true;
|
|
21548
|
+
link.forEach(function(param) {
|
|
21549
|
+
var time = param[0], pointIndex = param[1], delay = param[2], point = param[3];
|
|
21550
|
+
if (time < timePassed) {
|
|
21551
|
+
_this.clearPointTrail(pointIndex);
|
|
21552
|
+
} else if (timePassed > delay) {
|
|
21553
|
+
_this.updatePointTrail(pointIndex, emitterLifetime, point, delay);
|
|
21554
|
+
}
|
|
21555
|
+
});
|
|
21556
|
+
}
|
|
21557
|
+
};
|
|
21558
|
+
if (!this.ended) {
|
|
21559
|
+
var duration = this.item.duration;
|
|
21560
|
+
var lifetime = this.lifetime;
|
|
21561
|
+
if (timePassed < duration) {
|
|
21562
|
+
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21563
|
+
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21564
|
+
var maxEmissionCount = pointCount;
|
|
21565
|
+
var timeDelta = interval / pointCount;
|
|
21566
|
+
var meshTime = now;
|
|
21567
|
+
var maxCount = options.maxCount;
|
|
21568
|
+
this.updateEmitterTransform(timePassed);
|
|
21569
|
+
var shouldSkipGenerate = function() {
|
|
21570
|
+
var first = link.first;
|
|
21571
|
+
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21572
|
+
};
|
|
21573
|
+
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21574
|
+
if (shouldSkipGenerate()) {
|
|
21575
|
+
break;
|
|
21576
|
+
}
|
|
21577
|
+
var p = this.createPoint(lifetime);
|
|
21578
|
+
p.delay += meshTime + i * timeDelta;
|
|
21579
|
+
this.addParticle(p, maxCount);
|
|
21580
|
+
this.lastEmitTime = timePassed;
|
|
21461
21581
|
}
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
if (timePassed < duration) {
|
|
21467
|
-
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21468
|
-
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21469
|
-
var maxEmissionCount = pointCount;
|
|
21470
|
-
var timeDelta = interval / pointCount;
|
|
21471
|
-
var meshTime = now;
|
|
21472
|
-
var maxCount = options.maxCount;
|
|
21473
|
-
this.updateEmitterTransform(timePassed);
|
|
21474
|
-
var shouldSkipGenerate = function() {
|
|
21475
|
-
var first = link.first;
|
|
21476
|
-
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21477
|
-
};
|
|
21478
|
-
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21479
|
-
if (shouldSkipGenerate()) {
|
|
21480
|
-
break;
|
|
21481
|
-
}
|
|
21482
|
-
var p = this.createPoint(lifetime);
|
|
21483
|
-
p.delay += meshTime + i * timeDelta;
|
|
21484
|
-
this.addParticle(p, maxCount);
|
|
21485
|
-
this.lastEmitTime = timePassed;
|
|
21582
|
+
var bursts = emission.bursts;
|
|
21583
|
+
for(var j = (bursts == null ? void 0 : bursts.length) - 1, cursor = 0; j >= 0 && cursor < maxCount; j--){
|
|
21584
|
+
if (shouldSkipGenerate()) {
|
|
21585
|
+
break;
|
|
21486
21586
|
}
|
|
21487
|
-
var
|
|
21488
|
-
|
|
21489
|
-
|
|
21490
|
-
|
|
21587
|
+
var burst = bursts[j];
|
|
21588
|
+
var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
|
|
21589
|
+
if (opts) {
|
|
21590
|
+
var originVec = [
|
|
21591
|
+
0,
|
|
21592
|
+
0,
|
|
21593
|
+
0
|
|
21594
|
+
];
|
|
21595
|
+
var offsets = emission.burstOffsets[j];
|
|
21596
|
+
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21597
|
+
if (burst.once) {
|
|
21598
|
+
this.removeBurst(j);
|
|
21491
21599
|
}
|
|
21492
|
-
var
|
|
21493
|
-
|
|
21494
|
-
|
|
21495
|
-
|
|
21496
|
-
0,
|
|
21497
|
-
0,
|
|
21498
|
-
0
|
|
21499
|
-
];
|
|
21500
|
-
var offsets = emission.burstOffsets[j];
|
|
21501
|
-
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21502
|
-
if (burst.once) {
|
|
21503
|
-
this.removeBurst(j);
|
|
21504
|
-
}
|
|
21505
|
-
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21506
|
-
var _p_transform;
|
|
21507
|
-
if (shouldSkipGenerate()) {
|
|
21508
|
-
break;
|
|
21509
|
-
}
|
|
21510
|
-
var p1 = this.initPoint(this.shape.generate({
|
|
21511
|
-
total: opts.total,
|
|
21512
|
-
index: opts.index,
|
|
21513
|
-
burstIndex: i1,
|
|
21514
|
-
burstCount: opts.count
|
|
21515
|
-
}));
|
|
21516
|
-
p1.delay += meshTime;
|
|
21517
|
-
cursor++;
|
|
21518
|
-
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21519
|
-
this.addParticle(p1, maxCount);
|
|
21600
|
+
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21601
|
+
var _p_transform;
|
|
21602
|
+
if (shouldSkipGenerate()) {
|
|
21603
|
+
break;
|
|
21520
21604
|
}
|
|
21605
|
+
var p1 = this.initPoint(this.shape.generate({
|
|
21606
|
+
total: opts.total,
|
|
21607
|
+
index: opts.index,
|
|
21608
|
+
burstIndex: i1,
|
|
21609
|
+
burstCount: opts.count
|
|
21610
|
+
}));
|
|
21611
|
+
p1.delay += meshTime;
|
|
21612
|
+
cursor++;
|
|
21613
|
+
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21614
|
+
this.addParticle(p1, maxCount);
|
|
21521
21615
|
}
|
|
21522
21616
|
}
|
|
21523
|
-
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21524
|
-
updateTrail();
|
|
21525
|
-
this.loopStartTime = now - duration;
|
|
21526
|
-
this.lastEmitTime -= duration;
|
|
21527
|
-
this.time -= duration;
|
|
21528
|
-
emission.bursts.forEach(function(b) {
|
|
21529
|
-
return b.reset();
|
|
21530
|
-
});
|
|
21531
|
-
this.particleLink.forEach(function(content) {
|
|
21532
|
-
content[0] -= duration;
|
|
21533
|
-
content[2] -= duration;
|
|
21534
|
-
content[3].delay -= duration;
|
|
21535
|
-
});
|
|
21536
|
-
this.renderer.minusTimeForLoop(duration);
|
|
21537
|
-
} else {
|
|
21538
|
-
this.ended = true;
|
|
21539
|
-
var endBehavior = this.item.endBehavior;
|
|
21540
|
-
if (endBehavior === EndBehavior.freeze) {
|
|
21541
|
-
this.frozen = true;
|
|
21542
|
-
}
|
|
21543
21617
|
}
|
|
21544
|
-
} else if (this.item.endBehavior
|
|
21545
|
-
|
|
21546
|
-
|
|
21547
|
-
|
|
21548
|
-
|
|
21549
|
-
|
|
21618
|
+
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21619
|
+
updateTrail();
|
|
21620
|
+
this.loopStartTime = now - duration;
|
|
21621
|
+
this.lastEmitTime -= duration;
|
|
21622
|
+
this.time -= duration;
|
|
21623
|
+
emission.bursts.forEach(function(b) {
|
|
21624
|
+
return b.reset();
|
|
21625
|
+
});
|
|
21626
|
+
this.particleLink.forEach(function(content) {
|
|
21627
|
+
content[0] -= duration;
|
|
21628
|
+
content[2] -= duration;
|
|
21629
|
+
content[3].delay -= duration;
|
|
21630
|
+
});
|
|
21631
|
+
this.renderer.minusTimeForLoop(duration);
|
|
21632
|
+
} else {
|
|
21633
|
+
this.ended = true;
|
|
21634
|
+
var endBehavior = this.item.endBehavior;
|
|
21635
|
+
if (endBehavior === EndBehavior.freeze) {
|
|
21636
|
+
this.frozen = true;
|
|
21637
|
+
}
|
|
21638
|
+
}
|
|
21639
|
+
} else if (this.item.endBehavior !== EndBehavior.restart) {
|
|
21640
|
+
if (EndBehavior.destroy === this.item.endBehavior) {
|
|
21641
|
+
var node = link.last;
|
|
21642
|
+
if (node && node.content[0] < this.time) {
|
|
21643
|
+
this.destroyed = true;
|
|
21550
21644
|
}
|
|
21551
21645
|
}
|
|
21552
|
-
updateTrail();
|
|
21553
21646
|
}
|
|
21647
|
+
updateTrail();
|
|
21554
21648
|
};
|
|
21555
21649
|
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
21556
21650
|
if (!this.isActiveAndEnabled) {
|
|
@@ -25590,7 +25684,6 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25590
25684
|
_this = MaskableGraphic.call(this, engine) || this;
|
|
25591
25685
|
_this.time = 0;
|
|
25592
25686
|
_this.duration = 1;
|
|
25593
|
-
_this.loop = true;
|
|
25594
25687
|
/**
|
|
25595
25688
|
* @internal
|
|
25596
25689
|
*/ _this.splits = singleSplits;
|
|
@@ -25605,11 +25698,13 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25605
25698
|
var _this = this;
|
|
25606
25699
|
var time = this.time;
|
|
25607
25700
|
var duration = this.duration;
|
|
25608
|
-
|
|
25701
|
+
var textureAnimation = this.textureSheetAnimation;
|
|
25702
|
+
var _textureAnimation_loop;
|
|
25703
|
+
var loop = (_textureAnimation_loop = textureAnimation == null ? void 0 : textureAnimation.loop) != null ? _textureAnimation_loop : true;
|
|
25704
|
+
if (time > duration && loop) {
|
|
25609
25705
|
time = time % duration;
|
|
25610
25706
|
}
|
|
25611
25707
|
var life = Math.min(Math.max(time / duration, 0.0), 1.0);
|
|
25612
|
-
var ta = this.textureSheetAnimation;
|
|
25613
25708
|
var video = this.renderer.texture.source.video;
|
|
25614
25709
|
if (video) {
|
|
25615
25710
|
if (time === 0) {
|
|
@@ -25621,9 +25716,9 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25621
25716
|
}
|
|
25622
25717
|
this.renderer.texture.uploadCurrentVideoFrame();
|
|
25623
25718
|
}
|
|
25624
|
-
if (
|
|
25719
|
+
if (textureAnimation) {
|
|
25625
25720
|
var _this_material_getVector4;
|
|
25626
|
-
var total =
|
|
25721
|
+
var total = textureAnimation.total || textureAnimation.row * textureAnimation.col;
|
|
25627
25722
|
var texRectX = 0;
|
|
25628
25723
|
var texRectY = 0;
|
|
25629
25724
|
var texRectW = 1;
|
|
@@ -25644,20 +25739,20 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25644
25739
|
}
|
|
25645
25740
|
var dx, dy;
|
|
25646
25741
|
if (flip) {
|
|
25647
|
-
dx = 1 /
|
|
25648
|
-
dy = 1 /
|
|
25742
|
+
dx = 1 / textureAnimation.row * texRectW;
|
|
25743
|
+
dy = 1 / textureAnimation.col * texRectH;
|
|
25649
25744
|
} else {
|
|
25650
|
-
dx = 1 /
|
|
25651
|
-
dy = 1 /
|
|
25745
|
+
dx = 1 / textureAnimation.col * texRectW;
|
|
25746
|
+
dy = 1 / textureAnimation.row * texRectH;
|
|
25652
25747
|
}
|
|
25653
25748
|
var texOffset;
|
|
25654
|
-
if (
|
|
25749
|
+
if (textureAnimation.animate) {
|
|
25655
25750
|
var frameIndex = Math.round(life * (total - 1));
|
|
25656
|
-
var yIndex = Math.floor(frameIndex /
|
|
25657
|
-
var xIndex = frameIndex - yIndex *
|
|
25751
|
+
var yIndex = Math.floor(frameIndex / textureAnimation.col);
|
|
25752
|
+
var xIndex = frameIndex - yIndex * textureAnimation.col;
|
|
25658
25753
|
texOffset = flip ? [
|
|
25659
25754
|
dx * yIndex,
|
|
25660
|
-
dy * (
|
|
25755
|
+
dy * (textureAnimation.col - xIndex)
|
|
25661
25756
|
] : [
|
|
25662
25757
|
dx * xIndex,
|
|
25663
25758
|
dy * (1 + yIndex)
|
|
@@ -25845,8 +25940,6 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25845
25940
|
var _data_duration;
|
|
25846
25941
|
//@ts-expect-error
|
|
25847
25942
|
this.duration = (_data_duration = data.duration) != null ? _data_duration : this.item.duration;
|
|
25848
|
-
var _data_loop;
|
|
25849
|
-
this.loop = (_data_loop = data.loop) != null ? _data_loop : true;
|
|
25850
25943
|
};
|
|
25851
25944
|
return SpriteComponent;
|
|
25852
25945
|
}(MaskableGraphic);
|
|
@@ -25854,21 +25947,21 @@ SpriteComponent = __decorate([
|
|
|
25854
25947
|
effectsClass(DataType.SpriteComponent)
|
|
25855
25948
|
], SpriteComponent);
|
|
25856
25949
|
|
|
25857
|
-
var ParticleLoader = /*#__PURE__*/ function(
|
|
25858
|
-
_inherits(ParticleLoader,
|
|
25950
|
+
var ParticleLoader = /*#__PURE__*/ function(Plugin) {
|
|
25951
|
+
_inherits(ParticleLoader, Plugin);
|
|
25859
25952
|
function ParticleLoader() {
|
|
25860
|
-
return
|
|
25953
|
+
return Plugin.apply(this, arguments);
|
|
25861
25954
|
}
|
|
25862
25955
|
return ParticleLoader;
|
|
25863
|
-
}(
|
|
25956
|
+
}(_wrap_native_super(Plugin));
|
|
25864
25957
|
|
|
25865
|
-
var CalculateLoader = /*#__PURE__*/ function(
|
|
25866
|
-
_inherits(CalculateLoader,
|
|
25958
|
+
var CalculateLoader = /*#__PURE__*/ function(Plugin) {
|
|
25959
|
+
_inherits(CalculateLoader, Plugin);
|
|
25867
25960
|
function CalculateLoader() {
|
|
25868
|
-
return
|
|
25961
|
+
return Plugin.apply(this, arguments);
|
|
25869
25962
|
}
|
|
25870
25963
|
return CalculateLoader;
|
|
25871
|
-
}(
|
|
25964
|
+
}(_wrap_native_super(Plugin));
|
|
25872
25965
|
|
|
25873
25966
|
// Based on:
|
|
25874
25967
|
/**
|
|
@@ -28970,6 +29063,12 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
28970
29063
|
/**
|
|
28971
29064
|
* 每一行文本的最大宽度
|
|
28972
29065
|
*/ _this.maxLineWidth = 0;
|
|
29066
|
+
/**
|
|
29067
|
+
* 初始文本宽度,用于计算缩放比例
|
|
29068
|
+
*/ _this.baseTextWidth = 0;
|
|
29069
|
+
/**
|
|
29070
|
+
* 初始 `transform.size.x`,用于按比例更新显示宽度
|
|
29071
|
+
*/ _this.baseScaleX = 1;
|
|
28973
29072
|
_this.name = "MText" + seed$1++;
|
|
28974
29073
|
// 初始化canvas资源
|
|
28975
29074
|
_this.canvas = canvasPool.getCanvas();
|
|
@@ -28995,10 +29094,11 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
28995
29094
|
text: "默认文本",
|
|
28996
29095
|
fontFamily: "AlibabaSans-BoldItalic",
|
|
28997
29096
|
fontSize: 40,
|
|
29097
|
+
// 统一使用 0-1 颜色值
|
|
28998
29098
|
textColor: [
|
|
28999
|
-
|
|
29000
|
-
|
|
29001
|
-
|
|
29099
|
+
1,
|
|
29100
|
+
1,
|
|
29101
|
+
1,
|
|
29002
29102
|
1
|
|
29003
29103
|
],
|
|
29004
29104
|
fontWeight: TextWeight.normal,
|
|
@@ -29035,6 +29135,10 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29035
29135
|
// TextComponentBase
|
|
29036
29136
|
this.updateWithOptions(options);
|
|
29037
29137
|
this.renderText(options);
|
|
29138
|
+
// 记录初始的 textWidth 和 x 缩放,用于后续按比例更新显示宽度
|
|
29139
|
+
// 添加兜底值 1 防止除 0
|
|
29140
|
+
this.baseTextWidth = options.textWidth || this.textLayout.width || 1;
|
|
29141
|
+
this.baseScaleX = this.item.transform.size.x;
|
|
29038
29142
|
// 恢复默认颜色
|
|
29039
29143
|
this.material.setColor("_Color", new Color(1, 1, 1, 1));
|
|
29040
29144
|
};
|
|
@@ -29233,9 +29337,9 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29233
29337
|
if (style.isOutlined) {
|
|
29234
29338
|
_this.setupOutline();
|
|
29235
29339
|
}
|
|
29236
|
-
//
|
|
29340
|
+
// textColor 统一是 0-1,写入 canvas 时乘 255
|
|
29237
29341
|
var _style_textColor = style.textColor, r = _style_textColor[0], g = _style_textColor[1], b = _style_textColor[2], a = _style_textColor[3];
|
|
29238
|
-
context.fillStyle = "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
|
|
29342
|
+
context.fillStyle = "rgba(" + r * 255 + ", " + g * 255 + ", " + b * 255 + ", " + a + ")";
|
|
29239
29343
|
var charsInfo = [];
|
|
29240
29344
|
var x = 0;
|
|
29241
29345
|
var y = layout.getOffsetY(style, _this.lineCount, lineHeight, fontSize);
|
|
@@ -29297,6 +29401,31 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29297
29401
|
layout.autoWidth = normalizedValue;
|
|
29298
29402
|
this.isDirty = true;
|
|
29299
29403
|
};
|
|
29404
|
+
/**
|
|
29405
|
+
* 设置文本框宽度
|
|
29406
|
+
* 手动设置宽度时会自动关闭 `autoWidth`
|
|
29407
|
+
* 同时会按比例更新 `transform.size.x`,让 UI 框宽度也跟着变化
|
|
29408
|
+
* @param value - 文本框宽度
|
|
29409
|
+
*/ _proto.setTextWidth = function setTextWidth(value) {
|
|
29410
|
+
var width = Math.max(0, Number(value) || 0);
|
|
29411
|
+
var layout = this.textLayout;
|
|
29412
|
+
// 宽度没变且已是非 autoWidth 模式,直接返回
|
|
29413
|
+
if (layout.width === width && layout.autoWidth === false) {
|
|
29414
|
+
return;
|
|
29415
|
+
}
|
|
29416
|
+
// 手动设置宽度时关闭 autoWidth
|
|
29417
|
+
layout.autoWidth = false;
|
|
29418
|
+
layout.width = width;
|
|
29419
|
+
// 按当前 overflow 模式重新计算行数和 maxLineWidth
|
|
29420
|
+
this.lineCount = this.getLineCount(this.text || "");
|
|
29421
|
+
this.isDirty = true;
|
|
29422
|
+
// 同步更新外层显示宽度(按比例缩放 transform)
|
|
29423
|
+
// 这样 UI 框的视觉宽度也会跟着文本宽度变化
|
|
29424
|
+
if (this.baseTextWidth > 0) {
|
|
29425
|
+
var scale = width / this.baseTextWidth;
|
|
29426
|
+
this.item.transform.size.x = this.baseScaleX * scale;
|
|
29427
|
+
}
|
|
29428
|
+
};
|
|
29300
29429
|
_proto.setFontSize = function setFontSize(value) {
|
|
29301
29430
|
if (this.textStyle.fontSize === value) {
|
|
29302
29431
|
return;
|
|
@@ -29364,13 +29493,13 @@ applyMixins(TextComponent, [
|
|
|
29364
29493
|
]);
|
|
29365
29494
|
|
|
29366
29495
|
// TODO: 注册必须用
|
|
29367
|
-
var TextLoader = /*#__PURE__*/ function(
|
|
29368
|
-
_inherits(TextLoader,
|
|
29496
|
+
var TextLoader = /*#__PURE__*/ function(Plugin) {
|
|
29497
|
+
_inherits(TextLoader, Plugin);
|
|
29369
29498
|
function TextLoader() {
|
|
29370
|
-
return
|
|
29499
|
+
return Plugin.apply(this, arguments);
|
|
29371
29500
|
}
|
|
29372
29501
|
return TextLoader;
|
|
29373
|
-
}(
|
|
29502
|
+
}(_wrap_native_super(Plugin));
|
|
29374
29503
|
|
|
29375
29504
|
var Asset = /*#__PURE__*/ function(EffectsObject) {
|
|
29376
29505
|
_inherits(Asset, EffectsObject);
|
|
@@ -30427,6 +30556,10 @@ function version35Migration(json) {
|
|
|
30427
30556
|
if (component.dataType === DataType.TextComponent || component.dataType === DataType.RichTextComponent && component.options) {
|
|
30428
30557
|
ensureTextVerticalAlign(component.options);
|
|
30429
30558
|
}
|
|
30559
|
+
// 处理文本颜色从 0-255 到 0-1 的转换
|
|
30560
|
+
if (component.dataType === DataType.TextComponent) {
|
|
30561
|
+
convertTextColorTo01(component.options);
|
|
30562
|
+
}
|
|
30430
30563
|
}
|
|
30431
30564
|
}
|
|
30432
30565
|
//@ts-expect-error
|
|
@@ -30446,6 +30579,22 @@ function version35Migration(json) {
|
|
|
30446
30579
|
options.TextVerticalAlign = options.textBaseline;
|
|
30447
30580
|
}
|
|
30448
30581
|
}
|
|
30582
|
+
/**
|
|
30583
|
+
* 将文本颜色从 0-255 转换到 0-1
|
|
30584
|
+
*/ function convertTextColorTo01(options) {
|
|
30585
|
+
if (!options || !options.textColor) {
|
|
30586
|
+
return;
|
|
30587
|
+
}
|
|
30588
|
+
var textColor = options.textColor;
|
|
30589
|
+
var _textColor_;
|
|
30590
|
+
// 将 RGB 从 0-255 转换到 0-1(alpha 通道已经是 0-1,不需要转换)
|
|
30591
|
+
options.textColor = [
|
|
30592
|
+
textColor[0] / 255.0,
|
|
30593
|
+
textColor[1] / 255.0,
|
|
30594
|
+
textColor[2] / 255.0,
|
|
30595
|
+
(_textColor_ = textColor[3]) != null ? _textColor_ : 1
|
|
30596
|
+
];
|
|
30597
|
+
}
|
|
30449
30598
|
/**
|
|
30450
30599
|
* 根据形状获取形状几何体数据
|
|
30451
30600
|
* @param shape - 形状
|
|
@@ -31222,6 +31371,7 @@ function getStandardParticleContent(particle) {
|
|
|
31222
31371
|
}
|
|
31223
31372
|
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
31224
31373
|
if (textureSheetAnimation) {
|
|
31374
|
+
// @ts-expect-error
|
|
31225
31375
|
ret.textureSheetAnimation = {
|
|
31226
31376
|
row: textureSheetAnimation.row,
|
|
31227
31377
|
col: textureSheetAnimation.col,
|
|
@@ -31351,6 +31501,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31351
31501
|
var ret = getStandardNullContent(sprite, transform);
|
|
31352
31502
|
var texAni = sprite.textureSheetAnimation;
|
|
31353
31503
|
if (texAni) {
|
|
31504
|
+
// @ts-expect-error
|
|
31354
31505
|
ret.textureSheetAnimation = {
|
|
31355
31506
|
row: texAni.row,
|
|
31356
31507
|
col: texAni.col,
|
|
@@ -31368,7 +31519,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31368
31519
|
return ret;
|
|
31369
31520
|
}
|
|
31370
31521
|
|
|
31371
|
-
var version$1 = "2.8.0-alpha.
|
|
31522
|
+
var version$1 = "2.8.0-alpha.5";
|
|
31372
31523
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31373
31524
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31374
31525
|
var reverseParticle = false;
|
|
@@ -32008,8 +32159,8 @@ var seed = 1;
|
|
|
32008
32159
|
};
|
|
32009
32160
|
return [
|
|
32010
32161
|
4,
|
|
32011
|
-
hookTimeInfo("plugin:
|
|
32012
|
-
return _this.
|
|
32162
|
+
hookTimeInfo("plugin:onAssetsLoadStart", function() {
|
|
32163
|
+
return _this.onPluginSceneLoadStart(scene);
|
|
32013
32164
|
})
|
|
32014
32165
|
];
|
|
32015
32166
|
case 6:
|
|
@@ -32017,7 +32168,7 @@ var seed = 1;
|
|
|
32017
32168
|
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
32018
32169
|
return [
|
|
32019
32170
|
4,
|
|
32020
|
-
Promise.all([
|
|
32171
|
+
Promise.all([].concat([
|
|
32021
32172
|
hookTimeInfo("processBins", function() {
|
|
32022
32173
|
return _this.processBins(bins);
|
|
32023
32174
|
}),
|
|
@@ -32027,7 +32178,11 @@ var seed = 1;
|
|
|
32027
32178
|
hookTimeInfo("processFontURL", function() {
|
|
32028
32179
|
return _this.processFontURL(fonts);
|
|
32029
32180
|
})
|
|
32030
|
-
]
|
|
32181
|
+
], _this.options.useHevcVideo ? [
|
|
32182
|
+
hookTimeInfo("processVideoURL", function() {
|
|
32183
|
+
return _this.processVideoURL(jsonScene);
|
|
32184
|
+
})
|
|
32185
|
+
] : []))
|
|
32031
32186
|
];
|
|
32032
32187
|
case 7:
|
|
32033
32188
|
_ref = _state.sent(), loadedBins = _ref[0], loadedImages = _ref[1];
|
|
@@ -32297,7 +32452,7 @@ var seed = 1;
|
|
|
32297
32452
|
});
|
|
32298
32453
|
})();
|
|
32299
32454
|
};
|
|
32300
|
-
_proto.
|
|
32455
|
+
_proto.onPluginSceneLoadStart = function onPluginSceneLoadStart(scene) {
|
|
32301
32456
|
var _this = this;
|
|
32302
32457
|
return _async_to_generator(function() {
|
|
32303
32458
|
return __generator(this, function(_state) {
|
|
@@ -32305,7 +32460,7 @@ var seed = 1;
|
|
|
32305
32460
|
case 0:
|
|
32306
32461
|
return [
|
|
32307
32462
|
4,
|
|
32308
|
-
PluginSystem.
|
|
32463
|
+
PluginSystem.onAssetsLoadStart(scene, _this.options)
|
|
32309
32464
|
];
|
|
32310
32465
|
case 1:
|
|
32311
32466
|
_state.sent();
|
|
@@ -32413,6 +32568,30 @@ var seed = 1;
|
|
|
32413
32568
|
});
|
|
32414
32569
|
})();
|
|
32415
32570
|
};
|
|
32571
|
+
_proto.processVideoURL = function processVideoURL(jsonScene) {
|
|
32572
|
+
return _async_to_generator(function() {
|
|
32573
|
+
return __generator(this, function(_state) {
|
|
32574
|
+
if (!(jsonScene == null ? void 0 : jsonScene.videos) || !Array.isArray(jsonScene.videos)) {
|
|
32575
|
+
return [
|
|
32576
|
+
2
|
|
32577
|
+
];
|
|
32578
|
+
}
|
|
32579
|
+
jsonScene.videos.forEach(function(video) {
|
|
32580
|
+
var hevc = video.hevc;
|
|
32581
|
+
if (!(hevc == null ? void 0 : hevc.url) || !(hevc == null ? void 0 : hevc.codec)) {
|
|
32582
|
+
return;
|
|
32583
|
+
}
|
|
32584
|
+
var codec = parseCodec(hevc.codec);
|
|
32585
|
+
if (codec && canPlayHevcCodec(codec)) {
|
|
32586
|
+
video.url = hevc.url;
|
|
32587
|
+
}
|
|
32588
|
+
});
|
|
32589
|
+
return [
|
|
32590
|
+
2
|
|
32591
|
+
];
|
|
32592
|
+
});
|
|
32593
|
+
})();
|
|
32594
|
+
};
|
|
32416
32595
|
_proto.loadJSON = function loadJSON(url) {
|
|
32417
32596
|
var _this = this;
|
|
32418
32597
|
return _async_to_generator(function() {
|
|
@@ -35006,8 +35185,8 @@ var SceneLoader = /*#__PURE__*/ function() {
|
|
|
35006
35185
|
case 1:
|
|
35007
35186
|
loadedScene = _state.sent();
|
|
35008
35187
|
engine.clearResources();
|
|
35009
|
-
// 触发插件系统 pluginSystem 的回调
|
|
35010
|
-
PluginSystem.
|
|
35188
|
+
// 触发插件系统 pluginSystem 的回调 onAssetsLoadFinish
|
|
35189
|
+
PluginSystem.onAssetsLoadFinish(loadedScene, assetManager.options, engine);
|
|
35011
35190
|
engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
|
|
35012
35191
|
engine.assetService.updateTextVariables(loadedScene, options.variables);
|
|
35013
35192
|
engine.assetService.initializeTexture(loadedScene);
|
|
@@ -35069,8 +35248,8 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35069
35248
|
registerPlugin("particle", ParticleLoader);
|
|
35070
35249
|
registerPlugin("cal", CalculateLoader);
|
|
35071
35250
|
registerPlugin("interact", InteractLoader);
|
|
35072
|
-
var version = "2.8.0-alpha.
|
|
35251
|
+
var version = "2.8.0-alpha.5";
|
|
35073
35252
|
logger.info("Core version: " + version + ".");
|
|
35074
35253
|
|
|
35075
|
-
export {
|
|
35254
|
+
export { ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, PropertyClipPlayable, PropertyTrack, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, 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, Scene, SceneLoader, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SourceType, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, buildLine, calculateTranslation, canPlayHevcCodec, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parseCodec, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
35076
35255
|
//# sourceMappingURL=index.mjs.map
|