This commit is contained in:
kaile.yin 2014-12-05 14:42:25 +08:00
commit 1db2bf89e0
23 changed files with 70 additions and 109 deletions

View File

@ -1,5 +1,7 @@
cocos2d-x-3.3 ???
cocos2d-x-3.3-rc2 Dec.5
[FIX] C++: use 100% of one core on Windows
[FIX] Label: when a label is added to a invisible parent node, app will crash if switching from background
[FIX] Label: label will not be shown when using system font on Mac
[FIX] Studio reader: replace protocol buffer with flatbuffer
cocos2d-x-3.3-rc1 Nov.29 2014

View File

@ -929,7 +929,7 @@ void Sprite::setSpriteFrame(const std::string &spriteFrameName)
SpriteFrameCache *cache = SpriteFrameCache::getInstance();
SpriteFrame *spriteFrame = cache->getSpriteFrameByName(spriteFrameName);
CCASSERT(spriteFrame, "Invalid spriteFrameName");
CCASSERT(spriteFrame, std::string("Invalid spriteFrameName :").append(spriteFrameName).c_str());
setSpriteFrame(spriteFrame);
}

View File

@ -127,7 +127,7 @@ else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
endif()
foreach(pkg ZLIB MINIZIP JPEG PNG TIFF TinyXML2 FREETYPE WEBSOCKETS CURL PROTOBUF_LITE)
foreach(pkg ZLIB MINIZIP JPEG PNG TIFF TinyXML2 FREETYPE WEBSOCKETS CURL FLATBUFFERS)
cocos_use_pkg(cocos2d ${pkg})
endforeach()

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x 3.3rc1";
return "cocos2d-x 3.3rc2";
}
NS_CC_END

View File

@ -822,6 +822,12 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree)
node = ActionTimelineNode::create(root, action);
node->setName(root->getName());
}
cocostudio::timeline::ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersFile(filePath);
if(action)
{
node->runAction(action);
action->gotoFrameAndPlay(0);
}
}
else if (classname == "SimpleAudio")
{

View File

@ -241,7 +241,10 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
builder.CreateVector(_texturePngs),
nodeTree,
aciton);
builder.Finish(csparsebinary);
builder.Finish(csparsebinary);
_textures.clear();
_texturePngs.clear();
std::string outFullPath = FileUtils::getInstance()->fullPathForFilename(flatbuffersFileName);

View File

@ -478,6 +478,7 @@ namespace cocostudio
bool displaystate = options->displaystate();
checkBox->setBright(displaystate);
checkBox->setEnabled(displaystate);
auto widgetReader = WidgetReader::getInstance();

View File

@ -506,11 +506,8 @@ namespace cocostudio
slider->loadProgressBarTexture(progressBarFileName, (Widget::TextureResType)progressBarType);
bool displaystate = options->displaystate();
if(!displaystate)
{
slider->setBright(displaystate);
slider->setEnabled(false);
}
slider->setBright(displaystate);
slider->setEnabled(displaystate);
auto widgetReader = WidgetReader::getInstance();
widgetReader->setPropsWithFlatBuffers(node, (Table*)options->widgetOptions());

View File

@ -275,6 +275,7 @@ namespace cocostudio
auto options = (TextFieldOptions*)textFieldOptions;
textField->setUnifySizeEnabled(false);
textField->ignoreContentAdaptWithSize(false);
std::string placeholder = options->placeHolder()->c_str();
textField->setPlaceHolder(placeholder);

View File

@ -893,17 +893,6 @@ void Mat4::subtract(const Mat4& m1, const Mat4& m2, Mat4* dst)
#endif
}
void Mat4::transformPoint(Vec3* point) const
{
GP_ASSERT(point);
transformVector(point->x, point->y, point->z, 1.0f, point);
}
void Mat4::transformPoint(const Vec3& point, Vec3* dst) const
{
transformVector(point.x, point.y, point.z, 1.0f, dst);
}
void Mat4::transformVector(Vec3* vector) const
{
GP_ASSERT(vector);

View File

@ -21,6 +21,8 @@
#ifndef MATH_MAT4_H
#define MATH_MAT4_H
#include "base/ccMacros.h"
#include "math/Vec3.h"
#include "math/Vec4.h"
@ -761,7 +763,7 @@ public:
*
* @param point The point to transform and also a vector to hold the result in.
*/
void transformPoint(Vec3* point) const;
inline void transformPoint(Vec3* point) const { GP_ASSERT(point); transformVector(point->x, point->y, point->z, 1.0f, point); }
/**
* Transforms the specified point by this matrix, and stores
@ -770,7 +772,7 @@ public:
* @param point The point to transform.
* @param dst A vector to store the transformed point in.
*/
void transformPoint(const Vec3& point, Vec3* dst) const;
inline void transformPoint(const Vec3& point, Vec3* dst) const { GP_ASSERT(dst); transformVector(point.x, point.y, point.z, 1.0f, dst); }
/**
* Transforms the specified vector by this matrix by

View File

@ -132,7 +132,7 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
lastBreakLocation = i + insertCount;
}
textSize = [lineBreak sizeWithAttributes:tokenAttributesDict];
if(textSize.height > info->height)
if(info->height > 0 && textSize.height > info->height)
break;
if (textSize.width > info->width) {
if(lastBreakLocation > 0) {

View File

@ -89,14 +89,14 @@ int Application::run()
QueryPerformanceCounter(&nNow);
if (nNow.QuadPart - nLast.QuadPart > _animationInterval.QuadPart)
{
nLast.QuadPart = nNow.QuadPart;
nLast.QuadPart = nNow.QuadPart - (nNow.QuadPart % _animationInterval.QuadPart);
director->mainLoop();
glview->pollEvents();
}
else
{
Sleep(0);
Sleep(1);
}
}

View File

@ -131,6 +131,8 @@ GLProgram::GLProgram()
, _fragShader(0)
, _flags()
{
_director = Director::getInstance();
CCASSERT(nullptr != _director, "Director is null when init a GLProgram");
memset(_builtInUniforms, 0, sizeof(_builtInUniforms));
}
@ -855,17 +857,12 @@ void GLProgram::setUniformLocationWithMatrix4fv(GLint location, const GLfloat* m
void GLProgram::setUniformsForBuiltins()
{
Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
auto matrixMV = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
setUniformsForBuiltins(matrixMV);
setUniformsForBuiltins(_director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW));
}
void GLProgram::setUniformsForBuiltins(const Mat4 &matrixMV)
{
auto matrixP = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
auto& matrixP = _director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
if(_flags.usesP)
setUniformLocationWithMatrix4fv(_builtInUniforms[UNIFORM_P_MATRIX], matrixP.m, 1);
@ -892,11 +889,10 @@ void GLProgram::setUniformsForBuiltins(const Mat4 &matrixMV)
}
if(_flags.usesTime) {
Director *director = Director::getInstance();
// This doesn't give the most accurate global time value.
// Cocos2D doesn't store a high precision time value, so this will have to do.
// Getting Mach time per frame per shader using time could be extremely expensive.
float time = director->getTotalFrames() * director->getAnimationInterval();
float time = _director->getTotalFrames() * _director->getAnimationInterval();
setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_TIME], time/10.0, time, time*2, time*4);
setUniformLocationWith4f(_builtInUniforms[GLProgram::UNIFORM_SIN_TIME], time/8.0, time/4.0, time/2.0, sinf(time));

View File

@ -46,7 +46,7 @@ NS_CC_BEGIN
*/
class GLProgram;
class Director;
typedef void (*GLInfoFunction)(GLuint program, GLenum pname, GLint* params);
typedef void (*GLLogFunction) (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
@ -359,6 +359,8 @@ protected:
std::unordered_map<std::string, Uniform> _userUniforms;
std::unordered_map<std::string, VertexAttrib> _vertexAttribs;
std::unordered_map<GLint, GLvoid*> _hashForUniforms;
//cached director pointer for calling
Director* _director;
};
NS_CC_END

View File

@ -17,7 +17,11 @@ To report bugs, please use the [Issue Tracker](https://github.com/cocos2d/cocos2
Steps to report a bug:
* Open the [url](https://github.com/cocos2d/cocos2d-x/issues/new)
* Add all the needed information to reproduce the bug
* Add all the needed information to reproduce the bug, the information include
* engine version
* steps to reproduce the bug
* some pseudocode
* resources link if needed
## Submitting patches

View File

@ -1,5 +1,5 @@
{
"version":"v3-deps-27",
"version":"v3-deps-28",
"zip_file_size":"87419231",
"repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/",

View File

@ -2433,53 +2433,6 @@
"external/png/prebuilt/wp8/Win32/libpng.lib",
"external/png/prebuilt/wp_8.1/arm/libpng.lib",
"external/png/prebuilt/wp_8.1/win32/libpng.lib",
"external/protobuf-lite/Android.mk",
"external/protobuf-lite/CMakeLists.txt",
"external/protobuf-lite/src/google/protobuf/config.h",
"external/protobuf-lite/src/google/protobuf/extension_set.cc",
"external/protobuf-lite/src/google/protobuf/extension_set.h",
"external/protobuf-lite/src/google/protobuf/generated_message_util.cc",
"external/protobuf-lite/src/google/protobuf/generated_message_util.h",
"external/protobuf-lite/src/google/protobuf/io/coded_stream.cc",
"external/protobuf-lite/src/google/protobuf/io/coded_stream.h",
"external/protobuf-lite/src/google/protobuf/io/coded_stream_inl.h",
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream.cc",
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream.h",
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl.cc",
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl.h",
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
"external/protobuf-lite/src/google/protobuf/io/zero_copy_stream_impl_lite.h",
"external/protobuf-lite/src/google/protobuf/message_lite.cc",
"external/protobuf-lite/src/google/protobuf/message_lite.h",
"external/protobuf-lite/src/google/protobuf/repeated_field.cc",
"external/protobuf-lite/src/google/protobuf/repeated_field.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_macosx.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_pnacl.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
"external/protobuf-lite/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h",
"external/protobuf-lite/src/google/protobuf/stubs/common.cc",
"external/protobuf-lite/src/google/protobuf/stubs/common.h",
"external/protobuf-lite/src/google/protobuf/stubs/hash.h",
"external/protobuf-lite/src/google/protobuf/stubs/map-util.h",
"external/protobuf-lite/src/google/protobuf/stubs/once.cc",
"external/protobuf-lite/src/google/protobuf/stubs/once.h",
"external/protobuf-lite/src/google/protobuf/stubs/platform_macros.h",
"external/protobuf-lite/src/google/protobuf/stubs/stl_util.h",
"external/protobuf-lite/src/google/protobuf/stubs/stringprintf.cc",
"external/protobuf-lite/src/google/protobuf/stubs/stringprintf.h",
"external/protobuf-lite/src/google/protobuf/stubs/template_util.h",
"external/protobuf-lite/src/google/protobuf/stubs/type_traits.h",
"external/protobuf-lite/src/google/protobuf/wire_format_lite.cc",
"external/protobuf-lite/src/google/protobuf/wire_format_lite.h",
"external/protobuf-lite/src/google/protobuf/wire_format_lite_inl.h",
"external/protobuf-lite/win32/config.h",
"external/sqlite3/Android.mk",
"external/sqlite3/include/sqlite3.h",
"external/sqlite3/include/sqlite3ext.h",

View File

@ -1092,12 +1092,13 @@ void ClippingToRenderTextureTest::reproduceBug()
img->drawPolygon(triangle, 3, red, 0, red);
clipper->addChild(img);
// container rendered on Texture the size of the screen
RenderTexture* rt = RenderTexture::create(visibleSize.width, visibleSize.height);
// container rendered on Texture the size of the screen and because Clipping node use stencil buffer so we need to
// create RenderTexture with depthStencil format parameter
RenderTexture* rt = RenderTexture::create(visibleSize.width, visibleSize.height, Texture2D::PixelFormat::RGBA8888, GL_DEPTH24_STENCIL8);
rt->setPosition(visibleSize.width/2, visibleSize.height/2);
this->addChild(rt);
rt->beginWithClear(0.3f, 0, 0, 1);
rt->begin();
container->visit();
rt->end();
}

View File

@ -5,8 +5,8 @@ local TimelineTestIndex =
{
TEST_ACTION_TIMELINE = 1,
TEST_CHANGE_PLAY_SECTION = 2,
TEST_TIMELINE_FRAME_EVENT = 3,
TEST_TIMELINE_PERFORMACE = 4,
--TEST_TIMELINE_FRAME_EVENT = 3,
TEST_TIMELINE_PERFORMACE = 3,
}
local timelineSceneIdx = TimelineTestIndex.TEST_ACTION_TIMELINE
@ -62,8 +62,8 @@ function TimelineTestLayer.title(idx)
return "Test ActionTimeline"
elseif TimelineTestIndex.TEST_CHANGE_PLAY_SECTION == idx then
return "Test Change Play Section"
elseif TimelineTestIndex.TEST_TIMELINE_FRAME_EVENT == idx then
return "Test Frame Event"
-- elseif TimelineTestIndex.TEST_TIMELINE_FRAME_EVENT == idx then
-- return "Test Frame Event"
elseif TimelineTestIndex.TEST_TIMELINE_PERFORMACE == idx then
return "Test ActionTimeline performance"
end
@ -158,7 +158,6 @@ function TimelineTestLayer:createToExtensionMenu()
end
function TimelineTestLayer:creatTitleAndSubTitle(idx)
print("set title")
local title = cc.Label:createWithTTF(TimelineTestLayer.title(idx), "fonts/Thonburi.ttf", 18)
title:setColor(cc.c3b(255,0,0))
self:addChild(title, 1, 10000)
@ -186,16 +185,14 @@ function TestActionTimeline.extend(target)
end
function TestActionTimeline:onEnter()
cc.SpriteFrameCache:getInstance():addSpriteFrames("armature/Cowboy0.plist", "armature/Cowboy0.png")
local node = cc.CSLoader:createNode("ActionTimeline/boy_1.csb")
local action = cc.CSLoader:createTimeline("ActionTimeline/boy_1.csb")
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
node:runAction(action)
action:gotoFrameAndPlay(0, 60, true)
action:gotoFrameAndPlay(0, 40, true)
node:setScale(0.2)
node:setPosition(150, 100)
node:setPosition(VisibleRect:center())
self:addChild(node)
end
@ -239,16 +236,15 @@ function TestChangePlaySection.extend(target)
end
function TestChangePlaySection:onEnter()
cc.SpriteFrameCache:getInstance():addSpriteFrames("armature/Cowboy0.plist", "armature/Cowboy0.png")
local node = cc.CSLoader:createNode("ActionTimeline/boy_1.csb")
local action = cc.CSLoader:createTimeline("ActionTimeline/boy_1.csb")
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
node:runAction(action)
action:gotoFrameAndPlay(70, action:getDuration(), true)
action:gotoFrameAndPlay(41, action:getDuration(), true)
node:setScale(0.2)
node:setPosition(150, 100)
node:setPosition(VisibleRect:center())
local function onTouchesEnded(touches, event)
if action:getStartFrame() == 0 then
@ -374,11 +370,10 @@ function TestTimelinePerformance.extend(target)
end
function TestTimelinePerformance:onEnter()
cc.SpriteFrameCache:getInstance():addSpriteFrames("armature/Cowboy0.plist", "armature/Cowboy0.png")
for i = 1,100 do
local node = cc.CSLoader:createNode("ActionTimeline/boy_1.csb")
local action = cc.CSLoader:createTimeline("ActionTimeline/boy_1.csb")
local node = cc.CSLoader:createNode("ActionTimeline/DemoPlayer.csb")
local action = cc.CSLoader:createTimeline("ActionTimeline/DemoPlayer.csb")
node:runAction(action)
action:gotoFrameAndPlay(70, action:getDuration(), true)
@ -418,7 +413,7 @@ local actionlineSceneArr =
{
TestActionTimeline.create,
TestChangePlaySection.create,
TestTimelineFrameEvent.create,
--TestTimelineFrameEvent.create,
TestTimelinePerformance.create,
}

View File

@ -54,6 +54,7 @@ local function addSearchPath(resPrefix, height)
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TmxMapComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/UIComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/hd/scenetest/TriggerTest")
table.insert(searchPaths, 1, resPrefix .. "hd/ActionTimeline")
else
table.insert(searchPaths, 1, resPrefix .. "ccs-res/Images")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/ArmatureComponentTest")
@ -66,6 +67,7 @@ local function addSearchPath(resPrefix, height)
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TmxMapComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/UIComponentTest")
table.insert(searchPaths, 1, resPrefix .. "ccs-res/scenetest/TriggerTest")
table.insert(searchPaths, 1, resPrefix .. "ActionTimeline")
end
fileUtils:setSearchPaths(searchPaths)

@ -1 +1 @@
Subproject commit 62aa5ed9cb84f5d2784ae3332a29fc5a900cfb3f
Subproject commit 3b956b46cc683f81d69811b3016810c1a93ad5f1

View File

@ -77,9 +77,16 @@ def main():
if platform == 'win32':
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s' % cur_platform))
if not os.path.exists(x86_llvm_path):
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s' % cur_platform))
else:
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86')))
if not os.path.exists(x86_llvm_path):
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86')))
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.3/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
if not os.path.exists(x64_llvm_path):
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm-3.4/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
if os.path.isdir(x86_llvm_path):
llvm_path = x86_llvm_path