当前位置:网站首页>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("")
边栏推荐
猜你喜欢
场效应管 | N-mos内部结构详解
this指向问题
永恒之蓝漏洞复现
计网 Packet Tracer仿真 | 简单易懂集线器和交换机对比(理论+仿真)
Linux中mysql密码修改方法(亲测可用)
leetcode-1833. 雪糕的最大数量(排序+贪心)
CMOS管原理,及其在推挽电路中的应用
[Ubuntu20.04 installs MySQL and MySQL-workbench visualization tool]
MySQL compressed package installation, fool teaching
Error: Cannot find module 'D:\Application\nodejs\node_modules\npm\bin\npm-cli.js'
随机推荐
C语言 | 获取字符串里逗号间隔的内容
Digital twins will be an important way to enter the "metaverse"
js中的函数
对于输出点是时间戳的渗透测试方法(以Oracle数据库为例)
configure:error no SDL library found
[Cloud native] Ribbon is no longer used at the bottom layer of OpenFeign starting from the 2020.0.X version
mysql启动报错The server quit without updating PID file几种解决办法
通信原理——纠错编码 | 汉明码(海明码)手算详解
About integrating superset into your own project
quick-3.5 ActionTimeline的setLastFrameCallFunc调用会崩溃问题
js中的全局作用域与函数作用域
使用ps | egrep时过滤排除掉egrep自身
带你搞懂MySQL隔离级别,两个事务同时操作同一行数据会怎样?
常见JVM面试题及答案整理
vulhub靶场学习日记xxe-lab
腾讯云轻量服务器删除所有防火墙规则
Hyper-V新建虚拟机注意事项
mac10.14中安装mysqldb
MySQL compressed package installation, fool teaching
GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?