@galacean/engine 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.
package/dist/browser.js CHANGED
@@ -15116,8 +15116,10 @@
15116
15116
  _this = Renderer.call(this, entity) || this;
15117
15117
  /** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
15118
15118
  _this._sprite = null;
15119
- _this._width = undefined;
15120
- _this._height = undefined;
15119
+ _this._automaticWidth = 0;
15120
+ _this._automaticHeight = 0;
15121
+ _this._customWidth = undefined;
15122
+ _this._customHeight = undefined;
15121
15123
  _this._flipX = false;
15122
15124
  _this._flipY = false;
15123
15125
  _this._alphaCutoff = 0.5;
@@ -15147,12 +15149,11 @@
15147
15149
  /**
15148
15150
  * @override
15149
15151
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
15150
- var _this_sprite;
15151
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
15152
+ if (this.sprite) {
15153
+ SimpleSpriteAssembler.updatePositions(this);
15154
+ } else {
15152
15155
  worldBounds.min.set(0, 0, 0);
15153
15156
  worldBounds.max.set(0, 0, 0);
15154
- } else {
15155
- SimpleSpriteAssembler.updatePositions(this);
15156
15157
  }
15157
15158
  };
15158
15159
  /**
@@ -15163,12 +15164,12 @@
15163
15164
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
15164
15165
  return;
15165
15166
  }
15166
- // Update position.
15167
+ // Update position
15167
15168
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
15168
15169
  SimpleSpriteAssembler.updatePositions(this);
15169
15170
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
15170
15171
  }
15171
- // Update uv.
15172
+ // Update uv
15172
15173
  if (this._dirtyUpdateFlag & 0x2) {
15173
15174
  SimpleSpriteAssembler.updateUVs(this);
15174
15175
  this._dirtyUpdateFlag &= ~0x2;
@@ -15179,11 +15180,27 @@
15179
15180
  context.camera._renderPipeline._allSpriteMasks.add(this);
15180
15181
  this._maskElement = maskElement;
15181
15182
  };
15183
+ _proto._calDefaultSize = function _calDefaultSize() {
15184
+ var sprite = this._sprite;
15185
+ if (sprite) {
15186
+ this._automaticWidth = sprite.width;
15187
+ this._automaticHeight = sprite.height;
15188
+ } else {
15189
+ this._automaticWidth = this._automaticHeight = 0;
15190
+ }
15191
+ this._dirtyUpdateFlag &= ~0x4;
15192
+ };
15182
15193
  _proto._onSpriteChange = function _onSpriteChange(type) {
15183
15194
  switch(type){
15184
15195
  case SpriteModifyFlags.texture:
15185
15196
  this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
15186
15197
  break;
15198
+ case SpriteModifyFlags.size:
15199
+ this._dirtyUpdateFlag |= 0x4;
15200
+ if (this._customWidth === undefined || this._customHeight === undefined) {
15201
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15202
+ }
15203
+ break;
15187
15204
  case SpriteModifyFlags.region:
15188
15205
  case SpriteModifyFlags.atlasRegionOffset:
15189
15206
  this._dirtyUpdateFlag |= 0x3;
@@ -15191,22 +15208,31 @@
15191
15208
  case SpriteModifyFlags.atlasRegion:
15192
15209
  this._dirtyUpdateFlag |= 0x2;
15193
15210
  break;
15211
+ case SpriteModifyFlags.pivot:
15212
+ this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15213
+ break;
15194
15214
  }
15195
15215
  };
15196
15216
  _create_class$3(SpriteMask, [
15197
15217
  {
15198
15218
  key: "width",
15199
15219
  get: /**
15200
- * Render width.
15220
+ * Render width (in world coordinates).
15221
+ *
15222
+ * @remarks
15223
+ * If width is set, return the set value,
15224
+ * otherwise return `SpriteMask.sprite.width`.
15201
15225
  */ function get() {
15202
- if (this._width === undefined && this._sprite) {
15203
- this.width = this._sprite.width;
15226
+ if (this._customWidth !== undefined) {
15227
+ return this._customWidth;
15228
+ } else {
15229
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
15230
+ return this._automaticWidth;
15204
15231
  }
15205
- return this._width;
15206
15232
  },
15207
15233
  set: function set(value) {
15208
- if (this._width !== value) {
15209
- this._width = value;
15234
+ if (this._customWidth !== value) {
15235
+ this._customWidth = value;
15210
15236
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15211
15237
  }
15212
15238
  }
@@ -15214,16 +15240,22 @@
15214
15240
  {
15215
15241
  key: "height",
15216
15242
  get: /**
15217
- * Render height.
15243
+ * Render height (in world coordinates).
15244
+ *
15245
+ * @remarks
15246
+ * If height is set, return the set value,
15247
+ * otherwise return `SpriteMask.sprite.height`.
15218
15248
  */ function get() {
15219
- if (this._height === undefined && this._sprite) {
15220
- this.height = this._sprite.height;
15249
+ if (this._customHeight !== undefined) {
15250
+ return this._customHeight;
15251
+ } else {
15252
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
15253
+ return this._automaticHeight;
15221
15254
  }
15222
- return this._height;
15223
15255
  },
15224
15256
  set: function set(value) {
15225
- if (this._height !== value) {
15226
- this._height = value;
15257
+ if (this._customHeight !== value) {
15258
+ this._customHeight = value;
15227
15259
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
15228
15260
  }
15229
15261
  }
@@ -15267,9 +15299,9 @@
15267
15299
  var lastSprite = this._sprite;
15268
15300
  if (lastSprite !== value) {
15269
15301
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
15302
+ this._dirtyUpdateFlag |= 0x7;
15270
15303
  if (value) {
15271
15304
  value._updateFlagManager.addListener(this._onSpriteChange);
15272
- this._dirtyUpdateFlag |= 0x3;
15273
15305
  this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
15274
15306
  } else {
15275
15307
  this.shaderData.setTexture(SpriteMask._textureProperty, null);
@@ -15309,10 +15341,16 @@
15309
15341
  ], SpriteMask.prototype, "_sprite", void 0);
15310
15342
  __decorate$1([
15311
15343
  ignoreClone
15312
- ], SpriteMask.prototype, "_width", void 0);
15344
+ ], SpriteMask.prototype, "_automaticWidth", void 0);
15313
15345
  __decorate$1([
15314
15346
  ignoreClone
15315
- ], SpriteMask.prototype, "_height", void 0);
15347
+ ], SpriteMask.prototype, "_automaticHeight", void 0);
15348
+ __decorate$1([
15349
+ assignmentClone
15350
+ ], SpriteMask.prototype, "_customWidth", void 0);
15351
+ __decorate$1([
15352
+ assignmentClone
15353
+ ], SpriteMask.prototype, "_customHeight", void 0);
15316
15354
  __decorate$1([
15317
15355
  assignmentClone
15318
15356
  ], SpriteMask.prototype, "_flipX", void 0);
@@ -15330,7 +15368,9 @@
15330
15368
  */ SpriteMaskUpdateFlags;
15331
15369
  (function(SpriteMaskUpdateFlags) {
15332
15370
  SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
15333
- SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x3] = "All";
15371
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
15372
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
15373
+ SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
15334
15374
  })(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
15335
15375
  /**
15336
15376
  * Vertex element format.
@@ -19007,7 +19047,7 @@
19007
19047
  // vertices
19008
19048
  this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
19009
19049
  // indices
19010
- this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
19050
+ this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
19011
19051
  mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
19012
19052
  mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
19013
19053
  mesh.setVertexElements(vertexElements);
@@ -23890,8 +23930,10 @@
23890
23930
  if (name === void 0) name = null;
23891
23931
  var _this;
23892
23932
  _this = RefObject.call(this, engine) || this;
23893
- _this._width = undefined;
23894
- _this._height = undefined;
23933
+ _this._automaticWidth = 0;
23934
+ _this._automaticHeight = 0;
23935
+ _this._customWidth = undefined;
23936
+ _this._customHeight = undefined;
23895
23937
  _this._positions = [
23896
23938
  new Vector2(),
23897
23939
  new Vector2(),
@@ -23912,7 +23954,7 @@
23912
23954
  _this._region = new Rect(0, 0, 1, 1);
23913
23955
  _this._pivot = new Vector2(0.5, 0.5);
23914
23956
  _this._border = new Vector4(0, 0, 0, 0);
23915
- _this._dirtyUpdateFlag = 0x3;
23957
+ _this._dirtyUpdateFlag = 0x7;
23916
23958
  /** @internal */ _this._updateFlagManager = new UpdateFlagManager();
23917
23959
  _this._texture = texture;
23918
23960
  region && _this._region.copyFrom(region);
@@ -23962,9 +24004,12 @@
23962
24004
  if (this._texture) {
23963
24005
  var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
23964
24006
  var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
23965
- this._width = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
23966
- this._height = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
24007
+ this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
24008
+ this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
24009
+ } else {
24010
+ this._automaticWidth = this._automaticHeight = 0;
23967
24011
  }
24012
+ this._dirtyUpdateFlag &= ~0x4;
23968
24013
  };
23969
24014
  _proto._updatePositions = function _updatePositions() {
23970
24015
  var blank = this._atlasRegionOffset;
@@ -24018,11 +24063,16 @@
24018
24063
  };
24019
24064
  _proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
24020
24065
  switch(type){
24066
+ case SpriteModifyFlags.texture:
24067
+ this._dirtyUpdateFlag |= 0x4;
24068
+ break;
24021
24069
  case SpriteModifyFlags.atlasRegionOffset:
24022
24070
  case SpriteModifyFlags.region:
24023
- this._dirtyUpdateFlag |= 0x3;
24071
+ this._dirtyUpdateFlag |= 0x7;
24024
24072
  break;
24025
24073
  case SpriteModifyFlags.atlasRegion:
24074
+ this._dirtyUpdateFlag |= 0x4 | 0x2;
24075
+ break;
24026
24076
  case SpriteModifyFlags.border:
24027
24077
  this._dirtyUpdateFlag |= 0x2;
24028
24078
  break;
@@ -24041,7 +24091,9 @@
24041
24091
  if (this._texture !== value) {
24042
24092
  this._texture = value;
24043
24093
  this._dispatchSpriteChange(SpriteModifyFlags.texture);
24044
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24094
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24095
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24096
+ }
24045
24097
  }
24046
24098
  }
24047
24099
  },
@@ -24049,13 +24101,21 @@
24049
24101
  key: "width",
24050
24102
  get: /**
24051
24103
  * The width of the sprite (in world coordinates).
24104
+ *
24105
+ * @remarks
24106
+ * If width is set, return the set value,
24107
+ * otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
24052
24108
  */ function get() {
24053
- this._width === undefined && this._calDefaultSize();
24054
- return this._width;
24109
+ if (this._customWidth !== undefined) {
24110
+ return this._customWidth;
24111
+ } else {
24112
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24113
+ return this._automaticWidth;
24114
+ }
24055
24115
  },
24056
24116
  set: function set(value) {
24057
- if (this._width !== value) {
24058
- this._width = value;
24117
+ if (this._customWidth !== value) {
24118
+ this._customWidth = value;
24059
24119
  this._dispatchSpriteChange(SpriteModifyFlags.size);
24060
24120
  }
24061
24121
  }
@@ -24064,13 +24124,21 @@
24064
24124
  key: "height",
24065
24125
  get: /**
24066
24126
  * The height of the sprite (in world coordinates).
24127
+ *
24128
+ * @remarks
24129
+ * If height is set, return the set value,
24130
+ * otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
24067
24131
  */ function get() {
24068
- this._height === undefined && this._calDefaultSize();
24069
- return this._height;
24132
+ if (this._customHeight !== undefined) {
24133
+ return this._customHeight;
24134
+ } else {
24135
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24136
+ return this._automaticHeight;
24137
+ }
24070
24138
  },
24071
24139
  set: function set(value) {
24072
- if (this._height !== value) {
24073
- this._height = value;
24140
+ if (this._customHeight !== value) {
24141
+ this._customHeight = value;
24074
24142
  this._dispatchSpriteChange(SpriteModifyFlags.size);
24075
24143
  }
24076
24144
  }
@@ -24100,7 +24168,9 @@
24100
24168
  var y = MathUtil$1.clamp(value.y, 0, 1);
24101
24169
  this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
24102
24170
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
24103
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24171
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24172
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24173
+ }
24104
24174
  }
24105
24175
  },
24106
24176
  {
@@ -24115,7 +24185,9 @@
24115
24185
  var y = MathUtil$1.clamp(value.y, 0, 1);
24116
24186
  this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
24117
24187
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
24118
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24188
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24189
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24190
+ }
24119
24191
  }
24120
24192
  },
24121
24193
  {
@@ -24131,7 +24203,9 @@
24131
24203
  var y = MathUtil$1.clamp(value.y, 0, 1);
24132
24204
  region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
24133
24205
  this._dispatchSpriteChange(SpriteModifyFlags.region);
24134
- (this._width === undefined || this._height === undefined) && this._dispatchSpriteChange(SpriteModifyFlags.size);
24206
+ if (this._customWidth === undefined || this._customHeight === undefined) {
24207
+ this._dispatchSpriteChange(SpriteModifyFlags.size);
24208
+ }
24135
24209
  }
24136
24210
  },
24137
24211
  {
@@ -24181,7 +24255,8 @@
24181
24255
  (function(SpriteUpdateFlags) {
24182
24256
  SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
24183
24257
  SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
24184
- SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x3] = "all";
24258
+ SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
24259
+ SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
24185
24260
  })(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
24186
24261
  var _SlicedSpriteAssembler;
24187
24262
  var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
@@ -24331,8 +24406,10 @@
24331
24406
  _this = Renderer.call(this, entity) || this;
24332
24407
  _this._color = new Color$1(1, 1, 1, 1);
24333
24408
  _this._sprite = null;
24334
- _this._width = undefined;
24335
- _this._height = undefined;
24409
+ _this._automaticWidth = 0;
24410
+ _this._automaticHeight = 0;
24411
+ _this._customWidth = undefined;
24412
+ _this._customHeight = undefined;
24336
24413
  _this._flipX = false;
24337
24414
  _this._flipY = false;
24338
24415
  _this._maskLayer = exports.SpriteMaskLayer.Layer0;
@@ -24349,6 +24426,7 @@
24349
24426
  * @internal
24350
24427
  */ _proto._cloneTo = function _cloneTo(target) {
24351
24428
  target.sprite = this._sprite;
24429
+ target.drawMode = this._drawMode;
24352
24430
  };
24353
24431
  /**
24354
24432
  * @internal
@@ -24364,12 +24442,11 @@
24364
24442
  /**
24365
24443
  * @override
24366
24444
  */ _proto._updateBounds = function _updateBounds(worldBounds) {
24367
- var _this_sprite;
24368
- if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
24445
+ if (this.sprite) {
24446
+ this._assembler.updatePositions(this);
24447
+ } else {
24369
24448
  worldBounds.min.set(0, 0, 0);
24370
24449
  worldBounds.max.set(0, 0, 0);
24371
- } else {
24372
- this._assembler.updatePositions(this);
24373
24450
  }
24374
24451
  };
24375
24452
  /**
@@ -24379,17 +24456,17 @@
24379
24456
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
24380
24457
  return;
24381
24458
  }
24382
- // Update position.
24459
+ // Update position
24383
24460
  if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
24384
24461
  this._assembler.updatePositions(this);
24385
24462
  this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
24386
24463
  }
24387
- // Update uv.
24464
+ // Update uv
24388
24465
  if (this._dirtyUpdateFlag & 0x2) {
24389
24466
  this._assembler.updateUVs(this);
24390
24467
  this._dirtyUpdateFlag &= ~0x2;
24391
24468
  }
24392
- // Push primitive.
24469
+ // Push primitive
24393
24470
  var material = this.getMaterial();
24394
24471
  var passes = material.shader.passes;
24395
24472
  var renderStates = material.renderStates;
@@ -24400,6 +24477,16 @@
24400
24477
  context.camera._renderPipeline.pushPrimitive(spriteElement);
24401
24478
  }
24402
24479
  };
24480
+ _proto._calDefaultSize = function _calDefaultSize() {
24481
+ var sprite = this._sprite;
24482
+ if (sprite) {
24483
+ this._automaticWidth = sprite.width;
24484
+ this._automaticHeight = sprite.height;
24485
+ } else {
24486
+ this._automaticWidth = this._automaticHeight = 0;
24487
+ }
24488
+ this._dirtyUpdateFlag &= ~0x4;
24489
+ };
24403
24490
  _proto._updateStencilState = function _updateStencilState() {
24404
24491
  // Update stencil.
24405
24492
  var material = this.getInstanceMaterial();
@@ -24425,9 +24512,10 @@
24425
24512
  this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
24426
24513
  break;
24427
24514
  case SpriteModifyFlags.size:
24515
+ this._dirtyUpdateFlag |= 0x4;
24428
24516
  // When the width and height of `SpriteRenderer` are `undefined`,
24429
24517
  // the `size` of `Sprite` will affect the position of `SpriteRenderer`.
24430
- if (this._drawMode === exports.SpriteDrawMode.Sliced || this._width === undefined || this._height === undefined) {
24518
+ if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
24431
24519
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
24432
24520
  }
24433
24521
  break;
@@ -24481,9 +24569,9 @@
24481
24569
  var lastSprite = this._sprite;
24482
24570
  if (lastSprite !== value) {
24483
24571
  lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
24572
+ this._dirtyUpdateFlag |= 0x7;
24484
24573
  if (value) {
24485
24574
  value._updateFlagManager.addListener(this._onSpriteChange);
24486
- this._dirtyUpdateFlag |= 0x3;
24487
24575
  this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
24488
24576
  } else {
24489
24577
  this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
@@ -24508,16 +24596,22 @@
24508
24596
  {
24509
24597
  key: "width",
24510
24598
  get: /**
24511
- * Render width.
24599
+ * Render width (in world coordinates).
24600
+ *
24601
+ * @remarks
24602
+ * If width is set, return the set value,
24603
+ * otherwise return `SpriteRenderer.sprite.width`.
24512
24604
  */ function get() {
24513
- this._width === undefined && this._sprite && (this.width = this._sprite.width);
24514
- return this._width;
24605
+ if (this._customWidth !== undefined) {
24606
+ return this._customWidth;
24607
+ } else {
24608
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24609
+ return this._automaticWidth;
24610
+ }
24515
24611
  },
24516
24612
  set: function set(value) {
24517
- // Update width if undefined
24518
- this._width === undefined && this._sprite && (this._width = this._sprite.width);
24519
- if (this._width !== value) {
24520
- this._width = value;
24613
+ if (this._customWidth !== value) {
24614
+ this._customWidth = value;
24521
24615
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
24522
24616
  }
24523
24617
  }
@@ -24525,16 +24619,22 @@
24525
24619
  {
24526
24620
  key: "height",
24527
24621
  get: /**
24528
- * Render height.
24622
+ * Render height (in world coordinates).
24623
+ *
24624
+ * @remarks
24625
+ * If height is set, return the set value,
24626
+ * otherwise return `SpriteRenderer.sprite.height`.
24529
24627
  */ function get() {
24530
- this._height === undefined && this._sprite && (this.height = this._sprite.height);
24531
- return this._height;
24628
+ if (this._customHeight !== undefined) {
24629
+ return this._customHeight;
24630
+ } else {
24631
+ this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
24632
+ return this._automaticHeight;
24633
+ }
24532
24634
  },
24533
24635
  set: function set(value) {
24534
- // Update height if undefined
24535
- this._height === undefined && this._sprite && (this._height = this._sprite.height);
24536
- if (this._height !== value) {
24537
- this._height = value;
24636
+ if (this._customHeight !== value) {
24637
+ this._customHeight = value;
24538
24638
  this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
24539
24639
  }
24540
24640
  }
@@ -24615,10 +24715,16 @@
24615
24715
  ], SpriteRenderer.prototype, "_sprite", void 0);
24616
24716
  __decorate$1([
24617
24717
  ignoreClone
24618
- ], SpriteRenderer.prototype, "_width", void 0);
24718
+ ], SpriteRenderer.prototype, "_automaticWidth", void 0);
24619
24719
  __decorate$1([
24620
24720
  ignoreClone
24621
- ], SpriteRenderer.prototype, "_height", void 0);
24721
+ ], SpriteRenderer.prototype, "_automaticHeight", void 0);
24722
+ __decorate$1([
24723
+ assignmentClone
24724
+ ], SpriteRenderer.prototype, "_customWidth", void 0);
24725
+ __decorate$1([
24726
+ assignmentClone
24727
+ ], SpriteRenderer.prototype, "_customHeight", void 0);
24622
24728
  __decorate$1([
24623
24729
  assignmentClone
24624
24730
  ], SpriteRenderer.prototype, "_flipX", void 0);
@@ -24639,7 +24745,9 @@
24639
24745
  */ SpriteRendererUpdateFlags;
24640
24746
  (function(SpriteRendererUpdateFlags) {
24641
24747
  SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
24642
- SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
24748
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
24749
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
24750
+ SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
24643
24751
  })(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
24644
24752
  /**
24645
24753
  * @internal
@@ -35573,7 +35681,7 @@
35573
35681
  var atlasItem = atlasItems[i];
35574
35682
  if (atlasItem.img) {
35575
35683
  chainPromises.push(resourceManager.load({
35576
- url: atlasItem.img,
35684
+ url: GLTFUtil.parseRelativeUrl(item.url, atlasItem.img),
35577
35685
  type: exports.AssetType.Texture2D,
35578
35686
  params: {
35579
35687
  format: format,
@@ -35746,6 +35854,29 @@
35746
35854
  ""
35747
35855
  ])
35748
35856
  ], TextureCubeLoader);
35857
+ var AnimationClipLoader = /*#__PURE__*/ function(Loader) {
35858
+ var AnimationClipLoader = function AnimationClipLoader() {
35859
+ return Loader.apply(this, arguments);
35860
+ };
35861
+ _inherits(AnimationClipLoader, Loader);
35862
+ var _proto = AnimationClipLoader.prototype;
35863
+ _proto.load = function load(item, resourceManager) {
35864
+ var _this = this;
35865
+ return new AssetPromise(function(resolve, reject) {
35866
+ _this.request(item.url, _extends({}, item, {
35867
+ type: "arraybuffer"
35868
+ })).then(function(data) {
35869
+ return decode(data, resourceManager.engine).then(resolve);
35870
+ }).catch(reject);
35871
+ });
35872
+ };
35873
+ return AnimationClipLoader;
35874
+ }(Loader);
35875
+ AnimationClipLoader = __decorate([
35876
+ resourceLoader(exports.AssetType.AnimationClip, [
35877
+ "ani"
35878
+ ])
35879
+ ], AnimationClipLoader);
35749
35880
  var SceneLoader = /*#__PURE__*/ function(Loader) {
35750
35881
  var SceneLoader = function SceneLoader() {
35751
35882
  return Loader.apply(this, arguments);
@@ -35814,6 +35945,14 @@
35814
35945
  if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
35815
35946
  if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
35816
35947
  }
35948
+ var fog = data.scene.fog;
35949
+ if (fog) {
35950
+ if (fog.fogMode != undefined) scene.fogMode = fog.fogMode;
35951
+ if (fog.fogStart != undefined) scene.fogStart = fog.fogStart;
35952
+ if (fog.fogEnd != undefined) scene.fogEnd = fog.fogEnd;
35953
+ if (fog.fogDensity != undefined) scene.fogDensity = fog.fogDensity;
35954
+ if (fog.fogColor != undefined) scene.fogColor.copyFrom(fog.fogColor);
35955
+ }
35817
35956
  return Promise.all([
35818
35957
  ambientLightPromise,
35819
35958
  backgroundPromise
@@ -35847,7 +35986,7 @@
35847
35986
  }));
35848
35987
 
35849
35988
  //@ts-ignore
35850
- var version = "0.9.6";
35989
+ var version = "0.9.8";
35851
35990
  console.log("Galacean engine version: " + version);
35852
35991
  for(var key in CoreObjects){
35853
35992
  Loader.registerClass(key, CoreObjects[key]);