@galacean/engine-physics-physx 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.
@@ -10375,8 +10375,10 @@ SimpleSpriteAssembler = __decorate$1([
10375
10375
  _this = Renderer.call(this, entity) || this;
10376
10376
  /** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
10377
10377
  _this._sprite = null;
10378
- _this._width = undefined;
10379
- _this._height = undefined;
10378
+ _this._automaticWidth = 0;
10379
+ _this._automaticHeight = 0;
10380
+ _this._customWidth = undefined;
10381
+ _this._customHeight = undefined;
10380
10382
  _this._flipX = false;
10381
10383
  _this._flipY = false;
10382
10384
  _this._alphaCutoff = 0.5;
@@ -10406,12 +10408,11 @@ SimpleSpriteAssembler = __decorate$1([
10406
10408
  /**
10407
10409
  * @override
10408
10410
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
10409
- var _this_sprite;
10410
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
10411
+ if (this.sprite) {
10412
+ SimpleSpriteAssembler.updatePositions(this);
10413
+ } else {
10411
10414
  worldBounds.min.set(0, 0, 0);
10412
10415
  worldBounds.max.set(0, 0, 0);
10413
- } else {
10414
- SimpleSpriteAssembler.updatePositions(this);
10415
10416
  }
10416
10417
  };
10417
10418
  /**
@@ -10422,12 +10423,12 @@ SimpleSpriteAssembler = __decorate$1([
10422
10423
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
10423
10424
  return;
10424
10425
  }
10425
- // Update position.
10426
+ // Update position
10426
10427
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
10427
10428
  SimpleSpriteAssembler.updatePositions(this);
10428
10429
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
10429
10430
  }
10430
- // Update uv.
10431
+ // Update uv
10431
10432
  if (this._dirtyUpdateFlag & 0x2) {
10432
10433
  SimpleSpriteAssembler.updateUVs(this);
10433
10434
  this._dirtyUpdateFlag &= ~0x2;
@@ -10438,11 +10439,27 @@ SimpleSpriteAssembler = __decorate$1([
10438
10439
  context.camera._renderPipeline._allSpriteMasks.add(this);
10439
10440
  this._maskElement = maskElement;
10440
10441
  };
10442
+ _proto._calDefaultSize = function _calDefaultSize() {
10443
+ var sprite = this._sprite;
10444
+ if (sprite) {
10445
+ this._automaticWidth = sprite.width;
10446
+ this._automaticHeight = sprite.height;
10447
+ } else {
10448
+ this._automaticWidth = this._automaticHeight = 0;
10449
+ }
10450
+ this._dirtyUpdateFlag &= ~0x4;
10451
+ };
10441
10452
  _proto._onSpriteChange = function _onSpriteChange(type) {
10442
10453
  switch(type){
10443
10454
  case SpriteModifyFlags.texture:
10444
10455
  this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
10445
10456
  break;
10457
+ case SpriteModifyFlags.size:
10458
+ this._dirtyUpdateFlag |= 0x4;
10459
+ if (this._customWidth === undefined || this._customHeight === undefined) {
10460
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10461
+ }
10462
+ break;
10446
10463
  case SpriteModifyFlags.region:
10447
10464
  case SpriteModifyFlags.atlasRegionOffset:
10448
10465
  this._dirtyUpdateFlag |= 0x3;
@@ -10450,22 +10467,31 @@ SimpleSpriteAssembler = __decorate$1([
10450
10467
  case SpriteModifyFlags.atlasRegion:
10451
10468
  this._dirtyUpdateFlag |= 0x2;
10452
10469
  break;
10470
+ case SpriteModifyFlags.pivot:
10471
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10472
+ break;
10453
10473
  }
10454
10474
  };
10455
10475
  _create_class$2(SpriteMask, [
10456
10476
  {
10457
10477
  key: "width",
10458
10478
  get: /**
10459
- * Render width.
10479
+ * Render width (in world coordinates).
10480
+ *
10481
+ * @remarks
10482
+ * If width is set, return the set value,
10483
+ * otherwise return `SpriteMask.sprite.width`.
10460
10484
  */ function get() {
10461
- if (this._width === undefined && this._sprite) {
10462
- this.width = this._sprite.width;
10485
+ if (this._customWidth !== undefined) {
10486
+ return this._customWidth;
10487
+ } else {
10488
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
10489
+ return this._automaticWidth;
10463
10490
  }
10464
- return this._width;
10465
10491
  },
10466
10492
  set: function set(value) {
10467
- if (this._width !== value) {
10468
- this._width = value;
10493
+ if (this._customWidth !== value) {
10494
+ this._customWidth = value;
10469
10495
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10470
10496
  }
10471
10497
  }
@@ -10473,16 +10499,22 @@ SimpleSpriteAssembler = __decorate$1([
10473
10499
  {
10474
10500
  key: "height",
10475
10501
  get: /**
10476
- * Render height.
10502
+ * Render height (in world coordinates).
10503
+ *
10504
+ * @remarks
10505
+ * If height is set, return the set value,
10506
+ * otherwise return `SpriteMask.sprite.height`.
10477
10507
  */ function get() {
10478
- if (this._height === undefined && this._sprite) {
10479
- this.height = this._sprite.height;
10508
+ if (this._customHeight !== undefined) {
10509
+ return this._customHeight;
10510
+ } else {
10511
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
10512
+ return this._automaticHeight;
10480
10513
  }
10481
- return this._height;
10482
10514
  },
10483
10515
  set: function set(value) {
10484
- if (this._height !== value) {
10485
- this._height = value;
10516
+ if (this._customHeight !== value) {
10517
+ this._customHeight = value;
10486
10518
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
10487
10519
  }
10488
10520
  }
@@ -10526,9 +10558,9 @@ SimpleSpriteAssembler = __decorate$1([
10526
10558
  var lastSprite = this._sprite;
10527
10559
  if (lastSprite !== value) {
10528
10560
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
10561
+ this._dirtyUpdateFlag |= 0x7;
10529
10562
  if (value) {
10530
10563
  value._updateFlagManager.addListener(this._onSpriteChange);
10531
- this._dirtyUpdateFlag |= 0x3;
10532
10564
  this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
10533
10565
  } else {
10534
10566
  this.shaderData.setTexture(SpriteMask._textureProperty, null);
@@ -10568,10 +10600,16 @@ __decorate$1([
10568
10600
  ], SpriteMask.prototype, "_sprite", void 0);
10569
10601
  __decorate$1([
10570
10602
  ignoreClone
10571
- ], SpriteMask.prototype, "_width", void 0);
10603
+ ], SpriteMask.prototype, "_automaticWidth", void 0);
10572
10604
  __decorate$1([
10573
10605
  ignoreClone
10574
- ], SpriteMask.prototype, "_height", void 0);
10606
+ ], SpriteMask.prototype, "_automaticHeight", void 0);
10607
+ __decorate$1([
10608
+ assignmentClone
10609
+ ], SpriteMask.prototype, "_customWidth", void 0);
10610
+ __decorate$1([
10611
+ assignmentClone
10612
+ ], SpriteMask.prototype, "_customHeight", void 0);
10575
10613
  __decorate$1([
10576
10614
  assignmentClone
10577
10615
  ], SpriteMask.prototype, "_flipX", void 0);
@@ -10589,7 +10627,9 @@ var /**
10589
10627
  */ SpriteMaskUpdateFlags;
10590
10628
  (function(SpriteMaskUpdateFlags) {
10591
10629
  SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
10592
- SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x3] = "All";
10630
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
10631
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
10632
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
10593
10633
  })(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
10594
10634
  /**
10595
10635
  * Vertex element format.
@@ -11440,6 +11480,7 @@ var MeshModifyFlags;
11440
11480
  var subDataDirtyFlags = this._subDataDirtyFlags;
11441
11481
  var blendShapeFloatStride = this._vertexElementCount * 3;
11442
11482
  var blendShapeByteStride = blendShapeFloatStride * 4;
11483
+ var bufferOffset = this._bufferBindingOffset;
11443
11484
  // @todo: should fix bug when dataChangedFlag is true
11444
11485
  for(var i = 0, n = blendShapes.length; i < n; i++){
11445
11486
  var dataChangedFlag = subDataDirtyFlags[i];
@@ -11457,7 +11498,7 @@ var MeshModifyFlags;
11457
11498
  var offset = indexInBuffer * blendShapeFloatStride;
11458
11499
  var storeInfo = storeInfos[i];
11459
11500
  storeInfo || (storeInfos[i] = storeInfo = new miniprogram$7.Vector2());
11460
- storeInfo.set(bufferIndex + 1, indexInBuffer * blendShapeByteStride); // BlendShape buffer is start from 1
11501
+ storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
11461
11502
  var deltaPositions = endFrame.deltaPositions;
11462
11503
  for(var j = 0; j < vertexCount; j++){
11463
11504
  var start = offset + bufferFloatStride * j;
@@ -19149,8 +19190,10 @@ exports.TextVerticalAlignment = void 0;
19149
19190
  if (name === void 0) name = null;
19150
19191
  var _this;
19151
19192
  _this = RefObject.call(this, engine) || this;
19152
- _this._width = undefined;
19153
- _this._height = undefined;
19193
+ _this._automaticWidth = 0;
19194
+ _this._automaticHeight = 0;
19195
+ _this._customWidth = undefined;
19196
+ _this._customHeight = undefined;
19154
19197
  _this._positions = [
19155
19198
  new miniprogram$7.Vector2(),
19156
19199
  new miniprogram$7.Vector2(),
@@ -19171,7 +19214,7 @@ exports.TextVerticalAlignment = void 0;
19171
19214
  _this._region = new miniprogram$7.Rect(0, 0, 1, 1);
19172
19215
  _this._pivot = new miniprogram$7.Vector2(0.5, 0.5);
19173
19216
  _this._border = new miniprogram$7.Vector4(0, 0, 0, 0);
19174
- _this._dirtyUpdateFlag = 0x3;
19217
+ _this._dirtyUpdateFlag = 0x7;
19175
19218
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
19176
19219
  _this._texture = texture;
19177
19220
  region && _this._region.copyFrom(region);
@@ -19221,9 +19264,12 @@ exports.TextVerticalAlignment = void 0;
19221
19264
  if (this._texture) {
19222
19265
  var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
19223
19266
  var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
19224
- this._width = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
19225
- this._height = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
19267
+ this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
19268
+ this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
19269
+ } else {
19270
+ this._automaticWidth = this._automaticHeight = 0;
19226
19271
  }
19272
+ this._dirtyUpdateFlag &= ~0x4;
19227
19273
  };
19228
19274
  _proto._updatePositions = function _updatePositions() {
19229
19275
  var blank = this._atlasRegionOffset;
@@ -19277,11 +19323,16 @@ exports.TextVerticalAlignment = void 0;
19277
19323
  };
19278
19324
  _proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
19279
19325
  switch(type){
19326
+ case SpriteModifyFlags.texture:
19327
+ this._dirtyUpdateFlag |= 0x4;
19328
+ break;
19280
19329
  case SpriteModifyFlags.atlasRegionOffset:
19281
19330
  case SpriteModifyFlags.region:
19282
- this._dirtyUpdateFlag |= 0x3;
19331
+ this._dirtyUpdateFlag |= 0x7;
19283
19332
  break;
19284
19333
  case SpriteModifyFlags.atlasRegion:
19334
+ this._dirtyUpdateFlag |= 0x4 | 0x2;
19335
+ break;
19285
19336
  case SpriteModifyFlags.border:
19286
19337
  this._dirtyUpdateFlag |= 0x2;
19287
19338
  break;
@@ -19300,7 +19351,9 @@ exports.TextVerticalAlignment = void 0;
19300
19351
  if (this._texture !== value) {
19301
19352
  this._texture = value;
19302
19353
  this._dispatchSpriteChange(SpriteModifyFlags.texture);
19303
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19354
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19355
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19356
+ }
19304
19357
  }
19305
19358
  }
19306
19359
  },
@@ -19308,13 +19361,21 @@ exports.TextVerticalAlignment = void 0;
19308
19361
  key: "width",
19309
19362
  get: /**
19310
19363
  * The width of the sprite (in world coordinates).
19364
+ *
19365
+ * @remarks
19366
+ * If width is set, return the set value,
19367
+ * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19311
19368
  */ function get() {
19312
- this._width === undefined && this._calDefaultSize();
19313
- return this._width;
19369
+ if (this._customWidth !== undefined) {
19370
+ return this._customWidth;
19371
+ } else {
19372
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19373
+ return this._automaticWidth;
19374
+ }
19314
19375
  },
19315
19376
  set: function set(value) {
19316
- if (this._width !== value) {
19317
- this._width = value;
19377
+ if (this._customWidth !== value) {
19378
+ this._customWidth = value;
19318
19379
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19319
19380
  }
19320
19381
  }
@@ -19323,13 +19384,21 @@ exports.TextVerticalAlignment = void 0;
19323
19384
  key: "height",
19324
19385
  get: /**
19325
19386
  * The height of the sprite (in world coordinates).
19387
+ *
19388
+ * @remarks
19389
+ * If height is set, return the set value,
19390
+ * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19326
19391
  */ function get() {
19327
- this._height === undefined && this._calDefaultSize();
19328
- return this._height;
19392
+ if (this._customHeight !== undefined) {
19393
+ return this._customHeight;
19394
+ } else {
19395
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19396
+ return this._automaticHeight;
19397
+ }
19329
19398
  },
19330
19399
  set: function set(value) {
19331
- if (this._height !== value) {
19332
- this._height = value;
19400
+ if (this._customHeight !== value) {
19401
+ this._customHeight = value;
19333
19402
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19334
19403
  }
19335
19404
  }
@@ -19359,7 +19428,9 @@ exports.TextVerticalAlignment = void 0;
19359
19428
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19360
19429
  this._atlasRegion.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19361
19430
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
19362
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19431
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19432
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19433
+ }
19363
19434
  }
19364
19435
  },
19365
19436
  {
@@ -19374,7 +19445,9 @@ exports.TextVerticalAlignment = void 0;
19374
19445
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19375
19446
  this._atlasRegionOffset.set(x, y, miniprogram$7.MathUtil.clamp(value.z, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.w, 0, 1 - y));
19376
19447
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
19377
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19448
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19449
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19450
+ }
19378
19451
  }
19379
19452
  },
19380
19453
  {
@@ -19390,7 +19463,9 @@ exports.TextVerticalAlignment = void 0;
19390
19463
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19391
19464
  region.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19392
19465
  this._dispatchSpriteChange(SpriteModifyFlags.region);
19393
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19466
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19467
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19468
+ }
19394
19469
  }
19395
19470
  },
19396
19471
  {
@@ -19440,7 +19515,8 @@ var SpriteUpdateFlags;
19440
19515
  (function(SpriteUpdateFlags) {
19441
19516
  SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
19442
19517
  SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
19443
- SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x3] = "all";
19518
+ SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
19519
+ SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
19444
19520
  })(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
19445
19521
  var _SlicedSpriteAssembler;
19446
19522
  var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
@@ -19590,8 +19666,10 @@ SlicedSpriteAssembler = __decorate$1([
19590
19666
  _this = Renderer.call(this, entity) || this;
19591
19667
  _this._color = new miniprogram$7.Color(1, 1, 1, 1);
19592
19668
  _this._sprite = null;
19593
- _this._width = undefined;
19594
- _this._height = undefined;
19669
+ _this._automaticWidth = 0;
19670
+ _this._automaticHeight = 0;
19671
+ _this._customWidth = undefined;
19672
+ _this._customHeight = undefined;
19595
19673
  _this._flipX = false;
19596
19674
  _this._flipY = false;
19597
19675
  _this._maskLayer = exports.SpriteMaskLayer.Layer0;
@@ -19608,6 +19686,7 @@ SlicedSpriteAssembler = __decorate$1([
19608
19686
  * @internal
19609
19687
  */ _proto._cloneTo = function _cloneTo(target) {
19610
19688
  target.sprite = this._sprite;
19689
+ target.drawMode = this._drawMode;
19611
19690
  };
19612
19691
  /**
19613
19692
  * @internal
@@ -19623,12 +19702,11 @@ SlicedSpriteAssembler = __decorate$1([
19623
19702
  /**
19624
19703
  * @override
19625
19704
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
19626
- var _this_sprite;
19627
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
19705
+ if (this.sprite) {
19706
+ this._assembler.updatePositions(this);
19707
+ } else {
19628
19708
  worldBounds.min.set(0, 0, 0);
19629
19709
  worldBounds.max.set(0, 0, 0);
19630
- } else {
19631
- this._assembler.updatePositions(this);
19632
19710
  }
19633
19711
  };
19634
19712
  /**
@@ -19638,17 +19716,17 @@ SlicedSpriteAssembler = __decorate$1([
19638
19716
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
19639
19717
  return;
19640
19718
  }
19641
- // Update position.
19719
+ // Update position
19642
19720
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
19643
19721
  this._assembler.updatePositions(this);
19644
19722
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
19645
19723
  }
19646
- // Update uv.
19724
+ // Update uv
19647
19725
  if (this._dirtyUpdateFlag & 0x2) {
19648
19726
  this._assembler.updateUVs(this);
19649
19727
  this._dirtyUpdateFlag &= ~0x2;
19650
19728
  }
19651
- // Push primitive.
19729
+ // Push primitive
19652
19730
  var material = this.getMaterial();
19653
19731
  var passes = material.shader.passes;
19654
19732
  var renderStates = material.renderStates;
@@ -19659,6 +19737,16 @@ SlicedSpriteAssembler = __decorate$1([
19659
19737
  context.camera._renderPipeline.pushPrimitive(spriteElement);
19660
19738
  }
19661
19739
  };
19740
+ _proto._calDefaultSize = function _calDefaultSize() {
19741
+ var sprite = this._sprite;
19742
+ if (sprite) {
19743
+ this._automaticWidth = sprite.width;
19744
+ this._automaticHeight = sprite.height;
19745
+ } else {
19746
+ this._automaticWidth = this._automaticHeight = 0;
19747
+ }
19748
+ this._dirtyUpdateFlag &= ~0x4;
19749
+ };
19662
19750
  _proto._updateStencilState = function _updateStencilState() {
19663
19751
  // Update stencil.
19664
19752
  var material = this.getInstanceMaterial();
@@ -19684,9 +19772,10 @@ SlicedSpriteAssembler = __decorate$1([
19684
19772
  this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
19685
19773
  break;
19686
19774
  case SpriteModifyFlags.size:
19775
+ this._dirtyUpdateFlag |= 0x4;
19687
19776
  // When the width and height of `SpriteRenderer` are `undefined`,
19688
19777
  // the `size` of `Sprite` will affect the position of `SpriteRenderer`.
19689
- if (this._drawMode === exports.SpriteDrawMode.Sliced || this._width === undefined || this._height === undefined) {
19778
+ if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
19690
19779
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19691
19780
  }
19692
19781
  break;
@@ -19740,9 +19829,9 @@ SlicedSpriteAssembler = __decorate$1([
19740
19829
  var lastSprite = this._sprite;
19741
19830
  if (lastSprite !== value) {
19742
19831
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
19832
+ this._dirtyUpdateFlag |= 0x7;
19743
19833
  if (value) {
19744
19834
  value._updateFlagManager.addListener(this._onSpriteChange);
19745
- this._dirtyUpdateFlag |= 0x3;
19746
19835
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
19747
19836
  } else {
19748
19837
  this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
@@ -19767,16 +19856,22 @@ SlicedSpriteAssembler = __decorate$1([
19767
19856
  {
19768
19857
  key: "width",
19769
19858
  get: /**
19770
- * Render width.
19859
+ * Render width (in world coordinates).
19860
+ *
19861
+ * @remarks
19862
+ * If width is set, return the set value,
19863
+ * otherwise return `SpriteRenderer.sprite.width`.
19771
19864
  */ function get() {
19772
- this._width === undefined && this._sprite && (this.width = this._sprite.width);
19773
- return this._width;
19865
+ if (this._customWidth !== undefined) {
19866
+ return this._customWidth;
19867
+ } else {
19868
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19869
+ return this._automaticWidth;
19870
+ }
19774
19871
  },
19775
19872
  set: function set(value) {
19776
- // Update width if undefined
19777
- this._width === undefined && this._sprite && (this._width = this._sprite.width);
19778
- if (this._width !== value) {
19779
- this._width = value;
19873
+ if (this._customWidth !== value) {
19874
+ this._customWidth = value;
19780
19875
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19781
19876
  }
19782
19877
  }
@@ -19784,16 +19879,22 @@ SlicedSpriteAssembler = __decorate$1([
19784
19879
  {
19785
19880
  key: "height",
19786
19881
  get: /**
19787
- * Render height.
19882
+ * Render height (in world coordinates).
19883
+ *
19884
+ * @remarks
19885
+ * If height is set, return the set value,
19886
+ * otherwise return `SpriteRenderer.sprite.height`.
19788
19887
  */ function get() {
19789
- this._height === undefined && this._sprite && (this.height = this._sprite.height);
19790
- return this._height;
19888
+ if (this._customHeight !== undefined) {
19889
+ return this._customHeight;
19890
+ } else {
19891
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19892
+ return this._automaticHeight;
19893
+ }
19791
19894
  },
19792
19895
  set: function set(value) {
19793
- // Update height if undefined
19794
- this._height === undefined && this._sprite && (this._height = this._sprite.height);
19795
- if (this._height !== value) {
19796
- this._height = value;
19896
+ if (this._customHeight !== value) {
19897
+ this._customHeight = value;
19797
19898
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19798
19899
  }
19799
19900
  }
@@ -19874,10 +19975,16 @@ __decorate$1([
19874
19975
  ], SpriteRenderer.prototype, "_sprite", void 0);
19875
19976
  __decorate$1([
19876
19977
  ignoreClone
19877
- ], SpriteRenderer.prototype, "_width", void 0);
19978
+ ], SpriteRenderer.prototype, "_automaticWidth", void 0);
19878
19979
  __decorate$1([
19879
19980
  ignoreClone
19880
- ], SpriteRenderer.prototype, "_height", void 0);
19981
+ ], SpriteRenderer.prototype, "_automaticHeight", void 0);
19982
+ __decorate$1([
19983
+ assignmentClone
19984
+ ], SpriteRenderer.prototype, "_customWidth", void 0);
19985
+ __decorate$1([
19986
+ assignmentClone
19987
+ ], SpriteRenderer.prototype, "_customHeight", void 0);
19881
19988
  __decorate$1([
19882
19989
  assignmentClone
19883
19990
  ], SpriteRenderer.prototype, "_flipX", void 0);
@@ -19898,7 +20005,9 @@ var /**
19898
20005
  */ SpriteRendererUpdateFlags;
19899
20006
  (function(SpriteRendererUpdateFlags) {
19900
20007
  SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
19901
- SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
20008
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
20009
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
20010
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
19902
20011
  })(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
19903
20012
  /**
19904
20013
  * @internal
@@ -28675,7 +28784,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
28675
28784
  var atlasItem = atlasItems[i];
28676
28785
  if (atlasItem.img) {
28677
28786
  chainPromises.push(resourceManager.load({
28678
- url: atlasItem.img,
28787
+ url: GLTFUtil.parseRelativeUrl(item.url, atlasItem.img),
28679
28788
  type: miniprogram$5.AssetType.Texture2D,
28680
28789
  params: {
28681
28790
  format: format,
@@ -35745,7 +35854,7 @@ function _interopNamespace(e) {
35745
35854
  }
35746
35855
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35747
35856
  //@ts-ignore
35748
- var version = "0.9.7";
35857
+ var version = "0.9.9";
35749
35858
  console.log("Galacean engine version: " + version);
35750
35859
  for(var key in CoreObjects__namespace){
35751
35860
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);
@@ -36703,23 +36812,22 @@ var CollisionDetectionMode;
36703
36812
  /**
36704
36813
  * {@inheritDoc IPhysicsManager.addCharacterController }
36705
36814
  */ _proto.addCharacterController = function addCharacterController(characterController) {
36706
- var lastPXManager = characterController._pxManager;
36707
- var shape = characterController._shape;
36708
- if (shape) {
36709
- if (lastPXManager !== this) {
36710
- lastPXManager && characterController._destroyPXController();
36711
- characterController._createPXController(this, shape);
36815
+ // Physx have no API to remove/readd cct into scene.
36816
+ if (!characterController._pxController) {
36817
+ var shape = characterController._shape;
36818
+ if (shape) {
36819
+ var lastPXManager = characterController._pxManager;
36820
+ if (lastPXManager !== this) {
36821
+ lastPXManager && characterController._destroyPXController();
36822
+ characterController._createPXController(this, shape);
36823
+ }
36712
36824
  }
36713
- this._pxScene.addController(characterController._pxController);
36714
36825
  }
36715
36826
  characterController._pxManager = this;
36716
36827
  };
36717
36828
  /**
36718
36829
  * {@inheritDoc IPhysicsManager.removeCharacterController }
36719
36830
  */ _proto.removeCharacterController = function removeCharacterController(characterController) {
36720
- if (characterController._shape) {
36721
- this._pxScene.removeController(characterController._pxController);
36722
- }
36723
36831
  characterController._pxManager = null;
36724
36832
  };
36725
36833
  /**
package/dist/module.js CHANGED
@@ -975,23 +975,22 @@ var CollisionDetectionMode;
975
975
  /**
976
976
  * {@inheritDoc IPhysicsManager.addCharacterController }
977
977
  */ _proto.addCharacterController = function addCharacterController(characterController) {
978
- var lastPXManager = characterController._pxManager;
979
- var shape = characterController._shape;
980
- if (shape) {
981
- if (lastPXManager !== this) {
982
- lastPXManager && characterController._destroyPXController();
983
- characterController._createPXController(this, shape);
978
+ // Physx have no API to remove/readd cct into scene.
979
+ if (!characterController._pxController) {
980
+ var shape = characterController._shape;
981
+ if (shape) {
982
+ var lastPXManager = characterController._pxManager;
983
+ if (lastPXManager !== this) {
984
+ lastPXManager && characterController._destroyPXController();
985
+ characterController._createPXController(this, shape);
986
+ }
984
987
  }
985
- this._pxScene.addController(characterController._pxController);
986
988
  }
987
989
  characterController._pxManager = this;
988
990
  };
989
991
  /**
990
992
  * {@inheritDoc IPhysicsManager.removeCharacterController }
991
993
  */ _proto.removeCharacterController = function removeCharacterController(characterController) {
992
- if (characterController._shape) {
993
- this._pxScene.removeController(characterController._pxController);
994
- }
995
994
  characterController._pxManager = null;
996
995
  };
997
996
  /**