@galacean/engine-physics-physx 0.9.6 → 0.9.8

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.
@@ -14266,7 +14306,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
14266
14306
  // vertices
14267
14307
  this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
14268
14308
  // indices
14269
- this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
14309
+ this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
14270
14310
  mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
14271
14311
  mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
14272
14312
  mesh.setVertexElements(vertexElements);
@@ -19149,8 +19189,10 @@ exports.TextVerticalAlignment = void 0;
19149
19189
  if (name === void 0) name = null;
19150
19190
  var _this;
19151
19191
  _this = RefObject.call(this, engine) || this;
19152
- _this._width = undefined;
19153
- _this._height = undefined;
19192
+ _this._automaticWidth = 0;
19193
+ _this._automaticHeight = 0;
19194
+ _this._customWidth = undefined;
19195
+ _this._customHeight = undefined;
19154
19196
  _this._positions = [
19155
19197
  new miniprogram$7.Vector2(),
19156
19198
  new miniprogram$7.Vector2(),
@@ -19171,7 +19213,7 @@ exports.TextVerticalAlignment = void 0;
19171
19213
  _this._region = new miniprogram$7.Rect(0, 0, 1, 1);
19172
19214
  _this._pivot = new miniprogram$7.Vector2(0.5, 0.5);
19173
19215
  _this._border = new miniprogram$7.Vector4(0, 0, 0, 0);
19174
- _this._dirtyUpdateFlag = 0x3;
19216
+ _this._dirtyUpdateFlag = 0x7;
19175
19217
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
19176
19218
  _this._texture = texture;
19177
19219
  region && _this._region.copyFrom(region);
@@ -19221,9 +19263,12 @@ exports.TextVerticalAlignment = void 0;
19221
19263
  if (this._texture) {
19222
19264
  var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
19223
19265
  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;
19266
+ this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
19267
+ this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
19268
+ } else {
19269
+ this._automaticWidth = this._automaticHeight = 0;
19226
19270
  }
19271
+ this._dirtyUpdateFlag &= ~0x4;
19227
19272
  };
19228
19273
  _proto._updatePositions = function _updatePositions() {
19229
19274
  var blank = this._atlasRegionOffset;
@@ -19277,11 +19322,16 @@ exports.TextVerticalAlignment = void 0;
19277
19322
  };
19278
19323
  _proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
19279
19324
  switch(type){
19325
+ case SpriteModifyFlags.texture:
19326
+ this._dirtyUpdateFlag |= 0x4;
19327
+ break;
19280
19328
  case SpriteModifyFlags.atlasRegionOffset:
19281
19329
  case SpriteModifyFlags.region:
19282
- this._dirtyUpdateFlag |= 0x3;
19330
+ this._dirtyUpdateFlag |= 0x7;
19283
19331
  break;
19284
19332
  case SpriteModifyFlags.atlasRegion:
19333
+ this._dirtyUpdateFlag |= 0x4 | 0x2;
19334
+ break;
19285
19335
  case SpriteModifyFlags.border:
19286
19336
  this._dirtyUpdateFlag |= 0x2;
19287
19337
  break;
@@ -19300,7 +19350,9 @@ exports.TextVerticalAlignment = void 0;
19300
19350
  if (this._texture !== value) {
19301
19351
  this._texture = value;
19302
19352
  this._dispatchSpriteChange(SpriteModifyFlags.texture);
19303
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19353
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19354
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19355
+ }
19304
19356
  }
19305
19357
  }
19306
19358
  },
@@ -19308,13 +19360,21 @@ exports.TextVerticalAlignment = void 0;
19308
19360
  key: "width",
19309
19361
  get: /**
19310
19362
  * The width of the sprite (in world coordinates).
19363
+ *
19364
+ * @remarks
19365
+ * If width is set, return the set value,
19366
+ * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19311
19367
  */ function get() {
19312
- this._width === undefined && this._calDefaultSize();
19313
- return this._width;
19368
+ if (this._customWidth !== undefined) {
19369
+ return this._customWidth;
19370
+ } else {
19371
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19372
+ return this._automaticWidth;
19373
+ }
19314
19374
  },
19315
19375
  set: function set(value) {
19316
- if (this._width !== value) {
19317
- this._width = value;
19376
+ if (this._customWidth !== value) {
19377
+ this._customWidth = value;
19318
19378
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19319
19379
  }
19320
19380
  }
@@ -19323,13 +19383,21 @@ exports.TextVerticalAlignment = void 0;
19323
19383
  key: "height",
19324
19384
  get: /**
19325
19385
  * The height of the sprite (in world coordinates).
19386
+ *
19387
+ * @remarks
19388
+ * If height is set, return the set value,
19389
+ * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19326
19390
  */ function get() {
19327
- this._height === undefined && this._calDefaultSize();
19328
- return this._height;
19391
+ if (this._customHeight !== undefined) {
19392
+ return this._customHeight;
19393
+ } else {
19394
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19395
+ return this._automaticHeight;
19396
+ }
19329
19397
  },
19330
19398
  set: function set(value) {
19331
- if (this._height !== value) {
19332
- this._height = value;
19399
+ if (this._customHeight !== value) {
19400
+ this._customHeight = value;
19333
19401
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19334
19402
  }
19335
19403
  }
@@ -19359,7 +19427,9 @@ exports.TextVerticalAlignment = void 0;
19359
19427
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19360
19428
  this._atlasRegion.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19361
19429
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
19362
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19430
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19431
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19432
+ }
19363
19433
  }
19364
19434
  },
19365
19435
  {
@@ -19374,7 +19444,9 @@ exports.TextVerticalAlignment = void 0;
19374
19444
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19375
19445
  this._atlasRegionOffset.set(x, y, miniprogram$7.MathUtil.clamp(value.z, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.w, 0, 1 - y));
19376
19446
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
19377
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19447
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19448
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19449
+ }
19378
19450
  }
19379
19451
  },
19380
19452
  {
@@ -19390,7 +19462,9 @@ exports.TextVerticalAlignment = void 0;
19390
19462
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19391
19463
  region.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19392
19464
  this._dispatchSpriteChange(SpriteModifyFlags.region);
19393
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19465
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19466
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19467
+ }
19394
19468
  }
19395
19469
  },
19396
19470
  {
@@ -19440,7 +19514,8 @@ var SpriteUpdateFlags;
19440
19514
  (function(SpriteUpdateFlags) {
19441
19515
  SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
19442
19516
  SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
19443
- SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x3] = "all";
19517
+ SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
19518
+ SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
19444
19519
  })(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
19445
19520
  var _SlicedSpriteAssembler;
19446
19521
  var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
@@ -19590,8 +19665,10 @@ SlicedSpriteAssembler = __decorate$1([
19590
19665
  _this = Renderer.call(this, entity) || this;
19591
19666
  _this._color = new miniprogram$7.Color(1, 1, 1, 1);
19592
19667
  _this._sprite = null;
19593
- _this._width = undefined;
19594
- _this._height = undefined;
19668
+ _this._automaticWidth = 0;
19669
+ _this._automaticHeight = 0;
19670
+ _this._customWidth = undefined;
19671
+ _this._customHeight = undefined;
19595
19672
  _this._flipX = false;
19596
19673
  _this._flipY = false;
19597
19674
  _this._maskLayer = exports.SpriteMaskLayer.Layer0;
@@ -19608,6 +19685,7 @@ SlicedSpriteAssembler = __decorate$1([
19608
19685
  * @internal
19609
19686
  */ _proto._cloneTo = function _cloneTo(target) {
19610
19687
  target.sprite = this._sprite;
19688
+ target.drawMode = this._drawMode;
19611
19689
  };
19612
19690
  /**
19613
19691
  * @internal
@@ -19623,12 +19701,11 @@ SlicedSpriteAssembler = __decorate$1([
19623
19701
  /**
19624
19702
  * @override
19625
19703
  */ _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) {
19704
+ if (this.sprite) {
19705
+ this._assembler.updatePositions(this);
19706
+ } else {
19628
19707
  worldBounds.min.set(0, 0, 0);
19629
19708
  worldBounds.max.set(0, 0, 0);
19630
- } else {
19631
- this._assembler.updatePositions(this);
19632
19709
  }
19633
19710
  };
19634
19711
  /**
@@ -19638,17 +19715,17 @@ SlicedSpriteAssembler = __decorate$1([
19638
19715
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
19639
19716
  return;
19640
19717
  }
19641
- // Update position.
19718
+ // Update position
19642
19719
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
19643
19720
  this._assembler.updatePositions(this);
19644
19721
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
19645
19722
  }
19646
- // Update uv.
19723
+ // Update uv
19647
19724
  if (this._dirtyUpdateFlag & 0x2) {
19648
19725
  this._assembler.updateUVs(this);
19649
19726
  this._dirtyUpdateFlag &= ~0x2;
19650
19727
  }
19651
- // Push primitive.
19728
+ // Push primitive
19652
19729
  var material = this.getMaterial();
19653
19730
  var passes = material.shader.passes;
19654
19731
  var renderStates = material.renderStates;
@@ -19659,6 +19736,16 @@ SlicedSpriteAssembler = __decorate$1([
19659
19736
  context.camera._renderPipeline.pushPrimitive(spriteElement);
19660
19737
  }
19661
19738
  };
19739
+ _proto._calDefaultSize = function _calDefaultSize() {
19740
+ var sprite = this._sprite;
19741
+ if (sprite) {
19742
+ this._automaticWidth = sprite.width;
19743
+ this._automaticHeight = sprite.height;
19744
+ } else {
19745
+ this._automaticWidth = this._automaticHeight = 0;
19746
+ }
19747
+ this._dirtyUpdateFlag &= ~0x4;
19748
+ };
19662
19749
  _proto._updateStencilState = function _updateStencilState() {
19663
19750
  // Update stencil.
19664
19751
  var material = this.getInstanceMaterial();
@@ -19684,9 +19771,10 @@ SlicedSpriteAssembler = __decorate$1([
19684
19771
  this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
19685
19772
  break;
19686
19773
  case SpriteModifyFlags.size:
19774
+ this._dirtyUpdateFlag |= 0x4;
19687
19775
  // When the width and height of `SpriteRenderer` are `undefined`,
19688
19776
  // the `size` of `Sprite` will affect the position of `SpriteRenderer`.
19689
- if (this._drawMode === exports.SpriteDrawMode.Sliced || this._width === undefined || this._height === undefined) {
19777
+ if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
19690
19778
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19691
19779
  }
19692
19780
  break;
@@ -19740,9 +19828,9 @@ SlicedSpriteAssembler = __decorate$1([
19740
19828
  var lastSprite = this._sprite;
19741
19829
  if (lastSprite !== value) {
19742
19830
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
19831
+ this._dirtyUpdateFlag |= 0x7;
19743
19832
  if (value) {
19744
19833
  value._updateFlagManager.addListener(this._onSpriteChange);
19745
- this._dirtyUpdateFlag |= 0x3;
19746
19834
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
19747
19835
  } else {
19748
19836
  this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
@@ -19767,16 +19855,22 @@ SlicedSpriteAssembler = __decorate$1([
19767
19855
  {
19768
19856
  key: "width",
19769
19857
  get: /**
19770
- * Render width.
19858
+ * Render width (in world coordinates).
19859
+ *
19860
+ * @remarks
19861
+ * If width is set, return the set value,
19862
+ * otherwise return `SpriteRenderer.sprite.width`.
19771
19863
  */ function get() {
19772
- this._width === undefined && this._sprite && (this.width = this._sprite.width);
19773
- return this._width;
19864
+ if (this._customWidth !== undefined) {
19865
+ return this._customWidth;
19866
+ } else {
19867
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19868
+ return this._automaticWidth;
19869
+ }
19774
19870
  },
19775
19871
  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;
19872
+ if (this._customWidth !== value) {
19873
+ this._customWidth = value;
19780
19874
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19781
19875
  }
19782
19876
  }
@@ -19784,16 +19878,22 @@ SlicedSpriteAssembler = __decorate$1([
19784
19878
  {
19785
19879
  key: "height",
19786
19880
  get: /**
19787
- * Render height.
19881
+ * Render height (in world coordinates).
19882
+ *
19883
+ * @remarks
19884
+ * If height is set, return the set value,
19885
+ * otherwise return `SpriteRenderer.sprite.height`.
19788
19886
  */ function get() {
19789
- this._height === undefined && this._sprite && (this.height = this._sprite.height);
19790
- return this._height;
19887
+ if (this._customHeight !== undefined) {
19888
+ return this._customHeight;
19889
+ } else {
19890
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19891
+ return this._automaticHeight;
19892
+ }
19791
19893
  },
19792
19894
  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;
19895
+ if (this._customHeight !== value) {
19896
+ this._customHeight = value;
19797
19897
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19798
19898
  }
19799
19899
  }
@@ -19874,10 +19974,16 @@ __decorate$1([
19874
19974
  ], SpriteRenderer.prototype, "_sprite", void 0);
19875
19975
  __decorate$1([
19876
19976
  ignoreClone
19877
- ], SpriteRenderer.prototype, "_width", void 0);
19977
+ ], SpriteRenderer.prototype, "_automaticWidth", void 0);
19878
19978
  __decorate$1([
19879
19979
  ignoreClone
19880
- ], SpriteRenderer.prototype, "_height", void 0);
19980
+ ], SpriteRenderer.prototype, "_automaticHeight", void 0);
19981
+ __decorate$1([
19982
+ assignmentClone
19983
+ ], SpriteRenderer.prototype, "_customWidth", void 0);
19984
+ __decorate$1([
19985
+ assignmentClone
19986
+ ], SpriteRenderer.prototype, "_customHeight", void 0);
19881
19987
  __decorate$1([
19882
19988
  assignmentClone
19883
19989
  ], SpriteRenderer.prototype, "_flipX", void 0);
@@ -19898,7 +20004,9 @@ var /**
19898
20004
  */ SpriteRendererUpdateFlags;
19899
20005
  (function(SpriteRendererUpdateFlags) {
19900
20006
  SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
19901
- SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
20007
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
20008
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
20009
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
19902
20010
  })(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
19903
20011
  /**
19904
20012
  * @internal
@@ -28675,7 +28783,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
28675
28783
  var atlasItem = atlasItems[i];
28676
28784
  if (atlasItem.img) {
28677
28785
  chainPromises.push(resourceManager.load({
28678
- url: atlasItem.img,
28786
+ url: GLTFUtil.parseRelativeUrl(item.url, atlasItem.img),
28679
28787
  type: miniprogram$5.AssetType.Texture2D,
28680
28788
  params: {
28681
28789
  format: format,
@@ -28848,6 +28956,29 @@ TextureCubeLoader = __decorate([
28848
28956
  ""
28849
28957
  ])
28850
28958
  ], TextureCubeLoader);
28959
+ var AnimationClipLoader = /*#__PURE__*/ function(Loader) {
28960
+ var AnimationClipLoader = function AnimationClipLoader() {
28961
+ return Loader.apply(this, arguments);
28962
+ };
28963
+ _inherits$1(AnimationClipLoader, Loader);
28964
+ var _proto = AnimationClipLoader.prototype;
28965
+ _proto.load = function load(item, resourceManager) {
28966
+ var _this = this;
28967
+ return new miniprogram$5.AssetPromise(function(resolve, reject) {
28968
+ _this.request(item.url, _extends$1({}, item, {
28969
+ type: "arraybuffer"
28970
+ })).then(function(data) {
28971
+ return decode(data, resourceManager.engine).then(resolve);
28972
+ }).catch(reject);
28973
+ });
28974
+ };
28975
+ return AnimationClipLoader;
28976
+ }(miniprogram$5.Loader);
28977
+ AnimationClipLoader = __decorate([
28978
+ miniprogram$5.resourceLoader(miniprogram$5.AssetType.AnimationClip, [
28979
+ "ani"
28980
+ ])
28981
+ ], AnimationClipLoader);
28851
28982
  var SceneLoader = /*#__PURE__*/ function(Loader) {
28852
28983
  var SceneLoader = function SceneLoader() {
28853
28984
  return Loader.apply(this, arguments);
@@ -28916,6 +29047,14 @@ var SceneLoader = /*#__PURE__*/ function(Loader) {
28916
29047
  if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
28917
29048
  if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
28918
29049
  }
29050
+ var fog = data.scene.fog;
29051
+ if (fog) {
29052
+ if (fog.fogMode != undefined) scene.fogMode = fog.fogMode;
29053
+ if (fog.fogStart != undefined) scene.fogStart = fog.fogStart;
29054
+ if (fog.fogEnd != undefined) scene.fogEnd = fog.fogEnd;
29055
+ if (fog.fogDensity != undefined) scene.fogDensity = fog.fogDensity;
29056
+ if (fog.fogColor != undefined) scene.fogColor.copyFrom(fog.fogColor);
29057
+ }
28919
29058
  return Promise.all([
28920
29059
  ambientLightPromise,
28921
29060
  backgroundPromise
@@ -35714,7 +35853,7 @@ function _interopNamespace(e) {
35714
35853
  }
35715
35854
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35716
35855
  //@ts-ignore
35717
- var version = "0.9.6";
35856
+ var version = "0.9.8";
35718
35857
  console.log("Galacean engine version: " + version);
35719
35858
  for(var key in CoreObjects__namespace){
35720
35859
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);
@@ -36672,12 +36811,15 @@ var CollisionDetectionMode;
36672
36811
  /**
36673
36812
  * {@inheritDoc IPhysicsManager.addCharacterController }
36674
36813
  */ _proto.addCharacterController = function addCharacterController(characterController) {
36675
- var lastPXManager = characterController._pxManager;
36676
- var shape = characterController._shape;
36677
- if (shape) {
36678
- if (lastPXManager !== this) {
36679
- lastPXManager && characterController._destroyPXController();
36680
- characterController._createPXController(this, shape);
36814
+ // Physx have no API to remove/readd cct into scene.
36815
+ if (!characterController._pxController) {
36816
+ var shape = characterController._shape;
36817
+ if (shape) {
36818
+ var lastPXManager = characterController._pxManager;
36819
+ if (lastPXManager !== this) {
36820
+ lastPXManager && characterController._destroyPXController();
36821
+ characterController._createPXController(this, shape);
36822
+ }
36681
36823
  }
36682
36824
  this._pxScene.addController(characterController._pxController);
36683
36825
  }
@@ -36686,9 +36828,6 @@ var CollisionDetectionMode;
36686
36828
  /**
36687
36829
  * {@inheritDoc IPhysicsManager.removeCharacterController }
36688
36830
  */ _proto.removeCharacterController = function removeCharacterController(characterController) {
36689
- if (characterController._shape) {
36690
- this._pxScene.removeController(characterController._pxController);
36691
- }
36692
36831
  characterController._pxManager = null;
36693
36832
  };
36694
36833
  /**
package/dist/module.js CHANGED
@@ -975,12 +975,15 @@ 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
988
  this._pxScene.addController(characterController._pxController);
986
989
  }
@@ -989,9 +992,6 @@ var CollisionDetectionMode;
989
992
  /**
990
993
  * {@inheritDoc IPhysicsManager.removeCharacterController }
991
994
  */ _proto.removeCharacterController = function removeCharacterController(characterController) {
992
- if (characterController._shape) {
993
- this._pxScene.removeController(characterController._pxController);
994
- }
995
995
  characterController._pxManager = null;
996
996
  };
997
997
  /**