@galacean/effects-threejs 2.8.0-alpha.0 → 2.8.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.8.0-alpha.0
6
+ * Version: v2.8.0-alpha.2
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -35,41 +35,6 @@ function _async_to_generator(fn) {
35
35
  };
36
36
  }
37
37
 
38
- function _array_like_to_array(arr, len) {
39
- if (len == null || len > arr.length) len = arr.length;
40
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
41
- return arr2;
42
- }
43
-
44
- function _unsupported_iterable_to_array(o, minLen) {
45
- if (!o) return;
46
- if (typeof o === "string") return _array_like_to_array(o, minLen);
47
- var n = Object.prototype.toString.call(o).slice(8, -1);
48
- if (n === "Object" && o.constructor) n = o.constructor.name;
49
- if (n === "Map" || n === "Set") return Array.from(n);
50
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
51
- }
52
-
53
- function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
54
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
55
- if (it) return (it = it.call(o)).next.bind(it);
56
- // Fallback for engines without symbol support
57
- if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
58
- if (it) o = it;
59
- var i = 0;
60
- return function() {
61
- if (i >= o.length) return {
62
- done: true
63
- };
64
- return {
65
- done: false,
66
- value: o[i++]
67
- };
68
- };
69
- }
70
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
71
- }
72
-
73
38
  function _instanceof1(left, right) {
74
39
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
75
40
  return !!right[Symbol.hasInstance](left);
@@ -2902,134 +2867,68 @@ function applyMixins(derivedCtrl, baseCtrls) {
2902
2867
  }
2903
2868
 
2904
2869
  var pluginLoaderMap = {};
2905
- var defaultPlugins = [];
2906
- var pluginCtrlMap = {};
2870
+ var plugins = [];
2907
2871
  /**
2908
2872
  * 注册 plugin
2909
2873
  * @param name
2910
2874
  * @param pluginClass class of plugin
2911
2875
  * @param itemClass class of item
2912
2876
  * @param isDefault load
2913
- */ function registerPlugin(name, pluginClass, itemClass) {
2914
- if (pluginCtrlMap[name]) {
2877
+ */ function registerPlugin(name, pluginClass) {
2878
+ if (pluginLoaderMap[name]) {
2915
2879
  logger.error("Duplicate registration for plugin " + name + ".");
2916
2880
  }
2917
- pluginCtrlMap[name] = itemClass;
2918
2881
  pluginLoaderMap[name] = pluginClass;
2919
- addItem(defaultPlugins, name);
2882
+ var pluginInstance = new pluginClass();
2883
+ pluginInstance.name = name;
2884
+ pluginInstance.initialize();
2885
+ plugins.push(pluginInstance);
2886
+ plugins.sort(function(a, b) {
2887
+ return a.order - b.order;
2888
+ });
2920
2889
  }
2921
- function unregisterPlugin(name) {
2922
- delete pluginCtrlMap[name];
2890
+ /**
2891
+ * 注销 plugin
2892
+ */ function unregisterPlugin(name) {
2923
2893
  delete pluginLoaderMap[name];
2924
- removeItem(defaultPlugins, name);
2894
+ var pluginIndex = plugins.findIndex(function(plugin) {
2895
+ return plugin.name === name;
2896
+ });
2897
+ if (pluginIndex !== -1) {
2898
+ plugins.splice(pluginIndex, 1);
2899
+ }
2925
2900
  }
2926
2901
  var PluginSystem = /*#__PURE__*/ function() {
2927
- function PluginSystem(pluginNames) {
2928
- var loaders = {};
2929
- var loaded = [];
2930
- var addLoader = function(name) {
2931
- var loader = pluginLoaderMap[name];
2932
- if (!loaded.includes(loader)) {
2933
- loaded.push(loader);
2934
- loaders[name] = loader;
2935
- }
2936
- };
2937
- defaultPlugins.forEach(addLoader);
2938
- for(var _iterator = _create_for_of_iterator_helper_loose(pluginNames), _step; !(_step = _iterator()).done;){
2939
- var customPluginName = _step.value;
2940
- if (!pluginLoaderMap[customPluginName]) {
2941
- throw new Error("The plugin '" + customPluginName + "' not found." + getPluginUsageInfo(customPluginName));
2942
- }
2943
- }
2944
- this.plugins = Object.keys(loaders).map(function(name) {
2945
- var pluginConstructor = pluginLoaderMap[name];
2946
- var loader = new pluginConstructor();
2947
- loader.name = name;
2948
- return loader;
2949
- }).sort(function(a, b) {
2950
- return a.order - b.order;
2951
- });
2952
- }
2953
- var _proto = PluginSystem.prototype;
2954
- _proto.initializeComposition = function initializeComposition(composition, scene) {
2955
- this.plugins.forEach(function(loader) {
2902
+ function PluginSystem() {}
2903
+ PluginSystem.getPlugins = function getPlugins() {
2904
+ return plugins;
2905
+ };
2906
+ PluginSystem.initializeComposition = function initializeComposition(composition, scene) {
2907
+ plugins.forEach(function(loader) {
2956
2908
  return loader.onCompositionConstructed(composition, scene);
2957
2909
  });
2958
2910
  };
2959
- _proto.destroyComposition = function destroyComposition(comp) {
2960
- this.plugins.forEach(function(loader) {
2911
+ PluginSystem.destroyComposition = function destroyComposition(comp) {
2912
+ plugins.forEach(function(loader) {
2961
2913
  return loader.onCompositionDestroyed(comp);
2962
2914
  });
2963
2915
  };
2964
- _proto.resetComposition = function resetComposition(comp, renderFrame) {
2965
- this.plugins.forEach(function(loader) {
2966
- return loader.onCompositionReset(comp, renderFrame);
2967
- });
2968
- };
2969
- _proto.processRawJSON = function processRawJSON(json, options) {
2970
- var _this = this;
2971
- return _async_to_generator(function() {
2972
- return __generator(this, function(_state) {
2973
- return [
2974
- 2,
2975
- _this.callStatic("processRawJSON", json, options)
2976
- ];
2977
- });
2978
- })();
2979
- };
2980
- _proto.processAssets = function processAssets(json, options) {
2981
- var _this = this;
2982
- return _async_to_generator(function() {
2983
- return __generator(this, function(_state) {
2984
- return [
2985
- 2,
2986
- _this.callStatic("processAssets", json, options)
2987
- ];
2988
- });
2989
- })();
2990
- };
2991
- _proto.precompile = function precompile(compositions, renderer) {
2992
- for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
2993
- var plugin = _step.value;
2994
- plugin.precompile(compositions, renderer);
2995
- }
2996
- };
2997
- _proto.loadResources = function loadResources(scene, options) {
2998
- var _this = this;
2916
+ PluginSystem.processAssets = function processAssets(scene, options) {
2999
2917
  return _async_to_generator(function() {
3000
2918
  return __generator(this, function(_state) {
3001
2919
  return [
3002
2920
  2,
3003
- _this.callStatic("prepareResource", scene, options)
2921
+ Promise.all(plugins.map(function(plugin) {
2922
+ return plugin.processAssets(scene, options);
2923
+ }))
3004
2924
  ];
3005
2925
  });
3006
2926
  })();
3007
2927
  };
3008
- _proto.callStatic = function callStatic(name) {
3009
- for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
3010
- args[_key - 1] = arguments[_key];
3011
- }
3012
- var _this = this;
3013
- return _async_to_generator(function() {
3014
- var pendings, plugins, i, plugin, ctrl, _ctrl_name, _ctrl_name1;
3015
- return __generator(this, function(_state) {
3016
- pendings = [];
3017
- plugins = _this.plugins;
3018
- for(i = 0; i < plugins.length; i++){
3019
- plugin = plugins[i];
3020
- ctrl = pluginLoaderMap[plugin.name];
3021
- if (name in ctrl) {
3022
- pendings.push(Promise.resolve((_ctrl_name1 = ctrl[name]) == null ? void 0 : (_ctrl_name = _ctrl_name1).call.apply(_ctrl_name, [].concat([
3023
- ctrl
3024
- ], args))));
3025
- }
3026
- }
3027
- return [
3028
- 2,
3029
- Promise.all(pendings)
3030
- ];
3031
- });
3032
- })();
2928
+ PluginSystem.loadResources = function loadResources(scene, options, engine) {
2929
+ plugins.forEach(function(loader) {
2930
+ return loader.prepareResource(scene, options, engine);
2931
+ });
3033
2932
  };
3034
2933
  return PluginSystem;
3035
2934
  }();
@@ -3037,6 +2936,8 @@ var pluginInfoMap = {
3037
2936
  "alipay-downgrade": "@galacean/effects-plugin-alipay-downgrade",
3038
2937
  "downgrade": "@galacean/effects-plugin-downgrade",
3039
2938
  "editor-gizmo": "@galacean/effects-plugin-editor-gizmo",
2939
+ "ffd": "@galacean/effects-plugin-ffd",
2940
+ "ktx2": "@galacean/effects-plugin-ktx2",
3040
2941
  "model": "@galacean/effects-plugin-model",
3041
2942
  "video": "@galacean/effects-plugin-multimedia",
3042
2943
  "audio": "@galacean/effects-plugin-multimedia",
@@ -3062,15 +2963,33 @@ function getPluginUsageInfo(name) {
3062
2963
  this.name = "";
3063
2964
  }
3064
2965
  var _proto = AbstractPlugin.prototype;
2966
+ _proto.initialize = function initialize() {};
2967
+ /**
2968
+ * loadScene 函数调用的时候会触发此函数,
2969
+ * 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
2970
+ * @param scene
2971
+ * @param options
2972
+ * @returns
2973
+ */ _proto.processAssets = function processAssets(scene, options) {
2974
+ return _async_to_generator(function() {
2975
+ return __generator(this, function(_state) {
2976
+ return [
2977
+ 2
2978
+ ];
2979
+ });
2980
+ })();
2981
+ };
3065
2982
  /**
3066
- * 在加载到 JSON 后,就可以进行提前编译
3067
- * @param json
3068
- * @param player
3069
- */ _proto.precompile = function precompile(compositions, renderer) {};
2983
+ * loadScene 函数调用的时候会触发此函数,
2984
+ * 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
2985
+ * 如果 promise 被 reject, loadScene 函数同样会被 reject,表示场景加载失败。
2986
+ * 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
2987
+ * 此阶段晚于 processAssets
2988
+ * @param {Scene} scene
2989
+ * @param {SceneLoadOptions} options
2990
+ */ _proto.prepareResource = function prepareResource(scene, options, engine) {};
3070
2991
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
3071
- _proto.onCompositionReset = function onCompositionReset(composition, frame) {};
3072
2992
  _proto.onCompositionDestroyed = function onCompositionDestroyed(composition) {};
3073
- _proto.onCompositionUpdate = function onCompositionUpdate(composition, dt) {};
3074
2993
  return AbstractPlugin;
3075
2994
  }();
3076
2995
 
@@ -4055,6 +3974,41 @@ var index$1 = /*#__PURE__*/Object.freeze({
4055
3974
  get VertexBufferSemantic () { return VertexBufferSemantic; }
4056
3975
  });
4057
3976
 
3977
+ function _array_like_to_array(arr, len) {
3978
+ if (len == null || len > arr.length) len = arr.length;
3979
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3980
+ return arr2;
3981
+ }
3982
+
3983
+ function _unsupported_iterable_to_array(o, minLen) {
3984
+ if (!o) return;
3985
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
3986
+ var n = Object.prototype.toString.call(o).slice(8, -1);
3987
+ if (n === "Object" && o.constructor) n = o.constructor.name;
3988
+ if (n === "Map" || n === "Set") return Array.from(n);
3989
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
3990
+ }
3991
+
3992
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
3993
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
3994
+ if (it) return (it = it.call(o)).next.bind(it);
3995
+ // Fallback for engines without symbol support
3996
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
3997
+ if (it) o = it;
3998
+ var i = 0;
3999
+ return function() {
4000
+ if (i >= o.length) return {
4001
+ done: true
4002
+ };
4003
+ return {
4004
+ done: false,
4005
+ value: o[i++]
4006
+ };
4007
+ };
4008
+ }
4009
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4010
+ }
4011
+
4058
4012
  var decoratorInitialStore = new Map();
4059
4013
  var mergedStore = new Map();
4060
4014
  var effectsClassStore = {};
@@ -9879,6 +9833,8 @@ var TextureFactory = /*#__PURE__*/ function() {
9879
9833
  internalFormat: textureData.internalFormat,
9880
9834
  format: textureData.format,
9881
9835
  mipmaps: textureData.mipmaps,
9836
+ minFilter: glContext.LINEAR,
9837
+ magFilter: glContext.LINEAR,
9882
9838
  sourceFrom: sourceFrom
9883
9839
  }, config)
9884
9840
  ];
@@ -10351,208 +10307,70 @@ var MaskProcessor = /*#__PURE__*/ function() {
10351
10307
  return MaskProcessor;
10352
10308
  }();
10353
10309
 
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;
10396
- };
10397
- _proto.fromData = function fromData(data) {
10398
- EffectsObject.prototype.fromData.call(this, data);
10399
- this.shaderData = data;
10400
- };
10401
- return Shader;
10402
- }(EffectsObject);
10403
- Shader = __decorate([
10404
- effectsClass(DataType.Shader)
10405
- ], Shader);
10406
-
10407
10310
  var EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
10408
10311
  var COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
10409
10312
  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
10313
  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
10426
- };
10427
- }
10428
10314
 
10429
- var def = {
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;
10315
+ var FilterMode;
10316
+ (function(FilterMode) {
10317
+ FilterMode[FilterMode["Nearest"] = 0] = "Nearest";
10318
+ FilterMode[FilterMode["Linear"] = 1] = "Linear";
10319
+ })(FilterMode || (FilterMode = {}));
10320
+ var RenderTextureFormat;
10321
+ (function(RenderTextureFormat) {
10322
+ RenderTextureFormat[RenderTextureFormat["RGBA32"] = 0] = "RGBA32";
10323
+ RenderTextureFormat[RenderTextureFormat["RGBAHalf"] = 1] = "RGBAHalf";
10324
+ })(RenderTextureFormat || (RenderTextureFormat = {}));
10325
+ /**
10326
+ *
10327
+ */ var Framebuffer = /*#__PURE__*/ function() {
10328
+ function Framebuffer() {}
10329
+ var _proto = Framebuffer.prototype;
10330
+ _proto.resize = function resize(x, y, width, height) {
10331
+ // OVERRIDE
10482
10332
  };
10483
- _proto.removeTexture = function removeTexture(id) {
10484
- var refCount = this.textureRef[id];
10485
- if (refCount <= 1) {
10486
- if (refCount < 0) {
10487
- console.error("Ref count < 0.");
10488
- }
10489
- var tex = this.textureCache[id];
10490
- if (tex) {
10491
- // @ts-expect-error
10492
- tex[disposeSymbol]();
10493
- // @ts-expect-error
10494
- tex.dispose = tex[disposeSymbol];
10495
- }
10496
- delete this.textureCache[id];
10497
- delete this.textureRef[id];
10498
- } else {
10499
- this.textureRef[id] = refCount - 1;
10500
- }
10333
+ _proto.resetColorTextures = function resetColorTextures(textures) {
10334
+ // OVERRIDE
10501
10335
  };
10502
- _proto.dispose = function dispose() {
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;
10336
+ _proto.unbind = function unbind() {
10337
+ // OVERRIDE
10514
10338
  };
10515
- return PassTextureCache;
10516
- }();
10517
-
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
- var SemanticMap = /*#__PURE__*/ function() {
10524
- function SemanticMap(semantics) {
10525
- if (semantics === void 0) semantics = {};
10526
- this.semantics = _extends({}, semantics);
10527
- }
10528
- var _proto = SemanticMap.prototype;
10529
- _proto.toObject = function toObject() {
10530
- return _extends({}, this.semantics);
10339
+ _proto.bind = function bind() {
10340
+ // OVERRIDE
10531
10341
  };
10532
- _proto.setSemantic = function setSemantic(name, value) {
10533
- if (value === undefined) {
10534
- delete this.semantics[name];
10535
- } else {
10536
- this.semantics[name] = value;
10537
- }
10342
+ _proto.getDepthTexture = function getDepthTexture() {
10343
+ // OVERRIDE
10344
+ return undefined;
10538
10345
  };
10539
- _proto.getSemanticValue = function getSemanticValue(name, state) {
10540
- var ret = this.semantics[name];
10541
- if (isFunction(ret)) {
10542
- return ret(state);
10543
- }
10544
- return ret;
10346
+ _proto.getStencilTexture = function getStencilTexture() {
10347
+ // OVERRIDE
10348
+ return undefined;
10545
10349
  };
10546
- _proto.hasSemanticValue = function hasSemanticValue(name) {
10547
- return name in this.semantics;
10350
+ _proto.getColorTextures = function getColorTextures() {
10351
+ // OVERRIDE
10352
+ return [];
10548
10353
  };
10549
- _proto.dispose = function dispose() {
10550
- var _this = this;
10551
- Object.keys(this.semantics).forEach(function(name) {
10552
- delete _this.semantics[name];
10553
- });
10354
+ _proto.dispose = function dispose(options) {
10355
+ // OVERRIDE
10554
10356
  };
10555
- return SemanticMap;
10357
+ _create_class(Framebuffer, [
10358
+ {
10359
+ key: "stencilStorage",
10360
+ get: function get() {
10361
+ // OVERRIDE
10362
+ return undefined;
10363
+ }
10364
+ },
10365
+ {
10366
+ key: "depthStorage",
10367
+ get: function get() {
10368
+ // OVERRIDE
10369
+ return undefined;
10370
+ }
10371
+ }
10372
+ ]);
10373
+ return Framebuffer;
10556
10374
  }();
10557
10375
 
10558
10376
  var RenderPassPriorityPrepare = 0;
@@ -10564,7 +10382,7 @@ var RenderPassAttachmentStorageType;
10564
10382
  RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["color"] = 1] = "color";
10565
10383
  //stencil 8 render buffer
10566
10384
  RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["stencil_8_opaque"] = 2] = "stencil_8_opaque";
10567
- //stencil 16 render buffer
10385
+ //depth 16 render buffer
10568
10386
  RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["depth_16_opaque"] = 3] = "depth_16_opaque";
10569
10387
  //depth 16 & stencil 8 render buffer
10570
10388
  RenderPassAttachmentStorageType[RenderPassAttachmentStorageType["depth_stencil_opaque"] = 4] = "depth_stencil_opaque";
@@ -10683,128 +10501,47 @@ var seed$8 = 1;
10683
10501
  /**
10684
10502
  * RenderPass 抽象类
10685
10503
  */ var RenderPass = /*#__PURE__*/ function() {
10686
- function RenderPass(renderer, options) {
10504
+ function RenderPass(renderer) {
10687
10505
  /**
10688
- * ColorAttachment 数组
10689
- */ this.attachments = [];
10690
- this.destroyed = false;
10691
- this.initialized = false;
10692
- var _options_name = options.name, name = _options_name === void 0 ? "RenderPass_" + seed$8++ : _options_name, clearAction = options.clearAction, semantics = options.semantics, depthStencilAttachment = options.depthStencilAttachment, storeAction = options.storeAction, _options_priority = options.priority, priority = _options_priority === void 0 ? 0 : _options_priority, _options_meshOrder = options.meshOrder, meshOrder = _options_meshOrder === void 0 ? OrderType.ascending : _options_meshOrder, _options_meshes = options.meshes, meshes = _options_meshes === void 0 ? [] : _options_meshes, _options_delegate = options.delegate, delegate = _options_delegate === void 0 ? {} : _options_delegate;
10693
- this.name = name;
10506
+ * 优先级
10507
+ */ this.priority = 0;
10508
+ /**
10509
+ * 名称
10510
+ */ this.name = "RenderPass" + seed$8++;
10511
+ /**
10512
+ * 包含的 Mesh 列表
10513
+ */ this.meshes = [];
10514
+ this.disposed = false;
10515
+ this.framebuffer = null;
10694
10516
  this.renderer = renderer;
10695
- this.priority = priority;
10696
- this.meshOrder = meshOrder;
10697
- this.meshes = sortByOrder(meshes.slice(), this.meshOrder);
10698
- this.depthStencilType = (depthStencilAttachment == null ? void 0 : depthStencilAttachment.storageType) || 0;
10699
- this.clearAction = _extends({}, clearAction);
10700
- this.storeAction = _extends({
10701
- colorAction: 0,
10702
- depthAction: 0,
10703
- stencilAction: 0
10704
- }, storeAction);
10705
- this.semantics = new SemanticMap(semantics);
10706
- this.options = options;
10707
- this.delegate = delegate;
10708
10517
  }
10709
10518
  var _proto = RenderPass.prototype;
10710
10519
  _proto.addMesh = function addMesh(mesh) {
10711
- addByOrder(this.meshes, mesh, this.meshOrder);
10520
+ addByOrder(this.meshes, mesh);
10712
10521
  };
10713
10522
  _proto.removeMesh = function removeMesh(mesh) {
10714
10523
  removeItem(this.meshes, mesh);
10715
10524
  };
10716
- _proto.setMeshes = function setMeshes(meshes) {
10717
- var _this_meshes;
10718
- this.meshes.length = 0;
10719
- (_this_meshes = this.meshes).splice.apply(_this_meshes, [].concat([
10720
- 0,
10721
- 0
10722
- ], meshes));
10723
- sortByOrder(this.meshes, this.meshOrder);
10724
- return this.meshes;
10725
- };
10726
- // TODO 所有pass在子类配置
10727
10525
  /**
10728
10526
  * 配置当前pass的RT,在每帧渲染前调用
10729
10527
  */ _proto.configure = function configure(renderer) {
10730
- if (this.framebuffer) {
10731
- renderer.setFramebuffer(this.framebuffer);
10732
- } else {
10733
- var _this_getViewport = this.getViewport(), x = _this_getViewport[0], y = _this_getViewport[1], width = _this_getViewport[2], height = _this_getViewport[3];
10734
- renderer.setViewport(x, y, width, height);
10735
- }
10528
+ // OVERRIDE
10736
10529
  };
10737
10530
  /**
10738
10531
  * 执行当前pass,每帧调用一次
10739
10532
  */ _proto.execute = function execute(renderer) {
10740
- renderer.clear(this.clearAction);
10741
- renderer.renderMeshes(this.meshes);
10742
- renderer.clear(this.storeAction);
10533
+ // OVERRIDE
10743
10534
  };
10744
10535
  /**
10745
- * 每帧所有的pass渲染完后调用,通常用于清空临时的RT资源
10746
- */ _proto.frameCleanup = function frameCleanup(renderer) {};
10747
- _proto._resetAttachments = function _resetAttachments() {
10748
- var _this = this;
10749
- var _options_attachments;
10750
- var renderer = this.renderer;
10751
- var options = this.options;
10752
- if (this.attachments.length) {
10753
- var _this_framebuffer;
10754
- this.attachments.forEach(function(att) {
10755
- return !att.externalTexture && att.dispose();
10756
- });
10757
- this.attachments.length = 0;
10758
- (_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.dispose({
10759
- depthStencilAttachment: 2
10760
- });
10761
- this.framebuffer = null;
10762
- }
10763
- // renderpass 的 viewport 相关参数都需要动态的修改
10764
- var viewport = [
10765
- 0,
10766
- 0,
10767
- renderer.getWidth(),
10768
- renderer.getHeight()
10769
- ];
10770
- var size = [
10771
- viewport[2],
10772
- viewport[3]
10773
- ];
10774
- var name = this.name;
10775
- if ((_options_attachments = options.attachments) == null ? void 0 : _options_attachments.length) {
10776
- var attachments = options.attachments.map(function(attr, index) {
10777
- var _attr_texture;
10778
- var attachment = new RenderTargetHandle(_this.renderer.engine, _extends({
10779
- size: size,
10780
- name: ((_attr_texture = attr.texture) == null ? void 0 : _attr_texture.name) || name + "##color_" + index
10781
- }, attr));
10782
- return attachment;
10783
- });
10784
- this.attachments = attachments;
10785
- var framebuffer = Framebuffer.create({
10786
- storeAction: this.storeAction,
10787
- name: name,
10788
- viewport: viewport,
10789
- attachments: attachments.map(function(att) {
10790
- return att.texture;
10791
- }),
10792
- depthStencilAttachment: options.depthStencilAttachment || {
10793
- storageType: 0
10794
- }
10795
- }, renderer);
10796
- framebuffer.bind();
10797
- framebuffer.unbind();
10798
- this.framebuffer = framebuffer;
10799
- } else {
10800
- this.attachments.length = 0;
10801
- }
10536
+ * 每帧所有的pass渲染完后调用,用于清空临时的RT资源
10537
+ */ _proto.onCameraCleanup = function onCameraCleanup(renderer) {
10538
+ // OVERRIDE
10802
10539
  };
10803
10540
  /**
10804
10541
  * 获取当前视口大小,格式:[x偏移,y偏移,宽度,高度]
10805
10542
  */ _proto.getViewport = function getViewport() {
10806
10543
  var _this_framebuffer;
10807
- var ret = ((_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.viewport) || this.customViewport;
10544
+ var ret = (_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.viewport;
10808
10545
  if (ret) {
10809
10546
  return ret;
10810
10547
  }
@@ -10822,72 +10559,10 @@ var seed$8 = 1;
10822
10559
  ];
10823
10560
  };
10824
10561
  /**
10825
- * 获取深度 Attachment,可能没有
10826
- */ _proto.getDepthAttachment = function getDepthAttachment() {
10827
- var framebuffer = this.framebuffer;
10828
- if (framebuffer) {
10829
- var depthTexture = framebuffer.getDepthTexture();
10830
- var texture = depthTexture ? this.getDepthTexture(depthTexture, framebuffer.externalStorage) : undefined;
10831
- return {
10832
- storageType: framebuffer.depthStencilStorageType,
10833
- storage: framebuffer.depthStorage,
10834
- texture: texture
10835
- };
10836
- }
10837
- };
10838
- /**
10839
- * 获取蒙版 Attachment,可能没有
10840
- */ _proto.getStencilAttachment = function getStencilAttachment() {
10841
- var framebuffer = this.framebuffer;
10842
- if (framebuffer) {
10843
- var stencilTexture = framebuffer.getStencilTexture();
10844
- var texture = stencilTexture ? this.getDepthTexture(stencilTexture, framebuffer.externalStorage) : undefined;
10845
- return {
10846
- storageType: framebuffer.depthStencilStorageType,
10847
- storage: framebuffer.stencilStorage,
10848
- texture: texture
10849
- };
10850
- }
10851
- };
10852
- _proto.getDepthTexture = function getDepthTexture(texture, external) {
10853
- if (!this.depthTexture) {
10854
- var _this_options_depthStencilAttachment;
10855
- var outTex = (_this_options_depthStencilAttachment = this.options.depthStencilAttachment) == null ? void 0 : _this_options_depthStencilAttachment.texture;
10856
- var tex = texture === outTex ? outTex : texture;
10857
- // TODO 为什么要initialize?
10858
- //tex.initialize(this.renderer.engine);
10859
- if (!external) {
10860
- this.depthTexture = tex;
10861
- }
10862
- return tex;
10863
- }
10864
- return this.depthTexture;
10865
- };
10866
- _proto.getStencilTexture = function getStencilTexture(texture, external) {
10867
- if (!this.stencilTexture) {
10868
- var _this_options_depthStencilAttachment;
10869
- var outTex = (_this_options_depthStencilAttachment = this.options.depthStencilAttachment) == null ? void 0 : _this_options_depthStencilAttachment.texture;
10870
- var tex = texture === outTex ? outTex : texture;
10871
- if (!external) {
10872
- this.stencilTexture = tex;
10873
- }
10874
- return tex;
10875
- }
10876
- return this.stencilTexture;
10877
- };
10878
- // 生成并初始化帧缓冲
10879
- _proto.initialize = function initialize(renderer) {
10880
- if (!this.initialized) {
10881
- this._resetAttachments();
10882
- this.initialized = true;
10883
- }
10884
- return this;
10885
- };
10886
- /**
10887
10562
  * 销毁 RenderPass
10888
10563
  * @param options - 有选择销毁内部对象
10889
10564
  */ _proto.dispose = function dispose(options) {
10890
- if (this.destroyed) {
10565
+ if (this.disposed) {
10891
10566
  return;
10892
10567
  }
10893
10568
  var destroyMeshOption = (options == null ? void 0 : options.meshes) || undefined;
@@ -10897,40 +10572,13 @@ var seed$8 = 1;
10897
10572
  });
10898
10573
  }
10899
10574
  this.meshes.length = 0;
10900
- var colorOpt = (options == null ? void 0 : options.colorAttachment) ? options.colorAttachment : 0;
10901
- this.attachments.forEach(function(att) {
10902
- var keep = att.externalTexture && colorOpt === 2 || colorOpt === 1;
10903
- if (!keep) {
10904
- att.dispose();
10905
- }
10906
- });
10907
- this.attachments.length = 0;
10908
- if ((options == null ? void 0 : options.semantics) !== DestroyOptions.keep) {
10909
- this.semantics.dispose();
10910
- }
10911
- this.destroyed = true;
10912
- var depthStencilOpt = (options == null ? void 0 : options.depthStencilAttachment) ? options.depthStencilAttachment : 0;
10913
- var fbo = this.framebuffer;
10914
- if (fbo) {
10915
- fbo.dispose({
10916
- depthStencilAttachment: depthStencilOpt
10917
- });
10918
- var keep = fbo.externalStorage && depthStencilOpt === 2 || depthStencilOpt === 1;
10919
- if (!keep) {
10920
- var _this_stencilTexture, _this_depthTexture;
10921
- (_this_stencilTexture = this.stencilTexture) == null ? void 0 : _this_stencilTexture.dispose();
10922
- (_this_depthTexture = this.depthTexture) == null ? void 0 : _this_depthTexture.dispose();
10923
- }
10924
- }
10925
- // @ts-expect-error safe to assign
10926
- this.options = null;
10927
- this.initialize = throwDestroyedError;
10575
+ this.disposed = true;
10928
10576
  };
10929
10577
  _create_class(RenderPass, [
10930
10578
  {
10931
- key: "isDestroyed",
10579
+ key: "isDisposed",
10932
10580
  get: function get() {
10933
- return this.destroyed;
10581
+ return this.disposed;
10934
10582
  }
10935
10583
  },
10936
10584
  {
@@ -10938,18 +10586,6 @@ var seed$8 = 1;
10938
10586
  get: function get() {
10939
10587
  return this.getViewport();
10940
10588
  }
10941
- },
10942
- {
10943
- key: "stencilAttachment",
10944
- get: function get() {
10945
- return this.getStencilAttachment();
10946
- }
10947
- },
10948
- {
10949
- key: "depthAttachment",
10950
- get: function get() {
10951
- return this.getDepthAttachment();
10952
- }
10953
10589
  }
10954
10590
  ]);
10955
10591
  return RenderPass;
@@ -10957,27 +10593,95 @@ var seed$8 = 1;
10957
10593
 
10958
10594
  var DrawObjectPass = /*#__PURE__*/ function(RenderPass) {
10959
10595
  _inherits(DrawObjectPass, RenderPass);
10960
- function DrawObjectPass(renderer, options) {
10596
+ function DrawObjectPass(renderer) {
10961
10597
  var _this;
10962
- _this = RenderPass.call(this, renderer, options) || this;
10963
- _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
10964
- _this.renderer.engine.on("resize", _this.onResize);
10598
+ _this = RenderPass.call(this, renderer) || this;
10599
+ _this.useRenderTarget = false;
10600
+ _this.priority = RenderPassPriorityNormal;
10601
+ _this.name = "DrawObjectPass";
10965
10602
  return _this;
10966
10603
  }
10967
10604
  var _proto = DrawObjectPass.prototype;
10968
- _proto.onResize = function onResize() {
10969
- var _this_framebuffer;
10970
- var width = this.renderer.getWidth();
10971
- var height = this.renderer.getHeight();
10972
- (_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.resize(0, 0, width, height);
10605
+ _proto.setup = function setup(useRenderTarget) {
10606
+ this.useRenderTarget = useRenderTarget;
10973
10607
  };
10974
- _proto.dispose = function dispose(options) {
10975
- this.renderer.engine.off("resize", this.onResize);
10976
- RenderPass.prototype.dispose.call(this, options);
10608
+ _proto.configure = function configure(renderer) {
10609
+ if (this.useRenderTarget) {
10610
+ this.framebuffer = renderer.getTemporaryRT("DrawObjectPass", renderer.getWidth(), renderer.getHeight(), 16, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
10611
+ renderer.setFramebuffer(this.framebuffer);
10612
+ }
10613
+ };
10614
+ _proto.execute = function execute(renderer) {
10615
+ if (this.useRenderTarget) {
10616
+ renderer.clear({
10617
+ colorAction: TextureLoadAction.clear,
10618
+ depthAction: TextureLoadAction.clear,
10619
+ stencilAction: TextureLoadAction.clear
10620
+ });
10621
+ }
10622
+ renderer.renderMeshes(this.meshes);
10623
+ };
10624
+ _proto.onCameraCleanup = function onCameraCleanup(renderer) {
10625
+ if (this.useRenderTarget && this.framebuffer) {
10626
+ renderer.releaseTemporaryRT(this.framebuffer);
10627
+ }
10977
10628
  };
10978
10629
  return DrawObjectPass;
10979
10630
  }(RenderPass);
10980
10631
 
10632
+ var ShaderCompileResultStatus;
10633
+ (function(ShaderCompileResultStatus) {
10634
+ ShaderCompileResultStatus[ShaderCompileResultStatus["noShader"] = 0] = "noShader";
10635
+ ShaderCompileResultStatus[ShaderCompileResultStatus["success"] = 1] = "success";
10636
+ ShaderCompileResultStatus[ShaderCompileResultStatus["fail"] = 2] = "fail";
10637
+ ShaderCompileResultStatus[ShaderCompileResultStatus["compiling"] = 3] = "compiling";
10638
+ })(ShaderCompileResultStatus || (ShaderCompileResultStatus = {}));
10639
+ var GLSLVersion;
10640
+ (function(GLSLVersion) {
10641
+ GLSLVersion["GLSL1"] = "100";
10642
+ GLSLVersion["GLSL3"] = "300 es";
10643
+ })(GLSLVersion || (GLSLVersion = {}));
10644
+ var ShaderVariant = /*#__PURE__*/ function(EffectsObject) {
10645
+ _inherits(ShaderVariant, EffectsObject);
10646
+ function ShaderVariant(engine, source) {
10647
+ var _this;
10648
+ _this = EffectsObject.call(this, engine) || this;
10649
+ _this.source = source;
10650
+ return _this;
10651
+ }
10652
+ return ShaderVariant;
10653
+ }(EffectsObject);
10654
+ var Shader = /*#__PURE__*/ function(EffectsObject) {
10655
+ _inherits(Shader, EffectsObject);
10656
+ function Shader() {
10657
+ return EffectsObject.apply(this, arguments);
10658
+ }
10659
+ var _proto = Shader.prototype;
10660
+ _proto.createVariant = function createVariant(macros) {
10661
+ var shaderMacros = [];
10662
+ if (macros) {
10663
+ for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(macros)), _step; !(_step = _iterator()).done;){
10664
+ var key = _step.value;
10665
+ shaderMacros.push([
10666
+ key,
10667
+ macros[key]
10668
+ ]);
10669
+ }
10670
+ }
10671
+ var shaderVariant = this.engine.getShaderLibrary().createShader(this.shaderData, shaderMacros);
10672
+ shaderVariant.shader = this;
10673
+ return shaderVariant;
10674
+ };
10675
+ _proto.fromData = function fromData(data) {
10676
+ EffectsObject.prototype.fromData.call(this, data);
10677
+ this.shaderData = data;
10678
+ };
10679
+ return Shader;
10680
+ }(EffectsObject);
10681
+ Shader = __decorate([
10682
+ effectsClass(DataType.Shader)
10683
+ ], Shader);
10684
+
10981
10685
  var _obj$6;
10982
10686
  var BYTES_TYPE_MAP = (_obj$6 = {}, _obj$6[glContext.FLOAT] = Float32Array.BYTES_PER_ELEMENT, _obj$6[glContext.INT] = Int32Array.BYTES_PER_ELEMENT, _obj$6[glContext.SHORT] = Int16Array.BYTES_PER_ELEMENT, _obj$6[glContext.BYTE] = Int8Array.BYTES_PER_ELEMENT, _obj$6);
10983
10687
  /**
@@ -13019,9 +12723,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
13019
12723
  // Bloom 阈值 Pass
13020
12724
  var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
13021
12725
  _inherits(BloomThresholdPass, RenderPass);
13022
- function BloomThresholdPass(renderer, option) {
12726
+ function BloomThresholdPass(renderer) {
13023
12727
  var _this;
13024
- _this = RenderPass.call(this, renderer, option) || this;
12728
+ _this = RenderPass.call(this, renderer) || this;
13025
12729
  var engine = _this.renderer.engine;
13026
12730
  var geometry = Geometry.create(engine, {
13027
12731
  mode: glContext.TRIANGLE_STRIP,
@@ -13059,12 +12763,12 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
13059
12763
  priority: 0
13060
12764
  });
13061
12765
  _this.priority = 5000;
13062
- _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
13063
- _this.renderer.engine.on("resize", _this.onResize);
12766
+ _this.name = "BloomThresholdPass";
13064
12767
  return _this;
13065
12768
  }
13066
12769
  var _proto = BloomThresholdPass.prototype;
13067
12770
  _proto.configure = function configure(renderer) {
12771
+ this.framebuffer = renderer.getTemporaryRT(this.name, renderer.getWidth(), renderer.getHeight(), 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
13068
12772
  this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
13069
12773
  this.sceneTextureHandle.texture = this.mainTexture;
13070
12774
  renderer.setFramebuffer(this.framebuffer);
@@ -13072,9 +12776,9 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
13072
12776
  _proto.execute = function execute(renderer) {
13073
12777
  var _renderer_renderingData_currentFrame_globalVolume_bloom, _renderer_renderingData_currentFrame_globalVolume;
13074
12778
  renderer.clear({
13075
- colorAction: TextureStoreAction.clear,
13076
- depthAction: TextureStoreAction.clear,
13077
- stencilAction: TextureStoreAction.clear
12779
+ colorAction: TextureLoadAction.clear,
12780
+ depthAction: TextureLoadAction.clear,
12781
+ stencilAction: TextureLoadAction.clear
13078
12782
  });
13079
12783
  this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
13080
12784
  var _renderer_renderingData_currentFrame_globalVolume_bloom_threshold;
@@ -13084,23 +12788,21 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
13084
12788
  this.screenMesh
13085
12789
  ]);
13086
12790
  };
13087
- _proto.onResize = function onResize() {
13088
- var _this_framebuffer;
13089
- var width = this.renderer.getWidth();
13090
- var height = this.renderer.getHeight();
13091
- (_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.resize(0, 0, width, height);
12791
+ _proto.onCameraCleanup = function onCameraCleanup(renderer) {
12792
+ if (this.framebuffer) {
12793
+ renderer.releaseTemporaryRT(this.framebuffer);
12794
+ }
13092
12795
  };
13093
12796
  _proto.dispose = function dispose(options) {
13094
- this.renderer.engine.off("resize", this.onResize);
13095
12797
  RenderPass.prototype.dispose.call(this, options);
13096
12798
  };
13097
12799
  return BloomThresholdPass;
13098
12800
  }(RenderPass);
13099
12801
  var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
13100
12802
  _inherits(HQGaussianDownSamplePass, RenderPass);
13101
- function HQGaussianDownSamplePass(renderer, type, level, options) {
12803
+ function HQGaussianDownSamplePass(renderer, type, level) {
13102
12804
  var _this;
13103
- _this = RenderPass.call(this, renderer, options) || this;
12805
+ _this = RenderPass.call(this, renderer) || this;
13104
12806
  _this.type = type;
13105
12807
  _this.level = level;
13106
12808
  var engine = _this.renderer.engine;
@@ -13146,25 +12848,22 @@ var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
13146
12848
  priority: 0
13147
12849
  });
13148
12850
  _this.priority = 5000;
13149
- _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
13150
- _this.renderer.engine.on("resize", _this.onResize);
12851
+ _this.name = "GaussianDownPass" + type + level;
13151
12852
  return _this;
13152
12853
  }
13153
12854
  var _proto = HQGaussianDownSamplePass.prototype;
13154
- _proto.initialize = function initialize(renderer) {
13155
- RenderPass.prototype.initialize.call(this, renderer);
13156
- this.onResize();
13157
- return this;
13158
- };
13159
12855
  _proto.configure = function configure(renderer) {
12856
+ var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level + 1));
12857
+ var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level + 1));
12858
+ this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
13160
12859
  this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
13161
12860
  renderer.setFramebuffer(this.framebuffer);
13162
12861
  };
13163
12862
  _proto.execute = function execute(renderer) {
13164
12863
  renderer.clear({
13165
- colorAction: TextureStoreAction.clear,
13166
- depthAction: TextureStoreAction.clear,
13167
- stencilAction: TextureStoreAction.clear
12864
+ colorAction: TextureLoadAction.clear,
12865
+ depthAction: TextureLoadAction.clear,
12866
+ stencilAction: TextureLoadAction.clear
13168
12867
  });
13169
12868
  this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
13170
12869
  this.screenMesh.material.setVector2("_TextureSize", getTextureSize(this.mainTexture));
@@ -13175,23 +12874,18 @@ var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
13175
12874
  this.gaussianResult.texture = renderer.getFramebuffer().getColorTextures()[0];
13176
12875
  }
13177
12876
  };
13178
- _proto.onResize = function onResize() {
13179
- var _this_framebuffer;
13180
- var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level + 1));
13181
- var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level + 1));
13182
- (_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.resize(0, 0, width, height);
13183
- };
13184
- _proto.dispose = function dispose(options) {
13185
- this.renderer.engine.off("resize", this.onResize);
13186
- RenderPass.prototype.dispose.call(this, options);
12877
+ _proto.onCameraCleanup = function onCameraCleanup(renderer) {
12878
+ if (this.framebuffer) {
12879
+ renderer.releaseTemporaryRT(this.framebuffer);
12880
+ }
13187
12881
  };
13188
12882
  return HQGaussianDownSamplePass;
13189
12883
  }(RenderPass);
13190
12884
  var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
13191
12885
  _inherits(HQGaussianUpSamplePass, RenderPass);
13192
- function HQGaussianUpSamplePass(renderer, level, options) {
12886
+ function HQGaussianUpSamplePass(renderer, level) {
13193
12887
  var _this;
13194
- _this = RenderPass.call(this, renderer, options) || this;
12888
+ _this = RenderPass.call(this, renderer) || this;
13195
12889
  _this.level = level;
13196
12890
  var name = "PostProcess";
13197
12891
  var engine = _this.renderer.engine;
@@ -13234,25 +12928,22 @@ var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
13234
12928
  priority: 0
13235
12929
  });
13236
12930
  _this.priority = 5000;
13237
- _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
13238
- _this.renderer.engine.on("resize", _this.onResize);
12931
+ _this.name = "GaussianUpPass" + level;
13239
12932
  return _this;
13240
12933
  }
13241
12934
  var _proto = HQGaussianUpSamplePass.prototype;
13242
- _proto.initialize = function initialize(renderer) {
13243
- RenderPass.prototype.initialize.call(this, renderer);
13244
- this.onResize();
13245
- return this;
13246
- };
13247
12935
  _proto.configure = function configure(renderer) {
12936
+ var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level - 1));
12937
+ var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level - 1));
12938
+ this.framebuffer = renderer.getTemporaryRT(this.name, width, height, 0, FilterMode.Linear, RenderTextureFormat.RGBAHalf);
13248
12939
  this.mainTexture = renderer.getFramebuffer().getColorTextures()[0];
13249
12940
  renderer.setFramebuffer(this.framebuffer);
13250
12941
  };
13251
12942
  _proto.execute = function execute(renderer) {
13252
12943
  renderer.clear({
13253
- colorAction: TextureStoreAction.clear,
13254
- depthAction: TextureStoreAction.clear,
13255
- stencilAction: TextureStoreAction.clear
12944
+ colorAction: TextureLoadAction.clear,
12945
+ depthAction: TextureLoadAction.clear,
12946
+ stencilAction: TextureLoadAction.clear
13256
12947
  });
13257
12948
  this.screenMesh.material.setTexture("_MainTex", this.mainTexture);
13258
12949
  this.screenMesh.material.setTexture("_GaussianDownTex", this.gaussianDownSampleResult.texture);
@@ -13261,15 +12952,10 @@ var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
13261
12952
  this.screenMesh
13262
12953
  ]);
13263
12954
  };
13264
- _proto.onResize = function onResize() {
13265
- var _this_framebuffer;
13266
- var width = Math.floor(this.renderer.getWidth() / Math.pow(2, this.level - 1));
13267
- var height = Math.floor(this.renderer.getHeight() / Math.pow(2, this.level - 1));
13268
- (_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.resize(0, 0, width, height);
13269
- };
13270
- _proto.dispose = function dispose(options) {
13271
- this.renderer.engine.off("resize", this.onResize);
13272
- RenderPass.prototype.dispose.call(this, options);
12955
+ _proto.onCameraCleanup = function onCameraCleanup(renderer) {
12956
+ if (this.framebuffer) {
12957
+ renderer.releaseTemporaryRT(this.framebuffer);
12958
+ }
13273
12959
  };
13274
12960
  return HQGaussianUpSamplePass;
13275
12961
  }(RenderPass);
@@ -13278,7 +12964,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
13278
12964
  _inherits(ToneMappingPass, RenderPass);
13279
12965
  function ToneMappingPass(renderer, sceneTextureHandle) {
13280
12966
  var _this;
13281
- _this = RenderPass.call(this, renderer, {}) || this;
12967
+ _this = RenderPass.call(this, renderer) || this;
13282
12968
  var name = "PostProcess";
13283
12969
  var engine = _this.renderer.engine;
13284
12970
  _this.sceneTextureHandle = sceneTextureHandle ? sceneTextureHandle : new RenderTargetHandle(engine);
@@ -13321,6 +13007,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
13321
13007
  priority: 0
13322
13008
  });
13323
13009
  _this.priority = 5000;
13010
+ _this.name = "ToneMappingPass";
13324
13011
  return _this;
13325
13012
  }
13326
13013
  var _proto = ToneMappingPass.prototype;
@@ -13333,9 +13020,9 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
13333
13020
  };
13334
13021
  _proto.execute = function execute(renderer) {
13335
13022
  renderer.clear({
13336
- colorAction: TextureStoreAction.clear,
13337
- depthAction: TextureStoreAction.clear,
13338
- stencilAction: TextureStoreAction.clear
13023
+ colorAction: TextureLoadAction.clear,
13024
+ depthAction: TextureLoadAction.clear,
13025
+ stencilAction: TextureLoadAction.clear
13339
13026
  });
13340
13027
  var globalVolume = renderer.renderingData.currentFrame.globalVolume;
13341
13028
  var bloom = _extends({
@@ -13382,70 +13069,31 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
13382
13069
  return ToneMappingPass;
13383
13070
  }(RenderPass);
13384
13071
 
13385
- var RENDER_PASS_NAME_PREFIX = "_effects_default_";
13386
13072
  var seed$6 = 1;
13387
13073
  /**
13388
13074
  * RenderFrame 抽象类
13389
13075
  */ var RenderFrame = /*#__PURE__*/ function() {
13390
13076
  function RenderFrame(options) {
13391
- var _this_renderer_getShaderLibrary;
13392
- // TODO: 是否有用
13393
- this.renderQueue = [];
13394
- this.destroyed = false;
13395
- this.renderPassInfoMap = new WeakMap();
13396
- var camera = options.camera, keepColorBuffer = options.keepColorBuffer, renderer = options.renderer, _options_editorTransform = options.editorTransform, editorTransform = _options_editorTransform === void 0 ? [
13077
+ this.disposed = false;
13078
+ this.postProcessingEnabled = false;
13079
+ this.enableHDR = true;
13080
+ var camera = options.camera, renderer = options.renderer, _options_editorTransform = options.editorTransform, editorTransform = _options_editorTransform === void 0 ? [
13397
13081
  1,
13398
13082
  1,
13399
13083
  0,
13400
13084
  0
13401
- ] : _options_editorTransform, globalVolume = options.globalVolume, _options_postProcessingEnabled = options.postProcessingEnabled, postProcessingEnabled = _options_postProcessingEnabled === void 0 ? false : _options_postProcessingEnabled, _options_clearAction = options.clearAction, clearAction = _options_clearAction === void 0 ? {
13402
- colorAction: TextureLoadAction.whatever,
13403
- stencilAction: TextureLoadAction.clear,
13404
- depthAction: TextureLoadAction.whatever
13405
- } : _options_clearAction;
13085
+ ] : _options_editorTransform, globalVolume = options.globalVolume, _options_postProcessingEnabled = options.postProcessingEnabled, postProcessingEnabled = _options_postProcessingEnabled === void 0 ? false : _options_postProcessingEnabled;
13406
13086
  var engine = renderer.engine;
13407
13087
  if (globalVolume) {
13408
13088
  this.globalVolume = globalVolume;
13409
13089
  }
13090
+ this.postProcessingEnabled = postProcessingEnabled;
13410
13091
  this.globalUniforms = new GlobalUniforms();
13411
- var attachments = []; //渲染场景物体Pass的RT
13412
- var depthStencilAttachment;
13413
- var drawObjectPassClearAction = {};
13414
13092
  this.renderer = renderer;
13415
- if (postProcessingEnabled) {
13416
- var enableHDR = true;
13417
- if (!this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
13418
- throw new Error("Half float texture is not supported.");
13419
- }
13420
- // 使用HDR浮点纹理,FLOAT在IOS上报错,使用HALF_FLOAT
13421
- var textureType = enableHDR ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
13422
- attachments = [
13423
- {
13424
- texture: {
13425
- format: glContext.RGBA,
13426
- type: textureType,
13427
- magFilter: glContext.LINEAR,
13428
- minFilter: glContext.LINEAR
13429
- }
13430
- }
13431
- ];
13432
- depthStencilAttachment = {
13433
- storageType: RenderPassAttachmentStorageType.depth_stencil_opaque
13434
- };
13435
- drawObjectPassClearAction = {
13436
- colorAction: TextureLoadAction.clear,
13437
- stencilAction: TextureLoadAction.clear,
13438
- depthAction: TextureLoadAction.clear
13439
- };
13093
+ if (postProcessingEnabled && this.enableHDR && !this.renderer.engine.gpuCapability.detail.halfFloatTexture) {
13094
+ throw new Error("Half float texture is not supported.");
13440
13095
  }
13441
- this.drawObjectPass = new DrawObjectPass(renderer, {
13442
- name: RENDER_PASS_NAME_PREFIX,
13443
- priority: RenderPassPriorityNormal,
13444
- meshOrder: OrderType.ascending,
13445
- depthStencilAttachment: depthStencilAttachment,
13446
- attachments: attachments,
13447
- clearAction: drawObjectPassClearAction
13448
- });
13096
+ this.drawObjectPass = new DrawObjectPass(renderer);
13449
13097
  var renderPasses = [
13450
13098
  this.drawObjectPass
13451
13099
  ];
@@ -13460,51 +13108,13 @@ var seed$6 = 1;
13460
13108
  this.renderer.getHeight() / 2
13461
13109
  ];
13462
13110
  var gaussianDownResults = new Array(gaussianStep); //存放多个高斯Pass的模糊结果,用于Bloom
13463
- var enableHDR1 = true;
13464
- var textureType1 = enableHDR1 ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
13465
- var bloomThresholdPass = new BloomThresholdPass(renderer, {
13466
- name: "BloomThresholdPass",
13467
- attachments: [
13468
- {
13469
- texture: {
13470
- format: glContext.RGBA,
13471
- type: textureType1,
13472
- minFilter: glContext.LINEAR,
13473
- magFilter: glContext.LINEAR
13474
- }
13475
- }
13476
- ]
13477
- });
13111
+ var bloomThresholdPass = new BloomThresholdPass(renderer);
13478
13112
  bloomThresholdPass.sceneTextureHandle = sceneTextureHandle;
13479
13113
  this.addRenderPass(bloomThresholdPass);
13480
13114
  for(var i = 0; i < gaussianStep; i++){
13481
13115
  gaussianDownResults[i] = new RenderTargetHandle(engine);
13482
- var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i, {
13483
- name: "GaussianDownPassH" + i,
13484
- attachments: [
13485
- {
13486
- texture: {
13487
- format: glContext.RGBA,
13488
- type: textureType1,
13489
- minFilter: glContext.LINEAR,
13490
- magFilter: glContext.LINEAR
13491
- }
13492
- }
13493
- ]
13494
- });
13495
- var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i, {
13496
- name: "GaussianDownPassV" + i,
13497
- attachments: [
13498
- {
13499
- texture: {
13500
- format: glContext.RGBA,
13501
- type: textureType1,
13502
- minFilter: glContext.LINEAR,
13503
- magFilter: glContext.LINEAR
13504
- }
13505
- }
13506
- ]
13507
- });
13116
+ var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i);
13117
+ var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i);
13508
13118
  gaussianDownVPass.gaussianResult = gaussianDownResults[i];
13509
13119
  this.addRenderPass(gaussianDownHPass);
13510
13120
  this.addRenderPass(gaussianDownVPass);
@@ -13515,19 +13125,7 @@ var seed$6 = 1;
13515
13125
  viewport[2] *= 4;
13516
13126
  viewport[3] *= 4;
13517
13127
  for(var i1 = 0; i1 < gaussianStep - 1; i1++){
13518
- var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1, {
13519
- name: "GaussianUpPass" + i1,
13520
- attachments: [
13521
- {
13522
- texture: {
13523
- format: glContext.RGBA,
13524
- type: textureType1,
13525
- minFilter: glContext.LINEAR,
13526
- magFilter: glContext.LINEAR
13527
- }
13528
- }
13529
- ]
13530
- });
13128
+ var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1);
13531
13129
  gaussianUpPass.gaussianDownSampleResult = gaussianDownResults[gaussianStep - 2 - i1];
13532
13130
  this.addRenderPass(gaussianUpPass);
13533
13131
  viewport[2] *= 2;
@@ -13536,31 +13134,17 @@ var seed$6 = 1;
13536
13134
  var postProcessPass = new ToneMappingPass(renderer, sceneTextureHandle);
13537
13135
  this.addRenderPass(postProcessPass);
13538
13136
  }
13539
- this.semantics = new SemanticMap(options.semantics);
13540
- this.clearAction = clearAction;
13541
13137
  this.name = "RenderFrame" + seed$6++;
13542
- var firstRP = renderPasses[0];
13543
13138
  this.camera = camera;
13544
- this.keepColorBuffer = keepColorBuffer;
13545
- this.renderPassInfoMap.set(firstRP, {
13546
- listStart: 0,
13547
- listEnd: 0,
13548
- renderPass: firstRP,
13549
- intermedia: false
13550
- });
13551
13139
  this.editorTransform = Vector4.fromArray(editorTransform);
13552
- if (!options.clearAction) {
13553
- this.resetClearActions();
13554
- }
13555
- this.passTextureCache = new PassTextureCache(engine);
13556
- // FIXME: addShader是为了性能考虑,如果影响不大,下面代码可以删除
13557
- var _engine_gpuCapability = engine.gpuCapability, detail = _engine_gpuCapability.detail, level = _engine_gpuCapability.level;
13558
- var writeDepth = detail.readableDepthStencilTextures && detail.writableFragDepth;
13559
- var shader = createCopyShader(level, writeDepth);
13560
- (_this_renderer_getShaderLibrary = this.renderer.getShaderLibrary()) == null ? void 0 : _this_renderer_getShaderLibrary.addShader(shader);
13561
13140
  }
13562
13141
  var _proto = RenderFrame.prototype;
13563
13142
  /**
13143
+ * 设置 RenderPasses 参数,此函数每帧调用一次
13144
+ */ _proto.setup = function setup() {
13145
+ this.drawObjectPass.setup(this.postProcessingEnabled);
13146
+ };
13147
+ /**
13564
13148
  * 根据 Mesh 优先级添加到 RenderPass
13565
13149
  * @param mesh - 要添加的 Mesh 对象
13566
13150
  */ _proto.addMeshToDefaultRenderPass = function addMeshToDefaultRenderPass(mesh) {
@@ -13577,78 +13161,25 @@ var seed$6 = 1;
13577
13161
  * 销毁 RenderFrame
13578
13162
  * @param options - 可以有选择销毁一些对象
13579
13163
  */ _proto.dispose = function dispose(options) {
13580
- if ((options == null ? void 0 : options.semantics) !== DestroyOptions.keep) {
13581
- this.semantics.dispose();
13582
- }
13583
13164
  var pass = (options == null ? void 0 : options.passes) ? options.passes : undefined;
13584
13165
  if (pass !== DestroyOptions.keep) {
13585
13166
  this._renderPasses.forEach(function(renderPass) {
13586
13167
  renderPass.dispose(pass);
13587
13168
  });
13588
13169
  }
13589
- this.passTextureCache.dispose();
13590
13170
  this._renderPasses.length = 0;
13591
- this.destroyed = true;
13592
- };
13593
- /**
13594
- * 查找 Mesh 所在的 RenderPass 索引,没找到是-1
13595
- * @param mesh - 需要查找的 Mesh
13596
- */ _proto.findMeshRenderPassIndex = function findMeshRenderPassIndex(mesh) {
13597
- var index = -1;
13598
- this.renderPasses.every(function(rp, idx) {
13599
- if (rp.name.startsWith(RENDER_PASS_NAME_PREFIX) && rp.meshes.includes(mesh)) {
13600
- index = idx;
13601
- return false;
13602
- }
13603
- return true;
13604
- });
13605
- return index;
13606
- };
13607
- _proto.addToRenderPass = function addToRenderPass(renderPass, mesh) {
13608
- var info = this.renderPassInfoMap.get(renderPass);
13609
- var priority = mesh.priority;
13610
- if (!info) {
13611
- return;
13612
- }
13613
- if (renderPass.meshes.length === 0) {
13614
- info.listStart = info.listEnd = priority;
13615
- } else {
13616
- if (priority < info.listStart) {
13617
- info.listStart = priority;
13618
- } else if (priority > info.listEnd) {
13619
- info.listEnd = priority;
13620
- }
13621
- }
13622
- renderPass.addMesh(mesh);
13623
- };
13624
- _proto.resetClearActions = function resetClearActions() {
13625
- var action = this.renderPasses.length > 1 ? TextureLoadAction.clear : TextureLoadAction.whatever;
13626
- this.clearAction.stencilAction = action;
13627
- this.clearAction.depthAction = action;
13628
- this.clearAction.colorAction = action;
13629
- if (this.keepColorBuffer) {
13630
- this.clearAction.colorAction = TextureLoadAction.whatever;
13631
- }
13171
+ this.disposed = true;
13632
13172
  };
13633
13173
  /**
13634
13174
  * 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
13635
13175
  * @param passes - RenderPass 数组
13636
13176
  */ _proto.setRenderPasses = function setRenderPasses(passes) {
13637
- var _this = this;
13638
- if (this.renderer !== undefined) {
13639
- passes.forEach(function(pass) {
13640
- return pass.initialize(_this.renderer);
13641
- });
13642
- }
13643
13177
  this._renderPasses = passes.slice();
13644
13178
  };
13645
13179
  /**
13646
13180
  * 添加 RenderPass
13647
13181
  * @param pass - 需要添加的 RenderPass
13648
13182
  */ _proto.addRenderPass = function addRenderPass(pass) {
13649
- if (this.renderer !== undefined) {
13650
- pass.initialize(this.renderer);
13651
- }
13652
13183
  this._renderPasses.push(pass);
13653
13184
  };
13654
13185
  /**
@@ -13665,9 +13196,9 @@ var seed$6 = 1;
13665
13196
  }
13666
13197
  },
13667
13198
  {
13668
- key: "isDestroyed",
13199
+ key: "isDisposed",
13669
13200
  get: function get() {
13670
- return this.destroyed;
13201
+ return this.disposed;
13671
13202
  }
13672
13203
  }
13673
13204
  ]);
@@ -13676,10 +13207,6 @@ var seed$6 = 1;
13676
13207
  function getTextureSize(tex) {
13677
13208
  return tex ? new Vector2(tex.getWidth(), tex.getHeight()) : new Vector2();
13678
13209
  }
13679
- function findPreviousRenderPass(renderPasses, renderPass) {
13680
- var index = renderPasses.indexOf(renderPass);
13681
- return renderPasses[index - 1];
13682
- }
13683
13210
  var GlobalUniforms = function GlobalUniforms() {
13684
13211
  this.floats = {};
13685
13212
  this.ints = {};
@@ -13717,6 +13244,122 @@ var Renderbuffer = /*#__PURE__*/ function() {
13717
13244
  return Renderbuffer;
13718
13245
  }();
13719
13246
 
13247
+ var RenderTargetPool = /*#__PURE__*/ function() {
13248
+ function RenderTargetPool(engine) {
13249
+ this.engine = engine;
13250
+ this.temporaryRTs = [];
13251
+ this.currentFrame = 0;
13252
+ this.maxUnusedFrames = 4;
13253
+ }
13254
+ var _proto = RenderTargetPool.prototype;
13255
+ /**
13256
+ * 清理 RenderTarget 池
13257
+ * @param force - 是否强制清理所有未占用的 RT
13258
+ * @param framesOffset - 自定义未使用帧数阈值,-1 表示使用默认值
13259
+ */ _proto.flush = function flush(force, framesOffset) {
13260
+ if (force === void 0) force = false;
13261
+ if (framesOffset === void 0) framesOffset = -1;
13262
+ this.currentFrame++;
13263
+ var threshold = framesOffset >= 0 ? framesOffset : this.maxUnusedFrames;
13264
+ for(var i = 0; i < this.temporaryRTs.length; i++){
13265
+ var entry = this.temporaryRTs[i];
13266
+ // 强制清理所有未占用的 RT,或清理超过阈值帧数未使用的 RT
13267
+ if (!entry.isOccupied && (force || this.currentFrame - entry.lastFrameReleased > threshold)) {
13268
+ entry.RT.dispose();
13269
+ this.temporaryRTs.splice(i--, 1);
13270
+ }
13271
+ }
13272
+ };
13273
+ _proto.get = function get(name, width, height, depthBuffer, filter, format) {
13274
+ if (depthBuffer === void 0) depthBuffer = 0;
13275
+ if (filter === void 0) filter = FilterMode.Linear;
13276
+ if (format === void 0) format = RenderTextureFormat.RGBA32;
13277
+ // 使用参数计算 hash 值作为缓存 key
13278
+ var hash = width + "_" + height + "_" + depthBuffer + "_" + filter + "_" + format;
13279
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.temporaryRTs), _step; !(_step = _iterator()).done;){
13280
+ var entry = _step.value;
13281
+ if (!entry.isOccupied && entry.descriptionHash === hash) {
13282
+ entry.isOccupied = true;
13283
+ entry.RT.name = name;
13284
+ return entry.RT;
13285
+ }
13286
+ }
13287
+ var textureFilter;
13288
+ var textureType;
13289
+ var depthType = RenderPassAttachmentStorageType.none;
13290
+ // TODO 建立Map映射
13291
+ if (filter === FilterMode.Linear) {
13292
+ textureFilter = glContext.LINEAR;
13293
+ } else if (filter === FilterMode.Nearest) {
13294
+ textureFilter = glContext.NEAREST;
13295
+ }
13296
+ if (format === RenderTextureFormat.RGBA32) {
13297
+ textureType = glContext.UNSIGNED_BYTE;
13298
+ } else if (format === RenderTextureFormat.RGBAHalf) {
13299
+ textureType = glContext.HALF_FLOAT;
13300
+ }
13301
+ if (depthBuffer === 0) {
13302
+ depthType = RenderPassAttachmentStorageType.none;
13303
+ } else if (depthBuffer === 16) {
13304
+ depthType = RenderPassAttachmentStorageType.depth_stencil_opaque;
13305
+ } else if (depthBuffer === 24) {
13306
+ depthType = RenderPassAttachmentStorageType.depth_24_stencil_8_texture;
13307
+ }
13308
+ var colorAttachment = Texture.create(this.engine, {
13309
+ sourceType: TextureSourceType.framebuffer,
13310
+ minFilter: textureFilter,
13311
+ magFilter: textureFilter,
13312
+ internalFormat: glContext.RGBA,
13313
+ format: glContext.RGBA,
13314
+ type: textureType
13315
+ });
13316
+ var newFramebuffer = Framebuffer.create({
13317
+ name: name,
13318
+ storeAction: {},
13319
+ viewport: [
13320
+ 0,
13321
+ 0,
13322
+ width,
13323
+ height
13324
+ ],
13325
+ attachments: [
13326
+ colorAttachment
13327
+ ],
13328
+ depthStencilAttachment: {
13329
+ storageType: depthType
13330
+ }
13331
+ }, this.engine.renderer);
13332
+ var entry1 = {
13333
+ RT: newFramebuffer,
13334
+ lastFrameReleased: 0,
13335
+ descriptionHash: hash,
13336
+ isOccupied: true
13337
+ };
13338
+ this.temporaryRTs.push(entry1);
13339
+ return entry1.RT;
13340
+ };
13341
+ /**
13342
+ * 释放 RenderTarget,使其可以被复用
13343
+ * @param rt - 要释放的 Framebuffer
13344
+ */ _proto.release = function release(rt) {
13345
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.temporaryRTs), _step; !(_step = _iterator()).done;){
13346
+ var entry = _step.value;
13347
+ if (entry.RT === rt) {
13348
+ entry.isOccupied = false;
13349
+ entry.lastFrameReleased = this.currentFrame;
13350
+ break;
13351
+ }
13352
+ }
13353
+ };
13354
+ _proto.dispose = function dispose() {
13355
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.temporaryRTs), _step; !(_step = _iterator()).done;){
13356
+ var entry = _step.value;
13357
+ entry.RT.dispose();
13358
+ }
13359
+ };
13360
+ return RenderTargetPool;
13361
+ }();
13362
+
13720
13363
  var isWebGL2Available = typeof WebGL2RenderingContext === "function";
13721
13364
  var GPUCapability = /*#__PURE__*/ function() {
13722
13365
  function GPUCapability(gl) {
@@ -13902,70 +13545,11 @@ var CompressTextureCapabilityType;
13902
13545
  return !!hasCompressedTextureSupport;
13903
13546
  }
13904
13547
 
13905
- var FilterMode;
13906
- (function(FilterMode) {
13907
- FilterMode[FilterMode["Nearest"] = 0] = "Nearest";
13908
- FilterMode[FilterMode["Linear"] = 1] = "Linear";
13909
- })(FilterMode || (FilterMode = {}));
13910
- var RenderTextureFormat;
13911
- (function(RenderTextureFormat) {
13912
- RenderTextureFormat[RenderTextureFormat["RGBA32"] = 0] = "RGBA32";
13913
- RenderTextureFormat[RenderTextureFormat["RGBAHalf"] = 1] = "RGBAHalf";
13914
- })(RenderTextureFormat || (RenderTextureFormat = {}));
13915
- /**
13916
- *
13917
- */ var Framebuffer = /*#__PURE__*/ function() {
13918
- function Framebuffer() {}
13919
- var _proto = Framebuffer.prototype;
13920
- _proto.resize = function resize(x, y, width, height) {
13921
- // OVERRIDE
13922
- };
13923
- _proto.resetColorTextures = function resetColorTextures(textures) {
13924
- // OVERRIDE
13925
- };
13926
- _proto.unbind = function unbind() {
13927
- // OVERRIDE
13928
- };
13929
- _proto.bind = function bind() {
13930
- // OVERRIDE
13931
- };
13932
- _proto.getDepthTexture = function getDepthTexture() {
13933
- // OVERRIDE
13934
- return undefined;
13935
- };
13936
- _proto.getStencilTexture = function getStencilTexture() {
13937
- // OVERRIDE
13938
- return undefined;
13939
- };
13940
- _proto.getColorTextures = function getColorTextures() {
13941
- // OVERRIDE
13942
- return [];
13943
- };
13944
- _proto.dispose = function dispose(options) {
13945
- // OVERRIDE
13946
- };
13947
- _create_class(Framebuffer, [
13948
- {
13949
- key: "stencilStorage",
13950
- get: function get() {
13951
- // OVERRIDE
13952
- return undefined;
13953
- }
13954
- },
13955
- {
13956
- key: "depthStorage",
13957
- get: function get() {
13958
- // OVERRIDE
13959
- return undefined;
13960
- }
13961
- }
13962
- ]);
13963
- return Framebuffer;
13964
- }();
13965
-
13966
13548
  var Renderer = /*#__PURE__*/ function() {
13967
13549
  function Renderer(engine) {
13968
13550
  this.engine = engine;
13551
+ this.currentFramebuffer = null;
13552
+ this.renderTargetPool = new RenderTargetPool(engine);
13969
13553
  }
13970
13554
  var _proto = Renderer.prototype;
13971
13555
  _proto.setGlobalFloat = function setGlobalFloat(name, value) {
@@ -14035,8 +13619,10 @@ var Renderer = /*#__PURE__*/ function() {
14035
13619
  // OVERRIDE
14036
13620
  };
14037
13621
  _proto.getTemporaryRT = function getTemporaryRT(name, width, height, depthBuffer, filter, format) {
14038
- // OVERRIDE
14039
- return null;
13622
+ return this.renderTargetPool.get(name, width, height, depthBuffer, filter, format);
13623
+ };
13624
+ _proto.releaseTemporaryRT = function releaseTemporaryRT(rt) {
13625
+ this.renderTargetPool.release(rt);
14040
13626
  };
14041
13627
  _proto.dispose = function dispose() {
14042
13628
  // OVERRIDE
@@ -14044,6 +13630,41 @@ var Renderer = /*#__PURE__*/ function() {
14044
13630
  return Renderer;
14045
13631
  }();
14046
13632
 
13633
+ var SemanticMap = /*#__PURE__*/ function() {
13634
+ function SemanticMap(semantics) {
13635
+ if (semantics === void 0) semantics = {};
13636
+ this.semantics = _extends({}, semantics);
13637
+ }
13638
+ var _proto = SemanticMap.prototype;
13639
+ _proto.toObject = function toObject() {
13640
+ return _extends({}, this.semantics);
13641
+ };
13642
+ _proto.setSemantic = function setSemantic(name, value) {
13643
+ if (value === undefined) {
13644
+ delete this.semantics[name];
13645
+ } else {
13646
+ this.semantics[name] = value;
13647
+ }
13648
+ };
13649
+ _proto.getSemanticValue = function getSemanticValue(name, state) {
13650
+ var ret = this.semantics[name];
13651
+ if (isFunction(ret)) {
13652
+ return ret(state);
13653
+ }
13654
+ return ret;
13655
+ };
13656
+ _proto.hasSemanticValue = function hasSemanticValue(name) {
13657
+ return name in this.semantics;
13658
+ };
13659
+ _proto.dispose = function dispose() {
13660
+ var _this = this;
13661
+ Object.keys(this.semantics).forEach(function(name) {
13662
+ delete _this.semantics[name];
13663
+ });
13664
+ };
13665
+ return SemanticMap;
13666
+ }();
13667
+
14047
13668
  /**
14048
13669
  * @since 2.7.0
14049
13670
  */ var MaskableGraphic = /*#__PURE__*/ function(RendererComponent) {
@@ -18074,6 +17695,11 @@ var PlayState;
18074
17695
  PlayState[PlayState["Paused"] = 1] = "Paused";
18075
17696
  })(PlayState || (PlayState = {}));
18076
17697
 
17698
+ function _assert_this_initialized(self) {
17699
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17700
+ return self;
17701
+ }
17702
+
18077
17703
  var tempQuat$1 = new Quaternion();
18078
17704
  var tempVector3 = new Vector3();
18079
17705
  var tempVector3Second = new Vector3();
@@ -24451,8 +24077,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24451
24077
  _this.reusable = reusable;
24452
24078
  _this.speed = speed;
24453
24079
  _this.name = sourceContent.name;
24454
- _this.pluginSystem = scene.pluginSystem;
24455
- _this.pluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
24080
+ PluginSystem.initializeComposition(_assert_this_initialized(_this), scene);
24456
24081
  _this.camera = new Camera(_this.name, _extends({}, sourceContent == null ? void 0 : sourceContent.camera, {
24457
24082
  aspect: width / height,
24458
24083
  pixelWidth: width,
@@ -24466,7 +24091,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24466
24091
  _this.createRenderFrame();
24467
24092
  Composition.buildItemTree(_this.rootItem);
24468
24093
  _this.rootComposition.setChildrenRenderOrder(0);
24469
- _this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
24470
24094
  return _this;
24471
24095
  }
24472
24096
  var _proto = Composition.prototype;
@@ -24576,12 +24200,9 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24576
24200
  this.renderFrame = new RenderFrame({
24577
24201
  camera: this.camera,
24578
24202
  renderer: this.renderer,
24579
- keepColorBuffer: this.keepColorBuffer,
24580
24203
  globalVolume: this.globalVolume,
24581
24204
  postProcessingEnabled: this.postProcessingEnabled
24582
24205
  });
24583
- // TODO 考虑放到构造函数
24584
- this.renderFrame.cachedTextures = this.textures;
24585
24206
  };
24586
24207
  /**
24587
24208
  * 跳到指定时间点(不做任何播放行为)
@@ -24632,7 +24253,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24632
24253
  this.isEnded = false;
24633
24254
  this.isEndCalled = false;
24634
24255
  this.rootComposition.time = 0;
24635
- this.pluginSystem.resetComposition(this, this.renderFrame);
24636
24256
  };
24637
24257
  _proto.prepareRender = function prepareRender() {};
24638
24258
  /**
@@ -24650,8 +24270,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24650
24270
  var previousCompositionTime = this.time;
24651
24271
  this.updateCompositionTime(deltaTime * this.speed / 1000);
24652
24272
  var deltaTimeInMs = (this.time - previousCompositionTime) * 1000;
24653
- // 更新 model-tree-plugin
24654
- this.updatePluginLoaders(deltaTimeInMs);
24655
24273
  this.sceneTicking.update.tick(deltaTimeInMs);
24656
24274
  this.sceneTicking.lateUpdate.tick(deltaTimeInMs);
24657
24275
  this.updateCamera();
@@ -24676,15 +24294,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24676
24294
  this.camera.updateMatrix();
24677
24295
  };
24678
24296
  /**
24679
- * 插件更新,来自 CompVFXItem 的更新调用
24680
- * @param deltaTime - 更新的时间步长
24681
- */ _proto.updatePluginLoaders = function updatePluginLoaders(deltaTime) {
24682
- var _this = this;
24683
- this.pluginSystem.plugins.forEach(function(loader) {
24684
- return loader.onCompositionUpdate(_this, deltaTime);
24685
- });
24686
- };
24687
- /**
24688
24297
  * 更新主合成组件
24689
24298
  */ _proto.updateCompositionTime = function updateCompositionTime(deltaTime) {
24690
24299
  if (this.rootComposition.state === PlayState.Paused || !this.rootComposition.isActiveAndEnabled) {
@@ -24843,7 +24452,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24843
24452
  * 合成对象销毁
24844
24453
  */ _proto.dispose = function dispose() {
24845
24454
  var _this = this;
24846
- var _this_pluginSystem;
24847
24455
  if (this.destroyed) {
24848
24456
  return;
24849
24457
  }
@@ -24863,13 +24471,14 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24863
24471
  this.rootItem.dispose();
24864
24472
  // FIXME: 注意这里增加了renderFrame销毁
24865
24473
  this.renderFrame.dispose();
24866
- (_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
24474
+ PluginSystem.destroyComposition(this);
24867
24475
  this.update = function() {
24868
24476
  {
24869
24477
  logger.error("Update disposed composition: " + _this.name + ".");
24870
24478
  }
24871
24479
  };
24872
24480
  this.dispose = noop;
24481
+ this.renderer.engine.removeComposition(this);
24873
24482
  if (this.getEngine().env === PLAYER_OPTIONS_ENV_EDITOR) {
24874
24483
  return;
24875
24484
  }
@@ -24886,7 +24495,6 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24886
24495
  0
24887
24496
  ]
24888
24497
  });
24889
- this.renderer.engine.removeComposition(this);
24890
24498
  };
24891
24499
  /**
24892
24500
  * 编辑器使用的 transform 修改方法
@@ -29279,6 +28887,12 @@ var TextComponentBase = /*#__PURE__*/ function() {
29279
28887
  this.textLayout.textVerticalAlign = value;
29280
28888
  this.isDirty = true;
29281
28889
  };
28890
+ /**
28891
+ * @deprecated 2.8.0 本方法已废弃,请使用 setTextVerticalAlign 替代。
28892
+ */ _proto.setTextBaseline = function setTextBaseline(value) {
28893
+ console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。" + "本次调用将转调用 setTextVerticalAlign。");
28894
+ this.setTextVerticalAlign(value);
28895
+ };
29282
28896
  _proto.setTextColor = function setTextColor(value) {
29283
28897
  if (this.textStyle.textColor === value) {
29284
28898
  return;
@@ -29543,7 +29157,9 @@ var TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
29543
29157
  this.lineCount = this.getLineCount(this.text);
29544
29158
  this.isDirty = true;
29545
29159
  };
29546
- _proto.updateWithOptions = function updateWithOptions(options) {
29160
+ /**
29161
+ * 根据配置更新文本样式和布局
29162
+ */ _proto.updateWithOptions = function updateWithOptions(options) {
29547
29163
  // 初始化 textStyle 和 textLayout
29548
29164
  if (!this.textStyle) {
29549
29165
  this.textStyle = new TextStyle(options);
@@ -31853,7 +31469,7 @@ function getStandardSpriteContent(sprite, transform) {
31853
31469
  return ret;
31854
31470
  }
31855
31471
 
31856
- var version$2 = "2.8.0-alpha.0";
31472
+ var version$2 = "2.8.0-alpha.2";
31857
31473
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31858
31474
  var standardVersion = /^(\d+)\.(\d+)$/;
31859
31475
  var reverseParticle = false;
@@ -32368,7 +31984,7 @@ var seed$1 = 1;
32368
31984
  * @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
32369
31985
  * @param options - 扩展参数
32370
31986
  * @returns
32371
- */ _proto.loadScene = function loadScene(url, renderer, options) {
31987
+ */ _proto.loadScene = function loadScene(url, renderer) {
32372
31988
  var _this = this;
32373
31989
  return _async_to_generator(function() {
32374
31990
  var rawJSON, assetUrl, startTime, timeInfoMessages, gpuInstance, _gpuInstance_detail_ktx2Support, isKTX2Supported, timeInfos, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
@@ -32429,7 +32045,7 @@ var seed$1 = 1;
32429
32045
  });
32430
32046
  });
32431
32047
  loadResourcePromise = /*#__PURE__*/ _async_to_generator(function() {
32432
- var scene, link, _ref, jsonScene, pluginSystem, _jsonScene_bins, bins, images, fonts, _ref1, loadedBins, loadedImages, loadedTextures, totalTime;
32048
+ var scene, link, _scene_bins, _scene_textureOptions, _scene_images, jsonScene, _jsonScene_bins, bins, images, fonts, _ref, loadedBins, loadedImages, loadedTextures, totalTime;
32433
32049
  return __generator(this, function(_state) {
32434
32050
  switch(_state.label){
32435
32051
  case 0:
@@ -32479,7 +32095,26 @@ var seed$1 = 1;
32479
32095
  })
32480
32096
  ];
32481
32097
  case 5:
32482
- _ref = _state.sent(), jsonScene = _ref.jsonScene, pluginSystem = _ref.pluginSystem;
32098
+ jsonScene = _state.sent().jsonScene;
32099
+ scene = {
32100
+ timeInfos: timeInfos,
32101
+ url: url,
32102
+ storage: {},
32103
+ jsonScene: jsonScene,
32104
+ bins: [],
32105
+ textureOptions: [],
32106
+ textures: [],
32107
+ images: [],
32108
+ assets: _this.assets
32109
+ };
32110
+ return [
32111
+ 4,
32112
+ hookTimeInfo("plugin:processAssets", function() {
32113
+ return _this.processPluginAssets(scene);
32114
+ })
32115
+ ];
32116
+ case 6:
32117
+ _state.sent();
32483
32118
  _jsonScene_bins = jsonScene.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images = jsonScene.images, fonts = jsonScene.fonts;
32484
32119
  return [
32485
32120
  4,
@@ -32490,46 +32125,26 @@ var seed$1 = 1;
32490
32125
  hookTimeInfo("processImages", function() {
32491
32126
  return _this.processImages(images, isKTX2Supported);
32492
32127
  }),
32493
- hookTimeInfo("plugin:processAssets", function() {
32494
- return _this.processPluginAssets(jsonScene, pluginSystem, options);
32495
- }),
32496
32128
  hookTimeInfo("processFontURL", function() {
32497
32129
  return _this.processFontURL(fonts);
32498
32130
  })
32499
32131
  ])
32500
32132
  ];
32501
- case 6:
32502
- _ref1 = _state.sent(), loadedBins = _ref1[0], loadedImages = _ref1[1];
32133
+ case 7:
32134
+ _ref = _state.sent(), loadedBins = _ref[0], loadedImages = _ref[1];
32503
32135
  return [
32504
32136
  4,
32505
32137
  hookTimeInfo("processTextures", function() {
32506
32138
  return _this.processTextures(loadedImages, loadedBins, jsonScene);
32507
32139
  })
32508
32140
  ];
32509
- case 7:
32510
- loadedTextures = _state.sent();
32511
- scene = {
32512
- timeInfos: timeInfos,
32513
- url: url,
32514
- renderLevel: _this.options.renderLevel,
32515
- storage: {},
32516
- pluginSystem: pluginSystem,
32517
- jsonScene: jsonScene,
32518
- bins: loadedBins,
32519
- textureOptions: loadedTextures,
32520
- textures: [],
32521
- images: loadedImages,
32522
- assets: _this.assets
32523
- };
32524
- // 触发插件系统 pluginSystem 的回调 prepareResource
32525
- return [
32526
- 4,
32527
- hookTimeInfo("plugin:prepareResource", function() {
32528
- return pluginSystem.loadResources(scene, _this.options);
32529
- })
32530
- ];
32531
32141
  case 8:
32532
- _state.sent();
32142
+ loadedTextures = _state.sent();
32143
+ (_scene_bins = scene.bins).push.apply(_scene_bins, [].concat(loadedBins));
32144
+ (_scene_textureOptions = scene.textureOptions).push.apply(_scene_textureOptions, [].concat(loadedTextures));
32145
+ (_scene_images = scene.images).push.apply(_scene_images, [].concat(loadedImages));
32146
+ // 降级插件会修改 this.options.renderLevel, 在 processPluginAssets 后赋值
32147
+ scene.renderLevel = _this.options.renderLevel;
32533
32148
  _state.label = 9;
32534
32149
  case 9:
32535
32150
  totalTime = performance.now() - startTime;
@@ -32561,29 +32176,23 @@ var seed$1 = 1;
32561
32176
  return this.assets;
32562
32177
  };
32563
32178
  _proto.processJSON = function processJSON(json) {
32564
- var _this = this;
32565
32179
  return _async_to_generator(function() {
32566
- var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
32180
+ var jsonScene, _jsonScene_plugins, plugins, _iterator, _step, customPluginName;
32567
32181
  return __generator(this, function(_state) {
32568
- switch(_state.label){
32569
- case 0:
32570
- jsonScene = getStandardJSON(json);
32571
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
32572
- pluginSystem = new PluginSystem(plugins);
32573
- return [
32574
- 4,
32575
- pluginSystem.processRawJSON(jsonScene, _this.options)
32576
- ];
32577
- case 1:
32578
- _state.sent();
32579
- return [
32580
- 2,
32581
- {
32582
- jsonScene: jsonScene,
32583
- pluginSystem: pluginSystem
32584
- }
32585
- ];
32182
+ jsonScene = getStandardJSON(json);
32183
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
32184
+ for(_iterator = _create_for_of_iterator_helper_loose(plugins); !(_step = _iterator()).done;){
32185
+ customPluginName = _step.value;
32186
+ if (!pluginLoaderMap[customPluginName]) {
32187
+ throw new Error("The plugin '" + customPluginName + "' not found." + getPluginUsageInfo(customPluginName));
32188
+ }
32586
32189
  }
32190
+ return [
32191
+ 2,
32192
+ {
32193
+ jsonScene: jsonScene
32194
+ }
32195
+ ];
32587
32196
  });
32588
32197
  })();
32589
32198
  };
@@ -32789,30 +32398,18 @@ var seed$1 = 1;
32789
32398
  });
32790
32399
  })();
32791
32400
  };
32792
- _proto.processPluginAssets = function processPluginAssets(jsonScene, pluginSystem, options) {
32401
+ _proto.processPluginAssets = function processPluginAssets(scene) {
32793
32402
  var _this = this;
32794
32403
  return _async_to_generator(function() {
32795
- var pluginResult, _pluginResult_reduce, assets, loadedAssets, i;
32796
32404
  return __generator(this, function(_state) {
32797
32405
  switch(_state.label){
32798
32406
  case 0:
32799
32407
  return [
32800
32408
  4,
32801
- pluginSystem.processAssets(jsonScene, options)
32409
+ PluginSystem.processAssets(scene, _this.options)
32802
32410
  ];
32803
32411
  case 1:
32804
- pluginResult = _state.sent();
32805
- _pluginResult_reduce = pluginResult.reduce(function(acc, cur) {
32806
- acc.assets = acc.assets.concat(cur.assets);
32807
- acc.loadedAssets = acc.loadedAssets.concat(cur.loadedAssets);
32808
- return acc;
32809
- }, {
32810
- assets: [],
32811
- loadedAssets: []
32812
- }), assets = _pluginResult_reduce.assets, loadedAssets = _pluginResult_reduce.loadedAssets;
32813
- for(i = 0; i < assets.length; i++){
32814
- _this.assets[assets[i].id] = loadedAssets[i];
32815
- }
32412
+ _state.sent();
32816
32413
  return [
32817
32414
  2
32818
32415
  ];
@@ -33239,7 +32836,6 @@ function _createTextureOptionsBySource() {
33239
32836
  }
33240
32837
  };
33241
32838
  _proto.prepareAssets = function prepareAssets(scene, assets) {
33242
- this.engine.clearResources();
33243
32839
  for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(assets)), _step; !(_step = _iterator()).done;){
33244
32840
  var assetId = _step.value;
33245
32841
  var asset = assets[assetId];
@@ -35151,8 +34747,9 @@ var DEFAULT_FPS = 60;
35151
34747
  ]
35152
34748
  });
35153
34749
  for(var i1 = 0; i1 < comps.length; i1++){
35154
- !comps[i1].renderFrame.isDestroyed && this.renderer.renderRenderFrame(comps[i1].renderFrame);
34750
+ !comps[i1].renderFrame.isDisposed && this.renderer.renderRenderFrame(comps[i1].renderFrame);
35155
34751
  }
34752
+ this.renderer.renderTargetPool.flush();
35156
34753
  };
35157
34754
  /**
35158
34755
  * 将渲染器重新和父容器大小对齐
@@ -35398,6 +34995,95 @@ var DEFAULT_FPS = 60;
35398
34995
  return Engine;
35399
34996
  }(EventEmitter);
35400
34997
 
34998
+ var def = {
34999
+ format: glContext.RGBA,
35000
+ type: glContext.UNSIGNED_BYTE,
35001
+ minFilter: glContext.LINEAR,
35002
+ magFilter: glContext.LINEAR,
35003
+ wrapS: glContext.CLAMP_TO_EDGE,
35004
+ wrapT: glContext.CLAMP_TO_EDGE
35005
+ };
35006
+ var disposeSymbol = Symbol("dispose");
35007
+ var PassTextureCache = /*#__PURE__*/ function() {
35008
+ function PassTextureCache(engine) {
35009
+ this.textureCache = {};
35010
+ this.textureRef = {};
35011
+ this.engine = engine;
35012
+ }
35013
+ var _proto = PassTextureCache.prototype;
35014
+ _proto.requestColorAttachmentTexture = function requestColorAttachmentTexture(request) {
35015
+ var _this = this;
35016
+ var width = request.width, height = request.height, name = request.name;
35017
+ var options = {
35018
+ sourceType: TextureSourceType.framebuffer,
35019
+ data: {
35020
+ width: width,
35021
+ height: height
35022
+ },
35023
+ name: name
35024
+ };
35025
+ var keys = [
35026
+ name
35027
+ ];
35028
+ Object.getOwnPropertyNames(def).forEach(function(name) {
35029
+ var _request_name;
35030
+ var value = (_request_name = request[name]) != null ? _request_name : def[name];
35031
+ options[name] = value;
35032
+ keys.push(name, value);
35033
+ });
35034
+ var cacheId = keys.join(":");
35035
+ var tex = this.textureCache[cacheId];
35036
+ if (tex) {
35037
+ this.textureRef[cacheId]++;
35038
+ } else {
35039
+ var engine = this.engine;
35040
+ assertExist(engine);
35041
+ tex = Texture.create(engine, options);
35042
+ this.textureCache[cacheId] = tex;
35043
+ this.textureRef[cacheId] = 1;
35044
+ // @ts-expect-error
35045
+ tex[disposeSymbol] = tex.dispose;
35046
+ tex.dispose = function() {
35047
+ return _this.removeTexture(cacheId);
35048
+ };
35049
+ }
35050
+ return tex;
35051
+ };
35052
+ _proto.removeTexture = function removeTexture(id) {
35053
+ var refCount = this.textureRef[id];
35054
+ if (refCount <= 1) {
35055
+ if (refCount < 0) {
35056
+ console.error("Ref count < 0.");
35057
+ }
35058
+ var tex = this.textureCache[id];
35059
+ if (tex) {
35060
+ // @ts-expect-error
35061
+ tex[disposeSymbol]();
35062
+ // @ts-expect-error
35063
+ tex.dispose = tex[disposeSymbol];
35064
+ }
35065
+ delete this.textureCache[id];
35066
+ delete this.textureRef[id];
35067
+ } else {
35068
+ this.textureRef[id] = refCount - 1;
35069
+ }
35070
+ };
35071
+ _proto.dispose = function dispose() {
35072
+ var _this = this;
35073
+ Object.keys(this.textureCache).forEach(function(key) {
35074
+ var texture = _this.textureCache[key];
35075
+ // @ts-expect-error
35076
+ texture[disposeSymbol]();
35077
+ // @ts-expect-error
35078
+ texture.dispose = texture[disposeSymbol];
35079
+ });
35080
+ this.textureCache = {};
35081
+ this.textureRef = {};
35082
+ this.engine = undefined;
35083
+ };
35084
+ return PassTextureCache;
35085
+ }();
35086
+
35401
35087
  var SceneLoader = /*#__PURE__*/ function() {
35402
35088
  function SceneLoader() {}
35403
35089
  SceneLoader.load = function load(scene, engine, options) {
@@ -35416,16 +35102,16 @@ var SceneLoader = /*#__PURE__*/ function() {
35416
35102
  engine.assetManagers.push(assetManager);
35417
35103
  return [
35418
35104
  4,
35419
- assetManager.loadScene(scene, engine.renderer, {
35420
- env: engine.env
35421
- })
35105
+ assetManager.loadScene(scene, engine.renderer)
35422
35106
  ];
35423
35107
  case 1:
35424
35108
  loadedScene = _state.sent();
35109
+ engine.clearResources();
35110
+ // 触发插件系统 pluginSystem 的回调 prepareResource
35111
+ PluginSystem.loadResources(loadedScene, assetManager.options, engine);
35425
35112
  engine.assetService.prepareAssets(loadedScene, loadedScene.assets);
35426
35113
  engine.assetService.updateTextVariables(loadedScene, options.variables);
35427
35114
  engine.assetService.initializeTexture(loadedScene);
35428
- loadedScene.pluginSystem.precompile(loadedScene.jsonScene.compositions, engine.renderer);
35429
35115
  composition = _this.createComposition(loadedScene, engine, options);
35430
35116
  composition.setIndex(compositionIndex);
35431
35117
  compileStart = performance.now();
@@ -35478,13 +35164,13 @@ var SceneLoader = /*#__PURE__*/ function() {
35478
35164
  return SceneLoader;
35479
35165
  }();
35480
35166
 
35481
- registerPlugin("camera", CameraVFXItemLoader, VFXItem);
35482
- registerPlugin("text", TextLoader, VFXItem);
35483
- registerPlugin("sprite", SpriteLoader, VFXItem);
35484
- registerPlugin("particle", ParticleLoader, VFXItem);
35485
- registerPlugin("cal", CalculateLoader, VFXItem);
35486
- registerPlugin("interact", InteractLoader, VFXItem);
35487
- var version$1 = "2.8.0-alpha.0";
35167
+ registerPlugin("camera", CameraVFXItemLoader);
35168
+ registerPlugin("text", TextLoader);
35169
+ registerPlugin("sprite", SpriteLoader);
35170
+ registerPlugin("particle", ParticleLoader);
35171
+ registerPlugin("cal", CalculateLoader);
35172
+ registerPlugin("interact", InteractLoader);
35173
+ var version$1 = "2.8.0-alpha.2";
35488
35174
  logger.info("Core version: " + version$1 + ".");
35489
35175
 
35490
35176
  var _obj;
@@ -36762,7 +36448,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
36762
36448
  return [
36763
36449
  4,
36764
36450
  Promise.all(scenes.map(/*#__PURE__*/ _async_to_generator(function(url, index) {
36765
- var _this_assetService_assembleSceneLoadOptions, source, opts, assetManager, _$scene, composition;
36451
+ var _this_assetService_assembleSceneLoadOptions, source, opts, assetManager, _$scene, engine, composition;
36766
36452
  return __generator(this, function(_state) {
36767
36453
  switch(_state.label){
36768
36454
  case 0:
@@ -36772,16 +36458,17 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
36772
36458
  assetManager = new AssetManager(opts);
36773
36459
  return [
36774
36460
  4,
36775
- assetManager.loadScene(source, _this.renderer, {
36776
- env: _this.env
36777
- })
36461
+ assetManager.loadScene(source, _this.renderer)
36778
36462
  ];
36779
36463
  case 1:
36780
36464
  _$scene = _state.sent();
36465
+ engine = _this.engine;
36466
+ engine.clearResources();
36467
+ // 触发插件系统 pluginSystem 的回调 prepareResource
36468
+ PluginSystem.loadResources(_$scene, assetManager.options, engine);
36781
36469
  _this.assetService.prepareAssets(_$scene, assetManager.getAssets());
36782
36470
  _this.assetService.updateTextVariables(_$scene, assetManager.options.variables);
36783
36471
  _this.assetService.initializeTexture(_$scene);
36784
- _$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer);
36785
36472
  composition = _this.createComposition(_$scene, opts);
36786
36473
  _this.baseCompositionIndex += 1;
36787
36474
  composition.setIndex(baseOrder + index);
@@ -37073,8 +36760,8 @@ applyMixins(ThreeTextComponent, [
37073
36760
  */ Mesh.create = function(engine, props) {
37074
36761
  return new ThreeMesh(engine, props);
37075
36762
  };
37076
- var version = "2.8.0-alpha.0";
36763
+ var version = "2.8.0-alpha.2";
37077
36764
  logger.info("THREEJS plugin version: " + version + ".");
37078
36765
 
37079
- 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, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, PropertyClipPlayable, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SourceType, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, setUniformValue, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
36766
+ 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, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, DEFAULT_FONTS, DEFAULT_FPS, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, GraphInstance, GraphNode, GraphNodeData, GraphicsPath, GreaterNodeData, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, NodeTransform, NotNode, NotNodeData, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, PropertyClipPlayable, PropertyTrack, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, ShapePath, SourceType, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TangentMode, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, WeightedMode, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getClass, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, setUniformValue, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
37080
36767
  //# sourceMappingURL=index.mjs.map