@esotericsoftware/spine-webgl 4.2.116 → 4.2.118
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/esm/spine-webgl.mjs
CHANGED
|
@@ -8293,12 +8293,12 @@ var SlotData = class {
|
|
|
8293
8293
|
this.boneData = boneData;
|
|
8294
8294
|
}
|
|
8295
8295
|
};
|
|
8296
|
-
var BlendMode = /* @__PURE__ */ ((
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
return
|
|
8296
|
+
var BlendMode = /* @__PURE__ */ ((BlendMode2) => {
|
|
8297
|
+
BlendMode2[BlendMode2["Normal"] = 0] = "Normal";
|
|
8298
|
+
BlendMode2[BlendMode2["Additive"] = 1] = "Additive";
|
|
8299
|
+
BlendMode2[BlendMode2["Multiply"] = 2] = "Multiply";
|
|
8300
|
+
BlendMode2[BlendMode2["Screen"] = 3] = "Screen";
|
|
8301
|
+
return BlendMode2;
|
|
8302
8302
|
})(BlendMode || {});
|
|
8303
8303
|
|
|
8304
8304
|
// spine-core/src/TransformConstraintData.ts
|
|
@@ -13164,6 +13164,13 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
13164
13164
|
temp2 = new Vector2();
|
|
13165
13165
|
temp3 = new Color();
|
|
13166
13166
|
temp4 = new Color();
|
|
13167
|
+
/**
|
|
13168
|
+
* Batches additive slots together with normal slots by rendering additive slots with premultiplied alpha RGB and zero alpha,
|
|
13169
|
+
* while using normal PMA blending. This reduces draw calls for normal/additive/normal sequences with the same texture.
|
|
13170
|
+
*
|
|
13171
|
+
* Disabled by default in 4.2 to preserve exact additive alpha accumulation for transparent targets.
|
|
13172
|
+
*/
|
|
13173
|
+
pmaAdditiveBatching = false;
|
|
13167
13174
|
constructor(context, twoColorTint = true) {
|
|
13168
13175
|
this.twoColorTint = twoColorTint;
|
|
13169
13176
|
if (twoColorTint)
|
|
@@ -13237,14 +13244,17 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
13237
13244
|
if (texture) {
|
|
13238
13245
|
let slotColor = slot.color;
|
|
13239
13246
|
let finalColor = this.tempColor;
|
|
13247
|
+
let slotBlendMode = slot.data.blendMode;
|
|
13248
|
+
let additiveBlend = this.pmaAdditiveBatching && premultipliedAlpha && slotBlendMode == 1 /* Additive */;
|
|
13249
|
+
let alpha = skeletonColor.a * slotColor.a * attachmentColor.a;
|
|
13240
13250
|
finalColor.r = skeletonColor.r * slotColor.r * attachmentColor.r;
|
|
13241
13251
|
finalColor.g = skeletonColor.g * slotColor.g * attachmentColor.g;
|
|
13242
13252
|
finalColor.b = skeletonColor.b * slotColor.b * attachmentColor.b;
|
|
13243
|
-
finalColor.a =
|
|
13253
|
+
finalColor.a = additiveBlend ? 0 : alpha;
|
|
13244
13254
|
if (premultipliedAlpha) {
|
|
13245
|
-
finalColor.r *=
|
|
13246
|
-
finalColor.g *=
|
|
13247
|
-
finalColor.b *=
|
|
13255
|
+
finalColor.r *= alpha;
|
|
13256
|
+
finalColor.g *= alpha;
|
|
13257
|
+
finalColor.b *= alpha;
|
|
13248
13258
|
}
|
|
13249
13259
|
let darkColor = this.tempColor2;
|
|
13250
13260
|
if (!slot.darkColor)
|
|
@@ -13259,9 +13269,9 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
13259
13269
|
}
|
|
13260
13270
|
darkColor.a = premultipliedAlpha ? 1 : 0;
|
|
13261
13271
|
}
|
|
13262
|
-
let
|
|
13263
|
-
if (
|
|
13264
|
-
blendMode =
|
|
13272
|
+
let batchBlendMode = additiveBlend ? 0 /* Normal */ : slotBlendMode;
|
|
13273
|
+
if (batchBlendMode != blendMode) {
|
|
13274
|
+
blendMode = batchBlendMode;
|
|
13265
13275
|
batcher.setBlendMode(blendMode, premultipliedAlpha);
|
|
13266
13276
|
}
|
|
13267
13277
|
if (clipper.isClipping()) {
|