Merged with upstream/v3

This commit is contained in:
kompjoefriek 2015-02-10 21:31:16 +01:00
parent 0854f980fa
commit ee259f19b7
51 changed files with 876 additions and 208 deletions

View File

@ -1,13 +1,15 @@
cocos2d-x-3.4 xxx
cocos2d-x-3.4 Jan.30 2015
[FIX] Animate3D: `setSpeed` has not effect if `Animate3D` is used in Sequence
[FIX] C++: will crash if built with armeabi-v7a enabled on Android devices that with armeabi-v7a architecture but doesn't support NEON instructions
[FIX] C++: may crash if VAO is not supported
[FIX] EditBox: content is not clipped correctly on windows
[FIX] GLProgram: will cause crash on some devices that don't support more than 8 atrributes
[FIX] HttpClient: not set response code when connecting failed on Android
[FIX] Label: alpha channel of text color of system font has not effect
[FIX] Label: use int for dimensions that will lose the precision
[FIX] Label: labels will become white block after resume from background on some Android devices, such as xiaomi3
[FIX] Label: improved parsing performance of bitmap font
[FIX] Label: can not display `&` if using system font on windows
[FIX] Lua-binding:studio-support: AnimationInfo is not binded
[FIX] New audio: not close file descriptor leads to that may causes game freeze if playing two many times(may be more than 1000) on Android
[FIX] Node: anchor point has not effect to rotation, it always rotate along (0, 0)

View File

@ -29,6 +29,12 @@ cmake_minimum_required(VERSION 2.8)
# also from cmake's Modules dir, to not clash with per-project files.
cmake_policy(SET CMP0017 NEW)
# Use new behaviour with cmake >= 3.0:
# Only interpret if() arguments as variables or keywords when unquoted.
if(CMAKE_VERSION VERSION_GREATER 3)
cmake_policy(SET CMP0054 NEW)
endif()
project (Cocos2d-X)
# The version number
@ -49,6 +55,16 @@ if(MINGW)
set(USE_PREBUILT_LIBS_DEFAULT OFF)
endif()
set(BUILD_CPP_TESTS_DEFAULT ON)
set(BUILD_LUA_LIBS_DEFAULT ON)
set(BUILD_LUA_TESTS_DEFAULT ON)
# TODO: fix test samples for MSVC
if(MSVC)
set(BUILD_CPP_TESTS_DEFAULT OFF)
set(BUILD_LUA_LIBS_DEFAULT OFF)
set(BUILD_LUA_TESTS_DEFAULT OFF)
endif()
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(USE_WEBP "Use WebP codec" ${USE_WEBP_DEFAULT})
@ -58,9 +74,9 @@ option(BUILD_EXTENSIONS "Build extension library" ON)
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_CPP_TESTS "Build TestCpp samples" ON)
option(BUILD_LUA_LIBS "Build lua libraries" ON)
option(BUILD_LUA_TESTS "Build TestLua samples" ON)
option(BUILD_CPP_TESTS "Build TestCpp samples" ${BUILD_CPP_TESTS_DEFAULT})
option(BUILD_LUA_LIBS "Build lua libraries" ${BUILD_LUA_LIBS_DEFAULT})
option(BUILD_LUA_TESTS "Build TestLua samples" ${BUILD_LUA_TESTS_DEFAULT})
option(USE_PREBUILT_LIBS "Use prebuilt libraries in external directory" ${USE_PREBUILT_LIBS_DEFAULT})
if(USE_PREBUILT_LIBS AND MINGW)
@ -81,6 +97,14 @@ if(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
-wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710
-wd4514 -wd4056 -wd4996 -wd4099)
# Use inline debug info (/Z7) format. Or internal error may occur.
# Errors looks like: "xmemory0(592): error C3130: Internal Compiler Error: failed to write injected code block to PDB"
foreach(lang C CXX)
string(REGEX REPLACE "/Z[iI7]" "" CMAKE_${lang}_FLAGS_DEBUG "${CMAKE_${lang}_FLAGS_DEBUG}")
set(CMAKE_${lang}_FLAGS_DEBUG "${CMAKE_${lang}_FLAGS_DEBUG} /Z7")
endforeach()
else()
set(CMAKE_C_FLAGS_DEBUG "-g -Wall -DCOCOS2D_DEBUG=1")
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
@ -150,12 +174,14 @@ if(USE_PREBUILT_LIBS)
include(CocosUsePrebuiltLibs)
endif()
# GLFW3 used on Mac, Windows and Linux desktop platforms
# desktop platforms
if(LINUX OR MACOSX OR WINDOWS)
cocos_find_package(OpenGL OPENGL REQUIRED)
if(LINUX OR WINDOWS)
cocos_find_package(GLEW GLEW REQUIRED)
#TODO: implement correct schema for pass cocos2d specific requirements to projects
include_directories(${GLEW_INCLUDE_DIRS})
endif()
cocos_find_package(GLFW3 GLFW3 REQUIRED)
@ -236,9 +262,11 @@ cocos_find_package(ZLIB ZLIB REQUIRED)
# moreover our embedded version modified to quick provide
# functionality needed by cocos.
if(USE_PREBUILT_LIBS OR NOT MINGW)
#TODO: hack! should be in external/unzip/CMakeLists.txt
include_directories(${ZLIB_INCLUDE_DIRS})
add_subdirectory(external/unzip)
set(MINIZIP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/unzip)
set(MINIZIP_LIBRARIES unzip)
set(MINIZIP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/unzip ${ZLIB_INCLUDE_DIRS})
set(MINIZIP_LIBRARIES unzip ${ZLIB_LIBRARIES})
message(STATUS "MINIZIP include dirs: ${MINIZIP_INCLUDE_DIRS}")
else()
cocos_find_package(MINIZIP MINIZIP REQUIRED)
@ -261,10 +289,10 @@ set(FLATBUFFERS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external)
message(STATUS "Flatbuffers include dirs: ${FLATBUFFERS_INCLUDE_DIRS}")
# build for 3rd party libraries
if(LINUX OR APPLE)
# build xxhash
add_subdirectory(external/xxhash)
endif()
set(XXHASH_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/xxhash)
set(XXHASH_LIBRARIES xxhash)
# libcocos2d.a
add_subdirectory(cocos)

View File

@ -36,7 +36,7 @@ set(_sqlite3_inc sqlite3.h)
set(_sqlite3_libs sqlite3)
set(_gles_prefix GLEW)
set(_gles_inc glew.h)
set(_gles_inc GL/glew.h)
set(_gles_inc_paths OGLES)
set(_gles_libs glew32)

View File

@ -218,7 +218,8 @@ void ClippingNode::drawFullScreenQuadClearStencil()
glProgram->use();
glProgram->setUniformsForBuiltins();
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
glBindBuffer(GL_ARRAY_BUFFER, 0);
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);

View File

@ -274,6 +274,8 @@ bool DrawNode::init()
glGenBuffers(1, &_vboGLPoint);
glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint);
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
CHECK_GL_ERROR_DEBUG();

View File

@ -896,8 +896,8 @@ void Label::drawShadowWithoutBlur()
void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
{
// Don't do calculate the culling if the transform was not updated
#if CC_USE_CULLING
bool transformUpdated = flags & FLAGS_TRANSFORM_DIRTY;
#if CC_USE_CULLING
_insideBounds = transformUpdated ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
if(_insideBounds)

View File

@ -587,7 +587,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\..\external\unzip\ioapi.h" />
<ClInclude Include="..\..\external\unzip\unzip.h" />
<ClInclude Include="..\..\external\xxhash\xxhash.h" />
<ClInclude Include="..\3d\3dExport.h" />
<ClInclude Include="..\3d\CCAABB.h" />
<ClInclude Include="..\3d\CCAnimate3D.h" />
<ClInclude Include="..\3d\CCAnimation3D.h" />
@ -658,8 +657,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\base\ccMacros.h" />
<ClInclude Include="..\base\CCMap.h" />
<ClInclude Include="..\base\CCNS.h" />
<ClInclude Include="..\base\CCPlatformConfig.h" />
<ClInclude Include="..\base\CCPlatformMacros.h" />
<ClInclude Include="..\base\CCProfiling.h" />
<ClInclude Include="..\base\CCProtocols.h" />
<ClInclude Include="..\base\ccRandom.h" />
@ -825,6 +822,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\platform\CCFileUtils.h" />
<ClInclude Include="..\platform\CCGLView.h" />
<ClInclude Include="..\platform\CCImage.h" />
<ClInclude Include="..\platform\CCPlatformConfig.h" />
<ClInclude Include="..\platform\CCPlatformMacros.h" />
<ClInclude Include="..\platform\CCSAXParser.h" />
<ClInclude Include="..\platform\CCThread.h" />
<ClInclude Include="..\platform\desktop\CCGLViewImpl-desktop.h" />

View File

@ -1639,12 +1639,6 @@
<ClInclude Include="..\base\CCNS.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\CCPlatformConfig.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\CCPlatformMacros.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\CCProfiling.h">
<Filter>base</Filter>
</ClInclude>
@ -1876,9 +1870,6 @@
<ClInclude Include="..\base\ccRandom.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\3d\3dExport.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\3d\CCAABB.h">
<Filter>3d</Filter>
</ClInclude>
@ -2548,6 +2539,12 @@
<ClInclude Include="..\physics\CCPhysicsHelper.h">
<Filter>physics</Filter>
</ClInclude>
<ClInclude Include="..\platform\CCPlatformConfig.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\platform\CCPlatformMacros.h">
<Filter>platform</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -144,7 +144,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -162,7 +162,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -180,7 +180,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -198,7 +198,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -216,7 +216,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -234,7 +234,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\winrt_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\winrt_8.1;$(EngineRoot)external\websockets\include\winrt_8.1;$(EngineRoot)external\curl\include\winrt_8.1;$(EngineRoot)external\tiff\include\winrt_8.1;$(EngineRoot)external\jpeg\include\winrt_8.1;$(EngineRoot)external\png\include\winrt_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -106,7 +106,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -124,7 +124,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -142,7 +142,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -160,7 +160,7 @@
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>$(EngineRoot)external\wp_8.1-specific\zlib\include;$(EngineRoot)external\freetype2\include\wp_8.1;$(EngineRoot)external\websockets\include\wp_8.1;$(EngineRoot)external\curl\include\wp_8.1;$(EngineRoot)external\tiff\include\wp_8.1;$(EngineRoot)external\jpeg\include\wp_8.1;$(EngineRoot)external\png\include\wp_8.1;$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CC_NO_GL_POINTSIZE;_USRDLL;_LIB;COCOS2DXWIN32_EXPORTS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -93,7 +93,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>
@ -114,7 +114,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>
@ -135,7 +135,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>
@ -156,7 +156,7 @@
<CompileAsWinRT>true</CompileAsWinRT>
<AdditionalUsingDirectories>$(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external\jpeg\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\tiff\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\png\include\$(COCOS2D_PLATFORM);$(EngineRoot)external\protobuf-lite\src;$(EngineRoot)external\protobuf-lite\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zm256 /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zm384 /bigobj %(AdditionalOptions)</AdditionalOptions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
</ClCompile>
<Link>

View File

@ -102,6 +102,9 @@ void BillBoard::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t
{
return;
}
bool visibleByCamera = isVisitableByVisitingCamera();
if (!visibleByCamera && _children.empty())
return;
uint32_t flags = processParentFlags(parentTransform, parentFlags);
@ -119,7 +122,7 @@ void BillBoard::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
bool visibleByCamera = isVisitableByVisitingCamera();
int i = 0;
@ -158,7 +161,7 @@ bool BillBoard::calculateBillbaordTransform()
const Mat4& camWorldMat = camera->getNodeToWorldTransform();
//TODO: use math lib to calculate math lib Make it easier to read and maintain
if (memcmp(_camWorldMat.m, camWorldMat.m, sizeof(float) * 16) != 0 || _transformDirty || _modeDirty)
if (memcmp(_camWorldMat.m, camWorldMat.m, sizeof(float) * 16) != 0 || memcmp(_mvTransform.m, _modelViewTransform.m, sizeof(float) * 16) != 0 || _modeDirty || true)
{
//Rotate based on anchor point
Vec3 anchorPoint(_anchorPointInPoints.x , _anchorPointInPoints.y , 0.0f);
@ -190,13 +193,9 @@ bool BillBoard::calculateBillbaordTransform()
Quaternion rotationQuaternion;
this->getNodeToWorldTransform().getRotation(&rotationQuaternion);
// fetch the rotation angle of z
float rotationZ = atan2(2*(rotationQuaternion.w*rotationQuaternion.z + rotationQuaternion.x*rotationQuaternion.y),
(1 - 2* (rotationQuaternion.y*rotationQuaternion.y + rotationQuaternion.z *rotationQuaternion.z)));
Mat4 rotationMatrix;
rotationMatrix.setIdentity();
rotationMatrix.rotateZ(rotationZ);
Vec3 upAxis = Vec3(rotationMatrix.m[4],rotationMatrix.m[5],rotationMatrix.m[6]);
Vec3 x, y;
camWorldMat.transformVector(upAxis, &y);
@ -217,7 +216,7 @@ bool BillBoard::calculateBillbaordTransform()
billboardTransform.m[12] = localToWorld.m[12]; billboardTransform.m[13] = localToWorld.m[13]; billboardTransform.m[14] = localToWorld.m[14];
billboardTransform.translate(-anchorPoint);
_modelViewTransform = billboardTransform;
_mvTransform = _modelViewTransform = billboardTransform;
_camWorldMat = camWorldMat;

View File

@ -105,6 +105,7 @@ protected:
bool calculateBillbaordTransform();
Mat4 _camWorldMat;
Mat4 _mvTransform;
Mode _mode;
bool _modeDirty;

View File

@ -289,7 +289,7 @@ std::string LoadMtl ( std::map<std::string, ObjLoader::material_t>& material_map
filepath = std::string(filename);
}
std::ifstream ifs(filepath.c_str());
std::istringstream ifs(FileUtils::getInstance()->getStringFromFile(filepath));
if (!ifs)
{
err << "Cannot open file [" << filepath << "]" << std::endl;

View File

@ -79,9 +79,7 @@ set(COCOS_SRC cocos2d.cpp
)
#todo: provide prebuild versions of the xx libs for all platforms
include_directories(
../external/xxhash
../external/xxtea)
include_directories(../external/xxtea)
add_library(cocos2d ${COCOS_SRC})
@ -127,11 +125,11 @@ else()
message( FATAL_ERROR "Unsupported platform, CMake will exit" )
endif()
foreach(pkg ZLIB MINIZIP JPEG PNG TIFF TinyXML2 FREETYPE WEBSOCKETS CURL FLATBUFFERS)
foreach(pkg ZLIB MINIZIP JPEG PNG TIFF TinyXML2 FREETYPE WEBSOCKETS CURL FLATBUFFERS XXHASH)
cocos_use_pkg(cocos2d ${pkg})
endforeach()
target_link_libraries(cocos2d xxhash ${PLATFORM_SPECIFIC_LIBS})
target_link_libraries(cocos2d ${PLATFORM_SPECIFIC_LIBS})
if(USE_WEBP)
add_definitions(-DCC_USE_WEBP=1)

View File

@ -687,6 +687,7 @@ static void processResponse(HttpResponse* response, std::string& responseMessage
{
response->setSucceed(false);
response->setErrorBuffer("connect failed");
response->setResponseCode(responseCode);
return;
}

View File

@ -170,6 +170,10 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
//if request type is post or put,set header and data
if([requestType isEqual: @"POST"] || [requestType isEqual: @"PUT"])
{
if ([requestType isEqual: @"PUT"])
{
[nsrequest setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField: @"Content-Type"];
}
/* get custom header data (if set) */
std::vector<std::string> headers=request->getHeaders();
if(!headers.empty())
@ -190,8 +194,7 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
char* requestDataBuffer = request->getRequestData();
if (nullptr != requestDataBuffer && 0 != strlen(requestDataBuffer))
{
NSString* requestData = [NSString stringWithUTF8String:requestDataBuffer];
NSData *postData = [requestData dataUsingEncoding:NSUTF8StringEncoding];
NSData *postData = [NSData dataWithBytes:requestDataBuffer length:request->getRequestDataSize()];
[nsrequest setHTTPBody:postData];
}
}

View File

@ -246,6 +246,7 @@ public:
{
int nRet = 0;
wchar_t * pwszBuffer = 0;
wchar_t* fixedText = nullptr;
do
{
CC_BREAK_IF(! pszText);
@ -276,7 +277,37 @@ public:
memset(pwszBuffer, 0, sizeof(wchar_t)*nBufLen);
nLen = MultiByteToWideChar(CP_UTF8, 0, pszText, nLen, pwszBuffer, nBufLen);
SIZE newSize = sizeWithText(pwszBuffer, nLen, dwFmt, tSize.cx);
if (strchr(pszText, '&'))
{
fixedText = new wchar_t[nLen * 2 + 1];
int fixedIndex = 0;
for (int index = 0; index < nLen; ++index)
{
if (pwszBuffer[index] == '&')
{
fixedText[fixedIndex] = '&';
fixedText[fixedIndex + 1] = '&';
fixedIndex += 2;
}
else
{
fixedText[fixedIndex] = pwszBuffer[index];
fixedIndex += 1;
}
}
fixedText[fixedIndex] = '\0';
nLen = fixedIndex;
}
SIZE newSize;
if (fixedText)
{
newSize = sizeWithText(fixedText, nLen, dwFmt, tSize.cx);
}
else
{
newSize = sizeWithText(pwszBuffer, nLen, dwFmt, tSize.cx);
}
RECT rcText = {0};
// if content width is 0, use text size as content size
@ -343,13 +374,23 @@ public:
SetTextColor(_DC, RGB(255, 255, 255)); // white color
// draw text
nRet = DrawTextW(_DC, pwszBuffer, nLen, &rcText, dwFmt);
if (fixedText)
{
nRet = DrawTextW(_DC, fixedText, nLen, &rcText, dwFmt);
}
else
{
nRet = DrawTextW(_DC, pwszBuffer, nLen, &rcText, dwFmt);
}
//DrawTextA(_DC, pszText, nLen, &rcText, dwFmt);
SelectObject(_DC, hOldBmp);
SelectObject(_DC, hOldFont);
} while (0);
CC_SAFE_DELETE_ARRAY(pwszBuffer);
delete[] fixedText;
return nRet;
}

View File

@ -163,7 +163,7 @@ GLProgram::~GLProgram()
for (auto e : _hashForUniforms)
{
free(e.second);
free(e.second.first);
}
_hashForUniforms.clear();
}
@ -666,17 +666,24 @@ bool GLProgram::updateUniformLocation(GLint location, const GLvoid* data, unsign
{
GLvoid* value = malloc(bytes);
memcpy(value, data, bytes );
_hashForUniforms.insert(std::make_pair(location, value));
_hashForUniforms.insert(std::make_pair(location, std::make_pair(value, bytes)));
}
else
{
if (memcmp(element->second, data, bytes) == 0)
if (memcmp(element->second.first, data, bytes) == 0)
{
updated = false;
}
else
{
memcpy(element->second, data, bytes);
if (element->second.second < bytes)
{
GLvoid* value = realloc(element->second.first, bytes);
memcpy(value, data, bytes );
_hashForUniforms[location] = std::make_pair(value, bytes);
}
else
memcpy(element->second.first, data, bytes);
}
}
@ -937,7 +944,7 @@ void GLProgram::reset()
for (auto e: _hashForUniforms)
{
free(e.second);
free(e.second.first);
}
_hashForUniforms.clear();

View File

@ -361,7 +361,7 @@ protected:
std::unordered_map<std::string, Uniform> _userUniforms;
std::unordered_map<std::string, VertexAttrib> _vertexAttribs;
std::unordered_map<GLint, GLvoid*> _hashForUniforms;
std::unordered_map<GLint, std::pair<GLvoid*, unsigned int>> _hashForUniforms;
//cached director pointer for calling
Director* _director;
};

View File

@ -49,13 +49,12 @@ bool GroupCommandManager::init()
int GroupCommandManager::getGroupID()
{
//Reuse old id
for(auto it = _groupMapping.begin(); it != _groupMapping.end(); ++it)
if (!_unusedIDs.empty())
{
if(!it->second)
{
_groupMapping[it->first] = true;
return it->first;
}
int groupID = *_unusedIDs.rbegin();
_unusedIDs.pop_back();
_groupMapping[groupID] = true;
return groupID;
}
//Create new ID
@ -69,6 +68,7 @@ int GroupCommandManager::getGroupID()
void GroupCommandManager::releaseGroupID(int groupID)
{
_groupMapping[groupID] = false;
_unusedIDs.push_back(groupID);
}
GroupCommand::GroupCommand()

View File

@ -26,6 +26,7 @@
#ifndef _CC_GROUPCOMMAND_H_
#define _CC_GROUPCOMMAND_H_
#include <vector>
#include <unordered_map>
#include "base/CCRef.h"
@ -45,6 +46,7 @@ protected:
~GroupCommandManager();
bool init();
std::unordered_map<int, bool> _groupMapping;
std::vector<int> _unusedIDs;
};
class CC_DLL GroupCommand : public RenderCommand

View File

@ -83,6 +83,10 @@ MeshCommand::MeshCommand()
, _cullFace(GL_BACK)
, _depthTestEnabled(false)
, _depthWriteEnabled(false)
, _forceDepthWrite(false)
, _renderStateCullFaceEnabled(false)
, _renderStateDepthTest(false)
, _renderStateDepthWrite(GL_FALSE)
, _lightMask(-1)
{
_type = RenderCommand::Type::MESH_COMMAND;
@ -168,7 +172,11 @@ void MeshCommand::setTransparent(bool value)
//Skip batching for transparent mesh
_skipBatching = value;
if (!_forceDepthWrite)
if (_isTransparent && !_forceDepthWrite)
{
_depthWriteEnabled = false;
}
else
{
_depthWriteEnabled = true;
}
@ -184,48 +192,55 @@ MeshCommand::~MeshCommand()
void MeshCommand::applyRenderState()
{
_renderStateCullFace = glIsEnabled(GL_CULL_FACE);
_renderStateCullFaceEnabled = glIsEnabled(GL_CULL_FACE);
_renderStateDepthTest = glIsEnabled(GL_DEPTH_TEST);
glGetBooleanv(GL_DEPTH_WRITEMASK, &_renderStateDepthWrite);
GLint cullface;
glGetIntegerv(GL_CULL_FACE_MODE, &cullface);
_renderStateCullFace = (GLenum)cullface;
if (_cullFaceEnabled && !_renderStateCullFace)
if (_cullFaceEnabled != _renderStateCullFaceEnabled)
{
glEnable(GL_CULL_FACE);
_cullFaceEnabled ? glEnable(GL_CULL_FACE) : glDisable(GL_CULL_FACE);
}
glCullFace(_cullFace);
if (_depthTestEnabled && !_renderStateDepthTest)
if (_cullFace != _renderStateCullFace)
{
glEnable(GL_DEPTH_TEST);
glCullFace(_cullFace);
}
if (_depthWriteEnabled && !_renderStateDepthWrite)
if (_depthTestEnabled != _renderStateDepthTest)
{
glDepthMask(GL_TRUE);
_depthTestEnabled ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST);
}
if (_depthWriteEnabled != _renderStateDepthWrite)
{
glDepthMask(_depthWriteEnabled);
}
}
void MeshCommand::restoreRenderState()
{
if (_renderStateCullFace)
if (_cullFaceEnabled != _renderStateCullFaceEnabled)
{
glEnable(GL_CULL_FACE);
}
else
{
glDisable(GL_CULL_FACE);
_renderStateCullFaceEnabled ? glEnable(GL_CULL_FACE) : glDisable(GL_CULL_FACE);
}
if (_renderStateDepthTest)
if (_cullFace != _renderStateCullFace)
{
glEnable(GL_DEPTH_TEST);
}
else
{
glDisable(GL_DEPTH_TEST);
glCullFace(_renderStateCullFace);
}
glDepthMask(_renderStateDepthTest);
if (_depthTestEnabled != _renderStateDepthTest)
{
_renderStateDepthTest ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST);
}
if (_depthWriteEnabled != _renderStateDepthWrite)
{
glDepthMask(_renderStateDepthWrite);
}
}
void MeshCommand::genMaterialID(GLuint texID, void* glProgramState, GLuint vertexBuffer, GLuint indexBuffer, const BlendFunc& blend)

View File

@ -129,9 +129,10 @@ protected:
bool _depthWriteEnabled;
bool _forceDepthWrite;
bool _renderStateCullFace;
bool _renderStateCullFaceEnabled;
bool _renderStateDepthTest;
GLboolean _renderStateDepthWrite;
GLenum _renderStateCullFace;
// ModelView transform
Mat4 _mv;

View File

@ -539,7 +539,6 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
{
//Clear depth to achieve layered rendering
glDepthMask(true);
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
for (auto it = opaqueQueue.cbegin(); it != opaqueQueue.cend(); ++it)
@ -586,10 +585,6 @@ void Renderer::visitRenderQueue(RenderQueue& queue)
processRenderCommand(*it);
}
flush();
glDepthMask(true);
glClear(GL_DEPTH_BUFFER_BIT);
glDepthMask(false);
}
//

View File

@ -1,9 +1,5 @@
set(cocos_root ${Cocos2d-X_SOURCE_DIR})
if(WINDOWS)
add_definitions(-DLUASOCKET_INET_ATON -DLUASOCKET_INET_PTON)
endif()
include_directories(
${cocos_root}/external/lua/tolua
${cocos_root}/external/lua/lua
@ -14,6 +10,7 @@ include_directories(
${cocos_root}/cocos/ui
${cocos_root}/cocos/2d
${cocos_root}/cocos/3d
${cocos_root}/cocos/base
${cocos_root}/cocos/editor-support/spine
${cocos_root}/cocos/editor-support/cocostudio
${cocos_root}/cocos/editor-support/cocostudio/ActionTimeline
@ -52,6 +49,10 @@ list(APPEND lua_cocos2d_source_files
)
if(WINDOWS)
if(MINGW)
add_definitions(-DLUASOCKET_INET_ATON -DLUASOCKET_INET_PTON)
endif()
add_definitions(-DWIN32 -D_WINDOWS)
list(APPEND lua_cocos2d_source_files
${cocos_root}/external/lua/luasocket/wsocket.c
)

View File

@ -0,0 +1,26 @@
--------------------------------
-- @module AsyncTaskPool
-- @parent_module cc
--------------------------------
-- stop tasks<br>
-- param type task type you want to stop
-- @function [parent=#AsyncTaskPool] stopTasks
-- @param self
-- @param #int type
-- @return AsyncTaskPool#AsyncTaskPool self (return value: cc.AsyncTaskPool)
--------------------------------
-- destroy instance
-- @function [parent=#AsyncTaskPool] destoryInstance
-- @param self
-- @return AsyncTaskPool#AsyncTaskPool self (return value: cc.AsyncTaskPool)
--------------------------------
-- get instance
-- @function [parent=#AsyncTaskPool] getInstance
-- @param self
-- @return AsyncTaskPool#AsyncTaskPool ret (return value: cc.AsyncTaskPool)
return nil

View File

@ -127,17 +127,6 @@
-- @param #string texturePath
-- @return Sprite3D#Sprite3D ret (return value: cc.Sprite3D)
--------------------------------
-- @overload self, string, string, function, void
-- @overload self, string, function, void
-- @function [parent=#Sprite3D] createAsync
-- @param self
-- @param #string modelPath
-- @param #string texturePath
-- @param #function callback
-- @param #void callbackparam
-- @return Sprite3D#Sprite3D self (return value: cc.Sprite3D)
--------------------------------
-- Returns 2d bounding-box<br>
-- Note: the bouding-box is just get from the AABB which as Z=0, so that is not very accurate.

View File

@ -0,0 +1,31 @@
--------------------------------
-- @module Sprite3DCache
-- @parent_module cc
--------------------------------
--
-- @function [parent=#Sprite3DCache] removeSprite3DData
-- @param self
-- @param #string key
-- @return Sprite3DCache#Sprite3DCache self (return value: cc.Sprite3DCache)
--------------------------------
--
-- @function [parent=#Sprite3DCache] removeAllSprite3DData
-- @param self
-- @return Sprite3DCache#Sprite3DCache self (return value: cc.Sprite3DCache)
--------------------------------
--
-- @function [parent=#Sprite3DCache] destroyInstance
-- @param self
-- @return Sprite3DCache#Sprite3DCache self (return value: cc.Sprite3DCache)
--------------------------------
-- get & destroy
-- @function [parent=#Sprite3DCache] getInstance
-- @param self
-- @return Sprite3DCache#Sprite3DCache ret (return value: cc.Sprite3DCache)
return nil

View File

@ -11,6 +11,11 @@
-- @field [parent=#cc] Sprite3D#Sprite3D Sprite3D preloaded module
--------------------------------------------------------
-- the cc Sprite3DCache
-- @field [parent=#cc] Sprite3DCache#Sprite3DCache Sprite3DCache preloaded module
--------------------------------------------------------
-- the cc Mesh
-- @field [parent=#cc] Mesh#Mesh Mesh preloaded module

View File

@ -1246,4 +1246,9 @@
-- @field [parent=#cc] Component#Component Component preloaded module
--------------------------------------------------------
-- the cc AsyncTaskPool
-- @field [parent=#cc] AsyncTaskPool#AsyncTaskPool AsyncTaskPool preloaded module
return nil

View File

@ -1267,79 +1267,6 @@ int lua_cocos2dx_3d_Sprite3D_create(lua_State* tolua_S)
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3D_createAsync(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 4)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite3D:createAsync");
if (!ok) { break; }
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Sprite3D:createAsync");
if (!ok) { break; }
std::function<void (cocos2d::Sprite3D *, void *)> arg2;
do {
// Lambda binding for lua is not supported.
assert(false);
} while(0)
;
if (!ok) { break; }
void* arg3;
#pragma warning NO CONVERSION TO NATIVE FOR void*
ok = false;
if (!ok) { break; }
cocos2d::Sprite3D::createAsync(arg0, arg1, arg2, arg3);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 3)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite3D:createAsync");
if (!ok) { break; }
std::function<void (cocos2d::Sprite3D *, void *)> arg1;
do {
// Lambda binding for lua is not supported.
assert(false);
} while(0)
;
if (!ok) { break; }
void* arg2;
#pragma warning NO CONVERSION TO NATIVE FOR void*
ok = false;
if (!ok) { break; }
cocos2d::Sprite3D::createAsync(arg0, arg1, arg2);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Sprite3D:createAsync",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_createAsync'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_3d_Sprite3D_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Sprite3D)");
@ -1370,7 +1297,6 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
tolua_function(tolua_S,"getMeshByName",lua_cocos2dx_3d_Sprite3D_getMeshByName);
tolua_function(tolua_S,"getAttachNode",lua_cocos2dx_3d_Sprite3D_getAttachNode);
tolua_function(tolua_S,"create", lua_cocos2dx_3d_Sprite3D_create);
tolua_function(tolua_S,"createAsync", lua_cocos2dx_3d_Sprite3D_createAsync);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Sprite3D).name();
g_luaType[typeName] = "cc.Sprite3D";
@ -1378,6 +1304,194 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
return 1;
}
int lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Sprite3DCache* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Sprite3DCache*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Sprite3DCache:removeSprite3DData");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData'", nullptr);
return 0;
}
cobj->removeSprite3DData(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3DCache:removeSprite3DData",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Sprite3DCache* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Sprite3DCache*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData'", nullptr);
return 0;
}
cobj->removeAllSprite3DData();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3DCache:removeAllSprite3DData",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3DCache_destroyInstance(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3DCache_destroyInstance'", nullptr);
return 0;
}
cocos2d::Sprite3DCache::destroyInstance();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite3DCache:destroyInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_destroyInstance'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_3d_Sprite3DCache_getInstance(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Sprite3DCache",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3DCache_getInstance'", nullptr);
return 0;
}
cocos2d::Sprite3DCache* ret = cocos2d::Sprite3DCache::getInstance();
object_to_luaval<cocos2d::Sprite3DCache>(tolua_S, "cc.Sprite3DCache",(cocos2d::Sprite3DCache*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Sprite3DCache:getInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3DCache_getInstance'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_3d_Sprite3DCache_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (Sprite3DCache)");
return 0;
}
int lua_register_cocos2dx_3d_Sprite3DCache(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.Sprite3DCache");
tolua_cclass(tolua_S,"Sprite3DCache","cc.Sprite3DCache","",nullptr);
tolua_beginmodule(tolua_S,"Sprite3DCache");
tolua_function(tolua_S,"removeSprite3DData",lua_cocos2dx_3d_Sprite3DCache_removeSprite3DData);
tolua_function(tolua_S,"removeAllSprite3DData",lua_cocos2dx_3d_Sprite3DCache_removeAllSprite3DData);
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_3d_Sprite3DCache_destroyInstance);
tolua_function(tolua_S,"getInstance", lua_cocos2dx_3d_Sprite3DCache_getInstance);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::Sprite3DCache).name();
g_luaType[typeName] = "cc.Sprite3DCache";
g_typeCast["Sprite3DCache"] = "cc.Sprite3DCache";
return 1;
}
int lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount(lua_State* tolua_S)
{
int argc = 0;
@ -2881,6 +2995,7 @@ TOLUA_API int register_all_cocos2dx_3d(lua_State* tolua_S)
lua_register_cocos2dx_3d_Animate3D(tolua_S);
lua_register_cocos2dx_3d_Sprite3D(tolua_S);
lua_register_cocos2dx_3d_AttachNode(tolua_S);
lua_register_cocos2dx_3d_Sprite3DCache(tolua_S);
lua_register_cocos2dx_3d_BillBoard(tolua_S);
lua_register_cocos2dx_3d_Animation3D(tolua_S);
lua_register_cocos2dx_3d_Skeleton3D(tolua_S);

View File

@ -67,6 +67,10 @@ int register_all_cocos2dx_3d(lua_State* tolua_S);

View File

@ -1,6 +1,7 @@
#include "lua_cocos2dx_auto.hpp"
#include "cocos2d.h"
#include "CCProtectedNode.h"
#include "CCAsyncTaskPool.h"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
@ -72824,6 +72825,146 @@ int lua_register_cocos2dx_Component(lua_State* tolua_S)
g_typeCast["Component"] = "cc.Component";
return 1;
}
int lua_cocos2dx_AsyncTaskPool_stopTasks(lua_State* tolua_S)
{
int argc = 0;
cocos2d::AsyncTaskPool* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.AsyncTaskPool",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::AsyncTaskPool*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_AsyncTaskPool_stopTasks'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::AsyncTaskPool::TaskType arg0;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.AsyncTaskPool:stopTasks");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AsyncTaskPool_stopTasks'", nullptr);
return 0;
}
cobj->stopTasks(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.AsyncTaskPool:stopTasks",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AsyncTaskPool_stopTasks'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_AsyncTaskPool_destoryInstance(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AsyncTaskPool",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AsyncTaskPool_destoryInstance'", nullptr);
return 0;
}
cocos2d::AsyncTaskPool::destoryInstance();
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AsyncTaskPool:destoryInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AsyncTaskPool_destoryInstance'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_AsyncTaskPool_getInstance(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.AsyncTaskPool",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S) - 1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AsyncTaskPool_getInstance'", nullptr);
return 0;
}
cocos2d::AsyncTaskPool* ret = cocos2d::AsyncTaskPool::getInstance();
object_to_luaval<cocos2d::AsyncTaskPool>(tolua_S, "cc.AsyncTaskPool",(cocos2d::AsyncTaskPool*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.AsyncTaskPool:getInstance",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_AsyncTaskPool_getInstance'.",&tolua_err);
#endif
return 0;
}
static int lua_cocos2dx_AsyncTaskPool_finalize(lua_State* tolua_S)
{
printf("luabindings: finalizing LUA object (AsyncTaskPool)");
return 0;
}
int lua_register_cocos2dx_AsyncTaskPool(lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cc.AsyncTaskPool");
tolua_cclass(tolua_S,"AsyncTaskPool","cc.AsyncTaskPool","",nullptr);
tolua_beginmodule(tolua_S,"AsyncTaskPool");
tolua_function(tolua_S,"stopTasks",lua_cocos2dx_AsyncTaskPool_stopTasks);
tolua_function(tolua_S,"destoryInstance", lua_cocos2dx_AsyncTaskPool_destoryInstance);
tolua_function(tolua_S,"getInstance", lua_cocos2dx_AsyncTaskPool_getInstance);
tolua_endmodule(tolua_S);
std::string typeName = typeid(cocos2d::AsyncTaskPool).name();
g_luaType[typeName] = "cc.AsyncTaskPool";
g_typeCast["AsyncTaskPool"] = "cc.AsyncTaskPool";
return 1;
}
TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
{
tolua_open(tolua_S);
@ -72925,6 +73066,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
lua_register_cocos2dx_Application(tolua_S);
lua_register_cocos2dx_DelayTime(tolua_S);
lua_register_cocos2dx_LabelAtlas(tolua_S);
lua_register_cocos2dx_AsyncTaskPool(tolua_S);
lua_register_cocos2dx_ParticleSnow(tolua_S);
lua_register_cocos2dx_EaseElasticIn(tolua_S);
lua_register_cocos2dx_EaseCircleActionInOut(tolua_S);

View File

@ -1637,6 +1637,10 @@ int register_all_cocos2dx(lua_State* tolua_S);

View File

@ -116,6 +116,89 @@ tolua_lerror:
return 0;
}
int lua_cocos2dx_3d_Sprite3D_createAsync(lua_State* tolua_S)
{
int argc = 0;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertable(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror;
#endif
argc = lua_gettop(tolua_S)-1;
do
{
if (argc == 3)
{
std::string modelPath;
ok &= luaval_to_std_string(tolua_S, 2,&modelPath, "cc.Sprite3D:createAsync");
if (!ok)
break;
std::string texturePath;
ok &= luaval_to_std_string(tolua_S, 3,&texturePath, "cc.Sprite3D:createAsync");
if (!ok)
break;
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,4,"LUA_FUNCTION",0,&tolua_err)) {
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = toluafix_ref_function(tolua_S,4,0);
cocos2d::Sprite3D::createAsync(modelPath, texturePath, [=](cocos2d::Sprite3D* sprite, void* callbackparam){
int id = (sprite) ? (int)sprite->_ID : -1;
int* luaID = (sprite) ? &sprite->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)sprite,"cc.Sprite3D");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1);
}, nullptr);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
do
{
if (argc == 2)
{
std::string modelPath;
ok &= luaval_to_std_string(tolua_S, 2,&modelPath, "cc.Sprite3D:createAsync");
if (!ok)
break;
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S, 3, "LUA_FUNCTION", 0, &tolua_err)) {
goto tolua_lerror;
}
#endif
LUA_FUNCTION handler = toluafix_ref_function(tolua_S, 3, 0);
cocos2d::Sprite3D::createAsync(modelPath, [=](cocos2d::Sprite3D* sprite, void* callbackparam){
int id = (sprite) ? (int)sprite->_ID : -1;
int* luaID = (sprite) ? &sprite->_luaID : nullptr;
toluafix_pushusertype_ccobject(tolua_S, id, luaID, (void*)sprite,"cc.Sprite3D");
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 1);
}, nullptr);
lua_settop(tolua_S, 1);
return 1;
}
} while (0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Sprite3D:createAsync",argc, 3);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_createAsync'.",&tolua_err);
#endif
return 0;
}
static void extendSprite3D(lua_State* L)
{
lua_pushstring(L, "cc.Sprite3D");
@ -124,6 +207,7 @@ static void extendSprite3D(lua_State* L)
{
tolua_function(L, "setBlendFunc", lua_cocos2dx_3d_Sprite3D_setBlendFunc01);
tolua_function(L, "getAABB", lua_cocos2dx_3d_Sprite3D_getAABB);
tolua_function(L, "createAsync", lua_cocos2dx_3d_Sprite3D_createAsync);
}
lua_pop(L, 1);
}

View File

@ -277,7 +277,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\2d;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\ui;$(EngineRoot)external;$(EngineRoot)external\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -309,7 +309,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -610,3 +610,12 @@ cc.LightFlag =
LIGHT14 = math.pow(2,14),
LIGHT15 = math.pow(2,15),
}
cc.AsyncTaskPool.TaskType =
{
TASK_IO = 0,
TASK_NETWORK = 1,
TASK_OTHER = 2,
TASK_MAX_TYPE = 3,
}

View File

@ -13,6 +13,8 @@
- [Windows](#windows)
- [Linux](#linux)
- [How to start a new game](#how-to-start-a-new-game)
- [v3.4](#v34)
- [Bugs fixed in v3.4](#bugs-fixed-in-v34)
- [v3.4rc1](#v34rc1)
- [Highlights of v3.4rc1](#highlights-of-v34rc1)
- [Features in detail](#features-in-detail)
@ -39,7 +41,7 @@
# Misc Information
* Full Changelog: https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.4rc0/CHANGELOG
* [Full Changelog](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.4/CHANGELOG)
* v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md)
# Requirements
@ -124,6 +126,13 @@ Run
## How to start a new game
Please refer to this document: [ReadMe](../README.md)
# v3.4
##Bugs fixed in v3.4
* C++: crash on armeabi-v7a arch device which do not support NEON instructions
* GLProgram: crash on low end device with no more than 8 attributes support
* New audio: game freeze if audio played two many times on android
* Node: anchor point has no effects on rotation
* More bugs fixed
# v3.4rc1

View File

@ -264,9 +264,6 @@ const std::string& AssetsManagerEx::getStoragePath() const
void AssetsManagerEx::setStoragePath(const std::string& storagePath)
{
if (_storagePath.size() > 0)
_fileUtils->removeDirectory(_storagePath);
_storagePath = storagePath;
adjustPath(_storagePath);
_fileUtils->createDirectory(_storagePath);

View File

@ -4909,6 +4909,7 @@
"cocos/scripting/lua-bindings/auto/api/ArmatureDisplayData.lua",
"cocos/scripting/lua-bindings/auto/api/AssetsManager.lua",
"cocos/scripting/lua-bindings/auto/api/AssetsManagerEx.lua",
"cocos/scripting/lua-bindings/auto/api/AsyncTaskPool.lua",
"cocos/scripting/lua-bindings/auto/api/AtlasNode.lua",
"cocos/scripting/lua-bindings/auto/api/AttachNode.lua",
"cocos/scripting/lua-bindings/auto/api/AudioEngine.lua",
@ -5189,6 +5190,7 @@
"cocos/scripting/lua-bindings/auto/api/SpotLight.lua",
"cocos/scripting/lua-bindings/auto/api/Sprite.lua",
"cocos/scripting/lua-bindings/auto/api/Sprite3D.lua",
"cocos/scripting/lua-bindings/auto/api/Sprite3DCache.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteBatchNode.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteDisplayData.lua",
"cocos/scripting/lua-bindings/auto/api/SpriteFrame.lua",

View File

@ -1,5 +1,8 @@
set(APP_NAME cpp-tests)
# Use same method as in cocos library
cocos_find_package(CURL CURL REQUIRED)
if(WIN32)
set(PLATFORM_SRC proj.win32/main.cpp)
set(RES_PREFIX "")
@ -252,6 +255,8 @@ target_link_libraries(${APP_NAME}
cocos2d
)
cocos_use_pkg(${APP_NAME} CURL)
if(MACOSX OR APPLE)
set_target_properties(${APP_NAME} PROPERTIES
MACOSX_BUNDLE 1

View File

@ -245,6 +245,7 @@ Camera3DTestDemo::Camera3DTestDemo(void)
, _bZoomIn(false)
, _bRotateLeft(false)
, _bRotateRight(false)
, _cameraType(CameraType::Free)
{
}
Camera3DTestDemo::~Camera3DTestDemo(void)

View File

@ -1537,11 +1537,7 @@ TTFFontShadowAndStroke::TTFFontShadowAndStroke()
strokeShaodwTextDef._fontFillColor = tintColorBlue;
// shadow + stroke label
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
auto fontStrokeAndShadow = LabelTTF::createWithFontDefinition("Stroke && Shadow Blue Text", strokeShaodwTextDef);
#else
auto fontStrokeAndShadow = LabelTTF::createWithFontDefinition("Stroke &Shadow Blue Text", strokeShaodwTextDef);
#endif
auto fontStrokeAndShadow = LabelTTF::createWithFontDefinition("Stroke & Shadow Blue Text", strokeShaodwTextDef);
// add label to the scene
this->addChild(fontStrokeAndShadow);

View File

@ -70,7 +70,8 @@ static std::function<Layer*()> createFunctions[] =
CL(Sprite3DMirrorTest),
CL(QuaternionTest),
CL(Sprite3DEmptyTest),
CL(UseCaseSprite3D)
CL(UseCaseSprite3D),
CL(Sprite3DForceDepthTest)
};
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
@ -156,6 +157,42 @@ void Sprite3DTestDemo::backCallback(Ref* sender)
s->release();
}
//------------------------------------------------------------------
//
// Sprite3DForceDepthTest
//
//------------------------------------------------------------------
Sprite3DForceDepthTest::Sprite3DForceDepthTest()
{
auto orc = Sprite3D::create("Sprite3DTest/orc.c3b");
orc->setScale(5);
orc->setNormalizedPosition(Vec2(.5,.3));
orc->setPositionZ(40);
orc->setRotation3D(Vec3(0,180,0));
orc->setGlobalZOrder(-1);
addChild(orc);
auto ship = Sprite3D::create("Sprite3DTest/boss1.obj");
ship->setScale(5);
ship->setTexture("Sprite3DTest/boss.png");
ship->setNormalizedPosition(Vec2(.5,.5));
ship->setRotation3D(Vec3(90,0,0));
ship->setForceDepthWrite(true);
addChild(ship);
}
std::string Sprite3DForceDepthTest::title() const
{
return "Force Depth Write Error Test";
}
std::string Sprite3DForceDepthTest::subtitle() const
{
return "Ship should always appear behind orc";
}
//------------------------------------------------------------------
//
// Sprite3DEmptyTest

View File

@ -54,6 +54,15 @@ public:
virtual void onEnter() override;
};
class Sprite3DForceDepthTest : public Sprite3DTestDemo
{
public:
CREATE_FUNC(Sprite3DForceDepthTest);
Sprite3DForceDepthTest();
virtual std::string title() const override;
virtual std::string subtitle() const override;
};
class Sprite3DEmptyTest : public Sprite3DTestDemo
{
public:

View File

@ -356,8 +356,6 @@ end
--BugTest1159
local function BugTest1159()
local pLayer = cc.Layer:create()
cc.Director:getInstance():setDepthTest(true)
local background = cc.LayerColor:create(cc.c4b(255, 0, 255, 255))
pLayer:addChild(background)
@ -398,7 +396,6 @@ local function BugTest1159()
scheduler:unscheduleScriptEntry(schedulerEntry)
end
]]--
cc.Director:getInstance():setDepthTest(false)
end
end

View File

@ -145,7 +145,6 @@ end
function ParallaxTestMain()
cclog("ParallaxMain")
Helper.index = 1
cc.Director:getInstance():setDepthTest(true)
local scene = cc.Scene:create()
Helper.createFunctionTable = {

View File

@ -919,6 +919,113 @@ function Sprite3DMirrorTest.create()
return layer
end
----------------------------------------
----AsyncLoadSprite3DTest
----------------------------------------
local AsyncLoadSprite3DTest = class("AsyncLoadSprite3DTest", function ()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
function AsyncLoadSprite3DTest:ctor()
-- body
self:init()
end
function AsyncLoadSprite3DTest:init()
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event)
if event == "enter" then
self:onEnter()
elseif event == "exit" then
self:onExit()
end
end)
end
function AsyncLoadSprite3DTest:title()
return "Testing Sprite3D:createAsync"
end
function AsyncLoadSprite3DTest:subtitle()
return ""
end
function AsyncLoadSprite3DTest:onEnter()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 15
local paths = {"Sprite3DTest/boss.obj", "Sprite3DTest/girl.c3b", "Sprite3DTest/orc.c3b", "Sprite3DTest/ReskinGirl.c3b", "Sprite3DTest/axe.c3b"}
local label1 = cc.Label:createWithTTF(ttfConfig,"AsyncLoad Sprite3D")
local item1 = cc.MenuItemLabel:create(label1)
function menuCallback_asyncLoadSprite(tag, sender)
--Note that you must stop the tasks before leaving the scene.
cc.AsyncTaskPool:getInstance():stopTasks(cc.AsyncTaskPool.TaskType.TASK_IO)
local node = self:getChildByTag(101)
--remove all loaded sprite
node:removeAllChildren()
--remove cache data
cc.Sprite3DCache:getInstance():removeAllSprite3DData()
local function callback(sprite, index)
local node = self:getChildByTag(101)
local s = cc.Director:getInstance():getWinSize()
local width = s.width / (#paths)
local point = cc.p(width * (0.5 + index), s.height / 2.0)
sprite:setPosition(point)
node:addChild(sprite)
end
cc.Sprite3D:createAsync(paths[1], function(sprite)
callback(sprite, 0)
end)
cc.Sprite3D:createAsync(paths[2], function(sprite)
callback(sprite, 1)
end)
cc.Sprite3D:createAsync(paths[3], function(sprite)
callback(sprite, 2)
end)
cc.Sprite3D:createAsync(paths[4], function(sprite)
callback(sprite, 3)
end)
cc.Sprite3D:createAsync(paths[5], function(sprite)
callback(sprite, 4)
end)
end
item1:registerScriptTapHandler(menuCallback_asyncLoadSprite)
local s = cc.Director:getInstance():getWinSize()
item1:setPosition( s.width * 0.5, s.height * 0.8)
local menu = cc.Menu:create(item1)
menu:setPosition(cc.p(0,0))
self:addChild(menu, 10)
local node = cc.Node:create()
node:setTag(101)
self:addChild(node)
menuCallback_asyncLoadSprite()
end
function AsyncLoadSprite3DTest:onExit()
end
function Sprite3DTest()
local scene = cc.Scene:create()
@ -932,6 +1039,7 @@ function Sprite3DTest()
Sprite3DReskinTest.create,
Sprite3DWithOBBPerfromanceTest.create,
Sprite3DMirrorTest.create,
AsyncLoadSprite3DTest.create
}
scene:addChild(Sprite3DBasicTest.create())

View File

@ -22,11 +22,11 @@ cxxgenerator_headers =
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCProtectedNode.h %(cocosdir)s/cocos/base/CCAsyncTaskPool.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console GLProgramCache GLProgramState Device ClippingRectangleNode .*Light$ AsyncTaskPool
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also

View File

@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/cocos2d.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard
classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard Sprite3DCache
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -36,10 +36,11 @@ classes = Animate3D Sprite3D Animation3D Skeleton3D ^Mesh$ AttachNode BillBoard
# functions from all classes.
skip = Mesh::[create getAABB getVertexBuffer hasVertexAttrib getSkin getMeshIndexData getGLProgramState getPrimitiveType getIndexCount getIndexFormat getIndexBuffer],
Sprite3D::[getSkin getAABB getMeshArrayByName],
Sprite3D::[getSkin getAABB getMeshArrayByName createAsync],
Skeleton3D::[create],
Animation3D::[getBoneCurveByName],
BillBoard::[draw]
BillBoard::[draw],
Sprite3DCache::[addSprite3DData getSpriteData]
rename_functions =