[corona] Fixed color handling in renderer.

This commit is contained in:
badlogic 2017-06-19 18:08:22 +02:00
parent b443e6e609
commit 14bd5ecbfe
2 changed files with 2 additions and 6 deletions

View File

@ -75,7 +75,6 @@ function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin)
return { skeleton = skeleton, state = animationState } return { skeleton = skeleton, state = animationState }
end 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("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("spineboy.atlas", "spineboy-ess.json", 240, 300, 0.4, "walk"))
table.insert(skeletons, loadSkeleton("raptor.atlas", "raptor-pro.json", 200, 300, 0.25, "walk")) table.insert(skeletons, loadSkeleton("raptor.atlas", "raptor-pro.json", 200, 300, 0.25, "walk"))

View File

@ -97,10 +97,7 @@ spine.Skeleton.new = function(skeletonData, group)
end end
local function colorEquals(color1, color2) local function colorEquals(color1, color2)
if not color1 and not color2 then return true end return color1.r == color2.r and color1.g == color2.g and color1.b == color2.b and color1.a == color2.a
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]
end end
local function toCoronaBlendMode(blendMode) local function toCoronaBlendMode(blendMode)
@ -193,7 +190,7 @@ function spine.Skeleton:updateWorldTransform()
if (texture ~= lastTexture or not colorEquals(color, lastColor) or blendMode ~= lastBlendMode) then if (texture ~= lastTexture or not colorEquals(color, lastColor) or blendMode ~= lastBlendMode) then
self:flush(groupVertices, groupUvs, groupIndices, lastTexture, lastColor, lastBlendMode, drawingGroup) self:flush(groupVertices, groupUvs, groupIndices, lastTexture, lastColor, lastBlendMode, drawingGroup)
lastTexture = texture lastTexture = texture
lastColor = color lastColor:setFrom(color)
lastBlendMode = blendMode lastBlendMode = blendMode
groupVertices = {} groupVertices = {}
groupUvs = {} groupUvs = {}