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