@galacean/effects-core 2.8.0-alpha.1 → 2.8.0-alpha.3
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/README.md +279 -135
- package/dist/asset-manager.d.ts +1 -3
- package/dist/components/effect-component.d.ts +2 -1
- package/dist/components/mesh-component.d.ts +7 -1
- package/dist/composition.d.ts +0 -14
- package/dist/index.js +1095 -1523
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1094 -1520
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-system.d.ts +12 -20
- package/dist/plugins/plugin.d.ts +8 -64
- package/dist/render/create-copy-shader.d.ts +0 -2
- package/dist/render/draw-object-pass.d.ts +5 -4
- package/dist/render/index.d.ts +1 -0
- package/dist/render/post-process-pass.d.ts +11 -30
- package/dist/render/render-frame.d.ts +9 -118
- package/dist/render/render-pass.d.ts +7 -56
- package/dist/render/render-target-pool.d.ts +22 -0
- package/dist/render/renderer.d.ts +16 -5
- package/dist/scene.d.ts +1 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.8.0-alpha.
|
|
6
|
+
* Version: v2.8.0-alpha.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -33,41 +33,6 @@ function _async_to_generator(fn) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function _array_like_to_array(arr, len) {
|
|
37
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
38
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
39
|
-
return arr2;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
43
|
-
if (!o) return;
|
|
44
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
45
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
46
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
47
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
48
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
52
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
53
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
54
|
-
// Fallback for engines without symbol support
|
|
55
|
-
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
56
|
-
if (it) o = it;
|
|
57
|
-
var i = 0;
|
|
58
|
-
return function() {
|
|
59
|
-
if (i >= o.length) return {
|
|
60
|
-
done: true
|
|
61
|
-
};
|
|
62
|
-
return {
|
|
63
|
-
done: false,
|
|
64
|
-
value: o[i++]
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
69
|
-
}
|
|
70
|
-
|
|
71
36
|
function _instanceof1(left, right) {
|
|
72
37
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
73
38
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -2900,134 +2865,68 @@ function applyMixins(derivedCtrl, baseCtrls) {
|
|
|
2900
2865
|
}
|
|
2901
2866
|
|
|
2902
2867
|
var pluginLoaderMap = {};
|
|
2903
|
-
var
|
|
2904
|
-
var pluginCtrlMap = {};
|
|
2868
|
+
var plugins = [];
|
|
2905
2869
|
/**
|
|
2906
2870
|
* 注册 plugin
|
|
2907
2871
|
* @param name
|
|
2908
2872
|
* @param pluginClass class of plugin
|
|
2909
2873
|
* @param itemClass class of item
|
|
2910
2874
|
* @param isDefault load
|
|
2911
|
-
*/ function registerPlugin(name, pluginClass
|
|
2912
|
-
if (
|
|
2875
|
+
*/ function registerPlugin(name, pluginClass) {
|
|
2876
|
+
if (pluginLoaderMap[name]) {
|
|
2913
2877
|
logger.error("Duplicate registration for plugin " + name + ".");
|
|
2914
2878
|
}
|
|
2915
|
-
pluginCtrlMap[name] = itemClass;
|
|
2916
2879
|
pluginLoaderMap[name] = pluginClass;
|
|
2917
|
-
|
|
2880
|
+
var pluginInstance = new pluginClass();
|
|
2881
|
+
pluginInstance.name = name;
|
|
2882
|
+
pluginInstance.initialize();
|
|
2883
|
+
plugins.push(pluginInstance);
|
|
2884
|
+
plugins.sort(function(a, b) {
|
|
2885
|
+
return a.order - b.order;
|
|
2886
|
+
});
|
|
2918
2887
|
}
|
|
2919
|
-
|
|
2920
|
-
|
|
2888
|
+
/**
|
|
2889
|
+
* 注销 plugin
|
|
2890
|
+
*/ function unregisterPlugin(name) {
|
|
2921
2891
|
delete pluginLoaderMap[name];
|
|
2922
|
-
|
|
2892
|
+
var pluginIndex = plugins.findIndex(function(plugin) {
|
|
2893
|
+
return plugin.name === name;
|
|
2894
|
+
});
|
|
2895
|
+
if (pluginIndex !== -1) {
|
|
2896
|
+
plugins.splice(pluginIndex, 1);
|
|
2897
|
+
}
|
|
2923
2898
|
}
|
|
2924
2899
|
var PluginSystem = /*#__PURE__*/ function() {
|
|
2925
|
-
function PluginSystem(
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
loaded.push(loader);
|
|
2932
|
-
loaders[name] = loader;
|
|
2933
|
-
}
|
|
2934
|
-
};
|
|
2935
|
-
defaultPlugins.forEach(addLoader);
|
|
2936
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(pluginNames), _step; !(_step = _iterator()).done;){
|
|
2937
|
-
var customPluginName = _step.value;
|
|
2938
|
-
if (!pluginLoaderMap[customPluginName]) {
|
|
2939
|
-
throw new Error("The plugin '" + customPluginName + "' not found." + getPluginUsageInfo(customPluginName));
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
this.plugins = Object.keys(loaders).map(function(name) {
|
|
2943
|
-
var pluginConstructor = pluginLoaderMap[name];
|
|
2944
|
-
var loader = new pluginConstructor();
|
|
2945
|
-
loader.name = name;
|
|
2946
|
-
return loader;
|
|
2947
|
-
}).sort(function(a, b) {
|
|
2948
|
-
return a.order - b.order;
|
|
2949
|
-
});
|
|
2950
|
-
}
|
|
2951
|
-
var _proto = PluginSystem.prototype;
|
|
2952
|
-
_proto.initializeComposition = function initializeComposition(composition, scene) {
|
|
2953
|
-
this.plugins.forEach(function(loader) {
|
|
2900
|
+
function PluginSystem() {}
|
|
2901
|
+
PluginSystem.getPlugins = function getPlugins() {
|
|
2902
|
+
return plugins;
|
|
2903
|
+
};
|
|
2904
|
+
PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
|
|
2905
|
+
plugins.forEach(function(loader) {
|
|
2954
2906
|
return loader.onCompositionConstructed(composition, scene);
|
|
2955
2907
|
});
|
|
2956
2908
|
};
|
|
2957
|
-
|
|
2958
|
-
|
|
2909
|
+
PluginSystem.destroyComposition = function destroyComposition(comp) {
|
|
2910
|
+
plugins.forEach(function(loader) {
|
|
2959
2911
|
return loader.onCompositionDestroyed(comp);
|
|
2960
2912
|
});
|
|
2961
2913
|
};
|
|
2962
|
-
|
|
2963
|
-
this.plugins.forEach(function(loader) {
|
|
2964
|
-
return loader.onCompositionReset(comp, renderFrame);
|
|
2965
|
-
});
|
|
2966
|
-
};
|
|
2967
|
-
_proto.processRawJSON = function processRawJSON(json, options) {
|
|
2968
|
-
var _this = this;
|
|
2969
|
-
return _async_to_generator(function() {
|
|
2970
|
-
return __generator(this, function(_state) {
|
|
2971
|
-
return [
|
|
2972
|
-
2,
|
|
2973
|
-
_this.callStatic("processRawJSON", json, options)
|
|
2974
|
-
];
|
|
2975
|
-
});
|
|
2976
|
-
})();
|
|
2977
|
-
};
|
|
2978
|
-
_proto.processAssets = function processAssets(json, options) {
|
|
2979
|
-
var _this = this;
|
|
2980
|
-
return _async_to_generator(function() {
|
|
2981
|
-
return __generator(this, function(_state) {
|
|
2982
|
-
return [
|
|
2983
|
-
2,
|
|
2984
|
-
_this.callStatic("processAssets", json, options)
|
|
2985
|
-
];
|
|
2986
|
-
});
|
|
2987
|
-
})();
|
|
2988
|
-
};
|
|
2989
|
-
_proto.precompile = function precompile(compositions, renderer) {
|
|
2990
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
|
|
2991
|
-
var plugin = _step.value;
|
|
2992
|
-
plugin.precompile(compositions, renderer);
|
|
2993
|
-
}
|
|
2994
|
-
};
|
|
2995
|
-
_proto.loadResources = function loadResources(scene, options) {
|
|
2996
|
-
var _this = this;
|
|
2914
|
+
PluginSystem.processAssets = function processAssets(scene, options) {
|
|
2997
2915
|
return _async_to_generator(function() {
|
|
2998
2916
|
return __generator(this, function(_state) {
|
|
2999
2917
|
return [
|
|
3000
2918
|
2,
|
|
3001
|
-
|
|
2919
|
+
Promise.all(plugins.map(function(plugin) {
|
|
2920
|
+
return plugin.processAssets(scene, options);
|
|
2921
|
+
}))
|
|
3002
2922
|
];
|
|
3003
2923
|
});
|
|
3004
2924
|
})();
|
|
3005
2925
|
};
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
}
|
|
3010
|
-
var _this = this;
|
|
3011
|
-
return _async_to_generator(function() {
|
|
3012
|
-
var pendings, plugins, i, plugin, ctrl, _ctrl_name, _ctrl_name1;
|
|
3013
|
-
return __generator(this, function(_state) {
|
|
3014
|
-
pendings = [];
|
|
3015
|
-
plugins = _this.plugins;
|
|
3016
|
-
for(i = 0; i < plugins.length; i++){
|
|
3017
|
-
plugin = plugins[i];
|
|
3018
|
-
ctrl = pluginLoaderMap[plugin.name];
|
|
3019
|
-
if (name in ctrl) {
|
|
3020
|
-
pendings.push(Promise.resolve((_ctrl_name1 = ctrl[name]) == null ? void 0 : (_ctrl_name = _ctrl_name1).call.apply(_ctrl_name, [].concat([
|
|
3021
|
-
ctrl
|
|
3022
|
-
], args))));
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
return [
|
|
3026
|
-
2,
|
|
3027
|
-
Promise.all(pendings)
|
|
3028
|
-
];
|
|
3029
|
-
});
|
|
3030
|
-
})();
|
|
2926
|
+
PluginSystem.loadResources = function loadResources(scene, options, engine) {
|
|
2927
|
+
plugins.forEach(function(loader) {
|
|
2928
|
+
return loader.prepareResource(scene, options, engine);
|
|
2929
|
+
});
|
|
3031
2930
|
};
|
|
3032
2931
|
return PluginSystem;
|
|
3033
2932
|
}();
|
|
@@ -3035,6 +2934,8 @@ var pluginInfoMap = {
|
|
|
3035
2934
|
"alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
|
|
3036
2935
|
"downgrade": "@galacean/effects-plugin-downgrade",
|
|
3037
2936
|
"editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
|
|
2937
|
+
"ffd": "@galacean/effects-plugin-ffd",
|
|
2938
|
+
"ktx2": "@galacean/effects-plugin-ktx2",
|
|
3038
2939
|
"model": "@galacean/effects-plugin-model",
|
|
3039
2940
|
"video": "@galacean/effects-plugin-multimedia",
|
|
3040
2941
|
"audio": "@galacean/effects-plugin-multimedia",
|
|
@@ -3060,15 +2961,33 @@ function getPluginUsageInfo(name) {
|
|
|
3060
2961
|
this.name = "";
|
|
3061
2962
|
}
|
|
3062
2963
|
var _proto = AbstractPlugin.prototype;
|
|
2964
|
+
_proto.initialize = function initialize() {};
|
|
3063
2965
|
/**
|
|
3064
|
-
*
|
|
3065
|
-
*
|
|
3066
|
-
* @param
|
|
3067
|
-
|
|
2966
|
+
* loadScene 函数调用的时候会触发此函数,
|
|
2967
|
+
* 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
|
|
2968
|
+
* @param scene
|
|
2969
|
+
* @param options
|
|
2970
|
+
* @returns
|
|
2971
|
+
*/ _proto.processAssets = function processAssets(scene, options) {
|
|
2972
|
+
return _async_to_generator(function() {
|
|
2973
|
+
return __generator(this, function(_state) {
|
|
2974
|
+
return [
|
|
2975
|
+
2
|
|
2976
|
+
];
|
|
2977
|
+
});
|
|
2978
|
+
})();
|
|
2979
|
+
};
|
|
2980
|
+
/**
|
|
2981
|
+
* loadScene 函数调用的时候会触发此函数,
|
|
2982
|
+
* 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
|
|
2983
|
+
* 如果 promise 被 reject, loadScene 函数同样会被 reject,表示场景加载失败。
|
|
2984
|
+
* 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
|
|
2985
|
+
* 此阶段晚于 processAssets
|
|
2986
|
+
* @param {Scene} scene
|
|
2987
|
+
* @param {SceneLoadOptions} options
|
|
2988
|
+
*/ _proto.prepareResource = function prepareResource(scene, options, engine) {};
|
|
3068
2989
|
_proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
|
|
3069
|
-
_proto.onCompositionReset = function onCompositionReset(composition, frame) {};
|
|
3070
2990
|
_proto.onCompositionDestroyed = function onCompositionDestroyed(composition) {};
|
|
3071
|
-
_proto.onCompositionUpdate = function onCompositionUpdate(composition, dt) {};
|
|
3072
2991
|
return AbstractPlugin;
|
|
3073
2992
|
}();
|
|
3074
2993
|
|
|
@@ -4053,6 +3972,41 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4053
3972
|
get VertexBufferSemantic () { return VertexBufferSemantic; }
|
|
4054
3973
|
});
|
|
4055
3974
|
|
|
3975
|
+
function _array_like_to_array(arr, len) {
|
|
3976
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3977
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3978
|
+
return arr2;
|
|
3979
|
+
}
|
|
3980
|
+
|
|
3981
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
3982
|
+
if (!o) return;
|
|
3983
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
3984
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3985
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3986
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3987
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
3988
|
+
}
|
|
3989
|
+
|
|
3990
|
+
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
3991
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3992
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
3993
|
+
// Fallback for engines without symbol support
|
|
3994
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3995
|
+
if (it) o = it;
|
|
3996
|
+
var i = 0;
|
|
3997
|
+
return function() {
|
|
3998
|
+
if (i >= o.length) return {
|
|
3999
|
+
done: true
|
|
4000
|
+
};
|
|
4001
|
+
return {
|
|
4002
|
+
done: false,
|
|
4003
|
+
value: o[i++]
|
|
4004
|
+
};
|
|
4005
|
+
};
|
|
4006
|
+
}
|
|
4007
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4008
|
+
}
|
|
4009
|
+
|
|
4056
4010
|
var decoratorInitialStore = new Map();
|
|
4057
4011
|
var mergedStore = new Map();
|
|
4058
4012
|
var effectsClassStore = {};
|
|
@@ -7272,13 +7226,388 @@ __decorate([
|
|
|
7272
7226
|
serialize()
|
|
7273
7227
|
], RendererComponent.prototype, "_priority", void 0);
|
|
7274
7228
|
|
|
7229
|
+
var ShaderType;
|
|
7230
|
+
(function(ShaderType) {
|
|
7231
|
+
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
7232
|
+
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
7233
|
+
})(ShaderType || (ShaderType = {}));
|
|
7234
|
+
var MaskMode;
|
|
7235
|
+
(function(MaskMode) {
|
|
7236
|
+
/**
|
|
7237
|
+
* 无
|
|
7238
|
+
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
7239
|
+
/**
|
|
7240
|
+
* 蒙版
|
|
7241
|
+
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
7242
|
+
/**
|
|
7243
|
+
* 被遮挡
|
|
7244
|
+
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
7245
|
+
/**
|
|
7246
|
+
* 被反向遮挡
|
|
7247
|
+
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
7248
|
+
})(MaskMode || (MaskMode = {}));
|
|
7249
|
+
|
|
7250
|
+
var TextureLoadAction;
|
|
7251
|
+
(function(TextureLoadAction) {
|
|
7252
|
+
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
7253
|
+
//preserve previous attachment
|
|
7254
|
+
//load = 1,
|
|
7255
|
+
//clear attachment
|
|
7256
|
+
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
7257
|
+
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
7258
|
+
var TextureSourceType;
|
|
7259
|
+
(function(TextureSourceType) {
|
|
7260
|
+
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
7261
|
+
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
7262
|
+
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
7263
|
+
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
7264
|
+
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
7265
|
+
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
7266
|
+
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
7267
|
+
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
7268
|
+
})(TextureSourceType || (TextureSourceType = {}));
|
|
7269
|
+
|
|
7270
|
+
var MaskProcessor = /*#__PURE__*/ function() {
|
|
7271
|
+
function MaskProcessor(engine) {
|
|
7272
|
+
this.engine = engine;
|
|
7273
|
+
this.alphaMaskEnabled = false;
|
|
7274
|
+
this.maskMode = MaskMode.NONE;
|
|
7275
|
+
this.maskable = null;
|
|
7276
|
+
this.stencilClearAction = {
|
|
7277
|
+
stencilAction: TextureLoadAction.clear
|
|
7278
|
+
};
|
|
7279
|
+
}
|
|
7280
|
+
var _proto = MaskProcessor.prototype;
|
|
7281
|
+
_proto.getRefValue = function getRefValue() {
|
|
7282
|
+
return 1;
|
|
7283
|
+
};
|
|
7284
|
+
_proto.setMaskOptions = function setMaskOptions(data) {
|
|
7285
|
+
var _data_isMask = data.isMask, isMask = _data_isMask === void 0 ? false : _data_isMask, _data_inverted = data.inverted, inverted = _data_inverted === void 0 ? false : _data_inverted, reference = data.reference, _data_alphaMaskEnabled = data.alphaMaskEnabled, alphaMaskEnabled = _data_alphaMaskEnabled === void 0 ? false : _data_alphaMaskEnabled;
|
|
7286
|
+
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
7287
|
+
if (isMask) {
|
|
7288
|
+
this.maskMode = MaskMode.MASK;
|
|
7289
|
+
} else {
|
|
7290
|
+
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
7291
|
+
this.maskable = this.engine.findObject(reference);
|
|
7292
|
+
}
|
|
7293
|
+
};
|
|
7294
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7295
|
+
if (this.maskable) {
|
|
7296
|
+
renderer.clear(this.stencilClearAction);
|
|
7297
|
+
this.maskable.drawStencilMask(renderer);
|
|
7298
|
+
}
|
|
7299
|
+
};
|
|
7300
|
+
return MaskProcessor;
|
|
7301
|
+
}();
|
|
7302
|
+
|
|
7303
|
+
/**
|
|
7304
|
+
* Helper class to create a WebGL Context
|
|
7305
|
+
*
|
|
7306
|
+
* @param canvas
|
|
7307
|
+
* @param glType
|
|
7308
|
+
* @param options
|
|
7309
|
+
* @returns
|
|
7310
|
+
*/ function createGLContext(canvas, glType, options) {
|
|
7311
|
+
if (glType === void 0) glType = "webgl";
|
|
7312
|
+
var context;
|
|
7313
|
+
if (glType === "webgl2") {
|
|
7314
|
+
context = canvas.getContext("webgl2", options);
|
|
7315
|
+
if (!context) {
|
|
7316
|
+
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
7317
|
+
}
|
|
7318
|
+
}
|
|
7319
|
+
if (!context || glType === "webgl") {
|
|
7320
|
+
context = canvas.getContext("webgl", options);
|
|
7321
|
+
}
|
|
7322
|
+
if (!context) {
|
|
7323
|
+
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
7324
|
+
}
|
|
7325
|
+
return context;
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7328
|
+
function gpuTimer(gl) {
|
|
7329
|
+
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
7330
|
+
if (ext) {
|
|
7331
|
+
var query = gl.createQuery();
|
|
7332
|
+
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
7333
|
+
return __generator(this, function(_state) {
|
|
7334
|
+
return [
|
|
7335
|
+
2,
|
|
7336
|
+
new Promise(function(resolve, reject) {
|
|
7337
|
+
if (query) {
|
|
7338
|
+
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
7339
|
+
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
7340
|
+
if (available && !disjoint) {
|
|
7341
|
+
// See how much time the rendering of the object took in nanoseconds.
|
|
7342
|
+
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
7343
|
+
// taken to use all significant bits of the result, not just the
|
|
7344
|
+
// least significant 32 bits.
|
|
7345
|
+
resolve(timeElapsed / 1000 / 1000);
|
|
7346
|
+
}
|
|
7347
|
+
if (available || disjoint) {
|
|
7348
|
+
// Clean up the query object.
|
|
7349
|
+
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
7350
|
+
query = null;
|
|
7351
|
+
}
|
|
7352
|
+
available !== null && query && window.setTimeout(function() {
|
|
7353
|
+
getTime().then(resolve).catch;
|
|
7354
|
+
}, 1);
|
|
7355
|
+
}
|
|
7356
|
+
})
|
|
7357
|
+
];
|
|
7358
|
+
});
|
|
7359
|
+
});
|
|
7360
|
+
if (!query) {
|
|
7361
|
+
return;
|
|
7362
|
+
}
|
|
7363
|
+
return {
|
|
7364
|
+
begin: function() {
|
|
7365
|
+
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
7366
|
+
},
|
|
7367
|
+
end: function() {
|
|
7368
|
+
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
7369
|
+
},
|
|
7370
|
+
getTime: getTime
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7373
|
+
}
|
|
7374
|
+
|
|
7375
|
+
var initErrors = [];
|
|
7376
|
+
var glContext = {};
|
|
7377
|
+
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
7378
|
+
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
7379
|
+
if (!initErrors.length) {
|
|
7380
|
+
initGLContext();
|
|
7381
|
+
}
|
|
7382
|
+
function initGLContext() {
|
|
7383
|
+
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
7384
|
+
if (typeof WebGL2RenderingContext === "function") {
|
|
7385
|
+
copy(WebGL2RenderingContext);
|
|
7386
|
+
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
7387
|
+
copy(WebGLRenderingContext);
|
|
7388
|
+
copy(WebGLRenderingContext.prototype);
|
|
7389
|
+
} else {
|
|
7390
|
+
if (canUseBOM) {
|
|
7391
|
+
initErrors.push(// iOS 16 lockdown mode
|
|
7392
|
+
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7393
|
+
} else {
|
|
7394
|
+
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
7398
|
+
// @ts-expect-error set default value
|
|
7399
|
+
glContext["HALF_FLOAT"] = 5131;
|
|
7400
|
+
}
|
|
7401
|
+
}
|
|
7402
|
+
function isWebGL2(gl) {
|
|
7403
|
+
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
7404
|
+
}
|
|
7405
|
+
function copy(target) {
|
|
7406
|
+
for(var name in target){
|
|
7407
|
+
if (/^[A-Z_]/.test(name)) {
|
|
7408
|
+
// @ts-expect-error safe to assign
|
|
7409
|
+
glContext[name] = target[name];
|
|
7410
|
+
}
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
function vertexFormatType2GLType(formatType) {
|
|
7414
|
+
switch(formatType){
|
|
7415
|
+
case VertexFormatType.Float32:
|
|
7416
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7417
|
+
case VertexFormatType.Int16:
|
|
7418
|
+
return WebGLRenderingContext["SHORT"];
|
|
7419
|
+
case VertexFormatType.Int8:
|
|
7420
|
+
return WebGLRenderingContext["BYTE"];
|
|
7421
|
+
case VertexFormatType.UInt16:
|
|
7422
|
+
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
7423
|
+
case VertexFormatType.UInt8:
|
|
7424
|
+
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
7425
|
+
default:
|
|
7426
|
+
return WebGLRenderingContext["FLOAT"];
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7429
|
+
function glType2VertexFormatType(webglType) {
|
|
7430
|
+
switch(webglType){
|
|
7431
|
+
case WebGLRenderingContext["FLOAT"]:
|
|
7432
|
+
return VertexFormatType.Float32;
|
|
7433
|
+
case WebGLRenderingContext["SHORT"]:
|
|
7434
|
+
return VertexFormatType.Int16;
|
|
7435
|
+
case WebGLRenderingContext["BYTE"]:
|
|
7436
|
+
return VertexFormatType.Int8;
|
|
7437
|
+
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
7438
|
+
return VertexFormatType.UInt16;
|
|
7439
|
+
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
7440
|
+
return VertexFormatType.UInt8;
|
|
7441
|
+
default:
|
|
7442
|
+
return VertexFormatType.Float32;
|
|
7443
|
+
}
|
|
7444
|
+
}
|
|
7445
|
+
|
|
7446
|
+
function valIfUndefined(val, def) {
|
|
7447
|
+
if (val === undefined || val === null) {
|
|
7448
|
+
return def;
|
|
7449
|
+
}
|
|
7450
|
+
return val;
|
|
7451
|
+
}
|
|
7452
|
+
function getPreMultiAlpha(blending) {
|
|
7453
|
+
switch(blending){
|
|
7454
|
+
case BlendingMode.ALPHA:
|
|
7455
|
+
return 1;
|
|
7456
|
+
case BlendingMode.ADD:
|
|
7457
|
+
return 1;
|
|
7458
|
+
case BlendingMode.SUBTRACTION:
|
|
7459
|
+
return 1;
|
|
7460
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7461
|
+
return 1;
|
|
7462
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7463
|
+
return 1;
|
|
7464
|
+
case BlendingMode.SUPERPOSITION:
|
|
7465
|
+
return 2;
|
|
7466
|
+
case BlendingMode.BRIGHTNESS:
|
|
7467
|
+
return 3;
|
|
7468
|
+
case BlendingMode.MULTIPLY:
|
|
7469
|
+
return 0;
|
|
7470
|
+
default:
|
|
7471
|
+
// 处理undefined
|
|
7472
|
+
return 1;
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
function setBlendMode(material, blendMode) {
|
|
7476
|
+
switch(blendMode){
|
|
7477
|
+
case undefined:
|
|
7478
|
+
material.blendFunction = [
|
|
7479
|
+
glContext.ONE,
|
|
7480
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7481
|
+
glContext.ONE,
|
|
7482
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7483
|
+
];
|
|
7484
|
+
break;
|
|
7485
|
+
case BlendingMode.ALPHA:
|
|
7486
|
+
material.blendFunction = [
|
|
7487
|
+
glContext.ONE,
|
|
7488
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7489
|
+
glContext.ONE,
|
|
7490
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7491
|
+
];
|
|
7492
|
+
break;
|
|
7493
|
+
case BlendingMode.ADD:
|
|
7494
|
+
material.blendFunction = [
|
|
7495
|
+
glContext.ONE,
|
|
7496
|
+
glContext.ONE,
|
|
7497
|
+
glContext.ONE,
|
|
7498
|
+
glContext.ONE
|
|
7499
|
+
];
|
|
7500
|
+
break;
|
|
7501
|
+
case BlendingMode.SUBTRACTION:
|
|
7502
|
+
material.blendFunction = [
|
|
7503
|
+
glContext.ONE,
|
|
7504
|
+
glContext.ONE,
|
|
7505
|
+
glContext.ZERO,
|
|
7506
|
+
glContext.ONE
|
|
7507
|
+
];
|
|
7508
|
+
material.blendEquation = [
|
|
7509
|
+
glContext.FUNC_REVERSE_SUBTRACT,
|
|
7510
|
+
glContext.FUNC_REVERSE_SUBTRACT
|
|
7511
|
+
];
|
|
7512
|
+
break;
|
|
7513
|
+
case BlendingMode.SUPERPOSITION:
|
|
7514
|
+
material.blendFunction = [
|
|
7515
|
+
glContext.ONE,
|
|
7516
|
+
glContext.ONE,
|
|
7517
|
+
glContext.ONE,
|
|
7518
|
+
glContext.ONE
|
|
7519
|
+
];
|
|
7520
|
+
break;
|
|
7521
|
+
case BlendingMode.MULTIPLY:
|
|
7522
|
+
material.blendFunction = [
|
|
7523
|
+
glContext.DST_COLOR,
|
|
7524
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7525
|
+
glContext.DST_COLOR,
|
|
7526
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7527
|
+
];
|
|
7528
|
+
break;
|
|
7529
|
+
case BlendingMode.BRIGHTNESS:
|
|
7530
|
+
material.blendFunction = [
|
|
7531
|
+
glContext.ONE,
|
|
7532
|
+
glContext.ONE_MINUS_SRC_ALPHA,
|
|
7533
|
+
glContext.ONE,
|
|
7534
|
+
glContext.ONE_MINUS_SRC_ALPHA
|
|
7535
|
+
];
|
|
7536
|
+
break;
|
|
7537
|
+
case BlendingMode.STRONG_LIGHT:
|
|
7538
|
+
material.blendFunction = [
|
|
7539
|
+
glContext.DST_COLOR,
|
|
7540
|
+
glContext.DST_ALPHA,
|
|
7541
|
+
glContext.ZERO,
|
|
7542
|
+
glContext.ONE
|
|
7543
|
+
];
|
|
7544
|
+
break;
|
|
7545
|
+
case BlendingMode.WEAK_LIGHT:
|
|
7546
|
+
material.blendFunction = [
|
|
7547
|
+
glContext.DST_COLOR,
|
|
7548
|
+
glContext.ZERO,
|
|
7549
|
+
glContext.ZERO,
|
|
7550
|
+
glContext.ONE
|
|
7551
|
+
];
|
|
7552
|
+
break;
|
|
7553
|
+
default:
|
|
7554
|
+
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
7555
|
+
}
|
|
7556
|
+
}
|
|
7557
|
+
function setSideMode(material, side) {
|
|
7558
|
+
if (side === SideMode.DOUBLE) {
|
|
7559
|
+
material.culling = false;
|
|
7560
|
+
} else {
|
|
7561
|
+
material.culling = true;
|
|
7562
|
+
material.frontFace = glContext.CW;
|
|
7563
|
+
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
7564
|
+
}
|
|
7565
|
+
}
|
|
7566
|
+
function setMaskMode(material, maskMode) {
|
|
7567
|
+
switch(maskMode){
|
|
7568
|
+
case undefined:
|
|
7569
|
+
material.stencilTest = false;
|
|
7570
|
+
break;
|
|
7571
|
+
case MaskMode.MASK:
|
|
7572
|
+
material.stencilTest = true;
|
|
7573
|
+
material.stencilFunc = [
|
|
7574
|
+
glContext.ALWAYS,
|
|
7575
|
+
glContext.ALWAYS
|
|
7576
|
+
];
|
|
7577
|
+
material.stencilOpZPass = [
|
|
7578
|
+
glContext.REPLACE,
|
|
7579
|
+
glContext.REPLACE
|
|
7580
|
+
];
|
|
7581
|
+
break;
|
|
7582
|
+
case MaskMode.OBSCURED:
|
|
7583
|
+
material.stencilTest = true;
|
|
7584
|
+
material.stencilFunc = [
|
|
7585
|
+
glContext.EQUAL,
|
|
7586
|
+
glContext.EQUAL
|
|
7587
|
+
];
|
|
7588
|
+
break;
|
|
7589
|
+
case MaskMode.REVERSE_OBSCURED:
|
|
7590
|
+
material.stencilTest = true;
|
|
7591
|
+
material.stencilFunc = [
|
|
7592
|
+
glContext.NOTEQUAL,
|
|
7593
|
+
glContext.NOTEQUAL
|
|
7594
|
+
];
|
|
7595
|
+
break;
|
|
7596
|
+
case MaskMode.NONE:
|
|
7597
|
+
material.stencilTest = false;
|
|
7598
|
+
break;
|
|
7599
|
+
default:
|
|
7600
|
+
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
7601
|
+
}
|
|
7602
|
+
}
|
|
7603
|
+
|
|
7275
7604
|
/**
|
|
7276
7605
|
* Mesh 组件
|
|
7277
7606
|
*/ var MeshComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
7278
7607
|
_inherits(MeshComponent, RendererComponent);
|
|
7279
|
-
function MeshComponent() {
|
|
7608
|
+
function MeshComponent(engine) {
|
|
7280
7609
|
var _this;
|
|
7281
|
-
_this = RendererComponent.
|
|
7610
|
+
_this = RendererComponent.call(this, engine) || this;
|
|
7282
7611
|
/**
|
|
7283
7612
|
* 用于点击测试的碰撞器
|
|
7284
7613
|
*/ _this.meshCollider = new MeshCollider();
|
|
@@ -7294,6 +7623,7 @@ __decorate([
|
|
|
7294
7623
|
};
|
|
7295
7624
|
}
|
|
7296
7625
|
};
|
|
7626
|
+
_this.maskManager = new MaskProcessor(engine);
|
|
7297
7627
|
return _this;
|
|
7298
7628
|
}
|
|
7299
7629
|
var _proto = MeshComponent.prototype;
|
|
@@ -7303,12 +7633,42 @@ __decorate([
|
|
|
7303
7633
|
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7304
7634
|
}
|
|
7305
7635
|
};
|
|
7636
|
+
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
7637
|
+
if (!this.isActiveAndEnabled) {
|
|
7638
|
+
return;
|
|
7639
|
+
}
|
|
7640
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
7641
|
+
var material = this.materials[i];
|
|
7642
|
+
var previousColorMask = material.colorMask;
|
|
7643
|
+
material.colorMask = false;
|
|
7644
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
7645
|
+
material.colorMask = previousColorMask;
|
|
7646
|
+
}
|
|
7647
|
+
};
|
|
7306
7648
|
_proto.getBoundingBox = function getBoundingBox() {
|
|
7307
7649
|
var worldMatrix = this.transform.getWorldMatrix();
|
|
7308
7650
|
this.meshCollider.setGeometry(this.geometry, worldMatrix);
|
|
7309
7651
|
var boundingBox = this.meshCollider.getBoundingBox();
|
|
7310
7652
|
return boundingBox;
|
|
7311
7653
|
};
|
|
7654
|
+
// TODO: Update data spec
|
|
7655
|
+
_proto.fromData = function fromData(data) {
|
|
7656
|
+
RendererComponent.prototype.fromData.call(this, data);
|
|
7657
|
+
var maskableRendererData = data;
|
|
7658
|
+
var maskOptions = maskableRendererData.mask;
|
|
7659
|
+
if (maskOptions) {
|
|
7660
|
+
this.maskManager.setMaskOptions(maskOptions);
|
|
7661
|
+
}
|
|
7662
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.materials), _step; !(_step = _iterator()).done;){
|
|
7663
|
+
var material = _step.value;
|
|
7664
|
+
var stencilRef = this.maskManager.getRefValue();
|
|
7665
|
+
material.stencilRef = [
|
|
7666
|
+
stencilRef,
|
|
7667
|
+
stencilRef
|
|
7668
|
+
];
|
|
7669
|
+
setMaskMode(material, this.maskManager.maskMode);
|
|
7670
|
+
}
|
|
7671
|
+
};
|
|
7312
7672
|
return MeshComponent;
|
|
7313
7673
|
}(RendererComponent);
|
|
7314
7674
|
__decorate([
|
|
@@ -8498,348 +8858,6 @@ Matrix4.tempVec1 = new Vector3();
|
|
|
8498
8858
|
Matrix4.tempVec2 = new Vector3();
|
|
8499
8859
|
Matrix4.tempMat0 = new Matrix4();
|
|
8500
8860
|
|
|
8501
|
-
/**
|
|
8502
|
-
* Helper class to create a WebGL Context
|
|
8503
|
-
*
|
|
8504
|
-
* @param canvas
|
|
8505
|
-
* @param glType
|
|
8506
|
-
* @param options
|
|
8507
|
-
* @returns
|
|
8508
|
-
*/ function createGLContext(canvas, glType, options) {
|
|
8509
|
-
if (glType === void 0) glType = "webgl";
|
|
8510
|
-
var context;
|
|
8511
|
-
if (glType === "webgl2") {
|
|
8512
|
-
context = canvas.getContext("webgl2", options);
|
|
8513
|
-
if (!context) {
|
|
8514
|
-
console.debug("WebGL2 context retrieval failed, falling back to WebGL context.");
|
|
8515
|
-
}
|
|
8516
|
-
}
|
|
8517
|
-
if (!context || glType === "webgl") {
|
|
8518
|
-
context = canvas.getContext("webgl", options);
|
|
8519
|
-
}
|
|
8520
|
-
if (!context) {
|
|
8521
|
-
throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");
|
|
8522
|
-
}
|
|
8523
|
-
return context;
|
|
8524
|
-
}
|
|
8525
|
-
|
|
8526
|
-
function gpuTimer(gl) {
|
|
8527
|
-
var ext = gl.getExtension("EXT_disjoint_timer_query_webgl2");
|
|
8528
|
-
if (ext) {
|
|
8529
|
-
var query = gl.createQuery();
|
|
8530
|
-
var getTime = /*#__PURE__*/ _async_to_generator(function() {
|
|
8531
|
-
return __generator(this, function(_state) {
|
|
8532
|
-
return [
|
|
8533
|
-
2,
|
|
8534
|
-
new Promise(function(resolve, reject) {
|
|
8535
|
-
if (query) {
|
|
8536
|
-
var available = gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE);
|
|
8537
|
-
var disjoint = gl.getParameter(ext.GPU_DISJOINT_EXT);
|
|
8538
|
-
if (available && !disjoint) {
|
|
8539
|
-
// See how much time the rendering of the object took in nanoseconds.
|
|
8540
|
-
var timeElapsed = gl.getQueryParameter(query, gl.QUERY_RESULT); // Do something useful with the time. Note that care should be
|
|
8541
|
-
// taken to use all significant bits of the result, not just the
|
|
8542
|
-
// least significant 32 bits.
|
|
8543
|
-
resolve(timeElapsed / 1000 / 1000);
|
|
8544
|
-
}
|
|
8545
|
-
if (available || disjoint) {
|
|
8546
|
-
// Clean up the query object.
|
|
8547
|
-
gl.deleteQuery(query); // Don't re-enter this polling loop.
|
|
8548
|
-
query = null;
|
|
8549
|
-
}
|
|
8550
|
-
available !== null && query && window.setTimeout(function() {
|
|
8551
|
-
getTime().then(resolve).catch;
|
|
8552
|
-
}, 1);
|
|
8553
|
-
}
|
|
8554
|
-
})
|
|
8555
|
-
];
|
|
8556
|
-
});
|
|
8557
|
-
});
|
|
8558
|
-
if (!query) {
|
|
8559
|
-
return;
|
|
8560
|
-
}
|
|
8561
|
-
return {
|
|
8562
|
-
begin: function() {
|
|
8563
|
-
query && gl.beginQuery(ext.TIME_ELAPSED_EXT, query);
|
|
8564
|
-
},
|
|
8565
|
-
end: function() {
|
|
8566
|
-
gl.endQuery(ext.TIME_ELAPSED_EXT);
|
|
8567
|
-
},
|
|
8568
|
-
getTime: getTime
|
|
8569
|
-
};
|
|
8570
|
-
}
|
|
8571
|
-
}
|
|
8572
|
-
|
|
8573
|
-
var initErrors = [];
|
|
8574
|
-
var glContext = {};
|
|
8575
|
-
var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
|
|
8576
|
-
var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
|
|
8577
|
-
if (!initErrors.length) {
|
|
8578
|
-
initGLContext();
|
|
8579
|
-
}
|
|
8580
|
-
function initGLContext() {
|
|
8581
|
-
// 重要:iOS 9/10 低版本需要拷贝 gl context 的 prototype,要不然会有属性值的缺失
|
|
8582
|
-
if (typeof WebGL2RenderingContext === "function") {
|
|
8583
|
-
copy(WebGL2RenderingContext);
|
|
8584
|
-
} else if (typeof WebGLRenderingContext !== "undefined") {
|
|
8585
|
-
copy(WebGLRenderingContext);
|
|
8586
|
-
copy(WebGLRenderingContext.prototype);
|
|
8587
|
-
} else {
|
|
8588
|
-
if (canUseBOM) {
|
|
8589
|
-
initErrors.push(// iOS 16 lockdown mode
|
|
8590
|
-
isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8591
|
-
} else {
|
|
8592
|
-
initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
|
|
8593
|
-
}
|
|
8594
|
-
}
|
|
8595
|
-
if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
|
|
8596
|
-
// @ts-expect-error set default value
|
|
8597
|
-
glContext["HALF_FLOAT"] = 5131;
|
|
8598
|
-
}
|
|
8599
|
-
}
|
|
8600
|
-
function isWebGL2(gl) {
|
|
8601
|
-
return typeof WebGL2RenderingContext !== "undefined" && gl.constructor.name === "WebGL2RenderingContext";
|
|
8602
|
-
}
|
|
8603
|
-
function copy(target) {
|
|
8604
|
-
for(var name in target){
|
|
8605
|
-
if (/^[A-Z_]/.test(name)) {
|
|
8606
|
-
// @ts-expect-error safe to assign
|
|
8607
|
-
glContext[name] = target[name];
|
|
8608
|
-
}
|
|
8609
|
-
}
|
|
8610
|
-
}
|
|
8611
|
-
function vertexFormatType2GLType(formatType) {
|
|
8612
|
-
switch(formatType){
|
|
8613
|
-
case VertexFormatType.Float32:
|
|
8614
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8615
|
-
case VertexFormatType.Int16:
|
|
8616
|
-
return WebGLRenderingContext["SHORT"];
|
|
8617
|
-
case VertexFormatType.Int8:
|
|
8618
|
-
return WebGLRenderingContext["BYTE"];
|
|
8619
|
-
case VertexFormatType.UInt16:
|
|
8620
|
-
return WebGLRenderingContext["UNSIGNED_SHORT"];
|
|
8621
|
-
case VertexFormatType.UInt8:
|
|
8622
|
-
return WebGLRenderingContext["UNSIGNED_BYTE"];
|
|
8623
|
-
default:
|
|
8624
|
-
return WebGLRenderingContext["FLOAT"];
|
|
8625
|
-
}
|
|
8626
|
-
}
|
|
8627
|
-
function glType2VertexFormatType(webglType) {
|
|
8628
|
-
switch(webglType){
|
|
8629
|
-
case WebGLRenderingContext["FLOAT"]:
|
|
8630
|
-
return VertexFormatType.Float32;
|
|
8631
|
-
case WebGLRenderingContext["SHORT"]:
|
|
8632
|
-
return VertexFormatType.Int16;
|
|
8633
|
-
case WebGLRenderingContext["BYTE"]:
|
|
8634
|
-
return VertexFormatType.Int8;
|
|
8635
|
-
case WebGLRenderingContext["UNSIGNED_SHORT"]:
|
|
8636
|
-
return VertexFormatType.UInt16;
|
|
8637
|
-
case WebGLRenderingContext["UNSIGNED_BYTE"]:
|
|
8638
|
-
return VertexFormatType.UInt8;
|
|
8639
|
-
default:
|
|
8640
|
-
return VertexFormatType.Float32;
|
|
8641
|
-
}
|
|
8642
|
-
}
|
|
8643
|
-
|
|
8644
|
-
var ShaderType;
|
|
8645
|
-
(function(ShaderType) {
|
|
8646
|
-
ShaderType[ShaderType["vertex"] = 0] = "vertex";
|
|
8647
|
-
ShaderType[ShaderType["fragment"] = 1] = "fragment";
|
|
8648
|
-
})(ShaderType || (ShaderType = {}));
|
|
8649
|
-
var MaskMode;
|
|
8650
|
-
(function(MaskMode) {
|
|
8651
|
-
/**
|
|
8652
|
-
* 无
|
|
8653
|
-
*/ MaskMode[MaskMode["NONE"] = 0] = "NONE";
|
|
8654
|
-
/**
|
|
8655
|
-
* 蒙版
|
|
8656
|
-
*/ MaskMode[MaskMode["MASK"] = 1] = "MASK";
|
|
8657
|
-
/**
|
|
8658
|
-
* 被遮挡
|
|
8659
|
-
*/ MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
|
|
8660
|
-
/**
|
|
8661
|
-
* 被反向遮挡
|
|
8662
|
-
*/ MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
8663
|
-
})(MaskMode || (MaskMode = {}));
|
|
8664
|
-
|
|
8665
|
-
function valIfUndefined(val, def) {
|
|
8666
|
-
if (val === undefined || val === null) {
|
|
8667
|
-
return def;
|
|
8668
|
-
}
|
|
8669
|
-
return val;
|
|
8670
|
-
}
|
|
8671
|
-
function getPreMultiAlpha(blending) {
|
|
8672
|
-
switch(blending){
|
|
8673
|
-
case BlendingMode.ALPHA:
|
|
8674
|
-
return 1;
|
|
8675
|
-
case BlendingMode.ADD:
|
|
8676
|
-
return 1;
|
|
8677
|
-
case BlendingMode.SUBTRACTION:
|
|
8678
|
-
return 1;
|
|
8679
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8680
|
-
return 1;
|
|
8681
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8682
|
-
return 1;
|
|
8683
|
-
case BlendingMode.SUPERPOSITION:
|
|
8684
|
-
return 2;
|
|
8685
|
-
case BlendingMode.BRIGHTNESS:
|
|
8686
|
-
return 3;
|
|
8687
|
-
case BlendingMode.MULTIPLY:
|
|
8688
|
-
return 0;
|
|
8689
|
-
default:
|
|
8690
|
-
// 处理undefined
|
|
8691
|
-
return 1;
|
|
8692
|
-
}
|
|
8693
|
-
}
|
|
8694
|
-
function setBlendMode(material, blendMode) {
|
|
8695
|
-
switch(blendMode){
|
|
8696
|
-
case undefined:
|
|
8697
|
-
material.blendFunction = [
|
|
8698
|
-
glContext.ONE,
|
|
8699
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8700
|
-
glContext.ONE,
|
|
8701
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8702
|
-
];
|
|
8703
|
-
break;
|
|
8704
|
-
case BlendingMode.ALPHA:
|
|
8705
|
-
material.blendFunction = [
|
|
8706
|
-
glContext.ONE,
|
|
8707
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8708
|
-
glContext.ONE,
|
|
8709
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8710
|
-
];
|
|
8711
|
-
break;
|
|
8712
|
-
case BlendingMode.ADD:
|
|
8713
|
-
material.blendFunction = [
|
|
8714
|
-
glContext.ONE,
|
|
8715
|
-
glContext.ONE,
|
|
8716
|
-
glContext.ONE,
|
|
8717
|
-
glContext.ONE
|
|
8718
|
-
];
|
|
8719
|
-
break;
|
|
8720
|
-
case BlendingMode.SUBTRACTION:
|
|
8721
|
-
material.blendFunction = [
|
|
8722
|
-
glContext.ONE,
|
|
8723
|
-
glContext.ONE,
|
|
8724
|
-
glContext.ZERO,
|
|
8725
|
-
glContext.ONE
|
|
8726
|
-
];
|
|
8727
|
-
material.blendEquation = [
|
|
8728
|
-
glContext.FUNC_REVERSE_SUBTRACT,
|
|
8729
|
-
glContext.FUNC_REVERSE_SUBTRACT
|
|
8730
|
-
];
|
|
8731
|
-
break;
|
|
8732
|
-
case BlendingMode.SUPERPOSITION:
|
|
8733
|
-
material.blendFunction = [
|
|
8734
|
-
glContext.ONE,
|
|
8735
|
-
glContext.ONE,
|
|
8736
|
-
glContext.ONE,
|
|
8737
|
-
glContext.ONE
|
|
8738
|
-
];
|
|
8739
|
-
break;
|
|
8740
|
-
case BlendingMode.MULTIPLY:
|
|
8741
|
-
material.blendFunction = [
|
|
8742
|
-
glContext.DST_COLOR,
|
|
8743
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8744
|
-
glContext.DST_COLOR,
|
|
8745
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8746
|
-
];
|
|
8747
|
-
break;
|
|
8748
|
-
case BlendingMode.BRIGHTNESS:
|
|
8749
|
-
material.blendFunction = [
|
|
8750
|
-
glContext.ONE,
|
|
8751
|
-
glContext.ONE_MINUS_SRC_ALPHA,
|
|
8752
|
-
glContext.ONE,
|
|
8753
|
-
glContext.ONE_MINUS_SRC_ALPHA
|
|
8754
|
-
];
|
|
8755
|
-
break;
|
|
8756
|
-
case BlendingMode.STRONG_LIGHT:
|
|
8757
|
-
material.blendFunction = [
|
|
8758
|
-
glContext.DST_COLOR,
|
|
8759
|
-
glContext.DST_ALPHA,
|
|
8760
|
-
glContext.ZERO,
|
|
8761
|
-
glContext.ONE
|
|
8762
|
-
];
|
|
8763
|
-
break;
|
|
8764
|
-
case BlendingMode.WEAK_LIGHT:
|
|
8765
|
-
material.blendFunction = [
|
|
8766
|
-
glContext.DST_COLOR,
|
|
8767
|
-
glContext.ZERO,
|
|
8768
|
-
glContext.ZERO,
|
|
8769
|
-
glContext.ONE
|
|
8770
|
-
];
|
|
8771
|
-
break;
|
|
8772
|
-
default:
|
|
8773
|
-
console.warn("BlendMode " + blendMode + " not in specification, please set blend params separately.");
|
|
8774
|
-
}
|
|
8775
|
-
}
|
|
8776
|
-
function setSideMode(material, side) {
|
|
8777
|
-
if (side === SideMode.DOUBLE) {
|
|
8778
|
-
material.culling = false;
|
|
8779
|
-
} else {
|
|
8780
|
-
material.culling = true;
|
|
8781
|
-
material.frontFace = glContext.CW;
|
|
8782
|
-
material.cullFace = side === SideMode.BACK ? glContext.BACK : glContext.FRONT;
|
|
8783
|
-
}
|
|
8784
|
-
}
|
|
8785
|
-
function setMaskMode(material, maskMode) {
|
|
8786
|
-
switch(maskMode){
|
|
8787
|
-
case undefined:
|
|
8788
|
-
material.stencilTest = false;
|
|
8789
|
-
break;
|
|
8790
|
-
case MaskMode.MASK:
|
|
8791
|
-
material.stencilTest = true;
|
|
8792
|
-
material.stencilFunc = [
|
|
8793
|
-
glContext.ALWAYS,
|
|
8794
|
-
glContext.ALWAYS
|
|
8795
|
-
];
|
|
8796
|
-
material.stencilOpZPass = [
|
|
8797
|
-
glContext.REPLACE,
|
|
8798
|
-
glContext.REPLACE
|
|
8799
|
-
];
|
|
8800
|
-
break;
|
|
8801
|
-
case MaskMode.OBSCURED:
|
|
8802
|
-
material.stencilTest = true;
|
|
8803
|
-
material.stencilFunc = [
|
|
8804
|
-
glContext.EQUAL,
|
|
8805
|
-
glContext.EQUAL
|
|
8806
|
-
];
|
|
8807
|
-
break;
|
|
8808
|
-
case MaskMode.REVERSE_OBSCURED:
|
|
8809
|
-
material.stencilTest = true;
|
|
8810
|
-
material.stencilFunc = [
|
|
8811
|
-
glContext.NOTEQUAL,
|
|
8812
|
-
glContext.NOTEQUAL
|
|
8813
|
-
];
|
|
8814
|
-
break;
|
|
8815
|
-
case MaskMode.NONE:
|
|
8816
|
-
material.stencilTest = false;
|
|
8817
|
-
break;
|
|
8818
|
-
default:
|
|
8819
|
-
console.warn("MaskMode " + maskMode + " not in specification, please set stencil params seperately.");
|
|
8820
|
-
}
|
|
8821
|
-
}
|
|
8822
|
-
|
|
8823
|
-
var TextureLoadAction;
|
|
8824
|
-
(function(TextureLoadAction) {
|
|
8825
|
-
TextureLoadAction[TextureLoadAction["whatever"] = 0] = "whatever";
|
|
8826
|
-
//preserve previous attachment
|
|
8827
|
-
//load = 1,
|
|
8828
|
-
//clear attachment
|
|
8829
|
-
TextureLoadAction[TextureLoadAction["clear"] = 2] = "clear";
|
|
8830
|
-
})(TextureLoadAction || (TextureLoadAction = {}));
|
|
8831
|
-
var TextureSourceType;
|
|
8832
|
-
(function(TextureSourceType) {
|
|
8833
|
-
TextureSourceType[TextureSourceType["none"] = 0] = "none";
|
|
8834
|
-
TextureSourceType[TextureSourceType["data"] = 1] = "data";
|
|
8835
|
-
TextureSourceType[TextureSourceType["image"] = 2] = "image";
|
|
8836
|
-
TextureSourceType[TextureSourceType["compressed"] = 3] = "compressed";
|
|
8837
|
-
TextureSourceType[TextureSourceType["video"] = 4] = "video";
|
|
8838
|
-
TextureSourceType[TextureSourceType["canvas"] = 5] = "canvas";
|
|
8839
|
-
TextureSourceType[TextureSourceType["framebuffer"] = 6] = "framebuffer";
|
|
8840
|
-
TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
|
|
8841
|
-
})(TextureSourceType || (TextureSourceType = {}));
|
|
8842
|
-
|
|
8843
8861
|
/**
|
|
8844
8862
|
* 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
|
|
8845
8863
|
*/ var Downloader = /*#__PURE__*/ function() {
|
|
@@ -10318,208 +10336,72 @@ var MaterialRenderType;
|
|
|
10318
10336
|
return Material;
|
|
10319
10337
|
}(EffectsObject);
|
|
10320
10338
|
|
|
10321
|
-
var
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10339
|
+
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10340
|
+
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10341
|
+
var COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
10342
|
+
var COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
|
|
10343
|
+
|
|
10344
|
+
var FilterMode;
|
|
10345
|
+
(function(FilterMode) {
|
|
10346
|
+
FilterMode[FilterMode["Nearest"] = 0] = "Nearest";
|
|
10347
|
+
FilterMode[FilterMode["Linear"] = 1] = "Linear";
|
|
10348
|
+
})(FilterMode || (FilterMode = {}));
|
|
10349
|
+
var RenderTextureFormat;
|
|
10350
|
+
(function(RenderTextureFormat) {
|
|
10351
|
+
RenderTextureFormat[RenderTextureFormat["RGBA32"] = 0] = "RGBA32";
|
|
10352
|
+
RenderTextureFormat[RenderTextureFormat["RGBAHalf"] = 1] = "RGBAHalf";
|
|
10353
|
+
})(RenderTextureFormat || (RenderTextureFormat = {}));
|
|
10354
|
+
/**
|
|
10355
|
+
*
|
|
10356
|
+
*/ var Framebuffer = /*#__PURE__*/ function() {
|
|
10357
|
+
function Framebuffer() {}
|
|
10358
|
+
var _proto = Framebuffer.prototype;
|
|
10359
|
+
_proto.resize = function resize(x, y, width, height) {
|
|
10360
|
+
// OVERRIDE
|
|
10334
10361
|
};
|
|
10335
|
-
_proto.
|
|
10336
|
-
|
|
10337
|
-
this.alphaMaskEnabled = alphaMaskEnabled;
|
|
10338
|
-
if (isMask) {
|
|
10339
|
-
this.maskMode = MaskMode.MASK;
|
|
10340
|
-
} else {
|
|
10341
|
-
this.maskMode = inverted ? MaskMode.REVERSE_OBSCURED : MaskMode.OBSCURED;
|
|
10342
|
-
this.maskable = this.engine.findObject(reference);
|
|
10343
|
-
}
|
|
10362
|
+
_proto.resetColorTextures = function resetColorTextures(textures) {
|
|
10363
|
+
// OVERRIDE
|
|
10344
10364
|
};
|
|
10345
|
-
_proto.
|
|
10346
|
-
|
|
10347
|
-
renderer.clear(this.stencilClearAction);
|
|
10348
|
-
this.maskable.drawStencilMask(renderer);
|
|
10349
|
-
}
|
|
10365
|
+
_proto.unbind = function unbind() {
|
|
10366
|
+
// OVERRIDE
|
|
10350
10367
|
};
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
var ShaderCompileResultStatus;
|
|
10355
|
-
(function(ShaderCompileResultStatus) {
|
|
10356
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["noShader"] = 0] = "noShader";
|
|
10357
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["success"] = 1] = "success";
|
|
10358
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["fail"] = 2] = "fail";
|
|
10359
|
-
ShaderCompileResultStatus[ShaderCompileResultStatus["compiling"] = 3] = "compiling";
|
|
10360
|
-
})(ShaderCompileResultStatus || (ShaderCompileResultStatus = {}));
|
|
10361
|
-
var GLSLVersion;
|
|
10362
|
-
(function(GLSLVersion) {
|
|
10363
|
-
GLSLVersion["GLSL1"] = "100";
|
|
10364
|
-
GLSLVersion["GLSL3"] = "300 es";
|
|
10365
|
-
})(GLSLVersion || (GLSLVersion = {}));
|
|
10366
|
-
var ShaderVariant = /*#__PURE__*/ function(EffectsObject) {
|
|
10367
|
-
_inherits(ShaderVariant, EffectsObject);
|
|
10368
|
-
function ShaderVariant(engine, source) {
|
|
10369
|
-
var _this;
|
|
10370
|
-
_this = EffectsObject.call(this, engine) || this;
|
|
10371
|
-
_this.source = source;
|
|
10372
|
-
return _this;
|
|
10373
|
-
}
|
|
10374
|
-
return ShaderVariant;
|
|
10375
|
-
}(EffectsObject);
|
|
10376
|
-
var Shader = /*#__PURE__*/ function(EffectsObject) {
|
|
10377
|
-
_inherits(Shader, EffectsObject);
|
|
10378
|
-
function Shader() {
|
|
10379
|
-
return EffectsObject.apply(this, arguments);
|
|
10380
|
-
}
|
|
10381
|
-
var _proto = Shader.prototype;
|
|
10382
|
-
_proto.createVariant = function createVariant(macros) {
|
|
10383
|
-
var shaderMacros = [];
|
|
10384
|
-
if (macros) {
|
|
10385
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(macros)), _step; !(_step = _iterator()).done;){
|
|
10386
|
-
var key = _step.value;
|
|
10387
|
-
shaderMacros.push([
|
|
10388
|
-
key,
|
|
10389
|
-
macros[key]
|
|
10390
|
-
]);
|
|
10391
|
-
}
|
|
10392
|
-
}
|
|
10393
|
-
var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
|
|
10394
|
-
shaderVariant.shader = this;
|
|
10395
|
-
return shaderVariant;
|
|
10368
|
+
_proto.bind = function bind() {
|
|
10369
|
+
// OVERRIDE
|
|
10396
10370
|
};
|
|
10397
|
-
_proto.
|
|
10398
|
-
|
|
10399
|
-
|
|
10371
|
+
_proto.getDepthTexture = function getDepthTexture() {
|
|
10372
|
+
// OVERRIDE
|
|
10373
|
+
return undefined;
|
|
10400
10374
|
};
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
effectsClass(DataType.Shader)
|
|
10405
|
-
], Shader);
|
|
10406
|
-
|
|
10407
|
-
var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
10408
|
-
var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
10409
|
-
var COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
10410
|
-
var COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
|
|
10411
|
-
function createCopyShader(level, writeDepth) {
|
|
10412
|
-
var webgl2 = level === 2;
|
|
10413
|
-
return {
|
|
10414
|
-
name: EFFECTS_COPY_MESH_NAME,
|
|
10415
|
-
vertex: COPY_VERTEX_SHADER,
|
|
10416
|
-
fragment: COPY_FRAGMENT_SHADER,
|
|
10417
|
-
glslVersion: webgl2 ? GLSLVersion.GLSL3 : GLSLVersion.GLSL1,
|
|
10418
|
-
macros: [
|
|
10419
|
-
[
|
|
10420
|
-
"DEPTH_TEXTURE",
|
|
10421
|
-
!!writeDepth
|
|
10422
|
-
]
|
|
10423
|
-
],
|
|
10424
|
-
// @ts-expect-error
|
|
10425
|
-
cacheId: COPY_MESH_SHADER_ID + +writeDepth
|
|
10375
|
+
_proto.getStencilTexture = function getStencilTexture() {
|
|
10376
|
+
// OVERRIDE
|
|
10377
|
+
return undefined;
|
|
10426
10378
|
};
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
format: glContext.RGBA,
|
|
10431
|
-
type: glContext.UNSIGNED_BYTE,
|
|
10432
|
-
minFilter: glContext.LINEAR,
|
|
10433
|
-
magFilter: glContext.LINEAR,
|
|
10434
|
-
wrapS: glContext.CLAMP_TO_EDGE,
|
|
10435
|
-
wrapT: glContext.CLAMP_TO_EDGE
|
|
10436
|
-
};
|
|
10437
|
-
var disposeSymbol = Symbol("dispose");
|
|
10438
|
-
var PassTextureCache = /*#__PURE__*/ function() {
|
|
10439
|
-
function PassTextureCache(engine) {
|
|
10440
|
-
this.textureCache = {};
|
|
10441
|
-
this.textureRef = {};
|
|
10442
|
-
this.engine = engine;
|
|
10443
|
-
}
|
|
10444
|
-
var _proto = PassTextureCache.prototype;
|
|
10445
|
-
_proto.requestColorAttachmentTexture = function requestColorAttachmentTexture(request) {
|
|
10446
|
-
var _this = this;
|
|
10447
|
-
var width = request.width, height = request.height, name = request.name;
|
|
10448
|
-
var options = {
|
|
10449
|
-
sourceType: TextureSourceType.framebuffer,
|
|
10450
|
-
data: {
|
|
10451
|
-
width: width,
|
|
10452
|
-
height: height
|
|
10453
|
-
},
|
|
10454
|
-
name: name
|
|
10455
|
-
};
|
|
10456
|
-
var keys = [
|
|
10457
|
-
name
|
|
10458
|
-
];
|
|
10459
|
-
Object.getOwnPropertyNames(def).forEach(function(name) {
|
|
10460
|
-
var _request_name;
|
|
10461
|
-
var value = (_request_name = request[name]) != null ? _request_name : def[name];
|
|
10462
|
-
options[name] = value;
|
|
10463
|
-
keys.push(name, value);
|
|
10464
|
-
});
|
|
10465
|
-
var cacheId = keys.join(":");
|
|
10466
|
-
var tex = this.textureCache[cacheId];
|
|
10467
|
-
if (tex) {
|
|
10468
|
-
this.textureRef[cacheId]++;
|
|
10469
|
-
} else {
|
|
10470
|
-
var engine = this.engine;
|
|
10471
|
-
assertExist(engine);
|
|
10472
|
-
tex = Texture.create(engine, options);
|
|
10473
|
-
this.textureCache[cacheId] = tex;
|
|
10474
|
-
this.textureRef[cacheId] = 1;
|
|
10475
|
-
// @ts-expect-error
|
|
10476
|
-
tex[disposeSymbol] = tex.dispose;
|
|
10477
|
-
tex.dispose = function() {
|
|
10478
|
-
return _this.removeTexture(cacheId);
|
|
10479
|
-
};
|
|
10480
|
-
}
|
|
10481
|
-
return tex;
|
|
10379
|
+
_proto.getColorTextures = function getColorTextures() {
|
|
10380
|
+
// OVERRIDE
|
|
10381
|
+
return [];
|
|
10482
10382
|
};
|
|
10483
|
-
_proto.
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10383
|
+
_proto.dispose = function dispose(options) {
|
|
10384
|
+
// OVERRIDE
|
|
10385
|
+
};
|
|
10386
|
+
_create_class(Framebuffer, [
|
|
10387
|
+
{
|
|
10388
|
+
key: "stencilStorage",
|
|
10389
|
+
get: function get() {
|
|
10390
|
+
// OVERRIDE
|
|
10391
|
+
return undefined;
|
|
10488
10392
|
}
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
//
|
|
10494
|
-
|
|
10393
|
+
},
|
|
10394
|
+
{
|
|
10395
|
+
key: "depthStorage",
|
|
10396
|
+
get: function get() {
|
|
10397
|
+
// OVERRIDE
|
|
10398
|
+
return undefined;
|
|
10495
10399
|
}
|
|
10496
|
-
delete this.textureCache[id];
|
|
10497
|
-
delete this.textureRef[id];
|
|
10498
|
-
} else {
|
|
10499
|
-
this.textureRef[id] = refCount - 1;
|
|
10500
10400
|
}
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
var _this = this;
|
|
10504
|
-
Object.keys(this.textureCache).forEach(function(key) {
|
|
10505
|
-
var texture = _this.textureCache[key];
|
|
10506
|
-
// @ts-expect-error
|
|
10507
|
-
texture[disposeSymbol]();
|
|
10508
|
-
// @ts-expect-error
|
|
10509
|
-
texture.dispose = texture[disposeSymbol];
|
|
10510
|
-
});
|
|
10511
|
-
this.textureCache = {};
|
|
10512
|
-
this.textureRef = {};
|
|
10513
|
-
this.engine = undefined;
|
|
10514
|
-
};
|
|
10515
|
-
return PassTextureCache;
|
|
10401
|
+
]);
|
|
10402
|
+
return Framebuffer;
|
|
10516
10403
|
}();
|
|
10517
10404
|
|
|
10518
|
-
function _assert_this_initialized(self) {
|
|
10519
|
-
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
10520
|
-
return self;
|
|
10521
|
-
}
|
|
10522
|
-
|
|
10523
10405
|
var RenderPassPriorityPrepare = 0;
|
|
10524
10406
|
var RenderPassPriorityNormal = 1000;
|
|
10525
10407
|
var RenderPassPriorityPostprocess = 3000;
|
|
@@ -10529,7 +10411,7 @@ var RenderPassAttachmentStorageType;
|
|
|
10529
10411
|
RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["color"] = 1] = "color";
|
|
10530
10412
|
//stencil 8 render buffer
|
|
10531
10413
|
RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["stencil_8_opaque"] = 2] = "stencil_8_opaque";
|
|
10532
|
-
//
|
|
10414
|
+
//depth 16 render buffer
|
|
10533
10415
|
RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["depth_16_opaque"] = 3] = "depth_16_opaque";
|
|
10534
10416
|
//depth 16 & stencil 8 render buffer
|
|
10535
10417
|
RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["depth_stencil_opaque"] = 4] = "depth_stencil_opaque";
|
|
@@ -10648,61 +10530,31 @@ var seed$7 = 1;
|
|
|
10648
10530
|
/**
|
|
10649
10531
|
* RenderPass 抽象类
|
|
10650
10532
|
*/ var RenderPass = /*#__PURE__*/ function() {
|
|
10651
|
-
function RenderPass(renderer
|
|
10533
|
+
function RenderPass(renderer) {
|
|
10652
10534
|
/**
|
|
10653
10535
|
* 优先级
|
|
10654
10536
|
*/ this.priority = 0;
|
|
10655
10537
|
/**
|
|
10656
|
-
* ColorAttachment 数组
|
|
10657
|
-
*/ this.attachments = [];
|
|
10658
|
-
/**
|
|
10659
10538
|
* 名称
|
|
10660
10539
|
*/ this.name = "RenderPass" + seed$7++;
|
|
10661
10540
|
/**
|
|
10662
10541
|
* 包含的 Mesh 列表
|
|
10663
10542
|
*/ this.meshes = [];
|
|
10664
|
-
/**
|
|
10665
|
-
* Mesh 渲染顺序,按照优先级升序或降序
|
|
10666
|
-
*/ this.meshOrder = OrderType.ascending;
|
|
10667
10543
|
this.disposed = false;
|
|
10668
|
-
this.
|
|
10669
|
-
var depthStencilAttachment = options.depthStencilAttachment;
|
|
10544
|
+
this.framebuffer = null;
|
|
10670
10545
|
this.renderer = renderer;
|
|
10671
|
-
this.depthStencilType = (depthStencilAttachment == null ? void 0 : depthStencilAttachment.storageType) || 0;
|
|
10672
|
-
this.storeAction = {
|
|
10673
|
-
colorAction: 0,
|
|
10674
|
-
depthAction: 0,
|
|
10675
|
-
stencilAction: 0
|
|
10676
|
-
};
|
|
10677
|
-
this.options = options;
|
|
10678
10546
|
}
|
|
10679
10547
|
var _proto = RenderPass.prototype;
|
|
10680
10548
|
_proto.addMesh = function addMesh(mesh) {
|
|
10681
|
-
addByOrder(this.meshes, mesh
|
|
10549
|
+
addByOrder(this.meshes, mesh);
|
|
10682
10550
|
};
|
|
10683
10551
|
_proto.removeMesh = function removeMesh(mesh) {
|
|
10684
10552
|
removeItem(this.meshes, mesh);
|
|
10685
10553
|
};
|
|
10686
|
-
_proto.setMeshes = function setMeshes(meshes) {
|
|
10687
|
-
var _this_meshes;
|
|
10688
|
-
this.meshes.length = 0;
|
|
10689
|
-
(_this_meshes = this.meshes).splice.apply(_this_meshes, [].concat([
|
|
10690
|
-
0,
|
|
10691
|
-
0
|
|
10692
|
-
], meshes));
|
|
10693
|
-
sortByOrder(this.meshes, this.meshOrder);
|
|
10694
|
-
return this.meshes;
|
|
10695
|
-
};
|
|
10696
|
-
// TODO 所有pass在子类配置
|
|
10697
10554
|
/**
|
|
10698
10555
|
* 配置当前pass的RT,在每帧渲染前调用
|
|
10699
10556
|
*/ _proto.configure = function configure(renderer) {
|
|
10700
|
-
|
|
10701
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
10702
|
-
} else {
|
|
10703
|
-
var _this_getViewport = this.getViewport(), x = _this_getViewport[0], y = _this_getViewport[1], width = _this_getViewport[2], height = _this_getViewport[3];
|
|
10704
|
-
renderer.setViewport(x, y, width, height);
|
|
10705
|
-
}
|
|
10557
|
+
// OVERRIDE
|
|
10706
10558
|
};
|
|
10707
10559
|
/**
|
|
10708
10560
|
* 执行当前pass,每帧调用一次
|
|
@@ -10710,66 +10562,10 @@ var seed$7 = 1;
|
|
|
10710
10562
|
// OVERRIDE
|
|
10711
10563
|
};
|
|
10712
10564
|
/**
|
|
10713
|
-
* 每帧所有的pass
|
|
10714
|
-
*/ _proto.
|
|
10565
|
+
* 每帧所有的pass渲染完后调用,用于清空临时的RT资源
|
|
10566
|
+
*/ _proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
10715
10567
|
// OVERRIDE
|
|
10716
10568
|
};
|
|
10717
|
-
_proto._resetAttachments = function _resetAttachments() {
|
|
10718
|
-
var _this = this;
|
|
10719
|
-
var _options_attachments;
|
|
10720
|
-
var renderer = this.renderer;
|
|
10721
|
-
var options = this.options;
|
|
10722
|
-
if (this.attachments.length) {
|
|
10723
|
-
var _this_framebuffer;
|
|
10724
|
-
this.attachments.forEach(function(att) {
|
|
10725
|
-
return !att.externalTexture && att.dispose();
|
|
10726
|
-
});
|
|
10727
|
-
this.attachments.length = 0;
|
|
10728
|
-
(_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.dispose({
|
|
10729
|
-
depthStencilAttachment: 2
|
|
10730
|
-
});
|
|
10731
|
-
this.framebuffer = null;
|
|
10732
|
-
}
|
|
10733
|
-
// renderpass 的 viewport 相关参数都需要动态的修改
|
|
10734
|
-
var viewport = [
|
|
10735
|
-
0,
|
|
10736
|
-
0,
|
|
10737
|
-
renderer.getWidth(),
|
|
10738
|
-
renderer.getHeight()
|
|
10739
|
-
];
|
|
10740
|
-
var size = [
|
|
10741
|
-
viewport[2],
|
|
10742
|
-
viewport[3]
|
|
10743
|
-
];
|
|
10744
|
-
var name = this.name;
|
|
10745
|
-
if ((_options_attachments = options.attachments) == null ? void 0 : _options_attachments.length) {
|
|
10746
|
-
var attachments = options.attachments.map(function(attr, index) {
|
|
10747
|
-
var _attr_texture;
|
|
10748
|
-
var attachment = new RenderTargetHandle(_this.renderer.engine, _extends({
|
|
10749
|
-
size: size,
|
|
10750
|
-
name: ((_attr_texture = attr.texture) == null ? void 0 : _attr_texture.name) || name + "##color_" + index
|
|
10751
|
-
}, attr));
|
|
10752
|
-
return attachment;
|
|
10753
|
-
});
|
|
10754
|
-
this.attachments = attachments;
|
|
10755
|
-
var framebuffer = Framebuffer.create({
|
|
10756
|
-
storeAction: this.storeAction,
|
|
10757
|
-
name: name,
|
|
10758
|
-
viewport: viewport,
|
|
10759
|
-
attachments: attachments.map(function(att) {
|
|
10760
|
-
return att.texture;
|
|
10761
|
-
}),
|
|
10762
|
-
depthStencilAttachment: options.depthStencilAttachment || {
|
|
10763
|
-
storageType: 0
|
|
10764
|
-
}
|
|
10765
|
-
}, renderer);
|
|
10766
|
-
framebuffer.bind();
|
|
10767
|
-
framebuffer.unbind();
|
|
10768
|
-
this.framebuffer = framebuffer;
|
|
10769
|
-
} else {
|
|
10770
|
-
this.attachments.length = 0;
|
|
10771
|
-
}
|
|
10772
|
-
};
|
|
10773
10569
|
/**
|
|
10774
10570
|
* 获取当前视口大小,格式:[x偏移,y偏移,宽度,高度]
|
|
10775
10571
|
*/ _proto.getViewport = function getViewport() {
|
|
@@ -10792,68 +10588,6 @@ var seed$7 = 1;
|
|
|
10792
10588
|
];
|
|
10793
10589
|
};
|
|
10794
10590
|
/**
|
|
10795
|
-
* 获取深度 Attachment,可能没有
|
|
10796
|
-
*/ _proto.getDepthAttachment = function getDepthAttachment() {
|
|
10797
|
-
var framebuffer = this.framebuffer;
|
|
10798
|
-
if (framebuffer) {
|
|
10799
|
-
var depthTexture = framebuffer.getDepthTexture();
|
|
10800
|
-
var texture = depthTexture ? this.getDepthTexture(depthTexture, framebuffer.externalStorage) : undefined;
|
|
10801
|
-
return {
|
|
10802
|
-
storageType: framebuffer.depthStencilStorageType,
|
|
10803
|
-
storage: framebuffer.depthStorage,
|
|
10804
|
-
texture: texture
|
|
10805
|
-
};
|
|
10806
|
-
}
|
|
10807
|
-
};
|
|
10808
|
-
/**
|
|
10809
|
-
* 获取蒙版 Attachment,可能没有
|
|
10810
|
-
*/ _proto.getStencilAttachment = function getStencilAttachment() {
|
|
10811
|
-
var framebuffer = this.framebuffer;
|
|
10812
|
-
if (framebuffer) {
|
|
10813
|
-
var stencilTexture = framebuffer.getStencilTexture();
|
|
10814
|
-
var texture = stencilTexture ? this.getDepthTexture(stencilTexture, framebuffer.externalStorage) : undefined;
|
|
10815
|
-
return {
|
|
10816
|
-
storageType: framebuffer.depthStencilStorageType,
|
|
10817
|
-
storage: framebuffer.stencilStorage,
|
|
10818
|
-
texture: texture
|
|
10819
|
-
};
|
|
10820
|
-
}
|
|
10821
|
-
};
|
|
10822
|
-
_proto.getDepthTexture = function getDepthTexture(texture, external) {
|
|
10823
|
-
if (!this.depthTexture) {
|
|
10824
|
-
var _this_options_depthStencilAttachment;
|
|
10825
|
-
var outTex = (_this_options_depthStencilAttachment = this.options.depthStencilAttachment) == null ? void 0 : _this_options_depthStencilAttachment.texture;
|
|
10826
|
-
var tex = texture === outTex ? outTex : texture;
|
|
10827
|
-
// TODO 为什么要initialize?
|
|
10828
|
-
//tex.initialize(this.renderer.engine);
|
|
10829
|
-
if (!external) {
|
|
10830
|
-
this.depthTexture = tex;
|
|
10831
|
-
}
|
|
10832
|
-
return tex;
|
|
10833
|
-
}
|
|
10834
|
-
return this.depthTexture;
|
|
10835
|
-
};
|
|
10836
|
-
_proto.getStencilTexture = function getStencilTexture(texture, external) {
|
|
10837
|
-
if (!this.stencilTexture) {
|
|
10838
|
-
var _this_options_depthStencilAttachment;
|
|
10839
|
-
var outTex = (_this_options_depthStencilAttachment = this.options.depthStencilAttachment) == null ? void 0 : _this_options_depthStencilAttachment.texture;
|
|
10840
|
-
var tex = texture === outTex ? outTex : texture;
|
|
10841
|
-
if (!external) {
|
|
10842
|
-
this.stencilTexture = tex;
|
|
10843
|
-
}
|
|
10844
|
-
return tex;
|
|
10845
|
-
}
|
|
10846
|
-
return this.stencilTexture;
|
|
10847
|
-
};
|
|
10848
|
-
// 生成并初始化帧缓冲
|
|
10849
|
-
_proto.initialize = function initialize(renderer) {
|
|
10850
|
-
if (!this.initialized) {
|
|
10851
|
-
this._resetAttachments();
|
|
10852
|
-
this.initialized = true;
|
|
10853
|
-
}
|
|
10854
|
-
return this;
|
|
10855
|
-
};
|
|
10856
|
-
/**
|
|
10857
10591
|
* 销毁 RenderPass
|
|
10858
10592
|
* @param options - 有选择销毁内部对象
|
|
10859
10593
|
*/ _proto.dispose = function dispose(options) {
|
|
@@ -10867,35 +10601,11 @@ var seed$7 = 1;
|
|
|
10867
10601
|
});
|
|
10868
10602
|
}
|
|
10869
10603
|
this.meshes.length = 0;
|
|
10870
|
-
var colorOpt = (options == null ? void 0 : options.colorAttachment) ? options.colorAttachment : 0;
|
|
10871
|
-
this.attachments.forEach(function(att) {
|
|
10872
|
-
var keep = att.externalTexture && colorOpt === 2 || colorOpt === 1;
|
|
10873
|
-
if (!keep) {
|
|
10874
|
-
att.dispose();
|
|
10875
|
-
}
|
|
10876
|
-
});
|
|
10877
|
-
this.attachments.length = 0;
|
|
10878
10604
|
this.disposed = true;
|
|
10879
|
-
var depthStencilOpt = (options == null ? void 0 : options.depthStencilAttachment) ? options.depthStencilAttachment : 0;
|
|
10880
|
-
var fbo = this.framebuffer;
|
|
10881
|
-
if (fbo) {
|
|
10882
|
-
fbo.dispose({
|
|
10883
|
-
depthStencilAttachment: depthStencilOpt
|
|
10884
|
-
});
|
|
10885
|
-
var keep = fbo.externalStorage && depthStencilOpt === 2 || depthStencilOpt === 1;
|
|
10886
|
-
if (!keep) {
|
|
10887
|
-
var _this_stencilTexture, _this_depthTexture;
|
|
10888
|
-
(_this_stencilTexture = this.stencilTexture) == null ? void 0 : _this_stencilTexture.dispose();
|
|
10889
|
-
(_this_depthTexture = this.depthTexture) == null ? void 0 : _this_depthTexture.dispose();
|
|
10890
|
-
}
|
|
10891
|
-
}
|
|
10892
|
-
// @ts-expect-error safe to assign
|
|
10893
|
-
this.options = null;
|
|
10894
|
-
this.initialize = throwDestroyedError;
|
|
10895
10605
|
};
|
|
10896
10606
|
_create_class(RenderPass, [
|
|
10897
10607
|
{
|
|
10898
|
-
key: "
|
|
10608
|
+
key: "isDisposed",
|
|
10899
10609
|
get: function get() {
|
|
10900
10610
|
return this.disposed;
|
|
10901
10611
|
}
|
|
@@ -10905,18 +10615,6 @@ var seed$7 = 1;
|
|
|
10905
10615
|
get: function get() {
|
|
10906
10616
|
return this.getViewport();
|
|
10907
10617
|
}
|
|
10908
|
-
},
|
|
10909
|
-
{
|
|
10910
|
-
key: "stencilAttachment",
|
|
10911
|
-
get: function get() {
|
|
10912
|
-
return this.getStencilAttachment();
|
|
10913
|
-
}
|
|
10914
|
-
},
|
|
10915
|
-
{
|
|
10916
|
-
key: "depthAttachment",
|
|
10917
|
-
get: function get() {
|
|
10918
|
-
return this.getDepthAttachment();
|
|
10919
|
-
}
|
|
10920
10618
|
}
|
|
10921
10619
|
]);
|
|
10922
10620
|
return RenderPass;
|
|
@@ -10924,38 +10622,95 @@ var seed$7 = 1;
|
|
|
10924
10622
|
|
|
10925
10623
|
var DrawObjectPass = /*#__PURE__*/ function(RenderPass) {
|
|
10926
10624
|
_inherits(DrawObjectPass, RenderPass);
|
|
10927
|
-
function DrawObjectPass(renderer
|
|
10625
|
+
function DrawObjectPass(renderer) {
|
|
10928
10626
|
var _this;
|
|
10929
|
-
_this = RenderPass.call(this, renderer
|
|
10627
|
+
_this = RenderPass.call(this, renderer) || this;
|
|
10628
|
+
_this.useRenderTarget = false;
|
|
10930
10629
|
_this.priority = RenderPassPriorityNormal;
|
|
10931
10630
|
_this.name = "DrawObjectPass";
|
|
10932
|
-
_this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
|
|
10933
|
-
_this.renderer.engine.on("resize", _this.onResize);
|
|
10934
10631
|
return _this;
|
|
10935
10632
|
}
|
|
10936
10633
|
var _proto = DrawObjectPass.prototype;
|
|
10634
|
+
_proto.setup = function setup(useRenderTarget) {
|
|
10635
|
+
this.useRenderTarget = useRenderTarget;
|
|
10636
|
+
};
|
|
10637
|
+
_proto.configure = function configure(renderer) {
|
|
10638
|
+
if (this.useRenderTarget) {
|
|
10639
|
+
this.framebuffer = renderer.getTemporaryRT("DrawObjectPass", renderer.getWidth(), renderer.getHeight(), 16, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
10640
|
+
renderer.setFramebuffer(this.framebuffer);
|
|
10641
|
+
}
|
|
10642
|
+
};
|
|
10937
10643
|
_proto.execute = function execute(renderer) {
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10644
|
+
if (this.useRenderTarget) {
|
|
10645
|
+
renderer.clear({
|
|
10646
|
+
colorAction: TextureLoadAction.clear,
|
|
10647
|
+
depthAction: TextureLoadAction.clear,
|
|
10648
|
+
stencilAction: TextureLoadAction.clear
|
|
10649
|
+
});
|
|
10650
|
+
}
|
|
10943
10651
|
renderer.renderMeshes(this.meshes);
|
|
10944
|
-
renderer.clear(this.storeAction);
|
|
10945
|
-
};
|
|
10946
|
-
_proto.onResize = function onResize() {
|
|
10947
|
-
var _this_framebuffer;
|
|
10948
|
-
var width = this.renderer.getWidth();
|
|
10949
|
-
var height = this.renderer.getHeight();
|
|
10950
|
-
(_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.resize(0, 0, width, height);
|
|
10951
10652
|
};
|
|
10952
|
-
_proto.
|
|
10953
|
-
this.
|
|
10954
|
-
|
|
10653
|
+
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
10654
|
+
if (this.useRenderTarget && this.framebuffer) {
|
|
10655
|
+
renderer.releaseTemporaryRT(this.framebuffer);
|
|
10656
|
+
}
|
|
10955
10657
|
};
|
|
10956
10658
|
return DrawObjectPass;
|
|
10957
10659
|
}(RenderPass);
|
|
10958
10660
|
|
|
10661
|
+
var ShaderCompileResultStatus;
|
|
10662
|
+
(function(ShaderCompileResultStatus) {
|
|
10663
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["noShader"] = 0] = "noShader";
|
|
10664
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["success"] = 1] = "success";
|
|
10665
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["fail"] = 2] = "fail";
|
|
10666
|
+
ShaderCompileResultStatus[ShaderCompileResultStatus["compiling"] = 3] = "compiling";
|
|
10667
|
+
})(ShaderCompileResultStatus || (ShaderCompileResultStatus = {}));
|
|
10668
|
+
var GLSLVersion;
|
|
10669
|
+
(function(GLSLVersion) {
|
|
10670
|
+
GLSLVersion["GLSL1"] = "100";
|
|
10671
|
+
GLSLVersion["GLSL3"] = "300 es";
|
|
10672
|
+
})(GLSLVersion || (GLSLVersion = {}));
|
|
10673
|
+
var ShaderVariant = /*#__PURE__*/ function(EffectsObject) {
|
|
10674
|
+
_inherits(ShaderVariant, EffectsObject);
|
|
10675
|
+
function ShaderVariant(engine, source) {
|
|
10676
|
+
var _this;
|
|
10677
|
+
_this = EffectsObject.call(this, engine) || this;
|
|
10678
|
+
_this.source = source;
|
|
10679
|
+
return _this;
|
|
10680
|
+
}
|
|
10681
|
+
return ShaderVariant;
|
|
10682
|
+
}(EffectsObject);
|
|
10683
|
+
var Shader = /*#__PURE__*/ function(EffectsObject) {
|
|
10684
|
+
_inherits(Shader, EffectsObject);
|
|
10685
|
+
function Shader() {
|
|
10686
|
+
return EffectsObject.apply(this, arguments);
|
|
10687
|
+
}
|
|
10688
|
+
var _proto = Shader.prototype;
|
|
10689
|
+
_proto.createVariant = function createVariant(macros) {
|
|
10690
|
+
var shaderMacros = [];
|
|
10691
|
+
if (macros) {
|
|
10692
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(macros)), _step; !(_step = _iterator()).done;){
|
|
10693
|
+
var key = _step.value;
|
|
10694
|
+
shaderMacros.push([
|
|
10695
|
+
key,
|
|
10696
|
+
macros[key]
|
|
10697
|
+
]);
|
|
10698
|
+
}
|
|
10699
|
+
}
|
|
10700
|
+
var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
|
|
10701
|
+
shaderVariant.shader = this;
|
|
10702
|
+
return shaderVariant;
|
|
10703
|
+
};
|
|
10704
|
+
_proto.fromData = function fromData(data) {
|
|
10705
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
10706
|
+
this.shaderData = data;
|
|
10707
|
+
};
|
|
10708
|
+
return Shader;
|
|
10709
|
+
}(EffectsObject);
|
|
10710
|
+
Shader = __decorate([
|
|
10711
|
+
effectsClass(DataType.Shader)
|
|
10712
|
+
], Shader);
|
|
10713
|
+
|
|
10959
10714
|
var _obj$5;
|
|
10960
10715
|
var BYTES_TYPE_MAP = (_obj$5 = {}, _obj$5[glContext.FLOAT] = Float32Array.BYTES_PER_ELEMENT, _obj$5[glContext.INT] = Int32Array.BYTES_PER_ELEMENT, _obj$5[glContext.SHORT] = Int16Array.BYTES_PER_ELEMENT, _obj$5[glContext.BYTE] = Int8Array.BYTES_PER_ELEMENT, _obj$5);
|
|
10961
10716
|
/**
|
|
@@ -12994,272 +12749,138 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
12994
12749
|
return ShaderFactory;
|
|
12995
12750
|
}();
|
|
12996
12751
|
|
|
12997
|
-
// Bloom
|
|
12998
|
-
var
|
|
12999
|
-
_inherits(
|
|
13000
|
-
function
|
|
12752
|
+
// Bloom Pass - 包含阈值提取、高斯模糊(Down Sample 和 Up Sample)
|
|
12753
|
+
var BloomPass = /*#__PURE__*/ function(RenderPass) {
|
|
12754
|
+
_inherits(BloomPass, RenderPass);
|
|
12755
|
+
function BloomPass(renderer, iterationCount) {
|
|
12756
|
+
if (iterationCount === void 0) iterationCount = 4;
|
|
13001
12757
|
var _this;
|
|
13002
|
-
_this = RenderPass.call(this, renderer
|
|
12758
|
+
_this = RenderPass.call(this, renderer) || this;
|
|
12759
|
+
_this.tempRTs = [];
|
|
12760
|
+
_this.iterationCount = iterationCount;
|
|
13003
12761
|
var engine = _this.renderer.engine;
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
attributes: {
|
|
13007
|
-
aPos: {
|
|
13008
|
-
type: glContext.FLOAT,
|
|
13009
|
-
size: 2,
|
|
13010
|
-
data: new Float32Array([
|
|
13011
|
-
-1,
|
|
13012
|
-
1,
|
|
13013
|
-
-1,
|
|
13014
|
-
-1,
|
|
13015
|
-
1,
|
|
13016
|
-
1,
|
|
13017
|
-
1,
|
|
13018
|
-
-1
|
|
13019
|
-
])
|
|
13020
|
-
}
|
|
13021
|
-
},
|
|
13022
|
-
drawCount: 4
|
|
13023
|
-
});
|
|
13024
|
-
var material = Material.create(engine, {
|
|
12762
|
+
// Threshold material
|
|
12763
|
+
_this.thresholdMaterial = Material.create(engine, {
|
|
13025
12764
|
shader: {
|
|
13026
12765
|
vertex: screenMeshVert,
|
|
13027
12766
|
fragment: thresholdFrag,
|
|
13028
12767
|
glslVersion: GLSLVersion.GLSL1
|
|
13029
12768
|
}
|
|
13030
12769
|
});
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
12770
|
+
_this.thresholdMaterial.blending = false;
|
|
12771
|
+
_this.thresholdMaterial.depthTest = false;
|
|
12772
|
+
_this.thresholdMaterial.culling = false;
|
|
12773
|
+
// Down sample H material
|
|
12774
|
+
_this.downSampleHMaterial = Material.create(engine, {
|
|
12775
|
+
shader: {
|
|
12776
|
+
vertex: screenMeshVert,
|
|
12777
|
+
fragment: gaussianDownHFrag,
|
|
12778
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12779
|
+
}
|
|
13038
12780
|
});
|
|
12781
|
+
_this.downSampleHMaterial.blending = false;
|
|
12782
|
+
_this.downSampleHMaterial.depthTest = false;
|
|
12783
|
+
_this.downSampleHMaterial.culling = false;
|
|
12784
|
+
// Down sample V material
|
|
12785
|
+
_this.downSampleVMaterial = Material.create(engine, {
|
|
12786
|
+
shader: {
|
|
12787
|
+
vertex: screenMeshVert,
|
|
12788
|
+
fragment: gaussianDownVFrag,
|
|
12789
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12790
|
+
}
|
|
12791
|
+
});
|
|
12792
|
+
_this.downSampleVMaterial.blending = false;
|
|
12793
|
+
_this.downSampleVMaterial.depthTest = false;
|
|
12794
|
+
_this.downSampleVMaterial.culling = false;
|
|
12795
|
+
// Up sample material
|
|
12796
|
+
_this.upSampleMaterial = Material.create(engine, {
|
|
12797
|
+
shader: {
|
|
12798
|
+
vertex: screenMeshVert,
|
|
12799
|
+
fragment: gaussianUpFrag,
|
|
12800
|
+
glslVersion: GLSLVersion.GLSL1
|
|
12801
|
+
}
|
|
12802
|
+
});
|
|
12803
|
+
_this.upSampleMaterial.blending = false;
|
|
12804
|
+
_this.upSampleMaterial.depthTest = false;
|
|
12805
|
+
_this.upSampleMaterial.culling = false;
|
|
13039
12806
|
_this.priority = 5000;
|
|
13040
|
-
_this.name = "
|
|
13041
|
-
_this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
|
|
13042
|
-
_this.renderer.engine.on("resize", _this.onResize);
|
|
12807
|
+
_this.name = "BloomPass";
|
|
13043
12808
|
return _this;
|
|
13044
12809
|
}
|
|
13045
|
-
var _proto =
|
|
12810
|
+
var _proto = BloomPass.prototype;
|
|
13046
12811
|
_proto.configure = function configure(renderer) {
|
|
12812
|
+
// 获取场景纹理用于 ToneMappingPass
|
|
13047
12813
|
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
13048
12814
|
this.sceneTextureHandle.texture = this.mainTexture;
|
|
13049
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
13050
12815
|
};
|
|
13051
12816
|
_proto.execute = function execute(renderer) {
|
|
13052
12817
|
var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
|
|
13053
|
-
renderer.
|
|
13054
|
-
|
|
13055
|
-
depthAction: TextureStoreAction.clear,
|
|
13056
|
-
stencilAction: TextureStoreAction.clear
|
|
13057
|
-
});
|
|
13058
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
12818
|
+
var baseWidth = renderer.getWidth();
|
|
12819
|
+
var baseHeight = renderer.getHeight();
|
|
13059
12820
|
var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
|
|
12821
|
+
// 1. Threshold pass - 提取高亮区域
|
|
13060
12822
|
var threshold = (_renderer_renderingData_currentFrame_globalVolume_bloom_threshold = (_renderer_renderingData_currentFrame_globalVolume = renderer.renderingData.currentFrame.globalVolume) == null ? void 0 : (_renderer_renderingData_currentFrame_globalVolume_bloom = _renderer_renderingData_currentFrame_globalVolume.bloom) == null ? void 0 : _renderer_renderingData_currentFrame_globalVolume_bloom.threshold) != null ? _renderer_renderingData_currentFrame_globalVolume_bloom_threshold : 1.0;
|
|
13061
|
-
this.
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
]
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
var
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13092
|
-
|
|
13093
|
-
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
|
|
13106
|
-
drawCount: 4
|
|
13107
|
-
});
|
|
13108
|
-
var fragment = type === "H" ? gaussianDownHFrag : gaussianDownVFrag;
|
|
13109
|
-
var shader = {
|
|
13110
|
-
vertex: screenMeshVert,
|
|
13111
|
-
fragment: fragment,
|
|
13112
|
-
glslVersion: GLSLVersion.GLSL1
|
|
13113
|
-
};
|
|
13114
|
-
var material = Material.create(engine, {
|
|
13115
|
-
name: name,
|
|
13116
|
-
shader: shader
|
|
13117
|
-
});
|
|
13118
|
-
material.blending = false;
|
|
13119
|
-
material.depthTest = false;
|
|
13120
|
-
material.culling = false;
|
|
13121
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
13122
|
-
name: name,
|
|
13123
|
-
geometry: geometry,
|
|
13124
|
-
material: material,
|
|
13125
|
-
priority: 0
|
|
13126
|
-
});
|
|
13127
|
-
_this.priority = 5000;
|
|
13128
|
-
_this.name = "GaussianDownPass" + type + level;
|
|
13129
|
-
_this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
|
|
13130
|
-
_this.renderer.engine.on("resize", _this.onResize);
|
|
13131
|
-
return _this;
|
|
13132
|
-
}
|
|
13133
|
-
var _proto = HQGaussianDownSamplePass.prototype;
|
|
13134
|
-
_proto.initialize = function initialize(renderer) {
|
|
13135
|
-
RenderPass.prototype.initialize.call(this, renderer);
|
|
13136
|
-
this.onResize();
|
|
13137
|
-
return this;
|
|
13138
|
-
};
|
|
13139
|
-
_proto.configure = function configure(renderer) {
|
|
13140
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
13141
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
13142
|
-
};
|
|
13143
|
-
_proto.execute = function execute(renderer) {
|
|
13144
|
-
renderer.clear({
|
|
13145
|
-
colorAction: TextureStoreAction.clear,
|
|
13146
|
-
depthAction: TextureStoreAction.clear,
|
|
13147
|
-
stencilAction: TextureStoreAction.clear
|
|
13148
|
-
});
|
|
13149
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
13150
|
-
this.screenMesh.material.setVector2("_TextureSize", getTextureSize(this.mainTexture));
|
|
13151
|
-
renderer.renderMeshes([
|
|
13152
|
-
this.screenMesh
|
|
13153
|
-
]);
|
|
13154
|
-
if (this.type === "V") {
|
|
13155
|
-
this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
|
|
13156
|
-
}
|
|
13157
|
-
};
|
|
13158
|
-
_proto.onResize = function onResize() {
|
|
13159
|
-
var _this_framebuffer;
|
|
13160
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level + 1));
|
|
13161
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level + 1));
|
|
13162
|
-
(_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.resize(0, 0, width, height);
|
|
13163
|
-
};
|
|
13164
|
-
_proto.dispose = function dispose(options) {
|
|
13165
|
-
this.renderer.engine.off("resize", this.onResize);
|
|
13166
|
-
RenderPass.prototype.dispose.call(this, options);
|
|
13167
|
-
};
|
|
13168
|
-
return HQGaussianDownSamplePass;
|
|
13169
|
-
}(RenderPass);
|
|
13170
|
-
var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
|
|
13171
|
-
_inherits(HQGaussianUpSamplePass, RenderPass);
|
|
13172
|
-
function HQGaussianUpSamplePass(renderer, level, options) {
|
|
13173
|
-
var _this;
|
|
13174
|
-
_this = RenderPass.call(this, renderer, options) || this;
|
|
13175
|
-
_this.level = level;
|
|
13176
|
-
var name = "PostProcess";
|
|
13177
|
-
var engine = _this.renderer.engine;
|
|
13178
|
-
var geometry = Geometry.create(engine, {
|
|
13179
|
-
name: name,
|
|
13180
|
-
mode: glContext.TRIANGLE_STRIP,
|
|
13181
|
-
attributes: {
|
|
13182
|
-
aPos: {
|
|
13183
|
-
type: glContext.FLOAT,
|
|
13184
|
-
size: 2,
|
|
13185
|
-
data: new Float32Array([
|
|
13186
|
-
-1,
|
|
13187
|
-
1,
|
|
13188
|
-
-1,
|
|
13189
|
-
-1,
|
|
13190
|
-
1,
|
|
13191
|
-
1,
|
|
13192
|
-
1,
|
|
13193
|
-
-1
|
|
13194
|
-
])
|
|
13195
|
-
}
|
|
13196
|
-
},
|
|
13197
|
-
drawCount: 4
|
|
13198
|
-
});
|
|
13199
|
-
var shader = {
|
|
13200
|
-
vertex: screenMeshVert,
|
|
13201
|
-
fragment: gaussianUpFrag
|
|
13202
|
-
};
|
|
13203
|
-
var material = Material.create(engine, {
|
|
13204
|
-
name: name,
|
|
13205
|
-
shader: shader
|
|
13206
|
-
});
|
|
13207
|
-
material.blending = false;
|
|
13208
|
-
material.depthTest = false;
|
|
13209
|
-
material.culling = false;
|
|
13210
|
-
_this.screenMesh = Mesh.create(engine, {
|
|
13211
|
-
name: name,
|
|
13212
|
-
geometry: geometry,
|
|
13213
|
-
material: material,
|
|
13214
|
-
priority: 0
|
|
13215
|
-
});
|
|
13216
|
-
_this.priority = 5000;
|
|
13217
|
-
_this.name = "GaussianUpPass" + level;
|
|
13218
|
-
_this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
|
|
13219
|
-
_this.renderer.engine.on("resize", _this.onResize);
|
|
13220
|
-
return _this;
|
|
13221
|
-
}
|
|
13222
|
-
var _proto = HQGaussianUpSamplePass.prototype;
|
|
13223
|
-
_proto.initialize = function initialize(renderer) {
|
|
13224
|
-
RenderPass.prototype.initialize.call(this, renderer);
|
|
13225
|
-
this.onResize();
|
|
13226
|
-
return this;
|
|
13227
|
-
};
|
|
13228
|
-
_proto.configure = function configure(renderer) {
|
|
13229
|
-
this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
|
|
13230
|
-
renderer.setFramebuffer(this.framebuffer);
|
|
13231
|
-
};
|
|
13232
|
-
_proto.execute = function execute(renderer) {
|
|
13233
|
-
renderer.clear({
|
|
13234
|
-
colorAction: TextureStoreAction.clear,
|
|
13235
|
-
depthAction: TextureStoreAction.clear,
|
|
13236
|
-
stencilAction: TextureStoreAction.clear
|
|
13237
|
-
});
|
|
13238
|
-
this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
|
|
13239
|
-
this.screenMesh.material.setTexture("_GaussianDownTex", this.gaussianDownSampleResult.texture);
|
|
13240
|
-
this.screenMesh.material.setVector2("_GaussianDownTextureSize", getTextureSize(this.gaussianDownSampleResult.texture));
|
|
13241
|
-
renderer.renderMeshes([
|
|
13242
|
-
this.screenMesh
|
|
13243
|
-
]);
|
|
13244
|
-
};
|
|
13245
|
-
_proto.onResize = function onResize() {
|
|
13246
|
-
var _this_framebuffer;
|
|
13247
|
-
var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level - 1));
|
|
13248
|
-
var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level - 1));
|
|
13249
|
-
(_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.resize(0, 0, width, height);
|
|
12823
|
+
this.thresholdRT = renderer.getTemporaryRT("_BloomThreshold", baseWidth, baseHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12824
|
+
this.thresholdMaterial.setFloat("_Threshold", threshold);
|
|
12825
|
+
renderer.blit(this.mainTexture, this.thresholdRT, this.thresholdMaterial);
|
|
12826
|
+
var currentTexture = this.thresholdRT.getColorTextures()[0];
|
|
12827
|
+
// 2. Down sample passes
|
|
12828
|
+
for(var i = 0; i < this.iterationCount; i++){
|
|
12829
|
+
var downWidth = Math.floor(baseWidth / Math.pow(2, i + 1));
|
|
12830
|
+
var downHeight = Math.floor(baseHeight / Math.pow(2, i + 1));
|
|
12831
|
+
// Horizontal pass
|
|
12832
|
+
var tempH = renderer.getTemporaryRT("_BloomDownH" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12833
|
+
this.downSampleHMaterial.setVector2("_TextureSize", getTextureSize(currentTexture));
|
|
12834
|
+
renderer.blit(currentTexture, tempH, this.downSampleHMaterial);
|
|
12835
|
+
// Vertical pass
|
|
12836
|
+
var tempV = renderer.getTemporaryRT("_BloomDownV" + i, downWidth, downHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12837
|
+
this.downSampleVMaterial.setVector2("_TextureSize", getTextureSize(tempH.getColorTextures()[0]));
|
|
12838
|
+
renderer.blit(tempH.getColorTextures()[0], tempV, this.downSampleVMaterial);
|
|
12839
|
+
// 释放 H pass RT,保留 V pass RT 用于 up sample
|
|
12840
|
+
renderer.releaseTemporaryRT(tempH);
|
|
12841
|
+
this.tempRTs.push(tempV);
|
|
12842
|
+
currentTexture = tempV.getColorTextures()[0];
|
|
12843
|
+
}
|
|
12844
|
+
// 释放 threshold RT
|
|
12845
|
+
renderer.releaseTemporaryRT(this.thresholdRT);
|
|
12846
|
+
// 3. Up sample passes
|
|
12847
|
+
for(var i1 = this.iterationCount - 1; i1 > 0; i1--){
|
|
12848
|
+
var upWidth = Math.floor(baseWidth / Math.pow(2, i1 - 1));
|
|
12849
|
+
var upHeight = Math.floor(baseHeight / Math.pow(2, i1 - 1));
|
|
12850
|
+
var tempUp = renderer.getTemporaryRT("_BloomUp" + i1, upWidth, upHeight, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
|
|
12851
|
+
// 获取下一层的 down sample 结果
|
|
12852
|
+
var downSampleTexture = this.tempRTs[i1 - 1].getColorTextures()[0];
|
|
12853
|
+
this.upSampleMaterial.setTexture("_GaussianDownTex", downSampleTexture);
|
|
12854
|
+
this.upSampleMaterial.setVector2("_GaussianDownTextureSize", getTextureSize(downSampleTexture));
|
|
12855
|
+
renderer.blit(currentTexture, tempUp, this.upSampleMaterial);
|
|
12856
|
+
currentTexture = tempUp.getColorTextures()[0];
|
|
12857
|
+
this.tempRTs.push(tempUp);
|
|
12858
|
+
}
|
|
12859
|
+
// 设置最终输出到当前 framebuffer
|
|
12860
|
+
renderer.setFramebuffer(this.tempRTs[this.tempRTs.length - 1]);
|
|
12861
|
+
};
|
|
12862
|
+
_proto.onCameraCleanup = function onCameraCleanup(renderer) {
|
|
12863
|
+
// 释放所有临时 RT
|
|
12864
|
+
for(var i = 0; i < this.tempRTs.length; i++){
|
|
12865
|
+
renderer.releaseTemporaryRT(this.tempRTs[i]);
|
|
12866
|
+
}
|
|
12867
|
+
this.tempRTs = [];
|
|
13250
12868
|
};
|
|
13251
12869
|
_proto.dispose = function dispose(options) {
|
|
13252
|
-
this.
|
|
12870
|
+
this.thresholdMaterial.dispose();
|
|
12871
|
+
this.downSampleHMaterial.dispose();
|
|
12872
|
+
this.downSampleVMaterial.dispose();
|
|
12873
|
+
this.upSampleMaterial.dispose();
|
|
13253
12874
|
RenderPass.prototype.dispose.call(this, options);
|
|
13254
12875
|
};
|
|
13255
|
-
return
|
|
12876
|
+
return BloomPass;
|
|
13256
12877
|
}(RenderPass);
|
|
13257
12878
|
// 合并Bloom的高斯模糊结果,并应用ACES Tonemapping
|
|
13258
12879
|
var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
13259
12880
|
_inherits(ToneMappingPass, RenderPass);
|
|
13260
12881
|
function ToneMappingPass(renderer, sceneTextureHandle) {
|
|
13261
12882
|
var _this;
|
|
13262
|
-
_this = RenderPass.call(this, renderer
|
|
12883
|
+
_this = RenderPass.call(this, renderer) || this;
|
|
13263
12884
|
var name = "PostProcess";
|
|
13264
12885
|
var engine = _this.renderer.engine;
|
|
13265
12886
|
_this.sceneTextureHandle = sceneTextureHandle ? sceneTextureHandle : new RenderTargetHandle(engine);
|
|
@@ -13315,9 +12936,9 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
13315
12936
|
};
|
|
13316
12937
|
_proto.execute = function execute(renderer) {
|
|
13317
12938
|
renderer.clear({
|
|
13318
|
-
colorAction:
|
|
13319
|
-
depthAction:
|
|
13320
|
-
stencilAction:
|
|
12939
|
+
colorAction: TextureLoadAction.clear,
|
|
12940
|
+
depthAction: TextureLoadAction.clear,
|
|
12941
|
+
stencilAction: TextureLoadAction.clear
|
|
13321
12942
|
});
|
|
13322
12943
|
var globalVolume = renderer.renderingData.currentFrame.globalVolume;
|
|
13323
12944
|
var bloom = _extends({
|
|
@@ -13364,95 +12985,31 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
|
|
|
13364
12985
|
return ToneMappingPass;
|
|
13365
12986
|
}(RenderPass);
|
|
13366
12987
|
|
|
13367
|
-
var SemanticMap = /*#__PURE__*/ function() {
|
|
13368
|
-
function SemanticMap(semantics) {
|
|
13369
|
-
if (semantics === void 0) semantics = {};
|
|
13370
|
-
this.semantics = _extends({}, semantics);
|
|
13371
|
-
}
|
|
13372
|
-
var _proto = SemanticMap.prototype;
|
|
13373
|
-
_proto.toObject = function toObject() {
|
|
13374
|
-
return _extends({}, this.semantics);
|
|
13375
|
-
};
|
|
13376
|
-
_proto.setSemantic = function setSemantic(name, value) {
|
|
13377
|
-
if (value === undefined) {
|
|
13378
|
-
delete this.semantics[name];
|
|
13379
|
-
} else {
|
|
13380
|
-
this.semantics[name] = value;
|
|
13381
|
-
}
|
|
13382
|
-
};
|
|
13383
|
-
_proto.getSemanticValue = function getSemanticValue(name, state) {
|
|
13384
|
-
var ret = this.semantics[name];
|
|
13385
|
-
if (isFunction(ret)) {
|
|
13386
|
-
return ret(state);
|
|
13387
|
-
}
|
|
13388
|
-
return ret;
|
|
13389
|
-
};
|
|
13390
|
-
_proto.hasSemanticValue = function hasSemanticValue(name) {
|
|
13391
|
-
return name in this.semantics;
|
|
13392
|
-
};
|
|
13393
|
-
_proto.dispose = function dispose() {
|
|
13394
|
-
var _this = this;
|
|
13395
|
-
Object.keys(this.semantics).forEach(function(name) {
|
|
13396
|
-
delete _this.semantics[name];
|
|
13397
|
-
});
|
|
13398
|
-
};
|
|
13399
|
-
return SemanticMap;
|
|
13400
|
-
}();
|
|
13401
|
-
|
|
13402
|
-
var RENDER_PASS_NAME_PREFIX = "_effects_default_";
|
|
13403
12988
|
var seed$5 = 1;
|
|
13404
12989
|
/**
|
|
13405
12990
|
* RenderFrame 抽象类
|
|
13406
12991
|
*/ var RenderFrame = /*#__PURE__*/ function() {
|
|
13407
12992
|
function RenderFrame(options) {
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
this.
|
|
13411
|
-
|
|
13412
|
-
this.renderPassInfoMap = new WeakMap();
|
|
13413
|
-
var camera = options.camera, keepColorBuffer = options.keepColorBuffer, renderer = options.renderer, _options_editorTransform = options.editorTransform, editorTransform = _options_editorTransform === void 0 ? [
|
|
12993
|
+
this.disposed = false;
|
|
12994
|
+
this.postProcessingEnabled = false;
|
|
12995
|
+
this.enableHDR = true;
|
|
12996
|
+
var camera = options.camera, renderer = options.renderer, _options_editorTransform = options.editorTransform, editorTransform = _options_editorTransform === void 0 ? [
|
|
13414
12997
|
1,
|
|
13415
12998
|
1,
|
|
13416
12999
|
0,
|
|
13417
13000
|
0
|
|
13418
|
-
] : _options_editorTransform, globalVolume = options.globalVolume, _options_postProcessingEnabled = options.postProcessingEnabled, postProcessingEnabled = _options_postProcessingEnabled === void 0 ? false : _options_postProcessingEnabled
|
|
13419
|
-
colorAction: TextureLoadAction.whatever,
|
|
13420
|
-
stencilAction: TextureLoadAction.clear,
|
|
13421
|
-
depthAction: TextureLoadAction.whatever
|
|
13422
|
-
} : _options_clearAction;
|
|
13001
|
+
] : _options_editorTransform, globalVolume = options.globalVolume, _options_postProcessingEnabled = options.postProcessingEnabled, postProcessingEnabled = _options_postProcessingEnabled === void 0 ? false : _options_postProcessingEnabled;
|
|
13423
13002
|
var engine = renderer.engine;
|
|
13424
13003
|
if (globalVolume) {
|
|
13425
13004
|
this.globalVolume = globalVolume;
|
|
13426
13005
|
}
|
|
13006
|
+
this.postProcessingEnabled = postProcessingEnabled;
|
|
13427
13007
|
this.globalUniforms = new GlobalUniforms();
|
|
13428
|
-
var attachments = []; //渲染场景物体Pass的RT
|
|
13429
|
-
var depthStencilAttachment;
|
|
13430
13008
|
this.renderer = renderer;
|
|
13431
|
-
if (postProcessingEnabled) {
|
|
13432
|
-
|
|
13433
|
-
if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
13434
|
-
throw new Error("Half float texture is not supported.");
|
|
13435
|
-
}
|
|
13436
|
-
// 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
|
|
13437
|
-
var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
13438
|
-
attachments = [
|
|
13439
|
-
{
|
|
13440
|
-
texture: {
|
|
13441
|
-
format: glContext.RGBA,
|
|
13442
|
-
type: textureType,
|
|
13443
|
-
magFilter: glContext.LINEAR,
|
|
13444
|
-
minFilter: glContext.LINEAR
|
|
13445
|
-
}
|
|
13446
|
-
}
|
|
13447
|
-
];
|
|
13448
|
-
depthStencilAttachment = {
|
|
13449
|
-
storageType: RenderPassAttachmentStorageType.depth_stencil_opaque
|
|
13450
|
-
};
|
|
13009
|
+
if (postProcessingEnabled && this.enableHDR && !this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
|
|
13010
|
+
throw new Error("Half float texture is not supported.");
|
|
13451
13011
|
}
|
|
13452
|
-
this.drawObjectPass = new DrawObjectPass(renderer
|
|
13453
|
-
depthStencilAttachment: depthStencilAttachment,
|
|
13454
|
-
attachments: attachments
|
|
13455
|
-
});
|
|
13012
|
+
this.drawObjectPass = new DrawObjectPass(renderer);
|
|
13456
13013
|
var renderPasses = [
|
|
13457
13014
|
this.drawObjectPass
|
|
13458
13015
|
];
|
|
@@ -13460,110 +13017,25 @@ var seed$5 = 1;
|
|
|
13460
13017
|
if (postProcessingEnabled) {
|
|
13461
13018
|
var sceneTextureHandle = new RenderTargetHandle(engine); //保存后处理前的屏幕图像
|
|
13462
13019
|
var gaussianStep = 7; // 高斯模糊的迭代次数,次数越高模糊范围越大
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
];
|
|
13469
|
-
var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
|
|
13470
|
-
var enableHDR1 = true;
|
|
13471
|
-
var textureType1 = enableHDR1 ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
|
|
13472
|
-
var bloomThresholdPass = new BloomThresholdPass(renderer, {
|
|
13473
|
-
attachments: [
|
|
13474
|
-
{
|
|
13475
|
-
texture: {
|
|
13476
|
-
format: glContext.RGBA,
|
|
13477
|
-
type: textureType1,
|
|
13478
|
-
minFilter: glContext.LINEAR,
|
|
13479
|
-
magFilter: glContext.LINEAR
|
|
13480
|
-
}
|
|
13481
|
-
}
|
|
13482
|
-
]
|
|
13483
|
-
});
|
|
13484
|
-
bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
|
|
13485
|
-
this.addRenderPass(bloomThresholdPass);
|
|
13486
|
-
for(var i = 0; i < gaussianStep; i++){
|
|
13487
|
-
gaussianDownResults[i] = new RenderTargetHandle(engine);
|
|
13488
|
-
var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i, {
|
|
13489
|
-
attachments: [
|
|
13490
|
-
{
|
|
13491
|
-
texture: {
|
|
13492
|
-
format: glContext.RGBA,
|
|
13493
|
-
type: textureType1,
|
|
13494
|
-
minFilter: glContext.LINEAR,
|
|
13495
|
-
magFilter: glContext.LINEAR
|
|
13496
|
-
}
|
|
13497
|
-
}
|
|
13498
|
-
]
|
|
13499
|
-
});
|
|
13500
|
-
var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i, {
|
|
13501
|
-
attachments: [
|
|
13502
|
-
{
|
|
13503
|
-
texture: {
|
|
13504
|
-
format: glContext.RGBA,
|
|
13505
|
-
type: textureType1,
|
|
13506
|
-
minFilter: glContext.LINEAR,
|
|
13507
|
-
magFilter: glContext.LINEAR
|
|
13508
|
-
}
|
|
13509
|
-
}
|
|
13510
|
-
]
|
|
13511
|
-
});
|
|
13512
|
-
gaussianDownVPass.gaussianResult = gaussianDownResults[i];
|
|
13513
|
-
this.addRenderPass(gaussianDownHPass);
|
|
13514
|
-
this.addRenderPass(gaussianDownVPass);
|
|
13515
|
-
viewport[2] /= 2;
|
|
13516
|
-
viewport[3] /= 2;
|
|
13517
|
-
// TODO 限制最大迭代
|
|
13518
|
-
}
|
|
13519
|
-
viewport[2] *= 4;
|
|
13520
|
-
viewport[3] *= 4;
|
|
13521
|
-
for(var i1 = 0; i1 < gaussianStep - 1; i1++){
|
|
13522
|
-
var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1, {
|
|
13523
|
-
attachments: [
|
|
13524
|
-
{
|
|
13525
|
-
texture: {
|
|
13526
|
-
format: glContext.RGBA,
|
|
13527
|
-
type: textureType1,
|
|
13528
|
-
minFilter: glContext.LINEAR,
|
|
13529
|
-
magFilter: glContext.LINEAR
|
|
13530
|
-
}
|
|
13531
|
-
}
|
|
13532
|
-
]
|
|
13533
|
-
});
|
|
13534
|
-
gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
|
|
13535
|
-
this.addRenderPass(gaussianUpPass);
|
|
13536
|
-
viewport[2] *= 2;
|
|
13537
|
-
viewport[3] *= 2;
|
|
13538
|
-
}
|
|
13020
|
+
// Bloom Pass(包含阈值提取、高斯模糊)
|
|
13021
|
+
var bloomPass = new BloomPass(renderer, gaussianStep);
|
|
13022
|
+
bloomPass.sceneTextureHandle = sceneTextureHandle;
|
|
13023
|
+
this.addRenderPass(bloomPass);
|
|
13024
|
+
// Tone Mapping Pass
|
|
13539
13025
|
var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
|
|
13540
13026
|
this.addRenderPass(postProcessPass);
|
|
13541
13027
|
}
|
|
13542
|
-
this.semantics = new SemanticMap(options.semantics);
|
|
13543
|
-
this.clearAction = clearAction;
|
|
13544
13028
|
this.name = "RenderFrame" + seed$5++;
|
|
13545
|
-
var firstRP = renderPasses[0];
|
|
13546
13029
|
this.camera = camera;
|
|
13547
|
-
this.keepColorBuffer = keepColorBuffer;
|
|
13548
|
-
this.renderPassInfoMap.set(firstRP, {
|
|
13549
|
-
listStart: 0,
|
|
13550
|
-
listEnd: 0,
|
|
13551
|
-
renderPass: firstRP,
|
|
13552
|
-
intermedia: false
|
|
13553
|
-
});
|
|
13554
13030
|
this.editorTransform = Vector4.fromArray(editorTransform);
|
|
13555
|
-
if (!options.clearAction) {
|
|
13556
|
-
this.resetClearActions();
|
|
13557
|
-
}
|
|
13558
|
-
this.passTextureCache = new PassTextureCache(engine);
|
|
13559
|
-
// FIXME: addShader是为了性能考虑,如果影响不大,下面代码可以删除
|
|
13560
|
-
var _engine_gpuCapability = engine.gpuCapability, detail = _engine_gpuCapability.detail, level = _engine_gpuCapability.level;
|
|
13561
|
-
var writeDepth = detail.readableDepthStencilTextures && detail.writableFragDepth;
|
|
13562
|
-
var shader = createCopyShader(level, writeDepth);
|
|
13563
|
-
(_this_renderer_getShaderLibrary = this.renderer.getShaderLibrary()) == null ? void 0 : _this_renderer_getShaderLibrary.addShader(shader);
|
|
13564
13031
|
}
|
|
13565
13032
|
var _proto = RenderFrame.prototype;
|
|
13566
13033
|
/**
|
|
13034
|
+
* 设置 RenderPasses 参数,此函数每帧调用一次
|
|
13035
|
+
*/ _proto.setup = function setup() {
|
|
13036
|
+
this.drawObjectPass.setup(this.postProcessingEnabled);
|
|
13037
|
+
};
|
|
13038
|
+
/**
|
|
13567
13039
|
* 根据 Mesh 优先级添加到 RenderPass
|
|
13568
13040
|
* @param mesh - 要添加的 Mesh 对象
|
|
13569
13041
|
*/ _proto.addMeshToDefaultRenderPass = function addMeshToDefaultRenderPass(mesh) {
|
|
@@ -13580,78 +13052,25 @@ var seed$5 = 1;
|
|
|
13580
13052
|
* 销毁 RenderFrame
|
|
13581
13053
|
* @param options - 可以有选择销毁一些对象
|
|
13582
13054
|
*/ _proto.dispose = function dispose(options) {
|
|
13583
|
-
if ((options == null ? void 0 : options.semantics) !== DestroyOptions.keep) {
|
|
13584
|
-
this.semantics.dispose();
|
|
13585
|
-
}
|
|
13586
13055
|
var pass = (options == null ? void 0 : options.passes) ? options.passes : undefined;
|
|
13587
13056
|
if (pass !== DestroyOptions.keep) {
|
|
13588
13057
|
this._renderPasses.forEach(function(renderPass) {
|
|
13589
13058
|
renderPass.dispose(pass);
|
|
13590
13059
|
});
|
|
13591
13060
|
}
|
|
13592
|
-
this.passTextureCache.dispose();
|
|
13593
13061
|
this._renderPasses.length = 0;
|
|
13594
|
-
this.
|
|
13595
|
-
};
|
|
13596
|
-
/**
|
|
13597
|
-
* 查找 Mesh 所在的 RenderPass 索引,没找到是-1
|
|
13598
|
-
* @param mesh - 需要查找的 Mesh
|
|
13599
|
-
*/ _proto.findMeshRenderPassIndex = function findMeshRenderPassIndex(mesh) {
|
|
13600
|
-
var index = -1;
|
|
13601
|
-
this.renderPasses.every(function(rp, idx) {
|
|
13602
|
-
if (rp.name.startsWith(RENDER_PASS_NAME_PREFIX) && rp.meshes.includes(mesh)) {
|
|
13603
|
-
index = idx;
|
|
13604
|
-
return false;
|
|
13605
|
-
}
|
|
13606
|
-
return true;
|
|
13607
|
-
});
|
|
13608
|
-
return index;
|
|
13609
|
-
};
|
|
13610
|
-
_proto.addToRenderPass = function addToRenderPass(renderPass, mesh) {
|
|
13611
|
-
var info = this.renderPassInfoMap.get(renderPass);
|
|
13612
|
-
var priority = mesh.priority;
|
|
13613
|
-
if (!info) {
|
|
13614
|
-
return;
|
|
13615
|
-
}
|
|
13616
|
-
if (renderPass.meshes.length === 0) {
|
|
13617
|
-
info.listStart = info.listEnd = priority;
|
|
13618
|
-
} else {
|
|
13619
|
-
if (priority < info.listStart) {
|
|
13620
|
-
info.listStart = priority;
|
|
13621
|
-
} else if (priority > info.listEnd) {
|
|
13622
|
-
info.listEnd = priority;
|
|
13623
|
-
}
|
|
13624
|
-
}
|
|
13625
|
-
renderPass.addMesh(mesh);
|
|
13626
|
-
};
|
|
13627
|
-
_proto.resetClearActions = function resetClearActions() {
|
|
13628
|
-
var action = this.renderPasses.length > 1 ? TextureLoadAction.clear : TextureLoadAction.whatever;
|
|
13629
|
-
this.clearAction.stencilAction = action;
|
|
13630
|
-
this.clearAction.depthAction = action;
|
|
13631
|
-
this.clearAction.colorAction = action;
|
|
13632
|
-
if (this.keepColorBuffer) {
|
|
13633
|
-
this.clearAction.colorAction = TextureLoadAction.whatever;
|
|
13634
|
-
}
|
|
13062
|
+
this.disposed = true;
|
|
13635
13063
|
};
|
|
13636
13064
|
/**
|
|
13637
13065
|
* 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
|
|
13638
13066
|
* @param passes - RenderPass 数组
|
|
13639
13067
|
*/ _proto.setRenderPasses = function setRenderPasses(passes) {
|
|
13640
|
-
var _this = this;
|
|
13641
|
-
if (this.renderer !== undefined) {
|
|
13642
|
-
passes.forEach(function(pass) {
|
|
13643
|
-
return pass.initialize(_this.renderer);
|
|
13644
|
-
});
|
|
13645
|
-
}
|
|
13646
13068
|
this._renderPasses = passes.slice();
|
|
13647
13069
|
};
|
|
13648
13070
|
/**
|
|
13649
13071
|
* 添加 RenderPass
|
|
13650
13072
|
* @param pass - 需要添加的 RenderPass
|
|
13651
13073
|
*/ _proto.addRenderPass = function addRenderPass(pass) {
|
|
13652
|
-
if (this.renderer !== undefined) {
|
|
13653
|
-
pass.initialize(this.renderer);
|
|
13654
|
-
}
|
|
13655
13074
|
this._renderPasses.push(pass);
|
|
13656
13075
|
};
|
|
13657
13076
|
/**
|
|
@@ -13668,9 +13087,9 @@ var seed$5 = 1;
|
|
|
13668
13087
|
}
|
|
13669
13088
|
},
|
|
13670
13089
|
{
|
|
13671
|
-
key: "
|
|
13090
|
+
key: "isDisposed",
|
|
13672
13091
|
get: function get() {
|
|
13673
|
-
return this.
|
|
13092
|
+
return this.disposed;
|
|
13674
13093
|
}
|
|
13675
13094
|
}
|
|
13676
13095
|
]);
|
|
@@ -13679,10 +13098,6 @@ var seed$5 = 1;
|
|
|
13679
13098
|
function getTextureSize(tex) {
|
|
13680
13099
|
return tex ? new Vector2(tex.getWidth(), tex.getHeight()) : new Vector2();
|
|
13681
13100
|
}
|
|
13682
|
-
function findPreviousRenderPass(renderPasses, renderPass) {
|
|
13683
|
-
var index = renderPasses.indexOf(renderPass);
|
|
13684
|
-
return renderPasses[index - 1];
|
|
13685
|
-
}
|
|
13686
13101
|
var GlobalUniforms = function GlobalUniforms() {
|
|
13687
13102
|
this.floats = {};
|
|
13688
13103
|
this.ints = {};
|
|
@@ -13720,6 +13135,122 @@ var Renderbuffer = /*#__PURE__*/ function() {
|
|
|
13720
13135
|
return Renderbuffer;
|
|
13721
13136
|
}();
|
|
13722
13137
|
|
|
13138
|
+
var RenderTargetPool = /*#__PURE__*/ function() {
|
|
13139
|
+
function RenderTargetPool(engine) {
|
|
13140
|
+
this.engine = engine;
|
|
13141
|
+
this.temporaryRTs = [];
|
|
13142
|
+
this.currentFrame = 0;
|
|
13143
|
+
this.maxUnusedFrames = 4;
|
|
13144
|
+
}
|
|
13145
|
+
var _proto = RenderTargetPool.prototype;
|
|
13146
|
+
/**
|
|
13147
|
+
* 清理 RenderTarget 池
|
|
13148
|
+
* @param force - 是否强制清理所有未占用的 RT
|
|
13149
|
+
* @param framesOffset - 自定义未使用帧数阈值,-1 表示使用默认值
|
|
13150
|
+
*/ _proto.flush = function flush(force, framesOffset) {
|
|
13151
|
+
if (force === void 0) force = false;
|
|
13152
|
+
if (framesOffset === void 0) framesOffset = -1;
|
|
13153
|
+
this.currentFrame++;
|
|
13154
|
+
var threshold = framesOffset >= 0 ? framesOffset : this.maxUnusedFrames;
|
|
13155
|
+
for(var i = 0; i < this.temporaryRTs.length; i++){
|
|
13156
|
+
var entry = this.temporaryRTs[i];
|
|
13157
|
+
// 强制清理所有未占用的 RT,或清理超过阈值帧数未使用的 RT
|
|
13158
|
+
if (!entry.isOccupied && (force || this.currentFrame - entry.lastFrameReleased > threshold)) {
|
|
13159
|
+
entry.RT.dispose();
|
|
13160
|
+
this.temporaryRTs.splice(i--, 1);
|
|
13161
|
+
}
|
|
13162
|
+
}
|
|
13163
|
+
};
|
|
13164
|
+
_proto.get = function get(name, width, height, depthBuffer, filter, format) {
|
|
13165
|
+
if (depthBuffer === void 0) depthBuffer = 0;
|
|
13166
|
+
if (filter === void 0) filter = FilterMode.Linear;
|
|
13167
|
+
if (format === void 0) format = RenderTextureFormat.RGBA32;
|
|
13168
|
+
// 使用参数计算 hash 值作为缓存 key
|
|
13169
|
+
var hash = width + "_" + height + "_" + depthBuffer + "_" + filter + "_" + format;
|
|
13170
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.temporaryRTs), _step; !(_step = _iterator()).done;){
|
|
13171
|
+
var entry = _step.value;
|
|
13172
|
+
if (!entry.isOccupied && entry.descriptionHash === hash) {
|
|
13173
|
+
entry.isOccupied = true;
|
|
13174
|
+
entry.RT.name = name;
|
|
13175
|
+
return entry.RT;
|
|
13176
|
+
}
|
|
13177
|
+
}
|
|
13178
|
+
var textureFilter;
|
|
13179
|
+
var textureType;
|
|
13180
|
+
var depthType = RenderPassAttachmentStorageType.none;
|
|
13181
|
+
// TODO 建立Map映射
|
|
13182
|
+
if (filter === FilterMode.Linear) {
|
|
13183
|
+
textureFilter = glContext.LINEAR;
|
|
13184
|
+
} else if (filter === FilterMode.Nearest) {
|
|
13185
|
+
textureFilter = glContext.NEAREST;
|
|
13186
|
+
}
|
|
13187
|
+
if (format === RenderTextureFormat.RGBA32) {
|
|
13188
|
+
textureType = glContext.UNSIGNED_BYTE;
|
|
13189
|
+
} else if (format === RenderTextureFormat.RGBAHalf) {
|
|
13190
|
+
textureType = glContext.HALF_FLOAT;
|
|
13191
|
+
}
|
|
13192
|
+
if (depthBuffer === 0) {
|
|
13193
|
+
depthType = RenderPassAttachmentStorageType.none;
|
|
13194
|
+
} else if (depthBuffer === 16) {
|
|
13195
|
+
depthType = RenderPassAttachmentStorageType.depth_stencil_opaque;
|
|
13196
|
+
} else if (depthBuffer === 24) {
|
|
13197
|
+
depthType = RenderPassAttachmentStorageType.depth_24_stencil_8_texture;
|
|
13198
|
+
}
|
|
13199
|
+
var colorAttachment = Texture.create(this.engine, {
|
|
13200
|
+
sourceType: TextureSourceType.framebuffer,
|
|
13201
|
+
minFilter: textureFilter,
|
|
13202
|
+
magFilter: textureFilter,
|
|
13203
|
+
internalFormat: glContext.RGBA,
|
|
13204
|
+
format: glContext.RGBA,
|
|
13205
|
+
type: textureType
|
|
13206
|
+
});
|
|
13207
|
+
var newFramebuffer = Framebuffer.create({
|
|
13208
|
+
name: name,
|
|
13209
|
+
storeAction: {},
|
|
13210
|
+
viewport: [
|
|
13211
|
+
0,
|
|
13212
|
+
0,
|
|
13213
|
+
width,
|
|
13214
|
+
height
|
|
13215
|
+
],
|
|
13216
|
+
attachments: [
|
|
13217
|
+
colorAttachment
|
|
13218
|
+
],
|
|
13219
|
+
depthStencilAttachment: {
|
|
13220
|
+
storageType: depthType
|
|
13221
|
+
}
|
|
13222
|
+
}, this.engine.renderer);
|
|
13223
|
+
var entry1 = {
|
|
13224
|
+
RT: newFramebuffer,
|
|
13225
|
+
lastFrameReleased: 0,
|
|
13226
|
+
descriptionHash: hash,
|
|
13227
|
+
isOccupied: true
|
|
13228
|
+
};
|
|
13229
|
+
this.temporaryRTs.push(entry1);
|
|
13230
|
+
return entry1.RT;
|
|
13231
|
+
};
|
|
13232
|
+
/**
|
|
13233
|
+
* 释放 RenderTarget,使其可以被复用
|
|
13234
|
+
* @param rt - 要释放的 Framebuffer
|
|
13235
|
+
*/ _proto.release = function release(rt) {
|
|
13236
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.temporaryRTs), _step; !(_step = _iterator()).done;){
|
|
13237
|
+
var entry = _step.value;
|
|
13238
|
+
if (entry.RT === rt) {
|
|
13239
|
+
entry.isOccupied = false;
|
|
13240
|
+
entry.lastFrameReleased = this.currentFrame;
|
|
13241
|
+
break;
|
|
13242
|
+
}
|
|
13243
|
+
}
|
|
13244
|
+
};
|
|
13245
|
+
_proto.dispose = function dispose() {
|
|
13246
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.temporaryRTs), _step; !(_step = _iterator()).done;){
|
|
13247
|
+
var entry = _step.value;
|
|
13248
|
+
entry.RT.dispose();
|
|
13249
|
+
}
|
|
13250
|
+
};
|
|
13251
|
+
return RenderTargetPool;
|
|
13252
|
+
}();
|
|
13253
|
+
|
|
13723
13254
|
var isWebGL2Available = typeof WebGL2RenderingContext === "function";
|
|
13724
13255
|
var GPUCapability = /*#__PURE__*/ function() {
|
|
13725
13256
|
function GPUCapability(gl) {
|
|
@@ -13905,70 +13436,11 @@ var CompressTextureCapabilityType;
|
|
|
13905
13436
|
return !!hasCompressedTextureSupport;
|
|
13906
13437
|
}
|
|
13907
13438
|
|
|
13908
|
-
var FilterMode;
|
|
13909
|
-
(function(FilterMode) {
|
|
13910
|
-
FilterMode[FilterMode["Nearest"] = 0] = "Nearest";
|
|
13911
|
-
FilterMode[FilterMode["Linear"] = 1] = "Linear";
|
|
13912
|
-
})(FilterMode || (FilterMode = {}));
|
|
13913
|
-
var RenderTextureFormat;
|
|
13914
|
-
(function(RenderTextureFormat) {
|
|
13915
|
-
RenderTextureFormat[RenderTextureFormat["RGBA32"] = 0] = "RGBA32";
|
|
13916
|
-
RenderTextureFormat[RenderTextureFormat["RGBAHalf"] = 1] = "RGBAHalf";
|
|
13917
|
-
})(RenderTextureFormat || (RenderTextureFormat = {}));
|
|
13918
|
-
/**
|
|
13919
|
-
*
|
|
13920
|
-
*/ var Framebuffer = /*#__PURE__*/ function() {
|
|
13921
|
-
function Framebuffer() {}
|
|
13922
|
-
var _proto = Framebuffer.prototype;
|
|
13923
|
-
_proto.resize = function resize(x, y, width, height) {
|
|
13924
|
-
// OVERRIDE
|
|
13925
|
-
};
|
|
13926
|
-
_proto.resetColorTextures = function resetColorTextures(textures) {
|
|
13927
|
-
// OVERRIDE
|
|
13928
|
-
};
|
|
13929
|
-
_proto.unbind = function unbind() {
|
|
13930
|
-
// OVERRIDE
|
|
13931
|
-
};
|
|
13932
|
-
_proto.bind = function bind() {
|
|
13933
|
-
// OVERRIDE
|
|
13934
|
-
};
|
|
13935
|
-
_proto.getDepthTexture = function getDepthTexture() {
|
|
13936
|
-
// OVERRIDE
|
|
13937
|
-
return undefined;
|
|
13938
|
-
};
|
|
13939
|
-
_proto.getStencilTexture = function getStencilTexture() {
|
|
13940
|
-
// OVERRIDE
|
|
13941
|
-
return undefined;
|
|
13942
|
-
};
|
|
13943
|
-
_proto.getColorTextures = function getColorTextures() {
|
|
13944
|
-
// OVERRIDE
|
|
13945
|
-
return [];
|
|
13946
|
-
};
|
|
13947
|
-
_proto.dispose = function dispose(options) {
|
|
13948
|
-
// OVERRIDE
|
|
13949
|
-
};
|
|
13950
|
-
_create_class(Framebuffer, [
|
|
13951
|
-
{
|
|
13952
|
-
key: "stencilStorage",
|
|
13953
|
-
get: function get() {
|
|
13954
|
-
// OVERRIDE
|
|
13955
|
-
return undefined;
|
|
13956
|
-
}
|
|
13957
|
-
},
|
|
13958
|
-
{
|
|
13959
|
-
key: "depthStorage",
|
|
13960
|
-
get: function get() {
|
|
13961
|
-
// OVERRIDE
|
|
13962
|
-
return undefined;
|
|
13963
|
-
}
|
|
13964
|
-
}
|
|
13965
|
-
]);
|
|
13966
|
-
return Framebuffer;
|
|
13967
|
-
}();
|
|
13968
|
-
|
|
13969
13439
|
var Renderer = /*#__PURE__*/ function() {
|
|
13970
13440
|
function Renderer(engine) {
|
|
13971
13441
|
this.engine = engine;
|
|
13442
|
+
this.currentFramebuffer = null;
|
|
13443
|
+
this.renderTargetPool = new RenderTargetPool(engine);
|
|
13972
13444
|
}
|
|
13973
13445
|
var _proto = Renderer.prototype;
|
|
13974
13446
|
_proto.setGlobalFloat = function setGlobalFloat(name, value) {
|
|
@@ -14038,8 +13510,18 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14038
13510
|
// OVERRIDE
|
|
14039
13511
|
};
|
|
14040
13512
|
_proto.getTemporaryRT = function getTemporaryRT(name, width, height, depthBuffer, filter, format) {
|
|
14041
|
-
|
|
14042
|
-
|
|
13513
|
+
return this.renderTargetPool.get(name, width, height, depthBuffer, filter, format);
|
|
13514
|
+
};
|
|
13515
|
+
_proto.releaseTemporaryRT = function releaseTemporaryRT(rt) {
|
|
13516
|
+
this.renderTargetPool.release(rt);
|
|
13517
|
+
};
|
|
13518
|
+
/**
|
|
13519
|
+
* 将源纹理复制到目标 Framebuffer,可使用自定义材质进行处理
|
|
13520
|
+
* @param source - 源纹理
|
|
13521
|
+
* @param destination - 目标 Framebuffer,如果为 null 则渲染到屏幕
|
|
13522
|
+
* @param material - 可选的自定义材质,不传则使用默认复制材质
|
|
13523
|
+
*/ _proto.blit = function blit(source, destination, material) {
|
|
13524
|
+
// OVERRIDE
|
|
14043
13525
|
};
|
|
14044
13526
|
_proto.dispose = function dispose() {
|
|
14045
13527
|
// OVERRIDE
|
|
@@ -14047,6 +13529,41 @@ var Renderer = /*#__PURE__*/ function() {
|
|
|
14047
13529
|
return Renderer;
|
|
14048
13530
|
}();
|
|
14049
13531
|
|
|
13532
|
+
var SemanticMap = /*#__PURE__*/ function() {
|
|
13533
|
+
function SemanticMap(semantics) {
|
|
13534
|
+
if (semantics === void 0) semantics = {};
|
|
13535
|
+
this.semantics = _extends({}, semantics);
|
|
13536
|
+
}
|
|
13537
|
+
var _proto = SemanticMap.prototype;
|
|
13538
|
+
_proto.toObject = function toObject() {
|
|
13539
|
+
return _extends({}, this.semantics);
|
|
13540
|
+
};
|
|
13541
|
+
_proto.setSemantic = function setSemantic(name, value) {
|
|
13542
|
+
if (value === undefined) {
|
|
13543
|
+
delete this.semantics[name];
|
|
13544
|
+
} else {
|
|
13545
|
+
this.semantics[name] = value;
|
|
13546
|
+
}
|
|
13547
|
+
};
|
|
13548
|
+
_proto.getSemanticValue = function getSemanticValue(name, state) {
|
|
13549
|
+
var ret = this.semantics[name];
|
|
13550
|
+
if (isFunction(ret)) {
|
|
13551
|
+
return ret(state);
|
|
13552
|
+
}
|
|
13553
|
+
return ret;
|
|
13554
|
+
};
|
|
13555
|
+
_proto.hasSemanticValue = function hasSemanticValue(name) {
|
|
13556
|
+
return name in this.semantics;
|
|
13557
|
+
};
|
|
13558
|
+
_proto.dispose = function dispose() {
|
|
13559
|
+
var _this = this;
|
|
13560
|
+
Object.keys(this.semantics).forEach(function(name) {
|
|
13561
|
+
delete _this.semantics[name];
|
|
13562
|
+
});
|
|
13563
|
+
};
|
|
13564
|
+
return SemanticMap;
|
|
13565
|
+
}();
|
|
13566
|
+
|
|
14050
13567
|
/**
|
|
14051
13568
|
* @since 2.7.0
|
|
14052
13569
|
*/ var MaskableGraphic = /*#__PURE__*/ function(RendererComponent) {
|
|
@@ -18077,6 +17594,11 @@ var PlayState;
|
|
|
18077
17594
|
PlayState[PlayState["Paused"] = 1] = "Paused";
|
|
18078
17595
|
})(PlayState || (PlayState = {}));
|
|
18079
17596
|
|
|
17597
|
+
function _assert_this_initialized(self) {
|
|
17598
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
17599
|
+
return self;
|
|
17600
|
+
}
|
|
17601
|
+
|
|
18080
17602
|
var tempQuat$1 = new Quaternion();
|
|
18081
17603
|
var tempVector3 = new Vector3();
|
|
18082
17604
|
var tempVector3Second = new Vector3();
|
|
@@ -24454,8 +23976,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24454
23976
|
_this.reusable = reusable;
|
|
24455
23977
|
_this.speed = speed;
|
|
24456
23978
|
_this.name = sourceContent.name;
|
|
24457
|
-
_this
|
|
24458
|
-
_this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
23979
|
+
PluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
|
|
24459
23980
|
_this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
|
|
24460
23981
|
aspect: width / height,
|
|
24461
23982
|
pixelWidth: width,
|
|
@@ -24469,7 +23990,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24469
23990
|
_this.createRenderFrame();
|
|
24470
23991
|
Composition.buildItemTree(_this.rootItem);
|
|
24471
23992
|
_this.rootComposition.setChildrenRenderOrder(0);
|
|
24472
|
-
_this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
|
|
24473
23993
|
return _this;
|
|
24474
23994
|
}
|
|
24475
23995
|
var _proto = Composition.prototype;
|
|
@@ -24579,12 +24099,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24579
24099
|
this.renderFrame = new RenderFrame({
|
|
24580
24100
|
camera: this.camera,
|
|
24581
24101
|
renderer: this.renderer,
|
|
24582
|
-
keepColorBuffer: this.keepColorBuffer,
|
|
24583
24102
|
globalVolume: this.globalVolume,
|
|
24584
24103
|
postProcessingEnabled: this.postProcessingEnabled
|
|
24585
24104
|
});
|
|
24586
|
-
// TODO 考虑放到构造函数
|
|
24587
|
-
this.renderFrame.cachedTextures = this.textures;
|
|
24588
24105
|
};
|
|
24589
24106
|
/**
|
|
24590
24107
|
* 跳到指定时间点(不做任何播放行为)
|
|
@@ -24635,7 +24152,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24635
24152
|
this.isEnded = false;
|
|
24636
24153
|
this.isEndCalled = false;
|
|
24637
24154
|
this.rootComposition.time = 0;
|
|
24638
|
-
this.pluginSystem.resetComposition(this, this.renderFrame);
|
|
24639
24155
|
};
|
|
24640
24156
|
_proto.prepareRender = function prepareRender() {};
|
|
24641
24157
|
/**
|
|
@@ -24653,8 +24169,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24653
24169
|
var previousCompositionTime = this.time;
|
|
24654
24170
|
this.updateCompositionTime(deltaTime * this.speed / 1000);
|
|
24655
24171
|
var deltaTimeInMs = (this.time - previousCompositionTime) * 1000;
|
|
24656
|
-
// 更新 model-tree-plugin
|
|
24657
|
-
this.updatePluginLoaders(deltaTimeInMs);
|
|
24658
24172
|
this.sceneTicking.update.tick(deltaTimeInMs);
|
|
24659
24173
|
this.sceneTicking.lateUpdate.tick(deltaTimeInMs);
|
|
24660
24174
|
this.updateCamera();
|
|
@@ -24679,15 +24193,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24679
24193
|
this.camera.updateMatrix();
|
|
24680
24194
|
};
|
|
24681
24195
|
/**
|
|
24682
|
-
* 插件更新,来自 CompVFXItem 的更新调用
|
|
24683
|
-
* @param deltaTime - 更新的时间步长
|
|
24684
|
-
*/ _proto.updatePluginLoaders = function updatePluginLoaders(deltaTime) {
|
|
24685
|
-
var _this = this;
|
|
24686
|
-
this.pluginSystem.plugins.forEach(function(loader) {
|
|
24687
|
-
return loader.onCompositionUpdate(_this, deltaTime);
|
|
24688
|
-
});
|
|
24689
|
-
};
|
|
24690
|
-
/**
|
|
24691
24196
|
* 更新主合成组件
|
|
24692
24197
|
*/ _proto.updateCompositionTime = function updateCompositionTime(deltaTime) {
|
|
24693
24198
|
if (this.rootComposition.state === PlayState.Paused || !this.rootComposition.isActiveAndEnabled) {
|
|
@@ -24846,7 +24351,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24846
24351
|
* 合成对象销毁
|
|
24847
24352
|
*/ _proto.dispose = function dispose() {
|
|
24848
24353
|
var _this = this;
|
|
24849
|
-
var _this_pluginSystem;
|
|
24850
24354
|
if (this.destroyed) {
|
|
24851
24355
|
return;
|
|
24852
24356
|
}
|
|
@@ -24866,13 +24370,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24866
24370
|
this.rootItem.dispose();
|
|
24867
24371
|
// FIXME: 注意这里增加了renderFrame销毁
|
|
24868
24372
|
this.renderFrame.dispose();
|
|
24869
|
-
|
|
24373
|
+
PluginSystem.destroyComposition(this);
|
|
24870
24374
|
this.update = function() {
|
|
24871
24375
|
{
|
|
24872
24376
|
logger.error("Update disposed composition: " + _this.name + ".");
|
|
24873
24377
|
}
|
|
24874
24378
|
};
|
|
24875
24379
|
this.dispose = noop;
|
|
24380
|
+
this.renderer.engine.removeComposition(this);
|
|
24876
24381
|
if (this.getEngine().env === PLAYER_OPTIONS_ENV_EDITOR) {
|
|
24877
24382
|
return;
|
|
24878
24383
|
}
|
|
@@ -24889,7 +24394,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
24889
24394
|
0
|
|
24890
24395
|
]
|
|
24891
24396
|
});
|
|
24892
|
-
this.renderer.engine.removeComposition(this);
|
|
24893
24397
|
};
|
|
24894
24398
|
/**
|
|
24895
24399
|
* 编辑器使用的 transform 修改方法
|
|
@@ -31864,7 +31368,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31864
31368
|
return ret;
|
|
31865
31369
|
}
|
|
31866
31370
|
|
|
31867
|
-
var version$1 = "2.8.0-alpha.
|
|
31371
|
+
var version$1 = "2.8.0-alpha.3";
|
|
31868
31372
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31869
31373
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31870
31374
|
var reverseParticle = false;
|
|
@@ -32379,7 +31883,7 @@ var seed = 1;
|
|
|
32379
31883
|
* @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
|
|
32380
31884
|
* @param options - 扩展参数
|
|
32381
31885
|
* @returns
|
|
32382
|
-
*/ _proto.loadScene = function loadScene(url, renderer
|
|
31886
|
+
*/ _proto.loadScene = function loadScene(url, renderer) {
|
|
32383
31887
|
var _this = this;
|
|
32384
31888
|
return _async_to_generator(function() {
|
|
32385
31889
|
var rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_ktx2Support, isKTX2Supported, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
|
|
@@ -32440,7 +31944,7 @@ var seed = 1;
|
|
|
32440
31944
|
});
|
|
32441
31945
|
});
|
|
32442
31946
|
loadResourcePromise = /*#__PURE__*/ _async_to_generator(function() {
|
|
32443
|
-
var scene, link,
|
|
31947
|
+
var scene, link, _scene_bins, _scene_textureOptions, _scene_images, jsonScene, _jsonScene_bins, bins, images, fonts, _ref, loadedBins, loadedImages, loadedTextures, totalTime;
|
|
32444
31948
|
return __generator(this, function(_state) {
|
|
32445
31949
|
switch(_state.label){
|
|
32446
31950
|
case 0:
|
|
@@ -32490,7 +31994,26 @@ var seed = 1;
|
|
|
32490
31994
|
})
|
|
32491
31995
|
];
|
|
32492
31996
|
case 5:
|
|
32493
|
-
|
|
31997
|
+
jsonScene = _state.sent().jsonScene;
|
|
31998
|
+
scene = {
|
|
31999
|
+
timeInfos: timeInfos,
|
|
32000
|
+
url: url,
|
|
32001
|
+
storage: {},
|
|
32002
|
+
jsonScene: jsonScene,
|
|
32003
|
+
bins: [],
|
|
32004
|
+
textureOptions: [],
|
|
32005
|
+
textures: [],
|
|
32006
|
+
images: [],
|
|
32007
|
+
assets: _this.assets
|
|
32008
|
+
};
|
|
32009
|
+
return [
|
|
32010
|
+
4,
|
|
32011
|
+
hookTimeInfo("plugin:processAssets", function() {
|
|
32012
|
+
return _this.processPluginAssets(scene);
|
|
32013
|
+
})
|
|
32014
|
+
];
|
|
32015
|
+
case 6:
|
|
32016
|
+
_state.sent();
|
|
32494
32017
|
_jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
|
|
32495
32018
|
return [
|
|
32496
32019
|
4,
|
|
@@ -32501,46 +32024,26 @@ var seed = 1;
|
|
|
32501
32024
|
hookTimeInfo("processImages", function() {
|
|
32502
32025
|
return _this.processImages(images, isKTX2Supported);
|
|
32503
32026
|
}),
|
|
32504
|
-
hookTimeInfo("plugin:processAssets", function() {
|
|
32505
|
-
return _this.processPluginAssets(jsonScene, pluginSystem, options);
|
|
32506
|
-
}),
|
|
32507
32027
|
hookTimeInfo("processFontURL", function() {
|
|
32508
32028
|
return _this.processFontURL(fonts);
|
|
32509
32029
|
})
|
|
32510
32030
|
])
|
|
32511
32031
|
];
|
|
32512
|
-
case
|
|
32513
|
-
|
|
32032
|
+
case 7:
|
|
32033
|
+
_ref = _state.sent(), loadedBins = _ref[0], loadedImages = _ref[1];
|
|
32514
32034
|
return [
|
|
32515
32035
|
4,
|
|
32516
32036
|
hookTimeInfo("processTextures", function() {
|
|
32517
32037
|
return _this.processTextures(loadedImages, loadedBins, jsonScene);
|
|
32518
32038
|
})
|
|
32519
32039
|
];
|
|
32520
|
-
case 7:
|
|
32521
|
-
loadedTextures = _state.sent();
|
|
32522
|
-
scene = {
|
|
32523
|
-
timeInfos: timeInfos,
|
|
32524
|
-
url: url,
|
|
32525
|
-
renderLevel: _this.options.renderLevel,
|
|
32526
|
-
storage: {},
|
|
32527
|
-
pluginSystem: pluginSystem,
|
|
32528
|
-
jsonScene: jsonScene,
|
|
32529
|
-
bins: loadedBins,
|
|
32530
|
-
textureOptions: loadedTextures,
|
|
32531
|
-
textures: [],
|
|
32532
|
-
images: loadedImages,
|
|
32533
|
-
assets: _this.assets
|
|
32534
|
-
};
|
|
32535
|
-
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
32536
|
-
return [
|
|
32537
|
-
4,
|
|
32538
|
-
hookTimeInfo("plugin:prepareResource", function() {
|
|
32539
|
-
return pluginSystem.loadResources(scene, _this.options);
|
|
32540
|
-
})
|
|
32541
|
-
];
|
|
32542
32040
|
case 8:
|
|
32543
|
-
_state.sent();
|
|
32041
|
+
loadedTextures = _state.sent();
|
|
32042
|
+
(_scene_bins = scene.bins).push.apply(_scene_bins, [].concat(loadedBins));
|
|
32043
|
+
(_scene_textureOptions = scene.textureOptions).push.apply(_scene_textureOptions, [].concat(loadedTextures));
|
|
32044
|
+
(_scene_images = scene.images).push.apply(_scene_images, [].concat(loadedImages));
|
|
32045
|
+
// 降级插件会修改 this.options.renderLevel, 在 processPluginAssets 后赋值
|
|
32046
|
+
scene.renderLevel = _this.options.renderLevel;
|
|
32544
32047
|
_state.label = 9;
|
|
32545
32048
|
case 9:
|
|
32546
32049
|
totalTime = performance.now() - startTime;
|
|
@@ -32572,29 +32075,23 @@ var seed = 1;
|
|
|
32572
32075
|
return this.assets;
|
|
32573
32076
|
};
|
|
32574
32077
|
_proto.processJSON = function processJSON(json) {
|
|
32575
|
-
var _this = this;
|
|
32576
32078
|
return _async_to_generator(function() {
|
|
32577
|
-
var jsonScene, _jsonScene_plugins, plugins,
|
|
32079
|
+
var jsonScene, _jsonScene_plugins, plugins, _iterator, _step, customPluginName;
|
|
32578
32080
|
return __generator(this, function(_state) {
|
|
32579
|
-
|
|
32580
|
-
|
|
32581
|
-
|
|
32582
|
-
|
|
32583
|
-
|
|
32584
|
-
|
|
32585
|
-
|
|
32586
|
-
pluginSystem.processRawJSON(jsonScene, _this.options)
|
|
32587
|
-
];
|
|
32588
|
-
case 1:
|
|
32589
|
-
_state.sent();
|
|
32590
|
-
return [
|
|
32591
|
-
2,
|
|
32592
|
-
{
|
|
32593
|
-
jsonScene: jsonScene,
|
|
32594
|
-
pluginSystem: pluginSystem
|
|
32595
|
-
}
|
|
32596
|
-
];
|
|
32081
|
+
jsonScene = getStandardJSON(json);
|
|
32082
|
+
_jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
|
|
32083
|
+
for(_iterator = _create_for_of_iterator_helper_loose(plugins); !(_step = _iterator()).done;){
|
|
32084
|
+
customPluginName = _step.value;
|
|
32085
|
+
if (!pluginLoaderMap[customPluginName]) {
|
|
32086
|
+
throw new Error("The plugin '" + customPluginName + "' not found." + getPluginUsageInfo(customPluginName));
|
|
32087
|
+
}
|
|
32597
32088
|
}
|
|
32089
|
+
return [
|
|
32090
|
+
2,
|
|
32091
|
+
{
|
|
32092
|
+
jsonScene: jsonScene
|
|
32093
|
+
}
|
|
32094
|
+
];
|
|
32598
32095
|
});
|
|
32599
32096
|
})();
|
|
32600
32097
|
};
|
|
@@ -32800,30 +32297,18 @@ var seed = 1;
|
|
|
32800
32297
|
});
|
|
32801
32298
|
})();
|
|
32802
32299
|
};
|
|
32803
|
-
_proto.processPluginAssets = function processPluginAssets(
|
|
32300
|
+
_proto.processPluginAssets = function processPluginAssets(scene) {
|
|
32804
32301
|
var _this = this;
|
|
32805
32302
|
return _async_to_generator(function() {
|
|
32806
|
-
var pluginResult, _pluginResult_reduce, assets, loadedAssets, i;
|
|
32807
32303
|
return __generator(this, function(_state) {
|
|
32808
32304
|
switch(_state.label){
|
|
32809
32305
|
case 0:
|
|
32810
32306
|
return [
|
|
32811
32307
|
4,
|
|
32812
|
-
|
|
32308
|
+
PluginSystem.processAssets(scene, _this.options)
|
|
32813
32309
|
];
|
|
32814
32310
|
case 1:
|
|
32815
|
-
|
|
32816
|
-
_pluginResult_reduce = pluginResult.reduce(function(acc, cur) {
|
|
32817
|
-
acc.assets = acc.assets.concat(cur.assets);
|
|
32818
|
-
acc.loadedAssets = acc.loadedAssets.concat(cur.loadedAssets);
|
|
32819
|
-
return acc;
|
|
32820
|
-
}, {
|
|
32821
|
-
assets: [],
|
|
32822
|
-
loadedAssets: []
|
|
32823
|
-
}), assets = _pluginResult_reduce.assets, loadedAssets = _pluginResult_reduce.loadedAssets;
|
|
32824
|
-
for(i = 0; i < assets.length; i++){
|
|
32825
|
-
_this.assets[assets[i].id] = loadedAssets[i];
|
|
32826
|
-
}
|
|
32311
|
+
_state.sent();
|
|
32827
32312
|
return [
|
|
32828
32313
|
2
|
|
32829
32314
|
];
|
|
@@ -33250,7 +32735,6 @@ function _createTextureOptionsBySource() {
|
|
|
33250
32735
|
}
|
|
33251
32736
|
};
|
|
33252
32737
|
_proto.prepareAssets = function prepareAssets(scene, assets) {
|
|
33253
|
-
this.engine.clearResources();
|
|
33254
32738
|
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(assets)), _step; !(_step = _iterator()).done;){
|
|
33255
32739
|
var assetId = _step.value;
|
|
33256
32740
|
var asset = assets[assetId];
|
|
@@ -35162,8 +34646,9 @@ var DEFAULT_FPS = 60;
|
|
|
35162
34646
|
]
|
|
35163
34647
|
});
|
|
35164
34648
|
for(var i1 = 0; i1 < comps.length; i1++){
|
|
35165
|
-
!comps[i1].renderFrame.
|
|
34649
|
+
!comps[i1].renderFrame.isDisposed && this.renderer.renderRenderFrame(comps[i1].renderFrame);
|
|
35166
34650
|
}
|
|
34651
|
+
this.renderer.renderTargetPool.flush();
|
|
35167
34652
|
};
|
|
35168
34653
|
/**
|
|
35169
34654
|
* 将渲染器重新和父容器大小对齐
|
|
@@ -35409,6 +34894,95 @@ var DEFAULT_FPS = 60;
|
|
|
35409
34894
|
return Engine;
|
|
35410
34895
|
}(EventEmitter);
|
|
35411
34896
|
|
|
34897
|
+
var def = {
|
|
34898
|
+
format: glContext.RGBA,
|
|
34899
|
+
type: glContext.UNSIGNED_BYTE,
|
|
34900
|
+
minFilter: glContext.LINEAR,
|
|
34901
|
+
magFilter: glContext.LINEAR,
|
|
34902
|
+
wrapS: glContext.CLAMP_TO_EDGE,
|
|
34903
|
+
wrapT: glContext.CLAMP_TO_EDGE
|
|
34904
|
+
};
|
|
34905
|
+
var disposeSymbol = Symbol("dispose");
|
|
34906
|
+
var PassTextureCache = /*#__PURE__*/ function() {
|
|
34907
|
+
function PassTextureCache(engine) {
|
|
34908
|
+
this.textureCache = {};
|
|
34909
|
+
this.textureRef = {};
|
|
34910
|
+
this.engine = engine;
|
|
34911
|
+
}
|
|
34912
|
+
var _proto = PassTextureCache.prototype;
|
|
34913
|
+
_proto.requestColorAttachmentTexture = function requestColorAttachmentTexture(request) {
|
|
34914
|
+
var _this = this;
|
|
34915
|
+
var width = request.width, height = request.height, name = request.name;
|
|
34916
|
+
var options = {
|
|
34917
|
+
sourceType: TextureSourceType.framebuffer,
|
|
34918
|
+
data: {
|
|
34919
|
+
width: width,
|
|
34920
|
+
height: height
|
|
34921
|
+
},
|
|
34922
|
+
name: name
|
|
34923
|
+
};
|
|
34924
|
+
var keys = [
|
|
34925
|
+
name
|
|
34926
|
+
];
|
|
34927
|
+
Object.getOwnPropertyNames(def).forEach(function(name) {
|
|
34928
|
+
var _request_name;
|
|
34929
|
+
var value = (_request_name = request[name]) != null ? _request_name : def[name];
|
|
34930
|
+
options[name] = value;
|
|
34931
|
+
keys.push(name, value);
|
|
34932
|
+
});
|
|
34933
|
+
var cacheId = keys.join(":");
|
|
34934
|
+
var tex = this.textureCache[cacheId];
|
|
34935
|
+
if (tex) {
|
|
34936
|
+
this.textureRef[cacheId]++;
|
|
34937
|
+
} else {
|
|
34938
|
+
var engine = this.engine;
|
|
34939
|
+
assertExist(engine);
|
|
34940
|
+
tex = Texture.create(engine, options);
|
|
34941
|
+
this.textureCache[cacheId] = tex;
|
|
34942
|
+
this.textureRef[cacheId] = 1;
|
|
34943
|
+
// @ts-expect-error
|
|
34944
|
+
tex[disposeSymbol] = tex.dispose;
|
|
34945
|
+
tex.dispose = function() {
|
|
34946
|
+
return _this.removeTexture(cacheId);
|
|
34947
|
+
};
|
|
34948
|
+
}
|
|
34949
|
+
return tex;
|
|
34950
|
+
};
|
|
34951
|
+
_proto.removeTexture = function removeTexture(id) {
|
|
34952
|
+
var refCount = this.textureRef[id];
|
|
34953
|
+
if (refCount <= 1) {
|
|
34954
|
+
if (refCount < 0) {
|
|
34955
|
+
console.error("Ref count < 0.");
|
|
34956
|
+
}
|
|
34957
|
+
var tex = this.textureCache[id];
|
|
34958
|
+
if (tex) {
|
|
34959
|
+
// @ts-expect-error
|
|
34960
|
+
tex[disposeSymbol]();
|
|
34961
|
+
// @ts-expect-error
|
|
34962
|
+
tex.dispose = tex[disposeSymbol];
|
|
34963
|
+
}
|
|
34964
|
+
delete this.textureCache[id];
|
|
34965
|
+
delete this.textureRef[id];
|
|
34966
|
+
} else {
|
|
34967
|
+
this.textureRef[id] = refCount - 1;
|
|
34968
|
+
}
|
|
34969
|
+
};
|
|
34970
|
+
_proto.dispose = function dispose() {
|
|
34971
|
+
var _this = this;
|
|
34972
|
+
Object.keys(this.textureCache).forEach(function(key) {
|
|
34973
|
+
var texture = _this.textureCache[key];
|
|
34974
|
+
// @ts-expect-error
|
|
34975
|
+
texture[disposeSymbol]();
|
|
34976
|
+
// @ts-expect-error
|
|
34977
|
+
texture.dispose = texture[disposeSymbol];
|
|
34978
|
+
});
|
|
34979
|
+
this.textureCache = {};
|
|
34980
|
+
this.textureRef = {};
|
|
34981
|
+
this.engine = undefined;
|
|
34982
|
+
};
|
|
34983
|
+
return PassTextureCache;
|
|
34984
|
+
}();
|
|
34985
|
+
|
|
35412
34986
|
var SceneLoader = /*#__PURE__*/ function() {
|
|
35413
34987
|
function SceneLoader() {}
|
|
35414
34988
|
SceneLoader.load = function load(scene, engine, options) {
|
|
@@ -35427,16 +35001,16 @@ var SceneLoader = /*#__PURE__*/ function() {
|
|
|
35427
35001
|
engine.assetManagers.push(assetManager);
|
|
35428
35002
|
return [
|
|
35429
35003
|
4,
|
|
35430
|
-
assetManager.loadScene(scene, engine.renderer
|
|
35431
|
-
env: engine.env
|
|
35432
|
-
})
|
|
35004
|
+
assetManager.loadScene(scene, engine.renderer)
|
|
35433
35005
|
];
|
|
35434
35006
|
case 1:
|
|
35435
35007
|
loadedScene = _state.sent();
|
|
35008
|
+
engine.clearResources();
|
|
35009
|
+
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
35010
|
+
PluginSystem.loadResources(loadedScene, assetManager.options, engine);
|
|
35436
35011
|
engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
|
|
35437
35012
|
engine.assetService.updateTextVariables(loadedScene, options.variables);
|
|
35438
35013
|
engine.assetService.initializeTexture(loadedScene);
|
|
35439
|
-
loadedScene.pluginSystem.precompile(loadedScene.jsonScene.compositions, engine.renderer);
|
|
35440
35014
|
composition = _this.createComposition(loadedScene, engine, options);
|
|
35441
35015
|
composition.setIndex(compositionIndex);
|
|
35442
35016
|
compileStart = performance.now();
|
|
@@ -35489,14 +35063,14 @@ var SceneLoader = /*#__PURE__*/ function() {
|
|
|
35489
35063
|
return SceneLoader;
|
|
35490
35064
|
}();
|
|
35491
35065
|
|
|
35492
|
-
registerPlugin("camera", CameraVFXItemLoader
|
|
35493
|
-
registerPlugin("text", TextLoader
|
|
35494
|
-
registerPlugin("sprite", SpriteLoader
|
|
35495
|
-
registerPlugin("particle", ParticleLoader
|
|
35496
|
-
registerPlugin("cal", CalculateLoader
|
|
35497
|
-
registerPlugin("interact", InteractLoader
|
|
35498
|
-
var version = "2.8.0-alpha.
|
|
35066
|
+
registerPlugin("camera", CameraVFXItemLoader);
|
|
35067
|
+
registerPlugin("text", TextLoader);
|
|
35068
|
+
registerPlugin("sprite", SpriteLoader);
|
|
35069
|
+
registerPlugin("particle", ParticleLoader);
|
|
35070
|
+
registerPlugin("cal", CalculateLoader);
|
|
35071
|
+
registerPlugin("interact", InteractLoader);
|
|
35072
|
+
var version = "2.8.0-alpha.3";
|
|
35499
35073
|
logger.info("Core version: " + version + ".");
|
|
35500
35074
|
|
|
35501
|
-
export { AbstractPlugin, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, PropertyClipPlayable, PropertyTrack,
|
|
35075
|
+
export { AbstractPlugin, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, PropertyClipPlayable, PropertyTrack, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SourceType, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
35502
35076
|
//# sourceMappingURL=index.mjs.map
|