当前位置:网站首页>cocos2d-x-3.2 不能混合颜色修改
cocos2d-x-3.2 不能混合颜色修改
2022-07-31 05:15:00 【xuyid】
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);
2 cocos/editor-support/cocostudio/CCDatas.cpp
254行
, easingParams(nullptr)
, isTween(true)
, displayIndex(0)
- , blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED)
+ , blendFunc(BlendFunc::ALPHA_PREMULTIPLIED)
, strEvent("")
, strMovement("")
边栏推荐
- sql 添加 default 约束
- Artifact SSMwar exploded Error deploying artifact.See server log for details
- 【Elastic-Job源码分析】——作业监听器
- mysql password modification method in Linux (pro-test available)
- 什么是 GameFi?
- SQLite 查询表中每天插入的数量
- Three-party login using wallet Metamask based on web3.0
- DeFi Token in the project management
- [Ubuntu20.04 installs MySQL and MySQL-workbench visualization tool]
- Understanding SSRF, this article is enough
猜你喜欢
随机推荐
Redis:安装使用
[Cloud native] Simple introduction and use of microservice Nacos
Artifact SSMwar exploded Error deploying artifact.See server log for details
Access database query
this指向问题
对于输出点是时间戳的渗透测试方法(以Oracle数据库为例)
(Crypto必备干货)详细分析目前NFT的几大交易市场
(Crypto essential dry goods) Detailed analysis of the current NFT trading markets
[Elastic-Job] Overview of Distributed Scheduling Tasks
腾讯云轻量服务器删除所有防火墙规则
了解SSRF,这一篇就足够了
Linux modify MySQL database password
小米手机短信定位服务激活失败
数字孪生将成为进入“元宇宙”一项重要的途径
Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'
cocos2d-x-3.2 Physics
Hyper-V新建虚拟机注意事项
UiBot存在已打开的MicrosoftEdge浏览器,无法执行安装
About integrating superset into your own project
2021年京东数据分析工程师秋招笔试编程题







![[JVM Loading]---Class Loading Mechanism](/img/b6/d1754cb6699d18602ca9a463571c0c.png)
