mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[corona] Fixed color handling in renderer.
This commit is contained in:
parent
b443e6e609
commit
14bd5ecbfe
@ -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"))
|
||||
|
||||
@ -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 = {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user