mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fixed color blending.
This commit is contained in:
parent
5ffee20f53
commit
f915a6c777
@ -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));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user