@esotericsoftware/spine-webgl 4.3.1 → 4.3.2
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 +6 -4
- package/dist/SkeletonRenderer.js +16 -12
- package/dist/esm/spine-webgl.min.mjs +3 -3
- package/dist/esm/spine-webgl.mjs +14 -10
- package/dist/esm/spine-webgl.mjs.map +2 -2
- package/dist/iife/spine-webgl.js +14 -10
- 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
|
@@ -14741,10 +14741,12 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
14741
14741
|
twoColorTint = false;
|
|
14742
14742
|
renderable = new Renderable([], 0, 0);
|
|
14743
14743
|
clipper = new SkeletonClipping();
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14744
|
+
/**
|
|
14745
|
+
* Batches additive slots together with normal slots by rendering additive slots with premultiplied alpha RGB and zero alpha,
|
|
14746
|
+
* while using normal PMA blending. This reduces draw calls for normal/additive/normal sequences with the same texture.
|
|
14747
|
+
* Disable this if rendering to a transparent target and the accumulated destination alpha from additive blending must be preserved.
|
|
14748
|
+
*/
|
|
14749
|
+
pmaAdditiveBatching = true;
|
|
14748
14750
|
constructor(context, twoColorTint = true) {
|
|
14749
14751
|
this.twoColorTint = twoColorTint;
|
|
14750
14752
|
if (twoColorTint)
|
|
@@ -14823,7 +14825,9 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
14823
14825
|
finalColor.r = skeletonColor.r * slotColor.r * attachmentColor.r * alpha;
|
|
14824
14826
|
finalColor.g = skeletonColor.g * slotColor.g * attachmentColor.g * alpha;
|
|
14825
14827
|
finalColor.b = skeletonColor.b * slotColor.b * attachmentColor.b * alpha;
|
|
14826
|
-
|
|
14828
|
+
const slotBlendMode = slot.data.blendMode;
|
|
14829
|
+
const additiveBlend = this.pmaAdditiveBatching && slotBlendMode === 1 /* Additive */;
|
|
14830
|
+
finalColor.a = additiveBlend ? 0 : alpha;
|
|
14827
14831
|
const darkColor = this.tempColor2;
|
|
14828
14832
|
if (!pose.darkColor)
|
|
14829
14833
|
darkColor.set(0, 0, 0, 1);
|
|
@@ -14833,9 +14837,9 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
14833
14837
|
darkColor.b = pose.darkColor.b * alpha;
|
|
14834
14838
|
darkColor.a = 1;
|
|
14835
14839
|
}
|
|
14836
|
-
const
|
|
14837
|
-
if (
|
|
14838
|
-
blendMode =
|
|
14840
|
+
const batchBlendMode = additiveBlend ? 0 /* Normal */ : slotBlendMode;
|
|
14841
|
+
if (batchBlendMode !== blendMode) {
|
|
14842
|
+
blendMode = batchBlendMode;
|
|
14839
14843
|
batcher.setBlendMode(blendMode);
|
|
14840
14844
|
}
|
|
14841
14845
|
if (clipper.isClipping() && clipper.clipTriangles(renderable.vertices, triangles, triangles.length, uvs, finalColor, darkColor, twoColorTint, vertexSize)) {
|
|
@@ -14850,7 +14854,7 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
14850
14854
|
verts[v] = finalColor.r;
|
|
14851
14855
|
verts[v + 1] = finalColor.g;
|
|
14852
14856
|
verts[v + 2] = finalColor.b;
|
|
14853
|
-
verts[v + 3] =
|
|
14857
|
+
verts[v + 3] = finalColor.a;
|
|
14854
14858
|
verts[v + 4] = uvs[u];
|
|
14855
14859
|
verts[v + 5] = uvs[u + 1];
|
|
14856
14860
|
}
|
|
@@ -14859,7 +14863,7 @@ var SkeletonRenderer = class _SkeletonRenderer {
|
|
|
14859
14863
|
verts[v] = finalColor.r;
|
|
14860
14864
|
verts[v + 1] = finalColor.g;
|
|
14861
14865
|
verts[v + 2] = finalColor.b;
|
|
14862
|
-
verts[v + 3] =
|
|
14866
|
+
verts[v + 3] = finalColor.a;
|
|
14863
14867
|
verts[v + 4] = uvs[u];
|
|
14864
14868
|
verts[v + 5] = uvs[u + 1];
|
|
14865
14869
|
verts[v + 6] = darkColor.r;
|