@galacean/engine-physics-lite 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.
@@ -10382,8 +10382,10 @@ SimpleSpriteAssembler = __decorate$1([
10382
10382
  _this = Renderer.call(this, entity) || this;
10383
10383
  /** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
10384
10384
  _this._sprite = null;
10385
- _this._width = undefined;
10386
- _this._height = undefined;
10385
+ _this._automaticWidth = 0;
10386
+ _this._automaticHeight = 0;
10387
+ _this._customWidth = undefined;
10388
+ _this._customHeight = undefined;
10387
10389
  _this._flipX = false;
10388
10390
  _this._flipY = false;
10389
10391
  _this._alphaCutoff = 0.5;
@@ -10413,12 +10415,11 @@ SimpleSpriteAssembler = __decorate$1([
10413
10415
  /**
10414
10416
  * @override
10415
10417
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
10416
- var _this_sprite;
10417
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
10418
+ if (this.sprite) {
10419
+ SimpleSpriteAssembler.updatePositions(this);
10420
+ } else {
10418
10421
  worldBounds.min.set(0, 0, 0);
10419
10422
  worldBounds.max.set(0, 0, 0);
10420
- } else {
10421
- SimpleSpriteAssembler.updatePositions(this);
10422
10423
  }
10423
10424
  };
10424
10425
  /**
@@ -10429,12 +10430,12 @@ SimpleSpriteAssembler = __decorate$1([
10429
10430
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
10430
10431
  return;
10431
10432
  }
10432
- // Update position.
10433
+ // Update position
10433
10434
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
10434
10435
  SimpleSpriteAssembler.updatePositions(this);
10435
10436
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
10436
10437
  }
10437
- // Update uv.
10438
+ // Update uv
10438
10439
  if (this._dirtyUpdateFlag & 0x2) {
10439
10440
  SimpleSpriteAssembler.updateUVs(this);
10440
10441
  this._dirtyUpdateFlag &= ~0x2;
@@ -10445,11 +10446,27 @@ SimpleSpriteAssembler = __decorate$1([
10445
10446
  context.camera._renderPipeline._allSpriteMasks.add(this);
10446
10447
  this._maskElement = maskElement;
10447
10448
  };
10449
+ _proto._calDefaultSize = function _calDefaultSize() {
10450
+ var sprite = this._sprite;
10451
+ if (sprite) {
10452
+ this._automaticWidth = sprite.width;
10453
+ this._automaticHeight = sprite.height;
10454
+ } else {
10455
+ this._automaticWidth = this._automaticHeight = 0;
10456
+ }
10457
+ this._dirtyUpdateFlag &= ~0x4;
10458
+ };
10448
10459
  _proto._onSpriteChange = function _onSpriteChange(type) {
10449
10460
  switch(type){
10450
10461
  case SpriteModifyFlags.texture:
10451
10462
  this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
10452
10463
  break;
10464
+ case SpriteModifyFlags.size:
10465
+ this._dirtyUpdateFlag |= 0x4;
10466
+ if (this._customWidth === undefined || this._customHeight === undefined) {
10467
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10468
+ }
10469
+ break;
10453
10470
  case SpriteModifyFlags.region:
10454
10471
  case SpriteModifyFlags.atlasRegionOffset:
10455
10472
  this._dirtyUpdateFlag |= 0x3;
@@ -10457,22 +10474,31 @@ SimpleSpriteAssembler = __decorate$1([
10457
10474
  case SpriteModifyFlags.atlasRegion:
10458
10475
  this._dirtyUpdateFlag |= 0x2;
10459
10476
  break;
10477
+ case SpriteModifyFlags.pivot:
10478
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10479
+ break;
10460
10480
  }
10461
10481
  };
10462
10482
  _create_class$2(SpriteMask, [
10463
10483
  {
10464
10484
  key: "width",
10465
10485
  get: /**
10466
- * Render width.
10486
+ * Render width (in world coordinates).
10487
+ *
10488
+ * @remarks
10489
+ * If width is set, return the set value,
10490
+ * otherwise return `SpriteMask.sprite.width`.
10467
10491
  */ function get() {
10468
- if (this._width === undefined && this._sprite) {
10469
- this.width = this._sprite.width;
10492
+ if (this._customWidth !== undefined) {
10493
+ return this._customWidth;
10494
+ } else {
10495
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
10496
+ return this._automaticWidth;
10470
10497
  }
10471
- return this._width;
10472
10498
  },
10473
10499
  set: function set(value) {
10474
- if (this._width !== value) {
10475
- this._width = value;
10500
+ if (this._customWidth !== value) {
10501
+ this._customWidth = value;
10476
10502
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10477
10503
  }
10478
10504
  }
@@ -10480,16 +10506,22 @@ SimpleSpriteAssembler = __decorate$1([
10480
10506
  {
10481
10507
  key: "height",
10482
10508
  get: /**
10483
- * Render height.
10509
+ * Render height (in world coordinates).
10510
+ *
10511
+ * @remarks
10512
+ * If height is set, return the set value,
10513
+ * otherwise return `SpriteMask.sprite.height`.
10484
10514
  */ function get() {
10485
- if (this._height === undefined && this._sprite) {
10486
- this.height = this._sprite.height;
10515
+ if (this._customHeight !== undefined) {
10516
+ return this._customHeight;
10517
+ } else {
10518
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
10519
+ return this._automaticHeight;
10487
10520
  }
10488
- return this._height;
10489
10521
  },
10490
10522
  set: function set(value) {
10491
- if (this._height !== value) {
10492
- this._height = value;
10523
+ if (this._customHeight !== value) {
10524
+ this._customHeight = value;
10493
10525
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10494
10526
  }
10495
10527
  }
@@ -10533,9 +10565,9 @@ SimpleSpriteAssembler = __decorate$1([
10533
10565
  var lastSprite = this._sprite;
10534
10566
  if (lastSprite !== value) {
10535
10567
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
10568
+ this._dirtyUpdateFlag |= 0x7;
10536
10569
  if (value) {
10537
10570
  value._updateFlagManager.addListener(this._onSpriteChange);
10538
- this._dirtyUpdateFlag |= 0x3;
10539
10571
  this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
10540
10572
  } else {
10541
10573
  this.shaderData.setTexture(SpriteMask._textureProperty, null);
@@ -10575,10 +10607,16 @@ __decorate$1([
10575
10607
  ], SpriteMask.prototype, "_sprite", void 0);
10576
10608
  __decorate$1([
10577
10609
  ignoreClone
10578
- ], SpriteMask.prototype, "_width", void 0);
10610
+ ], SpriteMask.prototype, "_automaticWidth", void 0);
10579
10611
  __decorate$1([
10580
10612
  ignoreClone
10581
- ], SpriteMask.prototype, "_height", void 0);
10613
+ ], SpriteMask.prototype, "_automaticHeight", void 0);
10614
+ __decorate$1([
10615
+ assignmentClone
10616
+ ], SpriteMask.prototype, "_customWidth", void 0);
10617
+ __decorate$1([
10618
+ assignmentClone
10619
+ ], SpriteMask.prototype, "_customHeight", void 0);
10582
10620
  __decorate$1([
10583
10621
  assignmentClone
10584
10622
  ], SpriteMask.prototype, "_flipX", void 0);
@@ -10596,7 +10634,9 @@ var /**
10596
10634
  */ SpriteMaskUpdateFlags;
10597
10635
  (function(SpriteMaskUpdateFlags) {
10598
10636
  SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
10599
- SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x3] = "All";
10637
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
10638
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
10639
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
10600
10640
  })(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
10601
10641
  /**
10602
10642
  * Vertex element format.
@@ -11447,6 +11487,7 @@ var MeshModifyFlags;
11447
11487
  var subDataDirtyFlags = this._subDataDirtyFlags;
11448
11488
  var blendShapeFloatStride = this._vertexElementCount * 3;
11449
11489
  var blendShapeByteStride = blendShapeFloatStride * 4;
11490
+ var bufferOffset = this._bufferBindingOffset;
11450
11491
  // @todo: should fix bug when dataChangedFlag is true
11451
11492
  for(var i = 0, n = blendShapes.length; i < n; i++){
11452
11493
  var dataChangedFlag = subDataDirtyFlags[i];
@@ -11464,7 +11505,7 @@ var MeshModifyFlags;
11464
11505
  var offset = indexInBuffer * blendShapeFloatStride;
11465
11506
  var storeInfo = storeInfos[i];
11466
11507
  storeInfo || (storeInfos[i] = storeInfo = new miniprogram$7.Vector2());
11467
- storeInfo.set(bufferIndex + 1, indexInBuffer * blendShapeByteStride); // BlendShape buffer is start from 1
11508
+ storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
11468
11509
  var deltaPositions = endFrame.deltaPositions;
11469
11510
  for(var j = 0; j < vertexCount; j++){
11470
11511
  var start = offset + bufferFloatStride * j;
@@ -19156,8 +19197,10 @@ exports.TextVerticalAlignment = void 0;
19156
19197
  if (name === void 0) name = null;
19157
19198
  var _this;
19158
19199
  _this = RefObject.call(this, engine) || this;
19159
- _this._width = undefined;
19160
- _this._height = undefined;
19200
+ _this._automaticWidth = 0;
19201
+ _this._automaticHeight = 0;
19202
+ _this._customWidth = undefined;
19203
+ _this._customHeight = undefined;
19161
19204
  _this._positions = [
19162
19205
  new miniprogram$7.Vector2(),
19163
19206
  new miniprogram$7.Vector2(),
@@ -19178,7 +19221,7 @@ exports.TextVerticalAlignment = void 0;
19178
19221
  _this._region = new miniprogram$7.Rect(0, 0, 1, 1);
19179
19222
  _this._pivot = new miniprogram$7.Vector2(0.5, 0.5);
19180
19223
  _this._border = new miniprogram$7.Vector4(0, 0, 0, 0);
19181
- _this._dirtyUpdateFlag = 0x3;
19224
+ _this._dirtyUpdateFlag = 0x7;
19182
19225
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
19183
19226
  _this._texture = texture;
19184
19227
  region && _this._region.copyFrom(region);
@@ -19228,9 +19271,12 @@ exports.TextVerticalAlignment = void 0;
19228
19271
  if (this._texture) {
19229
19272
  var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
19230
19273
  var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
19231
- this._width = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
19232
- this._height = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
19274
+ this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
19275
+ this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
19276
+ } else {
19277
+ this._automaticWidth = this._automaticHeight = 0;
19233
19278
  }
19279
+ this._dirtyUpdateFlag &= ~0x4;
19234
19280
  };
19235
19281
  _proto._updatePositions = function _updatePositions() {
19236
19282
  var blank = this._atlasRegionOffset;
@@ -19284,11 +19330,16 @@ exports.TextVerticalAlignment = void 0;
19284
19330
  };
19285
19331
  _proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
19286
19332
  switch(type){
19333
+ case SpriteModifyFlags.texture:
19334
+ this._dirtyUpdateFlag |= 0x4;
19335
+ break;
19287
19336
  case SpriteModifyFlags.atlasRegionOffset:
19288
19337
  case SpriteModifyFlags.region:
19289
- this._dirtyUpdateFlag |= 0x3;
19338
+ this._dirtyUpdateFlag |= 0x7;
19290
19339
  break;
19291
19340
  case SpriteModifyFlags.atlasRegion:
19341
+ this._dirtyUpdateFlag |= 0x4 | 0x2;
19342
+ break;
19292
19343
  case SpriteModifyFlags.border:
19293
19344
  this._dirtyUpdateFlag |= 0x2;
19294
19345
  break;
@@ -19307,7 +19358,9 @@ exports.TextVerticalAlignment = void 0;
19307
19358
  if (this._texture !== value) {
19308
19359
  this._texture = value;
19309
19360
  this._dispatchSpriteChange(SpriteModifyFlags.texture);
19310
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19361
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19362
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19363
+ }
19311
19364
  }
19312
19365
  }
19313
19366
  },
@@ -19315,13 +19368,21 @@ exports.TextVerticalAlignment = void 0;
19315
19368
  key: "width",
19316
19369
  get: /**
19317
19370
  * The width of the sprite (in world coordinates).
19371
+ *
19372
+ * @remarks
19373
+ * If width is set, return the set value,
19374
+ * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19318
19375
  */ function get() {
19319
- this._width === undefined && this._calDefaultSize();
19320
- return this._width;
19376
+ if (this._customWidth !== undefined) {
19377
+ return this._customWidth;
19378
+ } else {
19379
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19380
+ return this._automaticWidth;
19381
+ }
19321
19382
  },
19322
19383
  set: function set(value) {
19323
- if (this._width !== value) {
19324
- this._width = value;
19384
+ if (this._customWidth !== value) {
19385
+ this._customWidth = value;
19325
19386
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19326
19387
  }
19327
19388
  }
@@ -19330,13 +19391,21 @@ exports.TextVerticalAlignment = void 0;
19330
19391
  key: "height",
19331
19392
  get: /**
19332
19393
  * The height of the sprite (in world coordinates).
19394
+ *
19395
+ * @remarks
19396
+ * If height is set, return the set value,
19397
+ * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19333
19398
  */ function get() {
19334
- this._height === undefined && this._calDefaultSize();
19335
- return this._height;
19399
+ if (this._customHeight !== undefined) {
19400
+ return this._customHeight;
19401
+ } else {
19402
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19403
+ return this._automaticHeight;
19404
+ }
19336
19405
  },
19337
19406
  set: function set(value) {
19338
- if (this._height !== value) {
19339
- this._height = value;
19407
+ if (this._customHeight !== value) {
19408
+ this._customHeight = value;
19340
19409
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19341
19410
  }
19342
19411
  }
@@ -19366,7 +19435,9 @@ exports.TextVerticalAlignment = void 0;
19366
19435
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19367
19436
  this._atlasRegion.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19368
19437
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
19369
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19438
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19439
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19440
+ }
19370
19441
  }
19371
19442
  },
19372
19443
  {
@@ -19381,7 +19452,9 @@ exports.TextVerticalAlignment = void 0;
19381
19452
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19382
19453
  this._atlasRegionOffset.set(x, y, miniprogram$7.MathUtil.clamp(value.z, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.w, 0, 1 - y));
19383
19454
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
19384
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19455
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19456
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19457
+ }
19385
19458
  }
19386
19459
  },
19387
19460
  {
@@ -19397,7 +19470,9 @@ exports.TextVerticalAlignment = void 0;
19397
19470
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19398
19471
  region.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19399
19472
  this._dispatchSpriteChange(SpriteModifyFlags.region);
19400
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19473
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19474
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19475
+ }
19401
19476
  }
19402
19477
  },
19403
19478
  {
@@ -19447,7 +19522,8 @@ var SpriteUpdateFlags;
19447
19522
  (function(SpriteUpdateFlags) {
19448
19523
  SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
19449
19524
  SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
19450
- SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x3] = "all";
19525
+ SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
19526
+ SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
19451
19527
  })(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
19452
19528
  var _SlicedSpriteAssembler;
19453
19529
  var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
@@ -19597,8 +19673,10 @@ SlicedSpriteAssembler = __decorate$1([
19597
19673
  _this = Renderer.call(this, entity) || this;
19598
19674
  _this._color = new miniprogram$7.Color(1, 1, 1, 1);
19599
19675
  _this._sprite = null;
19600
- _this._width = undefined;
19601
- _this._height = undefined;
19676
+ _this._automaticWidth = 0;
19677
+ _this._automaticHeight = 0;
19678
+ _this._customWidth = undefined;
19679
+ _this._customHeight = undefined;
19602
19680
  _this._flipX = false;
19603
19681
  _this._flipY = false;
19604
19682
  _this._maskLayer = exports.SpriteMaskLayer.Layer0;
@@ -19615,6 +19693,7 @@ SlicedSpriteAssembler = __decorate$1([
19615
19693
  * @internal
19616
19694
  */ _proto._cloneTo = function _cloneTo(target) {
19617
19695
  target.sprite = this._sprite;
19696
+ target.drawMode = this._drawMode;
19618
19697
  };
19619
19698
  /**
19620
19699
  * @internal
@@ -19630,12 +19709,11 @@ SlicedSpriteAssembler = __decorate$1([
19630
19709
  /**
19631
19710
  * @override
19632
19711
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
19633
- var _this_sprite;
19634
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
19712
+ if (this.sprite) {
19713
+ this._assembler.updatePositions(this);
19714
+ } else {
19635
19715
  worldBounds.min.set(0, 0, 0);
19636
19716
  worldBounds.max.set(0, 0, 0);
19637
- } else {
19638
- this._assembler.updatePositions(this);
19639
19717
  }
19640
19718
  };
19641
19719
  /**
@@ -19645,17 +19723,17 @@ SlicedSpriteAssembler = __decorate$1([
19645
19723
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
19646
19724
  return;
19647
19725
  }
19648
- // Update position.
19726
+ // Update position
19649
19727
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
19650
19728
  this._assembler.updatePositions(this);
19651
19729
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
19652
19730
  }
19653
- // Update uv.
19731
+ // Update uv
19654
19732
  if (this._dirtyUpdateFlag & 0x2) {
19655
19733
  this._assembler.updateUVs(this);
19656
19734
  this._dirtyUpdateFlag &= ~0x2;
19657
19735
  }
19658
- // Push primitive.
19736
+ // Push primitive
19659
19737
  var material = this.getMaterial();
19660
19738
  var passes = material.shader.passes;
19661
19739
  var renderStates = material.renderStates;
@@ -19666,6 +19744,16 @@ SlicedSpriteAssembler = __decorate$1([
19666
19744
  context.camera._renderPipeline.pushPrimitive(spriteElement);
19667
19745
  }
19668
19746
  };
19747
+ _proto._calDefaultSize = function _calDefaultSize() {
19748
+ var sprite = this._sprite;
19749
+ if (sprite) {
19750
+ this._automaticWidth = sprite.width;
19751
+ this._automaticHeight = sprite.height;
19752
+ } else {
19753
+ this._automaticWidth = this._automaticHeight = 0;
19754
+ }
19755
+ this._dirtyUpdateFlag &= ~0x4;
19756
+ };
19669
19757
  _proto._updateStencilState = function _updateStencilState() {
19670
19758
  // Update stencil.
19671
19759
  var material = this.getInstanceMaterial();
@@ -19691,9 +19779,10 @@ SlicedSpriteAssembler = __decorate$1([
19691
19779
  this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
19692
19780
  break;
19693
19781
  case SpriteModifyFlags.size:
19782
+ this._dirtyUpdateFlag |= 0x4;
19694
19783
  // When the width and height of `SpriteRenderer` are `undefined`,
19695
19784
  // the `size` of `Sprite` will affect the position of `SpriteRenderer`.
19696
- if (this._drawMode === exports.SpriteDrawMode.Sliced || this._width === undefined || this._height === undefined) {
19785
+ if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
19697
19786
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19698
19787
  }
19699
19788
  break;
@@ -19747,9 +19836,9 @@ SlicedSpriteAssembler = __decorate$1([
19747
19836
  var lastSprite = this._sprite;
19748
19837
  if (lastSprite !== value) {
19749
19838
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
19839
+ this._dirtyUpdateFlag |= 0x7;
19750
19840
  if (value) {
19751
19841
  value._updateFlagManager.addListener(this._onSpriteChange);
19752
- this._dirtyUpdateFlag |= 0x3;
19753
19842
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
19754
19843
  } else {
19755
19844
  this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
@@ -19774,16 +19863,22 @@ SlicedSpriteAssembler = __decorate$1([
19774
19863
  {
19775
19864
  key: "width",
19776
19865
  get: /**
19777
- * Render width.
19866
+ * Render width (in world coordinates).
19867
+ *
19868
+ * @remarks
19869
+ * If width is set, return the set value,
19870
+ * otherwise return `SpriteRenderer.sprite.width`.
19778
19871
  */ function get() {
19779
- this._width === undefined && this._sprite && (this.width = this._sprite.width);
19780
- return this._width;
19872
+ if (this._customWidth !== undefined) {
19873
+ return this._customWidth;
19874
+ } else {
19875
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19876
+ return this._automaticWidth;
19877
+ }
19781
19878
  },
19782
19879
  set: function set(value) {
19783
- // Update width if undefined
19784
- this._width === undefined && this._sprite && (this._width = this._sprite.width);
19785
- if (this._width !== value) {
19786
- this._width = value;
19880
+ if (this._customWidth !== value) {
19881
+ this._customWidth = value;
19787
19882
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19788
19883
  }
19789
19884
  }
@@ -19791,16 +19886,22 @@ SlicedSpriteAssembler = __decorate$1([
19791
19886
  {
19792
19887
  key: "height",
19793
19888
  get: /**
19794
- * Render height.
19889
+ * Render height (in world coordinates).
19890
+ *
19891
+ * @remarks
19892
+ * If height is set, return the set value,
19893
+ * otherwise return `SpriteRenderer.sprite.height`.
19795
19894
  */ function get() {
19796
- this._height === undefined && this._sprite && (this.height = this._sprite.height);
19797
- return this._height;
19895
+ if (this._customHeight !== undefined) {
19896
+ return this._customHeight;
19897
+ } else {
19898
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19899
+ return this._automaticHeight;
19900
+ }
19798
19901
  },
19799
19902
  set: function set(value) {
19800
- // Update height if undefined
19801
- this._height === undefined && this._sprite && (this._height = this._sprite.height);
19802
- if (this._height !== value) {
19803
- this._height = value;
19903
+ if (this._customHeight !== value) {
19904
+ this._customHeight = value;
19804
19905
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19805
19906
  }
19806
19907
  }
@@ -19881,10 +19982,16 @@ __decorate$1([
19881
19982
  ], SpriteRenderer.prototype, "_sprite", void 0);
19882
19983
  __decorate$1([
19883
19984
  ignoreClone
19884
- ], SpriteRenderer.prototype, "_width", void 0);
19985
+ ], SpriteRenderer.prototype, "_automaticWidth", void 0);
19885
19986
  __decorate$1([
19886
19987
  ignoreClone
19887
- ], SpriteRenderer.prototype, "_height", void 0);
19988
+ ], SpriteRenderer.prototype, "_automaticHeight", void 0);
19989
+ __decorate$1([
19990
+ assignmentClone
19991
+ ], SpriteRenderer.prototype, "_customWidth", void 0);
19992
+ __decorate$1([
19993
+ assignmentClone
19994
+ ], SpriteRenderer.prototype, "_customHeight", void 0);
19888
19995
  __decorate$1([
19889
19996
  assignmentClone
19890
19997
  ], SpriteRenderer.prototype, "_flipX", void 0);
@@ -19905,7 +20012,9 @@ var /**
19905
20012
  */ SpriteRendererUpdateFlags;
19906
20013
  (function(SpriteRendererUpdateFlags) {
19907
20014
  SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
19908
- SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
20015
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
20016
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
20017
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
19909
20018
  })(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
19910
20019
  /**
19911
20020
  * @internal
@@ -28682,7 +28791,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
28682
28791
  var atlasItem = atlasItems[i];
28683
28792
  if (atlasItem.img) {
28684
28793
  chainPromises.push(resourceManager.load({
28685
- url: atlasItem.img,
28794
+ url: GLTFUtil.parseRelativeUrl(item.url, atlasItem.img),
28686
28795
  type: miniprogram$5.AssetType.Texture2D,
28687
28796
  params: {
28688
28797
  format: format,
@@ -35752,7 +35861,7 @@ function _interopNamespace(e) {
35752
35861
  }
35753
35862
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35754
35863
  //@ts-ignore
35755
- var version = "0.9.7";
35864
+ var version = "0.9.9";
35756
35865
  console.log("Galacean engine version: " + version);
35757
35866
  for(var key in CoreObjects__namespace){
35758
35867
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);