quick-3.6源码修改纪录
2015-11-10 11:57
405 查看
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>
utils
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>
utils
相关文章推荐
- Builder模式在Android自定义底部对话框的实现
- 使用非 GUI 模式运行 JMeter 压力测试
- 关于elementary OS 64bit UEFI启动修复
- UITabBarController用法
- String,StringBuilder的区别
- easyui validatebox 验证类型
- IOS中UITableViewCell使用详解
- UISwipeGestureRecognizer 侧滑手势
- ios中UIButton选中状态切换
- 3.UiObejct API 详细介绍
- The current branch is not configured for pull No value for key branch.master.merge found in config
- debug模式下多次自动build
- Null value was assigned to a property of primitive type setter of 的原因与解决方案
- shuipf 经典记录
- require.js简要概述及require.js的使用方法
- IOS开发—segue几种模式的介绍以及几种创建方式
- Android快速SDK(1)基础工具库QuickBase
- Queue接口的实现与使用
- 安装 XHGui对 PHP 应用进行性能诊断
- activity的生命周期