@galacean/engine-core 0.9.7 → 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 +179 -71
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +179 -71
- package/dist/module.js +179 -71
- 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/main.js
CHANGED
|
@@ -10489,8 +10489,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10489
10489
|
_this = Renderer.call(this, entity) || this;
|
|
10490
10490
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
10491
10491
|
_this._sprite = null;
|
|
10492
|
-
_this.
|
|
10493
|
-
_this.
|
|
10492
|
+
_this._automaticWidth = 0;
|
|
10493
|
+
_this._automaticHeight = 0;
|
|
10494
|
+
_this._customWidth = undefined;
|
|
10495
|
+
_this._customHeight = undefined;
|
|
10494
10496
|
_this._flipX = false;
|
|
10495
10497
|
_this._flipY = false;
|
|
10496
10498
|
_this._alphaCutoff = 0.5;
|
|
@@ -10520,12 +10522,11 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10520
10522
|
/**
|
|
10521
10523
|
* @override
|
|
10522
10524
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
+
if (this.sprite) {
|
|
10526
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
10527
|
+
} else {
|
|
10525
10528
|
worldBounds.min.set(0, 0, 0);
|
|
10526
10529
|
worldBounds.max.set(0, 0, 0);
|
|
10527
|
-
} else {
|
|
10528
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
10529
10530
|
}
|
|
10530
10531
|
};
|
|
10531
10532
|
/**
|
|
@@ -10536,12 +10537,12 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10536
10537
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
10537
10538
|
return;
|
|
10538
10539
|
}
|
|
10539
|
-
// Update position
|
|
10540
|
+
// Update position
|
|
10540
10541
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
10541
10542
|
SimpleSpriteAssembler.updatePositions(this);
|
|
10542
10543
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
10543
10544
|
}
|
|
10544
|
-
// Update uv
|
|
10545
|
+
// Update uv
|
|
10545
10546
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
10546
10547
|
SimpleSpriteAssembler.updateUVs(this);
|
|
10547
10548
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -10552,11 +10553,27 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10552
10553
|
context.camera._renderPipeline._allSpriteMasks.add(this);
|
|
10553
10554
|
this._maskElement = maskElement;
|
|
10554
10555
|
};
|
|
10556
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
10557
|
+
var sprite = this._sprite;
|
|
10558
|
+
if (sprite) {
|
|
10559
|
+
this._automaticWidth = sprite.width;
|
|
10560
|
+
this._automaticHeight = sprite.height;
|
|
10561
|
+
} else {
|
|
10562
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
10563
|
+
}
|
|
10564
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
10565
|
+
};
|
|
10555
10566
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
10556
10567
|
switch(type){
|
|
10557
10568
|
case SpriteModifyFlags.texture:
|
|
10558
10569
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
10559
10570
|
break;
|
|
10571
|
+
case SpriteModifyFlags.size:
|
|
10572
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
10573
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
10574
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10575
|
+
}
|
|
10576
|
+
break;
|
|
10560
10577
|
case SpriteModifyFlags.region:
|
|
10561
10578
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
10562
10579
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -10564,22 +10581,31 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10564
10581
|
case SpriteModifyFlags.atlasRegion:
|
|
10565
10582
|
this._dirtyUpdateFlag |= 0x2;
|
|
10566
10583
|
break;
|
|
10584
|
+
case SpriteModifyFlags.pivot:
|
|
10585
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10586
|
+
break;
|
|
10567
10587
|
}
|
|
10568
10588
|
};
|
|
10569
10589
|
_create_class(SpriteMask, [
|
|
10570
10590
|
{
|
|
10571
10591
|
key: "width",
|
|
10572
10592
|
get: /**
|
|
10573
|
-
* Render width.
|
|
10593
|
+
* Render width (in world coordinates).
|
|
10594
|
+
*
|
|
10595
|
+
* @remarks
|
|
10596
|
+
* If width is set, return the set value,
|
|
10597
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
10574
10598
|
*/ function get() {
|
|
10575
|
-
if (this.
|
|
10576
|
-
|
|
10599
|
+
if (this._customWidth !== undefined) {
|
|
10600
|
+
return this._customWidth;
|
|
10601
|
+
} else {
|
|
10602
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10603
|
+
return this._automaticWidth;
|
|
10577
10604
|
}
|
|
10578
|
-
return this._width;
|
|
10579
10605
|
},
|
|
10580
10606
|
set: function set(value) {
|
|
10581
|
-
if (this.
|
|
10582
|
-
this.
|
|
10607
|
+
if (this._customWidth !== value) {
|
|
10608
|
+
this._customWidth = value;
|
|
10583
10609
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10584
10610
|
}
|
|
10585
10611
|
}
|
|
@@ -10587,16 +10613,22 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10587
10613
|
{
|
|
10588
10614
|
key: "height",
|
|
10589
10615
|
get: /**
|
|
10590
|
-
* Render height.
|
|
10616
|
+
* Render height (in world coordinates).
|
|
10617
|
+
*
|
|
10618
|
+
* @remarks
|
|
10619
|
+
* If height is set, return the set value,
|
|
10620
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
10591
10621
|
*/ function get() {
|
|
10592
|
-
if (this.
|
|
10593
|
-
|
|
10622
|
+
if (this._customHeight !== undefined) {
|
|
10623
|
+
return this._customHeight;
|
|
10624
|
+
} else {
|
|
10625
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
10626
|
+
return this._automaticHeight;
|
|
10594
10627
|
}
|
|
10595
|
-
return this._height;
|
|
10596
10628
|
},
|
|
10597
10629
|
set: function set(value) {
|
|
10598
|
-
if (this.
|
|
10599
|
-
this.
|
|
10630
|
+
if (this._customHeight !== value) {
|
|
10631
|
+
this._customHeight = value;
|
|
10600
10632
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
10601
10633
|
}
|
|
10602
10634
|
}
|
|
@@ -10640,9 +10672,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10640
10672
|
var lastSprite = this._sprite;
|
|
10641
10673
|
if (lastSprite !== value) {
|
|
10642
10674
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
10675
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
10643
10676
|
if (value) {
|
|
10644
10677
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
10645
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
10646
10678
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
10647
10679
|
} else {
|
|
10648
10680
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -10682,10 +10714,16 @@ __decorate([
|
|
|
10682
10714
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
10683
10715
|
__decorate([
|
|
10684
10716
|
ignoreClone
|
|
10685
|
-
], SpriteMask.prototype, "
|
|
10717
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
10686
10718
|
__decorate([
|
|
10687
10719
|
ignoreClone
|
|
10688
|
-
], SpriteMask.prototype, "
|
|
10720
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
10721
|
+
__decorate([
|
|
10722
|
+
assignmentClone
|
|
10723
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
10724
|
+
__decorate([
|
|
10725
|
+
assignmentClone
|
|
10726
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
10689
10727
|
__decorate([
|
|
10690
10728
|
assignmentClone
|
|
10691
10729
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -10703,7 +10741,9 @@ var /**
|
|
|
10703
10741
|
*/ SpriteMaskUpdateFlags;
|
|
10704
10742
|
(function(SpriteMaskUpdateFlags) {
|
|
10705
10743
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
10706
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
10744
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
10745
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
10746
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
10707
10747
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
10708
10748
|
|
|
10709
10749
|
/**
|
|
@@ -19358,8 +19398,10 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19358
19398
|
if (name === void 0) name = null;
|
|
19359
19399
|
var _this;
|
|
19360
19400
|
_this = RefObject.call(this, engine) || this;
|
|
19361
|
-
_this.
|
|
19362
|
-
_this.
|
|
19401
|
+
_this._automaticWidth = 0;
|
|
19402
|
+
_this._automaticHeight = 0;
|
|
19403
|
+
_this._customWidth = undefined;
|
|
19404
|
+
_this._customHeight = undefined;
|
|
19363
19405
|
_this._positions = [
|
|
19364
19406
|
new engineMath.Vector2(),
|
|
19365
19407
|
new engineMath.Vector2(),
|
|
@@ -19380,7 +19422,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19380
19422
|
_this._region = new engineMath.Rect(0, 0, 1, 1);
|
|
19381
19423
|
_this._pivot = new engineMath.Vector2(0.5, 0.5);
|
|
19382
19424
|
_this._border = new engineMath.Vector4(0, 0, 0, 0);
|
|
19383
|
-
_this._dirtyUpdateFlag =
|
|
19425
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
19384
19426
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
19385
19427
|
_this._texture = texture;
|
|
19386
19428
|
region && _this._region.copyFrom(region);
|
|
@@ -19429,9 +19471,12 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19429
19471
|
if (this._texture) {
|
|
19430
19472
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
19431
19473
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
19432
|
-
this.
|
|
19433
|
-
this.
|
|
19474
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
19475
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
19476
|
+
} else {
|
|
19477
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19434
19478
|
}
|
|
19479
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19435
19480
|
};
|
|
19436
19481
|
_proto._updatePositions = function _updatePositions() {
|
|
19437
19482
|
var blank = this._atlasRegionOffset;
|
|
@@ -19485,11 +19530,16 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19485
19530
|
};
|
|
19486
19531
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
19487
19532
|
switch(type){
|
|
19533
|
+
case SpriteModifyFlags.texture:
|
|
19534
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19535
|
+
break;
|
|
19488
19536
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
19489
19537
|
case SpriteModifyFlags.region:
|
|
19490
|
-
this._dirtyUpdateFlag |=
|
|
19538
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19491
19539
|
break;
|
|
19492
19540
|
case SpriteModifyFlags.atlasRegion:
|
|
19541
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
19542
|
+
break;
|
|
19493
19543
|
case SpriteModifyFlags.border:
|
|
19494
19544
|
this._dirtyUpdateFlag |= 0x2;
|
|
19495
19545
|
break;
|
|
@@ -19508,7 +19558,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19508
19558
|
if (this._texture !== value) {
|
|
19509
19559
|
this._texture = value;
|
|
19510
19560
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
19511
|
-
(this.
|
|
19561
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19562
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19563
|
+
}
|
|
19512
19564
|
}
|
|
19513
19565
|
}
|
|
19514
19566
|
},
|
|
@@ -19516,13 +19568,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19516
19568
|
key: "width",
|
|
19517
19569
|
get: /**
|
|
19518
19570
|
* The width of the sprite (in world coordinates).
|
|
19571
|
+
*
|
|
19572
|
+
* @remarks
|
|
19573
|
+
* If width is set, return the set value,
|
|
19574
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19519
19575
|
*/ function get() {
|
|
19520
|
-
this.
|
|
19521
|
-
|
|
19576
|
+
if (this._customWidth !== undefined) {
|
|
19577
|
+
return this._customWidth;
|
|
19578
|
+
} else {
|
|
19579
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19580
|
+
return this._automaticWidth;
|
|
19581
|
+
}
|
|
19522
19582
|
},
|
|
19523
19583
|
set: function set(value) {
|
|
19524
|
-
if (this.
|
|
19525
|
-
this.
|
|
19584
|
+
if (this._customWidth !== value) {
|
|
19585
|
+
this._customWidth = value;
|
|
19526
19586
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19527
19587
|
}
|
|
19528
19588
|
}
|
|
@@ -19531,13 +19591,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19531
19591
|
key: "height",
|
|
19532
19592
|
get: /**
|
|
19533
19593
|
* The height of the sprite (in world coordinates).
|
|
19594
|
+
*
|
|
19595
|
+
* @remarks
|
|
19596
|
+
* If height is set, return the set value,
|
|
19597
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
19534
19598
|
*/ function get() {
|
|
19535
|
-
this.
|
|
19536
|
-
|
|
19599
|
+
if (this._customHeight !== undefined) {
|
|
19600
|
+
return this._customHeight;
|
|
19601
|
+
} else {
|
|
19602
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
19603
|
+
return this._automaticHeight;
|
|
19604
|
+
}
|
|
19537
19605
|
},
|
|
19538
19606
|
set: function set(value) {
|
|
19539
|
-
if (this.
|
|
19540
|
-
this.
|
|
19607
|
+
if (this._customHeight !== value) {
|
|
19608
|
+
this._customHeight = value;
|
|
19541
19609
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19542
19610
|
}
|
|
19543
19611
|
}
|
|
@@ -19567,7 +19635,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19567
19635
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
19568
19636
|
this._atlasRegion.set(x, y, engineMath.MathUtil.clamp(value.width, 0, 1 - x), engineMath.MathUtil.clamp(value.height, 0, 1 - y));
|
|
19569
19637
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
19570
|
-
(this.
|
|
19638
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19639
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19640
|
+
}
|
|
19571
19641
|
}
|
|
19572
19642
|
},
|
|
19573
19643
|
{
|
|
@@ -19582,7 +19652,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19582
19652
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
19583
19653
|
this._atlasRegionOffset.set(x, y, engineMath.MathUtil.clamp(value.z, 0, 1 - x), engineMath.MathUtil.clamp(value.w, 0, 1 - y));
|
|
19584
19654
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
19585
|
-
(this.
|
|
19655
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19656
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19657
|
+
}
|
|
19586
19658
|
}
|
|
19587
19659
|
},
|
|
19588
19660
|
{
|
|
@@ -19598,7 +19670,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19598
19670
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
19599
19671
|
region.set(x, y, engineMath.MathUtil.clamp(value.width, 0, 1 - x), engineMath.MathUtil.clamp(value.height, 0, 1 - y));
|
|
19600
19672
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
19601
|
-
(this.
|
|
19673
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
19674
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
19675
|
+
}
|
|
19602
19676
|
}
|
|
19603
19677
|
},
|
|
19604
19678
|
{
|
|
@@ -19648,7 +19722,8 @@ var SpriteUpdateFlags;
|
|
|
19648
19722
|
(function(SpriteUpdateFlags) {
|
|
19649
19723
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
19650
19724
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
19651
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
19725
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
19726
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
19652
19727
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
19653
19728
|
|
|
19654
19729
|
var _SlicedSpriteAssembler;
|
|
@@ -19801,8 +19876,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19801
19876
|
_this = Renderer.call(this, entity) || this;
|
|
19802
19877
|
_this._color = new engineMath.Color(1, 1, 1, 1);
|
|
19803
19878
|
_this._sprite = null;
|
|
19804
|
-
_this.
|
|
19805
|
-
_this.
|
|
19879
|
+
_this._automaticWidth = 0;
|
|
19880
|
+
_this._automaticHeight = 0;
|
|
19881
|
+
_this._customWidth = undefined;
|
|
19882
|
+
_this._customHeight = undefined;
|
|
19806
19883
|
_this._flipX = false;
|
|
19807
19884
|
_this._flipY = false;
|
|
19808
19885
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -19818,6 +19895,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19818
19895
|
* @internal
|
|
19819
19896
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19820
19897
|
target.sprite = this._sprite;
|
|
19898
|
+
target.drawMode = this._drawMode;
|
|
19821
19899
|
};
|
|
19822
19900
|
/**
|
|
19823
19901
|
* @internal
|
|
@@ -19833,12 +19911,11 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19833
19911
|
/**
|
|
19834
19912
|
* @override
|
|
19835
19913
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
19836
|
-
|
|
19837
|
-
|
|
19914
|
+
if (this.sprite) {
|
|
19915
|
+
this._assembler.updatePositions(this);
|
|
19916
|
+
} else {
|
|
19838
19917
|
worldBounds.min.set(0, 0, 0);
|
|
19839
19918
|
worldBounds.max.set(0, 0, 0);
|
|
19840
|
-
} else {
|
|
19841
|
-
this._assembler.updatePositions(this);
|
|
19842
19919
|
}
|
|
19843
19920
|
};
|
|
19844
19921
|
/**
|
|
@@ -19848,17 +19925,17 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19848
19925
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
19849
19926
|
return;
|
|
19850
19927
|
}
|
|
19851
|
-
// Update position
|
|
19928
|
+
// Update position
|
|
19852
19929
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
19853
19930
|
this._assembler.updatePositions(this);
|
|
19854
19931
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
19855
19932
|
}
|
|
19856
|
-
// Update uv
|
|
19933
|
+
// Update uv
|
|
19857
19934
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
19858
19935
|
this._assembler.updateUVs(this);
|
|
19859
19936
|
this._dirtyUpdateFlag &= ~0x2;
|
|
19860
19937
|
}
|
|
19861
|
-
// Push primitive
|
|
19938
|
+
// Push primitive
|
|
19862
19939
|
var material = this.getMaterial();
|
|
19863
19940
|
var passes = material.shader.passes;
|
|
19864
19941
|
var renderStates = material.renderStates;
|
|
@@ -19869,6 +19946,16 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19869
19946
|
context.camera._renderPipeline.pushPrimitive(spriteElement);
|
|
19870
19947
|
}
|
|
19871
19948
|
};
|
|
19949
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
19950
|
+
var sprite = this._sprite;
|
|
19951
|
+
if (sprite) {
|
|
19952
|
+
this._automaticWidth = sprite.width;
|
|
19953
|
+
this._automaticHeight = sprite.height;
|
|
19954
|
+
} else {
|
|
19955
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
19956
|
+
}
|
|
19957
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
19958
|
+
};
|
|
19872
19959
|
_proto._updateStencilState = function _updateStencilState() {
|
|
19873
19960
|
// Update stencil.
|
|
19874
19961
|
var material = this.getInstanceMaterial();
|
|
@@ -19894,9 +19981,10 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19894
19981
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, this.sprite.texture);
|
|
19895
19982
|
break;
|
|
19896
19983
|
case SpriteModifyFlags.size:
|
|
19984
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
19897
19985
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
19898
19986
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
19899
|
-
if (this._drawMode === exports.SpriteDrawMode.Sliced || this.
|
|
19987
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced || this._customWidth === undefined || this._customHeight === undefined) {
|
|
19900
19988
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19901
19989
|
}
|
|
19902
19990
|
break;
|
|
@@ -19950,9 +20038,9 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19950
20038
|
var lastSprite = this._sprite;
|
|
19951
20039
|
if (lastSprite !== value) {
|
|
19952
20040
|
lastSprite && lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
20041
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
19953
20042
|
if (value) {
|
|
19954
20043
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
19955
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
19956
20044
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
19957
20045
|
} else {
|
|
19958
20046
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -19977,16 +20065,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19977
20065
|
{
|
|
19978
20066
|
key: "width",
|
|
19979
20067
|
get: /**
|
|
19980
|
-
* Render width.
|
|
20068
|
+
* Render width (in world coordinates).
|
|
20069
|
+
*
|
|
20070
|
+
* @remarks
|
|
20071
|
+
* If width is set, return the set value,
|
|
20072
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
19981
20073
|
*/ function get() {
|
|
19982
|
-
|
|
19983
|
-
|
|
20074
|
+
if (this._customWidth !== undefined) {
|
|
20075
|
+
return this._customWidth;
|
|
20076
|
+
} else {
|
|
20077
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20078
|
+
return this._automaticWidth;
|
|
20079
|
+
}
|
|
19984
20080
|
},
|
|
19985
20081
|
set: function set(value) {
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
if (this._width !== value) {
|
|
19989
|
-
this._width = value;
|
|
20082
|
+
if (this._customWidth !== value) {
|
|
20083
|
+
this._customWidth = value;
|
|
19990
20084
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
19991
20085
|
}
|
|
19992
20086
|
}
|
|
@@ -19994,16 +20088,22 @@ SlicedSpriteAssembler = __decorate([
|
|
|
19994
20088
|
{
|
|
19995
20089
|
key: "height",
|
|
19996
20090
|
get: /**
|
|
19997
|
-
* Render height.
|
|
20091
|
+
* Render height (in world coordinates).
|
|
20092
|
+
*
|
|
20093
|
+
* @remarks
|
|
20094
|
+
* If height is set, return the set value,
|
|
20095
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
19998
20096
|
*/ function get() {
|
|
19999
|
-
|
|
20000
|
-
|
|
20097
|
+
if (this._customHeight !== undefined) {
|
|
20098
|
+
return this._customHeight;
|
|
20099
|
+
} else {
|
|
20100
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20101
|
+
return this._automaticHeight;
|
|
20102
|
+
}
|
|
20001
20103
|
},
|
|
20002
20104
|
set: function set(value) {
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
if (this._height !== value) {
|
|
20006
|
-
this._height = value;
|
|
20105
|
+
if (this._customHeight !== value) {
|
|
20106
|
+
this._customHeight = value;
|
|
20007
20107
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
20008
20108
|
}
|
|
20009
20109
|
}
|
|
@@ -20084,10 +20184,16 @@ __decorate([
|
|
|
20084
20184
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
20085
20185
|
__decorate([
|
|
20086
20186
|
ignoreClone
|
|
20087
|
-
], SpriteRenderer.prototype, "
|
|
20187
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
20088
20188
|
__decorate([
|
|
20089
20189
|
ignoreClone
|
|
20090
|
-
], SpriteRenderer.prototype, "
|
|
20190
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
20191
|
+
__decorate([
|
|
20192
|
+
assignmentClone
|
|
20193
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
20194
|
+
__decorate([
|
|
20195
|
+
assignmentClone
|
|
20196
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
20091
20197
|
__decorate([
|
|
20092
20198
|
assignmentClone
|
|
20093
20199
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -20108,7 +20214,9 @@ var /**
|
|
|
20108
20214
|
*/ SpriteRendererUpdateFlags;
|
|
20109
20215
|
(function(SpriteRendererUpdateFlags) {
|
|
20110
20216
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
20111
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
20217
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
20218
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
20219
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
20112
20220
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
20113
20221
|
|
|
20114
20222
|
/**
|