pixi-spine
Advanced tools
Comparing version 1.5.7 to 1.5.9
@@ -1231,3 +1231,2 @@ /// <reference types="pixi.js" /> | ||
region: core.TextureRegion; | ||
constructor(tex: PIXI.Texture); | ||
} | ||
@@ -1266,3 +1265,4 @@ class SpineMesh extends PIXI.mesh.Mesh { | ||
newMesh(texture: PIXI.Texture, vertices?: Float32Array, uvs?: Float32Array, indices?: Uint16Array, drawMode?: number): SpineMesh; | ||
transformHack(): number; | ||
} | ||
} |
{ | ||
"name": "pixi-spine", | ||
"version": "1.5.7", | ||
"version": "1.5.9", | ||
"description": "Spine implementation for pixi v^3 and v^4", | ||
@@ -5,0 +5,0 @@ "author": "Mat Groves", |
@@ -10,7 +10,3 @@ /// <reference types="pixi.js" /> | ||
export class SpineSprite extends PIXI.Sprite { | ||
region: core.TextureRegion; | ||
constructor(tex: PIXI.Texture) { | ||
super(tex); | ||
} | ||
region: core.TextureRegion = null; | ||
} | ||
@@ -194,6 +190,15 @@ | ||
let r0 = this.tintRgb[0]; | ||
let g0 = this.tintRgb[1]; | ||
let b0 = this.tintRgb[2]; | ||
// in case pixi has double tint | ||
let globalClr = (this as any).color; | ||
let light: ArrayLike<number> = null, dark: ArrayLike<number> = null; | ||
if (globalClr) { | ||
light = globalClr.light; | ||
dark = globalClr.dark; | ||
} else { | ||
light = this.tintRgb; | ||
} | ||
let thack = PIXI.TransformBase && (this.transformHack() == 1); | ||
for (let i = 0, n = slots.length; i < n; i++) { | ||
@@ -209,2 +214,4 @@ let slot = slots[i]; | ||
let spriteColor: any = null; | ||
let attColor = (attachment as any).color; | ||
@@ -251,3 +258,3 @@ if (attachment instanceof core.RegionAttachment) { | ||
} else { | ||
if (PIXI.TransformBase) { | ||
if (thack) { | ||
if (transAny.position) { | ||
@@ -275,6 +282,11 @@ transform = new PIXI.TransformBase(); | ||
} | ||
tempRgb[0] = r0 * slot.color.r * attColor.r; | ||
tempRgb[1] = g0 * slot.color.g * attColor.g; | ||
tempRgb[2] = b0 * slot.color.b * attColor.b; | ||
slot.currentSprite.tint = PIXI.utils.rgb2hex(tempRgb); | ||
if (slot.currentSprite.color) { | ||
//YAY! double - tint! | ||
spriteColor = slot.currentSprite.color; | ||
} else { | ||
tempRgb[0] = light[0] * slot.color.r * attColor.r; | ||
tempRgb[1] = light[1] * slot.color.g * attColor.g; | ||
tempRgb[2] = light[2] * slot.color.b * attColor.b; | ||
slot.currentSprite.tint = PIXI.utils.rgb2hex(tempRgb); | ||
} | ||
slot.currentSprite.blendMode = slot.blendMode; | ||
@@ -317,3 +329,5 @@ } | ||
(attachment as core.VertexAttachment).computeWorldVerticesOld(slot, slot.currentMesh.vertices); | ||
if (PIXI.VERSION[0] !== '3') { | ||
if (slot.currentMesh.color) { | ||
spriteColor = slot.currentMesh.color; | ||
} else if (PIXI.VERSION[0] !== '3') { | ||
// PIXI version 4 | ||
@@ -323,5 +337,5 @@ // slot.currentMesh.dirty++; | ||
let tintRgb = slot.currentMesh.tintRgb; | ||
tintRgb[0] = r0 * slot.color.r * attColor.r; | ||
tintRgb[1] = g0 * slot.color.g * attColor.g; | ||
tintRgb[2] = b0 * slot.color.b * attColor.b; | ||
tintRgb[0] = light[0] * slot.color.r * attColor.r; | ||
tintRgb[1] = light[1] * slot.color.g * attColor.g; | ||
tintRgb[2] = light[2] * slot.color.b * attColor.b; | ||
} | ||
@@ -344,6 +358,33 @@ slot.currentMesh.blendMode = slot.blendMode; | ||
// pixi has double tint | ||
if (spriteColor) { | ||
let r0 = slot.color.r * attColor.r; | ||
let g0 = slot.color.g * attColor.g; | ||
let b0 = slot.color.b * attColor.b; | ||
//YAY! double-tint! | ||
spriteColor.setLight( | ||
light[0] * r0 + dark[0] * (1.0 - r0), | ||
light[1] * g0 + dark[1] * (1.0 - g0), | ||
light[2] * b0 + dark[2] * (1.0 - b0), | ||
); | ||
if (slot.darkColor) { | ||
r0 = slot.darkColor.r; | ||
g0 = slot.darkColor.g; | ||
b0 = slot.darkColor.b; | ||
} else { | ||
r0 = 0.0; | ||
g0 = 0.0; | ||
b0 = 0.0; | ||
} | ||
spriteColor.setDark( | ||
light[0] * r0 + dark[0] * (1 - r0), | ||
light[1] * g0 + dark[1] * (1 - g0), | ||
light[2] * b0 + dark[2] * (1 - b0), | ||
); | ||
} | ||
slotContainer.alpha = slot.color.a; | ||
} | ||
//== this is clipping implementation === | ||
@@ -605,2 +646,6 @@ //TODO: remove parent hacks when pixi masks allow it | ||
} | ||
transformHack() { | ||
return 1; | ||
} | ||
} | ||
@@ -607,0 +652,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1565817
16492