@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.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.8.0-alpha.
|
|
6
|
+
* Version: v2.8.0-alpha.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -2668,357 +2668,6 @@ function asserts(condition, msg) {
|
|
|
2668
2668
|
return /^[^\d.][\w-]*$/.test(fontFamily);
|
|
2669
2669
|
}
|
|
2670
2670
|
|
|
2671
|
-
/**
|
|
2672
|
-
* Simple implementation of the deferred pattern.
|
|
2673
|
-
* An object that exposes a promise and functions to resolve and reject it.
|
|
2674
|
-
*/ var Deferred = function Deferred() {
|
|
2675
|
-
var _this = this;
|
|
2676
|
-
this.promise = new Promise(function(resolve, reject) {
|
|
2677
|
-
_this.resolve = resolve;
|
|
2678
|
-
_this.reject = reject;
|
|
2679
|
-
});
|
|
2680
|
-
};
|
|
2681
|
-
|
|
2682
|
-
var prefix = "[Galacean Effects]";
|
|
2683
|
-
var localLogger;
|
|
2684
|
-
function format(message) {
|
|
2685
|
-
return [
|
|
2686
|
-
"%c" + prefix,
|
|
2687
|
-
"color: #AA0100",
|
|
2688
|
-
"" + message
|
|
2689
|
-
];
|
|
2690
|
-
}
|
|
2691
|
-
function error(message) {
|
|
2692
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2693
|
-
args[_key - 1] = arguments[_key];
|
|
2694
|
-
}
|
|
2695
|
-
var _console;
|
|
2696
|
-
(_console = console).error.apply(_console, [].concat(format(message), [
|
|
2697
|
-
args
|
|
2698
|
-
]));
|
|
2699
|
-
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
2700
|
-
}
|
|
2701
|
-
/**
|
|
2702
|
-
* info 会转换成浏览器的 console.debug
|
|
2703
|
-
* @param message
|
|
2704
|
-
* @param args
|
|
2705
|
-
*/ function info(message) {
|
|
2706
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2707
|
-
args[_key - 1] = arguments[_key];
|
|
2708
|
-
}
|
|
2709
|
-
var _console;
|
|
2710
|
-
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
2711
|
-
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
2712
|
-
}
|
|
2713
|
-
function warn(message) {
|
|
2714
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2715
|
-
args[_key - 1] = arguments[_key];
|
|
2716
|
-
}
|
|
2717
|
-
var _console;
|
|
2718
|
-
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
2719
|
-
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
2720
|
-
}
|
|
2721
|
-
/**
|
|
2722
|
-
* 注册自定义埋点函数
|
|
2723
|
-
*
|
|
2724
|
-
* @param fn
|
|
2725
|
-
*/ function register(fn) {
|
|
2726
|
-
if (fn && isFunction(fn)) {
|
|
2727
|
-
localLogger = fn;
|
|
2728
|
-
}
|
|
2729
|
-
}
|
|
2730
|
-
var logger = {
|
|
2731
|
-
error: error,
|
|
2732
|
-
info: info,
|
|
2733
|
-
warn: warn,
|
|
2734
|
-
register: register
|
|
2735
|
-
};
|
|
2736
|
-
|
|
2737
|
-
exports.DestroyOptions = void 0;
|
|
2738
|
-
(function(DestroyOptions) {
|
|
2739
|
-
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
2740
|
-
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
2741
|
-
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
2742
|
-
})(exports.DestroyOptions || (exports.DestroyOptions = {}));
|
|
2743
|
-
function noop() {}
|
|
2744
|
-
/**
|
|
2745
|
-
* 判断对象是否是`String`类型
|
|
2746
|
-
*
|
|
2747
|
-
* @static
|
|
2748
|
-
* @function isString
|
|
2749
|
-
* @param obj - 要判断的对象
|
|
2750
|
-
* @return
|
|
2751
|
-
*/ function isString(obj) {
|
|
2752
|
-
return typeof obj === "string";
|
|
2753
|
-
}
|
|
2754
|
-
/**
|
|
2755
|
-
* 判断对象是否是`Array`类型
|
|
2756
|
-
*
|
|
2757
|
-
* @static
|
|
2758
|
-
* @function isArray
|
|
2759
|
-
* @param obj - 要判断的对象
|
|
2760
|
-
* @return
|
|
2761
|
-
*/ var isArray = Array.isArray || function(obj) {
|
|
2762
|
-
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
2763
|
-
};
|
|
2764
|
-
/**
|
|
2765
|
-
* 判断对象是否是函数类型
|
|
2766
|
-
*
|
|
2767
|
-
* @static
|
|
2768
|
-
* @function isFunction
|
|
2769
|
-
* @param obj - 要判断的对象
|
|
2770
|
-
* @return
|
|
2771
|
-
*/ function isFunction(obj) {
|
|
2772
|
-
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
2773
|
-
}
|
|
2774
|
-
/**
|
|
2775
|
-
* 判断对象是否是`Object`类型
|
|
2776
|
-
*
|
|
2777
|
-
* @static
|
|
2778
|
-
* @function isObject
|
|
2779
|
-
* @param obj - 要判断的对象
|
|
2780
|
-
* @return
|
|
2781
|
-
*/ function isObject(obj) {
|
|
2782
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
2783
|
-
}
|
|
2784
|
-
/**
|
|
2785
|
-
* 判断对象是否是`Plain Object`类型
|
|
2786
|
-
*
|
|
2787
|
-
* @param obj - 要判断的对象
|
|
2788
|
-
* @returns
|
|
2789
|
-
*/ function isPlainObject(obj) {
|
|
2790
|
-
if (obj === null || typeof obj !== "object") {
|
|
2791
|
-
return false;
|
|
2792
|
-
}
|
|
2793
|
-
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
2794
|
-
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
2795
|
-
return false;
|
|
2796
|
-
}
|
|
2797
|
-
var proto = Object.getPrototypeOf(obj);
|
|
2798
|
-
if (proto === null) {
|
|
2799
|
-
return true;
|
|
2800
|
-
} // Object.create(null)
|
|
2801
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
2802
|
-
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
2803
|
-
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
2804
|
-
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
2805
|
-
}
|
|
2806
|
-
function isCanvas(canvas) {
|
|
2807
|
-
var _canvas_tagName;
|
|
2808
|
-
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
2809
|
-
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
2810
|
-
}
|
|
2811
|
-
function isPowerOfTwo(value) {
|
|
2812
|
-
return (value & value - 1) === 0 && value !== 0;
|
|
2813
|
-
}
|
|
2814
|
-
/**
|
|
2815
|
-
* 生成一个位于 min 和 max 之间的随机数
|
|
2816
|
-
* @param min
|
|
2817
|
-
* @param max
|
|
2818
|
-
* @returns
|
|
2819
|
-
*/ function randomInRange(min, max) {
|
|
2820
|
-
return min + Math.random() * (max - min);
|
|
2821
|
-
}
|
|
2822
|
-
function throwDestroyedError() {
|
|
2823
|
-
throw new Error("Destroyed item cannot be used again.");
|
|
2824
|
-
}
|
|
2825
|
-
function generateGUID() {
|
|
2826
|
-
return v4().replace(/-/g, "");
|
|
2827
|
-
}
|
|
2828
|
-
function base64ToFile(base64, filename, contentType) {
|
|
2829
|
-
if (filename === void 0) filename = "base64File";
|
|
2830
|
-
if (contentType === void 0) contentType = "";
|
|
2831
|
-
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
2832
|
-
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
2833
|
-
// 将 base64 编码的字符串转换为二进制字符串
|
|
2834
|
-
var byteCharacters = atob(base64WithoutPrefix);
|
|
2835
|
-
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
2836
|
-
var byteArrays = [];
|
|
2837
|
-
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
2838
|
-
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
2839
|
-
var slice = byteCharacters.slice(offset, offset + 512);
|
|
2840
|
-
var byteNumbers = new Array(slice.length);
|
|
2841
|
-
for(var i = 0; i < slice.length; i++){
|
|
2842
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
2843
|
-
}
|
|
2844
|
-
var byteArray = new Uint8Array(byteNumbers);
|
|
2845
|
-
byteArrays.push(byteArray);
|
|
2846
|
-
}
|
|
2847
|
-
// 使用字节数组创建 Blob 对象
|
|
2848
|
-
var blob = new Blob(byteArrays, {
|
|
2849
|
-
type: contentType
|
|
2850
|
-
});
|
|
2851
|
-
// 创建 File 对象
|
|
2852
|
-
var file = new File([
|
|
2853
|
-
blob
|
|
2854
|
-
], filename, {
|
|
2855
|
-
type: contentType
|
|
2856
|
-
});
|
|
2857
|
-
return file;
|
|
2858
|
-
}
|
|
2859
|
-
function applyMixins(derivedCtrl, baseCtrls) {
|
|
2860
|
-
baseCtrls.forEach(function(baseCtrl) {
|
|
2861
|
-
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
2862
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
2863
|
-
if (!propertyDescriptor) {
|
|
2864
|
-
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
2865
|
-
}
|
|
2866
|
-
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
2867
|
-
});
|
|
2868
|
-
});
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
var pluginLoaderMap = {};
|
|
2872
|
-
var plugins = [];
|
|
2873
|
-
/**
|
|
2874
|
-
* 注册 plugin
|
|
2875
|
-
* @param name
|
|
2876
|
-
* @param pluginClass class of plugin
|
|
2877
|
-
* @param itemClass class of item
|
|
2878
|
-
* @param isDefault load
|
|
2879
|
-
*/ function registerPlugin(name, pluginClass) {
|
|
2880
|
-
if (pluginLoaderMap[name]) {
|
|
2881
|
-
logger.error("Duplicate registration for plugin " + name + ".");
|
|
2882
|
-
}
|
|
2883
|
-
pluginLoaderMap[name] = pluginClass;
|
|
2884
|
-
var pluginInstance = new pluginClass();
|
|
2885
|
-
pluginInstance.name = name;
|
|
2886
|
-
plugins.push(pluginInstance);
|
|
2887
|
-
plugins.sort(function(a, b) {
|
|
2888
|
-
return a.order - b.order;
|
|
2889
|
-
});
|
|
2890
|
-
}
|
|
2891
|
-
/**
|
|
2892
|
-
* 注销 plugin
|
|
2893
|
-
*/ function unregisterPlugin(name) {
|
|
2894
|
-
delete pluginLoaderMap[name];
|
|
2895
|
-
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
2896
|
-
return plugin.name === name;
|
|
2897
|
-
});
|
|
2898
|
-
if (pluginIndex !== -1) {
|
|
2899
|
-
plugins.splice(pluginIndex, 1);
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
var PluginSystem = /*#__PURE__*/ function() {
|
|
2903
|
-
function PluginSystem() {}
|
|
2904
|
-
PluginSystem.getPlugins = function getPlugins() {
|
|
2905
|
-
return plugins;
|
|
2906
|
-
};
|
|
2907
|
-
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2908
|
-
plugins.forEach(function(loader) {
|
|
2909
|
-
return loader.onCompositionCreated(composition, scene);
|
|
2910
|
-
});
|
|
2911
|
-
};
|
|
2912
|
-
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2913
|
-
plugins.forEach(function(loader) {
|
|
2914
|
-
return loader.onCompositionDestroy(comp);
|
|
2915
|
-
});
|
|
2916
|
-
};
|
|
2917
|
-
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2918
|
-
return _async_to_generator(function() {
|
|
2919
|
-
return __generator(this, function(_state) {
|
|
2920
|
-
return [
|
|
2921
|
-
2,
|
|
2922
|
-
Promise.all(plugins.map(function(plugin) {
|
|
2923
|
-
return plugin.onAssetsLoadStart(scene, options);
|
|
2924
|
-
}))
|
|
2925
|
-
];
|
|
2926
|
-
});
|
|
2927
|
-
})();
|
|
2928
|
-
};
|
|
2929
|
-
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
2930
|
-
plugins.forEach(function(loader) {
|
|
2931
|
-
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
2932
|
-
});
|
|
2933
|
-
};
|
|
2934
|
-
return PluginSystem;
|
|
2935
|
-
}();
|
|
2936
|
-
var pluginInfoMap = {
|
|
2937
|
-
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
2938
|
-
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
2939
|
-
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
2940
|
-
"ffd": "@galacean/effects-plugin-ffd",
|
|
2941
|
-
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
2942
|
-
"model": "@galacean/effects-plugin-model",
|
|
2943
|
-
"video": "@galacean/effects-plugin-multimedia",
|
|
2944
|
-
"audio": "@galacean/effects-plugin-multimedia",
|
|
2945
|
-
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
2946
|
-
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
2947
|
-
"spine": "@galacean/effects-plugin-spine"
|
|
2948
|
-
};
|
|
2949
|
-
function getPluginUsageInfo(name) {
|
|
2950
|
-
var info = pluginInfoMap[name];
|
|
2951
|
-
if (info) {
|
|
2952
|
-
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
2953
|
-
} else {
|
|
2954
|
-
return "";
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
|
|
2958
|
-
/**
|
|
2959
|
-
* 抽象插件类
|
|
2960
|
-
* 注册合成不同生命周期的回调函数
|
|
2961
|
-
*/ var Plugin = /*#__PURE__*/ function() {
|
|
2962
|
-
function Plugin() {
|
|
2963
|
-
this.order = 100;
|
|
2964
|
-
this.name = "Plugin";
|
|
2965
|
-
}
|
|
2966
|
-
var _proto = Plugin.prototype;
|
|
2967
|
-
/**
|
|
2968
|
-
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
2969
|
-
* 此阶段适合发起异步资源请求。
|
|
2970
|
-
* @param scene - 场景对象
|
|
2971
|
-
* @param options - 场景加载选项
|
|
2972
|
-
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2973
|
-
return _async_to_generator(function() {
|
|
2974
|
-
return __generator(this, function(_state) {
|
|
2975
|
-
return [
|
|
2976
|
-
2
|
|
2977
|
-
];
|
|
2978
|
-
});
|
|
2979
|
-
})();
|
|
2980
|
-
};
|
|
2981
|
-
/**
|
|
2982
|
-
* 场景资源加载完成后触发。
|
|
2983
|
-
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
2984
|
-
* @param scene - 场景对象
|
|
2985
|
-
* @param options - 场景加载选项
|
|
2986
|
-
* @param engine - 引擎实例
|
|
2987
|
-
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
2988
|
-
/**
|
|
2989
|
-
* 合成创建完成后触发。
|
|
2990
|
-
* @param composition - 合成对象
|
|
2991
|
-
* @param scene - 场景对象
|
|
2992
|
-
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
2993
|
-
/**
|
|
2994
|
-
* 合成销毁时触发。
|
|
2995
|
-
* @param composition - 合成对象
|
|
2996
|
-
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
2997
|
-
return Plugin;
|
|
2998
|
-
}();
|
|
2999
|
-
|
|
3000
|
-
function _set_prototype_of(o, p) {
|
|
3001
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
3002
|
-
o.__proto__ = p;
|
|
3003
|
-
return o;
|
|
3004
|
-
};
|
|
3005
|
-
return _set_prototype_of(o, p);
|
|
3006
|
-
}
|
|
3007
|
-
|
|
3008
|
-
function _inherits(subClass, superClass) {
|
|
3009
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
3010
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
3011
|
-
}
|
|
3012
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
3013
|
-
constructor: {
|
|
3014
|
-
value: subClass,
|
|
3015
|
-
writable: true,
|
|
3016
|
-
configurable: true
|
|
3017
|
-
}
|
|
3018
|
-
});
|
|
3019
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
2671
|
/**
|
|
3023
2672
|
* JSON 版本
|
|
3024
2673
|
*/ var JSONSceneVersion;
|
|
@@ -3766,6 +3415,17 @@ var NodeDataType;
|
|
|
3766
3415
|
MultimediaType["video"] = "video";
|
|
3767
3416
|
MultimediaType["audio"] = "audio";
|
|
3768
3417
|
})(MultimediaType || (MultimediaType = {}));
|
|
3418
|
+
var HevcVideoCodec;
|
|
3419
|
+
(function(HevcVideoCodec) {
|
|
3420
|
+
HevcVideoCodec["L30"] = "hev1.1.0.L30.B0";
|
|
3421
|
+
HevcVideoCodec["L60"] = "hev1.1.0.L60.B0";
|
|
3422
|
+
HevcVideoCodec["L63"] = "hev1.1.0.L63.B0";
|
|
3423
|
+
HevcVideoCodec["L90"] = "hev1.1.0.L90.B0";
|
|
3424
|
+
HevcVideoCodec["L93"] = "hev1.1.0.L93.B0";
|
|
3425
|
+
HevcVideoCodec["L120"] = "hev1.1.0.L120.B0";
|
|
3426
|
+
HevcVideoCodec["L150"] = "hev1.1.0.L150.B0";
|
|
3427
|
+
HevcVideoCodec["L180"] = "hev1.1.0.L180.B0";
|
|
3428
|
+
})(HevcVideoCodec || (HevcVideoCodec = {}));
|
|
3769
3429
|
|
|
3770
3430
|
var DataType;
|
|
3771
3431
|
(function(DataType) {
|
|
@@ -3971,6 +3631,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3971
3631
|
get NodeDataType () { return NodeDataType; },
|
|
3972
3632
|
get BackgroundType () { return BackgroundType; },
|
|
3973
3633
|
get MultimediaType () { return MultimediaType; },
|
|
3634
|
+
get HevcVideoCodec () { return HevcVideoCodec; },
|
|
3974
3635
|
get DataType () { return DataType; },
|
|
3975
3636
|
get GeometryType () { return GeometryType; },
|
|
3976
3637
|
get VertexFormatType () { return VertexFormatType; },
|
|
@@ -3978,6 +3639,391 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3978
3639
|
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
3979
3640
|
});
|
|
3980
3641
|
|
|
3642
|
+
/**
|
|
3643
|
+
* Check if the browser can play the given HEVC codec.
|
|
3644
|
+
* @param codec - The HEVC codec to check.
|
|
3645
|
+
* @returns True if the browser can probably or maybe play the codec, false otherwise.
|
|
3646
|
+
*/ function canPlayHevcCodec(codec) {
|
|
3647
|
+
var video = document.createElement("video");
|
|
3648
|
+
var contentType = 'video/mp4; codecs="' + codec + '"';
|
|
3649
|
+
var result = video.canPlayType(contentType);
|
|
3650
|
+
return result === "probably" || result === "maybe";
|
|
3651
|
+
}
|
|
3652
|
+
/**
|
|
3653
|
+
* Parse the given codec string into a HEVC video codec enum value.
|
|
3654
|
+
* @param codec - The codec string to parse.
|
|
3655
|
+
* @returns The corresponding HEVC video codec enum value, or undefined if the codec is invalid.
|
|
3656
|
+
*/ function parseCodec(codec) {
|
|
3657
|
+
// 传入的是完整的枚举值
|
|
3658
|
+
if (isCodecValue(codec)) {
|
|
3659
|
+
return codec;
|
|
3660
|
+
}
|
|
3661
|
+
// 传入的是枚举名称
|
|
3662
|
+
if (isCodecKey(codec)) {
|
|
3663
|
+
return HevcVideoCodec[codec];
|
|
3664
|
+
}
|
|
3665
|
+
return undefined;
|
|
3666
|
+
}
|
|
3667
|
+
function isCodecValue(codec) {
|
|
3668
|
+
return Object.keys(HevcVideoCodec).some(function(key) {
|
|
3669
|
+
return HevcVideoCodec[key] === codec;
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
function isCodecKey(codec) {
|
|
3673
|
+
return codec in HevcVideoCodec;
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3676
|
+
/**
|
|
3677
|
+
* Simple implementation of the deferred pattern.
|
|
3678
|
+
* An object that exposes a promise and functions to resolve and reject it.
|
|
3679
|
+
*/ var Deferred = function Deferred() {
|
|
3680
|
+
var _this = this;
|
|
3681
|
+
this.promise = new Promise(function(resolve, reject) {
|
|
3682
|
+
_this.resolve = resolve;
|
|
3683
|
+
_this.reject = reject;
|
|
3684
|
+
});
|
|
3685
|
+
};
|
|
3686
|
+
|
|
3687
|
+
var prefix = "[Galacean Effects]";
|
|
3688
|
+
var localLogger;
|
|
3689
|
+
function format(message) {
|
|
3690
|
+
return [
|
|
3691
|
+
"%c" + prefix,
|
|
3692
|
+
"color: #AA0100",
|
|
3693
|
+
"" + message
|
|
3694
|
+
];
|
|
3695
|
+
}
|
|
3696
|
+
function error(message) {
|
|
3697
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3698
|
+
args[_key - 1] = arguments[_key];
|
|
3699
|
+
}
|
|
3700
|
+
var _console;
|
|
3701
|
+
(_console = console).error.apply(_console, [].concat(format(message), [
|
|
3702
|
+
args
|
|
3703
|
+
]));
|
|
3704
|
+
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
3705
|
+
}
|
|
3706
|
+
/**
|
|
3707
|
+
* info 会转换成浏览器的 console.debug
|
|
3708
|
+
* @param message
|
|
3709
|
+
* @param args
|
|
3710
|
+
*/ function info(message) {
|
|
3711
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3712
|
+
args[_key - 1] = arguments[_key];
|
|
3713
|
+
}
|
|
3714
|
+
var _console;
|
|
3715
|
+
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
3716
|
+
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
3717
|
+
}
|
|
3718
|
+
function warn(message) {
|
|
3719
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3720
|
+
args[_key - 1] = arguments[_key];
|
|
3721
|
+
}
|
|
3722
|
+
var _console;
|
|
3723
|
+
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
3724
|
+
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
3725
|
+
}
|
|
3726
|
+
/**
|
|
3727
|
+
* 注册自定义埋点函数
|
|
3728
|
+
*
|
|
3729
|
+
* @param fn
|
|
3730
|
+
*/ function register(fn) {
|
|
3731
|
+
if (fn && isFunction(fn)) {
|
|
3732
|
+
localLogger = fn;
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
var logger = {
|
|
3736
|
+
error: error,
|
|
3737
|
+
info: info,
|
|
3738
|
+
warn: warn,
|
|
3739
|
+
register: register
|
|
3740
|
+
};
|
|
3741
|
+
|
|
3742
|
+
exports.DestroyOptions = void 0;
|
|
3743
|
+
(function(DestroyOptions) {
|
|
3744
|
+
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
3745
|
+
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
3746
|
+
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
3747
|
+
})(exports.DestroyOptions || (exports.DestroyOptions = {}));
|
|
3748
|
+
function noop() {}
|
|
3749
|
+
/**
|
|
3750
|
+
* 判断对象是否是`String`类型
|
|
3751
|
+
*
|
|
3752
|
+
* @static
|
|
3753
|
+
* @function isString
|
|
3754
|
+
* @param obj - 要判断的对象
|
|
3755
|
+
* @return
|
|
3756
|
+
*/ function isString(obj) {
|
|
3757
|
+
return typeof obj === "string";
|
|
3758
|
+
}
|
|
3759
|
+
/**
|
|
3760
|
+
* 判断对象是否是`Array`类型
|
|
3761
|
+
*
|
|
3762
|
+
* @static
|
|
3763
|
+
* @function isArray
|
|
3764
|
+
* @param obj - 要判断的对象
|
|
3765
|
+
* @return
|
|
3766
|
+
*/ var isArray = Array.isArray || function(obj) {
|
|
3767
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
3768
|
+
};
|
|
3769
|
+
/**
|
|
3770
|
+
* 判断对象是否是函数类型
|
|
3771
|
+
*
|
|
3772
|
+
* @static
|
|
3773
|
+
* @function isFunction
|
|
3774
|
+
* @param obj - 要判断的对象
|
|
3775
|
+
* @return
|
|
3776
|
+
*/ function isFunction(obj) {
|
|
3777
|
+
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
3778
|
+
}
|
|
3779
|
+
/**
|
|
3780
|
+
* 判断对象是否是`Object`类型
|
|
3781
|
+
*
|
|
3782
|
+
* @static
|
|
3783
|
+
* @function isObject
|
|
3784
|
+
* @param obj - 要判断的对象
|
|
3785
|
+
* @return
|
|
3786
|
+
*/ function isObject(obj) {
|
|
3787
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
3788
|
+
}
|
|
3789
|
+
/**
|
|
3790
|
+
* 判断对象是否是`Plain Object`类型
|
|
3791
|
+
*
|
|
3792
|
+
* @param obj - 要判断的对象
|
|
3793
|
+
* @returns
|
|
3794
|
+
*/ function isPlainObject(obj) {
|
|
3795
|
+
if (obj === null || typeof obj !== "object") {
|
|
3796
|
+
return false;
|
|
3797
|
+
}
|
|
3798
|
+
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
3799
|
+
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
3800
|
+
return false;
|
|
3801
|
+
}
|
|
3802
|
+
var proto = Object.getPrototypeOf(obj);
|
|
3803
|
+
if (proto === null) {
|
|
3804
|
+
return true;
|
|
3805
|
+
} // Object.create(null)
|
|
3806
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
3807
|
+
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
3808
|
+
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
3809
|
+
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
3810
|
+
}
|
|
3811
|
+
function isCanvas(canvas) {
|
|
3812
|
+
var _canvas_tagName;
|
|
3813
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
3814
|
+
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
3815
|
+
}
|
|
3816
|
+
function isPowerOfTwo(value) {
|
|
3817
|
+
return (value & value - 1) === 0 && value !== 0;
|
|
3818
|
+
}
|
|
3819
|
+
/**
|
|
3820
|
+
* 生成一个位于 min 和 max 之间的随机数
|
|
3821
|
+
* @param min
|
|
3822
|
+
* @param max
|
|
3823
|
+
* @returns
|
|
3824
|
+
*/ function randomInRange(min, max) {
|
|
3825
|
+
return min + Math.random() * (max - min);
|
|
3826
|
+
}
|
|
3827
|
+
function throwDestroyedError() {
|
|
3828
|
+
throw new Error("Destroyed item cannot be used again.");
|
|
3829
|
+
}
|
|
3830
|
+
function generateGUID() {
|
|
3831
|
+
return v4().replace(/-/g, "");
|
|
3832
|
+
}
|
|
3833
|
+
function base64ToFile(base64, filename, contentType) {
|
|
3834
|
+
if (filename === void 0) filename = "base64File";
|
|
3835
|
+
if (contentType === void 0) contentType = "";
|
|
3836
|
+
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
3837
|
+
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
3838
|
+
// 将 base64 编码的字符串转换为二进制字符串
|
|
3839
|
+
var byteCharacters = atob(base64WithoutPrefix);
|
|
3840
|
+
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
3841
|
+
var byteArrays = [];
|
|
3842
|
+
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
3843
|
+
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
3844
|
+
var slice = byteCharacters.slice(offset, offset + 512);
|
|
3845
|
+
var byteNumbers = new Array(slice.length);
|
|
3846
|
+
for(var i = 0; i < slice.length; i++){
|
|
3847
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
3848
|
+
}
|
|
3849
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
3850
|
+
byteArrays.push(byteArray);
|
|
3851
|
+
}
|
|
3852
|
+
// 使用字节数组创建 Blob 对象
|
|
3853
|
+
var blob = new Blob(byteArrays, {
|
|
3854
|
+
type: contentType
|
|
3855
|
+
});
|
|
3856
|
+
// 创建 File 对象
|
|
3857
|
+
var file = new File([
|
|
3858
|
+
blob
|
|
3859
|
+
], filename, {
|
|
3860
|
+
type: contentType
|
|
3861
|
+
});
|
|
3862
|
+
return file;
|
|
3863
|
+
}
|
|
3864
|
+
function applyMixins(derivedCtrl, baseCtrls) {
|
|
3865
|
+
baseCtrls.forEach(function(baseCtrl) {
|
|
3866
|
+
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
3867
|
+
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
3868
|
+
if (!propertyDescriptor) {
|
|
3869
|
+
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
3870
|
+
}
|
|
3871
|
+
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
3872
|
+
});
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
var pluginLoaderMap = {};
|
|
3877
|
+
var plugins = [];
|
|
3878
|
+
/**
|
|
3879
|
+
* 注册 plugin
|
|
3880
|
+
* @param name
|
|
3881
|
+
* @param pluginClass class of plugin
|
|
3882
|
+
* @param itemClass class of item
|
|
3883
|
+
* @param isDefault load
|
|
3884
|
+
*/ function registerPlugin(name, pluginClass) {
|
|
3885
|
+
if (pluginLoaderMap[name]) {
|
|
3886
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
3887
|
+
}
|
|
3888
|
+
pluginLoaderMap[name] = pluginClass;
|
|
3889
|
+
var pluginInstance = new pluginClass();
|
|
3890
|
+
pluginInstance.name = name;
|
|
3891
|
+
plugins.push(pluginInstance);
|
|
3892
|
+
plugins.sort(function(a, b) {
|
|
3893
|
+
return a.order - b.order;
|
|
3894
|
+
});
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* 注销 plugin
|
|
3898
|
+
*/ function unregisterPlugin(name) {
|
|
3899
|
+
delete pluginLoaderMap[name];
|
|
3900
|
+
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
3901
|
+
return plugin.name === name;
|
|
3902
|
+
});
|
|
3903
|
+
if (pluginIndex !== -1) {
|
|
3904
|
+
plugins.splice(pluginIndex, 1);
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
var PluginSystem = /*#__PURE__*/ function() {
|
|
3908
|
+
function PluginSystem() {}
|
|
3909
|
+
PluginSystem.getPlugins = function getPlugins() {
|
|
3910
|
+
return plugins;
|
|
3911
|
+
};
|
|
3912
|
+
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
3913
|
+
plugins.forEach(function(loader) {
|
|
3914
|
+
return loader.onCompositionCreated(composition, scene);
|
|
3915
|
+
});
|
|
3916
|
+
};
|
|
3917
|
+
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
3918
|
+
plugins.forEach(function(loader) {
|
|
3919
|
+
return loader.onCompositionDestroy(comp);
|
|
3920
|
+
});
|
|
3921
|
+
};
|
|
3922
|
+
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
3923
|
+
return _async_to_generator(function() {
|
|
3924
|
+
return __generator(this, function(_state) {
|
|
3925
|
+
return [
|
|
3926
|
+
2,
|
|
3927
|
+
Promise.all(plugins.map(function(plugin) {
|
|
3928
|
+
return plugin.onAssetsLoadStart(scene, options);
|
|
3929
|
+
}))
|
|
3930
|
+
];
|
|
3931
|
+
});
|
|
3932
|
+
})();
|
|
3933
|
+
};
|
|
3934
|
+
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
3935
|
+
plugins.forEach(function(loader) {
|
|
3936
|
+
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
3937
|
+
});
|
|
3938
|
+
};
|
|
3939
|
+
return PluginSystem;
|
|
3940
|
+
}();
|
|
3941
|
+
var pluginInfoMap = {
|
|
3942
|
+
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
3943
|
+
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
3944
|
+
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
3945
|
+
"ffd": "@galacean/effects-plugin-ffd",
|
|
3946
|
+
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
3947
|
+
"model": "@galacean/effects-plugin-model",
|
|
3948
|
+
"video": "@galacean/effects-plugin-multimedia",
|
|
3949
|
+
"audio": "@galacean/effects-plugin-multimedia",
|
|
3950
|
+
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
3951
|
+
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
3952
|
+
"spine": "@galacean/effects-plugin-spine"
|
|
3953
|
+
};
|
|
3954
|
+
function getPluginUsageInfo(name) {
|
|
3955
|
+
var info = pluginInfoMap[name];
|
|
3956
|
+
if (info) {
|
|
3957
|
+
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
3958
|
+
} else {
|
|
3959
|
+
return "";
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
/**
|
|
3964
|
+
* 抽象插件类
|
|
3965
|
+
* 注册合成不同生命周期的回调函数
|
|
3966
|
+
*/ var Plugin = /*#__PURE__*/ function() {
|
|
3967
|
+
function Plugin() {
|
|
3968
|
+
this.order = 100;
|
|
3969
|
+
this.name = "Plugin";
|
|
3970
|
+
}
|
|
3971
|
+
var _proto = Plugin.prototype;
|
|
3972
|
+
/**
|
|
3973
|
+
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
3974
|
+
* 此阶段适合发起异步资源请求。
|
|
3975
|
+
* @param scene - 场景对象
|
|
3976
|
+
* @param options - 场景加载选项
|
|
3977
|
+
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
3978
|
+
return _async_to_generator(function() {
|
|
3979
|
+
return __generator(this, function(_state) {
|
|
3980
|
+
return [
|
|
3981
|
+
2
|
|
3982
|
+
];
|
|
3983
|
+
});
|
|
3984
|
+
})();
|
|
3985
|
+
};
|
|
3986
|
+
/**
|
|
3987
|
+
* 场景资源加载完成后触发。
|
|
3988
|
+
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
3989
|
+
* @param scene - 场景对象
|
|
3990
|
+
* @param options - 场景加载选项
|
|
3991
|
+
* @param engine - 引擎实例
|
|
3992
|
+
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
3993
|
+
/**
|
|
3994
|
+
* 合成创建完成后触发。
|
|
3995
|
+
* @param composition - 合成对象
|
|
3996
|
+
* @param scene - 场景对象
|
|
3997
|
+
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
3998
|
+
/**
|
|
3999
|
+
* 合成销毁时触发。
|
|
4000
|
+
* @param composition - 合成对象
|
|
4001
|
+
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
4002
|
+
return Plugin;
|
|
4003
|
+
}();
|
|
4004
|
+
|
|
4005
|
+
function _set_prototype_of(o, p) {
|
|
4006
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
4007
|
+
o.__proto__ = p;
|
|
4008
|
+
return o;
|
|
4009
|
+
};
|
|
4010
|
+
return _set_prototype_of(o, p);
|
|
4011
|
+
}
|
|
4012
|
+
|
|
4013
|
+
function _inherits(subClass, superClass) {
|
|
4014
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
4015
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
4016
|
+
}
|
|
4017
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
4018
|
+
constructor: {
|
|
4019
|
+
value: subClass,
|
|
4020
|
+
writable: true,
|
|
4021
|
+
configurable: true
|
|
4022
|
+
}
|
|
4023
|
+
});
|
|
4024
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
4025
|
+
}
|
|
4026
|
+
|
|
3981
4027
|
function _array_like_to_array(arr, len) {
|
|
3982
4028
|
if (len == null || len > arr.length) len = arr.length;
|
|
3983
4029
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -25658,8 +25704,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25658
25704
|
var duration = this.duration;
|
|
25659
25705
|
var textureAnimation = this.textureSheetAnimation;
|
|
25660
25706
|
var _textureAnimation_loop;
|
|
25661
|
-
// TODO: Update textureAnimation spec.
|
|
25662
|
-
// @ts-expect-error
|
|
25663
25707
|
var loop = (_textureAnimation_loop = textureAnimation == null ? void 0 : textureAnimation.loop) != null ? _textureAnimation_loop : true;
|
|
25664
25708
|
if (time > duration && loop) {
|
|
25665
25709
|
time = time % duration;
|
|
@@ -29386,21 +29430,6 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29386
29430
|
this.item.transform.size.x = this.baseScaleX * scale;
|
|
29387
29431
|
}
|
|
29388
29432
|
};
|
|
29389
|
-
/**
|
|
29390
|
-
* 设置文本框高度
|
|
29391
|
-
* @param value - 文本框高度
|
|
29392
|
-
*/ _proto.setTextHeight = function setTextHeight(value) {
|
|
29393
|
-
var height = Math.max(0, Number(value) || 0);
|
|
29394
|
-
if (height === 0) {
|
|
29395
|
-
return;
|
|
29396
|
-
}
|
|
29397
|
-
var layout = this.textLayout;
|
|
29398
|
-
if (layout.height === height) {
|
|
29399
|
-
return;
|
|
29400
|
-
}
|
|
29401
|
-
layout.height = height;
|
|
29402
|
-
this.isDirty = true;
|
|
29403
|
-
};
|
|
29404
29433
|
_proto.setFontSize = function setFontSize(value) {
|
|
29405
29434
|
if (this.textStyle.fontSize === value) {
|
|
29406
29435
|
return;
|
|
@@ -31346,6 +31375,7 @@ function getStandardParticleContent(particle) {
|
|
|
31346
31375
|
}
|
|
31347
31376
|
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
31348
31377
|
if (textureSheetAnimation) {
|
|
31378
|
+
// @ts-expect-error
|
|
31349
31379
|
ret.textureSheetAnimation = {
|
|
31350
31380
|
row: textureSheetAnimation.row,
|
|
31351
31381
|
col: textureSheetAnimation.col,
|
|
@@ -31475,6 +31505,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31475
31505
|
var ret = getStandardNullContent(sprite, transform);
|
|
31476
31506
|
var texAni = sprite.textureSheetAnimation;
|
|
31477
31507
|
if (texAni) {
|
|
31508
|
+
// @ts-expect-error
|
|
31478
31509
|
ret.textureSheetAnimation = {
|
|
31479
31510
|
row: texAni.row,
|
|
31480
31511
|
col: texAni.col,
|
|
@@ -31492,7 +31523,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31492
31523
|
return ret;
|
|
31493
31524
|
}
|
|
31494
31525
|
|
|
31495
|
-
var version$1 = "2.8.0-alpha.
|
|
31526
|
+
var version$1 = "2.8.0-alpha.5";
|
|
31496
31527
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31497
31528
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31498
31529
|
var reverseParticle = false;
|
|
@@ -32141,7 +32172,7 @@ var seed = 1;
|
|
|
32141
32172
|
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
32142
32173
|
return [
|
|
32143
32174
|
4,
|
|
32144
|
-
Promise.all([
|
|
32175
|
+
Promise.all([].concat([
|
|
32145
32176
|
hookTimeInfo("processBins", function() {
|
|
32146
32177
|
return _this.processBins(bins);
|
|
32147
32178
|
}),
|
|
@@ -32151,7 +32182,11 @@ var seed = 1;
|
|
|
32151
32182
|
hookTimeInfo("processFontURL", function() {
|
|
32152
32183
|
return _this.processFontURL(fonts);
|
|
32153
32184
|
})
|
|
32154
|
-
]
|
|
32185
|
+
], _this.options.useHevcVideo ? [
|
|
32186
|
+
hookTimeInfo("processVideoURL", function() {
|
|
32187
|
+
return _this.processVideoURL(jsonScene);
|
|
32188
|
+
})
|
|
32189
|
+
] : []))
|
|
32155
32190
|
];
|
|
32156
32191
|
case 7:
|
|
32157
32192
|
_ref = _state.sent(), loadedBins = _ref[0], loadedImages = _ref[1];
|
|
@@ -32537,6 +32572,30 @@ var seed = 1;
|
|
|
32537
32572
|
});
|
|
32538
32573
|
})();
|
|
32539
32574
|
};
|
|
32575
|
+
_proto.processVideoURL = function processVideoURL(jsonScene) {
|
|
32576
|
+
return _async_to_generator(function() {
|
|
32577
|
+
return __generator(this, function(_state) {
|
|
32578
|
+
if (!(jsonScene == null ? void 0 : jsonScene.videos) || !Array.isArray(jsonScene.videos)) {
|
|
32579
|
+
return [
|
|
32580
|
+
2
|
|
32581
|
+
];
|
|
32582
|
+
}
|
|
32583
|
+
jsonScene.videos.forEach(function(video) {
|
|
32584
|
+
var hevc = video.hevc;
|
|
32585
|
+
if (!(hevc == null ? void 0 : hevc.url) || !(hevc == null ? void 0 : hevc.codec)) {
|
|
32586
|
+
return;
|
|
32587
|
+
}
|
|
32588
|
+
var codec = parseCodec(hevc.codec);
|
|
32589
|
+
if (codec && canPlayHevcCodec(codec)) {
|
|
32590
|
+
video.url = hevc.url;
|
|
32591
|
+
}
|
|
32592
|
+
});
|
|
32593
|
+
return [
|
|
32594
|
+
2
|
|
32595
|
+
];
|
|
32596
|
+
});
|
|
32597
|
+
})();
|
|
32598
|
+
};
|
|
32540
32599
|
_proto.loadJSON = function loadJSON(url) {
|
|
32541
32600
|
var _this = this;
|
|
32542
32601
|
return _async_to_generator(function() {
|
|
@@ -35193,7 +35252,7 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35193
35252
|
registerPlugin("particle", ParticleLoader);
|
|
35194
35253
|
registerPlugin("cal", CalculateLoader);
|
|
35195
35254
|
registerPlugin("interact", InteractLoader);
|
|
35196
|
-
var version = "2.8.0-alpha.
|
|
35255
|
+
var version = "2.8.0-alpha.5";
|
|
35197
35256
|
logger.info("Core version: " + version + ".");
|
|
35198
35257
|
|
|
35199
35258
|
exports.ActivationMixerPlayable = ActivationMixerPlayable;
|
|
@@ -35372,6 +35431,7 @@ exports.asserts = asserts;
|
|
|
35372
35431
|
exports.base64ToFile = base64ToFile;
|
|
35373
35432
|
exports.buildLine = buildLine;
|
|
35374
35433
|
exports.calculateTranslation = calculateTranslation;
|
|
35434
|
+
exports.canPlayHevcCodec = canPlayHevcCodec;
|
|
35375
35435
|
exports.canUseBOM = canUseBOM;
|
|
35376
35436
|
exports.canvasPool = canvasPool;
|
|
35377
35437
|
exports.closePointEps = closePointEps;
|
|
@@ -35465,6 +35525,7 @@ exports.noop = noop;
|
|
|
35465
35525
|
exports.normalizeColor = normalizeColor;
|
|
35466
35526
|
exports.numberToFix = numberToFix;
|
|
35467
35527
|
exports.oldBezierKeyFramesToNew = oldBezierKeyFramesToNew;
|
|
35528
|
+
exports.parseCodec = parseCodec;
|
|
35468
35529
|
exports.parsePercent = parsePercent$1;
|
|
35469
35530
|
exports.particleFrag = particleFrag;
|
|
35470
35531
|
exports.particleOriginTranslateMap = particleOriginTranslateMap$1;
|