Преглед изворни кода

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

badlogic пре 7 година
родитељ
комит
7fba618e88

+ 2 - 2
spine-cocos2dx/src/spine/SkeletonRenderer.cpp

@@ -391,7 +391,7 @@ namespace spine {
 			
 			float alpha = nodeColor.a * _skeleton->getColor().a * slot->getColor().a * color.a * 255;
 			// skip rendering if the color of this attachment is 0
-			if (color.a == 0){
+			if (alpha == 0){
 				_clipper->clipEnd(*slot);
 				continue;
 			}
@@ -414,7 +414,7 @@ namespace spine {
 				darkColor.g = 0;
 				darkColor.b = 0;
 			}
-			darkColor.a = _premultipliedAlpha ? 255 : 0;
+			darkColor.a = darkPremultipliedAlpha;
 			
 			BlendFunc blendFunc;
 			switch (slot->getData().getBlendMode()) {

+ 0 - 2
spine-cpp/spine-cpp/include/spine/Slot.h

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

+ 1 - 5
spine-cpp/spine-cpp/src/spine/Slot.cpp

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