فهرست منبع

[corona] Fixed color handling in renderer.

badlogic 8 سال پیش
والد
کامیت
14bd5ecbfe
2فایلهای تغییر یافته به همراه2 افزوده شده و 6 حذف شده
  1. 0 1
      spine-corona/main.lua
  2. 2 5
      spine-corona/spine-corona/spine.lua

+ 0 - 1
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"))

+ 2 - 5
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 = {}