您的位置:首页 > 产品设计 > UI/UE

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: