@galacean/effects-core 2.8.0-alpha.4 → 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 +1 -0
- package/dist/downloader.d.ts +1 -1
- package/dist/index.js +434 -373
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +433 -374
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/text/text-item.d.ts +0 -5
- 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,357 +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
|
-
plugins.push(pluginInstance);
|
|
2883
|
-
plugins.sort(function(a, b) {
|
|
2884
|
-
return a.order - b.order;
|
|
2885
|
-
});
|
|
2886
|
-
}
|
|
2887
|
-
/**
|
|
2888
|
-
* 注销 plugin
|
|
2889
|
-
*/ function unregisterPlugin(name) {
|
|
2890
|
-
delete pluginLoaderMap[name];
|
|
2891
|
-
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
2892
|
-
return plugin.name === name;
|
|
2893
|
-
});
|
|
2894
|
-
if (pluginIndex !== -1) {
|
|
2895
|
-
plugins.splice(pluginIndex, 1);
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
2898
|
-
var PluginSystem = /*#__PURE__*/ function() {
|
|
2899
|
-
function PluginSystem() {}
|
|
2900
|
-
PluginSystem.getPlugins = function getPlugins() {
|
|
2901
|
-
return plugins;
|
|
2902
|
-
};
|
|
2903
|
-
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2904
|
-
plugins.forEach(function(loader) {
|
|
2905
|
-
return loader.onCompositionCreated(composition, scene);
|
|
2906
|
-
});
|
|
2907
|
-
};
|
|
2908
|
-
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2909
|
-
plugins.forEach(function(loader) {
|
|
2910
|
-
return loader.onCompositionDestroy(comp);
|
|
2911
|
-
});
|
|
2912
|
-
};
|
|
2913
|
-
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2914
|
-
return _async_to_generator(function() {
|
|
2915
|
-
return __generator(this, function(_state) {
|
|
2916
|
-
return [
|
|
2917
|
-
2,
|
|
2918
|
-
Promise.all(plugins.map(function(plugin) {
|
|
2919
|
-
return plugin.onAssetsLoadStart(scene, options);
|
|
2920
|
-
}))
|
|
2921
|
-
];
|
|
2922
|
-
});
|
|
2923
|
-
})();
|
|
2924
|
-
};
|
|
2925
|
-
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
2926
|
-
plugins.forEach(function(loader) {
|
|
2927
|
-
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
2928
|
-
});
|
|
2929
|
-
};
|
|
2930
|
-
return PluginSystem;
|
|
2931
|
-
}();
|
|
2932
|
-
var pluginInfoMap = {
|
|
2933
|
-
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
2934
|
-
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
2935
|
-
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
2936
|
-
"ffd": "@galacean/effects-plugin-ffd",
|
|
2937
|
-
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
2938
|
-
"model": "@galacean/effects-plugin-model",
|
|
2939
|
-
"video": "@galacean/effects-plugin-multimedia",
|
|
2940
|
-
"audio": "@galacean/effects-plugin-multimedia",
|
|
2941
|
-
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
2942
|
-
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
2943
|
-
"spine": "@galacean/effects-plugin-spine"
|
|
2944
|
-
};
|
|
2945
|
-
function getPluginUsageInfo(name) {
|
|
2946
|
-
var info = pluginInfoMap[name];
|
|
2947
|
-
if (info) {
|
|
2948
|
-
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
2949
|
-
} else {
|
|
2950
|
-
return "";
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
/**
|
|
2955
|
-
* 抽象插件类
|
|
2956
|
-
* 注册合成不同生命周期的回调函数
|
|
2957
|
-
*/ var Plugin = /*#__PURE__*/ function() {
|
|
2958
|
-
function Plugin() {
|
|
2959
|
-
this.order = 100;
|
|
2960
|
-
this.name = "Plugin";
|
|
2961
|
-
}
|
|
2962
|
-
var _proto = Plugin.prototype;
|
|
2963
|
-
/**
|
|
2964
|
-
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
2965
|
-
* 此阶段适合发起异步资源请求。
|
|
2966
|
-
* @param scene - 场景对象
|
|
2967
|
-
* @param options - 场景加载选项
|
|
2968
|
-
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2969
|
-
return _async_to_generator(function() {
|
|
2970
|
-
return __generator(this, function(_state) {
|
|
2971
|
-
return [
|
|
2972
|
-
2
|
|
2973
|
-
];
|
|
2974
|
-
});
|
|
2975
|
-
})();
|
|
2976
|
-
};
|
|
2977
|
-
/**
|
|
2978
|
-
* 场景资源加载完成后触发。
|
|
2979
|
-
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
2980
|
-
* @param scene - 场景对象
|
|
2981
|
-
* @param options - 场景加载选项
|
|
2982
|
-
* @param engine - 引擎实例
|
|
2983
|
-
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
2984
|
-
/**
|
|
2985
|
-
* 合成创建完成后触发。
|
|
2986
|
-
* @param composition - 合成对象
|
|
2987
|
-
* @param scene - 场景对象
|
|
2988
|
-
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
2989
|
-
/**
|
|
2990
|
-
* 合成销毁时触发。
|
|
2991
|
-
* @param composition - 合成对象
|
|
2992
|
-
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
2993
|
-
return Plugin;
|
|
2994
|
-
}();
|
|
2995
|
-
|
|
2996
|
-
function _set_prototype_of(o, p) {
|
|
2997
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
2998
|
-
o.__proto__ = p;
|
|
2999
|
-
return o;
|
|
3000
|
-
};
|
|
3001
|
-
return _set_prototype_of(o, p);
|
|
3002
|
-
}
|
|
3003
|
-
|
|
3004
|
-
function _inherits(subClass, superClass) {
|
|
3005
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
3006
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
3007
|
-
}
|
|
3008
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
3009
|
-
constructor: {
|
|
3010
|
-
value: subClass,
|
|
3011
|
-
writable: true,
|
|
3012
|
-
configurable: true
|
|
3013
|
-
}
|
|
3014
|
-
});
|
|
3015
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
3016
|
-
}
|
|
3017
|
-
|
|
3018
2667
|
/**
|
|
3019
2668
|
* JSON 版本
|
|
3020
2669
|
*/ var JSONSceneVersion;
|
|
@@ -3762,6 +3411,17 @@ var NodeDataType;
|
|
|
3762
3411
|
MultimediaType["video"] = "video";
|
|
3763
3412
|
MultimediaType["audio"] = "audio";
|
|
3764
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 = {}));
|
|
3765
3425
|
|
|
3766
3426
|
var DataType;
|
|
3767
3427
|
(function(DataType) {
|
|
@@ -3967,6 +3627,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3967
3627
|
get NodeDataType () { return NodeDataType; },
|
|
3968
3628
|
get BackgroundType () { return BackgroundType; },
|
|
3969
3629
|
get MultimediaType () { return MultimediaType; },
|
|
3630
|
+
get HevcVideoCodec () { return HevcVideoCodec; },
|
|
3970
3631
|
get DataType () { return DataType; },
|
|
3971
3632
|
get GeometryType () { return GeometryType; },
|
|
3972
3633
|
get VertexFormatType () { return VertexFormatType; },
|
|
@@ -3974,6 +3635,391 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3974
3635
|
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
3975
3636
|
});
|
|
3976
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
|
+
|
|
3977
4023
|
function _array_like_to_array(arr, len) {
|
|
3978
4024
|
if (len == null || len > arr.length) len = arr.length;
|
|
3979
4025
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -25654,8 +25700,6 @@ var SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25654
25700
|
var duration = this.duration;
|
|
25655
25701
|
var textureAnimation = this.textureSheetAnimation;
|
|
25656
25702
|
var _textureAnimation_loop;
|
|
25657
|
-
// TODO: Update textureAnimation spec.
|
|
25658
|
-
// @ts-expect-error
|
|
25659
25703
|
var loop = (_textureAnimation_loop = textureAnimation == null ? void 0 : textureAnimation.loop) != null ? _textureAnimation_loop : true;
|
|
25660
25704
|
if (time > duration && loop) {
|
|
25661
25705
|
time = time % duration;
|
|
@@ -29382,21 +29426,6 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29382
29426
|
this.item.transform.size.x = this.baseScaleX * scale;
|
|
29383
29427
|
}
|
|
29384
29428
|
};
|
|
29385
|
-
/**
|
|
29386
|
-
* 设置文本框高度
|
|
29387
|
-
* @param value - 文本框高度
|
|
29388
|
-
*/ _proto.setTextHeight = function setTextHeight(value) {
|
|
29389
|
-
var height = Math.max(0, Number(value) || 0);
|
|
29390
|
-
if (height === 0) {
|
|
29391
|
-
return;
|
|
29392
|
-
}
|
|
29393
|
-
var layout = this.textLayout;
|
|
29394
|
-
if (layout.height === height) {
|
|
29395
|
-
return;
|
|
29396
|
-
}
|
|
29397
|
-
layout.height = height;
|
|
29398
|
-
this.isDirty = true;
|
|
29399
|
-
};
|
|
29400
29429
|
_proto.setFontSize = function setFontSize(value) {
|
|
29401
29430
|
if (this.textStyle.fontSize === value) {
|
|
29402
29431
|
return;
|
|
@@ -31342,6 +31371,7 @@ function getStandardParticleContent(particle) {
|
|
|
31342
31371
|
}
|
|
31343
31372
|
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
31344
31373
|
if (textureSheetAnimation) {
|
|
31374
|
+
// @ts-expect-error
|
|
31345
31375
|
ret.textureSheetAnimation = {
|
|
31346
31376
|
row: textureSheetAnimation.row,
|
|
31347
31377
|
col: textureSheetAnimation.col,
|
|
@@ -31471,6 +31501,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31471
31501
|
var ret = getStandardNullContent(sprite, transform);
|
|
31472
31502
|
var texAni = sprite.textureSheetAnimation;
|
|
31473
31503
|
if (texAni) {
|
|
31504
|
+
// @ts-expect-error
|
|
31474
31505
|
ret.textureSheetAnimation = {
|
|
31475
31506
|
row: texAni.row,
|
|
31476
31507
|
col: texAni.col,
|
|
@@ -31488,7 +31519,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31488
31519
|
return ret;
|
|
31489
31520
|
}
|
|
31490
31521
|
|
|
31491
|
-
var version$1 = "2.8.0-alpha.
|
|
31522
|
+
var version$1 = "2.8.0-alpha.5";
|
|
31492
31523
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31493
31524
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31494
31525
|
var reverseParticle = false;
|
|
@@ -32137,7 +32168,7 @@ var seed = 1;
|
|
|
32137
32168
|
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
32138
32169
|
return [
|
|
32139
32170
|
4,
|
|
32140
|
-
Promise.all([
|
|
32171
|
+
Promise.all([].concat([
|
|
32141
32172
|
hookTimeInfo("processBins", function() {
|
|
32142
32173
|
return _this.processBins(bins);
|
|
32143
32174
|
}),
|
|
@@ -32147,7 +32178,11 @@ var seed = 1;
|
|
|
32147
32178
|
hookTimeInfo("processFontURL", function() {
|
|
32148
32179
|
return _this.processFontURL(fonts);
|
|
32149
32180
|
})
|
|
32150
|
-
]
|
|
32181
|
+
], _this.options.useHevcVideo ? [
|
|
32182
|
+
hookTimeInfo("processVideoURL", function() {
|
|
32183
|
+
return _this.processVideoURL(jsonScene);
|
|
32184
|
+
})
|
|
32185
|
+
] : []))
|
|
32151
32186
|
];
|
|
32152
32187
|
case 7:
|
|
32153
32188
|
_ref = _state.sent(), loadedBins = _ref[0], loadedImages = _ref[1];
|
|
@@ -32533,6 +32568,30 @@ var seed = 1;
|
|
|
32533
32568
|
});
|
|
32534
32569
|
})();
|
|
32535
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
|
+
};
|
|
32536
32595
|
_proto.loadJSON = function loadJSON(url) {
|
|
32537
32596
|
var _this = this;
|
|
32538
32597
|
return _async_to_generator(function() {
|
|
@@ -35189,8 +35248,8 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35189
35248
|
registerPlugin("particle", ParticleLoader);
|
|
35190
35249
|
registerPlugin("cal", CalculateLoader);
|
|
35191
35250
|
registerPlugin("interact", InteractLoader);
|
|
35192
|
-
var version = "2.8.0-alpha.
|
|
35251
|
+
var version = "2.8.0-alpha.5";
|
|
35193
35252
|
logger.info("Core version: " + version + ".");
|
|
35194
35253
|
|
|
35195
|
-
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, 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, 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 };
|
|
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 };
|
|
35196
35255
|
//# sourceMappingURL=index.mjs.map
|