diff --git a/spine-ts/spine-pixi/example/darktint.html b/spine-ts/spine-pixi/example/darktint.html index aa7c0e5bde..189ac0a465 100644 --- a/spine-ts/spine-pixi/example/darktint.html +++ b/spine-ts/spine-pixi/example/darktint.html @@ -29,8 +29,8 @@ document.body.appendChild(app.view); - // const orange = "-pma"; - const orange = ""; + const orange = "-pma"; + // const orange = ""; PIXI.Assets.add("spineboyData", `./assets/orange${orange}.json`); PIXI.Assets.add("spineboyAtlas", `./assets/orange${orange}.atlas`); await PIXI.Assets.load(["spineboyData", "spineboyAtlas"]); diff --git a/spine-ts/spine-pixi/src/assets/atlasLoader.ts b/spine-ts/spine-pixi/src/assets/atlasLoader.ts index 22c1ecb96e..31dd5b9fd5 100644 --- a/spine-ts/spine-pixi/src/assets/atlasLoader.ts +++ b/spine-ts/spine-pixi/src/assets/atlasLoader.ts @@ -109,7 +109,7 @@ const spineTextureAtlasLoader: AssetExtension(assetsToLoadIn) .then((texture) => { page.setTexture(SpineTexture.from(texture.baseTexture)); diff --git a/spine-ts/spine-pixi/src/darkTintMesh/DarkTintRenderer.ts b/spine-ts/spine-pixi/src/darkTintMesh/DarkTintRenderer.ts index af73dea64f..dd467c6468 100644 --- a/spine-ts/spine-pixi/src/darkTintMesh/DarkTintRenderer.ts +++ b/spine-ts/spine-pixi/src/darkTintMesh/DarkTintRenderer.ts @@ -70,7 +70,7 @@ void main(void){ gl_FragColor.a = color.a * vColor.a; - gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb * gl_FragColor.a + color.rgb * vColor.rgb; + gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb + color.rgb * vColor.rgb; } `; @@ -96,9 +96,12 @@ export class DarkTintRenderer extends BatchRenderer { const vertexData = element.vertexData; const textureId = element._texture.baseTexture._batchLocation; const alpha = Math.min(element.worldAlpha, 1.0); - const argb = Color.shared.setValue(element._tintRGB).toPremultiplied(alpha, (element._texture.baseTexture.alphaMode ?? 0) > 0); + const alphaInt = Math.round(alpha * 255) & 0xFF; + const tintRGB = element._tintRGB & 0xFFFFFF; + const argb = (alphaInt << 24) | tintRGB; const darkargb = element._darkTintRGB; + // lets not worry about tint! for now.. for (let i = 0; i < vertexData.length; i += 2) { float32View[aIndex++] = vertexData[i];