mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[cocos2dx] Fixes tint black.
This commit is contained in:
commit
f033239b54
@ -60,6 +60,8 @@ bool AppDelegate::applicationDidFinishLaunching () {
|
|||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
auto glview = director->getOpenGLView();
|
auto glview = director->getOpenGLView();
|
||||||
if (!glview) {
|
if (!glview) {
|
||||||
|
GLContextAttrs attrs = { 8, 8, 8, 8, 0, 0 };
|
||||||
|
GLView::setGLContextAttrs(attrs);
|
||||||
glview = GLViewImpl::create("Spine Example");
|
glview = GLViewImpl::create("Spine Example");
|
||||||
director->setOpenGLView(glview);
|
director->setOpenGLView(glview);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -389,27 +389,32 @@ namespace spine {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slot->hasDarkColor()) {
|
float alpha = nodeColor.a * _skeleton->getColor().a * slot->getColor().a * color.a * 255;
|
||||||
darkColor.r = slot->getDarkColor().r * 255;
|
|
||||||
darkColor.g = slot->getDarkColor().g * 255;
|
|
||||||
darkColor.b = slot->getDarkColor().b * 255;
|
|
||||||
} else {
|
|
||||||
darkColor.r = 0;
|
|
||||||
darkColor.g = 0;
|
|
||||||
darkColor.b = 0;
|
|
||||||
}
|
|
||||||
darkColor.a = darkPremultipliedAlpha;
|
|
||||||
|
|
||||||
color.a *= nodeColor.a * _skeleton->getColor().a * slot->getColor().a * 255;
|
|
||||||
// skip rendering if the color of this attachment is 0
|
// skip rendering if the color of this attachment is 0
|
||||||
if (color.a == 0){
|
if (color.a == 0){
|
||||||
_clipper->clipEnd(*slot);
|
_clipper->clipEnd(*slot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float multiplier = _premultipliedAlpha ? color.a : 255;
|
float multiplier = _premultipliedAlpha ? alpha : 255;
|
||||||
color.r *= nodeColor.r * _skeleton->getColor().r * slot->getColor().r * multiplier;
|
float red = nodeColor.r * _skeleton->getColor().r * slot->getColor().r * multiplier;
|
||||||
color.g *= nodeColor.g * _skeleton->getColor().g * slot->getColor().g * multiplier;
|
float green = nodeColor.g * _skeleton->getColor().g * slot->getColor().g * multiplier;
|
||||||
color.b *= nodeColor.b * _skeleton->getColor().b * slot->getColor().b * multiplier;
|
float blue = nodeColor.b * _skeleton->getColor().b * slot->getColor().b * multiplier;
|
||||||
|
|
||||||
|
color.r = red * color.r;
|
||||||
|
color.g = green * color.g;
|
||||||
|
color.b = blue * color.b;
|
||||||
|
color.a = alpha;
|
||||||
|
|
||||||
|
if (slot->hasDarkColor()) {
|
||||||
|
darkColor.r = red * slot->getDarkColor().r;
|
||||||
|
darkColor.g = green * slot->getDarkColor().g;
|
||||||
|
darkColor.b = blue * slot->getDarkColor().b;
|
||||||
|
} else {
|
||||||
|
darkColor.r = 0;
|
||||||
|
darkColor.g = 0;
|
||||||
|
darkColor.b = 0;
|
||||||
|
}
|
||||||
|
darkColor.a = _premultipliedAlpha ? 255 : 0;
|
||||||
|
|
||||||
BlendFunc blendFunc;
|
BlendFunc blendFunc;
|
||||||
switch (slot->getData().getBlendMode()) {
|
switch (slot->getData().getBlendMode()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user