mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[corona] Another fix for color handling in renderer.
This commit is contained in:
parent
14bd5ecbfe
commit
add46aeda6
@ -75,13 +75,13 @@ 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("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"))
|
||||||
table.insert(skeletons, loadSkeleton("goblins.atlas", "goblins-pro.json", 240, 300, 0.8, "walk", "goblin"))
|
-- table.insert(skeletons, loadSkeleton("goblins.atlas", "goblins-pro.json", 240, 300, 0.8, "walk", "goblin"))
|
||||||
table.insert(skeletons, loadSkeleton("stretchyman.atlas", "stretchyman-pro.json", 40, 300, 0.5, "sneak"))
|
-- table.insert(skeletons, loadSkeleton("stretchyman.atlas", "stretchyman-pro.json", 40, 300, 0.5, "sneak"))
|
||||||
table.insert(skeletons, loadSkeleton("tank.atlas", "tank-pro.json", 400, 300, 0.2, "drive"))
|
table.insert(skeletons, loadSkeleton("tank.atlas", "tank-pro.json", 400, 300, 0.2, "drive"))
|
||||||
table.insert(skeletons, loadSkeleton("vine.atlas", "vine-pro.json", 240, 300, 0.3, "grow"))
|
-- table.insert(skeletons, loadSkeleton("vine.atlas", "vine-pro.json", 240, 300, 0.3, "grow"))
|
||||||
|
|
||||||
local triangulator = spine.Triangulator.new()
|
local triangulator = spine.Triangulator.new()
|
||||||
local polygon = { 411, 219, 199, 230, 161, 362, 534, 407, 346, 305, 596, 265 }
|
local polygon = { 411, 219, 199, 230, 161, 362, 534, 407, 346, 305, 596, 265 }
|
||||||
|
|||||||
@ -169,20 +169,20 @@ function spine.Skeleton:updateWorldTransform()
|
|||||||
elseif attachment.type == spine.AttachmentType.clipping then
|
elseif attachment.type == spine.AttachmentType.clipping then
|
||||||
self.clipper:clipStart(slot, attachment)
|
self.clipper:clipStart(slot, attachment)
|
||||||
end
|
end
|
||||||
|
|
||||||
local skeleton = slot.bone.skeleton
|
|
||||||
local skeletonColor = skeleton.color
|
|
||||||
local slotColor = slot.color
|
|
||||||
local attachmentColor = attachment.color
|
|
||||||
local alpha = skeletonColor.a * slotColor.a * attachmentColor.a
|
|
||||||
local multiplier = alpha
|
|
||||||
if premultipliedAlpha then multiplier = 1 end
|
|
||||||
color:set(skeletonColor.r * slotColor.r * attachmentColor.r * multiplier,
|
|
||||||
skeletonColor.g * slotColor.g * attachmentColor.g * multiplier,
|
|
||||||
skeletonColor.b * slotColor.b * attachmentColor.b * multiplier,
|
|
||||||
alpha)
|
|
||||||
|
|
||||||
if texture and vertices and indices then
|
if texture and vertices and indices then
|
||||||
|
local skeleton = slot.bone.skeleton
|
||||||
|
local skeletonColor = skeleton.color
|
||||||
|
local slotColor = slot.color
|
||||||
|
local attachmentColor = attachment.color
|
||||||
|
local alpha = skeletonColor.a * slotColor.a * attachmentColor.a
|
||||||
|
local multiplier = alpha
|
||||||
|
if premultipliedAlpha then multiplier = 1 end
|
||||||
|
color:set(skeletonColor.r * slotColor.r * attachmentColor.r * multiplier,
|
||||||
|
skeletonColor.g * slotColor.g * attachmentColor.g * multiplier,
|
||||||
|
skeletonColor.b * slotColor.b * attachmentColor.b * multiplier,
|
||||||
|
alpha)
|
||||||
|
|
||||||
if not lastTexture then lastTexture = texture end
|
if not lastTexture then lastTexture = texture end
|
||||||
if lastColor.r == -1 then lastColor:setFrom(color) end
|
if lastColor.r == -1 then lastColor:setFrom(color) end
|
||||||
if not lastBlendMode then lastBlendMode = blendMode end
|
if not lastBlendMode then lastBlendMode = blendMode end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user