[cpp] Fixed bug in handling of dark colors on load.

This commit is contained in:
badlogic 2018-08-13 17:21:24 +02:00
parent f033239b54
commit 7fba618e88
3 changed files with 3 additions and 9 deletions

View File

@ -391,7 +391,7 @@ namespace spine {
float alpha = nodeColor.a * _skeleton->getColor().a * slot->getColor().a * color.a * 255; float alpha = nodeColor.a * _skeleton->getColor().a * slot->getColor().a * color.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 (alpha == 0){
_clipper->clipEnd(*slot); _clipper->clipEnd(*slot);
continue; continue;
} }
@ -414,7 +414,7 @@ namespace spine {
darkColor.g = 0; darkColor.g = 0;
darkColor.b = 0; darkColor.b = 0;
} }
darkColor.a = _premultipliedAlpha ? 255 : 0; darkColor.a = darkPremultipliedAlpha;
BlendFunc blendFunc; BlendFunc blendFunc;
switch (slot->getData().getBlendMode()) { switch (slot->getData().getBlendMode()) {

View File

@ -100,8 +100,6 @@ public:
bool hasDarkColor(); bool hasDarkColor();
void setHasDarkColor(bool inValue);
/// May be NULL. /// May be NULL.
Attachment *getAttachment(); Attachment *getAttachment();

View File

@ -47,7 +47,7 @@ Slot::Slot(SlotData &data, Bone &bone) :
_skeleton(bone.getSkeleton()), _skeleton(bone.getSkeleton()),
_color(1, 1, 1, 1), _color(1, 1, 1, 1),
_darkColor(0, 0, 0, 0), _darkColor(0, 0, 0, 0),
_hasDarkColor(false), _hasDarkColor(data.hasDarkColor()),
_attachment(NULL), _attachment(NULL),
_attachmentTime(0) { _attachmentTime(0) {
setToSetupPose(); setToSetupPose();
@ -89,10 +89,6 @@ bool Slot::hasDarkColor() {
return _hasDarkColor; return _hasDarkColor;
} }
void Slot::setHasDarkColor(bool inValue) {
_hasDarkColor = inValue;
}
Attachment *Slot::getAttachment() { Attachment *Slot::getAttachment() {
return _attachment; return _attachment;
} }