浏览代码

[cocos2d-x] Not submitting geometry when final opacity of attachment is 0

badlogic 8 年之前
父节点
当前提交
6e7c6ebc07
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      spine-cocos2dx/src/spine/SkeletonRenderer.cpp

+ 3 - 0
spine-cocos2dx/src/spine/SkeletonRenderer.cpp

@@ -281,6 +281,9 @@ void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t
 		}
 		}
 		
 		
 		color.a *= nodeColor.a * _skeleton->color.a * slot->color.a * 255;
 		color.a *= nodeColor.a * _skeleton->color.a * slot->color.a * 255;
+		// skip rendering if the color of this attachment is 0
+		if (color.a == 0)
+			continue;
 		float multiplier = _premultipliedAlpha ? color.a : 255;
 		float multiplier = _premultipliedAlpha ? color.a : 255;
 		color.r *= nodeColor.r * _skeleton->color.r * slot->color.r * multiplier;
 		color.r *= nodeColor.r * _skeleton->color.r * slot->color.r * multiplier;
 		color.g *= nodeColor.g * _skeleton->color.g * slot->color.g * multiplier;
 		color.g *= nodeColor.g * _skeleton->color.g * slot->color.g * multiplier;