From 14bd5ecbfe43eced123f3598d2504a0ce6b12f63 Mon Sep 17 00:00:00 2001 From: badlogic Date: Mon, 19 Jun 2017 18:08:22 +0200 Subject: [PATCH] [corona] Fixed color handling in renderer. --- spine-corona/main.lua | 1 - spine-corona/spine-corona/spine.lua | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/spine-corona/main.lua b/spine-corona/main.lua index c8660e877..24c332476 100644 --- a/spine-corona/main.lua +++ b/spine-corona/main.lua @@ -75,7 +75,6 @@ function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin) return { skeleton = skeleton, state = animationState } end --- table.insert(skeletons, loadSkeleton("test.atlas", "test.json", 240, 300, 0.4, "animation")) table.insert(skeletons, loadSkeleton("coin.atlas", "coin-pro.json", 240, 300, 0.4, "rotate")) table.insert(skeletons, loadSkeleton("spineboy.atlas", "spineboy-ess.json", 240, 300, 0.4, "walk")) table.insert(skeletons, loadSkeleton("raptor.atlas", "raptor-pro.json", 200, 300, 0.25, "walk")) diff --git a/spine-corona/spine-corona/spine.lua b/spine-corona/spine-corona/spine.lua index 95571d0ff..5a0b2aa01 100644 --- a/spine-corona/spine-corona/spine.lua +++ b/spine-corona/spine-corona/spine.lua @@ -97,10 +97,7 @@ spine.Skeleton.new = function(skeletonData, group) end local function colorEquals(color1, color2) - if not color1 and not color2 then return true end - if not color1 and color2 then return false end - if color1 and not color2 then return false end - return color1[1] == color2[1] and color1[2] == color2[2] and color1[3] == color2[3] and color1[4] == color2[4] + return color1.r == color2.r and color1.g == color2.g and color1.b == color2.b and color1.a == color2.a end local function toCoronaBlendMode(blendMode) @@ -193,7 +190,7 @@ function spine.Skeleton:updateWorldTransform() if (texture ~= lastTexture or not colorEquals(color, lastColor) or blendMode ~= lastBlendMode) then self:flush(groupVertices, groupUvs, groupIndices, lastTexture, lastColor, lastBlendMode, drawingGroup) lastTexture = texture - lastColor = color + lastColor:setFrom(color) lastBlendMode = blendMode groupVertices = {} groupUvs = {}