@galacean/engine-physics-lite 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.
@@ -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.
@@ -14273,7 +14313,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
14273
14313
  // vertices
14274
14314
  this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
14275
14315
  // indices
14276
- this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
14316
+ this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
14277
14317
  mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
14278
14318
  mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
14279
14319
  mesh.setVertexElements(vertexElements);
@@ -19156,8 +19196,10 @@ exports.TextVerticalAlignment = void 0;
19156
19196
  if (name === void 0) name = null;
19157
19197
  var _this;
19158
19198
  _this = RefObject.call(this, engine) || this;
19159
- _this._width = undefined;
19160
- _this._height = undefined;
19199
+ _this._automaticWidth = 0;
19200
+ _this._automaticHeight = 0;
19201
+ _this._customWidth = undefined;
19202
+ _this._customHeight = undefined;
19161
19203
  _this._positions = [
19162
19204
  new miniprogram$7.Vector2(),
19163
19205
  new miniprogram$7.Vector2(),
@@ -19178,7 +19220,7 @@ exports.TextVerticalAlignment = void 0;
19178
19220
  _this._region = new miniprogram$7.Rect(0, 0, 1, 1);
19179
19221
  _this._pivot = new miniprogram$7.Vector2(0.5, 0.5);
19180
19222
  _this._border = new miniprogram$7.Vector4(0, 0, 0, 0);
19181
- _this._dirtyUpdateFlag = 0x3;
19223
+ _this._dirtyUpdateFlag = 0x7;
19182
19224
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
19183
19225
  _this._texture = texture;
19184
19226
  region && _this._region.copyFrom(region);
@@ -19228,9 +19270,12 @@ exports.TextVerticalAlignment = void 0;
19228
19270
  if (this._texture) {
19229
19271
  var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
19230
19272
  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;
19273
+ this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
19274
+ this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
19275
+ } else {
19276
+ this._automaticWidth = this._automaticHeight = 0;
19233
19277
  }
19278
+ this._dirtyUpdateFlag &= ~0x4;
19234
19279
  };
19235
19280
  _proto._updatePositions = function _updatePositions() {
19236
19281
  var blank = this._atlasRegionOffset;
@@ -19284,11 +19329,16 @@ exports.TextVerticalAlignment = void 0;
19284
19329
  };
19285
19330
  _proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
19286
19331
  switch(type){
19332
+ case SpriteModifyFlags.texture:
19333
+ this._dirtyUpdateFlag |= 0x4;
19334
+ break;
19287
19335
  case SpriteModifyFlags.atlasRegionOffset:
19288
19336
  case SpriteModifyFlags.region:
19289
- this._dirtyUpdateFlag |= 0x3;
19337
+ this._dirtyUpdateFlag |= 0x7;
19290
19338
  break;
19291
19339
  case SpriteModifyFlags.atlasRegion:
19340
+ this._dirtyUpdateFlag |= 0x4 | 0x2;
19341
+ break;
19292
19342
  case SpriteModifyFlags.border:
19293
19343
  this._dirtyUpdateFlag |= 0x2;
19294
19344
  break;
@@ -19307,7 +19357,9 @@ exports.TextVerticalAlignment = void 0;
19307
19357
  if (this._texture !== value) {
19308
19358
  this._texture = value;
19309
19359
  this._dispatchSpriteChange(SpriteModifyFlags.texture);
19310
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19360
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19361
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19362
+ }
19311
19363
  }
19312
19364
  }
19313
19365
  },
@@ -19315,13 +19367,21 @@ exports.TextVerticalAlignment = void 0;
19315
19367
  key: "width",
19316
19368
  get: /**
19317
19369
  * The width of the sprite (in world coordinates).
19370
+ *
19371
+ * @remarks
19372
+ * If width is set, return the set value,
19373
+ * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19318
19374
  */ function get() {
19319
- this._width === undefined && this._calDefaultSize();
19320
- return this._width;
19375
+ if (this._customWidth !== undefined) {
19376
+ return this._customWidth;
19377
+ } else {
19378
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19379
+ return this._automaticWidth;
19380
+ }
19321
19381
  },
19322
19382
  set: function set(value) {
19323
- if (this._width !== value) {
19324
- this._width = value;
19383
+ if (this._customWidth !== value) {
19384
+ this._customWidth = value;
19325
19385
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19326
19386
  }
19327
19387
  }
@@ -19330,13 +19390,21 @@ exports.TextVerticalAlignment = void 0;
19330
19390
  key: "height",
19331
19391
  get: /**
19332
19392
  * The height of the sprite (in world coordinates).
19393
+ *
19394
+ * @remarks
19395
+ * If height is set, return the set value,
19396
+ * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
19333
19397
  */ function get() {
19334
- this._height === undefined && this._calDefaultSize();
19335
- return this._height;
19398
+ if (this._customHeight !== undefined) {
19399
+ return this._customHeight;
19400
+ } else {
19401
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19402
+ return this._automaticHeight;
19403
+ }
19336
19404
  },
19337
19405
  set: function set(value) {
19338
- if (this._height !== value) {
19339
- this._height = value;
19406
+ if (this._customHeight !== value) {
19407
+ this._customHeight = value;
19340
19408
  this._dispatchSpriteChange(SpriteModifyFlags.size);
19341
19409
  }
19342
19410
  }
@@ -19366,7 +19434,9 @@ exports.TextVerticalAlignment = void 0;
19366
19434
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19367
19435
  this._atlasRegion.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19368
19436
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
19369
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19437
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19438
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19439
+ }
19370
19440
  }
19371
19441
  },
19372
19442
  {
@@ -19381,7 +19451,9 @@ exports.TextVerticalAlignment = void 0;
19381
19451
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19382
19452
  this._atlasRegionOffset.set(x, y, miniprogram$7.MathUtil.clamp(value.z, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.w, 0, 1 - y));
19383
19453
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
19384
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19454
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19455
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19456
+ }
19385
19457
  }
19386
19458
  },
19387
19459
  {
@@ -19397,7 +19469,9 @@ exports.TextVerticalAlignment = void 0;
19397
19469
  var y = miniprogram$7.MathUtil.clamp(value.y, 0, 1);
19398
19470
  region.set(x, y, miniprogram$7.MathUtil.clamp(value.width, 0, 1 - x), miniprogram$7.MathUtil.clamp(value.height, 0, 1 - y));
19399
19471
  this._dispatchSpriteChange(SpriteModifyFlags.region);
19400
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
19472
+ if (this._customWidth === undefined || this._customHeight === undefined) {
19473
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
19474
+ }
19401
19475
  }
19402
19476
  },
19403
19477
  {
@@ -19447,7 +19521,8 @@ var SpriteUpdateFlags;
19447
19521
  (function(SpriteUpdateFlags) {
19448
19522
  SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
19449
19523
  SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
19450
- SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x3] = "all";
19524
+ SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
19525
+ SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
19451
19526
  })(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
19452
19527
  var _SlicedSpriteAssembler;
19453
19528
  var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
@@ -19597,8 +19672,10 @@ SlicedSpriteAssembler = __decorate$1([
19597
19672
  _this = Renderer.call(this, entity) || this;
19598
19673
  _this._color = new miniprogram$7.Color(1, 1, 1, 1);
19599
19674
  _this._sprite = null;
19600
- _this._width = undefined;
19601
- _this._height = undefined;
19675
+ _this._automaticWidth = 0;
19676
+ _this._automaticHeight = 0;
19677
+ _this._customWidth = undefined;
19678
+ _this._customHeight = undefined;
19602
19679
  _this._flipX = false;
19603
19680
  _this._flipY = false;
19604
19681
  _this._maskLayer = exports.SpriteMaskLayer.Layer0;
@@ -19615,6 +19692,7 @@ SlicedSpriteAssembler = __decorate$1([
19615
19692
  * @internal
19616
19693
  */ _proto._cloneTo = function _cloneTo(target) {
19617
19694
  target.sprite = this._sprite;
19695
+ target.drawMode = this._drawMode;
19618
19696
  };
19619
19697
  /**
19620
19698
  * @internal
@@ -19630,12 +19708,11 @@ SlicedSpriteAssembler = __decorate$1([
19630
19708
  /**
19631
19709
  * @override
19632
19710
  */ _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) {
19711
+ if (this.sprite) {
19712
+ this._assembler.updatePositions(this);
19713
+ } else {
19635
19714
  worldBounds.min.set(0, 0, 0);
19636
19715
  worldBounds.max.set(0, 0, 0);
19637
- } else {
19638
- this._assembler.updatePositions(this);
19639
19716
  }
19640
19717
  };
19641
19718
  /**
@@ -19645,17 +19722,17 @@ SlicedSpriteAssembler = __decorate$1([
19645
19722
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
19646
19723
  return;
19647
19724
  }
19648
- // Update position.
19725
+ // Update position
19649
19726
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
19650
19727
  this._assembler.updatePositions(this);
19651
19728
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
19652
19729
  }
19653
- // Update uv.
19730
+ // Update uv
19654
19731
  if (this._dirtyUpdateFlag & 0x2) {
19655
19732
  this._assembler.updateUVs(this);
19656
19733
  this._dirtyUpdateFlag &= ~0x2;
19657
19734
  }
19658
- // Push primitive.
19735
+ // Push primitive
19659
19736
  var material = this.getMaterial();
19660
19737
  var passes = material.shader.passes;
19661
19738
  var renderStates = material.renderStates;
@@ -19666,6 +19743,16 @@ SlicedSpriteAssembler = __decorate$1([
19666
19743
  context.camera._renderPipeline.pushPrimitive(spriteElement);
19667
19744
  }
19668
19745
  };
19746
+ _proto._calDefaultSize = function _calDefaultSize() {
19747
+ var sprite = this._sprite;
19748
+ if (sprite) {
19749
+ this._automaticWidth = sprite.width;
19750
+ this._automaticHeight = sprite.height;
19751
+ } else {
19752
+ this._automaticWidth = this._automaticHeight = 0;
19753
+ }
19754
+ this._dirtyUpdateFlag &= ~0x4;
19755
+ };
19669
19756
  _proto._updateStencilState = function _updateStencilState() {
19670
19757
  // Update stencil.
19671
19758
  var material = this.getInstanceMaterial();
@@ -19691,9 +19778,10 @@ SlicedSpriteAssembler = __decorate$1([
19691
19778
  this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
19692
19779
  break;
19693
19780
  case SpriteModifyFlags.size:
19781
+ this._dirtyUpdateFlag |= 0x4;
19694
19782
  // When the width and height of `SpriteRenderer` are `undefined`,
19695
19783
  // the `size` of `Sprite` will affect the position of `SpriteRenderer`.
19696
- if (this._drawMode === exports.SpriteDrawMode.Sliced || this._width === undefined || this._height === undefined) {
19784
+ if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
19697
19785
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19698
19786
  }
19699
19787
  break;
@@ -19747,9 +19835,9 @@ SlicedSpriteAssembler = __decorate$1([
19747
19835
  var lastSprite = this._sprite;
19748
19836
  if (lastSprite !== value) {
19749
19837
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
19838
+ this._dirtyUpdateFlag |= 0x7;
19750
19839
  if (value) {
19751
19840
  value._updateFlagManager.addListener(this._onSpriteChange);
19752
- this._dirtyUpdateFlag |= 0x3;
19753
19841
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
19754
19842
  } else {
19755
19843
  this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
@@ -19774,16 +19862,22 @@ SlicedSpriteAssembler = __decorate$1([
19774
19862
  {
19775
19863
  key: "width",
19776
19864
  get: /**
19777
- * Render width.
19865
+ * Render width (in world coordinates).
19866
+ *
19867
+ * @remarks
19868
+ * If width is set, return the set value,
19869
+ * otherwise return `SpriteRenderer.sprite.width`.
19778
19870
  */ function get() {
19779
- this._width === undefined && this._sprite && (this.width = this._sprite.width);
19780
- return this._width;
19871
+ if (this._customWidth !== undefined) {
19872
+ return this._customWidth;
19873
+ } else {
19874
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19875
+ return this._automaticWidth;
19876
+ }
19781
19877
  },
19782
19878
  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;
19879
+ if (this._customWidth !== value) {
19880
+ this._customWidth = value;
19787
19881
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19788
19882
  }
19789
19883
  }
@@ -19791,16 +19885,22 @@ SlicedSpriteAssembler = __decorate$1([
19791
19885
  {
19792
19886
  key: "height",
19793
19887
  get: /**
19794
- * Render height.
19888
+ * Render height (in world coordinates).
19889
+ *
19890
+ * @remarks
19891
+ * If height is set, return the set value,
19892
+ * otherwise return `SpriteRenderer.sprite.height`.
19795
19893
  */ function get() {
19796
- this._height === undefined && this._sprite && (this.height = this._sprite.height);
19797
- return this._height;
19894
+ if (this._customHeight !== undefined) {
19895
+ return this._customHeight;
19896
+ } else {
19897
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
19898
+ return this._automaticHeight;
19899
+ }
19798
19900
  },
19799
19901
  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;
19902
+ if (this._customHeight !== value) {
19903
+ this._customHeight = value;
19804
19904
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
19805
19905
  }
19806
19906
  }
@@ -19881,10 +19981,16 @@ __decorate$1([
19881
19981
  ], SpriteRenderer.prototype, "_sprite", void 0);
19882
19982
  __decorate$1([
19883
19983
  ignoreClone
19884
- ], SpriteRenderer.prototype, "_width", void 0);
19984
+ ], SpriteRenderer.prototype, "_automaticWidth", void 0);
19885
19985
  __decorate$1([
19886
19986
  ignoreClone
19887
- ], SpriteRenderer.prototype, "_height", void 0);
19987
+ ], SpriteRenderer.prototype, "_automaticHeight", void 0);
19988
+ __decorate$1([
19989
+ assignmentClone
19990
+ ], SpriteRenderer.prototype, "_customWidth", void 0);
19991
+ __decorate$1([
19992
+ assignmentClone
19993
+ ], SpriteRenderer.prototype, "_customHeight", void 0);
19888
19994
  __decorate$1([
19889
19995
  assignmentClone
19890
19996
  ], SpriteRenderer.prototype, "_flipX", void 0);
@@ -19905,7 +20011,9 @@ var /**
19905
20011
  */ SpriteRendererUpdateFlags;
19906
20012
  (function(SpriteRendererUpdateFlags) {
19907
20013
  SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
19908
- SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
20014
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
20015
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
20016
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
19909
20017
  })(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
19910
20018
  /**
19911
20019
  * @internal
@@ -28682,7 +28790,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
28682
28790
  var atlasItem = atlasItems[i];
28683
28791
  if (atlasItem.img) {
28684
28792
  chainPromises.push(resourceManager.load({
28685
- url: atlasItem.img,
28793
+ url: GLTFUtil.parseRelativeUrl(item.url, atlasItem.img),
28686
28794
  type: miniprogram$5.AssetType.Texture2D,
28687
28795
  params: {
28688
28796
  format: format,
@@ -28855,6 +28963,29 @@ TextureCubeLoader = __decorate([
28855
28963
  ""
28856
28964
  ])
28857
28965
  ], TextureCubeLoader);
28966
+ var AnimationClipLoader = /*#__PURE__*/ function(Loader) {
28967
+ var AnimationClipLoader = function AnimationClipLoader() {
28968
+ return Loader.apply(this, arguments);
28969
+ };
28970
+ _inherits$1(AnimationClipLoader, Loader);
28971
+ var _proto = AnimationClipLoader.prototype;
28972
+ _proto.load = function load(item, resourceManager) {
28973
+ var _this = this;
28974
+ return new miniprogram$5.AssetPromise(function(resolve, reject) {
28975
+ _this.request(item.url, _extends$1({}, item, {
28976
+ type: "arraybuffer"
28977
+ })).then(function(data) {
28978
+ return decode(data, resourceManager.engine).then(resolve);
28979
+ }).catch(reject);
28980
+ });
28981
+ };
28982
+ return AnimationClipLoader;
28983
+ }(miniprogram$5.Loader);
28984
+ AnimationClipLoader = __decorate([
28985
+ miniprogram$5.resourceLoader(miniprogram$5.AssetType.AnimationClip, [
28986
+ "ani"
28987
+ ])
28988
+ ], AnimationClipLoader);
28858
28989
  var SceneLoader = /*#__PURE__*/ function(Loader) {
28859
28990
  var SceneLoader = function SceneLoader() {
28860
28991
  return Loader.apply(this, arguments);
@@ -28923,6 +29054,14 @@ var SceneLoader = /*#__PURE__*/ function(Loader) {
28923
29054
  if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
28924
29055
  if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
28925
29056
  }
29057
+ var fog = data.scene.fog;
29058
+ if (fog) {
29059
+ if (fog.fogMode != undefined) scene.fogMode = fog.fogMode;
29060
+ if (fog.fogStart != undefined) scene.fogStart = fog.fogStart;
29061
+ if (fog.fogEnd != undefined) scene.fogEnd = fog.fogEnd;
29062
+ if (fog.fogDensity != undefined) scene.fogDensity = fog.fogDensity;
29063
+ if (fog.fogColor != undefined) scene.fogColor.copyFrom(fog.fogColor);
29064
+ }
28926
29065
  return Promise.all([
28927
29066
  ambientLightPromise,
28928
29067
  backgroundPromise
@@ -35721,7 +35860,7 @@ function _interopNamespace(e) {
35721
35860
  }
35722
35861
  var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
35723
35862
  //@ts-ignore
35724
- var version = "0.9.6";
35863
+ var version = "0.9.8";
35725
35864
  console.log("Galacean engine version: " + version);
35726
35865
  for(var key in CoreObjects__namespace){
35727
35866
  CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);