@galacean/effects-threejs 2.2.0-alpha.0 → 2.2.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js 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.2.0-alpha.0
6
+ * Version: v2.2.1-alpha.0
7
7
  */
8
8
 
9
9
  'use strict';
@@ -5743,22 +5743,6 @@ exports.TextureSourceType = void 0;
5743
5743
  TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
5744
5744
  })(exports.TextureSourceType || (exports.TextureSourceType = {}));
5745
5745
 
5746
- var RUNTIME_ENV = "runtime_env";
5747
- var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
5748
- // 文本元素使用 offscreen canvas 绘制
5749
- var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
5750
- // 后处理配置相关
5751
- var POST_PROCESS_SETTINGS = "post_process_settings";
5752
- // 加载图片时是否使用 ImageBitmap
5753
- var LOAD_PREFER_IMAGE_BITMAP = "load_image_bitmap";
5754
- var config = {};
5755
- function getConfig(name) {
5756
- return config[name];
5757
- }
5758
- function setConfig(name, value) {
5759
- return config[name] = value;
5760
- }
5761
-
5762
5746
  /**
5763
5747
  * 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
5764
5748
  */ var Downloader = /*#__PURE__*/ function() {
@@ -5847,11 +5831,11 @@ var avifFailed = false;
5847
5831
  * 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
5848
5832
  * @param png - PNG 图片文件的 URL
5849
5833
  * @param webp - WebP 图片文件的 URL
5850
- */ function loadWebPOptional(png, webp, options) {
5834
+ */ function loadWebPOptional(png, webp) {
5851
5835
  return _loadWebPOptional.apply(this, arguments);
5852
5836
  }
5853
5837
  function _loadWebPOptional() {
5854
- _loadWebPOptional = _async_to_generator(function(png, webp, options) {
5838
+ _loadWebPOptional = _async_to_generator(function(png, webp) {
5855
5839
  var image, image1, image2;
5856
5840
  return __generator(this, function(_state) {
5857
5841
  switch(_state.label){
@@ -5862,7 +5846,7 @@ function _loadWebPOptional() {
5862
5846
  ];
5863
5847
  return [
5864
5848
  4,
5865
- loadImageBitmap(png, options)
5849
+ loadImage(png)
5866
5850
  ];
5867
5851
  case 1:
5868
5852
  image = _state.sent();
@@ -5882,7 +5866,7 @@ function _loadWebPOptional() {
5882
5866
  ]);
5883
5867
  return [
5884
5868
  4,
5885
- loadImageBitmap(webp, options)
5869
+ loadImage(webp)
5886
5870
  ];
5887
5871
  case 3:
5888
5872
  image1 = _state.sent();
@@ -5898,7 +5882,7 @@ function _loadWebPOptional() {
5898
5882
  webPFailed = true;
5899
5883
  return [
5900
5884
  4,
5901
- loadImageBitmap(png, options)
5885
+ loadImage(png)
5902
5886
  ];
5903
5887
  case 5:
5904
5888
  image2 = _state.sent();
@@ -5922,11 +5906,11 @@ function _loadWebPOptional() {
5922
5906
  * 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
5923
5907
  * @param png - PNG 图片文件的 URL
5924
5908
  * @param avif - AVIF 图片文件的 URL
5925
- */ function loadAVIFOptional(png, avif, options) {
5909
+ */ function loadAVIFOptional(png, avif) {
5926
5910
  return _loadAVIFOptional.apply(this, arguments);
5927
5911
  }
5928
5912
  function _loadAVIFOptional() {
5929
- _loadAVIFOptional = _async_to_generator(function(png, avif, options) {
5913
+ _loadAVIFOptional = _async_to_generator(function(png, avif) {
5930
5914
  var image, image1, image2;
5931
5915
  return __generator(this, function(_state) {
5932
5916
  switch(_state.label){
@@ -5937,7 +5921,7 @@ function _loadAVIFOptional() {
5937
5921
  ];
5938
5922
  return [
5939
5923
  4,
5940
- loadImageBitmap(png, options)
5924
+ loadImage(png)
5941
5925
  ];
5942
5926
  case 1:
5943
5927
  image = _state.sent();
@@ -5957,7 +5941,7 @@ function _loadAVIFOptional() {
5957
5941
  ]);
5958
5942
  return [
5959
5943
  4,
5960
- loadImageBitmap(avif, options)
5944
+ loadImage(avif)
5961
5945
  ];
5962
5946
  case 3:
5963
5947
  image1 = _state.sent();
@@ -5973,7 +5957,7 @@ function _loadAVIFOptional() {
5973
5957
  avifFailed = true;
5974
5958
  return [
5975
5959
  4,
5976
- loadImageBitmap(png, options)
5960
+ loadImage(png)
5977
5961
  ];
5978
5962
  case 5:
5979
5963
  image2 = _state.sent();
@@ -6188,80 +6172,6 @@ function _loadMedia() {
6188
6172
  });
6189
6173
  return _loadMedia.apply(this, arguments);
6190
6174
  }
6191
- var imageBitMapAvailable = typeof createImageBitmap === "function";
6192
- /**
6193
- * 异步加载一个图片文件,如果支持 ImageBitmap 则返回 ImageBitmap 对象
6194
- * @param source
6195
- * @param options
6196
- * @returns
6197
- */ function loadImageBitmap(source, options) {
6198
- return _loadImageBitmap.apply(this, arguments);
6199
- }
6200
- function _loadImageBitmap() {
6201
- _loadImageBitmap = _async_to_generator(function(source, options) {
6202
- var blob;
6203
- return __generator(this, function(_state) {
6204
- switch(_state.label){
6205
- case 0:
6206
- if (!(imageBitMapAvailable && getConfig(LOAD_PREFER_IMAGE_BITMAP))) return [
6207
- 3,
6208
- 4
6209
- ];
6210
- if (!(typeof source === "string")) return [
6211
- 3,
6212
- 2
6213
- ];
6214
- return [
6215
- 4,
6216
- loadBlob(source)
6217
- ];
6218
- case 1:
6219
- blob = _state.sent();
6220
- return [
6221
- 3,
6222
- 3
6223
- ];
6224
- case 2:
6225
- if (_instanceof1(source, Blob)) {
6226
- blob = source;
6227
- } else {
6228
- return [
6229
- 2,
6230
- loadImage(source)
6231
- ];
6232
- }
6233
- _state.label = 3;
6234
- case 3:
6235
- return [
6236
- 2,
6237
- createImageBitmap(blob, options)
6238
- ];
6239
- case 4:
6240
- return [
6241
- 2,
6242
- loadImage(source)
6243
- ];
6244
- case 5:
6245
- return [
6246
- 2
6247
- ];
6248
- }
6249
- });
6250
- });
6251
- return _loadImageBitmap.apply(this, arguments);
6252
- }
6253
- /**
6254
- * 关闭 ImageBitMap,释放内存
6255
- * @param imgs
6256
- */ function closeImageBitMap(imgs) {
6257
- if (imageBitMapAvailable) {
6258
- if (_instanceof1(imgs, ImageBitmap)) {
6259
- imgs.close();
6260
- } else if (_instanceof1(imgs, Array)) {
6261
- imgs.forEach(closeImageBitMap);
6262
- }
6263
- }
6264
- }
6265
6175
 
6266
6176
  function deserializeMipmapTexture(textureOptions, bins, assets) {
6267
6177
  return _deserializeMipmapTexture.apply(this, arguments);
@@ -16925,9 +16835,11 @@ function shouldIgnoreBouncing(arg, mul) {
16925
16835
  */ var MeshCollider = /*#__PURE__*/ function() {
16926
16836
  function MeshCollider() {
16927
16837
  this.triangles = [];
16838
+ this.worldMatrix = new Matrix4();
16928
16839
  }
16929
16840
  var _proto = MeshCollider.prototype;
16930
16841
  _proto.getBoundingBoxData = function getBoundingBoxData() {
16842
+ this.applyWorldMatrix(this.boundingBoxData.area);
16931
16843
  return this.boundingBoxData;
16932
16844
  };
16933
16845
  _proto.getBoundingBox = function getBoundingBox() {
@@ -16957,6 +16869,7 @@ function shouldIgnoreBouncing(arg, mul) {
16957
16869
  p1: point2,
16958
16870
  p2: point3
16959
16871
  });
16872
+ this.applyWorldMatrix(area);
16960
16873
  return {
16961
16874
  type: exports.HitTestType.triangle,
16962
16875
  area: area
@@ -16977,11 +16890,7 @@ function shouldIgnoreBouncing(arg, mul) {
16977
16890
  });
16978
16891
  }
16979
16892
  if (worldMatrix) {
16980
- area.forEach(function(triangle) {
16981
- triangle.p0 = worldMatrix.transformPoint(triangle.p0, new Vector3());
16982
- triangle.p1 = worldMatrix.transformPoint(triangle.p1, new Vector3());
16983
- triangle.p2 = worldMatrix.transformPoint(triangle.p2, new Vector3());
16984
- });
16893
+ this.worldMatrix.copyFrom(worldMatrix);
16985
16894
  }
16986
16895
  this.boundingBoxData = {
16987
16896
  type: exports.HitTestType.triangle,
@@ -17021,6 +16930,15 @@ function shouldIgnoreBouncing(arg, mul) {
17021
16930
  }
17022
16931
  return res;
17023
16932
  };
16933
+ _proto.applyWorldMatrix = function applyWorldMatrix(area) {
16934
+ var _this = this;
16935
+ area.forEach(function(triangle) {
16936
+ triangle.p0 = _this.worldMatrix.transformPoint(triangle.p0, new Vector3());
16937
+ triangle.p1 = _this.worldMatrix.transformPoint(triangle.p1, new Vector3());
16938
+ triangle.p2 = _this.worldMatrix.transformPoint(triangle.p2, new Vector3());
16939
+ });
16940
+ return area;
16941
+ };
17024
16942
  return MeshCollider;
17025
16943
  }();
17026
16944
 
@@ -17916,7 +17834,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
17916
17834
  };
17917
17835
  /**
17918
17836
  * 添加组件
17919
- * @param classConstructor - 要添加的组件类型
17837
+ * @param classConstructor - 要添加的组件
17920
17838
  */ _proto.addComponent = function addComponent(classConstructor) {
17921
17839
  var newComponent = new classConstructor(this.engine);
17922
17840
  this.components.push(newComponent);
@@ -18159,7 +18077,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
18159
18077
  };
18160
18078
  _proto.fromData = function fromData(data) {
18161
18079
  EffectsObject.prototype.fromData.call(this, data);
18162
- var id = data.id, name = data.name, delay = data.delay, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_listIndex = data.listIndex, listIndex = _data_listIndex === void 0 ? 0 : _data_listIndex, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration;
18080
+ var id = data.id, name = data.name, delay = data.delay, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration;
18163
18081
  this.props = data;
18164
18082
  //@ts-expect-error
18165
18083
  this.type = data.type;
@@ -18221,8 +18139,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
18221
18139
  this.rendererComponents.push(component.renderer);
18222
18140
  }
18223
18141
  }
18224
- // renderOrder 在 component 初始化后设置。确保能拿到 rendererComponent。
18225
- this.renderOrder = listIndex;
18226
18142
  };
18227
18143
  _proto.toData = function toData() {
18228
18144
  var _this_parent;
@@ -18830,6 +18746,20 @@ exports.SpriteComponent = __decorate([
18830
18746
  effectsClass(DataType.SpriteComponent)
18831
18747
  ], exports.SpriteComponent);
18832
18748
 
18749
+ var RUNTIME_ENV = "runtime_env";
18750
+ var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
18751
+ // 文本元素使用 offscreen canvas 绘制
18752
+ var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
18753
+ // 后处理配置相关
18754
+ var POST_PROCESS_SETTINGS = "post_process_settings";
18755
+ var config = {};
18756
+ function getConfig(name) {
18757
+ return config[name];
18758
+ }
18759
+ function setConfig(name, value) {
18760
+ return config[name] = value;
18761
+ }
18762
+
18833
18763
  var Cone = /*#__PURE__*/ function() {
18834
18764
  function Cone(props) {
18835
18765
  var _this = this;
@@ -23901,6 +23831,20 @@ var SerializationHelper = /*#__PURE__*/ function() {
23901
23831
  }
23902
23832
  return regions;
23903
23833
  };
23834
+ /**
23835
+ * 设置当前合成子元素的渲染顺序
23836
+ * @internal
23837
+ */ _proto.setChildrenRenderOrder = function setChildrenRenderOrder(startOrder) {
23838
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
23839
+ var item = _step.value;
23840
+ item.renderOrder = startOrder++;
23841
+ var subCompositionComponent = item.getComponent(CompositionComponent);
23842
+ if (subCompositionComponent) {
23843
+ startOrder = subCompositionComponent.setChildrenRenderOrder(startOrder);
23844
+ }
23845
+ }
23846
+ return startOrder;
23847
+ };
23904
23848
  _proto.fromData = function fromData(data) {
23905
23849
  Behaviour.prototype.fromData.call(this, data);
23906
23850
  this.items = data.items;
@@ -24715,7 +24659,7 @@ var TextLayout = /*#__PURE__*/ function() {
24715
24659
  function TextLayout(options) {
24716
24660
  this.width = 0;
24717
24661
  this.height = 0;
24718
- var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24662
+ var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.clip : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24719
24663
  var tempWidth = fontSize + letterSpace;
24720
24664
  this.autoWidth = autoWidth;
24721
24665
  this.maxTextWidth = text.length * tempWidth;
@@ -27337,7 +27281,6 @@ var seed$1 = 1;
27337
27281
  this.downloader = downloader;
27338
27282
  this.assets = {};
27339
27283
  this.sourceFrom = {};
27340
- this.imageBitmapOptions = {};
27341
27284
  this.id = seed$1++;
27342
27285
  this.timers = [];
27343
27286
  this.updateOptions(options);
@@ -27595,12 +27538,12 @@ var seed$1 = 1;
27595
27538
  _proto.processJSON = function processJSON(json) {
27596
27539
  var _this = this;
27597
27540
  return _async_to_generator(function() {
27598
- var jsonScene, _jsonScene_plugins, plugins, textures, pluginSystem;
27541
+ var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
27599
27542
  return __generator(this, function(_state) {
27600
27543
  switch(_state.label){
27601
27544
  case 0:
27602
27545
  jsonScene = getStandardJSON(json);
27603
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, textures = jsonScene.textures;
27546
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
27604
27547
  pluginSystem = new PluginSystem(plugins);
27605
27548
  return [
27606
27549
  4,
@@ -27608,7 +27551,6 @@ var seed$1 = 1;
27608
27551
  ];
27609
27552
  case 1:
27610
27553
  _state.sent();
27611
- _this.assignImageBitmapOptions(textures);
27612
27554
  return [
27613
27555
  2,
27614
27556
  {
@@ -27840,7 +27782,7 @@ var seed$1 = 1;
27840
27782
  ];
27841
27783
  return [
27842
27784
  4,
27843
- loadAVIFOptional(imageURL, avifURL, _this.imageBitmapOptions[id])
27785
+ loadAVIFOptional(imageURL, avifURL)
27844
27786
  ];
27845
27787
  case 10:
27846
27788
  _tmp = _state.sent();
@@ -27851,7 +27793,7 @@ var seed$1 = 1;
27851
27793
  case 11:
27852
27794
  return [
27853
27795
  4,
27854
- loadWebPOptional(imageURL, webpURL, _this.imageBitmapOptions[id])
27796
+ loadWebPOptional(imageURL, webpURL)
27855
27797
  ];
27856
27798
  case 12:
27857
27799
  _tmp = _state.sent();
@@ -28063,21 +28005,6 @@ var seed$1 = 1;
28063
28005
  this.assets[images[i].id] = loadedImages[i];
28064
28006
  }
28065
28007
  };
28066
- _proto.assignImageBitmapOptions = function assignImageBitmapOptions(textures) {
28067
- var _this = this;
28068
- if (textures === void 0) textures = [];
28069
- textures.forEach(function(texture) {
28070
- if (!(_instanceof1(texture, Texture) || "mipmaps" in texture)) {
28071
- var source = texture.source;
28072
- if (isObject(source)) {
28073
- _this.imageBitmapOptions[source.id] = {
28074
- imageOrientation: texture.flipY ? "flipY" : "none",
28075
- premultiplyAlpha: texture.premultiplyAlpha ? "premultiply" : "none"
28076
- };
28077
- }
28078
- }
28079
- });
28080
- };
28081
28008
  _proto.removeTimer = function removeTimer(id) {
28082
28009
  var index = this.timers.indexOf(id);
28083
28010
  if (index !== -1) {
@@ -28087,15 +28014,11 @@ var seed$1 = 1;
28087
28014
  /**
28088
28015
  * 销毁方法
28089
28016
  */ _proto.dispose = function dispose() {
28090
- var _this = this;
28091
28017
  if (this.timers.length) {
28092
28018
  this.timers.map(function(id) {
28093
28019
  return window.clearTimeout(id);
28094
28020
  });
28095
28021
  }
28096
- closeImageBitMap(Object.keys(this.assets).map(function(key) {
28097
- return _this.assets[key];
28098
- }));
28099
28022
  this.assets = {};
28100
28023
  this.sourceFrom = {};
28101
28024
  this.timers = [];
@@ -28112,7 +28035,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
28112
28035
  };
28113
28036
  if (_instanceof1(image, Texture)) {
28114
28037
  return _extends({}, image.source, options);
28115
- } else if (_instanceof1(image, HTMLImageElement) || _instanceof1(image, ImageBitmap) || isCanvas(image)) {
28038
+ } else if (_instanceof1(image, HTMLImageElement) || isCanvas(image)) {
28116
28039
  return _extends({
28117
28040
  image: image,
28118
28041
  sourceType: exports.TextureSourceType.image,
@@ -28439,7 +28362,6 @@ var tmpScale = new Vector3(1, 1, 1);
28439
28362
  return Camera;
28440
28363
  }();
28441
28364
 
28442
- var listOrder = 0;
28443
28365
  /**
28444
28366
  * 合成资源管理
28445
28367
  */ var CompositionSourceManager = /*#__PURE__*/ function() {
@@ -28472,7 +28394,6 @@ var listOrder = 0;
28472
28394
  this.pluginSystem = pluginSystem;
28473
28395
  this.totalTime = totalTime != null ? totalTime : 0;
28474
28396
  this.textures = cachedTextures;
28475
- listOrder = 0;
28476
28397
  this.sourceContent = this.getContent(this.composition);
28477
28398
  }
28478
28399
  var _proto = CompositionSourceManager.prototype;
@@ -28503,7 +28424,6 @@ var listOrder = 0;
28503
28424
  var sourceItemData = this.engine.jsonSceneData[itemDataPath.id];
28504
28425
  var itemProps = sourceItemData;
28505
28426
  if (passRenderLevel(sourceItemData.renderLevel, this.renderLevel)) {
28506
- itemProps.listIndex = listOrder++;
28507
28427
  if (itemProps.type === ItemType.sprite || itemProps.type === ItemType.particle || itemProps.type === ItemType.spine || //@ts-expect-error
28508
28428
  itemProps.type === ItemType.shape) {
28509
28429
  for(var _iterator2 = _create_for_of_iterator_helper_loose(itemProps.components), _step2; !(_step2 = _iterator2()).done;){
@@ -28806,6 +28726,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28806
28726
  SerializationHelper.deserialize(sourceContent, _this.rootComposition);
28807
28727
  _this.rootComposition.createContent();
28808
28728
  _this.buildItemTree(_this.rootItem);
28729
+ _this.rootComposition.setChildrenRenderOrder(0);
28809
28730
  _this.pluginSystem.resetComposition(_assert_this_initialized(_this), _this.renderFrame);
28810
28731
  return _this;
28811
28732
  }
@@ -31445,7 +31366,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31445
31366
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31446
31367
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31447
31368
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31448
- var version$1 = "2.2.0-alpha.0";
31369
+ var version$1 = "2.2.1-alpha.0";
31449
31370
  logger.info("Core version: " + version$1 + ".");
31450
31371
 
31451
31372
  var _obj;
@@ -31502,6 +31423,7 @@ var _obj3;
31502
31423
  /**
31503
31424
  * 储存 uniform 变量名及对应的 THREE uniform 对象
31504
31425
  */ _this.uniforms = {};
31426
+ _this.macrosDirty = true;
31505
31427
  var shader = props == null ? void 0 : props.shader;
31506
31428
  var level = engine.gpuCapability.level;
31507
31429
  _this.shader = new exports.Shader(engine);
@@ -31741,15 +31663,20 @@ var _obj3;
31741
31663
  var uniform = new THREE__namespace.Uniform(value);
31742
31664
  this.uniforms[name] = this.material.uniforms[name] = uniform;
31743
31665
  };
31744
- // 下列三个方法暂时不需要实现
31745
- _proto.enableMacro = function enableMacro(keyword) {
31746
- throw new Error("Method not implemented.");
31666
+ _proto.enableMacro = function enableMacro(keyword, value) {
31667
+ if (!this.isMacroEnabled(keyword) || this.enabledMacros[keyword] !== value) {
31668
+ this.enabledMacros[keyword] = value != null ? value : true;
31669
+ this.macrosDirty = true;
31670
+ }
31747
31671
  };
31748
31672
  _proto.disableMacro = function disableMacro(keyword) {
31749
- throw new Error("Method not implemented.");
31673
+ if (this.isMacroEnabled(keyword)) {
31674
+ delete this.enabledMacros[keyword];
31675
+ this.macrosDirty = true;
31676
+ }
31750
31677
  };
31751
31678
  _proto.isMacroEnabled = function isMacroEnabled(keyword) {
31752
- throw new Error("Method not implemented.");
31679
+ return this.enabledMacros[keyword] !== undefined;
31753
31680
  };
31754
31681
  _proto.clone = function clone(props) {
31755
31682
  //FIXME: 暂时不实现
@@ -33072,7 +32999,7 @@ setMaxSpriteMeshItemCount(8);
33072
32999
  */ Mesh.create = function(engine, props) {
33073
33000
  return new ThreeMesh(engine, props);
33074
33001
  };
33075
- var version = "2.2.0-alpha.0";
33002
+ var version = "2.2.1-alpha.0";
33076
33003
  logger.info("THREEJS plugin version: " + version + ".");
33077
33004
 
33078
33005
  exports.AbstractPlugin = AbstractPlugin;
@@ -33126,7 +33053,6 @@ exports.HELP_LINK = HELP_LINK;
33126
33053
  exports.InteractLoader = InteractLoader;
33127
33054
  exports.InteractMesh = InteractMesh;
33128
33055
  exports.KTXTexture = KTXTexture;
33129
- exports.LOAD_PREFER_IMAGE_BITMAP = LOAD_PREFER_IMAGE_BITMAP;
33130
33056
  exports.LineSegments = LineSegments;
33131
33057
  exports.LinearValue = LinearValue;
33132
33058
  exports.Material = Material;
@@ -33203,7 +33129,6 @@ exports.base64ToFile = base64ToFile;
33203
33129
  exports.blend = blend;
33204
33130
  exports.calculateTranslation = calculateTranslation;
33205
33131
  exports.canvasPool = canvasPool;
33206
- exports.closeImageBitMap = closeImageBitMap;
33207
33132
  exports.colorGradingFrag = colorGradingFrag;
33208
33133
  exports.colorStopsFromGradient = colorStopsFromGradient;
33209
33134
  exports.colorToArr = colorToArr$1;
@@ -33282,7 +33207,6 @@ exports.loadAVIFOptional = loadAVIFOptional;
33282
33207
  exports.loadBinary = loadBinary;
33283
33208
  exports.loadBlob = loadBlob;
33284
33209
  exports.loadImage = loadImage;
33285
- exports.loadImageBitmap = loadImageBitmap;
33286
33210
  exports.loadMedia = loadMedia;
33287
33211
  exports.loadVideo = loadVideo;
33288
33212
  exports.loadWebPOptional = loadWebPOptional;