@esotericsoftware/spine-webgl 4.2.117 → 4.2.119
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/SkeletonRenderer.d.ts +7 -0
- package/dist/SkeletonRenderer.js +19 -9
- package/dist/esm/spine-webgl.min.mjs +3 -3
- package/dist/esm/spine-webgl.mjs +23 -13
- package/dist/esm/spine-webgl.mjs.map +2 -2
- package/dist/iife/spine-webgl.js +23 -13
- package/dist/iife/spine-webgl.js.map +2 -2
- package/dist/iife/spine-webgl.min.js +3 -3
- package/package.json +2 -2
package/dist/iife/spine-webgl.js
CHANGED
|
@@ -8478,12 +8478,12 @@ var spine = (() => {
|
|
|
8478
8478
|
this.boneData = boneData;
|
|
8479
8479
|
}
|
|
8480
8480
|
};
|
|
8481
|
-
var BlendMode = /* @__PURE__ */ ((
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
return
|
|
8481
|
+
var BlendMode = /* @__PURE__ */ ((BlendMode2) => {
|
|
8482
|
+
BlendMode2[BlendMode2["Normal"] = 0] = "Normal";
|
|
8483
|
+
BlendMode2[BlendMode2["Additive"] = 1] = "Additive";
|
|
8484
|
+
BlendMode2[BlendMode2["Multiply"] = 2] = "Multiply";
|
|
8485
|
+
BlendMode2[BlendMode2["Screen"] = 3] = "Screen";
|
|
8486
|
+
return BlendMode2;
|
|
8487
8487
|
})(BlendMode || {});
|
|
8488
8488
|
|
|
8489
8489
|
// spine-core/src/TransformConstraintData.ts
|
|
@@ -13349,6 +13349,13 @@ void main () {
|
|
|
13349
13349
|
temp2 = new Vector2();
|
|
13350
13350
|
temp3 = new Color();
|
|
13351
13351
|
temp4 = new Color();
|
|
13352
|
+
/**
|
|
13353
|
+
* Batches additive slots together with normal slots by rendering additive slots with premultiplied alpha RGB and zero alpha,
|
|
13354
|
+
* while using normal PMA blending. This reduces draw calls for normal/additive/normal sequences with the same texture.
|
|
13355
|
+
*
|
|
13356
|
+
* Disabled by default in 4.2 to preserve exact additive alpha accumulation for transparent targets.
|
|
13357
|
+
*/
|
|
13358
|
+
pmaAdditiveBatching = false;
|
|
13352
13359
|
constructor(context, twoColorTint = true) {
|
|
13353
13360
|
this.twoColorTint = twoColorTint;
|
|
13354
13361
|
if (twoColorTint)
|
|
@@ -13422,14 +13429,17 @@ void main () {
|
|
|
13422
13429
|
if (texture) {
|
|
13423
13430
|
let slotColor = slot.color;
|
|
13424
13431
|
let finalColor = this.tempColor;
|
|
13432
|
+
let slotBlendMode = slot.data.blendMode;
|
|
13433
|
+
let additiveBlend = this.pmaAdditiveBatching && premultipliedAlpha && slotBlendMode == 1 /* Additive */;
|
|
13434
|
+
let alpha = skeletonColor.a * slotColor.a * attachmentColor.a;
|
|
13425
13435
|
finalColor.r = skeletonColor.r * slotColor.r * attachmentColor.r;
|
|
13426
13436
|
finalColor.g = skeletonColor.g * slotColor.g * attachmentColor.g;
|
|
13427
13437
|
finalColor.b = skeletonColor.b * slotColor.b * attachmentColor.b;
|
|
13428
|
-
finalColor.a =
|
|
13438
|
+
finalColor.a = additiveBlend ? 0 : alpha;
|
|
13429
13439
|
if (premultipliedAlpha) {
|
|
13430
|
-
finalColor.r *=
|
|
13431
|
-
finalColor.g *=
|
|
13432
|
-
finalColor.b *=
|
|
13440
|
+
finalColor.r *= alpha;
|
|
13441
|
+
finalColor.g *= alpha;
|
|
13442
|
+
finalColor.b *= alpha;
|
|
13433
13443
|
}
|
|
13434
13444
|
let darkColor = this.tempColor2;
|
|
13435
13445
|
if (!slot.darkColor)
|
|
@@ -13444,9 +13454,9 @@ void main () {
|
|
|
13444
13454
|
}
|
|
13445
13455
|
darkColor.a = premultipliedAlpha ? 1 : 0;
|
|
13446
13456
|
}
|
|
13447
|
-
let
|
|
13448
|
-
if (
|
|
13449
|
-
blendMode =
|
|
13457
|
+
let batchBlendMode = additiveBlend ? 0 /* Normal */ : slotBlendMode;
|
|
13458
|
+
if (batchBlendMode != blendMode) {
|
|
13459
|
+
blendMode = batchBlendMode;
|
|
13450
13460
|
batcher.setBlendMode(blendMode, premultipliedAlpha);
|
|
13451
13461
|
}
|
|
13452
13462
|
if (clipper.isClipping()) {
|