mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fixed colors non premultiplied also in the editor.
This commit is contained in:
parent
c43d5154da
commit
86a0950a5f
@ -163,6 +163,7 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
|||||||
|
|
||||||
private renderSkeleton (renderer: IRenderer, skeleton: Skeleton) {
|
private renderSkeleton (renderer: IRenderer, skeleton: Skeleton) {
|
||||||
let command = this.skeletonRenderer.render(skeleton);
|
let command = this.skeletonRenderer.render(skeleton);
|
||||||
|
const opacity = this.opacity;
|
||||||
const inv255 = 1 / 255;
|
const inv255 = 1 / 255;
|
||||||
while (command) {
|
while (command) {
|
||||||
const { numVertices, positions, uvs, colors, indices, numIndices, blendMode } = command;
|
const { numVertices, positions, uvs, colors, indices, numIndices, blendMode } = command;
|
||||||
@ -186,7 +187,7 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
|||||||
|
|
||||||
const color = colors[i];
|
const color = colors[i];
|
||||||
const colorDst = i * 4;
|
const colorDst = i * 4;
|
||||||
const alpha = (color >>> 24 & 0xFF) * inv255 * this.opacity;
|
const alpha = (color >>> 24 & 0xFF) * inv255 * opacity;
|
||||||
const alphaInverse = inv255 * alpha;
|
const alphaInverse = inv255 * alpha;
|
||||||
c3colors[colorDst] = (color >>> 16 & 0xFF) * alphaInverse;
|
c3colors[colorDst] = (color >>> 16 & 0xFF) * alphaInverse;
|
||||||
c3colors[colorDst + 1] = (color >>> 8 & 0xFF) * alphaInverse;
|
c3colors[colorDst + 1] = (color >>> 8 & 0xFF) * alphaInverse;
|
||||||
|
|||||||
@ -118,7 +118,7 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
|||||||
skeleton.scaleY = _inst.GetPropertyValue(PLUGIN_CLASS.PROP_SKELETON_SCALE_Y) as number;
|
skeleton.scaleY = _inst.GetPropertyValue(PLUGIN_CLASS.PROP_SKELETON_SCALE_Y) as number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const opacity = _inst.GetOpacity();
|
||||||
const cos = Math.cos(offsetAngle);
|
const cos = Math.cos(offsetAngle);
|
||||||
const sin = Math.sin(offsetAngle);
|
const sin = Math.sin(offsetAngle);
|
||||||
const inv255 = 1 / 255;
|
const inv255 = 1 / 255;
|
||||||
@ -147,10 +147,12 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
|||||||
|
|
||||||
const color = colors[i];
|
const color = colors[i];
|
||||||
const colorDst = i * 4;
|
const colorDst = i * 4;
|
||||||
c3colors[colorDst] = (color >>> 16 & 0xFF) * inv255;
|
const alpha = (color >>> 24 & 0xFF) * inv255 * opacity;
|
||||||
c3colors[colorDst + 1] = (color >>> 8 & 0xFF) * inv255;
|
const alphaInverse = inv255 * alpha;
|
||||||
c3colors[colorDst + 2] = (color & 0xFF) * inv255;
|
c3colors[colorDst] = (color >>> 16 & 0xFF) * alphaInverse;
|
||||||
c3colors[colorDst + 3] = (color >>> 24 & 0xFF) * inv255;
|
c3colors[colorDst + 1] = (color >>> 8 & 0xFF) * alphaInverse;
|
||||||
|
c3colors[colorDst + 2] = (color & 0xFF) * alphaInverse;
|
||||||
|
c3colors[colorDst + 3] = alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
iRenderer.ResetColor();
|
iRenderer.ResetColor();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user