当前位置:网站首页>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("")
边栏推荐
- leetcode-1833. 雪糕的最大数量(排序+贪心)
- Digital twins will be an important way to enter the "metaverse"
- C language tutorial (3) - if and loop
- MySQL错误-this is incompatible with sql_mode=only_full_group_by完美解决方案
- Attribute Changer的几种形态
- Build DVWA with phpstudy
- cocos2d-x 实现跨平台的目录遍历
- GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?
- flutter 混合开发 module 依赖
- About integrating superset into your own project
猜你喜欢

Take you to understand the MySQL isolation level, what happens when two transactions operate on the same row of data at the same time?

Yuan prospect and four track of the universe
Getting to know regular expressions

GUCCI, LV and other luxury giant universe how to layout yuan, other brands should keep up with?

Gradle sync failed: Uninitialized object exists on backward branch 142

Powershell中UTF-8环境中文乱码解决办法

feign调用不通问题,JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r

MySQL-如何分库分表?一看就懂

CMOS管原理,及其在推挽电路中的应用

What is an EVM Compatible Chain?
随机推荐
【uiautomation】微信好友列表获取(存储到txt中)
代码块、Package,Import,封装(第六天)
【云原生】原来2020.0.X版本开始的OpenFeign底层不再使用Ribbon了
For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
The server time zone value ‘й‘ is unrecognized or represents more than one time zone
纯shell实现文本替换
一个简单的bash转powershell案例
Build vulhub vulnerability shooting range on kali
永恒之蓝漏洞复现
Getting to know regular expressions
The MySQL database in Alibaba Cloud was attacked, and the data was finally recovered
What is an EVM Compatible Chain?
MySql to create data tables
PHP中abstract(抽象)、final(最终)和static(静态)原理与用法
Attribute Changer的几种形态
SSH自动重连脚本
Linux修改MySQL数据库密码
vulhub靶场学习日记hackme2
正则表达式基础知识
对js的数组的理解