@galacean/engine 0.9.7 → 0.9.9

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/browser.js CHANGED
@@ -15116,8 +15116,10 @@
15116
15116
  _this = Renderer.call(this, entity) || this;
15117
15117
  /** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
15118
15118
  _this._sprite = null;
15119
- _this._width = undefined;
15120
- _this._height = undefined;
15119
+ _this._automaticWidth = 0;
15120
+ _this._automaticHeight = 0;
15121
+ _this._customWidth = undefined;
15122
+ _this._customHeight = undefined;
15121
15123
  _this._flipX = false;
15122
15124
  _this._flipY = false;
15123
15125
  _this._alphaCutoff = 0.5;
@@ -15147,12 +15149,11 @@
15147
15149
  /**
15148
15150
  * @override
15149
15151
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
15150
- var _this_sprite;
15151
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
15152
+ if (this.sprite) {
15153
+ SimpleSpriteAssembler.updatePositions(this);
15154
+ } else {
15152
15155
  worldBounds.min.set(0, 0, 0);
15153
15156
  worldBounds.max.set(0, 0, 0);
15154
- } else {
15155
- SimpleSpriteAssembler.updatePositions(this);
15156
15157
  }
15157
15158
  };
15158
15159
  /**
@@ -15163,12 +15164,12 @@
15163
15164
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
15164
15165
  return;
15165
15166
  }
15166
- // Update position.
15167
+ // Update position
15167
15168
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
15168
15169
  SimpleSpriteAssembler.updatePositions(this);
15169
15170
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
15170
15171
  }
15171
- // Update uv.
15172
+ // Update uv
15172
15173
  if (this._dirtyUpdateFlag & 0x2) {
15173
15174
  SimpleSpriteAssembler.updateUVs(this);
15174
15175
  this._dirtyUpdateFlag &= ~0x2;
@@ -15179,11 +15180,27 @@
15179
15180
  context.camera._renderPipeline._allSpriteMasks.add(this);
15180
15181
  this._maskElement = maskElement;
15181
15182
  };
15183
+ _proto._calDefaultSize = function _calDefaultSize() {
15184
+ var sprite = this._sprite;
15185
+ if (sprite) {
15186
+ this._automaticWidth = sprite.width;
15187
+ this._automaticHeight = sprite.height;
15188
+ } else {
15189
+ this._automaticWidth = this._automaticHeight = 0;
15190
+ }
15191
+ this._dirtyUpdateFlag &= ~0x4;
15192
+ };
15182
15193
  _proto._onSpriteChange = function _onSpriteChange(type) {
15183
15194
  switch(type){
15184
15195
  case SpriteModifyFlags.texture:
15185
15196
  this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
15186
15197
  break;
15198
+ case SpriteModifyFlags.size:
15199
+ this._dirtyUpdateFlag |= 0x4;
15200
+ if (this._customWidth === undefined || this._customHeight === undefined) {
15201
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15202
+ }
15203
+ break;
15187
15204
  case SpriteModifyFlags.region:
15188
15205
  case SpriteModifyFlags.atlasRegionOffset:
15189
15206
  this._dirtyUpdateFlag |= 0x3;
@@ -15191,22 +15208,31 @@
15191
15208
  case SpriteModifyFlags.atlasRegion:
15192
15209
  this._dirtyUpdateFlag |= 0x2;
15193
15210
  break;
15211
+ case SpriteModifyFlags.pivot:
15212
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15213
+ break;
15194
15214
  }
15195
15215
  };
15196
15216
  _create_class$3(SpriteMask, [
15197
15217
  {
15198
15218
  key: "width",
15199
15219
  get: /**
15200
- * Render width.
15220
+ * Render width (in world coordinates).
15221
+ *
15222
+ * @remarks
15223
+ * If width is set, return the set value,
15224
+ * otherwise return `SpriteMask.sprite.width`.
15201
15225
  */ function get() {
15202
- if (this._width === undefined && this._sprite) {
15203
- this.width = this._sprite.width;
15226
+ if (this._customWidth !== undefined) {
15227
+ return this._customWidth;
15228
+ } else {
15229
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
15230
+ return this._automaticWidth;
15204
15231
  }
15205
- return this._width;
15206
15232
  },
15207
15233
  set: function set(value) {
15208
- if (this._width !== value) {
15209
- this._width = value;
15234
+ if (this._customWidth !== value) {
15235
+ this._customWidth = value;
15210
15236
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15211
15237
  }
15212
15238
  }
@@ -15214,16 +15240,22 @@
15214
15240
  {
15215
15241
  key: "height",
15216
15242
  get: /**
15217
- * Render height.
15243
+ * Render height (in world coordinates).
15244
+ *
15245
+ * @remarks
15246
+ * If height is set, return the set value,
15247
+ * otherwise return `SpriteMask.sprite.height`.
15218
15248
  */ function get() {
15219
- if (this._height === undefined && this._sprite) {
15220
- this.height = this._sprite.height;
15249
+ if (this._customHeight !== undefined) {
15250
+ return this._customHeight;
15251
+ } else {
15252
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
15253
+ return this._automaticHeight;
15221
15254
  }
15222
- return this._height;
15223
15255
  },
15224
15256
  set: function set(value) {
15225
- if (this._height !== value) {
15226
- this._height = value;
15257
+ if (this._customHeight !== value) {
15258
+ this._customHeight = value;
15227
15259
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15228
15260
  }
15229
15261
  }
@@ -15267,9 +15299,9 @@
15267
15299
  var lastSprite = this._sprite;
15268
15300
  if (lastSprite !== value) {
15269
15301
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
15302
+ this._dirtyUpdateFlag |= 0x7;
15270
15303
  if (value) {
15271
15304
  value._updateFlagManager.addListener(this._onSpriteChange);
15272
- this._dirtyUpdateFlag |= 0x3;
15273
15305
  this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
15274
15306
  } else {
15275
15307
  this.shaderData.setTexture(SpriteMask._textureProperty, null);
@@ -15309,10 +15341,16 @@
15309
15341
  ], SpriteMask.prototype, "_sprite", void 0);
15310
15342
  __decorate$1([
15311
15343
  ignoreClone
15312
- ], SpriteMask.prototype, "_width", void 0);
15344
+ ], SpriteMask.prototype, "_automaticWidth", void 0);
15313
15345
  __decorate$1([
15314
15346
  ignoreClone
15315
- ], SpriteMask.prototype, "_height", void 0);
15347
+ ], SpriteMask.prototype, "_automaticHeight", void 0);
15348
+ __decorate$1([
15349
+ assignmentClone
15350
+ ], SpriteMask.prototype, "_customWidth", void 0);
15351
+ __decorate$1([
15352
+ assignmentClone
15353
+ ], SpriteMask.prototype, "_customHeight", void 0);
15316
15354
  __decorate$1([
15317
15355
  assignmentClone
15318
15356
  ], SpriteMask.prototype, "_flipX", void 0);
@@ -15330,7 +15368,9 @@
15330
15368
  */ SpriteMaskUpdateFlags;
15331
15369
  (function(SpriteMaskUpdateFlags) {
15332
15370
  SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
15333
- SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x3] = "All";
15371
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
15372
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
15373
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
15334
15374
  })(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
15335
15375
  /**
15336
15376
  * Vertex element format.
@@ -16181,6 +16221,7 @@
16181
16221
  var subDataDirtyFlags = this._subDataDirtyFlags;
16182
16222
  var blendShapeFloatStride = this._vertexElementCount * 3;
16183
16223
  var blendShapeByteStride = blendShapeFloatStride * 4;
16224
+ var bufferOffset = this._bufferBindingOffset;
16184
16225
  // @todo: should fix bug when dataChangedFlag is true
16185
16226
  for(var i = 0, n = blendShapes.length; i < n; i++){
16186
16227
  var dataChangedFlag = subDataDirtyFlags[i];
@@ -16198,7 +16239,7 @@
16198
16239
  var offset = indexInBuffer * blendShapeFloatStride;
16199
16240
  var storeInfo = storeInfos[i];
16200
16241
  storeInfo || (storeInfos[i] = storeInfo = new Vector2());
16201
- storeInfo.set(bufferIndex + 1, indexInBuffer * blendShapeByteStride); // BlendShape buffer is start from 1
16242
+ storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
16202
16243
  var deltaPositions = endFrame.deltaPositions;
16203
16244
  for(var j = 0; j < vertexCount; j++){
16204
16245
  var start = offset + bufferFloatStride * j;
@@ -23890,8 +23931,10 @@
23890
23931
  if (name === void 0) name = null;
23891
23932
  var _this;
23892
23933
  _this = RefObject.call(this, engine) || this;
23893
- _this._width = undefined;
23894
- _this._height = undefined;
23934
+ _this._automaticWidth = 0;
23935
+ _this._automaticHeight = 0;
23936
+ _this._customWidth = undefined;
23937
+ _this._customHeight = undefined;
23895
23938
  _this._positions = [
23896
23939
  new Vector2(),
23897
23940
  new Vector2(),
@@ -23912,7 +23955,7 @@
23912
23955
  _this._region = new Rect(0, 0, 1, 1);
23913
23956
  _this._pivot = new Vector2(0.5, 0.5);
23914
23957
  _this._border = new Vector4(0, 0, 0, 0);
23915
- _this._dirtyUpdateFlag = 0x3;
23958
+ _this._dirtyUpdateFlag = 0x7;
23916
23959
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
23917
23960
  _this._texture = texture;
23918
23961
  region && _this._region.copyFrom(region);
@@ -23962,9 +24005,12 @@
23962
24005
  if (this._texture) {
23963
24006
  var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
23964
24007
  var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
23965
- this._width = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
23966
- this._height = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
24008
+ this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
24009
+ this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
24010
+ } else {
24011
+ this._automaticWidth = this._automaticHeight = 0;
23967
24012
  }
24013
+ this._dirtyUpdateFlag &= ~0x4;
23968
24014
  };
23969
24015
  _proto._updatePositions = function _updatePositions() {
23970
24016
  var blank = this._atlasRegionOffset;
@@ -24018,11 +24064,16 @@
24018
24064
  };
24019
24065
  _proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
24020
24066
  switch(type){
24067
+ case SpriteModifyFlags.texture:
24068
+ this._dirtyUpdateFlag |= 0x4;
24069
+ break;
24021
24070
  case SpriteModifyFlags.atlasRegionOffset:
24022
24071
  case SpriteModifyFlags.region:
24023
- this._dirtyUpdateFlag |= 0x3;
24072
+ this._dirtyUpdateFlag |= 0x7;
24024
24073
  break;
24025
24074
  case SpriteModifyFlags.atlasRegion:
24075
+ this._dirtyUpdateFlag |= 0x4 | 0x2;
24076
+ break;
24026
24077
  case SpriteModifyFlags.border:
24027
24078
  this._dirtyUpdateFlag |= 0x2;
24028
24079
  break;
@@ -24041,7 +24092,9 @@
24041
24092
  if (this._texture !== value) {
24042
24093
  this._texture = value;
24043
24094
  this._dispatchSpriteChange(SpriteModifyFlags.texture);
24044
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24095
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24096
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24097
+ }
24045
24098
  }
24046
24099
  }
24047
24100
  },
@@ -24049,13 +24102,21 @@
24049
24102
  key: "width",
24050
24103
  get: /**
24051
24104
  * The width of the sprite (in world coordinates).
24105
+ *
24106
+ * @remarks
24107
+ * If width is set, return the set value,
24108
+ * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
24052
24109
  */ function get() {
24053
- this._width === undefined && this._calDefaultSize();
24054
- return this._width;
24110
+ if (this._customWidth !== undefined) {
24111
+ return this._customWidth;
24112
+ } else {
24113
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24114
+ return this._automaticWidth;
24115
+ }
24055
24116
  },
24056
24117
  set: function set(value) {
24057
- if (this._width !== value) {
24058
- this._width = value;
24118
+ if (this._customWidth !== value) {
24119
+ this._customWidth = value;
24059
24120
  this._dispatchSpriteChange(SpriteModifyFlags.size);
24060
24121
  }
24061
24122
  }
@@ -24064,13 +24125,21 @@
24064
24125
  key: "height",
24065
24126
  get: /**
24066
24127
  * The height of the sprite (in world coordinates).
24128
+ *
24129
+ * @remarks
24130
+ * If height is set, return the set value,
24131
+ * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
24067
24132
  */ function get() {
24068
- this._height === undefined && this._calDefaultSize();
24069
- return this._height;
24133
+ if (this._customHeight !== undefined) {
24134
+ return this._customHeight;
24135
+ } else {
24136
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24137
+ return this._automaticHeight;
24138
+ }
24070
24139
  },
24071
24140
  set: function set(value) {
24072
- if (this._height !== value) {
24073
- this._height = value;
24141
+ if (this._customHeight !== value) {
24142
+ this._customHeight = value;
24074
24143
  this._dispatchSpriteChange(SpriteModifyFlags.size);
24075
24144
  }
24076
24145
  }
@@ -24100,7 +24169,9 @@
24100
24169
  var y = MathUtil$1.clamp(value.y, 0, 1);
24101
24170
  this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
24102
24171
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
24103
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24172
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24173
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24174
+ }
24104
24175
  }
24105
24176
  },
24106
24177
  {
@@ -24115,7 +24186,9 @@
24115
24186
  var y = MathUtil$1.clamp(value.y, 0, 1);
24116
24187
  this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
24117
24188
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
24118
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24189
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24190
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24191
+ }
24119
24192
  }
24120
24193
  },
24121
24194
  {
@@ -24131,7 +24204,9 @@
24131
24204
  var y = MathUtil$1.clamp(value.y, 0, 1);
24132
24205
  region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
24133
24206
  this._dispatchSpriteChange(SpriteModifyFlags.region);
24134
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24207
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24208
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24209
+ }
24135
24210
  }
24136
24211
  },
24137
24212
  {
@@ -24181,7 +24256,8 @@
24181
24256
  (function(SpriteUpdateFlags) {
24182
24257
  SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
24183
24258
  SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
24184
- SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x3] = "all";
24259
+ SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
24260
+ SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
24185
24261
  })(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
24186
24262
  var _SlicedSpriteAssembler;
24187
24263
  var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
@@ -24331,8 +24407,10 @@
24331
24407
  _this = Renderer.call(this, entity) || this;
24332
24408
  _this._color = new Color$1(1, 1, 1, 1);
24333
24409
  _this._sprite = null;
24334
- _this._width = undefined;
24335
- _this._height = undefined;
24410
+ _this._automaticWidth = 0;
24411
+ _this._automaticHeight = 0;
24412
+ _this._customWidth = undefined;
24413
+ _this._customHeight = undefined;
24336
24414
  _this._flipX = false;
24337
24415
  _this._flipY = false;
24338
24416
  _this._maskLayer = exports.SpriteMaskLayer.Layer0;
@@ -24349,6 +24427,7 @@
24349
24427
  * @internal
24350
24428
  */ _proto._cloneTo = function _cloneTo(target) {
24351
24429
  target.sprite = this._sprite;
24430
+ target.drawMode = this._drawMode;
24352
24431
  };
24353
24432
  /**
24354
24433
  * @internal
@@ -24364,12 +24443,11 @@
24364
24443
  /**
24365
24444
  * @override
24366
24445
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
24367
- var _this_sprite;
24368
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
24446
+ if (this.sprite) {
24447
+ this._assembler.updatePositions(this);
24448
+ } else {
24369
24449
  worldBounds.min.set(0, 0, 0);
24370
24450
  worldBounds.max.set(0, 0, 0);
24371
- } else {
24372
- this._assembler.updatePositions(this);
24373
24451
  }
24374
24452
  };
24375
24453
  /**
@@ -24379,17 +24457,17 @@
24379
24457
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
24380
24458
  return;
24381
24459
  }
24382
- // Update position.
24460
+ // Update position
24383
24461
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
24384
24462
  this._assembler.updatePositions(this);
24385
24463
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
24386
24464
  }
24387
- // Update uv.
24465
+ // Update uv
24388
24466
  if (this._dirtyUpdateFlag & 0x2) {
24389
24467
  this._assembler.updateUVs(this);
24390
24468
  this._dirtyUpdateFlag &= ~0x2;
24391
24469
  }
24392
- // Push primitive.
24470
+ // Push primitive
24393
24471
  var material = this.getMaterial();
24394
24472
  var passes = material.shader.passes;
24395
24473
  var renderStates = material.renderStates;
@@ -24400,6 +24478,16 @@
24400
24478
  context.camera._renderPipeline.pushPrimitive(spriteElement);
24401
24479
  }
24402
24480
  };
24481
+ _proto._calDefaultSize = function _calDefaultSize() {
24482
+ var sprite = this._sprite;
24483
+ if (sprite) {
24484
+ this._automaticWidth = sprite.width;
24485
+ this._automaticHeight = sprite.height;
24486
+ } else {
24487
+ this._automaticWidth = this._automaticHeight = 0;
24488
+ }
24489
+ this._dirtyUpdateFlag &= ~0x4;
24490
+ };
24403
24491
  _proto._updateStencilState = function _updateStencilState() {
24404
24492
  // Update stencil.
24405
24493
  var material = this.getInstanceMaterial();
@@ -24425,9 +24513,10 @@
24425
24513
  this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
24426
24514
  break;
24427
24515
  case SpriteModifyFlags.size:
24516
+ this._dirtyUpdateFlag |= 0x4;
24428
24517
  // When the width and height of `SpriteRenderer` are `undefined`,
24429
24518
  // the `size` of `Sprite` will affect the position of `SpriteRenderer`.
24430
- if (this._drawMode === exports.SpriteDrawMode.Sliced || this._width === undefined || this._height === undefined) {
24519
+ if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
24431
24520
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
24432
24521
  }
24433
24522
  break;
@@ -24481,9 +24570,9 @@
24481
24570
  var lastSprite = this._sprite;
24482
24571
  if (lastSprite !== value) {
24483
24572
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
24573
+ this._dirtyUpdateFlag |= 0x7;
24484
24574
  if (value) {
24485
24575
  value._updateFlagManager.addListener(this._onSpriteChange);
24486
- this._dirtyUpdateFlag |= 0x3;
24487
24576
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
24488
24577
  } else {
24489
24578
  this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
@@ -24508,16 +24597,22 @@
24508
24597
  {
24509
24598
  key: "width",
24510
24599
  get: /**
24511
- * Render width.
24600
+ * Render width (in world coordinates).
24601
+ *
24602
+ * @remarks
24603
+ * If width is set, return the set value,
24604
+ * otherwise return `SpriteRenderer.sprite.width`.
24512
24605
  */ function get() {
24513
- this._width === undefined && this._sprite && (this.width = this._sprite.width);
24514
- return this._width;
24606
+ if (this._customWidth !== undefined) {
24607
+ return this._customWidth;
24608
+ } else {
24609
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24610
+ return this._automaticWidth;
24611
+ }
24515
24612
  },
24516
24613
  set: function set(value) {
24517
- // Update width if undefined
24518
- this._width === undefined && this._sprite && (this._width = this._sprite.width);
24519
- if (this._width !== value) {
24520
- this._width = value;
24614
+ if (this._customWidth !== value) {
24615
+ this._customWidth = value;
24521
24616
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
24522
24617
  }
24523
24618
  }
@@ -24525,16 +24620,22 @@
24525
24620
  {
24526
24621
  key: "height",
24527
24622
  get: /**
24528
- * Render height.
24623
+ * Render height (in world coordinates).
24624
+ *
24625
+ * @remarks
24626
+ * If height is set, return the set value,
24627
+ * otherwise return `SpriteRenderer.sprite.height`.
24529
24628
  */ function get() {
24530
- this._height === undefined && this._sprite && (this.height = this._sprite.height);
24531
- return this._height;
24629
+ if (this._customHeight !== undefined) {
24630
+ return this._customHeight;
24631
+ } else {
24632
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24633
+ return this._automaticHeight;
24634
+ }
24532
24635
  },
24533
24636
  set: function set(value) {
24534
- // Update height if undefined
24535
- this._height === undefined && this._sprite && (this._height = this._sprite.height);
24536
- if (this._height !== value) {
24537
- this._height = value;
24637
+ if (this._customHeight !== value) {
24638
+ this._customHeight = value;
24538
24639
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
24539
24640
  }
24540
24641
  }
@@ -24615,10 +24716,16 @@
24615
24716
  ], SpriteRenderer.prototype, "_sprite", void 0);
24616
24717
  __decorate$1([
24617
24718
  ignoreClone
24618
- ], SpriteRenderer.prototype, "_width", void 0);
24719
+ ], SpriteRenderer.prototype, "_automaticWidth", void 0);
24619
24720
  __decorate$1([
24620
24721
  ignoreClone
24621
- ], SpriteRenderer.prototype, "_height", void 0);
24722
+ ], SpriteRenderer.prototype, "_automaticHeight", void 0);
24723
+ __decorate$1([
24724
+ assignmentClone
24725
+ ], SpriteRenderer.prototype, "_customWidth", void 0);
24726
+ __decorate$1([
24727
+ assignmentClone
24728
+ ], SpriteRenderer.prototype, "_customHeight", void 0);
24622
24729
  __decorate$1([
24623
24730
  assignmentClone
24624
24731
  ], SpriteRenderer.prototype, "_flipX", void 0);
@@ -24639,7 +24746,9 @@
24639
24746
  */ SpriteRendererUpdateFlags;
24640
24747
  (function(SpriteRendererUpdateFlags) {
24641
24748
  SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
24642
- SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
24749
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
24750
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
24751
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
24643
24752
  })(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
24644
24753
  /**
24645
24754
  * @internal
@@ -35573,7 +35682,7 @@
35573
35682
  var atlasItem = atlasItems[i];
35574
35683
  if (atlasItem.img) {
35575
35684
  chainPromises.push(resourceManager.load({
35576
- url: atlasItem.img,
35685
+ url: GLTFUtil.parseRelativeUrl(item.url, atlasItem.img),
35577
35686
  type: exports.AssetType.Texture2D,
35578
35687
  params: {
35579
35688
  format: format,
@@ -35878,7 +35987,7 @@
35878
35987
  }));
35879
35988
 
35880
35989
  //@ts-ignore
35881
- var version = "0.9.7";
35990
+ var version = "0.9.9";
35882
35991
  console.log("Galacean engine version: " + version);
35883
35992
  for(var key in CoreObjects){
35884
35993
  Loader.registerClass(key, CoreObjects[key]);