@galacean/effects-threejs 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/index.js +435 -374
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +434 -375
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.8.0-alpha.
|
|
6
|
+
* Version: v2.8.0-alpha.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -2690,357 +2690,6 @@ function asserts(condition, msg) {
|
|
|
2690
2690
|
return /^[^\d.][\w-]*$/.test(fontFamily);
|
|
2691
2691
|
}
|
|
2692
2692
|
|
|
2693
|
-
/**
|
|
2694
|
-
* Simple implementation of the deferred pattern.
|
|
2695
|
-
* An object that exposes a promise and functions to resolve and reject it.
|
|
2696
|
-
*/ var Deferred = function Deferred() {
|
|
2697
|
-
var _this = this;
|
|
2698
|
-
this.promise = new Promise(function(resolve, reject) {
|
|
2699
|
-
_this.resolve = resolve;
|
|
2700
|
-
_this.reject = reject;
|
|
2701
|
-
});
|
|
2702
|
-
};
|
|
2703
|
-
|
|
2704
|
-
var prefix = "[Galacean Effects]";
|
|
2705
|
-
var localLogger;
|
|
2706
|
-
function format(message) {
|
|
2707
|
-
return [
|
|
2708
|
-
"%c" + prefix,
|
|
2709
|
-
"color: #AA0100",
|
|
2710
|
-
"" + message
|
|
2711
|
-
];
|
|
2712
|
-
}
|
|
2713
|
-
function error(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).error.apply(_console, [].concat(format(message), [
|
|
2719
|
-
args
|
|
2720
|
-
]));
|
|
2721
|
-
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
2722
|
-
}
|
|
2723
|
-
/**
|
|
2724
|
-
* info 会转换成浏览器的 console.debug
|
|
2725
|
-
* @param message
|
|
2726
|
-
* @param args
|
|
2727
|
-
*/ function info(message) {
|
|
2728
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2729
|
-
args[_key - 1] = arguments[_key];
|
|
2730
|
-
}
|
|
2731
|
-
var _console;
|
|
2732
|
-
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
2733
|
-
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
2734
|
-
}
|
|
2735
|
-
function warn(message) {
|
|
2736
|
-
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2737
|
-
args[_key - 1] = arguments[_key];
|
|
2738
|
-
}
|
|
2739
|
-
var _console;
|
|
2740
|
-
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
2741
|
-
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
2742
|
-
}
|
|
2743
|
-
/**
|
|
2744
|
-
* 注册自定义埋点函数
|
|
2745
|
-
*
|
|
2746
|
-
* @param fn
|
|
2747
|
-
*/ function register(fn) {
|
|
2748
|
-
if (fn && isFunction(fn)) {
|
|
2749
|
-
localLogger = fn;
|
|
2750
|
-
}
|
|
2751
|
-
}
|
|
2752
|
-
var logger = {
|
|
2753
|
-
error: error,
|
|
2754
|
-
info: info,
|
|
2755
|
-
warn: warn,
|
|
2756
|
-
register: register
|
|
2757
|
-
};
|
|
2758
|
-
|
|
2759
|
-
exports.DestroyOptions = void 0;
|
|
2760
|
-
(function(DestroyOptions) {
|
|
2761
|
-
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
2762
|
-
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
2763
|
-
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
2764
|
-
})(exports.DestroyOptions || (exports.DestroyOptions = {}));
|
|
2765
|
-
function noop() {}
|
|
2766
|
-
/**
|
|
2767
|
-
* 判断对象是否是`String`类型
|
|
2768
|
-
*
|
|
2769
|
-
* @static
|
|
2770
|
-
* @function isString
|
|
2771
|
-
* @param obj - 要判断的对象
|
|
2772
|
-
* @return
|
|
2773
|
-
*/ function isString(obj) {
|
|
2774
|
-
return typeof obj === "string";
|
|
2775
|
-
}
|
|
2776
|
-
/**
|
|
2777
|
-
* 判断对象是否是`Array`类型
|
|
2778
|
-
*
|
|
2779
|
-
* @static
|
|
2780
|
-
* @function isArray
|
|
2781
|
-
* @param obj - 要判断的对象
|
|
2782
|
-
* @return
|
|
2783
|
-
*/ var isArray = Array.isArray || function(obj) {
|
|
2784
|
-
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
2785
|
-
};
|
|
2786
|
-
/**
|
|
2787
|
-
* 判断对象是否是函数类型
|
|
2788
|
-
*
|
|
2789
|
-
* @static
|
|
2790
|
-
* @function isFunction
|
|
2791
|
-
* @param obj - 要判断的对象
|
|
2792
|
-
* @return
|
|
2793
|
-
*/ function isFunction(obj) {
|
|
2794
|
-
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
2795
|
-
}
|
|
2796
|
-
/**
|
|
2797
|
-
* 判断对象是否是`Object`类型
|
|
2798
|
-
*
|
|
2799
|
-
* @static
|
|
2800
|
-
* @function isObject
|
|
2801
|
-
* @param obj - 要判断的对象
|
|
2802
|
-
* @return
|
|
2803
|
-
*/ function isObject(obj) {
|
|
2804
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
2805
|
-
}
|
|
2806
|
-
/**
|
|
2807
|
-
* 判断对象是否是`Plain Object`类型
|
|
2808
|
-
*
|
|
2809
|
-
* @param obj - 要判断的对象
|
|
2810
|
-
* @returns
|
|
2811
|
-
*/ function isPlainObject(obj) {
|
|
2812
|
-
if (obj === null || typeof obj !== "object") {
|
|
2813
|
-
return false;
|
|
2814
|
-
}
|
|
2815
|
-
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
2816
|
-
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
2817
|
-
return false;
|
|
2818
|
-
}
|
|
2819
|
-
var proto = Object.getPrototypeOf(obj);
|
|
2820
|
-
if (proto === null) {
|
|
2821
|
-
return true;
|
|
2822
|
-
} // Object.create(null)
|
|
2823
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
2824
|
-
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
2825
|
-
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
2826
|
-
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
2827
|
-
}
|
|
2828
|
-
function isCanvas(canvas) {
|
|
2829
|
-
var _canvas_tagName;
|
|
2830
|
-
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
2831
|
-
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
2832
|
-
}
|
|
2833
|
-
function isPowerOfTwo(value) {
|
|
2834
|
-
return (value & value - 1) === 0 && value !== 0;
|
|
2835
|
-
}
|
|
2836
|
-
/**
|
|
2837
|
-
* 生成一个位于 min 和 max 之间的随机数
|
|
2838
|
-
* @param min
|
|
2839
|
-
* @param max
|
|
2840
|
-
* @returns
|
|
2841
|
-
*/ function randomInRange(min, max) {
|
|
2842
|
-
return min + Math.random() * (max - min);
|
|
2843
|
-
}
|
|
2844
|
-
function throwDestroyedError() {
|
|
2845
|
-
throw new Error("Destroyed item cannot be used again.");
|
|
2846
|
-
}
|
|
2847
|
-
function generateGUID() {
|
|
2848
|
-
return v4().replace(/-/g, "");
|
|
2849
|
-
}
|
|
2850
|
-
function base64ToFile(base64, filename, contentType) {
|
|
2851
|
-
if (filename === void 0) filename = "base64File";
|
|
2852
|
-
if (contentType === void 0) contentType = "";
|
|
2853
|
-
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
2854
|
-
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
2855
|
-
// 将 base64 编码的字符串转换为二进制字符串
|
|
2856
|
-
var byteCharacters = atob(base64WithoutPrefix);
|
|
2857
|
-
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
2858
|
-
var byteArrays = [];
|
|
2859
|
-
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
2860
|
-
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
2861
|
-
var slice = byteCharacters.slice(offset, offset + 512);
|
|
2862
|
-
var byteNumbers = new Array(slice.length);
|
|
2863
|
-
for(var i = 0; i < slice.length; i++){
|
|
2864
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
2865
|
-
}
|
|
2866
|
-
var byteArray = new Uint8Array(byteNumbers);
|
|
2867
|
-
byteArrays.push(byteArray);
|
|
2868
|
-
}
|
|
2869
|
-
// 使用字节数组创建 Blob 对象
|
|
2870
|
-
var blob = new Blob(byteArrays, {
|
|
2871
|
-
type: contentType
|
|
2872
|
-
});
|
|
2873
|
-
// 创建 File 对象
|
|
2874
|
-
var file = new File([
|
|
2875
|
-
blob
|
|
2876
|
-
], filename, {
|
|
2877
|
-
type: contentType
|
|
2878
|
-
});
|
|
2879
|
-
return file;
|
|
2880
|
-
}
|
|
2881
|
-
function applyMixins(derivedCtrl, baseCtrls) {
|
|
2882
|
-
baseCtrls.forEach(function(baseCtrl) {
|
|
2883
|
-
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
2884
|
-
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
2885
|
-
if (!propertyDescriptor) {
|
|
2886
|
-
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
2887
|
-
}
|
|
2888
|
-
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
2889
|
-
});
|
|
2890
|
-
});
|
|
2891
|
-
}
|
|
2892
|
-
|
|
2893
|
-
var pluginLoaderMap = {};
|
|
2894
|
-
var plugins = [];
|
|
2895
|
-
/**
|
|
2896
|
-
* 注册 plugin
|
|
2897
|
-
* @param name
|
|
2898
|
-
* @param pluginClass class of plugin
|
|
2899
|
-
* @param itemClass class of item
|
|
2900
|
-
* @param isDefault load
|
|
2901
|
-
*/ function registerPlugin(name, pluginClass) {
|
|
2902
|
-
if (pluginLoaderMap[name]) {
|
|
2903
|
-
logger.error("Duplicate registration for plugin " + name + ".");
|
|
2904
|
-
}
|
|
2905
|
-
pluginLoaderMap[name] = pluginClass;
|
|
2906
|
-
var pluginInstance = new pluginClass();
|
|
2907
|
-
pluginInstance.name = name;
|
|
2908
|
-
plugins.push(pluginInstance);
|
|
2909
|
-
plugins.sort(function(a, b) {
|
|
2910
|
-
return a.order - b.order;
|
|
2911
|
-
});
|
|
2912
|
-
}
|
|
2913
|
-
/**
|
|
2914
|
-
* 注销 plugin
|
|
2915
|
-
*/ function unregisterPlugin(name) {
|
|
2916
|
-
delete pluginLoaderMap[name];
|
|
2917
|
-
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
2918
|
-
return plugin.name === name;
|
|
2919
|
-
});
|
|
2920
|
-
if (pluginIndex !== -1) {
|
|
2921
|
-
plugins.splice(pluginIndex, 1);
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
|
-
var PluginSystem = /*#__PURE__*/ function() {
|
|
2925
|
-
function PluginSystem() {}
|
|
2926
|
-
PluginSystem.getPlugins = function getPlugins() {
|
|
2927
|
-
return plugins;
|
|
2928
|
-
};
|
|
2929
|
-
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2930
|
-
plugins.forEach(function(loader) {
|
|
2931
|
-
return loader.onCompositionCreated(composition, scene);
|
|
2932
|
-
});
|
|
2933
|
-
};
|
|
2934
|
-
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2935
|
-
plugins.forEach(function(loader) {
|
|
2936
|
-
return loader.onCompositionDestroy(comp);
|
|
2937
|
-
});
|
|
2938
|
-
};
|
|
2939
|
-
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2940
|
-
return _async_to_generator(function() {
|
|
2941
|
-
return __generator(this, function(_state) {
|
|
2942
|
-
return [
|
|
2943
|
-
2,
|
|
2944
|
-
Promise.all(plugins.map(function(plugin) {
|
|
2945
|
-
return plugin.onAssetsLoadStart(scene, options);
|
|
2946
|
-
}))
|
|
2947
|
-
];
|
|
2948
|
-
});
|
|
2949
|
-
})();
|
|
2950
|
-
};
|
|
2951
|
-
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
2952
|
-
plugins.forEach(function(loader) {
|
|
2953
|
-
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
2954
|
-
});
|
|
2955
|
-
};
|
|
2956
|
-
return PluginSystem;
|
|
2957
|
-
}();
|
|
2958
|
-
var pluginInfoMap = {
|
|
2959
|
-
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
2960
|
-
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
2961
|
-
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
2962
|
-
"ffd": "@galacean/effects-plugin-ffd",
|
|
2963
|
-
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
2964
|
-
"model": "@galacean/effects-plugin-model",
|
|
2965
|
-
"video": "@galacean/effects-plugin-multimedia",
|
|
2966
|
-
"audio": "@galacean/effects-plugin-multimedia",
|
|
2967
|
-
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
2968
|
-
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
2969
|
-
"spine": "@galacean/effects-plugin-spine"
|
|
2970
|
-
};
|
|
2971
|
-
function getPluginUsageInfo(name) {
|
|
2972
|
-
var info = pluginInfoMap[name];
|
|
2973
|
-
if (info) {
|
|
2974
|
-
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
2975
|
-
} else {
|
|
2976
|
-
return "";
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
|
|
2980
|
-
/**
|
|
2981
|
-
* 抽象插件类
|
|
2982
|
-
* 注册合成不同生命周期的回调函数
|
|
2983
|
-
*/ var Plugin = /*#__PURE__*/ function() {
|
|
2984
|
-
function Plugin() {
|
|
2985
|
-
this.order = 100;
|
|
2986
|
-
this.name = "Plugin";
|
|
2987
|
-
}
|
|
2988
|
-
var _proto = Plugin.prototype;
|
|
2989
|
-
/**
|
|
2990
|
-
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
2991
|
-
* 此阶段适合发起异步资源请求。
|
|
2992
|
-
* @param scene - 场景对象
|
|
2993
|
-
* @param options - 场景加载选项
|
|
2994
|
-
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
2995
|
-
return _async_to_generator(function() {
|
|
2996
|
-
return __generator(this, function(_state) {
|
|
2997
|
-
return [
|
|
2998
|
-
2
|
|
2999
|
-
];
|
|
3000
|
-
});
|
|
3001
|
-
})();
|
|
3002
|
-
};
|
|
3003
|
-
/**
|
|
3004
|
-
* 场景资源加载完成后触发。
|
|
3005
|
-
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
3006
|
-
* @param scene - 场景对象
|
|
3007
|
-
* @param options - 场景加载选项
|
|
3008
|
-
* @param engine - 引擎实例
|
|
3009
|
-
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
3010
|
-
/**
|
|
3011
|
-
* 合成创建完成后触发。
|
|
3012
|
-
* @param composition - 合成对象
|
|
3013
|
-
* @param scene - 场景对象
|
|
3014
|
-
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
3015
|
-
/**
|
|
3016
|
-
* 合成销毁时触发。
|
|
3017
|
-
* @param composition - 合成对象
|
|
3018
|
-
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
3019
|
-
return Plugin;
|
|
3020
|
-
}();
|
|
3021
|
-
|
|
3022
|
-
function _set_prototype_of(o, p) {
|
|
3023
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
3024
|
-
o.__proto__ = p;
|
|
3025
|
-
return o;
|
|
3026
|
-
};
|
|
3027
|
-
return _set_prototype_of(o, p);
|
|
3028
|
-
}
|
|
3029
|
-
|
|
3030
|
-
function _inherits(subClass, superClass) {
|
|
3031
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
3032
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
3033
|
-
}
|
|
3034
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
3035
|
-
constructor: {
|
|
3036
|
-
value: subClass,
|
|
3037
|
-
writable: true,
|
|
3038
|
-
configurable: true
|
|
3039
|
-
}
|
|
3040
|
-
});
|
|
3041
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
3042
|
-
}
|
|
3043
|
-
|
|
3044
2693
|
/**
|
|
3045
2694
|
* JSON 版本
|
|
3046
2695
|
*/ var JSONSceneVersion;
|
|
@@ -3788,6 +3437,17 @@ var NodeDataType;
|
|
|
3788
3437
|
MultimediaType["video"] = "video";
|
|
3789
3438
|
MultimediaType["audio"] = "audio";
|
|
3790
3439
|
})(MultimediaType || (MultimediaType = {}));
|
|
3440
|
+
var HevcVideoCodec;
|
|
3441
|
+
(function(HevcVideoCodec) {
|
|
3442
|
+
HevcVideoCodec["L30"] = "hev1.1.0.L30.B0";
|
|
3443
|
+
HevcVideoCodec["L60"] = "hev1.1.0.L60.B0";
|
|
3444
|
+
HevcVideoCodec["L63"] = "hev1.1.0.L63.B0";
|
|
3445
|
+
HevcVideoCodec["L90"] = "hev1.1.0.L90.B0";
|
|
3446
|
+
HevcVideoCodec["L93"] = "hev1.1.0.L93.B0";
|
|
3447
|
+
HevcVideoCodec["L120"] = "hev1.1.0.L120.B0";
|
|
3448
|
+
HevcVideoCodec["L150"] = "hev1.1.0.L150.B0";
|
|
3449
|
+
HevcVideoCodec["L180"] = "hev1.1.0.L180.B0";
|
|
3450
|
+
})(HevcVideoCodec || (HevcVideoCodec = {}));
|
|
3791
3451
|
|
|
3792
3452
|
var DataType;
|
|
3793
3453
|
(function(DataType) {
|
|
@@ -3993,6 +3653,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
3993
3653
|
get NodeDataType () { return NodeDataType; },
|
|
3994
3654
|
get BackgroundType () { return BackgroundType; },
|
|
3995
3655
|
get MultimediaType () { return MultimediaType; },
|
|
3656
|
+
get HevcVideoCodec () { return HevcVideoCodec; },
|
|
3996
3657
|
get DataType () { return DataType; },
|
|
3997
3658
|
get GeometryType () { return GeometryType; },
|
|
3998
3659
|
get VertexFormatType () { return VertexFormatType; },
|
|
@@ -4000,6 +3661,391 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4000
3661
|
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
4001
3662
|
});
|
|
4002
3663
|
|
|
3664
|
+
/**
|
|
3665
|
+
* Check if the browser can play the given HEVC codec.
|
|
3666
|
+
* @param codec - The HEVC codec to check.
|
|
3667
|
+
* @returns True if the browser can probably or maybe play the codec, false otherwise.
|
|
3668
|
+
*/ function canPlayHevcCodec(codec) {
|
|
3669
|
+
var video = document.createElement("video");
|
|
3670
|
+
var contentType = 'video/mp4; codecs="' + codec + '"';
|
|
3671
|
+
var result = video.canPlayType(contentType);
|
|
3672
|
+
return result === "probably" || result === "maybe";
|
|
3673
|
+
}
|
|
3674
|
+
/**
|
|
3675
|
+
* Parse the given codec string into a HEVC video codec enum value.
|
|
3676
|
+
* @param codec - The codec string to parse.
|
|
3677
|
+
* @returns The corresponding HEVC video codec enum value, or undefined if the codec is invalid.
|
|
3678
|
+
*/ function parseCodec(codec) {
|
|
3679
|
+
// 传入的是完整的枚举值
|
|
3680
|
+
if (isCodecValue(codec)) {
|
|
3681
|
+
return codec;
|
|
3682
|
+
}
|
|
3683
|
+
// 传入的是枚举名称
|
|
3684
|
+
if (isCodecKey(codec)) {
|
|
3685
|
+
return HevcVideoCodec[codec];
|
|
3686
|
+
}
|
|
3687
|
+
return undefined;
|
|
3688
|
+
}
|
|
3689
|
+
function isCodecValue(codec) {
|
|
3690
|
+
return Object.keys(HevcVideoCodec).some(function(key) {
|
|
3691
|
+
return HevcVideoCodec[key] === codec;
|
|
3692
|
+
});
|
|
3693
|
+
}
|
|
3694
|
+
function isCodecKey(codec) {
|
|
3695
|
+
return codec in HevcVideoCodec;
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
/**
|
|
3699
|
+
* Simple implementation of the deferred pattern.
|
|
3700
|
+
* An object that exposes a promise and functions to resolve and reject it.
|
|
3701
|
+
*/ var Deferred = function Deferred() {
|
|
3702
|
+
var _this = this;
|
|
3703
|
+
this.promise = new Promise(function(resolve, reject) {
|
|
3704
|
+
_this.resolve = resolve;
|
|
3705
|
+
_this.reject = reject;
|
|
3706
|
+
});
|
|
3707
|
+
};
|
|
3708
|
+
|
|
3709
|
+
var prefix = "[Galacean Effects]";
|
|
3710
|
+
var localLogger;
|
|
3711
|
+
function format(message) {
|
|
3712
|
+
return [
|
|
3713
|
+
"%c" + prefix,
|
|
3714
|
+
"color: #AA0100",
|
|
3715
|
+
"" + message
|
|
3716
|
+
];
|
|
3717
|
+
}
|
|
3718
|
+
function error(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).error.apply(_console, [].concat(format(message), [
|
|
3724
|
+
args
|
|
3725
|
+
]));
|
|
3726
|
+
localLogger == null ? void 0 : localLogger("error", message, args);
|
|
3727
|
+
}
|
|
3728
|
+
/**
|
|
3729
|
+
* info 会转换成浏览器的 console.debug
|
|
3730
|
+
* @param message
|
|
3731
|
+
* @param args
|
|
3732
|
+
*/ function info(message) {
|
|
3733
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3734
|
+
args[_key - 1] = arguments[_key];
|
|
3735
|
+
}
|
|
3736
|
+
var _console;
|
|
3737
|
+
(_console = console).debug.apply(_console, [].concat(format(message)));
|
|
3738
|
+
localLogger == null ? void 0 : localLogger("info", message, args);
|
|
3739
|
+
}
|
|
3740
|
+
function warn(message) {
|
|
3741
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
3742
|
+
args[_key - 1] = arguments[_key];
|
|
3743
|
+
}
|
|
3744
|
+
var _console;
|
|
3745
|
+
(_console = console).warn.apply(_console, [].concat(format(message)));
|
|
3746
|
+
localLogger == null ? void 0 : localLogger("warn", message, args);
|
|
3747
|
+
}
|
|
3748
|
+
/**
|
|
3749
|
+
* 注册自定义埋点函数
|
|
3750
|
+
*
|
|
3751
|
+
* @param fn
|
|
3752
|
+
*/ function register(fn) {
|
|
3753
|
+
if (fn && isFunction(fn)) {
|
|
3754
|
+
localLogger = fn;
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
var logger = {
|
|
3758
|
+
error: error,
|
|
3759
|
+
info: info,
|
|
3760
|
+
warn: warn,
|
|
3761
|
+
register: register
|
|
3762
|
+
};
|
|
3763
|
+
|
|
3764
|
+
exports.DestroyOptions = void 0;
|
|
3765
|
+
(function(DestroyOptions) {
|
|
3766
|
+
DestroyOptions[DestroyOptions["destroy"] = 0] = "destroy";
|
|
3767
|
+
DestroyOptions[DestroyOptions["keep"] = 1] = "keep";
|
|
3768
|
+
DestroyOptions[DestroyOptions["force"] = 0] = "force";
|
|
3769
|
+
})(exports.DestroyOptions || (exports.DestroyOptions = {}));
|
|
3770
|
+
function noop() {}
|
|
3771
|
+
/**
|
|
3772
|
+
* 判断对象是否是`String`类型
|
|
3773
|
+
*
|
|
3774
|
+
* @static
|
|
3775
|
+
* @function isString
|
|
3776
|
+
* @param obj - 要判断的对象
|
|
3777
|
+
* @return
|
|
3778
|
+
*/ function isString(obj) {
|
|
3779
|
+
return typeof obj === "string";
|
|
3780
|
+
}
|
|
3781
|
+
/**
|
|
3782
|
+
* 判断对象是否是`Array`类型
|
|
3783
|
+
*
|
|
3784
|
+
* @static
|
|
3785
|
+
* @function isArray
|
|
3786
|
+
* @param obj - 要判断的对象
|
|
3787
|
+
* @return
|
|
3788
|
+
*/ var isArray = Array.isArray || function(obj) {
|
|
3789
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
3790
|
+
};
|
|
3791
|
+
/**
|
|
3792
|
+
* 判断对象是否是函数类型
|
|
3793
|
+
*
|
|
3794
|
+
* @static
|
|
3795
|
+
* @function isFunction
|
|
3796
|
+
* @param obj - 要判断的对象
|
|
3797
|
+
* @return
|
|
3798
|
+
*/ function isFunction(obj) {
|
|
3799
|
+
return Object.prototype.toString.call(obj) === "[object Function]";
|
|
3800
|
+
}
|
|
3801
|
+
/**
|
|
3802
|
+
* 判断对象是否是`Object`类型
|
|
3803
|
+
*
|
|
3804
|
+
* @static
|
|
3805
|
+
* @function isObject
|
|
3806
|
+
* @param obj - 要判断的对象
|
|
3807
|
+
* @return
|
|
3808
|
+
*/ function isObject(obj) {
|
|
3809
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
3810
|
+
}
|
|
3811
|
+
/**
|
|
3812
|
+
* 判断对象是否是`Plain Object`类型
|
|
3813
|
+
*
|
|
3814
|
+
* @param obj - 要判断的对象
|
|
3815
|
+
* @returns
|
|
3816
|
+
*/ function isPlainObject(obj) {
|
|
3817
|
+
if (obj === null || typeof obj !== "object") {
|
|
3818
|
+
return false;
|
|
3819
|
+
}
|
|
3820
|
+
// 先排除 Array/Date/Map/Set/RegExp 等
|
|
3821
|
+
if (Object.prototype.toString.call(obj) !== "[object Object]") {
|
|
3822
|
+
return false;
|
|
3823
|
+
}
|
|
3824
|
+
var proto = Object.getPrototypeOf(obj);
|
|
3825
|
+
if (proto === null) {
|
|
3826
|
+
return true;
|
|
3827
|
+
} // Object.create(null)
|
|
3828
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
3829
|
+
var Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
|
|
3830
|
+
// 构造器需要是 Object(跨 realm 用函数源码比对)
|
|
3831
|
+
return typeof Ctor === "function" && Function.prototype.toString.call(Ctor) === Function.prototype.toString.call(Object);
|
|
3832
|
+
}
|
|
3833
|
+
function isCanvas(canvas) {
|
|
3834
|
+
var _canvas_tagName;
|
|
3835
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
3836
|
+
return typeof canvas === "object" && canvas !== null && ((_canvas_tagName = canvas.tagName) == null ? void 0 : _canvas_tagName.toUpperCase()) === "CANVAS";
|
|
3837
|
+
}
|
|
3838
|
+
function isPowerOfTwo(value) {
|
|
3839
|
+
return (value & value - 1) === 0 && value !== 0;
|
|
3840
|
+
}
|
|
3841
|
+
/**
|
|
3842
|
+
* 生成一个位于 min 和 max 之间的随机数
|
|
3843
|
+
* @param min
|
|
3844
|
+
* @param max
|
|
3845
|
+
* @returns
|
|
3846
|
+
*/ function randomInRange(min, max) {
|
|
3847
|
+
return min + Math.random() * (max - min);
|
|
3848
|
+
}
|
|
3849
|
+
function throwDestroyedError() {
|
|
3850
|
+
throw new Error("Destroyed item cannot be used again.");
|
|
3851
|
+
}
|
|
3852
|
+
function generateGUID() {
|
|
3853
|
+
return v4().replace(/-/g, "");
|
|
3854
|
+
}
|
|
3855
|
+
function base64ToFile(base64, filename, contentType) {
|
|
3856
|
+
if (filename === void 0) filename = "base64File";
|
|
3857
|
+
if (contentType === void 0) contentType = "";
|
|
3858
|
+
// 去掉 Base64 字符串的 Data URL 部分(如果存在)
|
|
3859
|
+
var base64WithoutPrefix = base64.split(",")[1] || base64;
|
|
3860
|
+
// 将 base64 编码的字符串转换为二进制字符串
|
|
3861
|
+
var byteCharacters = atob(base64WithoutPrefix);
|
|
3862
|
+
// 创建一个 8 位无符号整数值的数组,即“字节数组”
|
|
3863
|
+
var byteArrays = [];
|
|
3864
|
+
// 切割二进制字符串为多个片段,并将每个片段转换成一个字节数组
|
|
3865
|
+
for(var offset = 0; offset < byteCharacters.length; offset += 512){
|
|
3866
|
+
var slice = byteCharacters.slice(offset, offset + 512);
|
|
3867
|
+
var byteNumbers = new Array(slice.length);
|
|
3868
|
+
for(var i = 0; i < slice.length; i++){
|
|
3869
|
+
byteNumbers[i] = slice.charCodeAt(i);
|
|
3870
|
+
}
|
|
3871
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
3872
|
+
byteArrays.push(byteArray);
|
|
3873
|
+
}
|
|
3874
|
+
// 使用字节数组创建 Blob 对象
|
|
3875
|
+
var blob = new Blob(byteArrays, {
|
|
3876
|
+
type: contentType
|
|
3877
|
+
});
|
|
3878
|
+
// 创建 File 对象
|
|
3879
|
+
var file = new File([
|
|
3880
|
+
blob
|
|
3881
|
+
], filename, {
|
|
3882
|
+
type: contentType
|
|
3883
|
+
});
|
|
3884
|
+
return file;
|
|
3885
|
+
}
|
|
3886
|
+
function applyMixins(derivedCtrl, baseCtrls) {
|
|
3887
|
+
baseCtrls.forEach(function(baseCtrl) {
|
|
3888
|
+
Object.getOwnPropertyNames(baseCtrl.prototype).forEach(function(name) {
|
|
3889
|
+
var propertyDescriptor = Object.getOwnPropertyDescriptor(baseCtrl.prototype, name);
|
|
3890
|
+
if (!propertyDescriptor) {
|
|
3891
|
+
throw new Error("Cannot find property descriptor of class " + baseCtrl);
|
|
3892
|
+
}
|
|
3893
|
+
Object.defineProperty(derivedCtrl.prototype, name, propertyDescriptor);
|
|
3894
|
+
});
|
|
3895
|
+
});
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
var pluginLoaderMap = {};
|
|
3899
|
+
var plugins = [];
|
|
3900
|
+
/**
|
|
3901
|
+
* 注册 plugin
|
|
3902
|
+
* @param name
|
|
3903
|
+
* @param pluginClass class of plugin
|
|
3904
|
+
* @param itemClass class of item
|
|
3905
|
+
* @param isDefault load
|
|
3906
|
+
*/ function registerPlugin(name, pluginClass) {
|
|
3907
|
+
if (pluginLoaderMap[name]) {
|
|
3908
|
+
logger.error("Duplicate registration for plugin " + name + ".");
|
|
3909
|
+
}
|
|
3910
|
+
pluginLoaderMap[name] = pluginClass;
|
|
3911
|
+
var pluginInstance = new pluginClass();
|
|
3912
|
+
pluginInstance.name = name;
|
|
3913
|
+
plugins.push(pluginInstance);
|
|
3914
|
+
plugins.sort(function(a, b) {
|
|
3915
|
+
return a.order - b.order;
|
|
3916
|
+
});
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
3919
|
+
* 注销 plugin
|
|
3920
|
+
*/ function unregisterPlugin(name) {
|
|
3921
|
+
delete pluginLoaderMap[name];
|
|
3922
|
+
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
3923
|
+
return plugin.name === name;
|
|
3924
|
+
});
|
|
3925
|
+
if (pluginIndex !== -1) {
|
|
3926
|
+
plugins.splice(pluginIndex, 1);
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
var PluginSystem = /*#__PURE__*/ function() {
|
|
3930
|
+
function PluginSystem() {}
|
|
3931
|
+
PluginSystem.getPlugins = function getPlugins() {
|
|
3932
|
+
return plugins;
|
|
3933
|
+
};
|
|
3934
|
+
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
3935
|
+
plugins.forEach(function(loader) {
|
|
3936
|
+
return loader.onCompositionCreated(composition, scene);
|
|
3937
|
+
});
|
|
3938
|
+
};
|
|
3939
|
+
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
3940
|
+
plugins.forEach(function(loader) {
|
|
3941
|
+
return loader.onCompositionDestroy(comp);
|
|
3942
|
+
});
|
|
3943
|
+
};
|
|
3944
|
+
PluginSystem.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
3945
|
+
return _async_to_generator(function() {
|
|
3946
|
+
return __generator(this, function(_state) {
|
|
3947
|
+
return [
|
|
3948
|
+
2,
|
|
3949
|
+
Promise.all(plugins.map(function(plugin) {
|
|
3950
|
+
return plugin.onAssetsLoadStart(scene, options);
|
|
3951
|
+
}))
|
|
3952
|
+
];
|
|
3953
|
+
});
|
|
3954
|
+
})();
|
|
3955
|
+
};
|
|
3956
|
+
PluginSystem.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {
|
|
3957
|
+
plugins.forEach(function(loader) {
|
|
3958
|
+
return loader.onAssetsLoadFinish(scene, options, engine);
|
|
3959
|
+
});
|
|
3960
|
+
};
|
|
3961
|
+
return PluginSystem;
|
|
3962
|
+
}();
|
|
3963
|
+
var pluginInfoMap = {
|
|
3964
|
+
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
3965
|
+
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
3966
|
+
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
3967
|
+
"ffd": "@galacean/effects-plugin-ffd",
|
|
3968
|
+
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
3969
|
+
"model": "@galacean/effects-plugin-model",
|
|
3970
|
+
"video": "@galacean/effects-plugin-multimedia",
|
|
3971
|
+
"audio": "@galacean/effects-plugin-multimedia",
|
|
3972
|
+
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
3973
|
+
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
3974
|
+
"spine": "@galacean/effects-plugin-spine"
|
|
3975
|
+
};
|
|
3976
|
+
function getPluginUsageInfo(name) {
|
|
3977
|
+
var info = pluginInfoMap[name];
|
|
3978
|
+
if (info) {
|
|
3979
|
+
return "\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i " + info + "@latest --save\n2、导入插件(Import Plugin):import '" + info + "'";
|
|
3980
|
+
} else {
|
|
3981
|
+
return "";
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3985
|
+
/**
|
|
3986
|
+
* 抽象插件类
|
|
3987
|
+
* 注册合成不同生命周期的回调函数
|
|
3988
|
+
*/ var Plugin = /*#__PURE__*/ function() {
|
|
3989
|
+
function Plugin() {
|
|
3990
|
+
this.order = 100;
|
|
3991
|
+
this.name = "Plugin";
|
|
3992
|
+
}
|
|
3993
|
+
var _proto = Plugin.prototype;
|
|
3994
|
+
/**
|
|
3995
|
+
* 场景加载时触发,用于加载插件所需的自定义资源。
|
|
3996
|
+
* 此阶段适合发起异步资源请求。
|
|
3997
|
+
* @param scene - 场景对象
|
|
3998
|
+
* @param options - 场景加载选项
|
|
3999
|
+
*/ _proto.onAssetsLoadStart = function onAssetsLoadStart(scene, options) {
|
|
4000
|
+
return _async_to_generator(function() {
|
|
4001
|
+
return __generator(this, function(_state) {
|
|
4002
|
+
return [
|
|
4003
|
+
2
|
|
4004
|
+
];
|
|
4005
|
+
});
|
|
4006
|
+
})();
|
|
4007
|
+
};
|
|
4008
|
+
/**
|
|
4009
|
+
* 场景资源加载完成后触发。
|
|
4010
|
+
* 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
|
|
4011
|
+
* @param scene - 场景对象
|
|
4012
|
+
* @param options - 场景加载选项
|
|
4013
|
+
* @param engine - 引擎实例
|
|
4014
|
+
*/ _proto.onAssetsLoadFinish = function onAssetsLoadFinish(scene, options, engine) {};
|
|
4015
|
+
/**
|
|
4016
|
+
* 合成创建完成后触发。
|
|
4017
|
+
* @param composition - 合成对象
|
|
4018
|
+
* @param scene - 场景对象
|
|
4019
|
+
*/ _proto.onCompositionCreated = function onCompositionCreated(composition, scene) {};
|
|
4020
|
+
/**
|
|
4021
|
+
* 合成销毁时触发。
|
|
4022
|
+
* @param composition - 合成对象
|
|
4023
|
+
*/ _proto.onCompositionDestroy = function onCompositionDestroy(composition) {};
|
|
4024
|
+
return Plugin;
|
|
4025
|
+
}();
|
|
4026
|
+
|
|
4027
|
+
function _set_prototype_of(o, p) {
|
|
4028
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
4029
|
+
o.__proto__ = p;
|
|
4030
|
+
return o;
|
|
4031
|
+
};
|
|
4032
|
+
return _set_prototype_of(o, p);
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
function _inherits(subClass, superClass) {
|
|
4036
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
4037
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
4038
|
+
}
|
|
4039
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
4040
|
+
constructor: {
|
|
4041
|
+
value: subClass,
|
|
4042
|
+
writable: true,
|
|
4043
|
+
configurable: true
|
|
4044
|
+
}
|
|
4045
|
+
});
|
|
4046
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4003
4049
|
function _array_like_to_array(arr, len) {
|
|
4004
4050
|
if (len == null || len > arr.length) len = arr.length;
|
|
4005
4051
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -25680,8 +25726,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25680
25726
|
var duration = this.duration;
|
|
25681
25727
|
var textureAnimation = this.textureSheetAnimation;
|
|
25682
25728
|
var _textureAnimation_loop;
|
|
25683
|
-
// TODO: Update textureAnimation spec.
|
|
25684
|
-
// @ts-expect-error
|
|
25685
25729
|
var loop = (_textureAnimation_loop = textureAnimation == null ? void 0 : textureAnimation.loop) != null ? _textureAnimation_loop : true;
|
|
25686
25730
|
if (time > duration && loop) {
|
|
25687
25731
|
time = time % duration;
|
|
@@ -29408,21 +29452,6 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29408
29452
|
this.item.transform.size.x = this.baseScaleX * scale;
|
|
29409
29453
|
}
|
|
29410
29454
|
};
|
|
29411
|
-
/**
|
|
29412
|
-
* 设置文本框高度
|
|
29413
|
-
* @param value - 文本框高度
|
|
29414
|
-
*/ _proto.setTextHeight = function setTextHeight(value) {
|
|
29415
|
-
var height = Math.max(0, Number(value) || 0);
|
|
29416
|
-
if (height === 0) {
|
|
29417
|
-
return;
|
|
29418
|
-
}
|
|
29419
|
-
var layout = this.textLayout;
|
|
29420
|
-
if (layout.height === height) {
|
|
29421
|
-
return;
|
|
29422
|
-
}
|
|
29423
|
-
layout.height = height;
|
|
29424
|
-
this.isDirty = true;
|
|
29425
|
-
};
|
|
29426
29455
|
_proto.setFontSize = function setFontSize(value) {
|
|
29427
29456
|
if (this.textStyle.fontSize === value) {
|
|
29428
29457
|
return;
|
|
@@ -31368,6 +31397,7 @@ function getStandardParticleContent(particle) {
|
|
|
31368
31397
|
}
|
|
31369
31398
|
var textureSheetAnimation = particle.textureSheetAnimation;
|
|
31370
31399
|
if (textureSheetAnimation) {
|
|
31400
|
+
// @ts-expect-error
|
|
31371
31401
|
ret.textureSheetAnimation = {
|
|
31372
31402
|
row: textureSheetAnimation.row,
|
|
31373
31403
|
col: textureSheetAnimation.col,
|
|
@@ -31497,6 +31527,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31497
31527
|
var ret = getStandardNullContent(sprite, transform);
|
|
31498
31528
|
var texAni = sprite.textureSheetAnimation;
|
|
31499
31529
|
if (texAni) {
|
|
31530
|
+
// @ts-expect-error
|
|
31500
31531
|
ret.textureSheetAnimation = {
|
|
31501
31532
|
row: texAni.row,
|
|
31502
31533
|
col: texAni.col,
|
|
@@ -31514,7 +31545,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31514
31545
|
return ret;
|
|
31515
31546
|
}
|
|
31516
31547
|
|
|
31517
|
-
var version$2 = "2.8.0-alpha.
|
|
31548
|
+
var version$2 = "2.8.0-alpha.5";
|
|
31518
31549
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31519
31550
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31520
31551
|
var reverseParticle = false;
|
|
@@ -32163,7 +32194,7 @@ var seed$1 = 1;
|
|
|
32163
32194
|
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
32164
32195
|
return [
|
|
32165
32196
|
4,
|
|
32166
|
-
Promise.all([
|
|
32197
|
+
Promise.all([].concat([
|
|
32167
32198
|
hookTimeInfo("processBins", function() {
|
|
32168
32199
|
return _this.processBins(bins);
|
|
32169
32200
|
}),
|
|
@@ -32173,7 +32204,11 @@ var seed$1 = 1;
|
|
|
32173
32204
|
hookTimeInfo("processFontURL", function() {
|
|
32174
32205
|
return _this.processFontURL(fonts);
|
|
32175
32206
|
})
|
|
32176
|
-
]
|
|
32207
|
+
], _this.options.useHevcVideo ? [
|
|
32208
|
+
hookTimeInfo("processVideoURL", function() {
|
|
32209
|
+
return _this.processVideoURL(jsonScene);
|
|
32210
|
+
})
|
|
32211
|
+
] : []))
|
|
32177
32212
|
];
|
|
32178
32213
|
case 7:
|
|
32179
32214
|
_ref = _state.sent(), loadedBins = _ref[0], loadedImages = _ref[1];
|
|
@@ -32559,6 +32594,30 @@ var seed$1 = 1;
|
|
|
32559
32594
|
});
|
|
32560
32595
|
})();
|
|
32561
32596
|
};
|
|
32597
|
+
_proto.processVideoURL = function processVideoURL(jsonScene) {
|
|
32598
|
+
return _async_to_generator(function() {
|
|
32599
|
+
return __generator(this, function(_state) {
|
|
32600
|
+
if (!(jsonScene == null ? void 0 : jsonScene.videos) || !Array.isArray(jsonScene.videos)) {
|
|
32601
|
+
return [
|
|
32602
|
+
2
|
|
32603
|
+
];
|
|
32604
|
+
}
|
|
32605
|
+
jsonScene.videos.forEach(function(video) {
|
|
32606
|
+
var hevc = video.hevc;
|
|
32607
|
+
if (!(hevc == null ? void 0 : hevc.url) || !(hevc == null ? void 0 : hevc.codec)) {
|
|
32608
|
+
return;
|
|
32609
|
+
}
|
|
32610
|
+
var codec = parseCodec(hevc.codec);
|
|
32611
|
+
if (codec && canPlayHevcCodec(codec)) {
|
|
32612
|
+
video.url = hevc.url;
|
|
32613
|
+
}
|
|
32614
|
+
});
|
|
32615
|
+
return [
|
|
32616
|
+
2
|
|
32617
|
+
];
|
|
32618
|
+
});
|
|
32619
|
+
})();
|
|
32620
|
+
};
|
|
32562
32621
|
_proto.loadJSON = function loadJSON(url) {
|
|
32563
32622
|
var _this = this;
|
|
32564
32623
|
return _async_to_generator(function() {
|
|
@@ -35215,7 +35274,7 @@ registerPlugin("sprite", SpriteLoader);
|
|
|
35215
35274
|
registerPlugin("particle", ParticleLoader);
|
|
35216
35275
|
registerPlugin("cal", CalculateLoader);
|
|
35217
35276
|
registerPlugin("interact", InteractLoader);
|
|
35218
|
-
var version$1 = "2.8.0-alpha.
|
|
35277
|
+
var version$1 = "2.8.0-alpha.5";
|
|
35219
35278
|
logger.info("Core version: " + version$1 + ".");
|
|
35220
35279
|
|
|
35221
35280
|
var _obj;
|
|
@@ -36805,7 +36864,7 @@ applyMixins(exports.ThreeTextComponent, [
|
|
|
36805
36864
|
*/ Mesh.create = function(engine, props) {
|
|
36806
36865
|
return new ThreeMesh(engine, props);
|
|
36807
36866
|
};
|
|
36808
|
-
var version = "2.8.0-alpha.
|
|
36867
|
+
var version = "2.8.0-alpha.5";
|
|
36809
36868
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36810
36869
|
|
|
36811
36870
|
exports.ActivationMixerPlayable = ActivationMixerPlayable;
|
|
@@ -36994,6 +37053,7 @@ exports.asserts = asserts;
|
|
|
36994
37053
|
exports.base64ToFile = base64ToFile;
|
|
36995
37054
|
exports.buildLine = buildLine;
|
|
36996
37055
|
exports.calculateTranslation = calculateTranslation;
|
|
37056
|
+
exports.canPlayHevcCodec = canPlayHevcCodec;
|
|
36997
37057
|
exports.canUseBOM = canUseBOM;
|
|
36998
37058
|
exports.canvasPool = canvasPool;
|
|
36999
37059
|
exports.closePointEps = closePointEps;
|
|
@@ -37087,6 +37147,7 @@ exports.noop = noop;
|
|
|
37087
37147
|
exports.normalizeColor = normalizeColor;
|
|
37088
37148
|
exports.numberToFix = numberToFix;
|
|
37089
37149
|
exports.oldBezierKeyFramesToNew = oldBezierKeyFramesToNew;
|
|
37150
|
+
exports.parseCodec = parseCodec;
|
|
37090
37151
|
exports.parsePercent = parsePercent$1;
|
|
37091
37152
|
exports.particleFrag = particleFrag;
|
|
37092
37153
|
exports.particleOriginTranslateMap = particleOriginTranslateMap$1;
|