@galacean/engine-core 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/main.js +180 -72
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +180 -72
- package/dist/module.js +180 -72
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/sprite/Sprite.d.ts +12 -2
- package/types/2d/sprite/SpriteMask.d.ts +15 -4
- package/types/2d/sprite/SpriteRenderer.d.ts +15 -4
package/dist/module.js
CHANGED
|
@@ -10485,8 +10485,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10485
10485
|
_this = Renderer.call(this, entity) || this;
|
|
10486
10486
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = SpriteMaskLayer.Everything;
|
|
10487
10487
|
_this._sprite = null;
|
|
10488
|
-
_this.
|
|
10489
|
-
_this.
|
|
10488
|
+
_this._automaticWidth = 0;
|
|
10489
|
+
_this._automaticHeight = 0;
|
|
10490
|
+
_this._customWidth = undefined;
|
|
10491
|
+
_this._customHeight = undefined;
|
|
10490
10492
|
_this._flipX = false;
|
|
10491
10493
|
_this._flipY = false;
|
|
10492
10494
|
_this._alphaCutoff = 0.5;
|
|
@@ -10516,12 +10518,11 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10516
10518
|
/**
|
|
10517
10519
|
* @override
|
|
10518
10520
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
+
if (this.sprite) {
|
|
10522
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
10523
|
+
} else {
|
|
10521
10524
|
worldBounds.min.set(0, 0, 0);
|
|
10522
10525
|
worldBounds.max.set(0, 0, 0);
|
|
10523
|
-
} else {
|
|
10524
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
10525
10526
|
}
|
|
10526
10527
|
};
|
|
10527
10528
|
/**
|
|
@@ -10532,12 +10533,12 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10532
10533
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
10533
10534
|
return;
|
|
10534
10535
|
}
|
|
10535
|
-
// Update position
|
|
10536
|
+
// Update position
|
|
10536
10537
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
10537
10538
|
SimpleSpriteAssembler.updatePositions(this);
|
|
10538
10539
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
10539
10540
|
}
|
|
10540
|
-
// Update uv
|
|
10541
|
+
// Update uv
|
|
10541
10542
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
10542
10543
|
SimpleSpriteAssembler.updateUVs(this);
|
|
10543
10544
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -10548,11 +10549,27 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10548
10549
|
context.camera._renderPipeline._allSpriteMasks.add(this);
|
|
10549
10550
|
this._maskElement = maskElement;
|
|
10550
10551
|
};
|
|
10552
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
10553
|
+
var sprite = this._sprite;
|
|
10554
|
+
if (sprite) {
|
|
10555
|
+
this._automaticWidth = sprite.width;
|
|
10556
|
+
this._automaticHeight = sprite.height;
|
|
10557
|
+
} else {
|
|
10558
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
10559
|
+
}
|
|
10560
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
10561
|
+
};
|
|
10551
10562
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
10552
10563
|
switch(type){
|
|
10553
10564
|
case SpriteModifyFlags.texture:
|
|
10554
10565
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
10555
10566
|
break;
|
|
10567
|
+
case SpriteModifyFlags.size:
|
|
10568
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
10569
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
10570
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10571
|
+
}
|
|
10572
|
+
break;
|
|
10556
10573
|
case SpriteModifyFlags.region:
|
|
10557
10574
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
10558
10575
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -10560,22 +10577,31 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10560
10577
|
case SpriteModifyFlags.atlasRegion:
|
|
10561
10578
|
this._dirtyUpdateFlag |= 0x2;
|
|
10562
10579
|
break;
|
|
10580
|
+
case SpriteModifyFlags.pivot:
|
|
10581
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10582
|
+
break;
|
|
10563
10583
|
}
|
|
10564
10584
|
};
|
|
10565
10585
|
_create_class(SpriteMask, [
|
|
10566
10586
|
{
|
|
10567
10587
|
key: "width",
|
|
10568
10588
|
get: /**
|
|
10569
|
-
* Render width.
|
|
10589
|
+
* Render width (in world coordinates).
|
|
10590
|
+
*
|
|
10591
|
+
* @remarks
|
|
10592
|
+
* If width is set, return the set value,
|
|
10593
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
10570
10594
|
*/ function get() {
|
|
10571
|
-
if (this.
|
|
10572
|
-
|
|
10595
|
+
if (this._customWidth !== undefined) {
|
|
10596
|
+
return this._customWidth;
|
|
10597
|
+
} else {
|
|
10598
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10599
|
+
return this._automaticWidth;
|
|
10573
10600
|
}
|
|
10574
|
-
return this._width;
|
|
10575
10601
|
},
|
|
10576
10602
|
set: function set(value) {
|
|
10577
|
-
if (this.
|
|
10578
|
-
this.
|
|
10603
|
+
if (this._customWidth !== value) {
|
|
10604
|
+
this._customWidth = value;
|
|
10579
10605
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10580
10606
|
}
|
|
10581
10607
|
}
|
|
@@ -10583,16 +10609,22 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10583
10609
|
{
|
|
10584
10610
|
key: "height",
|
|
10585
10611
|
get: /**
|
|
10586
|
-
* Render height.
|
|
10612
|
+
* Render height (in world coordinates).
|
|
10613
|
+
*
|
|
10614
|
+
* @remarks
|
|
10615
|
+
* If height is set, return the set value,
|
|
10616
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
10587
10617
|
*/ function get() {
|
|
10588
|
-
if (this.
|
|
10589
|
-
|
|
10618
|
+
if (this._customHeight !== undefined) {
|
|
10619
|
+
return this._customHeight;
|
|
10620
|
+
} else {
|
|
10621
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10622
|
+
return this._automaticHeight;
|
|
10590
10623
|
}
|
|
10591
|
-
return this._height;
|
|
10592
10624
|
},
|
|
10593
10625
|
set: function set(value) {
|
|
10594
|
-
if (this.
|
|
10595
|
-
this.
|
|
10626
|
+
if (this._customHeight !== value) {
|
|
10627
|
+
this._customHeight = value;
|
|
10596
10628
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10597
10629
|
}
|
|
10598
10630
|
}
|
|
@@ -10636,9 +10668,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10636
10668
|
var lastSprite = this._sprite;
|
|
10637
10669
|
if (lastSprite !== value) {
|
|
10638
10670
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10671
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
10639
10672
|
if (value) {
|
|
10640
10673
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
10641
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
10642
10674
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
10643
10675
|
} else {
|
|
10644
10676
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -10678,10 +10710,16 @@ __decorate([
|
|
|
10678
10710
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
10679
10711
|
__decorate([
|
|
10680
10712
|
ignoreClone
|
|
10681
|
-
], SpriteMask.prototype, "
|
|
10713
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
10682
10714
|
__decorate([
|
|
10683
10715
|
ignoreClone
|
|
10684
|
-
], SpriteMask.prototype, "
|
|
10716
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
10717
|
+
__decorate([
|
|
10718
|
+
assignmentClone
|
|
10719
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
10720
|
+
__decorate([
|
|
10721
|
+
assignmentClone
|
|
10722
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
10685
10723
|
__decorate([
|
|
10686
10724
|
assignmentClone
|
|
10687
10725
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -10699,7 +10737,9 @@ var /**
|
|
|
10699
10737
|
*/ SpriteMaskUpdateFlags;
|
|
10700
10738
|
(function(SpriteMaskUpdateFlags) {
|
|
10701
10739
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
10702
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
10740
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
10741
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
10742
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
10703
10743
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
10704
10744
|
|
|
10705
10745
|
/**
|
|
@@ -14407,7 +14447,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
14407
14447
|
// vertices
|
|
14408
14448
|
this._vertexBuffers[index] = new Buffer(engine, BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, BufferUsage.Dynamic);
|
|
14409
14449
|
// indices
|
|
14410
|
-
this._indiceBuffers[index] = new Buffer(engine, BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, BufferUsage.Dynamic);
|
|
14450
|
+
this._indiceBuffers[index] = new Buffer(engine, BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, BufferUsage.Dynamic);
|
|
14411
14451
|
mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
|
|
14412
14452
|
mesh.setIndexBufferBinding(this._indiceBuffers[index], IndexFormat.UInt16);
|
|
14413
14453
|
mesh.setVertexElements(vertexElements);
|
|
@@ -19354,8 +19394,10 @@ var TextVerticalAlignment;
|
|
|
19354
19394
|
if (name === void 0) name = null;
|
|
19355
19395
|
var _this;
|
|
19356
19396
|
_this = RefObject.call(this, engine) || this;
|
|
19357
|
-
_this.
|
|
19358
|
-
_this.
|
|
19397
|
+
_this._automaticWidth = 0;
|
|
19398
|
+
_this._automaticHeight = 0;
|
|
19399
|
+
_this._customWidth = undefined;
|
|
19400
|
+
_this._customHeight = undefined;
|
|
19359
19401
|
_this._positions = [
|
|
19360
19402
|
new Vector2(),
|
|
19361
19403
|
new Vector2(),
|
|
@@ -19376,7 +19418,7 @@ var TextVerticalAlignment;
|
|
|
19376
19418
|
_this._region = new Rect(0, 0, 1, 1);
|
|
19377
19419
|
_this._pivot = new Vector2(0.5, 0.5);
|
|
19378
19420
|
_this._border = new Vector4(0, 0, 0, 0);
|
|
19379
|
-
_this._dirtyUpdateFlag =
|
|
19421
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
19380
19422
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
19381
19423
|
_this._texture = texture;
|
|
19382
19424
|
region && _this._region.copyFrom(region);
|
|
@@ -19425,9 +19467,12 @@ var TextVerticalAlignment;
|
|
|
19425
19467
|
if (this._texture) {
|
|
19426
19468
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
19427
19469
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
19428
|
-
this.
|
|
19429
|
-
this.
|
|
19470
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
19471
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
19472
|
+
} else {
|
|
19473
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19430
19474
|
}
|
|
19475
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19431
19476
|
};
|
|
19432
19477
|
_proto._updatePositions = function _updatePositions() {
|
|
19433
19478
|
var blank = this._atlasRegionOffset;
|
|
@@ -19481,11 +19526,16 @@ var TextVerticalAlignment;
|
|
|
19481
19526
|
};
|
|
19482
19527
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
19483
19528
|
switch(type){
|
|
19529
|
+
case SpriteModifyFlags.texture:
|
|
19530
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19531
|
+
break;
|
|
19484
19532
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
19485
19533
|
case SpriteModifyFlags.region:
|
|
19486
|
-
this._dirtyUpdateFlag |=
|
|
19534
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19487
19535
|
break;
|
|
19488
19536
|
case SpriteModifyFlags.atlasRegion:
|
|
19537
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
19538
|
+
break;
|
|
19489
19539
|
case SpriteModifyFlags.border:
|
|
19490
19540
|
this._dirtyUpdateFlag |= 0x2;
|
|
19491
19541
|
break;
|
|
@@ -19504,7 +19554,9 @@ var TextVerticalAlignment;
|
|
|
19504
19554
|
if (this._texture !== value) {
|
|
19505
19555
|
this._texture = value;
|
|
19506
19556
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
19507
|
-
(this.
|
|
19557
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19558
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19559
|
+
}
|
|
19508
19560
|
}
|
|
19509
19561
|
}
|
|
19510
19562
|
},
|
|
@@ -19512,13 +19564,21 @@ var TextVerticalAlignment;
|
|
|
19512
19564
|
key: "width",
|
|
19513
19565
|
get: /**
|
|
19514
19566
|
* The width of the sprite (in world coordinates).
|
|
19567
|
+
*
|
|
19568
|
+
* @remarks
|
|
19569
|
+
* If width is set, return the set value,
|
|
19570
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19515
19571
|
*/ function get() {
|
|
19516
|
-
this.
|
|
19517
|
-
|
|
19572
|
+
if (this._customWidth !== undefined) {
|
|
19573
|
+
return this._customWidth;
|
|
19574
|
+
} else {
|
|
19575
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19576
|
+
return this._automaticWidth;
|
|
19577
|
+
}
|
|
19518
19578
|
},
|
|
19519
19579
|
set: function set(value) {
|
|
19520
|
-
if (this.
|
|
19521
|
-
this.
|
|
19580
|
+
if (this._customWidth !== value) {
|
|
19581
|
+
this._customWidth = value;
|
|
19522
19582
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19523
19583
|
}
|
|
19524
19584
|
}
|
|
@@ -19527,13 +19587,21 @@ var TextVerticalAlignment;
|
|
|
19527
19587
|
key: "height",
|
|
19528
19588
|
get: /**
|
|
19529
19589
|
* The height of the sprite (in world coordinates).
|
|
19590
|
+
*
|
|
19591
|
+
* @remarks
|
|
19592
|
+
* If height is set, return the set value,
|
|
19593
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19530
19594
|
*/ function get() {
|
|
19531
|
-
this.
|
|
19532
|
-
|
|
19595
|
+
if (this._customHeight !== undefined) {
|
|
19596
|
+
return this._customHeight;
|
|
19597
|
+
} else {
|
|
19598
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19599
|
+
return this._automaticHeight;
|
|
19600
|
+
}
|
|
19533
19601
|
},
|
|
19534
19602
|
set: function set(value) {
|
|
19535
|
-
if (this.
|
|
19536
|
-
this.
|
|
19603
|
+
if (this._customHeight !== value) {
|
|
19604
|
+
this._customHeight = value;
|
|
19537
19605
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19538
19606
|
}
|
|
19539
19607
|
}
|
|
@@ -19563,7 +19631,9 @@ var TextVerticalAlignment;
|
|
|
19563
19631
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
19564
19632
|
this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
19565
19633
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
19566
|
-
(this.
|
|
19634
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19635
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19636
|
+
}
|
|
19567
19637
|
}
|
|
19568
19638
|
},
|
|
19569
19639
|
{
|
|
@@ -19578,7 +19648,9 @@ var TextVerticalAlignment;
|
|
|
19578
19648
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
19579
19649
|
this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
|
|
19580
19650
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
19581
|
-
(this.
|
|
19651
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19652
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19653
|
+
}
|
|
19582
19654
|
}
|
|
19583
19655
|
},
|
|
19584
19656
|
{
|
|
@@ -19594,7 +19666,9 @@ var TextVerticalAlignment;
|
|
|
19594
19666
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
19595
19667
|
region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
19596
19668
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
19597
|
-
(this.
|
|
19669
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19670
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19671
|
+
}
|
|
19598
19672
|
}
|
|
19599
19673
|
},
|
|
19600
19674
|
{
|
|
@@ -19644,7 +19718,8 @@ var SpriteUpdateFlags;
|
|
|
19644
19718
|
(function(SpriteUpdateFlags) {
|
|
19645
19719
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
19646
19720
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
19647
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
19721
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
19722
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
19648
19723
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
19649
19724
|
|
|
19650
19725
|
var _SlicedSpriteAssembler;
|
|
@@ -19797,8 +19872,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19797
19872
|
_this = Renderer.call(this, entity) || this;
|
|
19798
19873
|
_this._color = new Color$1(1, 1, 1, 1);
|
|
19799
19874
|
_this._sprite = null;
|
|
19800
|
-
_this.
|
|
19801
|
-
_this.
|
|
19875
|
+
_this._automaticWidth = 0;
|
|
19876
|
+
_this._automaticHeight = 0;
|
|
19877
|
+
_this._customWidth = undefined;
|
|
19878
|
+
_this._customHeight = undefined;
|
|
19802
19879
|
_this._flipX = false;
|
|
19803
19880
|
_this._flipY = false;
|
|
19804
19881
|
_this._maskLayer = SpriteMaskLayer.Layer0;
|
|
@@ -19814,6 +19891,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19814
19891
|
* @internal
|
|
19815
19892
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19816
19893
|
target.sprite = this._sprite;
|
|
19894
|
+
target.drawMode = this._drawMode;
|
|
19817
19895
|
};
|
|
19818
19896
|
/**
|
|
19819
19897
|
* @internal
|
|
@@ -19829,12 +19907,11 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19829
19907
|
/**
|
|
19830
19908
|
* @override
|
|
19831
19909
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
19832
|
-
|
|
19833
|
-
|
|
19910
|
+
if (this.sprite) {
|
|
19911
|
+
this._assembler.updatePositions(this);
|
|
19912
|
+
} else {
|
|
19834
19913
|
worldBounds.min.set(0, 0, 0);
|
|
19835
19914
|
worldBounds.max.set(0, 0, 0);
|
|
19836
|
-
} else {
|
|
19837
|
-
this._assembler.updatePositions(this);
|
|
19838
19915
|
}
|
|
19839
19916
|
};
|
|
19840
19917
|
/**
|
|
@@ -19844,17 +19921,17 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19844
19921
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
19845
19922
|
return;
|
|
19846
19923
|
}
|
|
19847
|
-
// Update position
|
|
19924
|
+
// Update position
|
|
19848
19925
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
19849
19926
|
this._assembler.updatePositions(this);
|
|
19850
19927
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
19851
19928
|
}
|
|
19852
|
-
// Update uv
|
|
19929
|
+
// Update uv
|
|
19853
19930
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
19854
19931
|
this._assembler.updateUVs(this);
|
|
19855
19932
|
this._dirtyUpdateFlag &= ~0x2;
|
|
19856
19933
|
}
|
|
19857
|
-
// Push primitive
|
|
19934
|
+
// Push primitive
|
|
19858
19935
|
var material = this.getMaterial();
|
|
19859
19936
|
var passes = material.shader.passes;
|
|
19860
19937
|
var renderStates = material.renderStates;
|
|
@@ -19865,6 +19942,16 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19865
19942
|
context.camera._renderPipeline.pushPrimitive(spriteElement);
|
|
19866
19943
|
}
|
|
19867
19944
|
};
|
|
19945
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
19946
|
+
var sprite = this._sprite;
|
|
19947
|
+
if (sprite) {
|
|
19948
|
+
this._automaticWidth = sprite.width;
|
|
19949
|
+
this._automaticHeight = sprite.height;
|
|
19950
|
+
} else {
|
|
19951
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19952
|
+
}
|
|
19953
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19954
|
+
};
|
|
19868
19955
|
_proto._updateStencilState = function _updateStencilState() {
|
|
19869
19956
|
// Update stencil.
|
|
19870
19957
|
var material = this.getInstanceMaterial();
|
|
@@ -19890,9 +19977,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19890
19977
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
|
|
19891
19978
|
break;
|
|
19892
19979
|
case SpriteModifyFlags.size:
|
|
19980
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19893
19981
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
19894
19982
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
19895
|
-
if (this._drawMode === SpriteDrawMode.Sliced || this.
|
|
19983
|
+
if (this._drawMode === SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
|
|
19896
19984
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19897
19985
|
}
|
|
19898
19986
|
break;
|
|
@@ -19946,9 +20034,9 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19946
20034
|
var lastSprite = this._sprite;
|
|
19947
20035
|
if (lastSprite !== value) {
|
|
19948
20036
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
20037
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19949
20038
|
if (value) {
|
|
19950
20039
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
19951
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
19952
20040
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
19953
20041
|
} else {
|
|
19954
20042
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -19973,16 +20061,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19973
20061
|
{
|
|
19974
20062
|
key: "width",
|
|
19975
20063
|
get: /**
|
|
19976
|
-
* Render width.
|
|
20064
|
+
* Render width (in world coordinates).
|
|
20065
|
+
*
|
|
20066
|
+
* @remarks
|
|
20067
|
+
* If width is set, return the set value,
|
|
20068
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
19977
20069
|
*/ function get() {
|
|
19978
|
-
|
|
19979
|
-
|
|
20070
|
+
if (this._customWidth !== undefined) {
|
|
20071
|
+
return this._customWidth;
|
|
20072
|
+
} else {
|
|
20073
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20074
|
+
return this._automaticWidth;
|
|
20075
|
+
}
|
|
19980
20076
|
},
|
|
19981
20077
|
set: function set(value) {
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
if (this._width !== value) {
|
|
19985
|
-
this._width = value;
|
|
20078
|
+
if (this._customWidth !== value) {
|
|
20079
|
+
this._customWidth = value;
|
|
19986
20080
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19987
20081
|
}
|
|
19988
20082
|
}
|
|
@@ -19990,16 +20084,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19990
20084
|
{
|
|
19991
20085
|
key: "height",
|
|
19992
20086
|
get: /**
|
|
19993
|
-
* Render height.
|
|
20087
|
+
* Render height (in world coordinates).
|
|
20088
|
+
*
|
|
20089
|
+
* @remarks
|
|
20090
|
+
* If height is set, return the set value,
|
|
20091
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
19994
20092
|
*/ function get() {
|
|
19995
|
-
|
|
19996
|
-
|
|
20093
|
+
if (this._customHeight !== undefined) {
|
|
20094
|
+
return this._customHeight;
|
|
20095
|
+
} else {
|
|
20096
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20097
|
+
return this._automaticHeight;
|
|
20098
|
+
}
|
|
19997
20099
|
},
|
|
19998
20100
|
set: function set(value) {
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
if (this._height !== value) {
|
|
20002
|
-
this._height = value;
|
|
20101
|
+
if (this._customHeight !== value) {
|
|
20102
|
+
this._customHeight = value;
|
|
20003
20103
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
20004
20104
|
}
|
|
20005
20105
|
}
|
|
@@ -20080,10 +20180,16 @@ __decorate([
|
|
|
20080
20180
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
20081
20181
|
__decorate([
|
|
20082
20182
|
ignoreClone
|
|
20083
|
-
], SpriteRenderer.prototype, "
|
|
20183
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
20084
20184
|
__decorate([
|
|
20085
20185
|
ignoreClone
|
|
20086
|
-
], SpriteRenderer.prototype, "
|
|
20186
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
20187
|
+
__decorate([
|
|
20188
|
+
assignmentClone
|
|
20189
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
20190
|
+
__decorate([
|
|
20191
|
+
assignmentClone
|
|
20192
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
20087
20193
|
__decorate([
|
|
20088
20194
|
assignmentClone
|
|
20089
20195
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -20104,7 +20210,9 @@ var /**
|
|
|
20104
20210
|
*/ SpriteRendererUpdateFlags;
|
|
20105
20211
|
(function(SpriteRendererUpdateFlags) {
|
|
20106
20212
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
20107
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
20213
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
20214
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
20215
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
20108
20216
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
20109
20217
|
|
|
20110
20218
|
/**
|