当前位置:网站首页>quick-3.6源码修改纪录
quick-3.6源码修改纪录
2022-07-31 05:15:00 【xuyid】
1.CCSprite.cpp第158行改为
bool Sprite::initWithFile(const std::string& filename)
{CCASSERT(filename.size()>0, "Invalid filename for sprite");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
if (texture)
{
Rect rect = Rect::ZERO;
rect.size = texture->getContentSize();
return initWithTexture(texture, rect);
}
else
{
Rect rect = Rect::ZERO;
texture = Director::getInstance()->getTextureCache()->addImage("picnull.png");
rect.size = texture->getContentSize();
return initWithTexture(texture, rect);
}
// don't release here.
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
// this->release();
return false;
}
bool Sprite::initWithFile(const std::string &filename, const Rect& rect)
{
CCASSERT(filename.size()>0, "Invalid filename");
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
if (texture)
{
return initWithTexture(texture, rect);
}
else
{
Rect rect = Rect::ZERO;
texture = Director::getInstance()->getTextureCache()->addImage("picnull.png");
rect.size = texture->getContentSize();
return initWithTexture(texture, rect);
}
// don't release here.
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
// this->release();
return false;
}
2.CCLabel.cpp第903行
if (_currLabelEffect == LabelEffect::OUTLINE || _currLabelEffect == LabelEffect::GLOW)
{
glprogram->setUniformLocationWith4f(_uniformEffectColor,
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
}
3.lua_cocos2dx_studio_auto.cpp 第21271行
#include "CocoStudio.h"
#include "CCLuaEngine.h"
int lua_cocos2dx_studio_ActionTimeline_setLastFrameCallFunc(lua_State* tolua_S)
{
if (nullptr == tolua_S)
return 0;
int argc = 0;
cocostudio::timeline::ActionTimeline* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(tolua_S,1,"ccs.ActionTimeline",0,&tolua_err)) goto tolua_lerror;
#endif
self = static_cast<cocostudio::timeline::ActionTimeline*>(tolua_tousertype(tolua_S,1,0));
#if COCOS2D_DEBUG >= 1
if (nullptr == self) {
tolua_error(tolua_S,"invalid 'self' in function 'lua_cocos2dx_ActionTimeline_setLastFrameCallFunc'\n", NULL);
return 0;
}
#endif
argc = lua_gettop(tolua_S) - 1;
if (1 == argc)
{
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,2,"LUA_FUNCTION",0,&tolua_err) )
{
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = ( toluafix_ref_function(tolua_S,2,0));
self->setLastFrameCallFunc([=](){
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 0);
});
return 0;
}
luaL_error(tolua_S, "'setLastFrameCallFunc' function of ActionTimeline has wrong number of arguments: %d, was expecting %d\n", argc, 1);
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'setLastFrameCallFunc'.",&tolua_err);
#endif
return 0;
}
doAnimationWhenKeyboardMoveWithDuration
4.cocos_libs/ platform/ios/CCEAGLView-ios.mm 862行doAnimationWhenKeyboardMoveWithDuration方法dis = 0;
5.调用display.captureScreen出现崩溃问题,utils类替换3.8版本的
6.TextReader.cpp替换回3.5版本的
7.ActionTimeline.cpp194行step方法替换3.5版本的
8.3d模型透贴问题修改:rag
在ccShader_3D_ColorTex.frag和ccShader_3D_ColorNormalTex.frag中的main里面添加
vec4 albedo = texture2D(CC_Texture0, TextureCoordOut);
if(albedo.a < 1.0/255.0) discard;
9.3d模型骨骼绑定的物品会跟随旋转的问题修改:
const Mat4& AttachNode::getNodeToParentTransform() const
{
Node::getNodeToParentTransform();
Mat4 mat = _attachBone->getWorldMat();
Vec3 scale, translation;
Quaternion rot;
mat.decompose(&scale, &rot, &translation);
Mat4::createTranslation(translation, &mat);
_transformToParent = mat * _transform;
return _transformToParent;
}
10.3d动作播放一半切换动作卡顿问题修改
在Animate3D.cpp的void Animate3D::startWithTarget(Node *target)第247行增加s_runningAnimates.erase(target);
11.修复anroid使用PUParticleSystem3D并且是热更新的话,会出现读取不到.material文件的bug
找到CCPUTranslateManager.cpp文件的loadMaterialsFromSearchPaths方法注释掉下面方法
// std::string::size_type pos = fileFolder.find("assets/");
// std::string relativePath = fileFolder;
// if (pos != std::string::npos) {
// // "assets/" is at the beginning of the path and we don't want it
// relativePath = fileFolder.substr(pos + strlen("assets/"));
// }
// AAssetDir *dir = AAssetManager_openDir(FileUtilsAndroid::getAssetManager(), relativePath.c_str());
// const char *fileName = nullptr;
// std::string seg("/");
// while ((fileName = AAssetDir_getNextFileName(dir)) != nullptr)
// {
// std::string fullpath = fileFolder + seg + std::string(fileName);
// loadMaterials(fullpath);
// }
// AAssetDir_close(dir);
改为
DIR *d; //dir handle
struct dirent *file; //readdir
struct stat statbuf;
if(!(d = opendir(fileFolder.c_str())))
{
CCLOG("error opendir %s!!!\n",fileFolder.c_str());
return false;
}
while((file = readdir(d)) != NULL)
{
if(strncmp(file->d_name, ".", 1) == 0 || (stat(file->d_name, &statbuf) >= 0 && S_ISDIR(statbuf.st_mode)))
{
continue;
}
std::string fullpath = fileFolder + "/" + file->d_name;
if (strlen(file->d_name) > 9 && (strcmp(".material", file->d_name + strlen(file->d_name) - 9) == 0))
{
CCLOG("%s", fullpath.c_str());
loadMaterials(fullpath);
state = true;
}
}
closedir(d);
并且加上头文件
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
12.修改CCFontAtlas文件的第37行
const int FontAtlas::CacheTextureWidth = 256;
const int FontAtlas::CacheTextureHeight = 256;
13.修改TextureCache文件316行
Texture2D * TextureCache::addImage(const std::string &path)
{
Texture2D * texture = nullptr;
Image* image = nullptr;
// Split up directory and filename
// MUTEX:
// Needed since addImageAsync calls this method from a different thread
std::string fullpath = FileUtils::getInstance()->fullPathForFilename(path);
if (fullpath.size() == 0)
{
return nullptr;
}
Texture2D::PixelFormat curFormat = Texture2D::getDefaultAlphaPixelFormat();
auto pos = fullpath.find_last_of(".");
string fileFormatName = fullpath.substr(pos + 1);
if(fileFormatName == "jpg"){
Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGB565);
}
auto it = _textures.find(fullpath);
if( it != _textures.end() )
texture = it->second;
if (! texture)
{
// all images are handled by UIImage except PVR extension that is handled by our own handler
do
{
image = new (std::nothrow) Image();
CC_BREAK_IF(nullptr == image);
bool bRet = image->initWithImageFile(fullpath);
CC_BREAK_IF(!bRet);
texture = new (std::nothrow) Texture2D();
if( texture && texture->initWithImage(image) )
{
#if CC_ENABLE_CACHE_TEXTURE_DATA
// cache the texture file name
VolatileTextureMgr::addImageTexture(texture, fullpath);
#endif
// texture already retained, no need to re-retain it
_textures.insert( std::make_pair(fullpath, texture) );
}
else
{
CCLOG("cocos2d: Couldn't create texture for file:%s in TextureCache", path.c_str());
}
} while (0);
}
Texture2D::setDefaultAlphaPixelFormat(curFormat);
CC_SAFE_RELEASE(image);
return texture;
}
边栏推荐
- npm WARN config global `--global`, `--local` are deprecated. Use `--location solution
- 5 methods of MySQL paging query
- flutter 混合开发 module 依赖
- Year-end summary - the years are quiet~
- 2021美赛C题M奖思路
- mysql启动报错The server quit without updating PID file几种解决办法
- cocos2d-x 实现跨平台的目录遍历
- File operations in C language (1)
- Linux modify MySQL database password
- 安装Multisim出现 No software will be installed or removed解决方法
猜你喜欢
随机推荐
【云原生】微服务Nacos的简单介绍与使用
"limit" query in Oracle database
Linux modify MySQL database password
MySQL compressed package installation, fool teaching
代码块、Package,Import,封装(第六天)
Build vulhub vulnerability shooting range on kali
最新MySql安装教学,非常详细
flutter 混合开发 module 依赖
MySQL高级SQL语句(二)
NFT与数字藏品到底有何区别?
vulhub靶场学习日记SickOs1.2
GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?
SQL注入中数据库的判断
数字孪生将成为进入“元宇宙”一项重要的途径
Redis:简单实用
this指向问题
NFT:数字所有权的核心
C language tutorial (2) - printf and data types that come with c
【云原生】SQL(及存储过程)跑得太慢怎么办?
vulhub靶场学习日记hackme2








