diff --git a/spine-cocos2d-iphone/3.0/src/spine/SkeletonRenderer.m b/spine-cocos2d-iphone/3.0/src/spine/SkeletonRenderer.m index 22bbb9244..47f0415f1 100755 --- a/spine-cocos2d-iphone/3.0/src/spine/SkeletonRenderer.m +++ b/spine-cocos2d-iphone/3.0/src/spine/SkeletonRenderer.m @@ -199,12 +199,18 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0}; [self setBlendMode:[CCBlendMode blendModeWithOptions:@{CCBlendFuncSrcColor: @(_blendFunc.src),CCBlendFuncDstColor: @(slot->data->additiveBlending ? GL_ONE : _blendFunc.dst)}]]; additive = slot->data->additiveBlending; } - color.a = _skeleton->a * slot->a * a * 255; - float multiplier = _premultipliedAlpha ? color.a : 255; - color.r = _skeleton->r * slot->r * r * multiplier; - color.g = _skeleton->g * slot->g * g * multiplier; - color.b = _skeleton->b * slot->b * b * multiplier; - self.texture = texture; + if (_premultipliedAlpha) { + a *= _skeleton->a * slot->a; + r *= _skeleton->r * slot->r * a; + g *= _skeleton->g * slot->g * a; + b *= _skeleton->b * slot->b * a; + } else { + a *= _skeleton->a * slot->a; + r *= _skeleton->r * slot->r; + g *= _skeleton->g * slot->g; + b *= _skeleton->b * slot->b; + } + self.texture = texture; CGSize size = texture.contentSize; GLKVector2 center = GLKVector2Make(size.width / 2.0, size.height / 2.0); GLKVector2 extents = GLKVector2Make(size.width / 2.0, size.height / 2.0); @@ -213,7 +219,7 @@ static const int quadTriangles[6] = {0, 1, 2, 2, 3, 0}; for (int i = 0; i * 2 < verticesCount; ++i) { CCVertex vertex; vertex.position = GLKVector4Make(worldVertices[i * 2], worldVertices[i * 2 + 1], 0.0, 1.0); - vertex.color = GLKVector4Make(color.r, color.g, color.b, color.a); + vertex.color = GLKVector4Make(r, g, b, a); vertex.texCoord1 = GLKVector2Make(uvs[i * 2], 1 - uvs[i * 2 + 1]); CCRenderBufferSetVertex(buffer, i, CCVertexApplyTransform(vertex, transform)); }