فهرست منبع

[corona] Another fix for color handling in renderer.

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

+ 6 - 6
spine-corona/main.lua

@@ -75,13 +75,13 @@ function loadSkeleton(atlasFile, jsonFile, x, y, scale, animation, skin)
 	return { skeleton = skeleton, state = animationState }
 end
 
-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"))
-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("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"))
+-- 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("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 polygon = { 411, 219, 199, 230, 161, 362, 534, 407, 346, 305, 596, 265 }

+ 12 - 12
spine-corona/spine-corona/spine.lua

@@ -169,20 +169,20 @@ function spine.Skeleton:updateWorldTransform()
 			elseif attachment.type == spine.AttachmentType.clipping then
 				self.clipper:clipStart(slot, attachment)
 			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
+				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 lastColor.r == -1 then lastColor:setFrom(color) end
 				if not lastBlendMode then lastBlendMode = blendMode end