@galacean/effects-core 2.0.0-alpha.30 → 2.0.0-alpha.31

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 core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.0-alpha.30
6
+ * Version: v2.0.0-alpha.31
7
7
  */
8
8
 
9
9
  'use strict';
@@ -8412,7 +8412,8 @@ var seed$9 = 1;
8412
8412
  texture = Texture.create(engine, {
8413
8413
  sourceType: exports.TextureSourceType.image,
8414
8414
  image: image,
8415
- id: generateGUID()
8415
+ id: generateGUID(),
8416
+ flipY: true
8416
8417
  });
8417
8418
  texture.initialize();
8418
8419
  return [
@@ -13481,6 +13482,11 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
13481
13482
  return SpriteLoader;
13482
13483
  }(AbstractPlugin);
13483
13484
 
13485
+ function _assert_this_initialized(self) {
13486
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13487
+ return self;
13488
+ }
13489
+
13484
13490
  /**
13485
13491
  * 动画图,负责更新所有的动画节点
13486
13492
  * @since 2.0.0
@@ -13888,6 +13894,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13888
13894
  function SpriteComponent(engine, props) {
13889
13895
  var _this;
13890
13896
  _this = RendererComponent.call(this, engine) || this;
13897
+ _this.cachePrefix = "-";
13898
+ _this.frameAnimationLoop = false;
13891
13899
  _this.frameAnimationTime = 0;
13892
13900
  _this.color = [
13893
13901
  1,
@@ -13911,6 +13919,39 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13911
13919
  }
13912
13920
  }
13913
13921
  };
13922
+ _this.name = "MSprite" + seed$3++;
13923
+ _this.renderer = {
13924
+ renderMode: RenderMode.BILLBOARD,
13925
+ blending: BlendingMode.ALPHA,
13926
+ texture: _this.engine.emptyTexture,
13927
+ occlusion: false,
13928
+ transparentOcclusion: false,
13929
+ side: SideMode.DOUBLE,
13930
+ mask: 0,
13931
+ maskMode: MaskMode.NONE,
13932
+ order: 0
13933
+ };
13934
+ _this.emptyTexture = _this.engine.emptyTexture;
13935
+ _this.splits = singleSplits;
13936
+ _this.renderInfo = getImageItemRenderInfo(_assert_this_initialized(_this));
13937
+ var geometry = _this.createGeometry(glContext.TRIANGLES);
13938
+ var material = _this.createMaterial(_this.renderInfo, 2);
13939
+ _this.worldMatrix = Matrix4.fromIdentity();
13940
+ _this.material = material;
13941
+ _this.geometry = geometry;
13942
+ _this.material.setVector4("_Color", new Vector4().setFromArray([
13943
+ 1,
13944
+ 1,
13945
+ 1,
13946
+ 1
13947
+ ]));
13948
+ _this.material.setVector4("_TexOffset", new Vector4().setFromArray([
13949
+ 0,
13950
+ 0,
13951
+ 1,
13952
+ 1
13953
+ ]));
13954
+ _this.setItem();
13914
13955
  if (props) {
13915
13956
  _this.fromData(props);
13916
13957
  }
@@ -13964,9 +14005,13 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13964
14005
  this.frameAnimationTime += dt / 1000;
13965
14006
  var time = this.frameAnimationTime;
13966
14007
  var duration = this.item.duration;
14008
+ if (time > duration && this.frameAnimationLoop) {
14009
+ time = time % duration;
14010
+ }
13967
14011
  var life = Math.min(Math.max(time / duration, 0.0), 1.0);
13968
14012
  var ta = this.textureSheetAnimation;
13969
14013
  if (ta) {
14014
+ var _this_material_getVector4;
13970
14015
  var total = ta.total || ta.row * ta.col;
13971
14016
  var texRectX = 0;
13972
14017
  var texRectY = 0;
@@ -14012,7 +14057,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14012
14057
  dy
14013
14058
  ];
14014
14059
  }
14015
- this.material.getVector4("_TexOffset").setFromArray([
14060
+ (_this_material_getVector4 = this.material.getVector4("_TexOffset")) == null ? void 0 : _this_material_getVector4.setFromArray([
14016
14061
  texRectX + texOffset[0],
14017
14062
  texRectH + texRectY - texOffset[1],
14018
14063
  dx,
@@ -14025,12 +14070,9 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14025
14070
  this.item.composition.destroyTextures(this.getTextures());
14026
14071
  }
14027
14072
  };
14028
- _proto.getItemInitData = function getItemInitData(item, idx, pointStartIndex, textureIndex) {
14029
- var geoData = item.geoData;
14030
- if (!geoData) {
14031
- geoData = item.geoData = this.getItemGeometryData(item, idx);
14032
- }
14033
- var index = geoData.index;
14073
+ _proto.getItemInitData = function getItemInitData() {
14074
+ this.geoData = this.getItemGeometryData();
14075
+ var _this_geoData = this.geoData, index = _this_geoData.index, atlasOffset = _this_geoData.atlasOffset;
14034
14076
  var idxCount = index.length;
14035
14077
  // @ts-expect-error
14036
14078
  var indexData = this.wireframe ? new Uint8Array([
@@ -14045,11 +14087,11 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14045
14087
  ]) : new index.constructor(idxCount);
14046
14088
  if (!this.wireframe) {
14047
14089
  for(var i = 0; i < idxCount; i++){
14048
- indexData[i] = pointStartIndex + index[i];
14090
+ indexData[i] = 0 + index[i];
14049
14091
  }
14050
14092
  }
14051
14093
  return {
14052
- atlasOffset: geoData.atlasOffset,
14094
+ atlasOffset: atlasOffset,
14053
14095
  index: indexData
14054
14096
  };
14055
14097
  };
@@ -14060,8 +14102,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14060
14102
  addItem(textures, texture);
14061
14103
  }
14062
14104
  texture = this.renderer.texture;
14063
- var textureIndex = texture ? textures.indexOf(texture) : -1;
14064
- var data = this.getItemInitData(this, 0, 0, textureIndex);
14105
+ var data = this.getItemInitData();
14065
14106
  var renderer = this.renderer;
14066
14107
  var texParams = this.material.getVector4("_TexParams");
14067
14108
  texParams.x = renderer.occlusion ? +renderer.transparentOcclusion : 1;
@@ -14152,6 +14193,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14152
14193
  setBlendMode(material, states.blendMode);
14153
14194
  setMaskMode(material, states.maskMode);
14154
14195
  setSideMode(material, states.side);
14196
+ material.shader.shaderData.properties = 'uSampler0("uSampler0",2D) = "white" {}';
14155
14197
  if (!material.hasUniform("_Color")) {
14156
14198
  material.setVector4("_Color", new Vector4(0, 0, 0, 1));
14157
14199
  }
@@ -14163,8 +14205,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14163
14205
  }
14164
14206
  return material;
14165
14207
  };
14166
- _proto.getItemGeometryData = function getItemGeometryData(item, aIndex) {
14167
- var splits = item.splits, renderer = item.renderer, textureSheetAnimation = item.textureSheetAnimation;
14208
+ _proto.getItemGeometryData = function getItemGeometryData() {
14209
+ var _this = this, splits = _this.splits, renderer = _this.renderer, textureSheetAnimation = _this.textureSheetAnimation;
14168
14210
  var sx = 1, sy = 1;
14169
14211
  if (renderer.shape) {
14170
14212
  var _renderer_shape = renderer.shape, _renderer_shape_index = _renderer_shape.index, index = _renderer_shape_index === void 0 ? [] : _renderer_shape_index, _renderer_shape_aPoint = _renderer_shape.aPoint, aPoint = _renderer_shape_aPoint === void 0 ? [] : _renderer_shape_aPoint;
@@ -14319,7 +14361,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14319
14361
  this.worldMatrix = Matrix4.fromIdentity();
14320
14362
  this.material = material;
14321
14363
  this.geometry = geometry;
14322
- this.name = "MSprite" + seed$3++;
14323
14364
  var startColor = options.startColor || [
14324
14365
  1,
14325
14366
  1,
@@ -18436,11 +18477,6 @@ var CalculateLoader = /*#__PURE__*/ function(AbstractPlugin) {
18436
18477
  return CalculateLoader;
18437
18478
  }(AbstractPlugin);
18438
18479
 
18439
- function _assert_this_initialized(self) {
18440
- if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
18441
- return self;
18442
- }
18443
-
18444
18480
  var AnimationStream = /*#__PURE__*/ function() {
18445
18481
  function AnimationStream(playable) {
18446
18482
  this.curveValues = {};
@@ -27449,7 +27485,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
27449
27485
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
27450
27486
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
27451
27487
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
27452
- var version = "2.0.0-alpha.30";
27488
+ var version = "2.0.0-alpha.31";
27453
27489
  logger.info("Core version: " + version + ".");
27454
27490
 
27455
27491
  exports.AbstractPlugin = AbstractPlugin;