@galacean/effects-threejs 2.4.1-alpha.0 → 2.4.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.4.1-alpha.0
6
+ * Version: v2.4.1
7
7
  */
8
8
 
9
9
  'use strict';
@@ -891,7 +891,7 @@ function unregisterPlugin(name) {
891
891
  removeItem(defaultPlugins, name);
892
892
  }
893
893
  var PluginSystem = /*#__PURE__*/ function() {
894
- function PluginSystem() {
894
+ function PluginSystem(pluginNames) {
895
895
  var loaders = {};
896
896
  var loaded = [];
897
897
  var addLoader = function(name) {
@@ -902,12 +902,15 @@ var PluginSystem = /*#__PURE__*/ function() {
902
902
  }
903
903
  };
904
904
  defaultPlugins.forEach(addLoader);
905
- this.plugins = Object.keys(loaders).map(function(name) {
906
- var CTRL = pluginLoaderMap[name];
907
- if (!CTRL) {
908
- throw new Error("The plugin '" + name + "' not found." + getPluginUsageInfo(name));
905
+ for(var _iterator = _create_for_of_iterator_helper_loose(pluginNames), _step; !(_step = _iterator()).done;){
906
+ var customPluginName = _step.value;
907
+ if (!pluginLoaderMap[customPluginName]) {
908
+ throw new Error("The plugin '" + customPluginName + "' not found." + getPluginUsageInfo(customPluginName));
909
909
  }
910
- var loader = new CTRL();
910
+ }
911
+ this.plugins = Object.keys(loaders).map(function(name) {
912
+ var pluginConstructor = pluginLoaderMap[name];
913
+ var loader = new pluginConstructor();
911
914
  loader.name = name;
912
915
  return loader;
913
916
  }).sort(function(a, b) {
@@ -7646,6 +7649,7 @@ exports.MaterialRenderType = void 0;
7646
7649
  var MaskProcessor = /*#__PURE__*/ function() {
7647
7650
  function MaskProcessor(engine) {
7648
7651
  this.engine = engine;
7652
+ this.maskable = null;
7649
7653
  this.stencilClearAction = {
7650
7654
  stencilAction: exports.TextureLoadAction.clear
7651
7655
  };
@@ -7662,15 +7666,18 @@ var MaskProcessor = /*#__PURE__*/ function() {
7662
7666
  maskMode = exports.MaskMode.MASK;
7663
7667
  } else if (mode === ObscuredMode.OBSCURED || mode === ObscuredMode.REVERSE_OBSCURED) {
7664
7668
  maskMode = mode === ObscuredMode.OBSCURED ? exports.MaskMode.OBSCURED : exports.MaskMode.REVERSE_OBSCURED;
7665
- this.maskable = ref;
7669
+ if (ref) {
7670
+ this.maskable = ref;
7671
+ }
7666
7672
  }
7667
7673
  }
7668
7674
  return maskMode;
7669
7675
  };
7670
7676
  _proto.drawStencilMask = function drawStencilMask(renderer) {
7671
- var _this_maskable;
7672
- renderer.clear(this.stencilClearAction);
7673
- (_this_maskable = this.maskable) == null ? void 0 : _this_maskable.drawStencilMask(renderer);
7677
+ if (this.maskable) {
7678
+ renderer.clear(this.stencilClearAction);
7679
+ this.maskable.drawStencilMask(renderer);
7680
+ }
7674
7681
  };
7675
7682
  return MaskProcessor;
7676
7683
  }();
@@ -12584,6 +12591,9 @@ function getBezier2DValue(out, t, p0, p1, cpx0, cpy0, cpx1, cpy1) {
12584
12591
  /**
12585
12592
  * @internal
12586
12593
  */ _proto.drawStencilMask = function drawStencilMask(renderer) {
12594
+ if (!this.isActiveAndEnabled) {
12595
+ return;
12596
+ }
12587
12597
  var previousColorMask = this.material.colorMask;
12588
12598
  this.material.colorMask = false;
12589
12599
  this.draw(renderer);
@@ -29092,12 +29102,13 @@ var seed$1 = 1;
29092
29102
  _proto.processJSON = function processJSON(json) {
29093
29103
  var _this = this;
29094
29104
  return _async_to_generator(function() {
29095
- var jsonScene, pluginSystem;
29105
+ var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
29096
29106
  return __generator(this, function(_state) {
29097
29107
  switch(_state.label){
29098
29108
  case 0:
29099
29109
  jsonScene = getStandardJSON(json);
29100
- pluginSystem = new PluginSystem();
29110
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
29111
+ pluginSystem = new PluginSystem(plugins);
29101
29112
  return [
29102
29113
  4,
29103
29114
  pluginSystem.processRawJSON(jsonScene, _this.options)
@@ -31648,7 +31659,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
31648
31659
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
31649
31660
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
31650
31661
  registerPlugin("interact", InteractLoader, exports.VFXItem);
31651
- var version$1 = "2.4.1-alpha.0";
31662
+ var version$1 = "2.4.1";
31652
31663
  logger.info("Core version: " + version$1 + ".");
31653
31664
 
31654
31665
  var _obj;
@@ -33250,7 +33261,7 @@ setMaxSpriteMeshItemCount(8);
33250
33261
  */ Mesh.create = function(engine, props) {
33251
33262
  return new ThreeMesh(engine, props);
33252
33263
  };
33253
- var version = "2.4.1-alpha.0";
33264
+ var version = "2.4.1";
33254
33265
  logger.info("THREEJS plugin version: " + version + ".");
33255
33266
 
33256
33267
  exports.AbstractPlugin = AbstractPlugin;