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

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.8.0-alpha.0
6
+ * Version: v2.8.0-alpha.1
7
7
  */
8
8
 
9
9
  'use strict';
@@ -9903,6 +9903,8 @@ var TextureFactory = /*#__PURE__*/ function() {
9903
9903
  internalFormat: textureData.internalFormat,
9904
9904
  format: textureData.format,
9905
9905
  mipmaps: textureData.mipmaps,
9906
+ minFilter: glContext.LINEAR,
9907
+ magFilter: glContext.LINEAR,
9906
9908
  sourceFrom: sourceFrom
9907
9909
  }, config)
9908
9910
  ];
@@ -10544,41 +10546,6 @@ function _assert_this_initialized(self) {
10544
10546
  return self;
10545
10547
  }
10546
10548
 
10547
- var SemanticMap = /*#__PURE__*/ function() {
10548
- function SemanticMap(semantics) {
10549
- if (semantics === void 0) semantics = {};
10550
- this.semantics = _extends({}, semantics);
10551
- }
10552
- var _proto = SemanticMap.prototype;
10553
- _proto.toObject = function toObject() {
10554
- return _extends({}, this.semantics);
10555
- };
10556
- _proto.setSemantic = function setSemantic(name, value) {
10557
- if (value === undefined) {
10558
- delete this.semantics[name];
10559
- } else {
10560
- this.semantics[name] = value;
10561
- }
10562
- };
10563
- _proto.getSemanticValue = function getSemanticValue(name, state) {
10564
- var ret = this.semantics[name];
10565
- if (isFunction(ret)) {
10566
- return ret(state);
10567
- }
10568
- return ret;
10569
- };
10570
- _proto.hasSemanticValue = function hasSemanticValue(name) {
10571
- return name in this.semantics;
10572
- };
10573
- _proto.dispose = function dispose() {
10574
- var _this = this;
10575
- Object.keys(this.semantics).forEach(function(name) {
10576
- delete _this.semantics[name];
10577
- });
10578
- };
10579
- return SemanticMap;
10580
- }();
10581
-
10582
10549
  var RenderPassPriorityPrepare = 0;
10583
10550
  var RenderPassPriorityNormal = 1000;
10584
10551
  var RenderPassPriorityPostprocess = 3000;
@@ -10709,26 +10676,31 @@ var seed$8 = 1;
10709
10676
  */ var RenderPass = /*#__PURE__*/ function() {
10710
10677
  function RenderPass(renderer, options) {
10711
10678
  /**
10679
+ * 优先级
10680
+ */ this.priority = 0;
10681
+ /**
10712
10682
  * ColorAttachment 数组
10713
10683
  */ this.attachments = [];
10714
- this.destroyed = false;
10684
+ /**
10685
+ * 名称
10686
+ */ this.name = "RenderPass" + seed$8++;
10687
+ /**
10688
+ * 包含的 Mesh 列表
10689
+ */ this.meshes = [];
10690
+ /**
10691
+ * Mesh 渲染顺序,按照优先级升序或降序
10692
+ */ this.meshOrder = exports.OrderType.ascending;
10693
+ this.disposed = false;
10715
10694
  this.initialized = false;
10716
- 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 ? exports.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;
10717
- this.name = name;
10695
+ var depthStencilAttachment = options.depthStencilAttachment;
10718
10696
  this.renderer = renderer;
10719
- this.priority = priority;
10720
- this.meshOrder = meshOrder;
10721
- this.meshes = sortByOrder(meshes.slice(), this.meshOrder);
10722
10697
  this.depthStencilType = (depthStencilAttachment == null ? void 0 : depthStencilAttachment.storageType) || 0;
10723
- this.clearAction = _extends({}, clearAction);
10724
- this.storeAction = _extends({
10698
+ this.storeAction = {
10725
10699
  colorAction: 0,
10726
10700
  depthAction: 0,
10727
10701
  stencilAction: 0
10728
- }, storeAction);
10729
- this.semantics = new SemanticMap(semantics);
10702
+ };
10730
10703
  this.options = options;
10731
- this.delegate = delegate;
10732
10704
  }
10733
10705
  var _proto = RenderPass.prototype;
10734
10706
  _proto.addMesh = function addMesh(mesh) {
@@ -10761,13 +10733,13 @@ var seed$8 = 1;
10761
10733
  /**
10762
10734
  * 执行当前pass,每帧调用一次
10763
10735
  */ _proto.execute = function execute(renderer) {
10764
- renderer.clear(this.clearAction);
10765
- renderer.renderMeshes(this.meshes);
10766
- renderer.clear(this.storeAction);
10736
+ // OVERRIDE
10767
10737
  };
10768
10738
  /**
10769
10739
  * 每帧所有的pass渲染完后调用,通常用于清空临时的RT资源
10770
- */ _proto.frameCleanup = function frameCleanup(renderer) {};
10740
+ */ _proto.frameCleanup = function frameCleanup(renderer) {
10741
+ // OVERRIDE
10742
+ };
10771
10743
  _proto._resetAttachments = function _resetAttachments() {
10772
10744
  var _this = this;
10773
10745
  var _options_attachments;
@@ -10828,7 +10800,7 @@ var seed$8 = 1;
10828
10800
  * 获取当前视口大小,格式:[x偏移,y偏移,宽度,高度]
10829
10801
  */ _proto.getViewport = function getViewport() {
10830
10802
  var _this_framebuffer;
10831
- var ret = ((_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.viewport) || this.customViewport;
10803
+ var ret = (_this_framebuffer = this.framebuffer) == null ? void 0 : _this_framebuffer.viewport;
10832
10804
  if (ret) {
10833
10805
  return ret;
10834
10806
  }
@@ -10911,7 +10883,7 @@ var seed$8 = 1;
10911
10883
  * 销毁 RenderPass
10912
10884
  * @param options - 有选择销毁内部对象
10913
10885
  */ _proto.dispose = function dispose(options) {
10914
- if (this.destroyed) {
10886
+ if (this.disposed) {
10915
10887
  return;
10916
10888
  }
10917
10889
  var destroyMeshOption = (options == null ? void 0 : options.meshes) || undefined;
@@ -10929,10 +10901,7 @@ var seed$8 = 1;
10929
10901
  }
10930
10902
  });
10931
10903
  this.attachments.length = 0;
10932
- if ((options == null ? void 0 : options.semantics) !== exports.DestroyOptions.keep) {
10933
- this.semantics.dispose();
10934
- }
10935
- this.destroyed = true;
10904
+ this.disposed = true;
10936
10905
  var depthStencilOpt = (options == null ? void 0 : options.depthStencilAttachment) ? options.depthStencilAttachment : 0;
10937
10906
  var fbo = this.framebuffer;
10938
10907
  if (fbo) {
@@ -10954,7 +10923,7 @@ var seed$8 = 1;
10954
10923
  {
10955
10924
  key: "isDestroyed",
10956
10925
  get: function get() {
10957
- return this.destroyed;
10926
+ return this.disposed;
10958
10927
  }
10959
10928
  },
10960
10929
  {
@@ -10984,11 +10953,22 @@ var DrawObjectPass = /*#__PURE__*/ function(RenderPass) {
10984
10953
  function DrawObjectPass(renderer, options) {
10985
10954
  var _this;
10986
10955
  _this = RenderPass.call(this, renderer, options) || this;
10956
+ _this.priority = RenderPassPriorityNormal;
10957
+ _this.name = "DrawObjectPass";
10987
10958
  _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
10988
10959
  _this.renderer.engine.on("resize", _this.onResize);
10989
10960
  return _this;
10990
10961
  }
10991
10962
  var _proto = DrawObjectPass.prototype;
10963
+ _proto.execute = function execute(renderer) {
10964
+ renderer.clear({
10965
+ colorAction: exports.TextureLoadAction.clear,
10966
+ depthAction: exports.TextureLoadAction.clear,
10967
+ stencilAction: exports.TextureLoadAction.clear
10968
+ });
10969
+ renderer.renderMeshes(this.meshes);
10970
+ renderer.clear(this.storeAction);
10971
+ };
10992
10972
  _proto.onResize = function onResize() {
10993
10973
  var _this_framebuffer;
10994
10974
  var width = this.renderer.getWidth();
@@ -13083,6 +13063,7 @@ var BloomThresholdPass = /*#__PURE__*/ function(RenderPass) {
13083
13063
  priority: 0
13084
13064
  });
13085
13065
  _this.priority = 5000;
13066
+ _this.name = "BloomThresholdPass";
13086
13067
  _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
13087
13068
  _this.renderer.engine.on("resize", _this.onResize);
13088
13069
  return _this;
@@ -13170,6 +13151,7 @@ var HQGaussianDownSamplePass = /*#__PURE__*/ function(RenderPass) {
13170
13151
  priority: 0
13171
13152
  });
13172
13153
  _this.priority = 5000;
13154
+ _this.name = "GaussianDownPass" + type + level;
13173
13155
  _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
13174
13156
  _this.renderer.engine.on("resize", _this.onResize);
13175
13157
  return _this;
@@ -13258,6 +13240,7 @@ var HQGaussianUpSamplePass = /*#__PURE__*/ function(RenderPass) {
13258
13240
  priority: 0
13259
13241
  });
13260
13242
  _this.priority = 5000;
13243
+ _this.name = "GaussianUpPass" + level;
13261
13244
  _this.onResize = _this.onResize.bind(_assert_this_initialized(_this));
13262
13245
  _this.renderer.engine.on("resize", _this.onResize);
13263
13246
  return _this;
@@ -13345,6 +13328,7 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
13345
13328
  priority: 0
13346
13329
  });
13347
13330
  _this.priority = 5000;
13331
+ _this.name = "ToneMappingPass";
13348
13332
  return _this;
13349
13333
  }
13350
13334
  var _proto = ToneMappingPass.prototype;
@@ -13406,6 +13390,41 @@ var ToneMappingPass = /*#__PURE__*/ function(RenderPass) {
13406
13390
  return ToneMappingPass;
13407
13391
  }(RenderPass);
13408
13392
 
13393
+ var SemanticMap = /*#__PURE__*/ function() {
13394
+ function SemanticMap(semantics) {
13395
+ if (semantics === void 0) semantics = {};
13396
+ this.semantics = _extends({}, semantics);
13397
+ }
13398
+ var _proto = SemanticMap.prototype;
13399
+ _proto.toObject = function toObject() {
13400
+ return _extends({}, this.semantics);
13401
+ };
13402
+ _proto.setSemantic = function setSemantic(name, value) {
13403
+ if (value === undefined) {
13404
+ delete this.semantics[name];
13405
+ } else {
13406
+ this.semantics[name] = value;
13407
+ }
13408
+ };
13409
+ _proto.getSemanticValue = function getSemanticValue(name, state) {
13410
+ var ret = this.semantics[name];
13411
+ if (isFunction(ret)) {
13412
+ return ret(state);
13413
+ }
13414
+ return ret;
13415
+ };
13416
+ _proto.hasSemanticValue = function hasSemanticValue(name) {
13417
+ return name in this.semantics;
13418
+ };
13419
+ _proto.dispose = function dispose() {
13420
+ var _this = this;
13421
+ Object.keys(this.semantics).forEach(function(name) {
13422
+ delete _this.semantics[name];
13423
+ });
13424
+ };
13425
+ return SemanticMap;
13426
+ }();
13427
+
13409
13428
  var RENDER_PASS_NAME_PREFIX = "_effects_default_";
13410
13429
  var seed$6 = 1;
13411
13430
  /**
@@ -13434,7 +13453,6 @@ var seed$6 = 1;
13434
13453
  this.globalUniforms = new GlobalUniforms();
13435
13454
  var attachments = []; //渲染场景物体Pass的RT
13436
13455
  var depthStencilAttachment;
13437
- var drawObjectPassClearAction = {};
13438
13456
  this.renderer = renderer;
13439
13457
  if (postProcessingEnabled) {
13440
13458
  var enableHDR = true;
@@ -13456,19 +13474,10 @@ var seed$6 = 1;
13456
13474
  depthStencilAttachment = {
13457
13475
  storageType: exports.RenderPassAttachmentStorageType.depth_stencil_opaque
13458
13476
  };
13459
- drawObjectPassClearAction = {
13460
- colorAction: exports.TextureLoadAction.clear,
13461
- stencilAction: exports.TextureLoadAction.clear,
13462
- depthAction: exports.TextureLoadAction.clear
13463
- };
13464
13477
  }
13465
13478
  this.drawObjectPass = new DrawObjectPass(renderer, {
13466
- name: RENDER_PASS_NAME_PREFIX,
13467
- priority: RenderPassPriorityNormal,
13468
- meshOrder: exports.OrderType.ascending,
13469
13479
  depthStencilAttachment: depthStencilAttachment,
13470
- attachments: attachments,
13471
- clearAction: drawObjectPassClearAction
13480
+ attachments: attachments
13472
13481
  });
13473
13482
  var renderPasses = [
13474
13483
  this.drawObjectPass
@@ -13487,7 +13496,6 @@ var seed$6 = 1;
13487
13496
  var enableHDR1 = true;
13488
13497
  var textureType1 = enableHDR1 ? glContext.HALF_FLOAT : glContext.UNSIGNED_BYTE;
13489
13498
  var bloomThresholdPass = new BloomThresholdPass(renderer, {
13490
- name: "BloomThresholdPass",
13491
13499
  attachments: [
13492
13500
  {
13493
13501
  texture: {
@@ -13504,7 +13512,6 @@ var seed$6 = 1;
13504
13512
  for(var i = 0; i < gaussianStep; i++){
13505
13513
  gaussianDownResults[i] = new RenderTargetHandle(engine);
13506
13514
  var gaussianDownHPass = new HQGaussianDownSamplePass(renderer, "H", i, {
13507
- name: "GaussianDownPassH" + i,
13508
13515
  attachments: [
13509
13516
  {
13510
13517
  texture: {
@@ -13517,7 +13524,6 @@ var seed$6 = 1;
13517
13524
  ]
13518
13525
  });
13519
13526
  var gaussianDownVPass = new HQGaussianDownSamplePass(renderer, "V", i, {
13520
- name: "GaussianDownPassV" + i,
13521
13527
  attachments: [
13522
13528
  {
13523
13529
  texture: {
@@ -13540,7 +13546,6 @@ var seed$6 = 1;
13540
13546
  viewport[3] *= 4;
13541
13547
  for(var i1 = 0; i1 < gaussianStep - 1; i1++){
13542
13548
  var gaussianUpPass = new HQGaussianUpSamplePass(renderer, gaussianStep - i1, {
13543
- name: "GaussianUpPass" + i1,
13544
13549
  attachments: [
13545
13550
  {
13546
13551
  texture: {
@@ -29303,6 +29308,12 @@ var TextComponentBase = /*#__PURE__*/ function() {
29303
29308
  this.textLayout.textVerticalAlign = value;
29304
29309
  this.isDirty = true;
29305
29310
  };
29311
+ /**
29312
+ * @deprecated 2.8.0 本方法已废弃,请使用 setTextVerticalAlign 替代。
29313
+ */ _proto.setTextBaseline = function setTextBaseline(value) {
29314
+ console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。" + "本次调用将转调用 setTextVerticalAlign。");
29315
+ this.setTextVerticalAlign(value);
29316
+ };
29306
29317
  _proto.setTextColor = function setTextColor(value) {
29307
29318
  if (this.textStyle.textColor === value) {
29308
29319
  return;
@@ -29567,7 +29578,9 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
29567
29578
  this.lineCount = this.getLineCount(this.text);
29568
29579
  this.isDirty = true;
29569
29580
  };
29570
- _proto.updateWithOptions = function updateWithOptions(options) {
29581
+ /**
29582
+ * 根据配置更新文本样式和布局
29583
+ */ _proto.updateWithOptions = function updateWithOptions(options) {
29571
29584
  // 初始化 textStyle 和 textLayout
29572
29585
  if (!this.textStyle) {
29573
29586
  this.textStyle = new TextStyle(options);
@@ -31877,7 +31890,7 @@ function getStandardSpriteContent(sprite, transform) {
31877
31890
  return ret;
31878
31891
  }
31879
31892
 
31880
- var version$2 = "2.8.0-alpha.0";
31893
+ var version$2 = "2.8.0-alpha.1";
31881
31894
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31882
31895
  var standardVersion = /^(\d+)\.(\d+)$/;
31883
31896
  var reverseParticle = false;
@@ -35508,7 +35521,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
35508
35521
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
35509
35522
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
35510
35523
  registerPlugin("interact", InteractLoader, exports.VFXItem);
35511
- var version$1 = "2.8.0-alpha.0";
35524
+ var version$1 = "2.8.0-alpha.1";
35512
35525
  logger.info("Core version: " + version$1 + ".");
35513
35526
 
35514
35527
  var _obj;
@@ -37097,7 +37110,7 @@ applyMixins(exports.ThreeTextComponent, [
37097
37110
  */ Mesh.create = function(engine, props) {
37098
37111
  return new ThreeMesh(engine, props);
37099
37112
  };
37100
- var version = "2.8.0-alpha.0";
37113
+ var version = "2.8.0-alpha.1";
37101
37114
  logger.info("THREEJS plugin version: " + version + ".");
37102
37115
 
37103
37116
  exports.AbstractPlugin = AbstractPlugin;