@galacean/effects-threejs 2.3.0-beta.0 → 2.3.0-beta.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.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.3.0-beta.0
6
+ * Version: v2.3.0-beta.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -59,6 +59,41 @@ function _async_to_generator(fn) {
59
59
  };
60
60
  }
61
61
 
62
+ function _array_like_to_array(arr, len) {
63
+ if (len == null || len > arr.length) len = arr.length;
64
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
65
+ return arr2;
66
+ }
67
+
68
+ function _unsupported_iterable_to_array(o, minLen) {
69
+ if (!o) return;
70
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
71
+ var n = Object.prototype.toString.call(o).slice(8, -1);
72
+ if (n === "Object" && o.constructor) n = o.constructor.name;
73
+ if (n === "Map" || n === "Set") return Array.from(n);
74
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
75
+ }
76
+
77
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
78
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
79
+ if (it) return (it = it.call(o)).next.bind(it);
80
+ // Fallback for engines without symbol support
81
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
82
+ if (it) o = it;
83
+ var i = 0;
84
+ return function() {
85
+ if (i >= o.length) return {
86
+ done: true
87
+ };
88
+ return {
89
+ done: false,
90
+ value: o[i++]
91
+ };
92
+ };
93
+ }
94
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
95
+ }
96
+
62
97
  function _instanceof1(left, right) {
63
98
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
64
99
  return !!right[Symbol.hasInstance](left);
@@ -842,16 +877,13 @@ var pluginCtrlMap = {};
842
877
  * @param pluginClass class of plugin
843
878
  * @param itemClass class of item
844
879
  * @param isDefault load
845
- */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
846
- function registerPlugin(name, pluginClass, itemClass, isDefault) {
880
+ */ function registerPlugin(name, pluginClass, itemClass) {
847
881
  if (pluginCtrlMap[name]) {
848
882
  logger.error("Duplicate registration for plugin " + name + ".");
849
883
  }
850
884
  pluginCtrlMap[name] = itemClass;
851
885
  pluginLoaderMap[name] = pluginClass;
852
- if (isDefault) {
853
- addItem(defaultPlugins, name);
854
- }
886
+ addItem(defaultPlugins, name);
855
887
  }
856
888
  function unregisterPlugin(name) {
857
889
  delete pluginCtrlMap[name];
@@ -859,7 +891,7 @@ function unregisterPlugin(name) {
859
891
  removeItem(defaultPlugins, name);
860
892
  }
861
893
  var PluginSystem = /*#__PURE__*/ function() {
862
- function PluginSystem(pluginNames) {
894
+ function PluginSystem() {
863
895
  var loaders = {};
864
896
  var loaded = [];
865
897
  var addLoader = function(name) {
@@ -870,7 +902,6 @@ var PluginSystem = /*#__PURE__*/ function() {
870
902
  }
871
903
  };
872
904
  defaultPlugins.forEach(addLoader);
873
- pluginNames.forEach(addLoader);
874
905
  this.plugins = Object.keys(loaders).map(function(name) {
875
906
  var CTRL = pluginLoaderMap[name];
876
907
  if (!CTRL) {
@@ -922,15 +953,10 @@ var PluginSystem = /*#__PURE__*/ function() {
922
953
  })();
923
954
  };
924
955
  _proto.precompile = function precompile(compositions, renderer, options) {
925
- var _this = this;
926
- return _async_to_generator(function() {
927
- return __generator(this, function(_state) {
928
- return [
929
- 2,
930
- _this.callStatic("precompile", compositions, renderer, options)
931
- ];
932
- });
933
- })();
956
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
957
+ var plugin = _step.value;
958
+ plugin.precompile(compositions, renderer, options);
959
+ }
934
960
  };
935
961
  _proto.loadResources = function loadResources(scene, options) {
936
962
  var _this = this;
@@ -1000,6 +1026,11 @@ function getPluginUsageInfo(name) {
1000
1026
  this.name = "";
1001
1027
  }
1002
1028
  var _proto = AbstractPlugin.prototype;
1029
+ /**
1030
+ * 在加载到 JSON 后,就可以进行提前编译
1031
+ * @param json
1032
+ * @param player
1033
+ */ _proto.precompile = function precompile(compositions, renderer, options) {};
1003
1034
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
1004
1035
  _proto.onCompositionItemLifeBegin = function onCompositionItemLifeBegin(composition, item) {};
1005
1036
  _proto.onCompositionItemLifeEnd = function onCompositionItemLifeEnd(composition, item) {};
@@ -1012,13 +1043,6 @@ function getPluginUsageInfo(name) {
1012
1043
  return false;
1013
1044
  };
1014
1045
  _proto.postProcessFrame = function postProcessFrame(composition, frame) {};
1015
- /**
1016
- * 在加载到 JSON 后,就可以进行提前编译
1017
- * @param json
1018
- * @param player
1019
- */ AbstractPlugin.precompile = function precompile(compositions, renderer) {
1020
- return Promise.resolve();
1021
- };
1022
1046
  return AbstractPlugin;
1023
1047
  }();
1024
1048
 
@@ -6693,41 +6717,6 @@ function setDefaultTextureFactory(factory) {
6693
6717
  g = factory;
6694
6718
  }
6695
6719
 
6696
- function _array_like_to_array(arr, len) {
6697
- if (len == null || len > arr.length) len = arr.length;
6698
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6699
- return arr2;
6700
- }
6701
-
6702
- function _unsupported_iterable_to_array(o, minLen) {
6703
- if (!o) return;
6704
- if (typeof o === "string") return _array_like_to_array(o, minLen);
6705
- var n = Object.prototype.toString.call(o).slice(8, -1);
6706
- if (n === "Object" && o.constructor) n = o.constructor.name;
6707
- if (n === "Map" || n === "Set") return Array.from(n);
6708
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
6709
- }
6710
-
6711
- function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
6712
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
6713
- if (it) return (it = it.call(o)).next.bind(it);
6714
- // Fallback for engines without symbol support
6715
- if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
6716
- if (it) o = it;
6717
- var i = 0;
6718
- return function() {
6719
- if (i >= o.length) return {
6720
- done: true
6721
- };
6722
- return {
6723
- done: false,
6724
- value: o[i++]
6725
- };
6726
- };
6727
- }
6728
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6729
- }
6730
-
6731
6720
  exports.ShaderCompileResultStatus = void 0;
6732
6721
  (function(ShaderCompileResultStatus) {
6733
6722
  ShaderCompileResultStatus[ShaderCompileResultStatus["noShader"] = 0] = "noShader";
@@ -16184,7 +16173,8 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
16184
16173
  var perpY = x0 - x1;
16185
16174
  var perp1x = 0;
16186
16175
  var perp1y = 0;
16187
- var dist = Math.sqrt(perpX * perpX + perpY * perpY);
16176
+ // 计算向量长度并添加极小值 NumberEpsilon 以避免除以零的情况。
16177
+ var dist = Math.sqrt(perpX * perpX + perpY * perpY) + NumberEpsilon;
16188
16178
  perpX /= dist;
16189
16179
  perpY /= dist;
16190
16180
  perpX *= width;
@@ -16211,14 +16201,14 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
16211
16201
  y2 = points[(i + 1) * 2 + 1];
16212
16202
  perpX = -(y0 - y1);
16213
16203
  perpY = x0 - x1;
16214
- dist = Math.sqrt(perpX * perpX + perpY * perpY);
16204
+ dist = Math.sqrt(perpX * perpX + perpY * perpY) + NumberEpsilon;
16215
16205
  perpX /= dist;
16216
16206
  perpY /= dist;
16217
16207
  perpX *= width;
16218
16208
  perpY *= width;
16219
16209
  perp1x = -(y1 - y2);
16220
16210
  perp1y = x1 - x2;
16221
- dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y);
16211
+ dist = Math.sqrt(perp1x * perp1x + perp1y * perp1y) + NumberEpsilon;
16222
16212
  perp1x /= dist;
16223
16213
  perp1y /= dist;
16224
16214
  perp1x *= width;
@@ -16319,7 +16309,7 @@ vertices, _verticesStride, _verticesOffset, indices, _indicesOffset) {
16319
16309
  y1 = points[(length - 1) * 2 + 1];
16320
16310
  perpX = -(y0 - y1);
16321
16311
  perpY = x0 - x1;
16322
- dist = Math.sqrt(perpX * perpX + perpY * perpY);
16312
+ dist = Math.sqrt(perpX * perpX + perpY * perpY) + NumberEpsilon;
16323
16313
  perpX /= dist;
16324
16314
  perpY /= dist;
16325
16315
  perpX *= width;
@@ -16482,7 +16472,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16482
16472
  indices.length;
16483
16473
  var vertOffset1 = vertices.length / 2;
16484
16474
  var lineStyle = this.strokeAttributes;
16485
- var close = false;
16475
+ var close = true;
16486
16476
  if (this.shapeAttribute.type === ShapePrimitiveType.Custom) {
16487
16477
  close = shape1.closePath;
16488
16478
  }
@@ -16864,7 +16854,10 @@ exports.CameraController = /*#__PURE__*/ function(Behaviour) {
16864
16854
  camera.far = this.options.far;
16865
16855
  camera.fov = this.options.fov;
16866
16856
  camera.clipMode = this.options.clipMode;
16867
- camera.setTransform(this.transform);
16857
+ camera.transform.parentTransform = this.transform.parentTransform;
16858
+ camera.position = this.transform.position;
16859
+ // TODO 修正 GE 四元数旋转共轭问题
16860
+ camera.setQuat(this.transform.getQuaternion().clone().conjugate());
16868
16861
  }
16869
16862
  };
16870
16863
  _proto.fromData = function fromData(data) {
@@ -17603,61 +17596,6 @@ function shouldIgnoreBouncing(arg, mul) {
17603
17596
  return MeshCollider;
17604
17597
  }();
17605
17598
 
17606
- exports.maxSpriteMeshItemCount = 8;
17607
- function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
17608
- if (gpuCapability.maxVertexUniforms >= 256) {
17609
- return exports.maxSpriteMeshItemCount = 32;
17610
- } else if (gpuCapability.maxVertexUniforms >= 128) {
17611
- return exports.maxSpriteMeshItemCount = 16;
17612
- }
17613
- }
17614
- function spriteMeshShaderFromFilter(level, options) {
17615
- var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
17616
- var macros = [
17617
- [
17618
- "ENV_EDITOR",
17619
- env === PLAYER_OPTIONS_ENV_EDITOR
17620
- ]
17621
- ];
17622
- var fragment = wireframe ? itemFrameFrag : itemFrag;
17623
- var vertex = itemVert;
17624
- return {
17625
- fragment: fragment,
17626
- vertex: vertex,
17627
- glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
17628
- macros: macros,
17629
- shared: true
17630
- };
17631
- }
17632
- function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
17633
- return renderInfo.cachePrefix + "_effects_sprite_" + count;
17634
- }
17635
- function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
17636
- var wireframe = renderInfo.wireframe;
17637
- var shader = spriteMeshShaderFromFilter(level, {
17638
- wireframe: wireframe,
17639
- env: env
17640
- });
17641
- shader.shared = true;
17642
- // if (!wireframe) {
17643
- // shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
17644
- // }
17645
- return shader;
17646
- }
17647
- // TODO: 只有单测用
17648
- function setMaxSpriteMeshItemCount(count) {
17649
- exports.maxSpriteMeshItemCount = count;
17650
- }
17651
-
17652
- var defRenderInfo = {
17653
- blending: 0,
17654
- cacheId: "-",
17655
- mask: 0,
17656
- maskMode: 0,
17657
- occlusion: false,
17658
- side: 0,
17659
- cachePrefix: "-"
17660
- };
17661
17599
  var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17662
17600
  _inherits(SpriteLoader, AbstractPlugin);
17663
17601
  function SpriteLoader() {
@@ -17666,19 +17604,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17666
17604
  _this.name = "sprite";
17667
17605
  return _this;
17668
17606
  }
17669
- SpriteLoader.precompile = function precompile(compositions, render, options) {
17670
- var shaderLibrary = render.getShaderLibrary();
17671
- var _render_engine_gpuCapability = render.engine.gpuCapability, level = _render_engine_gpuCapability.level, detail = _render_engine_gpuCapability.detail;
17672
- var env = (options != null ? options : {}).env;
17673
- if (!(shaderLibrary == null ? void 0 : shaderLibrary.shaderResults[spriteMeshShaderIdFromRenderInfo(defRenderInfo, 2)])) {
17674
- shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, 2, 1, env));
17675
- shaderLibrary == null ? void 0 : shaderLibrary.addShader(spriteMeshShaderFromRenderInfo(defRenderInfo, exports.maxSpriteMeshItemCount, 1, env));
17676
- if (detail.writableFragDepth) {
17677
- shaderLibrary == null ? void 0 : shaderLibrary.addShader(createCopyShader(level, true));
17678
- }
17679
- }
17680
- return Promise.resolve();
17681
- };
17682
17607
  return SpriteLoader;
17683
17608
  }(AbstractPlugin);
17684
17609
 
@@ -19880,66 +19805,6 @@ function calculateDirection(prePoint, point, nextPoint) {
19880
19805
  }
19881
19806
  return dir.normalize().toArray();
19882
19807
  }
19883
- function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env) {
19884
- if (env === void 0) env = "";
19885
- var shaderCacheId = 0;
19886
- var lookUpTexture = getConfig(RENDER_PREFER_LOOKUP_TEXTURE) ? 1 : 0;
19887
- var enableVertexTexture = gpuCapability.detail.maxVertexTextures > 0;
19888
- var macros = [
19889
- [
19890
- "ENABLE_VERTEX_TEXTURE",
19891
- enableVertexTexture
19892
- ],
19893
- [
19894
- "LOOKUP_TEXTURE_CURVE",
19895
- lookUpTexture
19896
- ],
19897
- [
19898
- "ENV_EDITOR",
19899
- env === PLAYER_OPTIONS_ENV_EDITOR
19900
- ]
19901
- ];
19902
- var keyFrameMeta = createKeyFrameMeta();
19903
- if (trails.colorOverLifetime) {
19904
- macros.push([
19905
- "COLOR_OVER_LIFETIME",
19906
- true
19907
- ]);
19908
- shaderCacheId |= 1;
19909
- }
19910
- if (trails.colorOverTrail) {
19911
- macros.push([
19912
- "COLOR_OVER_TRAIL",
19913
- true
19914
- ]);
19915
- shaderCacheId |= 1 << 2;
19916
- }
19917
- var useAttributeTrailStart = particleMaxCount > 64;
19918
- if (useAttributeTrailStart) {
19919
- macros.push([
19920
- "ATTR_TRAIL_START",
19921
- 1
19922
- ]);
19923
- shaderCacheId |= 1 << 3;
19924
- }
19925
- getKeyFrameMetaByRawValue(keyFrameMeta, trails.opacityOverLifetime);
19926
- getKeyFrameMetaByRawValue(keyFrameMeta, trails.widthOverTrail);
19927
- macros.push([
19928
- "VERT_CURVE_VALUE_COUNT",
19929
- keyFrameMeta.index
19930
- ], [
19931
- "VERT_MAX_KEY_FRAME_COUNT",
19932
- keyFrameMeta.max
19933
- ]);
19934
- return {
19935
- vertex: trailVert,
19936
- fragment: particleFrag,
19937
- macros: macros,
19938
- shared: true,
19939
- name: "trail#" + name,
19940
- cacheId: "-t:+" + shaderCacheId + "+" + keyFrameMeta.index + "+" + keyFrameMeta.max
19941
- };
19942
- }
19943
19808
 
19944
19809
  /**
19945
19810
  * @since 2.0.0
@@ -24963,59 +24828,57 @@ exports.SpriteComponent = __decorate([
24963
24828
  effectsClass(DataType.SpriteComponent)
24964
24829
  ], exports.SpriteComponent);
24965
24830
 
24831
+ exports.maxSpriteMeshItemCount = 8;
24832
+ function setSpriteMeshMaxItemCountByGPU(gpuCapability) {
24833
+ if (gpuCapability.maxVertexUniforms >= 256) {
24834
+ return exports.maxSpriteMeshItemCount = 32;
24835
+ } else if (gpuCapability.maxVertexUniforms >= 128) {
24836
+ return exports.maxSpriteMeshItemCount = 16;
24837
+ }
24838
+ }
24839
+ function spriteMeshShaderFromFilter(level, options) {
24840
+ var _ref = options != null ? options : {}, _ref_env = _ref.env, env = _ref_env === void 0 ? "" : _ref_env, wireframe = _ref.wireframe;
24841
+ var macros = [
24842
+ [
24843
+ "ENV_EDITOR",
24844
+ env === PLAYER_OPTIONS_ENV_EDITOR
24845
+ ]
24846
+ ];
24847
+ var fragment = wireframe ? itemFrameFrag : itemFrag;
24848
+ var vertex = itemVert;
24849
+ return {
24850
+ fragment: fragment,
24851
+ vertex: vertex,
24852
+ glslVersion: level === 1 ? exports.GLSLVersion.GLSL1 : exports.GLSLVersion.GLSL3,
24853
+ macros: macros,
24854
+ shared: true
24855
+ };
24856
+ }
24857
+ function spriteMeshShaderIdFromRenderInfo(renderInfo, count) {
24858
+ return renderInfo.cachePrefix + "_effects_sprite_" + count;
24859
+ }
24860
+ function spriteMeshShaderFromRenderInfo(renderInfo, count, level, env) {
24861
+ var wireframe = renderInfo.wireframe;
24862
+ var shader = spriteMeshShaderFromFilter(level, {
24863
+ wireframe: wireframe,
24864
+ env: env
24865
+ });
24866
+ shader.shared = true;
24867
+ // if (!wireframe) {
24868
+ // shader.cacheId = spriteMeshShaderIdFromRenderInfo(renderInfo, count);
24869
+ // }
24870
+ return shader;
24871
+ }
24872
+ // TODO: 只有单测用
24873
+ function setMaxSpriteMeshItemCount(count) {
24874
+ exports.maxSpriteMeshItemCount = count;
24875
+ }
24876
+
24966
24877
  var ParticleLoader = /*#__PURE__*/ function(AbstractPlugin) {
24967
24878
  _inherits(ParticleLoader, AbstractPlugin);
24968
24879
  function ParticleLoader() {
24969
24880
  return AbstractPlugin.apply(this, arguments);
24970
24881
  }
24971
- ParticleLoader.precompile = function precompile(compositions, renderer, options) {
24972
- var gpuCapability = renderer.engine.gpuCapability;
24973
- var level = gpuCapability.level;
24974
- var env = (options != null ? options : {}).env;
24975
- var shaderLibrary = renderer.getShaderLibrary();
24976
- var items = [];
24977
- var shaders = [];
24978
- var maxFragmentCount = 0;
24979
- var maxVertexCount = 0;
24980
- // 增加预合成中的粒子处理
24981
- compositions.forEach(function(comp) {
24982
- comp.items.forEach(function(item) {
24983
- if (exports.Item.isParticle(item)) {
24984
- items.push(item);
24985
- }
24986
- });
24987
- });
24988
- items.forEach(function(item) {
24989
- var _getParticleMeshShader = getParticleMeshShader(item, gpuCapability, env), shader = _getParticleMeshShader.shader, fragment = _getParticleMeshShader.fragment, vertex = _getParticleMeshShader.vertex;
24990
- shaders.push(shader);
24991
- maxFragmentCount = Math.max(maxFragmentCount, fragment);
24992
- maxVertexCount = Math.max(maxVertexCount, vertex);
24993
- // TODO 此处add是否有意义?shader变量似乎没有加到this.shaders数组。
24994
- if (item.content.trails) {
24995
- var shader1 = getTrailMeshShader(item.content.trails, item.content.options.maxCount, item.name, gpuCapability, env);
24996
- shader1.glslVersion = level === 2 ? exports.GLSLVersion.GLSL3 : exports.GLSLVersion.GLSL1;
24997
- shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader1);
24998
- }
24999
- });
25000
- shaders.forEach(function(shader) {
25001
- if (level === 2) {
25002
- modifyMaxKeyframeShader(shader, maxVertexCount, maxFragmentCount);
25003
- shader.glslVersion = exports.GLSLVersion.GLSL3;
25004
- } else {
25005
- shader.glslVersion = exports.GLSLVersion.GLSL1;
25006
- }
25007
- shaderLibrary == null ? void 0 : shaderLibrary.addShader(shader);
25008
- });
25009
- if (level === 2) {
25010
- items.forEach(function(item) {
25011
- item.content.options.meshSlots = [
25012
- maxVertexCount,
25013
- maxFragmentCount
25014
- ];
25015
- });
25016
- }
25017
- return Promise.resolve();
25018
- };
25019
24882
  return ParticleLoader;
25020
24883
  }(AbstractPlugin);
25021
24884
 
@@ -28193,7 +28056,7 @@ var seed$1 = 1;
28193
28056
  });
28194
28057
  });
28195
28058
  loadResourcePromise = /*#__PURE__*/ _async_to_generator(function() {
28196
- var scene, link, jsonScene, pluginSystem, loadedImages, compositions, images, _ref, jsonScene1, pluginSystem1, _jsonScene_bins, bins, images1, compositions1, fonts, _ref1, loadedBins, loadedImages1, loadedTextures, totalTime;
28059
+ var scene, link, jsonScene, pluginSystem, loadedImages, images, _ref, jsonScene1, pluginSystem1, _jsonScene_bins, bins, images1, fonts, _ref1, loadedBins, loadedImages1, loadedTextures, totalTime;
28197
28060
  return __generator(this, function(_state) {
28198
28061
  switch(_state.label){
28199
28062
  case 0:
@@ -28229,16 +28092,13 @@ var seed$1 = 1;
28229
28092
  // 已经加载过的 可能需要更新数据模板
28230
28093
  scene = _extends({}, rawJSON);
28231
28094
  jsonScene = scene.jsonScene, pluginSystem = scene.pluginSystem, loadedImages = scene.images;
28232
- compositions = jsonScene.compositions, images = jsonScene.images;
28095
+ images = jsonScene.images;
28233
28096
  _this.assignImagesToAssets(images, loadedImages);
28234
28097
  return [
28235
28098
  4,
28236
28099
  Promise.all([
28237
28100
  hookTimeInfo("plugin:processAssets", function() {
28238
28101
  return _this.processPluginAssets(jsonScene, pluginSystem, options);
28239
- }),
28240
- hookTimeInfo("plugin:precompile", function() {
28241
- return _this.precompile(compositions, pluginSystem, renderer, options);
28242
28102
  })
28243
28103
  ])
28244
28104
  ];
@@ -28257,7 +28117,7 @@ var seed$1 = 1;
28257
28117
  ];
28258
28118
  case 6:
28259
28119
  _ref = _state.sent(), jsonScene1 = _ref.jsonScene, pluginSystem1 = _ref.pluginSystem;
28260
- _jsonScene_bins = jsonScene1.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images1 = jsonScene1.images, compositions1 = jsonScene1.compositions, fonts = jsonScene1.fonts;
28120
+ _jsonScene_bins = jsonScene1.bins, bins = _jsonScene_bins === void 0 ? [] : _jsonScene_bins, images1 = jsonScene1.images, fonts = jsonScene1.fonts;
28261
28121
  return [
28262
28122
  4,
28263
28123
  Promise.all([
@@ -28270,9 +28130,6 @@ var seed$1 = 1;
28270
28130
  hookTimeInfo("plugin:processAssets", function() {
28271
28131
  return _this.processPluginAssets(jsonScene1, pluginSystem1, options);
28272
28132
  }),
28273
- hookTimeInfo("plugin:precompile", function() {
28274
- return _this.precompile(compositions1, pluginSystem1, renderer, options);
28275
- }),
28276
28133
  hookTimeInfo("processFontURL", function() {
28277
28134
  return _this.processFontURL(fonts);
28278
28135
  })
@@ -28338,39 +28195,15 @@ var seed$1 = 1;
28338
28195
  _proto.getAssets = function getAssets() {
28339
28196
  return this.assets;
28340
28197
  };
28341
- _proto.precompile = function precompile(compositions, pluginSystem, renderer, options) {
28342
- return _async_to_generator(function() {
28343
- return __generator(this, function(_state) {
28344
- switch(_state.label){
28345
- case 0:
28346
- if (!renderer || !renderer.getShaderLibrary()) {
28347
- return [
28348
- 2
28349
- ];
28350
- }
28351
- return [
28352
- 4,
28353
- pluginSystem.precompile(compositions, renderer, options)
28354
- ];
28355
- case 1:
28356
- _state.sent();
28357
- return [
28358
- 2
28359
- ];
28360
- }
28361
- });
28362
- })();
28363
- };
28364
28198
  _proto.processJSON = function processJSON(json) {
28365
28199
  var _this = this;
28366
28200
  return _async_to_generator(function() {
28367
- var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
28201
+ var jsonScene, pluginSystem;
28368
28202
  return __generator(this, function(_state) {
28369
28203
  switch(_state.label){
28370
28204
  case 0:
28371
28205
  jsonScene = getStandardJSON(json);
28372
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
28373
- pluginSystem = new PluginSystem(plugins);
28206
+ pluginSystem = new PluginSystem();
28374
28207
  return [
28375
28208
  4,
28376
28209
  pluginSystem.processRawJSON(jsonScene, _this.options)
@@ -28882,7 +28715,6 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
28882
28715
  }
28883
28716
  var _proto = AssetService.prototype;
28884
28717
  /**
28885
- * @internal
28886
28718
  * @param url
28887
28719
  * @param options
28888
28720
  * @returns
@@ -28907,7 +28739,6 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
28907
28739
  * 根据用户参数修改文本元素的原始数据
28908
28740
  * @param scene
28909
28741
  * @param options
28910
- * @internal
28911
28742
  */ _proto.updateTextVariables = function updateTextVariables(scene, variables) {
28912
28743
  var _this = this;
28913
28744
  if (variables === void 0) variables = {};
@@ -28989,12 +28820,14 @@ var tmpScale = new Vector3(1, 1, 1);
28989
28820
  function Camera(name, options) {
28990
28821
  if (options === void 0) options = {};
28991
28822
  this.name = name;
28823
+ this./**
28824
+ * @internal
28825
+ */ transform = new Transform();
28992
28826
  this.viewportMatrix = Matrix4.fromIdentity();
28993
28827
  this.viewMatrix = Matrix4.fromIdentity();
28994
28828
  this.projectionMatrix = Matrix4.fromIdentity();
28995
28829
  this.viewProjectionMatrix = Matrix4.fromIdentity();
28996
28830
  this.inverseViewMatrix = Matrix4.fromIdentity();
28997
- this.transform = new Transform();
28998
28831
  this.dirty = true;
28999
28832
  var _options_near = options.near, near = _options_near === void 0 ? 0.1 : _options_near, _options_far = options.far, far = _options_far === void 0 ? 20 : _options_far, _options_fov = options.fov, fov = _options_fov === void 0 ? 60 : _options_fov, _options_aspect = options.aspect, aspect = _options_aspect === void 0 ? 1 : _options_aspect, _options_clipMode = options.clipMode, clipMode = _options_clipMode === void 0 ? CameraClipMode.portrait : _options_clipMode, _options_position = options.position, position = _options_position === void 0 ? [
29000
28833
  0,
@@ -29108,7 +28941,10 @@ var tmpScale = new Vector3(1, 1, 1);
29108
28941
  * 设置相机的旋转四元数
29109
28942
  * @param value - 旋转四元数
29110
28943
  */ _proto.setQuat = function setQuat(value) {
29111
- this.transform.setQuaternion(value.x, value.y, value.z, value.w);
28944
+ if (!this.transform.getQuaternion().equals(value)) {
28945
+ this.transform.setQuaternion(value.x, value.y, value.z, value.w);
28946
+ this.dirty = true;
28947
+ }
29112
28948
  };
29113
28949
  /**
29114
28950
  * 获取相机旋转对应的四元数
@@ -29146,7 +28982,7 @@ var tmpScale = new Vector3(1, 1, 1);
29146
28982
  var _this_options = this.options, fov = _this_options.fov, aspect = _this_options.aspect, near = _this_options.near, far = _this_options.far, clipMode = _this_options.clipMode;
29147
28983
  this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
29148
28984
  this.projectionMatrix.premultiply(this.viewportMatrix);
29149
- this.inverseViewMatrix.compose(this.position, this.getQuat().conjugate(), tmpScale);
28985
+ this.inverseViewMatrix.compose(this.position, this.getQuat(), tmpScale);
29150
28986
  var _this_transform_getParentMatrix;
29151
28987
  this.inverseViewMatrix.premultiply((_this_transform_getParentMatrix = this.transform.getParentMatrix()) != null ? _this_transform_getParentMatrix : Matrix4.IDENTITY);
29152
28988
  this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
@@ -32258,13 +32094,13 @@ var DEFAULT_FPS = 60;
32258
32094
  return Ticker;
32259
32095
  }();
32260
32096
 
32261
- registerPlugin("camera", CameraVFXItemLoader, exports.VFXItem, true);
32262
- registerPlugin("text", TextLoader, exports.VFXItem, true);
32263
- registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
32264
- registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
32265
- registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
32266
- registerPlugin("interact", InteractLoader, exports.VFXItem, true);
32267
- var version$1 = "2.3.0-beta.0";
32097
+ registerPlugin("camera", CameraVFXItemLoader, exports.VFXItem);
32098
+ registerPlugin("text", TextLoader, exports.VFXItem);
32099
+ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
32100
+ registerPlugin("particle", ParticleLoader, exports.VFXItem);
32101
+ registerPlugin("cal", CalculateLoader, exports.VFXItem);
32102
+ registerPlugin("interact", InteractLoader, exports.VFXItem);
32103
+ var version$1 = "2.3.0-beta.2";
32268
32104
  logger.info("Core version: " + version$1 + ".");
32269
32105
 
32270
32106
  var _obj;
@@ -33910,7 +33746,7 @@ setMaxSpriteMeshItemCount(8);
33910
33746
  */ Mesh.create = function(engine, props) {
33911
33747
  return new ThreeMesh(engine, props);
33912
33748
  };
33913
- var version = "2.3.0-beta.0";
33749
+ var version = "2.3.0-beta.2";
33914
33750
  logger.info("THREEJS plugin version: " + version + ".");
33915
33751
 
33916
33752
  exports.AbstractPlugin = AbstractPlugin;