cocos2d-x-3.2 不能混合颜色修改

1.cocos/editor-support/cocostudio/CCArmature.cpp

125

bool Armature::init(const std::string& name)

{

bool bRet = false;

do

{

removeAllChildren();

CC_SAFE_DELETE(_animation);

_animation = new ArmatureAnimation();

_animation->init(this);

_boneDic.clear();

_topBoneList.clear();

- _blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;

+ _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;

_name = name;


@@ -404,13 +404,20 @@ void Armature::draw(cocos2d::Renderer *renderer, const Mat4 &transform, uint32_t

BlendFunc func = bone->getBlendFunc();

- if (func.src != _blendFunc.src || func.dst != _blendFunc.dst)

+ if (func.src != BlendFunc::ALPHA_PREMULTIPLIED.src || func.dst != BlendFunc::ALPHA_PREMULTIPLIED.dst)

{

skin->setBlendFunc(bone->getBlendFunc());

}

else

{

- skin->setBlendFunc(_blendFunc);

+ if (_blendFunc == BlendFunc::ALPHA_PREMULTIPLIED && !skin->getTexture()->hasPremultipliedAlpha())

+ {

+ skin->setBlendFunc(_blendFunc.ALPHA_NON_PREMULTIPLIED);

+ }

+ else

+ {

+ skin->setBlendFunc(_blendFunc);

+ }

}

skin->draw(renderer, transform, flags);

}


 cocos/editor-support/cocostudio/CCBone.cpp

74

// _worldTransform = AffineTransformMake(1, 0, 0, 1, 0, 0);


_worldTransform = Mat4::IDENTITY;

_boneTransformDirty = true;

- _blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;

+ _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;

_blendDirty = false;

_worldInfo = nullptr;


 cocos/editor-support/cocostudio/CCDataReaderHelper.cpp

1050

{

case BLEND_NORMAL:

{

- frameData->blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;

+ frameData->blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;

}

break;

case BLEND_ADD:

@@ -1614,8 +1614,8 @@ FrameData *DataReaderHelper::decodeFrame(const rapidjson::Value& json, DataInfo

frameData->tweenEasing = (TweenType)(DICTOOL->getIntValue_json(json, A_TWEEN_EASING, cocos2d::tweenfunc::Linear));

frameData->displayIndex = DICTOOL->getIntValue_json(json, A_DISPLAY_INDEX);

- frameData->blendFunc.src = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_SRC, BlendFunc::ALPHA_NON_PREMULTIPLIED.src));

- frameData->blendFunc.dst = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_DST, BlendFunc::ALPHA_NON_PREMULTIPLIED.dst));

+ frameData->blendFunc.src = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_SRC, BlendFunc::ALPHA_PREMULTIPLIED.src));

+ frameData->blendFunc.dst = (GLenum)(DICTOOL->getIntValue_json(json, A_BLEND_DST, BlendFunc::ALPHA_PREMULTIPLIED.dst));

frameData->isTween = DICTOOL->getBooleanValue_json(json, A_TWEEN_FRAME, true);

const char *event = DICTOOL->getStringValue_json(json, A_EVENT);

 cocos/editor-support/cocostudio/CCDatas.cpp

254

, easingParams(nullptr)

, isTween(true)

, displayIndex(0)

- , blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED)

+ , blendFunc(BlendFunc::ALPHA_PREMULTIPLIED)

, strEvent("")

, strMovement("")


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值