当前位置:网站首页>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("")
边栏推荐
- flutter 混合开发 module 依赖
- MySQL高级学习笔记
- What is the difference between NFT and digital collection?
- 著名网站msdn.itellyou.cn原理分析
- GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?
- Digital twins will be an important way to enter the "metaverse"
- What is an EVM Compatible Chain?
- 2021 Mianjing - Embrace Change
- 数字取证autopsy工具用法
- CMOS管原理,及其在推挽电路中的应用
猜你喜欢
Linux中mysql密码修改方法(亲测可用)
元宇宙的前景及四大赛道
CMOS管原理,及其在推挽电路中的应用
数据库 | SQL增删改查基础语法
UiBot存在已打开的MicrosoftEdge浏览器,无法执行安装
碎片化NFT(Fractional NFT)
For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
(Crypto essential dry goods) Detailed analysis of the current NFT trading markets
MySql创建数据表
Error: Cannot find module ‘D:\Application\nodejs\node_modules\npm\bin\npm-cli.js‘
随机推荐
Attribute Changer的几种形态
Getting to know regular expressions
纯shell实现文本替换
sql 添加 default 约束
使用ps | egrep时过滤排除掉egrep自身
对js的数组的理解
mac10.14中安装mysqldb
【Elastic-Job源码分析】——作业监听器
最新MySql安装教学,非常详细
腾讯云轻量服务器删除所有防火墙规则
Build vulhub vulnerability shooting range on kali
Install mysqldb in mac10.14
了解SSRF,这一篇就足够了
常见JVM面试题及答案整理
【windows】--- SQL Server 2008 超详细安装教程
Fragmented NFT (Fractional NFT)
Access数据库的查询
mysql password modification method in Linux (pro-test available)
[Cloud native] Open source data analysis SPL easily copes with T+0
什么是 GameFi?