Merge branch 'v3' into v3_addClearforCamera

Conflicts:
	cocos/renderer/CCGLProgramCache.cpp
	tests/cpp-tests/Classes/controller.cpp
This commit is contained in:
Huabing.Xu 2015-05-12 09:49:15 +08:00
commit cc0b3ffd2e
1075 changed files with 330598 additions and 8716 deletions

3
.gitignore vendored
View File

@ -123,9 +123,10 @@ project.properties
/templates/lua-template-runtime/runtime
/v*-deps-*.zip
/v*-lua-runtime-*.zip
/v*-console-*.zip
/tools/fbx-conv/
tests/cpp-tests/Resources/audio
/tests/js-tests/
/tests/lua-empty-test/src/cocos/
/tests/lua-game-controller-test/src/cocos/
/tests/lua-tests/src/cocos/
/tests/js-tests/res/

3
.gitmodules vendored
View File

@ -10,3 +10,6 @@
[submodule "tests/cpp-tests/Resources/ccs-res"]
path = tests/cpp-tests/Resources/ccs-res
url = git://github.com/dumganhar/ccs-res.git
[submodule "web"]
path = web
url = git://github.com/cocos2d/cocos2d-html5.git

View File

@ -37,4 +37,4 @@ before_install:
# whitelist
branches:
only:
- v3.6
- v3

View File

@ -1091,6 +1091,7 @@ Developers:
loadrunner
Added romanian languange support
Added sensor property for PhysicsShape
Almax27
RenderQueue command buffer optimize.
@ -1106,13 +1107,20 @@ Developers:
milos1290
Added Lerp for Vec3
Added ActionFloat
perminovVS
Optimize Vec3 and Vec2
Added `UserDefault::setDelegate()`
qiutaoleo
Added a feature to check case characters for filename on windows
HueyPark
Fixed memory leak in HttpClient on iOS
Dimon4eg
Fixed crash on AssetsManager
Retired Core Developers:
WenSheng Yang

View File

@ -1,4 +1,19 @@
cocos2d-x-3.6 ??
cocos2d-x-3.7 ??
[NEW] 3d: added physics3d support
[NEW] C++: added ActionFloat
[NEW] FileUtils: checked filename case characters on windows
[NEW] FileUitls: added supporting loading files that which file path include utf-8 characters
[NEW] PhysicsShape: added sensor property
[FIX] 3rd: fix PIE link error on iOS caused by libpng and libtiff
[FIX] AssetsManager: crashed issue
[FIX] EaseRateAction: no way to create an `EaseRateAction` instance
[FIX] Label: crashed if invoking `setString(text` after `getLetter(letterIndex)` and `letterIndex` is greater than the length of text
[FIX] Label: position is wrong if label content is changed after invoking `getLetter(letterIndex)`
[FIX] Label: shadow effect cause OpenGL error on iOS
[FIX] Label: outline effect doesn't match characters well
cocos2d-x-3.6 Apr.30 2015
[NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App
[NEW] 3rd: update freetype to v 2.5.5 on Windows 8.1 Universal App
[NEW] C++: Added SpritePolygon

View File

@ -58,15 +58,20 @@ endif()
set(BUILD_CPP_TESTS_DEFAULT ON)
set(BUILD_LUA_LIBS_DEFAULT ON)
set(BUILD_LUA_TESTS_DEFAULT ON)
set(BUILD_JS_LIBS_DEFAULT OFF)
set(BUILD_JS_TESTS_DEFAULT OFF)
# 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)
set(BUILD_JS_LIBS_DEFAULT OFF)
set(BUILD_JS_TESTS_DEFAULT OFF)
endif()
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(USE_BULLET "Use bullet for physics3d library" ON)
option(USE_WEBP "Use WebP codec" ${USE_WEBP_DEFAULT})
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(DEBUG_MODE "Debug or release?" ON)
@ -77,6 +82,8 @@ option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" 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(BUILD_JS_LIBS "Build js libraries" ${BUILD_JS_LIBS_DEFAULT})
option(BUILD_JS_TESTS "Build TestJS samples" ${BUILD_JS_TESTS_DEFAULT})
option(USE_PREBUILT_LIBS "Use prebuilt libraries in external directory" ${USE_PREBUILT_LIBS_DEFAULT})
if(USE_PREBUILT_LIBS AND MINGW)
@ -242,6 +249,24 @@ else()
add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=0)
endif(USE_BOX2D)
# Bullet (not prebuilded, exists as source)
if(USE_BULLET)
if(USE_PREBUILT_LIBS)
add_subdirectory(external/bullet)
set(BULLET_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet)
set(BULLET_LIBRARIES bullet)
else()
cocos_find_package(bullet BULLET REQUIRED)
set(BULLET_LIBRARIES bullet)
endif()
message(STATUS "Bullet include dirs: ${BULLET_INCLUDE_DIRS}")
add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=1)
add_definitions(-DCC_USE_PHYSICS=1)
else()
add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=0)
add_definitions(-DCC_USE_3D_PHYSICS=0)
endif(USE_BULLET)
# Tinyxml2 (not prebuilded, exists as source)
if(USE_PREBUILT_LIBS)
add_subdirectory(external/tinyxml2)
@ -314,3 +339,18 @@ if(BUILD_LUA_LIBS)
endif(BUILD_LUA_TESTS)
endif(BUILD_LUA_LIBS)
## JS
if(BUILD_JS_LIBS)
link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/spidermonkey/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
)
add_subdirectory(cocos/scripting/js-bindings)
# build js tests
if(BUILD_JS_TESTS)
add_subdirectory(tests/js-tests/project)
endif(BUILD_JS_TESTS)
endif(BUILD_JS_LIBS)

View File

@ -135,10 +135,10 @@ Build Requirements
* Mac OS X 10.7+, Xcode 5.1+
* or Ubuntu 12.10+, CMake 2.6+
* or Windows 7+, VS 2012+
* or Windows 7+, VS 2013+
* Python 2.7.5
* NDK r10c+ is required to build Android games
* Windows Phone/Store 8.0 VS 2012+
* Windows Phone/Store 8.0 VS 2013+
* Windows Phone/Store 8.1 VS 2013 Update 3+
@ -186,7 +186,7 @@ $ bin/lua-empty-test/lua-empty-test
* For Windows
Open the `cocos2d-x/build/cocos2d-win32.vc2012.sln`
Open the `cocos2d-x/build/cocos2d-win32.vc2013.sln`
* For Windows 8.1 Universal Apps (Phone and Store)

View File

@ -0,0 +1,69 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 12.0.21005.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{92D54E36-7916-48EF-A951-224DD3B25442}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d", "..\cocos\scripting\js-bindings\proj.win32\libjscocos2d.vcxproj", "{39379840-825A-45A0-B363-C09FFEF864BD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests", "..\tests\js-tests\project\proj.win32\js-tests.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|Win32 = Debug|Win32
Release|ARM = Release|ARM
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|ARM.ActiveCfg = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|ARM.ActiveCfg = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|ARM.ActiveCfg = Debug|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.ActiveCfg = Debug|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|ARM.ActiveCfg = Release|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Debug|ARM.ActiveCfg = Debug|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.ActiveCfg = Debug|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Release|ARM.ActiveCfg = Release|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|ARM.ActiveCfg = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.ActiveCfg = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.Build.0 = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|ARM.ActiveCfg = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.ActiveCfg = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.Build.0 = Release|Win32
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|ARM.ActiveCfg = Debug|Win32
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.ActiveCfg = Debug|Win32
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.Build.0 = Debug|Win32
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|ARM.ActiveCfg = Release|Win32
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.ActiveCfg = Release|Win32
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE} = {92D54E36-7916-48EF-A951-224DD3B25442}
{929480E7-23C0-4DF6-8456-096D71547116} = {92D54E36-7916-48EF-A951-224DD3B25442}
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,218 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 12.0.21005.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcocos2d", "libcocos2d", "{B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Shared", "..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems", "{5D6F020F-7E72-4494-90A0-2DF11D235DF9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Windows", "..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Windows\libcocos2d_8_1.Windows.vcxproj", "{9335005F-678E-4E8E-9B84-50037216AEC8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.WindowsPhone", "..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.WindowsPhone\libcocos2d_8_1.WindowsPhone.vcxproj", "{22F3B9DF-1209-4574-8331-003966F562BF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{85630454-74EA-4B5B-9B62-0E459B4476CB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libbox2d", "libbox2d", "{B3D1A3D5-9F54-43AF-9322-230B53242B78}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Shared", "..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems", "{4A3C6BA8-C227-498B-AA21-40BDA27B461F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.Windows", "..\external\Box2D\proj.win8.1-universal\libbox2d.Windows\libbox2d.Windows.vcxproj", "{3B26A12D-3A44-47EA-82D2-282660FC844D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d.WindowsPhone", "..\external\Box2D\proj.win8.1-universal\libbox2d.WindowsPhone\libbox2d.WindowsPhone.vcxproj", "{22F798D8-BFFF-4754-996F-A5395343D5EC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libSpine", "libSpine", "{6FEB795C-C98C-4C8C-A88B-A35DEE205348}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Shared", "..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems", "{ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Windows", "..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Windows\libSpine.Windows.vcxproj", "{F3550FE0-C795-44F6-8FEB-093EB68143AE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.WindowsPhone", "..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.WindowsPhone\libSpine.WindowsPhone.vcxproj", "{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "js-tests", "js-tests", "{8E24A044-D83D-476D-886D-F40E3CC621DF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests.Shared", "..\tests\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems", "{AE6763F6-1549-441E-AFB5-377BE1C776DC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests.Windows", "..\tests\js-tests\project\proj.win8.1-universal\App.Windows\js-tests.Windows.vcxproj", "{70914FC8-7709-4CD6-B86B-C63FDE5478DB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js-tests.WindowsPhone", "..\tests\js-tests\project\proj.win8.1-universal\App.WindowsPhone\js-tests.WindowsPhone.vcxproj", "{94874B5B-398F-448A-A366-35A35DC1DB9C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcocos2d-jsb", "libcocos2d-jsb", "{60DCAEA9-E344-40C0-B90C-82FB8E671BD5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d.Shared", "..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.Shared\libjscocos2d.Shared.vcxitems", "{BEA66276-51DD-4C53-92A8-F3D1FEA50892}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d.Windows", "..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.Windows\libjscocos2d.Windows.vcxproj", "{BCF5546D-66A0-4998-AFD6-C5514F618930}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d.WindowsPhone", "..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.WindowsPhone\libjscocos2d.WindowsPhone.vcxproj", "{CA082EC4-17CE-430B-8207-D1E947A5D1E9}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\tests\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{ae6763f6-1549-441e-afb5-377be1c776dc}*SharedItemsImports = 9
..\tests\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{94874b5b-398f-448a-a366-35a35dc1db9c}*SharedItemsImports = 4
..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{9335005f-678e-4e8e-9b84-50037216aec8}*SharedItemsImports = 4
..\tests\js-tests\project\proj.win8.1-universal\App.Shared\js-tests.Shared.vcxitems*{70914fc8-7709-4cd6-b86b-c63fde5478db}*SharedItemsImports = 4
..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{cc1da216-a80d-4be4-b309-acb6af313aff}*SharedItemsImports = 4
..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9
..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9
..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.Shared\libjscocos2d.Shared.vcxitems*{ca082ec4-17ce-430b-8207-d1e947a5d1e9}*SharedItemsImports = 4
..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9
..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.Shared\libjscocos2d.Shared.vcxitems*{bea66276-51dd-4c53-92a8-f3d1fea50892}*SharedItemsImports = 9
..\cocos\scripting\js-bindings\proj.win8.1-universal\libjscocos2d\libjscocos2d.Shared\libjscocos2d.Shared.vcxitems*{bcf5546d-66a0-4998-afd6-c5514f618930}*SharedItemsImports = 4
..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{3b26a12d-3a44-47ea-82d2-282660fc844d}*SharedItemsImports = 4
..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{22f3b9df-1209-4574-8331-003966f562bf}*SharedItemsImports = 4
..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{22f798d8-bfff-4754-996f-a5395343d5ec}*SharedItemsImports = 4
..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{f3550fe0-c795-44f6-8feb-093eb68143ae}*SharedItemsImports = 4
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|ARM = Release|ARM
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.ActiveCfg = Debug|ARM
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.Build.0 = Debug|ARM
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.ActiveCfg = Debug|Win32
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.Build.0 = Debug|Win32
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.ActiveCfg = Debug|x64
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.Build.0 = Debug|x64
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.ActiveCfg = Release|ARM
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.Build.0 = Release|ARM
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.ActiveCfg = Release|Win32
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.Build.0 = Release|Win32
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.ActiveCfg = Release|x64
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.Build.0 = Release|x64
{22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.ActiveCfg = Debug|ARM
{22F3B9DF-1209-4574-8331-003966F562BF}.Debug|ARM.Build.0 = Debug|ARM
{22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.ActiveCfg = Debug|Win32
{22F3B9DF-1209-4574-8331-003966F562BF}.Debug|Win32.Build.0 = Debug|Win32
{22F3B9DF-1209-4574-8331-003966F562BF}.Debug|x64.ActiveCfg = Debug|Win32
{22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.ActiveCfg = Release|ARM
{22F3B9DF-1209-4574-8331-003966F562BF}.Release|ARM.Build.0 = Release|ARM
{22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.ActiveCfg = Release|Win32
{22F3B9DF-1209-4574-8331-003966F562BF}.Release|Win32.Build.0 = Release|Win32
{22F3B9DF-1209-4574-8331-003966F562BF}.Release|x64.ActiveCfg = Release|Win32
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.ActiveCfg = Debug|ARM
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|ARM.Build.0 = Debug|ARM
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.ActiveCfg = Debug|Win32
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|Win32.Build.0 = Debug|Win32
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.ActiveCfg = Debug|x64
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Debug|x64.Build.0 = Debug|x64
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.ActiveCfg = Release|ARM
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|ARM.Build.0 = Release|ARM
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.ActiveCfg = Release|Win32
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|Win32.Build.0 = Release|Win32
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.ActiveCfg = Release|x64
{3B26A12D-3A44-47EA-82D2-282660FC844D}.Release|x64.Build.0 = Release|x64
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.ActiveCfg = Debug|ARM
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|ARM.Build.0 = Debug|ARM
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.ActiveCfg = Debug|Win32
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|Win32.Build.0 = Debug|Win32
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Debug|x64.ActiveCfg = Debug|Win32
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.ActiveCfg = Release|ARM
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|ARM.Build.0 = Release|ARM
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.ActiveCfg = Release|Win32
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|Win32.Build.0 = Release|Win32
{22F798D8-BFFF-4754-996F-A5395343D5EC}.Release|x64.ActiveCfg = Release|Win32
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.ActiveCfg = Debug|ARM
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|ARM.Build.0 = Debug|ARM
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.ActiveCfg = Debug|Win32
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|Win32.Build.0 = Debug|Win32
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.ActiveCfg = Debug|x64
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Debug|x64.Build.0 = Debug|x64
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.ActiveCfg = Release|ARM
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|ARM.Build.0 = Release|ARM
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.ActiveCfg = Release|Win32
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.Build.0 = Release|Win32
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.ActiveCfg = Release|x64
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.Build.0 = Release|x64
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.ActiveCfg = Debug|ARM
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|ARM.Build.0 = Debug|ARM
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.ActiveCfg = Debug|Win32
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|Win32.Build.0 = Debug|Win32
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Debug|x64.ActiveCfg = Debug|Win32
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.ActiveCfg = Release|ARM
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|ARM.Build.0 = Release|ARM
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.ActiveCfg = Release|Win32
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|Win32.Build.0 = Release|Win32
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF}.Release|x64.ActiveCfg = Release|Win32
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|ARM.ActiveCfg = Debug|ARM
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|ARM.Build.0 = Debug|ARM
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|ARM.Deploy.0 = Debug|ARM
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|Win32.ActiveCfg = Debug|Win32
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|Win32.Build.0 = Debug|Win32
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|Win32.Deploy.0 = Debug|Win32
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|x64.ActiveCfg = Debug|x64
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|x64.Build.0 = Debug|x64
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Debug|x64.Deploy.0 = Debug|x64
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|ARM.ActiveCfg = Release|ARM
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|ARM.Build.0 = Release|ARM
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|ARM.Deploy.0 = Release|ARM
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|Win32.ActiveCfg = Release|Win32
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|Win32.Build.0 = Release|Win32
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|Win32.Deploy.0 = Release|Win32
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|x64.ActiveCfg = Release|x64
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|x64.Build.0 = Release|x64
{70914FC8-7709-4CD6-B86B-C63FDE5478DB}.Release|x64.Deploy.0 = Release|x64
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|ARM.ActiveCfg = Debug|ARM
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|ARM.Build.0 = Debug|ARM
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|ARM.Deploy.0 = Debug|ARM
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|Win32.ActiveCfg = Debug|Win32
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|Win32.Build.0 = Debug|Win32
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|Win32.Deploy.0 = Debug|Win32
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Debug|x64.ActiveCfg = Debug|Win32
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|ARM.ActiveCfg = Release|ARM
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|ARM.Build.0 = Release|ARM
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|ARM.Deploy.0 = Release|ARM
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|Win32.ActiveCfg = Release|Win32
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|Win32.Build.0 = Release|Win32
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|Win32.Deploy.0 = Release|Win32
{94874B5B-398F-448A-A366-35A35DC1DB9C}.Release|x64.ActiveCfg = Release|Win32
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|ARM.ActiveCfg = Debug|ARM
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|ARM.Build.0 = Debug|ARM
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|Win32.ActiveCfg = Debug|Win32
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|Win32.Build.0 = Debug|Win32
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|x64.ActiveCfg = Debug|x64
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Debug|x64.Build.0 = Debug|x64
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|ARM.ActiveCfg = Release|ARM
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|ARM.Build.0 = Release|ARM
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|Win32.ActiveCfg = Release|Win32
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|Win32.Build.0 = Release|Win32
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|x64.ActiveCfg = Release|x64
{BCF5546D-66A0-4998-AFD6-C5514F618930}.Release|x64.Build.0 = Release|x64
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|ARM.ActiveCfg = Debug|ARM
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|ARM.Build.0 = Debug|ARM
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|Win32.ActiveCfg = Debug|Win32
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|Win32.Build.0 = Debug|Win32
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Debug|x64.ActiveCfg = Debug|Win32
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|ARM.ActiveCfg = Release|ARM
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|ARM.Build.0 = Release|ARM
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|Win32.ActiveCfg = Release|Win32
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|Win32.Build.0 = Release|Win32
{CA082EC4-17CE-430B-8207-D1E947A5D1E9}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5D6F020F-7E72-4494-90A0-2DF11D235DF9} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}
{9335005F-678E-4E8E-9B84-50037216AEC8} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}
{22F3B9DF-1209-4574-8331-003966F562BF} = {B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}
{B3D1A3D5-9F54-43AF-9322-230B53242B78} = {85630454-74EA-4B5B-9B62-0E459B4476CB}
{4A3C6BA8-C227-498B-AA21-40BDA27B461F} = {B3D1A3D5-9F54-43AF-9322-230B53242B78}
{3B26A12D-3A44-47EA-82D2-282660FC844D} = {B3D1A3D5-9F54-43AF-9322-230B53242B78}
{22F798D8-BFFF-4754-996F-A5395343D5EC} = {B3D1A3D5-9F54-43AF-9322-230B53242B78}
{6FEB795C-C98C-4C8C-A88B-A35DEE205348} = {85630454-74EA-4B5B-9B62-0E459B4476CB}
{ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348}
{F3550FE0-C795-44F6-8FEB-093EB68143AE} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348}
{CC1DA216-A80D-4BE4-B309-ACB6AF313AFF} = {6FEB795C-C98C-4C8C-A88B-A35DEE205348}
{AE6763F6-1549-441E-AFB5-377BE1C776DC} = {8E24A044-D83D-476D-886D-F40E3CC621DF}
{70914FC8-7709-4CD6-B86B-C63FDE5478DB} = {8E24A044-D83D-476D-886D-F40E3CC621DF}
{94874B5B-398F-448A-A366-35A35DC1DB9C} = {8E24A044-D83D-476D-886D-F40E3CC621DF}
{BEA66276-51DD-4C53-92A8-F3D1FEA50892} = {60DCAEA9-E344-40C0-B90C-82FB8E671BD5}
{BCF5546D-66A0-4998-AFD6-C5514F618930} = {60DCAEA9-E344-40C0-B90C-82FB8E671BD5}
{CA082EC4-17CE-430B-8207-D1E947A5D1E9} = {60DCAEA9-E344-40C0-B90C-82FB8E671BD5}
EndGlobalSection
EndGlobal

View File

@ -1,8 +1,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
MinimumVisualStudioVersion = 12.0.21005.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-tests", "..\tests\cpp-tests\proj.win32\cpp-tests.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-tests", "..\tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
@ -12,6 +12,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-empty-test", "..\tests\lua-empty-test\project\proj.win32\lua-empty-test.vcxproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
ProjectSection(ProjectDependencies) = postProject
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B} = {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluacocos2d", "..\cocos\scripting\lua-bindings\proj.win32\libluacocos2d.vcxproj", "{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}"
EndProject
@ -21,6 +24,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet", "..\external\bullet\proj.win32\libbullet.vcxproj", "{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@ -77,6 +82,12 @@ Global
{929480E7-23C0-4DF6-8456-096D71547116}.Release|ARM.ActiveCfg = Release|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Debug|ARM.ActiveCfg = Debug|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Debug|Win32.ActiveCfg = Debug|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Debug|Win32.Build.0 = Debug|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|ARM.ActiveCfg = Release|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.ActiveCfg = Release|Win32
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -84,6 +95,7 @@ Global
GlobalSection(NestedProjects) = preSolution
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE} = {92D54E36-7916-48EF-A951-224DD3B25442}
{929480E7-23C0-4DF6-8456-096D71547116} = {92D54E36-7916-48EF-A951-224DD3B25442}
{012DFF48-A13F-4F52-B07B-F8B9D21CE95B} = {92D54E36-7916-48EF-A951-224DD3B25442}
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}

View File

@ -2,7 +2,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
MinimumVisualStudioVersion = 12.0.21005.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcocos2d", "libcocos2d", "{B3F299D4-B4CA-4F0B-8BE2-FB328483BC13}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Shared", "..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems", "{5D6F020F-7E72-4494-90A0-2DF11D235DF9}"

View File

@ -0,0 +1,883 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
0541A76319738D8C00E45470 /* NativeOcClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 0541A75D19738D5A00E45470 /* NativeOcClass.m */; };
0541A77819750DE700E45470 /* NativeOcClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 0541A75D19738D5A00E45470 /* NativeOcClass.m */; };
0541A77A19750F7A00E45470 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0541A77919750F7A00E45470 /* AppKit.framework */; };
1A604F3418BF1D4900CC9A93 /* src in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F3118BF1D4900CC9A93 /* src */; };
1A604F3518BF1D4900CC9A93 /* src in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F3118BF1D4900CC9A93 /* src */; };
1A604F3918BF1D5600CC9A93 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A604F3718BF1D5600CC9A93 /* AppDelegate.cpp */; };
1A604F3A18BF1D5600CC9A93 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A604F3718BF1D5600CC9A93 /* AppDelegate.cpp */; };
1A604F4D18BF1D6000CC9A93 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A604F3D18BF1D6000CC9A93 /* AppController.mm */; };
1A604F4E18BF1D6000CC9A93 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F3E18BF1D6000CC9A93 /* Default-568h@2x.png */; };
1A604F4F18BF1D6000CC9A93 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F3F18BF1D6000CC9A93 /* Default.png */; };
1A604F5018BF1D6000CC9A93 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4018BF1D6000CC9A93 /* Default@2x.png */; };
1A604F5118BF1D6000CC9A93 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4118BF1D6000CC9A93 /* Icon-114.png */; };
1A604F5218BF1D6000CC9A93 /* Icon-120.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4218BF1D6000CC9A93 /* Icon-120.png */; };
1A604F5318BF1D6000CC9A93 /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4318BF1D6000CC9A93 /* Icon-144.png */; };
1A604F5418BF1D6000CC9A93 /* Icon-152.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4418BF1D6000CC9A93 /* Icon-152.png */; };
1A604F5518BF1D6000CC9A93 /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4518BF1D6000CC9A93 /* Icon-57.png */; };
1A604F5618BF1D6000CC9A93 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4618BF1D6000CC9A93 /* Icon-72.png */; };
1A604F5718BF1D6000CC9A93 /* Icon-76.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F4718BF1D6000CC9A93 /* Icon-76.png */; };
1A604F5918BF1D6000CC9A93 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A604F4918BF1D6000CC9A93 /* main.m */; };
1A604F5A18BF1D6000CC9A93 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A604F4C18BF1D6000CC9A93 /* RootViewController.mm */; };
1A604F6418BF1D6600CC9A93 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F5C18BF1D6600CC9A93 /* InfoPlist.strings */; };
1A604F6518BF1D6600CC9A93 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F5E18BF1D6600CC9A93 /* MainMenu.xib */; };
1A604F6618BF1D6600CC9A93 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1A604F6018BF1D6600CC9A93 /* Icon.icns */; };
1A604F6718BF1D6600CC9A93 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A604F6118BF1D6600CC9A93 /* main.cpp */; };
420BBD111AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */; };
420BBD121AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */; };
42BCD4A31AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */; };
42BCD4A41AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */; };
A01E18F81784C59400B0CA4A /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A035A71117822E9E00987F6C /* libsqlite3.dylib */; };
A035A5E01782290400987F6C /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A9F808C177E98A600D9A1CB /* libcurl.dylib */; };
A035A71217822E9E00987F6C /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A035A71117822E9E00987F6C /* libsqlite3.dylib */; };
BA0613B51AC23B2D003118D6 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA0613B41AC23B2D003118D6 /* Security.framework */; };
BA2350551948262700E17B2A /* script in Resources */ = {isa = PBXBuildFile; fileRef = BA2350541948262700E17B2A /* script */; };
BA2350561948262700E17B2A /* script in Resources */ = {isa = PBXBuildFile; fileRef = BA2350541948262700E17B2A /* script */; };
BAA7DEE418C84F5000D9A10E /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = BAA7DEE218C84F5000D9A10E /* main.js */; };
BAA7DEE518C84F5000D9A10E /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = BAA7DEE218C84F5000D9A10E /* main.js */; };
BAA7DEE618C84F5000D9A10E /* project.json in Resources */ = {isa = PBXBuildFile; fileRef = BAA7DEE318C84F5000D9A10E /* project.json */; };
BAA7DEE718C84F5000D9A10E /* project.json in Resources */ = {isa = PBXBuildFile; fileRef = BAA7DEE318C84F5000D9A10E /* project.json */; };
ED2719A21AE4F4F000C17085 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719A11AE4F4F000C17085 /* GameController.framework */; };
ED2719A41AE4F51F00C17085 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719A31AE4F51F00C17085 /* StoreKit.framework */; };
ED2719A61AE4F52F00C17085 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719A51AE4F52E00C17085 /* CoreTelephony.framework */; };
ED2719A81AE4F53B00C17085 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719A71AE4F53B00C17085 /* Security.framework */; };
ED2719AA1AE4F54500C17085 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719A91AE4F54500C17085 /* MediaPlayer.framework */; };
ED2719AC1AE4F55000C17085 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719AB1AE4F55000C17085 /* MessageUI.framework */; };
ED2719AE1AE4F55800C17085 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719AD1AE4F55800C17085 /* AdSupport.framework */; };
ED2719B01AE4F56500C17085 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719AF1AE4F56500C17085 /* SystemConfiguration.framework */; };
ED2719B21AE4F57200C17085 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719B11AE4F57100C17085 /* CoreMotion.framework */; };
ED2719B41AE4F57E00C17085 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719B31AE4F57E00C17085 /* libz.dylib */; };
ED2719B61AE4F59500C17085 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719B51AE4F59500C17085 /* Foundation.framework */; };
ED2719B81AE4F5A100C17085 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719B71AE4F5A100C17085 /* AudioToolbox.framework */; };
ED2719BA1AE4F5A900C17085 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719B91AE4F5A900C17085 /* OpenAL.framework */; };
ED2719BC1AE4F5B500C17085 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719BB1AE4F5B500C17085 /* QuartzCore.framework */; };
ED2719BE1AE4F5BE00C17085 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719BD1AE4F5BE00C17085 /* CoreGraphics.framework */; };
ED2719C01AE4F5C500C17085 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719BF1AE4F5C500C17085 /* OpenGLES.framework */; };
ED2719C21AE4F5CC00C17085 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719C11AE4F5CC00C17085 /* UIKit.framework */; };
ED2719C41AE4F5D300C17085 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719C31AE4F5D300C17085 /* AVFoundation.framework */; };
ED2719C61AE4F60C00C17085 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719C51AE4F60C00C17085 /* libz.dylib */; };
ED2719C81AE4F61600C17085 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719C71AE4F61500C17085 /* Foundation.framework */; };
ED2719CA1AE4F61D00C17085 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719C91AE4F61D00C17085 /* AudioToolbox.framework */; };
ED2719CC1AE4F62A00C17085 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719CB1AE4F62A00C17085 /* ApplicationServices.framework */; };
ED2719CE1AE4F63200C17085 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719CD1AE4F63200C17085 /* OpenAL.framework */; };
ED2719D01AE4F63D00C17085 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719CF1AE4F63D00C17085 /* QuartzCore.framework */; };
ED2719D21AE4F64600C17085 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719D11AE4F64600C17085 /* OpenGL.framework */; };
ED2719D41AE4F64D00C17085 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719D31AE4F64D00C17085 /* Cocoa.framework */; };
ED2719D51AE4F86500C17085 /* libjscocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719611AE4E69800C17085 /* libjscocos2d iOS.a */; };
ED2719DA1AE4F8EB00C17085 /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719591AE4E68200C17085 /* libcocos2d iOS.a */; };
ED2719DB1AE4FA1200C17085 /* libcocos2d Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2719571AE4E68200C17085 /* libcocos2d Mac.a */; };
ED2719DC1AE4FA1600C17085 /* libjscocos2d Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED27195F1AE4E69800C17085 /* libjscocos2d Mac.a */; };
ED743D1717D099F10004076B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDCC747E17C455FD007B692C /* IOKit.framework */; };
EDCA13E81AEA4D4A00F445CA /* res in Resources */ = {isa = PBXBuildFile; fileRef = EDCA13E71AEA4D4A00F445CA /* res */; };
EDCA13E91AEA4D4A00F445CA /* res in Resources */ = {isa = PBXBuildFile; fileRef = EDCA13E71AEA4D4A00F445CA /* res */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
ED2719561AE4E68200C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F0218BF1D1C00CC9A93 /* cocos2d_libs.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1551A33F158F2AB200E66CFE;
remoteInfo = "libcocos2d Mac";
};
ED2719581AE4E68200C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F0218BF1D1C00CC9A93 /* cocos2d_libs.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A07A4D641783777C0073F6A7;
remoteInfo = "libcocos2d iOS";
};
ED27195E1AE4E69800C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F2518BF1D2000CC9A93 /* cocos2d_js_bindings.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1A5410A418B785A10016A3AF;
remoteInfo = "libjscocos2d Mac";
};
ED2719601AE4E69800C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F2518BF1D2000CC9A93 /* cocos2d_js_bindings.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1A5410A518B785A10016A3AF;
remoteInfo = "libjscocos2d iOS";
};
ED2719941AE4F14A00C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F2518BF1D2000CC9A93 /* cocos2d_js_bindings.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = A07A4FB5178387750073F6A7;
remoteInfo = "libjscocos2d iOS";
};
ED2719961AE4F15100C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F0218BF1D1C00CC9A93 /* cocos2d_libs.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 1551A33E158F2AB200E66CFE;
remoteInfo = "libcocos2d Mac";
};
ED2719981AE4F15800C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F2518BF1D2000CC9A93 /* cocos2d_js_bindings.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = A03F31E81781479B006731B9;
remoteInfo = "libjscocos2d Mac";
};
ED27199E1AE4F48800C17085 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A604F0218BF1D1C00CC9A93 /* cocos2d_libs.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = A07A4C241783777C0073F6A7;
remoteInfo = "libcocos2d iOS";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
0541A75C19738D5A00E45470 /* NativeOcClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NativeOcClass.h; path = ../proj.ios/NativeOcClass.h; sourceTree = "<group>"; };
0541A75D19738D5A00E45470 /* NativeOcClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NativeOcClass.m; path = ../proj.ios/NativeOcClass.m; sourceTree = "<group>"; };
0541A77919750F7A00E45470 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
1A604F0218BF1D1C00CC9A93 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = cocos2d_libs.xcodeproj; sourceTree = "<group>"; };
1A604F2518BF1D2000CC9A93 /* cocos2d_js_bindings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2d_js_bindings.xcodeproj; path = "../cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj"; sourceTree = "<group>"; };
1A604F3118BF1D4900CC9A93 /* src */ = {isa = PBXFileReference; lastKnownFileType = folder; name = src; path = "../tests/js-tests/src"; sourceTree = "<group>"; };
1A604F3718BF1D5600CC9A93 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
1A604F3818BF1D5600CC9A93 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
1A604F3C18BF1D6000CC9A93 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
1A604F3D18BF1D6000CC9A93 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = "<group>"; };
1A604F3E18BF1D6000CC9A93 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
1A604F3F18BF1D6000CC9A93 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
1A604F4018BF1D6000CC9A93 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
1A604F4118BF1D6000CC9A93 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = "<group>"; };
1A604F4218BF1D6000CC9A93 /* Icon-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-120.png"; sourceTree = "<group>"; };
1A604F4318BF1D6000CC9A93 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = "<group>"; };
1A604F4418BF1D6000CC9A93 /* Icon-152.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-152.png"; sourceTree = "<group>"; };
1A604F4518BF1D6000CC9A93 /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-57.png"; sourceTree = "<group>"; };
1A604F4618BF1D6000CC9A93 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
1A604F4718BF1D6000CC9A93 /* Icon-76.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-76.png"; sourceTree = "<group>"; };
1A604F4818BF1D6000CC9A93 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1A604F4918BF1D6000CC9A93 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
1A604F4A18BF1D6000CC9A93 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
1A604F4B18BF1D6000CC9A93 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
1A604F4C18BF1D6000CC9A93 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; };
1A604F5D18BF1D6600CC9A93 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1A604F5F18BF1D6600CC9A93 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
1A604F6018BF1D6600CC9A93 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
1A604F6118BF1D6600CC9A93 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
1A604F6218BF1D6600CC9A93 /* Test_Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Test_Info.plist; sourceTree = "<group>"; };
1A604F6318BF1D6600CC9A93 /* Test_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test_Prefix.pch; sourceTree = "<group>"; };
1A9F808C177E98A600D9A1CB /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; };
420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_DrawNode3D_bindings.cpp; sourceTree = "<group>"; };
420BBD101AA8840E00493976 /* js_DrawNode3D_bindings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_DrawNode3D_bindings.h; sourceTree = "<group>"; };
42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_Effect3D_bindings.cpp; sourceTree = "<group>"; };
42BCD4A21AAF3BF500D035E5 /* js_Effect3D_bindings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_Effect3D_bindings.h; sourceTree = "<group>"; };
A01E17721784C06E00B0CA4A /* js-tests iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "js-tests iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
A035A5EC1782290400987F6C /* js-tests Mac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "js-tests Mac.app"; sourceTree = BUILT_PRODUCTS_DIR; };
A035A71117822E9E00987F6C /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
BA0613B41AC23B2D003118D6 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
BA2350541948262700E17B2A /* script */ = {isa = PBXFileReference; lastKnownFileType = text; name = script; path = "../cocos/scripting/js-bindings/script"; sourceTree = "<group>"; };
BAA7DEE218C84F5000D9A10E /* main.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = main.js; path = "../tests/js-tests/main.js"; sourceTree = "<group>"; };
BAA7DEE318C84F5000D9A10E /* project.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = project.json; path = "../tests/js-tests/project.json"; sourceTree = "<group>"; };
ED2719A11AE4F4F000C17085 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/GameController.framework; sourceTree = DEVELOPER_DIR; };
ED2719A31AE4F51F00C17085 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/StoreKit.framework; sourceTree = DEVELOPER_DIR; };
ED2719A51AE4F52E00C17085 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreTelephony.framework; sourceTree = DEVELOPER_DIR; };
ED2719A71AE4F53B00C17085 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
ED2719A91AE4F54500C17085 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
ED2719AB1AE4F55000C17085 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/MessageUI.framework; sourceTree = DEVELOPER_DIR; };
ED2719AD1AE4F55800C17085 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/AdSupport.framework; sourceTree = DEVELOPER_DIR; };
ED2719AF1AE4F56500C17085 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = DEVELOPER_DIR; };
ED2719B11AE4F57100C17085 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
ED2719B31AE4F57E00C17085 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
ED2719B51AE4F59500C17085 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
ED2719B71AE4F5A100C17085 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/AudioToolbox.framework; sourceTree = DEVELOPER_DIR; };
ED2719B91AE4F5A900C17085 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
ED2719BB1AE4F5B500C17085 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
ED2719BD1AE4F5BE00C17085 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
ED2719BF1AE4F5C500C17085 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
ED2719C11AE4F5CC00C17085 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
ED2719C31AE4F5D300C17085 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
ED2719C51AE4F60C00C17085 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
ED2719C71AE4F61500C17085 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
ED2719C91AE4F61D00C17085 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
ED2719CB1AE4F62A00C17085 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
ED2719CD1AE4F63200C17085 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
ED2719CF1AE4F63D00C17085 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
ED2719D11AE4F64600C17085 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
ED2719D31AE4F64D00C17085 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
EDCA13E71AEA4D4A00F445CA /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; name = res; path = "../tests/js-tests/res"; sourceTree = "<group>"; };
EDCC747E17C455FD007B692C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
A01E17601784C06E00B0CA4A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ED2719DA1AE4F8EB00C17085 /* libcocos2d iOS.a in Frameworks */,
ED2719D51AE4F86500C17085 /* libjscocos2d iOS.a in Frameworks */,
ED2719C41AE4F5D300C17085 /* AVFoundation.framework in Frameworks */,
ED2719C21AE4F5CC00C17085 /* UIKit.framework in Frameworks */,
ED2719C01AE4F5C500C17085 /* OpenGLES.framework in Frameworks */,
ED2719BE1AE4F5BE00C17085 /* CoreGraphics.framework in Frameworks */,
ED2719BC1AE4F5B500C17085 /* QuartzCore.framework in Frameworks */,
ED2719BA1AE4F5A900C17085 /* OpenAL.framework in Frameworks */,
ED2719B81AE4F5A100C17085 /* AudioToolbox.framework in Frameworks */,
ED2719B61AE4F59500C17085 /* Foundation.framework in Frameworks */,
ED2719B41AE4F57E00C17085 /* libz.dylib in Frameworks */,
ED2719B21AE4F57200C17085 /* CoreMotion.framework in Frameworks */,
ED2719B01AE4F56500C17085 /* SystemConfiguration.framework in Frameworks */,
ED2719AE1AE4F55800C17085 /* AdSupport.framework in Frameworks */,
ED2719AC1AE4F55000C17085 /* MessageUI.framework in Frameworks */,
ED2719AA1AE4F54500C17085 /* MediaPlayer.framework in Frameworks */,
ED2719A81AE4F53B00C17085 /* Security.framework in Frameworks */,
ED2719A61AE4F52F00C17085 /* CoreTelephony.framework in Frameworks */,
ED2719A41AE4F51F00C17085 /* StoreKit.framework in Frameworks */,
ED2719A21AE4F4F000C17085 /* GameController.framework in Frameworks */,
A01E18F81784C59400B0CA4A /* libsqlite3.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A035A5DA1782290400987F6C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ED2719DC1AE4FA1600C17085 /* libjscocos2d Mac.a in Frameworks */,
ED2719DB1AE4FA1200C17085 /* libcocos2d Mac.a in Frameworks */,
ED2719D41AE4F64D00C17085 /* Cocoa.framework in Frameworks */,
ED2719D21AE4F64600C17085 /* OpenGL.framework in Frameworks */,
ED2719D01AE4F63D00C17085 /* QuartzCore.framework in Frameworks */,
ED2719CE1AE4F63200C17085 /* OpenAL.framework in Frameworks */,
ED2719CC1AE4F62A00C17085 /* ApplicationServices.framework in Frameworks */,
ED2719CA1AE4F61D00C17085 /* AudioToolbox.framework in Frameworks */,
ED2719C81AE4F61600C17085 /* Foundation.framework in Frameworks */,
ED2719C61AE4F60C00C17085 /* libz.dylib in Frameworks */,
BA0613B51AC23B2D003118D6 /* Security.framework in Frameworks */,
0541A77A19750F7A00E45470 /* AppKit.framework in Frameworks */,
A035A71217822E9E00987F6C /* libsqlite3.dylib in Frameworks */,
A035A5E01782290400987F6C /* libcurl.dylib in Frameworks */,
ED743D1717D099F10004076B /* IOKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
A035A5EC1782290400987F6C /* js-tests Mac.app */,
A01E17721784C06E00B0CA4A /* js-tests iOS.app */,
);
name = Products;
sourceTree = "<group>";
};
1A2B72DA18D294AE00ED9E74 /* project */ = {
isa = PBXGroup;
children = (
1A604F3618BF1D5600CC9A93 /* Classes */,
1A604F3B18BF1D6000CC9A93 /* proj.ios */,
1A604F5B18BF1D6600CC9A93 /* proj.mac */,
);
name = project;
sourceTree = "<group>";
};
1A604F2E18BF1D3300CC9A93 /* js-tests */ = {
isa = PBXGroup;
children = (
EDCA13E71AEA4D4A00F445CA /* res */,
BAA7DEE218C84F5000D9A10E /* main.js */,
1A2B72DA18D294AE00ED9E74 /* project */,
BAA7DEE318C84F5000D9A10E /* project.json */,
1A604F3118BF1D4900CC9A93 /* src */,
);
name = "js-tests";
sourceTree = "<group>";
};
1A604F3618BF1D5600CC9A93 /* Classes */ = {
isa = PBXGroup;
children = (
42BCD4A11AAF3BF500D035E5 /* js_Effect3D_bindings.cpp */,
42BCD4A21AAF3BF500D035E5 /* js_Effect3D_bindings.h */,
420BBD0F1AA8840E00493976 /* js_DrawNode3D_bindings.cpp */,
420BBD101AA8840E00493976 /* js_DrawNode3D_bindings.h */,
0541A75C19738D5A00E45470 /* NativeOcClass.h */,
0541A75D19738D5A00E45470 /* NativeOcClass.m */,
1A604F3718BF1D5600CC9A93 /* AppDelegate.cpp */,
1A604F3818BF1D5600CC9A93 /* AppDelegate.h */,
);
name = Classes;
path = "../tests/js-tests/project/Classes";
sourceTree = "<group>";
};
1A604F3B18BF1D6000CC9A93 /* proj.ios */ = {
isa = PBXGroup;
children = (
1A604F3C18BF1D6000CC9A93 /* AppController.h */,
1A604F3D18BF1D6000CC9A93 /* AppController.mm */,
1A604F3E18BF1D6000CC9A93 /* Default-568h@2x.png */,
1A604F3F18BF1D6000CC9A93 /* Default.png */,
1A604F4018BF1D6000CC9A93 /* Default@2x.png */,
1A604F4118BF1D6000CC9A93 /* Icon-114.png */,
1A604F4218BF1D6000CC9A93 /* Icon-120.png */,
1A604F4318BF1D6000CC9A93 /* Icon-144.png */,
1A604F4418BF1D6000CC9A93 /* Icon-152.png */,
1A604F4518BF1D6000CC9A93 /* Icon-57.png */,
1A604F4618BF1D6000CC9A93 /* Icon-72.png */,
1A604F4718BF1D6000CC9A93 /* Icon-76.png */,
1A604F4818BF1D6000CC9A93 /* Info.plist */,
1A604F4918BF1D6000CC9A93 /* main.m */,
1A604F4A18BF1D6000CC9A93 /* Prefix.pch */,
1A604F4B18BF1D6000CC9A93 /* RootViewController.h */,
1A604F4C18BF1D6000CC9A93 /* RootViewController.mm */,
);
name = proj.ios;
path = "../tests/js-tests/project/proj.ios";
sourceTree = "<group>";
};
1A604F5B18BF1D6600CC9A93 /* proj.mac */ = {
isa = PBXGroup;
children = (
1A604F5C18BF1D6600CC9A93 /* InfoPlist.strings */,
1A604F5E18BF1D6600CC9A93 /* MainMenu.xib */,
1A604F6018BF1D6600CC9A93 /* Icon.icns */,
1A604F6118BF1D6600CC9A93 /* main.cpp */,
1A604F6218BF1D6600CC9A93 /* Test_Info.plist */,
1A604F6318BF1D6600CC9A93 /* Test_Prefix.pch */,
);
name = proj.mac;
path = "../tests/js-tests/project/proj.mac";
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
1A604F2518BF1D2000CC9A93 /* cocos2d_js_bindings.xcodeproj */,
1A604F0218BF1D1C00CC9A93 /* cocos2d_libs.xcodeproj */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
BAC9055D195C2D2500307000 /* script */,
1A604F2E18BF1D3300CC9A93 /* js-tests */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = CustomTemplate;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
ED2719D31AE4F64D00C17085 /* Cocoa.framework */,
ED2719D11AE4F64600C17085 /* OpenGL.framework */,
ED2719CF1AE4F63D00C17085 /* QuartzCore.framework */,
ED2719CD1AE4F63200C17085 /* OpenAL.framework */,
ED2719CB1AE4F62A00C17085 /* ApplicationServices.framework */,
ED2719C91AE4F61D00C17085 /* AudioToolbox.framework */,
ED2719C71AE4F61500C17085 /* Foundation.framework */,
ED2719C51AE4F60C00C17085 /* libz.dylib */,
ED2719C31AE4F5D300C17085 /* AVFoundation.framework */,
ED2719C11AE4F5CC00C17085 /* UIKit.framework */,
ED2719BF1AE4F5C500C17085 /* OpenGLES.framework */,
ED2719BD1AE4F5BE00C17085 /* CoreGraphics.framework */,
ED2719BB1AE4F5B500C17085 /* QuartzCore.framework */,
ED2719B91AE4F5A900C17085 /* OpenAL.framework */,
ED2719B71AE4F5A100C17085 /* AudioToolbox.framework */,
ED2719B51AE4F59500C17085 /* Foundation.framework */,
ED2719B31AE4F57E00C17085 /* libz.dylib */,
ED2719B11AE4F57100C17085 /* CoreMotion.framework */,
ED2719AF1AE4F56500C17085 /* SystemConfiguration.framework */,
ED2719AD1AE4F55800C17085 /* AdSupport.framework */,
ED2719AB1AE4F55000C17085 /* MessageUI.framework */,
ED2719A91AE4F54500C17085 /* MediaPlayer.framework */,
ED2719A71AE4F53B00C17085 /* Security.framework */,
ED2719A51AE4F52E00C17085 /* CoreTelephony.framework */,
ED2719A31AE4F51F00C17085 /* StoreKit.framework */,
ED2719A11AE4F4F000C17085 /* GameController.framework */,
BA0613B41AC23B2D003118D6 /* Security.framework */,
0541A77919750F7A00E45470 /* AppKit.framework */,
A035A71117822E9E00987F6C /* libsqlite3.dylib */,
1A9F808C177E98A600D9A1CB /* libcurl.dylib */,
EDCC747E17C455FD007B692C /* IOKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
BAC9055D195C2D2500307000 /* script */ = {
isa = PBXGroup;
children = (
BA2350541948262700E17B2A /* script */,
);
name = script;
sourceTree = "<group>";
};
ED2719521AE4E68200C17085 /* Products */ = {
isa = PBXGroup;
children = (
ED2719571AE4E68200C17085 /* libcocos2d Mac.a */,
ED2719591AE4E68200C17085 /* libcocos2d iOS.a */,
);
name = Products;
sourceTree = "<group>";
};
ED27195A1AE4E69800C17085 /* Products */ = {
isa = PBXGroup;
children = (
ED27195F1AE4E69800C17085 /* libjscocos2d Mac.a */,
ED2719611AE4E69800C17085 /* libjscocos2d iOS.a */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A01E16C01784C06E00B0CA4A /* js-tests iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = A01E176F1784C06E00B0CA4A /* Build configuration list for PBXNativeTarget "js-tests iOS" */;
buildPhases = (
EDCA13EE1AEA4E7B00F445CA /* ShellScript */,
A01E16CB1784C06E00B0CA4A /* Resources */,
A01E16F51784C06E00B0CA4A /* Sources */,
A01E17601784C06E00B0CA4A /* Frameworks */,
);
buildRules = (
);
dependencies = (
ED2719951AE4F14A00C17085 /* PBXTargetDependency */,
ED27199F1AE4F48800C17085 /* PBXTargetDependency */,
);
name = "js-tests iOS";
productName = iphone;
productReference = A01E17721784C06E00B0CA4A /* js-tests iOS.app */;
productType = "com.apple.product-type.application";
};
A035A5441782290400987F6C /* js-tests Mac */ = {
isa = PBXNativeTarget;
buildConfigurationList = A035A5E91782290400987F6C /* Build configuration list for PBXNativeTarget "js-tests Mac" */;
buildPhases = (
EDCA13E61AEA4C8100F445CA /* Run Script */,
A035A54F1782290400987F6C /* Resources */,
A035A5701782290400987F6C /* Sources */,
A035A5DA1782290400987F6C /* Frameworks */,
);
buildRules = (
);
dependencies = (
ED2719991AE4F15800C17085 /* PBXTargetDependency */,
ED2719971AE4F15100C17085 /* PBXTargetDependency */,
);
name = "js-tests Mac";
productName = iphone;
productReference = A035A5EC1782290400987F6C /* js-tests Mac.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "cocos2d_js_tests" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = ED27195A1AE4E69800C17085 /* Products */;
ProjectRef = 1A604F2518BF1D2000CC9A93 /* cocos2d_js_bindings.xcodeproj */;
},
{
ProductGroup = ED2719521AE4E68200C17085 /* Products */;
ProjectRef = 1A604F0218BF1D1C00CC9A93 /* cocos2d_libs.xcodeproj */;
},
);
projectRoot = "";
targets = (
A035A5441782290400987F6C /* js-tests Mac */,
A01E16C01784C06E00B0CA4A /* js-tests iOS */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
ED2719571AE4E68200C17085 /* libcocos2d Mac.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libcocos2d Mac.a";
remoteRef = ED2719561AE4E68200C17085 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
ED2719591AE4E68200C17085 /* libcocos2d iOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libcocos2d iOS.a";
remoteRef = ED2719581AE4E68200C17085 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
ED27195F1AE4E69800C17085 /* libjscocos2d Mac.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libjscocos2d Mac.a";
remoteRef = ED27195E1AE4E69800C17085 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
ED2719611AE4E69800C17085 /* libjscocos2d iOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libjscocos2d iOS.a";
remoteRef = ED2719601AE4E69800C17085 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
A01E16CB1784C06E00B0CA4A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BA2350561948262700E17B2A /* script in Resources */,
BAA7DEE718C84F5000D9A10E /* project.json in Resources */,
1A604F5518BF1D6000CC9A93 /* Icon-57.png in Resources */,
EDCA13E91AEA4D4A00F445CA /* res in Resources */,
1A604F5218BF1D6000CC9A93 /* Icon-120.png in Resources */,
1A604F5618BF1D6000CC9A93 /* Icon-72.png in Resources */,
1A604F5118BF1D6000CC9A93 /* Icon-114.png in Resources */,
1A604F5718BF1D6000CC9A93 /* Icon-76.png in Resources */,
1A604F3518BF1D4900CC9A93 /* src in Resources */,
1A604F5018BF1D6000CC9A93 /* Default@2x.png in Resources */,
1A604F4E18BF1D6000CC9A93 /* Default-568h@2x.png in Resources */,
1A604F5318BF1D6000CC9A93 /* Icon-144.png in Resources */,
1A604F5418BF1D6000CC9A93 /* Icon-152.png in Resources */,
1A604F4F18BF1D6000CC9A93 /* Default.png in Resources */,
BAA7DEE518C84F5000D9A10E /* main.js in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A035A54F1782290400987F6C /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BAA7DEE618C84F5000D9A10E /* project.json in Resources */,
1A604F6418BF1D6600CC9A93 /* InfoPlist.strings in Resources */,
BA2350551948262700E17B2A /* script in Resources */,
1A604F6618BF1D6600CC9A93 /* Icon.icns in Resources */,
1A604F3418BF1D4900CC9A93 /* src in Resources */,
EDCA13E81AEA4D4A00F445CA /* res in Resources */,
1A604F6518BF1D6600CC9A93 /* MainMenu.xib in Resources */,
BAA7DEE418C84F5000D9A10E /* main.js in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
EDCA13E61AEA4C8100F445CA /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\ncocos_dir=${SRCROOT}/../tests/js-tests/res\nif [ -d \"${cocos_dir}\" ]; then\nrm -rv \"${cocos_dir}\"\nmkdir \"${cocos_dir}\"\nelse\nmkdir \"${cocos_dir}\"\nfi\n\ncp -r \"${SRCROOT}/../tests/cpp-tests/Resources/\" \"${cocos_dir}\"";
};
EDCA13EE1AEA4E7B00F445CA /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "#!/bin/bash\ncocos_dir=${SRCROOT}/../tests/js-tests/res\nif [ -d \"${cocos_dir}\" ]; then\nrm -rv \"${cocos_dir}\"\nmkdir \"${cocos_dir}\"\nelse\nmkdir \"${cocos_dir}\"\nfi\n\ncp -r \"${SRCROOT}/../tests/cpp-tests/Resources/\" \"${cocos_dir}\"";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
A01E16F51784C06E00B0CA4A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0541A76319738D8C00E45470 /* NativeOcClass.m in Sources */,
1A604F5A18BF1D6000CC9A93 /* RootViewController.mm in Sources */,
42BCD4A41AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */,
420BBD121AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */,
1A604F3A18BF1D5600CC9A93 /* AppDelegate.cpp in Sources */,
1A604F5918BF1D6000CC9A93 /* main.m in Sources */,
1A604F4D18BF1D6000CC9A93 /* AppController.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A035A5701782290400987F6C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0541A77819750DE700E45470 /* NativeOcClass.m in Sources */,
1A604F6718BF1D6600CC9A93 /* main.cpp in Sources */,
42BCD4A31AAF3BF500D035E5 /* js_Effect3D_bindings.cpp in Sources */,
420BBD111AA8840E00493976 /* js_DrawNode3D_bindings.cpp in Sources */,
1A604F3918BF1D5600CC9A93 /* AppDelegate.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
ED2719951AE4F14A00C17085 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "libjscocos2d iOS";
targetProxy = ED2719941AE4F14A00C17085 /* PBXContainerItemProxy */;
};
ED2719971AE4F15100C17085 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "libcocos2d Mac";
targetProxy = ED2719961AE4F15100C17085 /* PBXContainerItemProxy */;
};
ED2719991AE4F15800C17085 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "libjscocos2d Mac";
targetProxy = ED2719981AE4F15800C17085 /* PBXContainerItemProxy */;
};
ED27199F1AE4F48800C17085 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "libcocos2d iOS";
targetProxy = ED27199E1AE4F48800C17085 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
1A604F5C18BF1D6600CC9A93 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
1A604F5D18BF1D6600CC9A93 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
1A604F5E18BF1D6600CC9A93 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
1A604F5F18BF1D6600CC9A93 /* en */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
A01E17701784C06E00B0CA4A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_DYNAMIC_NO_PIC = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_IPHONE,
COCOS2D_JAVASCRIPT,
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "$(SRCROOT)/../tests/js-tests/project/proj.ios/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
OTHER_LDFLAGS = "-ObjC";
PROVISIONING_PROFILE = "";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external/spidermonkey/include/ios";
VALID_ARCHS = "arm64 armv7";
};
name = Debug;
};
A01E17711784C06E00B0CA4A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
CC_TARGET_OS_IPHONE,
COCOS2D_JAVASCRIPT,
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "$(SRCROOT)/../tests/js-tests/project/proj.ios/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
OTHER_LDFLAGS = "-ObjC";
PROVISIONING_PROFILE = "";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/ios $(SRCROOT)/../external/spidermonkey/include/ios";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "arm64 armv7";
};
name = Release;
};
A035A5EA1782290400987F6C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
GCC_DYNAMIC_NO_PIC = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
COCOS2D_JAVASCRIPT,
CC_TARGET_OS_MAC,
CC_KEYBOARD_SUPPORT,
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "$(SRCROOT)/../tests/js-tests/project/proj.mac/Test_Info.plist";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external/spidermonkey/include/mac";
};
name = Debug;
};
A035A5EB1782290400987F6C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
COCOS2D_JAVASCRIPT,
CC_TARGET_OS_MAC,
CC_KEYBOARD_SUPPORT,
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "$(SRCROOT)/../tests/js-tests/project/proj.mac/Test_Info.plist";
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../cocos/platform/mac $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external/spidermonkey/include/mac";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"COCOS2D_DEBUG=1",
USE_FILE32API,
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/physics $(SRCROOT)/../cocos/math/kazmath $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_PREPROCESSOR_DEFINITIONS = (
NDEBUG,
USE_FILE32API,
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../cocos/base $(SRCROOT)/../cocos/physics $(SRCROOT)/../cocos/math/kazmath $(SRCROOT)/../cocos/2d $(SRCROOT)/../cocos/gui $(SRCROOT)/../cocos/network $(SRCROOT)/../cocos/audio/include $(SRCROOT)/../cocos/editor-support $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../external/chipmunk/include/chipmunk $(SRCROOT)/../cocos/scripting/js-bindings/auto $(SRCROOT)/../cocos/scripting/js-bindings/manual";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A01E176F1784C06E00B0CA4A /* Build configuration list for PBXNativeTarget "js-tests iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A01E17701784C06E00B0CA4A /* Debug */,
A01E17711784C06E00B0CA4A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
A035A5E91782290400987F6C /* Build configuration list for PBXNativeTarget "js-tests Mac" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A035A5EA1782290400987F6C /* Debug */,
A035A5EB1782290400987F6C /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "cocos2d_js_tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}

File diff suppressed because it is too large Load Diff

View File

@ -100,9 +100,7 @@
15EFA68D198B3AD8000C57D3 /* libluacocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15EFA665198B33EE000C57D3 /* libluacocos2d iOS.a */; };
182C5CBA1A95B2FD00C30D34 /* CocosStudio3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 182C5CB81A95B2FD00C30D34 /* CocosStudio3DTest.cpp */; };
182C5CBB1A95B30500C30D34 /* CocosStudio3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 182C5CB81A95B2FD00C30D34 /* CocosStudio3DTest.cpp */; };
182C5CCD1A95D9BA00C30D34 /* src in Resources */ = {isa = PBXBuildFile; fileRef = 182C5CCC1A95D9BA00C30D34 /* src */; };
182C5CCE1A95D9BA00C30D34 /* src in Resources */ = {isa = PBXBuildFile; fileRef = 182C5CCC1A95D9BA00C30D34 /* src */; };
182C5CCF1A95D9BA00C30D34 /* src in Resources */ = {isa = PBXBuildFile; fileRef = 182C5CCC1A95D9BA00C30D34 /* src */; };
182C5CD01A95D9BA00C30D34 /* src in Resources */ = {isa = PBXBuildFile; fileRef = 182C5CCC1A95D9BA00C30D34 /* src */; };
1A0EE2A218CDF6DA004CD58F /* libcocos2d Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FB01807A4F9005B8026 /* libcocos2d Mac.a */; };
1A0EE2A518CDF6DA004CD58F /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDCC747E17C455FD007B692C /* IOKit.framework */; };
@ -784,6 +782,10 @@
3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; };
3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; };
3EA0FB72191C844400B170C8 /* UIVideoPlayerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */; };
5046AB4A1AF2A8D80060550B /* MaterialSystemTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5046AB481AF2A8D80060550B /* MaterialSystemTest.cpp */; };
5046AB4B1AF2A8D80060550B /* MaterialSystemTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5046AB481AF2A8D80060550B /* MaterialSystemTest.cpp */; };
5046AB5B1AF2C4180060550B /* Materials in Resources */ = {isa = PBXBuildFile; fileRef = 5046AB5A1AF2C4180060550B /* Materials */; };
5046AB5C1AF2C4180060550B /* Materials in Resources */ = {isa = PBXBuildFile; fileRef = 5046AB5A1AF2C4180060550B /* Materials */; };
527B1F3019EF9819000A1F82 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 527B1F2E19EF9819000A1F82 /* Default-667h@2x.png */; };
527B1F3119EF9819000A1F82 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 527B1F2F19EF9819000A1F82 /* Default-736h@3x.png */; };
527B1F3419EF9CF8000A1F82 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 527B1F3219EF9CF8000A1F82 /* Default-667h@2x.png */; };
@ -836,6 +838,8 @@
B63993321A49359F00B07923 /* Particle3D in Resources */ = {isa = PBXBuildFile; fileRef = B63993301A49359F00B07923 /* Particle3D */; };
B6C039D919C95D83007207DC /* LightTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6C039D719C95D83007207DC /* LightTest.cpp */; };
B6C039DA19C95D83007207DC /* LightTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6C039D719C95D83007207DC /* LightTest.cpp */; };
B6CAB54E1AF9AA6C00B9B856 /* Physics3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6CAB54C1AF9AA6C00B9B856 /* Physics3DTest.cpp */; };
B6CAB54F1AF9AA6C00B9B856 /* Physics3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6CAB54C1AF9AA6C00B9B856 /* Physics3DTest.cpp */; };
C04F935A1941B05400E9FEAB /* TileMapTest2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C04F93581941B05400E9FEAB /* TileMapTest2.cpp */; };
C04F935B1941B05400E9FEAB /* TileMapTest2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C04F93581941B05400E9FEAB /* TileMapTest2.cpp */; };
C08689C118D370C90093E810 /* background.caf in Resources */ = {isa = PBXBuildFile; fileRef = C08689C018D370C90093E810 /* background.caf */; };
@ -1735,6 +1739,9 @@
3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIVideoPlayerTest.cpp; sourceTree = "<group>"; };
3EA0FB71191C844400B170C8 /* UIVideoPlayerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIVideoPlayerTest.h; sourceTree = "<group>"; };
46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = cocos2d_libs.xcodeproj; sourceTree = "<group>"; };
5046AB481AF2A8D80060550B /* MaterialSystemTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MaterialSystemTest.cpp; sourceTree = "<group>"; };
5046AB491AF2A8D80060550B /* MaterialSystemTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaterialSystemTest.h; sourceTree = "<group>"; };
5046AB5A1AF2C4180060550B /* Materials */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Materials; path = "../tests/cpp-tests/Resources/Materials"; sourceTree = "<group>"; };
527B1F2E19EF9819000A1F82 /* Default-667h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h@2x.png"; sourceTree = "<group>"; };
527B1F2F19EF9819000A1F82 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = "<group>"; };
527B1F3219EF9CF8000A1F82 /* Default-667h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h@2x.png"; sourceTree = "<group>"; };
@ -1780,6 +1787,8 @@
B63993301A49359F00B07923 /* Particle3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Particle3D; path = "../tests/cpp-tests/Resources/Particle3D"; sourceTree = "<group>"; };
B6C039D719C95D83007207DC /* LightTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LightTest.cpp; path = LightTest/LightTest.cpp; sourceTree = "<group>"; };
B6C039D819C95D83007207DC /* LightTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LightTest.h; path = LightTest/LightTest.h; sourceTree = "<group>"; };
B6CAB54C1AF9AA6C00B9B856 /* Physics3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Physics3DTest.cpp; path = Physics3DTest/Physics3DTest.cpp; sourceTree = "<group>"; };
B6CAB54D1AF9AA6C00B9B856 /* Physics3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Physics3DTest.h; path = Physics3DTest/Physics3DTest.h; sourceTree = "<group>"; };
C04F93581941B05400E9FEAB /* TileMapTest2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TileMapTest2.cpp; sourceTree = "<group>"; };
C04F93591941B05400E9FEAB /* TileMapTest2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TileMapTest2.h; sourceTree = "<group>"; };
C08689C018D370C90093E810 /* background.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = background.caf; path = "../tests/cpp-tests/Resources/background.caf"; sourceTree = "<group>"; };
@ -2198,6 +2207,8 @@
1AC3592418CECF0A00F37B72 /* Classes */ = {
isa = PBXGroup;
children = (
B6CAB54B1AF9AA4B00B9B856 /* Physics3DTest */,
5046AB471AF2A8D80060550B /* MaterialSystemTest */,
6886696E1AE8E8A000C2CFD9 /* SpritePolygonTest */,
B603F1AC1AC8EA2E00A9579C /* TerrainTest */,
182C5CB71A95B28A00C30D34 /* CocosStudio3DTest */,
@ -3238,6 +3249,7 @@
1AC35CA818CED83500F37B72 /* Resources */ = {
isa = PBXGroup;
children = (
5046AB5A1AF2C4180060550B /* Materials */,
B603F1B31AC8FBFB00A9579C /* TerrainTest */,
B63993301A49359F00B07923 /* Particle3D */,
15B3709219EE5D1000ABE682 /* Manifests */,
@ -3965,6 +3977,15 @@
name = Products;
sourceTree = "<group>";
};
5046AB471AF2A8D80060550B /* MaterialSystemTest */ = {
isa = PBXGroup;
children = (
5046AB481AF2A8D80060550B /* MaterialSystemTest.cpp */,
5046AB491AF2A8D80060550B /* MaterialSystemTest.h */,
);
path = MaterialSystemTest;
sourceTree = "<group>";
};
6886696E1AE8E8A000C2CFD9 /* SpritePolygonTest */ = {
isa = PBXGroup;
children = (
@ -4028,6 +4049,15 @@
name = LightTest;
sourceTree = "<group>";
};
B6CAB54B1AF9AA4B00B9B856 /* Physics3DTest */ = {
isa = PBXGroup;
children = (
B6CAB54C1AF9AA6C00B9B856 /* Physics3DTest.cpp */,
B6CAB54D1AF9AA6C00B9B856 /* Physics3DTest.h */,
);
name = Physics3DTest;
sourceTree = "<group>";
};
D0FD03611A3B543700825BB5 /* AllocatorTest */ = {
isa = PBXGroup;
children = (
@ -4515,7 +4545,6 @@
1AC35CFE18CED84500F37B72 /* Particles in Resources */,
1AC35CF418CED84500F37B72 /* Images in Resources */,
1AC35CE018CED84500F37B72 /* configs in Resources */,
182C5CCD1A95D9BA00C30D34 /* src in Resources */,
1AC35CE618CED84500F37B72 /* effect2.ogg in Resources */,
1AC35CFA18CED84500F37B72 /* Misc in Resources */,
38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */,
@ -4532,6 +4561,7 @@
1AC35CE218CED84500F37B72 /* effect1.raw in Resources */,
1AC35CF218CED84500F37B72 /* Hello.png in Resources */,
1AC35CA518CECF1E00F37B72 /* Icon.icns in Resources */,
5046AB5B1AF2C4180060550B /* Materials in Resources */,
B63993311A49359F00B07923 /* Particle3D in Resources */,
1AC35CEC18CED84500F37B72 /* fonts in Resources */,
1AC35CCA18CED84500F37B72 /* animations in Resources */,
@ -4604,7 +4634,7 @@
1AC35CE118CED84500F37B72 /* configs in Resources */,
1AC35CE918CED84500F37B72 /* extensions in Resources */,
3E2BDAD219BEA3E20055CDCD /* audio in Resources */,
182C5CCF1A95D9BA00C30D34 /* src in Resources */,
5046AB5C1AF2C4180060550B /* Materials in Resources */,
C08689C318D370C90093E810 /* background.caf in Resources */,
1AC35C9518CECF1400F37B72 /* Icon-72.png in Resources */,
15B3709419EE5D1000ABE682 /* Manifests in Resources */,
@ -4873,11 +4903,13 @@
1AC35C2118CECF0C00F37B72 /* ParallaxTest.cpp in Sources */,
1AC35C6B18CECF0C00F37B72 /* ZwoptexTest.cpp in Sources */,
1AC35B7718CECF0C00F37B72 /* ComponentsTestScene.cpp in Sources */,
5046AB4A1AF2A8D80060550B /* MaterialSystemTest.cpp in Sources */,
B603F1AF1AC8EA4E00A9579C /* TerrainTest.cpp in Sources */,
29080DC7191B595E0066F8DF /* UISceneManager.cpp in Sources */,
1AC35C2F18CECF0C00F37B72 /* PerformanceParticleTest.cpp in Sources */,
1AC35B4918CECF0C00F37B72 /* Bug-914.cpp in Sources */,
1AC35B6318CECF0C00F37B72 /* EffectsAdvancedTest.cpp in Sources */,
B6CAB54E1AF9AA6C00B9B856 /* Physics3DTest.cpp in Sources */,
B639932E1A490EC700B07923 /* Particle3DTest.cpp in Sources */,
1AC35C5F18CECF0C00F37B72 /* Paddle.cpp in Sources */,
1AC35BDB18CECF0C00F37B72 /* SceneEditorTest.cpp in Sources */,
@ -5047,6 +5079,7 @@
1AC35BEC18CECF0C00F37B72 /* CCControlSliderTest.cpp in Sources */,
29080DB4191B595E0066F8DF /* UILayoutTest_Editor.cpp in Sources */,
1AC35C4E18CECF0C00F37B72 /* SpineTest.cpp in Sources */,
B6CAB54F1AF9AA6C00B9B856 /* Physics3DTest.cpp in Sources */,
1AC35C1E18CECF0C00F37B72 /* NewRendererTest.cpp in Sources */,
5EBEECB11995247000429821 /* DrawNode3D.cpp in Sources */,
1AC35B6818CECF0C00F37B72 /* AnimationsTestLayer.cpp in Sources */,
@ -5190,6 +5223,7 @@
29080DB2191B595E0066F8DF /* UILayoutTest.cpp in Sources */,
1AC35B6A18CECF0C00F37B72 /* ButtonTestLayer.cpp in Sources */,
29080DB6191B595E0066F8DF /* UIListViewTest.cpp in Sources */,
5046AB4B1AF2A8D80060550B /* MaterialSystemTest.cpp in Sources */,
1AC35B3018CECF0C00F37B72 /* Box2dView.cpp in Sources */,
29080DAE191B595E0066F8DF /* UIImageViewTest.cpp in Sources */,
1AC35C1018CECF0C00F37B72 /* LabelTest.cpp in Sources */,
@ -5908,6 +5942,7 @@
"COCOS2D_DEBUG=1",
USE_FILE32API,
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
"CC_ENABLE_BULLET_INTEGRATION=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
@ -5936,6 +5971,7 @@
NDEBUG,
USE_FILE32API,
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
"CC_ENABLE_BULLET_INTEGRATION=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;

View File

@ -1,8 +0,0 @@
@echo off
SETLOCAL
:start
mkdir win32-msvc-vs2012-x86
cd win32-msvc-vs2012-x86
cmake -G "Visual Studio 11" ../..
pause

View File

@ -90,6 +90,24 @@ ActionInterval* ActionEase::getInnerAction()
// EaseRateAction
//
EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate)
{
EaseRateAction *easeRateAction = new (std::nothrow) EaseRateAction();
if (easeRateAction)
{
if (easeRateAction->initWithAction(action, rate))
{
easeRateAction->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(easeRateAction);
}
}
return easeRateAction;
}
bool EaseRateAction::initWithAction(ActionInterval *action, float rate)
{
if (ActionEase::initWithAction(action))

View File

@ -97,6 +97,14 @@ private:
class CC_DLL EaseRateAction : public ActionEase
{
public:
/**
@brief Creates the action with the inner action and the rate parameter.
@param action A given ActionInterval
@param rate A given rate
@return An autoreleased EaseRateAction object.
**/
static EaseRateAction* create(ActionInterval* action, float rate);
/**
@brief Set the rate value for the ease rate action.
@param rate The value will be set.

View File

@ -165,7 +165,7 @@ Sequence* Sequence::createWithTwoActions(FiniteTimeAction *actionOne, FiniteTime
return sequence;
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
Sequence* Sequence::variadicCreate(FiniteTimeAction *action1, ...)
{
va_list params;
@ -554,7 +554,7 @@ RepeatForever *RepeatForever::reverse() const
// Spawn
//
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
Spawn* Spawn::variadicCreate(FiniteTimeAction *action1, ...)
{
va_list params;
@ -2511,4 +2511,60 @@ void TargetedAction::setForcedTarget(Node* forcedTarget)
}
}
// ActionFloat
ActionFloat* ActionFloat::create(float duration, float from, float to, ActionFloatCallback callback)
{
auto ref = new (std::nothrow) ActionFloat();
if (ref && ref->initWithDuration(duration, from, to, callback))
{
ref->autorelease();
return ref;
}
CC_SAFE_DELETE(ref);
return ref;
}
bool ActionFloat::initWithDuration(float duration, float from, float to, ActionFloatCallback callback)
{
if (ActionInterval::initWithDuration(duration))
{
_from = from;
_to = to;
_callback = callback;
return true;
}
return false;
}
ActionFloat* ActionFloat::clone() const
{
auto a = new (std::nothrow) ActionFloat();
a->initWithDuration(_duration, _from, _to, _callback);
a->autorelease();
return a;
}
void ActionFloat::startWithTarget(Node *target)
{
ActionInterval::startWithTarget(target);
_delta = _to - _from;
}
void ActionFloat::update(float delta)
{
float value = _to - _delta * (1 - delta);
if (_callback)
{
// report back value to caller
_callback(value);
}
}
ActionFloat* ActionFloat::reverse() const
{
return ActionFloat::create(_duration, _to, _from, _callback);
}
NS_CC_END

View File

@ -124,8 +124,8 @@ public:
*
* @return An autoreleased Sequence object.
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// VS2013 does not support nullptr in variable args lists and variadic templates are also not supported
typedef FiniteTimeAction* M;
static Sequence* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); }
static Sequence* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); }
@ -351,8 +351,8 @@ public:
*
* @return An autoreleased Spawn object.
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// VS2013 does not support nullptr in variable args lists and variadic templates are also not supported.
typedef FiniteTimeAction* M;
static Spawn* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); }
static Spawn* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); }
@ -1525,6 +1525,58 @@ private:
CC_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
};
/**
* @class ActionFloat
* @brief Action used to animate any value in range [from,to] over specified time interval
*/
class CC_DLL ActionFloat : public ActionInterval
{
public:
/**
* Callback function used to report back result
*/
typedef std::function<void(float value)> ActionFloatCallback;
/**
* Creates FloatAction with specified duration, from value, to value and callback to report back
* results
* @param duration of the action
* @param from value to start from
* @param to value to be at the end of the action
* @param callback to report back result
*
* @return An autoreleased ActionFloat object
*/
static ActionFloat* create(float duration, float from, float to, ActionFloatCallback callback);
/**
* Overrided ActionInterval methods
*/
void startWithTarget(Node* target) override;
void update(float delta) override;
ActionFloat* reverse() const override;
ActionFloat* clone() const override;
CC_CONSTRUCTOR_ACCESS:
ActionFloat() {};
virtual ~ActionFloat() {};
bool initWithDuration(float duration, float from, float to, ActionFloatCallback callback);
protected:
/* From value */
float _from;
/* To value */
float _to;
/* delta time */
float _delta;
/* Callback to report back results */
ActionFloatCallback _callback;
private:
CC_DISALLOW_COPY_AND_ASSIGN(ActionFloat);
};
// end of actions group
/// @}

View File

@ -209,14 +209,6 @@ bool Camera::initPerspective(float fieldOfView, float aspectRatio, float nearPla
_nearPlane = nearPlane;
_farPlane = farPlane;
Mat4::createPerspective(_fieldOfView, _aspectRatio, _nearPlane, _farPlane, &_projection);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
//if needed, we need to add a rotation for Landscape orientations on Windows Phone 8 since it is always in Portrait Mode
GLView* view = Director::getInstance()->getOpenGLView();
if(view != nullptr)
{
setAdditionalProjection(view->getOrientationMatrix());
}
#endif
_viewProjectionDirty = true;
_frustumDirty = true;
@ -230,14 +222,6 @@ bool Camera::initOrthographic(float zoomX, float zoomY, float nearPlane, float f
_nearPlane = nearPlane;
_farPlane = farPlane;
Mat4::createOrthographicOffCenter(0, _zoom[0], 0, _zoom[1], _nearPlane, _farPlane, &_projection);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
//if needed, we need to add a rotation for Landscape orientations on Windows Phone 8 since it is always in Portrait Mode
GLView* view = Director::getInstance()->getOpenGLView();
if(view != nullptr)
{
setAdditionalProjection(view->getOrientationMatrix());
}
#endif
_viewProjectionDirty = true;
_frustumDirty = true;

View File

@ -32,6 +32,11 @@
#include "renderer/CCRenderer.h"
#include "base/CCDirector.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#define CC_CLIPPING_NODE_OPENGLES 0
#else
#define CC_CLIPPING_NODE_OPENGLES 1
#endif
NS_CC_BEGIN
@ -41,6 +46,7 @@ static GLint g_sStencilBits = -1;
// where n is the number of bits of the stencil buffer.
static GLint s_layer = -1;
#if CC_CLIPPING_NODE_OPENGLES
static void setProgram(Node *n, GLProgram *p)
{
n->setGLProgram(p);
@ -50,6 +56,7 @@ static void setProgram(Node *n, GLProgram *p)
setProgram(child, p);
}
}
#endif
ClippingNode::ClippingNode()
: _stencil(nullptr)
@ -257,8 +264,7 @@ void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32
renderer->addCommand(&_beforeVisitCmd);
if (_alphaThreshold < 1)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#else
#if CC_CLIPPING_NODE_OPENGLES
// since glAlphaTest do not exists in OES, use a shader that writes
// pixel only if greater than an alpha threshold
GLProgram *program = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV);
@ -438,7 +444,7 @@ void ClippingNode::onBeforeVisit()
// enable alpha test only if the alpha threshold < 1,
// indeed if alpha threshold == 1, every pixel will be drawn anyways
if (_alphaThreshold < 1) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#if !CC_CLIPPING_NODE_OPENGLES
// manually save the alpha test state
_currentAlphaTestEnabled = glIsEnabled(GL_ALPHA_TEST);
glGetIntegerv(GL_ALPHA_TEST_FUNC, (GLint *)&_currentAlphaTestFunc);
@ -449,8 +455,6 @@ void ClippingNode::onBeforeVisit()
CHECK_GL_ERROR_DEBUG();
// pixel will be drawn only if greater than an alpha threshold
glAlphaFunc(GL_GREATER, _alphaThreshold);
#else
#endif
}
@ -462,15 +466,15 @@ void ClippingNode::onAfterDrawStencil()
// restore alpha test state
if (_alphaThreshold < 1)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#if CC_CLIPPING_NODE_OPENGLES
// FIXME: we need to find a way to restore the shaders of the stencil node and its childs
#else
// manually restore the alpha test state
glAlphaFunc(_currentAlphaTestFunc, _currentAlphaTestRef);
if (!_currentAlphaTestEnabled)
{
glDisable(GL_ALPHA_TEST);
}
#else
// FIXME: we need to find a way to restore the shaders of the stencil node and its childs
#endif
}

View File

@ -156,4 +156,19 @@ bool ComponentContainer::isEmpty() const
return (_components == nullptr || _components->empty());
}
void ComponentContainer::onEnter()
{
for (auto iter = _components->begin(); iter != _components->end(); ++iter)
{
iter->second->onEnter();
}
}
void ComponentContainer::onExit()
{
for (auto iter = _components->begin(); iter != _components->end(); ++iter)
{
iter->second->onExit();
}
}
NS_CC_END

View File

@ -58,6 +58,10 @@ public:
virtual bool remove(Component *com);
virtual void removeAll();
virtual void visit(float delta);
virtual void onEnter();
virtual void onExit();
public:
bool isEmpty() const;

View File

@ -269,10 +269,11 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
break;
}
outRect.origin.x = _fontRef->glyph->metrics.horiBearingX >> 6;
outRect.origin.y = - (_fontRef->glyph->metrics.horiBearingY >> 6);
outRect.size.width = (_fontRef->glyph->metrics.width >> 6);
outRect.size.height = (_fontRef->glyph->metrics.height >> 6);
auto& metrics = _fontRef->glyph->metrics;
outRect.origin.x = metrics.horiBearingX >> 6;
outRect.origin.y = -(metrics.horiBearingY >> 6);
outRect.size.width = (metrics.width >> 6);
outRect.size.height = (metrics.height >> 6);
xAdvance = (static_cast<int>(_fontRef->glyph->metrics.horiAdvance >> 6));
@ -294,35 +295,46 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
break;
}
auto outlineWidth = (bbox.xMax - bbox.xMin)>>6;
auto outlineHeight = (bbox.yMax - bbox.yMin)>>6;
long glyphMinX = outRect.origin.x;
long glyphMaxX = outRect.origin.x + outWidth;
long glyphMinY = -outHeight - outRect.origin.y;
long glyphMaxY = -outRect.origin.y;
auto blendWidth = outlineWidth > outWidth ? outlineWidth : outWidth;
auto blendHeight = outlineHeight > outHeight ? outlineHeight : outHeight;
auto outlineMinX = bbox.xMin >> 6;
auto outlineMaxX = bbox.xMax >> 6;
auto outlineMinY = bbox.yMin >> 6;
auto outlineMaxY = bbox.yMax >> 6;
auto outlineWidth = outlineMaxX - outlineMinX;
auto outlineHeight = outlineMaxY - outlineMinY;
long index,index2;
auto blendImageMinX = MIN(outlineMinX, glyphMinX);
auto blendImageMaxY = MAX(outlineMaxY, glyphMaxY);
auto blendWidth = MAX(outlineMaxX, glyphMaxX) - blendImageMinX;
auto blendHeight = blendImageMaxY - MIN(outlineMinY, glyphMinY);
long index, index2;
auto blendImage = new unsigned char[blendWidth * blendHeight * 2];
memset(blendImage, 0, blendWidth * blendHeight * 2);
auto px = (blendWidth - outlineWidth) / 2;
auto py = (blendHeight - outlineHeight) / 2;
auto px = outlineMinX - blendImageMinX;
auto py = blendImageMaxY - outlineMaxY;
for (int x = 0; x < outlineWidth; ++x)
{
for (int y = 0; y < outlineHeight; ++y)
{
index = px + x + ( (py + y) * blendWidth );
index = px + x + ((py + y) * blendWidth);
index2 = x + (y * outlineWidth);
blendImage[2 * index] = outlineBitmap[index2];
}
}
px = (blendWidth - outWidth) / 2;
py = (blendHeight - outHeight) / 2;
px = glyphMinX - blendImageMinX;
py = blendImageMaxY - glyphMaxY;
for (int x = 0; x < outWidth; ++x)
{
for (int y = 0; y < outHeight; ++y)
{
index = px + x + ( (y + py) * blendWidth );
index = px + x + ((y + py) * blendWidth);
index2 = x + (y * outWidth);
blendImage[2 * index + 1] = copyBitmap[index2];
}

View File

@ -33,7 +33,7 @@
#include <string>
#include <ft2build.h>
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#define generic GenericFromFreeTypeLibrary
#define internal InternalFromFreeTypeLibrary
#endif
@ -41,7 +41,7 @@
#include FT_FREETYPE_H
#include FT_STROKER_H
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#undef generic
#undef internal
#endif

View File

@ -406,13 +406,7 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false *
_commonLineHeight = _fontAtlas->getCommonLineHeight();
_contentDirty = true;
}
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
_useDistanceField = distanceFieldEnabled;
#else
// some older Windows Phones cannot run the ccShader_Label_df.frag program
// so we must disable distance field
_useDistanceField = false;
#endif
_useA8Shader = useA8Shader;
if (_currentLabelType != LabelType::TTF)
@ -591,10 +585,6 @@ void Label::alignText()
return;
}
for (const auto& batchNode:_batchNodes)
{
batchNode->getTextureAtlas()->removeAllQuads();
}
_fontAtlas->prepareLetterDefinitions(_currentUTF16String);
auto& textures = _fontAtlas->getTextures();
if (textures.size() > _batchNodes.size())
@ -615,31 +605,48 @@ void Label::alignText()
if(_labelWidth > 0 || (_currNumLines > 1 && _hAlignment != TextHAlignment::LEFT))
LabelTextFormatter::alignText(this);
int strLen = static_cast<int>(_currentUTF16String.length());
Rect uvRect;
Sprite* letterSprite;
for(const auto &child : _children) {
int tag = child->getTag();
if(tag >= strLen)
{
SpriteBatchNode::removeChild(child, true);
}
else if(tag >= 0)
{
letterSprite = dynamic_cast<Sprite*>(child);
if (letterSprite)
if (!_children.empty())
{
int strLen = static_cast<int>(_currentUTF16String.length());
Rect uvRect;
Sprite* letterSprite;
for (auto index = 0; index < _children.size();) {
auto child = _children.at(index);
int tag = child->getTag();
if (tag >= strLen)
{
uvRect.size.height = _lettersInfo[tag].def.height;
uvRect.size.width = _lettersInfo[tag].def.width;
uvRect.origin.x = _lettersInfo[tag].def.U;
uvRect.origin.y = _lettersInfo[tag].def.V;
letterSprite->setTexture(textures.at(_lettersInfo[tag].def.textureID));
letterSprite->setTextureRect(uvRect);
child->removeFromParentAndCleanup(true);
}
else if (tag >= 0)
{
letterSprite = dynamic_cast<Sprite*>(child);
if (letterSprite)
{
auto& letterDef = _lettersInfo[tag].def;
uvRect.size.height = letterDef.height;
uvRect.size.width = letterDef.width;
uvRect.origin.x = letterDef.U;
uvRect.origin.y = letterDef.V;
letterSprite->setBatchNode(_batchNodes[letterDef.textureID]);
letterSprite->setTextureRect(uvRect, false, uvRect.size);
letterSprite->setPosition(_lettersInfo[tag].position.x + letterDef.width/2,
_lettersInfo[tag].position.y - letterDef.height/2);
}
++index;
}
else
{
++index;
}
}
}
for (const auto& batchNode : _batchNodes)
{
batchNode->getTextureAtlas()->removeAllQuads();
}
updateQuads();
updateColor();
@ -900,8 +907,11 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
{
glprogram->setUniformLocationWith4f(_uniformTextColor,
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
glprogram->setUniformLocationWith4f(_uniformEffectColor,
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
if (_currLabelEffect == LabelEffect::OUTLINE || _currLabelEffect == LabelEffect::GLOW)
{
glprogram->setUniformLocationWith4f(_uniformEffectColor,
_shadowColor4F.r, _shadowColor4F.g, _shadowColor4F.b, _shadowColor4F.a);
}
getGLProgram()->setUniformsForBuiltins(_shadowTransform);
for (const auto &child : _children)
@ -951,8 +961,7 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
for(const auto &child: _children)
{
if(child->getTag() >= 0)
child->updateTransform();
child->updateTransform();
}
for (const auto& batchNode:_batchNodes)

View File

@ -845,7 +845,7 @@ LayerMultiplex::~LayerMultiplex()
}
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
LayerMultiplex * LayerMultiplex::createVariadic(Layer * layer, ...)
{
va_list args;

View File

@ -596,8 +596,8 @@ public:
* In lua:local create(...)
* @endcode
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// VS2013 does not support nullptr in variable args lists and variadic templates are also not supported
typedef Layer* M;
static LayerMultiplex* create(M m1, std::nullptr_t listEnd) { return createVariadic(m1, NULL); }
static LayerMultiplex* create(M m1, M m2, std::nullptr_t listEnd) { return createVariadic(m1, m2, NULL); }

View File

@ -57,7 +57,7 @@ Menu* Menu::create()
return Menu::create(nullptr, nullptr);
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
Menu * Menu::variadicCreate(MenuItem* item, ...)
{
va_list args;

View File

@ -63,8 +63,8 @@ public:
*/
static Menu* create();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// VS2013 does not support nullptr in variable args lists and variadic templates are also not supported.
typedef MenuItem* M;
static Menu* create(M m1, std::nullptr_t listEnd) { return variadicCreate(m1, NULL); }
static Menu* create(M m1, M m2, std::nullptr_t listEnd) { return variadicCreate(m1, m2, NULL); }

View File

@ -820,7 +820,7 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler s
return ret;
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
MenuItemToggle * MenuItemToggle::createWithCallbackVA(const ccMenuCallback &callback, MenuItem* item, ...)
{
va_list args;

View File

@ -493,8 +493,8 @@ public:
*/
static MenuItemToggle * createWithCallback(const ccMenuCallback& callback, const Vector<MenuItem*>& menuItems);
/** Creates a menu item from a list of items with a callable object. */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// VS2013 does not support nullptr in variable args lists and variadic templates are also not supported.
typedef MenuItem* M;
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, NULL); }

View File

@ -44,6 +44,7 @@ THE SOFTWARE.
#include "2d/CCComponentContainer.h"
#include "renderer/CCGLProgram.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCMaterial.h"
#include "math/TransformUtils.h"
#include "deprecated/CCString.h"
@ -833,6 +834,7 @@ void Node::setGLProgramState(cocos2d::GLProgramState *glProgramState)
}
}
void Node::setGLProgram(GLProgram *glProgram)
{
if (_glProgramState == nullptr || (_glProgramState && _glProgramState->getGLProgram() != glProgram))

View File

@ -52,6 +52,7 @@ class Renderer;
class Director;
class GLProgram;
class GLProgramState;
class Material;
#if CC_USE_PHYSICS
class PhysicsBody;
class PhysicsWorld;

View File

@ -130,7 +130,7 @@ emitter.startSpin = 0;
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#ifdef RELATIVE
#undef RELATIVE
#endif

View File

@ -551,13 +551,6 @@ void RenderTexture::onBegin()
if(!_keepMatrix)
{
director->setProjection(director->getProjection());
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
auto modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION,modifiedProjection);
#endif
const Size& texSize = _texture->getContentSizeInPixels();
// Calculate the adjustment ratios based on the old and new projections
@ -569,14 +562,6 @@ void RenderTexture::onBegin()
Mat4::createOrthographicOffCenter((float)-1.0 / widthRatio, (float)1.0 / widthRatio, (float)-1.0 / heightRatio, (float)1.0 / heightRatio, -1, 1, &orthoMatrix);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, orthoMatrix);
}
else
{
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
auto modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
modifiedProjection = GLViewImpl::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, modifiedProjection);
#endif
}
//calculate viewport
{

View File

@ -37,6 +37,11 @@ THE SOFTWARE.
#include "physics/CCPhysicsWorld.h"
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
#include "physics3d/CCPhysics3DWorld.h"
#include "physics3d/CCPhysics3DComponent.h"
#endif
NS_CC_BEGIN
Scene::Scene()
@ -44,6 +49,10 @@ Scene::Scene()
: _physicsWorld(nullptr)
#endif
{
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
_physics3DWorld = nullptr;
_physics3dDebugCamera = nullptr;
#endif
_ignoreAnchorPointForPosition = true;
setAnchorPoint(Vec2(0.5f, 0.5f));
@ -61,6 +70,10 @@ Scene::~Scene()
{
#if CC_USE_PHYSICS
CC_SAFE_DELETE(_physicsWorld);
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
CC_SAFE_RELEASE(_physics3DWorld);
CC_SAFE_RELEASE(_physics3dDebugCamera);
#endif
Director::getInstance()->getEventDispatcher()->removeEventListener(_event);
CC_SAFE_RELEASE(_event);
@ -155,10 +168,22 @@ void Scene::render(Renderer* renderer)
camera->clearBackground(1.0);
//visit the scene
visit(renderer, transform, 0);
renderer->render();
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
}
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
if (_physics3DWorld && _physics3DWorld->isDebugDrawEnabled())
{
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, _physics3dDebugCamera != nullptr ? _physics3dDebugCamera->getViewProjectionMatrix() : defaultCamera->getViewProjectionMatrix());
_physics3DWorld->debugDraw(renderer);
renderer->render();
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
}
#endif
Camera::_visitingCamera = nullptr;
}
@ -177,7 +202,16 @@ void Scene::removeAllChildren()
}
}
#if CC_USE_PHYSICS
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
void Scene::setPhysics3DDebugCamera(Camera* camera)
{
CC_SAFE_RETAIN(camera);
CC_SAFE_RELEASE(_physics3dDebugCamera);
_physics3dDebugCamera = camera;
}
#endif
#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION))
void Scene::addChild(Node* child, int zOrder, int tag)
{
Node::addChild(child, zOrder, tag);
@ -214,7 +248,17 @@ bool Scene::initWithPhysics()
CC_BREAK_IF( ! (director = Director::getInstance()) );
this->setContentSize(director->getWinSize());
#if CC_USE_PHYSICS
CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::construct(*this)));
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
Physics3DWorldDes info;
//TODO: FIX ME
//info.isDebugDrawEnabled = true;
CC_BREAK_IF(! (_physics3DWorld = Physics3DWorld::create(&info)));
_physics3DWorld->retain();
#endif
// success
ret = true;
@ -224,6 +268,7 @@ bool Scene::initWithPhysics()
void Scene::addChildToPhysicsWorld(Node* child)
{
#if CC_USE_PHYSICS
if (_physicsWorld)
{
std::function<void(Node*)> addToPhysicsWorldFunc = nullptr;
@ -244,6 +289,30 @@ void Scene::addChildToPhysicsWorld(Node* child)
addToPhysicsWorldFunc(child);
}
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
if (_physics3DWorld)
{
std::function<void(Node*)> addToPhysicsWorldFunc = nullptr;
addToPhysicsWorldFunc = [this, &addToPhysicsWorldFunc](Node* node) -> void
{
static std::string comName = Physics3DComponent::getPhysics3DComponentName();
auto com = static_cast<Physics3DComponent*>(node->getComponent(comName));
if (com)
{
com->addToPhysicsWorld(_physics3DWorld);
}
auto& children = node->getChildren();
for( const auto &n : children) {
addToPhysicsWorldFunc(n);
}
};
addToPhysicsWorldFunc(child);
}
#endif
}
#endif

View File

@ -41,6 +41,9 @@ class EventCustom;
#if CC_USE_PHYSICS
class PhysicsWorld;
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
class Physics3DWorld;
#endif
/**
* @addtogroup _2d
* @{
@ -136,15 +139,31 @@ protected:
private:
CC_DISALLOW_COPY_AND_ASSIGN(Scene);
#if CC_USE_PHYSICS
#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION))
public:
virtual void addChild(Node* child, int zOrder, int tag) override;
virtual void addChild(Node* child, int zOrder, const std::string &name) override;
#if CC_USE_PHYSICS
/** Get the physics world of the scene.
* @return The physics world of the scene.
* @js NA
*/
inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; }
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
/** Get the 3d physics world of the scene.
* @return The 3d physics world of the scene.
* @js NA
*/
inline Physics3DWorld* getPhysics3DWorld() { return _physics3DWorld; }
/**
* Set Physics3D debug draw camera.
*/
void setPhysics3DDebugCamera(Camera* camera);
#endif
/** Create a scene with physics.
* @return An autoreleased Scene object with physics.
@ -158,8 +177,15 @@ CC_CONSTRUCTOR_ACCESS:
protected:
void addChildToPhysicsWorld(Node* child);
#if CC_USE_PHYSICS
PhysicsWorld* _physicsWorld;
#endif // CC_USE_PHYSICS
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
Physics3DWorld* _physics3DWorld;
Camera* _physics3dDebugCamera; //
#endif
#endif // (CC_USE_PHYSICS || CC_USE_3D_PHYSICS)
};
// end of _2d group

View File

@ -142,11 +142,7 @@ bool TextFieldTTF::attachWithIME()
auto pGlView = Director::getInstance()->getOpenGLView();
if (pGlView)
{
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8 && CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
pGlView->setIMEKeyboardState(true);
#else
pGlView->setIMEKeyboardState(true, _inputText);
#endif
}
}
return ret;
@ -161,11 +157,7 @@ bool TextFieldTTF::detachWithIME()
auto glView = Director::getInstance()->getOpenGLView();
if (glView)
{
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8 && CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
glView->setIMEKeyboardState(false);
#else
glView->setIMEKeyboardState(false, "");
#endif
}
}
return ret;

View File

@ -61,7 +61,7 @@ unsigned int MarchingSquare::findFirstNoneTransparentPixel()
return i;
}
}
throw "image is all transparent!";
CCASSERT(false, "image is all transparent!");
}
unsigned char MarchingSquare::getAlphaAt(const unsigned int i)
@ -235,10 +235,13 @@ void MarchingSquare::marchSquare(int startx, int starty)
break;
case 0:
CCLOG("case 0 at x:%d, y:%d, coming from %d, %d", curx, cury, prevx, prevy);
throw "this shoudln't happen";
CCASSERT(false, "this shoudln't happen");
break;
case 15:
CCLOG("case 15 at x:%d, y:%d, coming from %d, %d", curx, cury, prevx, prevy);
throw "this shoudln't happen";
CCASSERT(false, "this shoudln't happen");
break;
}
//little optimization
// if previous direction is same as current direction,
@ -266,8 +269,7 @@ void MarchingSquare::marchSquare(int startx, int starty)
prevx = stepx;
prevy = stepy;
problem = false;
if(count > totalPixel)
throw "oh no, marching square cannot find starting position";
CCASSERT(count <= totalPixel, "oh no, marching square cannot find starting position");
} while(curx != startx || cury != starty);
}

View File

@ -7,7 +7,7 @@
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES;$(EngineRoot)external\freetype2\include\win32\freetype2;$(EngineRoot)external\freetype2\include\win32\</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos;$(EngineRoot)cocos\platform;$(EngineRoot)cocos\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES;$(EngineRoot)external\freetype2\include\win32\freetype2;$(EngineRoot)external\freetype2\include\win32\;$(EngineRoot)external</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_VARIADIC_MAX=10;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ProjectReference>

View File

@ -20,18 +20,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup>
@ -50,7 +44,7 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration).win32\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration).win32\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
@ -78,7 +72,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\box2d;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\OpenalSoft\include;$(EngineRoot)external\win32-specific\MP3Decoder\include;$(EngineRoot)external\win32-specific\OggDecoder\include;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;$(EngineRoot)external\poly2tri;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_USRDLL;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_USRDLL;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -119,7 +113,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\debug-lib\*.*"
<ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ModuleDefinitionFile>cocos2d.def</ModuleDefinitionFile>
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;libbullet.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
@ -133,7 +127,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\debug-lib\*.*"
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\MP3Decoder\include;$(EngineRoot)external\win32-specific\OggDecoder\include;$(EngineRoot)external\win32-specific\OpenalSoft\include;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\Box2d;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32\;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;$(EngineRoot)external\poly2tri;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_USRDLL;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_USRDLL;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;CC_ENABLE_BULLET_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
@ -166,7 +160,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>sqlite3.lib;libcurl_imp.lib;websockets.lib;libmpg123.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;libbullet.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>LIBCMTD.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@ -567,6 +561,14 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="..\network\HttpClient.cpp" />
<ClCompile Include="..\network\SocketIO.cpp" />
<ClCompile Include="..\network\WebSocket.cpp" />
<ClCompile Include="..\physics3d\CCPhysics3D.cpp" />
<ClCompile Include="..\physics3d\CCPhysics3DComponent.cpp" />
<ClCompile Include="..\physics3d\CCPhysics3DConstraint.cpp" />
<ClCompile Include="..\physics3d\CCPhysics3DDebugDrawer.cpp" />
<ClCompile Include="..\physics3d\CCPhysics3DObject.cpp" />
<ClCompile Include="..\physics3d\CCPhysics3DShape.cpp" />
<ClCompile Include="..\physics3d\CCPhysics3DWorld.cpp" />
<ClCompile Include="..\physics3d\CCPhysicsSprite3D.cpp" />
<ClCompile Include="..\physics\CCPhysicsBody.cpp" />
<ClCompile Include="..\physics\CCPhysicsContact.cpp" />
<ClCompile Include="..\physics\CCPhysicsJoint.cpp" />
@ -591,13 +593,17 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp" />
<ClCompile Include="..\renderer\ccGLStateCache.cpp" />
<ClCompile Include="..\renderer\CCGroupCommand.cpp" />
<ClCompile Include="..\renderer\CCMaterial.cpp" />
<ClCompile Include="..\renderer\CCMeshCommand.cpp" />
<ClCompile Include="..\renderer\CCPass.cpp" />
<ClCompile Include="..\renderer\CCPrimitive.cpp" />
<ClCompile Include="..\renderer\CCPrimitiveCommand.cpp" />
<ClCompile Include="..\renderer\CCQuadCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderer.cpp" />
<ClCompile Include="..\renderer\CCRenderState.cpp" />
<ClCompile Include="..\renderer\ccShaders.cpp" />
<ClCompile Include="..\renderer\CCTechnique.cpp" />
<ClCompile Include="..\renderer\CCTexture2D.cpp" />
<ClCompile Include="..\renderer\CCTextureAtlas.cpp" />
<ClCompile Include="..\renderer\CCTextureCache.cpp" />
@ -1142,6 +1148,14 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\network\HttpResponse.h" />
<ClInclude Include="..\network\SocketIO.h" />
<ClInclude Include="..\network\WebSocket.h" />
<ClInclude Include="..\physics3d\CCPhysics3D.h" />
<ClInclude Include="..\physics3d\CCPhysics3DComponent.h" />
<ClInclude Include="..\physics3d\CCPhysics3DConstraint.h" />
<ClInclude Include="..\physics3d\CCPhysics3DDebugDrawer.h" />
<ClInclude Include="..\physics3d\CCPhysics3DObject.h" />
<ClInclude Include="..\physics3d\CCPhysics3DShape.h" />
<ClInclude Include="..\physics3d\CCPhysics3DWorld.h" />
<ClInclude Include="..\physics3d\CCPhysicsSprite3D.h" />
<ClInclude Include="..\physics\CCPhysicsBody.h" />
<ClInclude Include="..\physics\CCPhysicsContact.h" />
<ClInclude Include="..\physics\CCPhysicsHelper.h" />
@ -1173,14 +1187,18 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
<ClInclude Include="..\renderer\CCGLProgramStateCache.h" />
<ClInclude Include="..\renderer\ccGLStateCache.h" />
<ClInclude Include="..\renderer\CCGroupCommand.h" />
<ClInclude Include="..\renderer\CCMaterial.h" />
<ClInclude Include="..\renderer\CCMeshCommand.h" />
<ClInclude Include="..\renderer\CCPass.h" />
<ClInclude Include="..\renderer\CCPrimitive.h" />
<ClInclude Include="..\renderer\CCPrimitiveCommand.h" />
<ClInclude Include="..\renderer\CCQuadCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommandPool.h" />
<ClInclude Include="..\renderer\CCRenderer.h" />
<ClInclude Include="..\renderer\CCRenderState.h" />
<ClInclude Include="..\renderer\ccShaders.h" />
<ClInclude Include="..\renderer\CCTechnique.h" />
<ClInclude Include="..\renderer\CCTexture2D.h" />
<ClInclude Include="..\renderer\CCTextureAtlas.h" />
<ClInclude Include="..\renderer\CCTextureCache.h" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="physics">
@ -268,6 +268,9 @@
<Filter Include="external\poly2tri\sweep">
<UniqueIdentifier>{c37eceeb-5702-4ff7-88de-94680a22266f}</UniqueIdentifier>
</Filter>
<Filter Include="physics3d">
<UniqueIdentifier>{e492faef-2169-4117-8d73-e0c66271fe25}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
@ -1827,6 +1830,42 @@
<ClCompile Include="SpritePolygonCache.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysics3D.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysics3DComponent.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysics3DConstraint.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysics3DDebugDrawer.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysics3DObject.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysics3DShape.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysics3DWorld.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\physics3d\CCPhysicsSprite3D.cpp">
<Filter>physics3d</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCPass.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCRenderState.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCTechnique.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCMaterial.cpp">
<Filter>renderer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -3575,6 +3614,42 @@
<ClInclude Include="SpritePolygonCache.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysics3D.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysics3DComponent.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysics3DConstraint.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysics3DDebugDrawer.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysics3DObject.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysics3DShape.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysics3DWorld.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\physics3d\CCPhysicsSprite3D.h">
<Filter>physics3d</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCPass.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCRenderState.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCTechnique.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCMaterial.h">
<Filter>renderer</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -2,7 +2,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
MinimumVisualStudioVersion = 12.0.21005.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libcocos2d_8_1", "libcocos2d_8_1", "{CA9DBD4B-603D-494E-802A-1C36E3EA3F07}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Shared", "libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems", "{5D6F020F-7E72-4494-90A0-2DF11D235DF9}"

View File

@ -488,14 +488,18 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgramStateCache.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccGLStateCache.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGroupCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCMaterial.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCMeshCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPass.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPrimitive.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPrimitiveCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCQuadCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderCommand.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderCommandPool.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderer.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderState.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShaders.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTechnique.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTexture2D.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTextureAtlas.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTextureCache.h" />
@ -1051,13 +1055,17 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGLProgramStateCache.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccGLStateCache.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCGroupCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCMaterial.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCMeshCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPass.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPrimitive.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPrimitiveCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCQuadCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderCommand.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderer.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderState.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\ccShaders.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTechnique.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTexture2D.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTextureAtlas.cpp" />
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTextureCache.cpp" />

View File

@ -1773,6 +1773,18 @@
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygonCache.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderState.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTechnique.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCMaterial.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPass.h">
<Filter>renderer</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos2d.cpp" />
@ -3369,6 +3381,18 @@
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\SpritePolygonCache.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCRenderState.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTechnique.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCMaterial.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCPass.cpp">
<Filter>renderer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="2d">

View File

@ -113,40 +113,40 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.7_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.7_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.7_Windows_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.7_Windows_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.7_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_Windows_8.1</TargetName>
<TargetName>libcocos2d_v3.7_Windows_8.1</TargetName>
<LinkIncremental>
</LinkIncremental>
</PropertyGroup>

View File

@ -85,23 +85,23 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.7_WindowsPhone_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.7_WindowsPhone_8.1</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.7_WindowsPhone_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<GenerateManifest>false</GenerateManifest>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
<TargetName>libcocos2d_v3.6_WindowsPhone_8.1</TargetName>
<TargetName>libcocos2d_v3.7_WindowsPhone_8.1</TargetName>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

View File

@ -30,7 +30,7 @@
#include "base/CCRef.h"
#include "math/CCMath.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#undef NEAR
#endif

View File

@ -26,24 +26,106 @@
#include "3d/CCMeshSkin.h"
#include "3d/CCSkeleton3D.h"
#include "3d/CCMeshVertexIndexData.h"
#include "2d/CCLight.h"
#include "2d/CCScene.h"
#include "base/CCEventDispatcher.h"
#include "base/CCDirector.h"
#include "base/CCConfiguration.h"
#include "renderer/CCTextureCache.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCMaterial.h"
#include "renderer/CCTechnique.h"
#include "renderer/CCPass.h"
#include "renderer/CCRenderer.h"
#include "math/Mat4.h"
using namespace std;
NS_CC_BEGIN
// Helpers
static const char *s_dirLightUniformColorName = "u_DirLightSourceColor";
static std::vector<Vec3> s_dirLightUniformColorValues;
static const char *s_dirLightUniformDirName = "u_DirLightSourceDirection";
static std::vector<Vec3> s_dirLightUniformDirValues;
static const char *s_pointLightUniformColorName = "u_PointLightSourceColor";
static std::vector<Vec3> s_pointLightUniformColorValues;
static const char *s_pointLightUniformPositionName = "u_PointLightSourcePosition";
static std::vector<Vec3> s_pointLightUniformPositionValues;
static const char *s_pointLightUniformRangeInverseName = "u_PointLightSourceRangeInverse";
static std::vector<float> s_pointLightUniformRangeInverseValues;
static const char *s_spotLightUniformColorName = "u_SpotLightSourceColor";
static std::vector<Vec3> s_spotLightUniformColorValues;
static const char *s_spotLightUniformPositionName = "u_SpotLightSourcePosition";
static std::vector<Vec3> s_spotLightUniformPositionValues;
static const char *s_spotLightUniformDirName = "u_SpotLightSourceDirection";
static std::vector<Vec3> s_spotLightUniformDirValues;
static const char *s_spotLightUniformInnerAngleCosName = "u_SpotLightSourceInnerAngleCos";
static std::vector<float> s_spotLightUniformInnerAngleCosValues;
static const char *s_spotLightUniformOuterAngleCosName = "u_SpotLightSourceOuterAngleCos";
static std::vector<float> s_spotLightUniformOuterAngleCosValues;
static const char *s_spotLightUniformRangeInverseName = "u_SpotLightSourceRangeInverse";
static std::vector<float> s_spotLightUniformRangeInverseValues;
static const char *s_ambientLightUniformColorName = "u_AmbientLightSourceColor";
// helpers
static void resetLightUniformValues()
{
const auto& conf = Configuration::getInstance();
int maxDirLight = conf->getMaxSupportDirLightInShader();
int maxPointLight = conf->getMaxSupportPointLightInShader();
int maxSpotLight = conf->getMaxSupportSpotLightInShader();
s_dirLightUniformColorValues.assign(maxDirLight, Vec3::ZERO);
s_dirLightUniformDirValues.assign(maxDirLight, Vec3::ZERO);
s_pointLightUniformColorValues.assign(maxPointLight, Vec3::ZERO);
s_pointLightUniformPositionValues.assign(maxPointLight, Vec3::ZERO);
s_pointLightUniformRangeInverseValues.assign(maxPointLight, 0.0f);
s_spotLightUniformColorValues.assign(maxSpotLight, Vec3::ZERO);
s_spotLightUniformPositionValues.assign(maxSpotLight, Vec3::ZERO);
s_spotLightUniformDirValues.assign(maxSpotLight, Vec3::ZERO);
s_spotLightUniformInnerAngleCosValues.assign(maxSpotLight, 0.0f);
s_spotLightUniformOuterAngleCosValues.assign(maxSpotLight, 0.0f);
s_spotLightUniformRangeInverseValues.assign(maxSpotLight, 0.0f);
}
//Generate a dummy texture when the texture file is missing
static Texture2D * getDummyTexture()
{
auto texture = Director::getInstance()->getTextureCache()->getTextureForKey("/dummyTexture");
if(!texture)
{
#ifdef NDEBUG
unsigned char data[] ={0,0,0,0};//1*1 transparent picture
#else
unsigned char data[] ={255,0,0,255};//1*1 red picture
#endif
Image * image =new (std::nothrow) Image();
image->initWithRawData(data,sizeof(data),1,1,sizeof(unsigned char));
texture=Director::getInstance()->getTextureCache()->addImage(image,"/dummyTexture");
image->release();
}
return texture;
}
Mesh::Mesh()
: _texture(nullptr)
, _skin(nullptr)
, _visible(true)
, _isTransparent(false)
, _meshIndexData(nullptr)
, _material(nullptr)
, _glProgramState(nullptr)
, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED)
, _visibleChanged(nullptr)
, _blendDirty(true)
{
}
@ -52,6 +134,7 @@ Mesh::~Mesh()
CC_SAFE_RELEASE(_texture);
CC_SAFE_RELEASE(_skin);
CC_SAFE_RELEASE(_meshIndexData);
CC_SAFE_RELEASE(_material);
CC_SAFE_RELEASE(_glProgramState);
}
@ -172,6 +255,11 @@ void Mesh::setVisible(bool visible)
}
}
bool Mesh::isVisible() const
{
return _visible;
}
void Mesh::setTexture(const std::string& texPath)
{
auto tex = Director::getInstance()->getTextureCache()->addImage(texPath);
@ -180,13 +268,93 @@ void Mesh::setTexture(const std::string& texPath)
void Mesh::setTexture(Texture2D* tex)
{
// Texture must be saved for future use
// it doesn't matter if the material is already set or not
// This functionality is added for compatibility issues
if (tex != _texture)
{
CC_SAFE_RETAIN(tex);
CC_SAFE_RELEASE(_texture);
_texture = tex;
bindMeshCommand();
}
if (_material) {
auto technique = _material->_currentTechnique;
for(auto& pass: technique->_passes)
{
pass->setTexture(tex);
}
}
bindMeshCommand();
}
Texture2D* Mesh::getTexture() const
{
return _texture;
}
void Mesh::setMaterial(Material* material)
{
if (_material != material) {
CC_SAFE_RELEASE(_material);
_material = material;
CC_SAFE_RETAIN(_material);
}
}
Material* Mesh::getMaterial() const
{
return _material;
}
void Mesh::draw(Renderer* renderer, float globalZOrder, const Mat4& transform, uint32_t flags, unsigned int lightMask, const Vec4& color, bool forceDepthWrite)
{
if (! isVisible())
return;
bool isTransparent = (_isTransparent || color.w < 1.f);
float globalZ = isTransparent ? 0 : globalZOrder;
if (isTransparent)
flags |= Node::FLAGS_RENDER_AS_3D;
_meshCommand.init(globalZ,
_material,
getVertexBuffer(),
getIndexBuffer(),
getPrimitiveType(),
getIndexFormat(),
getIndexCount(),
transform,
flags);
if (isTransparent && !forceDepthWrite)
_material->getStateBlock()->setDepthWrite(false);
else
_material->getStateBlock()->setDepthWrite(true);
_meshCommand.setSkipBatching(isTransparent);
// set default uniforms for Mesh
// 'u_color' and others
const auto& scene = Director::getInstance()->getRunningScene();
auto technique = _material->_currentTechnique;
for(auto& pass : technique->_passes)
{
auto programState = pass->getGLProgramState();
programState->setUniformVec4("u_color", color);
if (_skin)
programState->setUniformVec4v("u_matrixPalette", _skin->getMatrixPalette(), (GLsizei)_skin->getMatrixPaletteSize());
if (scene && scene->getLights().size() > 0)
setLightUniforms(programState, scene, color, lightMask);
}
renderer->addCommand(&_meshCommand);
}
void Mesh::setSkin(MeshSkin* skin)
@ -214,13 +382,25 @@ void Mesh::setMeshIndexData(MeshIndexData* subMesh)
void Mesh::setGLProgramState(GLProgramState* glProgramState)
{
if (_glProgramState != glProgramState)
{
CC_SAFE_RETAIN(glProgramState);
CC_SAFE_RELEASE(_glProgramState);
_glProgramState = glProgramState;
bindMeshCommand();
}
// XXX create dummy texture
auto material = Material::createWithGLStateProgram(glProgramState);
setMaterial(material);
// Was the texture set before teh GLProgramState ? Set it
if (_texture)
setTexture(_texture);
if (_blendDirty)
setBlendFunc(_blend);
bindMeshCommand();
}
GLProgramState* Mesh::getGLProgramState() const
{
return _material ?
_material->_currentTechnique->_passes.at(0)->getGLProgramState()
: nullptr;
}
void Mesh::calculateAABB()
@ -262,25 +442,183 @@ void Mesh::calculateAABB()
void Mesh::bindMeshCommand()
{
if (_glProgramState && _meshIndexData && _texture)
if (_material && _meshIndexData)
{
GLuint texID = _texture ? _texture->getName() : 0;
_meshCommand.genMaterialID(texID, _glProgramState, _meshIndexData->getVertexBuffer()->getVBO(), _meshIndexData->getIndexBuffer()->getVBO(), _blend);
_meshCommand.setCullFaceEnabled(true);
_meshCommand.setDepthTestEnabled(true);
auto pass = _material->_currentTechnique->_passes.at(0);
auto glprogramstate = pass->getGLProgramState();
auto texture = pass->getTexture();
auto textureid = texture ? texture->getName() : 0;
// XXX
// auto blend = pass->getStateBlock()->getBlendFunc();
auto blend = BlendFunc::ALPHA_PREMULTIPLIED;
_meshCommand.genMaterialID(textureid, glprogramstate, _meshIndexData->getVertexBuffer()->getVBO(), _meshIndexData->getIndexBuffer()->getVBO(), blend);
_material->getStateBlock()->setCullFace(true);
_material->getStateBlock()->setDepthTest(true);
}
}
void Mesh::setLightUniforms(GLProgramState* glProgramState, Scene* scene, const Vec4& color, unsigned int lightmask)
{
CCASSERT(glProgramState, "Invalid glProgramstate");
CCASSERT(scene, "Invalid scene");
const auto& conf = Configuration::getInstance();
int maxDirLight = conf->getMaxSupportDirLightInShader();
int maxPointLight = conf->getMaxSupportPointLightInShader();
int maxSpotLight = conf->getMaxSupportSpotLightInShader();
auto &lights = scene->getLights();
if (glProgramState->getVertexAttribsFlags() & (1 << GLProgram::VERTEX_ATTRIB_NORMAL))
{
resetLightUniformValues();
GLint enabledDirLightNum = 0;
GLint enabledPointLightNum = 0;
GLint enabledSpotLightNum = 0;
Vec3 ambientColor;
for (const auto& light : lights)
{
bool useLight = light->isEnabled() && ((unsigned int)light->getLightFlag() & lightmask);
if (useLight)
{
float intensity = light->getIntensity();
switch (light->getLightType())
{
case LightType::DIRECTIONAL:
{
if(enabledDirLightNum < maxDirLight)
{
auto dirLight = static_cast<DirectionLight *>(light);
Vec3 dir = dirLight->getDirectionInWorld();
dir.normalize();
const Color3B &col = dirLight->getDisplayedColor();
s_dirLightUniformColorValues[enabledDirLightNum].set(col.r / 255.0f * intensity, col.g / 255.0f * intensity, col.b / 255.0f * intensity);
s_dirLightUniformDirValues[enabledDirLightNum] = dir;
++enabledDirLightNum;
}
}
break;
case LightType::POINT:
{
if(enabledPointLightNum < maxPointLight)
{
auto pointLight = static_cast<PointLight *>(light);
Mat4 mat= pointLight->getNodeToWorldTransform();
const Color3B &col = pointLight->getDisplayedColor();
s_pointLightUniformColorValues[enabledPointLightNum].set(col.r / 255.0f * intensity, col.g / 255.0f * intensity, col.b / 255.0f * intensity);
s_pointLightUniformPositionValues[enabledPointLightNum].set(mat.m[12], mat.m[13], mat.m[14]);
s_pointLightUniformRangeInverseValues[enabledPointLightNum] = 1.0f / pointLight->getRange();
++enabledPointLightNum;
}
}
break;
case LightType::SPOT:
{
if(enabledSpotLightNum < maxSpotLight)
{
auto spotLight = static_cast<SpotLight *>(light);
Vec3 dir = spotLight->getDirectionInWorld();
dir.normalize();
Mat4 mat= light->getNodeToWorldTransform();
const Color3B &col = spotLight->getDisplayedColor();
s_spotLightUniformColorValues[enabledSpotLightNum].set(col.r / 255.0f * intensity, col.g / 255.0f * intensity, col.b / 255.0f * intensity);
s_spotLightUniformPositionValues[enabledSpotLightNum].set(mat.m[12], mat.m[13], mat.m[14]);
s_spotLightUniformDirValues[enabledSpotLightNum] = dir;
s_spotLightUniformInnerAngleCosValues[enabledSpotLightNum] = spotLight->getCosInnerAngle();
s_spotLightUniformOuterAngleCosValues[enabledSpotLightNum] = spotLight->getCosOuterAngle();
s_spotLightUniformRangeInverseValues[enabledSpotLightNum] = 1.0f / spotLight->getRange();
++enabledSpotLightNum;
}
}
break;
case LightType::AMBIENT:
{
auto ambLight = static_cast<AmbientLight *>(light);
const Color3B &col = ambLight->getDisplayedColor();
ambientColor.add(col.r / 255.0f * intensity, col.g / 255.0f * intensity, col.b / 255.0f * intensity);
}
break;
default:
break;
}
}
}
if (0 < maxDirLight)
{
glProgramState->setUniformVec3v(s_dirLightUniformColorName, &s_dirLightUniformColorValues[0], s_dirLightUniformColorValues.size());
glProgramState->setUniformVec3v(s_dirLightUniformDirName, &s_dirLightUniformDirValues[0], s_dirLightUniformDirValues.size());
}
if (0 < maxPointLight)
{
glProgramState->setUniformVec3v(s_pointLightUniformColorName, &s_pointLightUniformColorValues[0], s_pointLightUniformColorValues.size());
glProgramState->setUniformVec3v(s_pointLightUniformPositionName, &s_pointLightUniformPositionValues[0], s_pointLightUniformPositionValues.size());
glProgramState->setUniformFloatv(s_pointLightUniformRangeInverseName, &s_pointLightUniformRangeInverseValues[0], s_pointLightUniformRangeInverseValues.size());
}
if (0 < maxSpotLight)
{
glProgramState->setUniformVec3v(s_spotLightUniformColorName, &s_spotLightUniformColorValues[0], s_spotLightUniformColorValues.size());
glProgramState->setUniformVec3v(s_spotLightUniformPositionName, &s_spotLightUniformPositionValues[0], s_spotLightUniformPositionValues.size());
glProgramState->setUniformVec3v(s_spotLightUniformDirName, &s_spotLightUniformDirValues[0], s_spotLightUniformDirValues.size());
glProgramState->setUniformFloatv(s_spotLightUniformInnerAngleCosName, &s_spotLightUniformInnerAngleCosValues[0], s_spotLightUniformInnerAngleCosValues.size());
glProgramState->setUniformFloatv(s_spotLightUniformOuterAngleCosName, &s_spotLightUniformOuterAngleCosValues[0], s_spotLightUniformOuterAngleCosValues.size());
glProgramState->setUniformFloatv(s_spotLightUniformRangeInverseName, &s_spotLightUniformRangeInverseValues[0], s_spotLightUniformRangeInverseValues.size());
}
glProgramState->setUniformVec3(s_ambientLightUniformColorName, Vec3(ambientColor.x, ambientColor.y, ambientColor.z));
}
else // normal does not exist
{
Vec3 ambient(0.0f, 0.0f, 0.0f);
bool hasAmbient = false;
for (const auto& light : lights)
{
if (light->getLightType() == LightType::AMBIENT)
{
bool useLight = light->isEnabled() && ((unsigned int)light->getLightFlag() & lightmask);
if (useLight)
{
hasAmbient = true;
const Color3B &col = light->getDisplayedColor();
ambient.x += col.r * light->getIntensity();
ambient.y += col.g * light->getIntensity();
ambient.z += col.b * light->getIntensity();
}
}
}
if (hasAmbient)
{
ambient.x /= 255.f; ambient.y /= 255.f; ambient.z /= 255.f;
}
glProgramState->setUniformVec4("u_color", Vec4(color.x * ambient.x, color.y * ambient.y, color.z * ambient.z, color.w));
}
}
void Mesh::setBlendFunc(const BlendFunc &blendFunc)
{
if(_blend.src != blendFunc.src || _blend.dst != blendFunc.dst)
// Blend must be saved for future use
// it doesn't matter if the material is already set or not
// This functionality is added for compatibility issues
if(_blend != blendFunc)
{
_blendDirty = true;
_blend = blendFunc;
}
if (_material) {
_material->getStateBlock()->setBlendFunc(blendFunc);
bindMeshCommand();
}
}
const BlendFunc &Mesh::getBlendFunc() const
const BlendFunc& Mesh::getBlendFunc() const
{
// return _material->_currentTechnique->_passes.at(0)->getBlendFunc();
return _blend;
}
@ -303,5 +641,4 @@ GLuint Mesh::getIndexBuffer() const
{
return _meshIndexData->getIndexBuffer()->getVBO();
}
NS_CC_END

View File

@ -46,6 +46,10 @@ class MeshSkin;
class MeshIndexData;
class GLProgramState;
class GLProgram;
class Material;
class Renderer;
class Scene;
/**
* @brief Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on
*/
@ -92,11 +96,11 @@ public:
/**texture getter and setter*/
void setTexture(const std::string& texPath);
void setTexture(Texture2D* tex);
Texture2D* getTexture() const { return _texture; }
Texture2D* getTexture() const;
/**visible getter and setter*/
void setVisible(bool visible);
bool isVisible() const { return _visible; }
bool isVisible() const;
/**
* skin getter
@ -117,7 +121,7 @@ public:
*
* @lua NA
*/
GLProgramState* getGLProgramState() const { return _glProgramState; }
GLProgramState* getGLProgramState() const;
/**name getter */
const std::string& getName() const { return _name; }
@ -153,21 +157,19 @@ public:
/**get AABB*/
const AABB& getAABB() const { return _aabb; }
CC_CONSTRUCTOR_ACCESS:
Mesh();
virtual ~Mesh();
/**
* Get the default GL program.
*/
GLProgram* getDefaultGLProgram(bool textured);
/**
* Set the default GL program.
/** Sets a new GLProgramState for the Mesh
* A new Material will be created for it
*/
void setGLProgramState(GLProgramState* glProgramState);
/** Sets a new Material to the Mesh */
void setMaterial(Material* material);
/** Returns the Material being used by the Mesh */
Material* getMaterial() const;
void draw(Renderer* renderer, float globalZ, const Mat4& transform, uint32_t flags, unsigned int lightMask, const Vec4& color, bool forceDepthWrite);
/**
* Get the MeshCommand.
*/
@ -186,22 +188,29 @@ CC_CONSTRUCTOR_ACCESS:
*/
void calculateAABB();
/**
* Bind to the MeshCommand
*/
void bindMeshCommand();
CC_CONSTRUCTOR_ACCESS:
Mesh();
virtual ~Mesh();
protected:
Texture2D* _texture; //texture that submesh is using
MeshSkin* _skin; //skin
bool _visible; // is the submesh visible
bool _isTransparent; // is this mesh transparent, it is a property of material in fact
void setLightUniforms(GLProgramState* glProgramState, Scene* scene, const Vec4& color, unsigned int lightmask);
void bindMeshCommand();
Texture2D* _texture; //texture that submesh is using
MeshSkin* _skin; //skin
bool _visible; // is the submesh visible
bool _isTransparent; // is this mesh transparent, it is a property of material in fact
std::string _name;
MeshIndexData* _meshIndexData;
GLProgramState* _glProgramState;
MeshCommand _meshCommand;
BlendFunc _blend;
AABB _aabb;
std::string _name;
MeshCommand _meshCommand;
MeshIndexData* _meshIndexData;
GLProgramState* _glProgramState;
BlendFunc _blend;
bool _blendDirty;
Material* _material;
AABB _aabb;
std::function<void()> _visibleChanged;
};

View File

@ -41,6 +41,9 @@
#include "renderer/CCRenderer.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCGLProgramCache.h"
#include "renderer/CCMaterial.h"
#include "renderer/CCTechnique.h"
#include "renderer/CCPass.h"
#include "deprecated/CCString.h" // For StringUtils::format
@ -63,8 +66,7 @@ Sprite3D* Sprite3D::create()
Sprite3D* Sprite3D::create(const std::string &modelPath)
{
if (modelPath.length() < 4)
CCASSERT(false, "invalid filename for Sprite3D");
CCASSERT(modelPath.length() >= 4, "invalid filename for Sprite3D");
auto sprite = new (std::nothrow) Sprite3D();
if (sprite && sprite->initWithFile(modelPath))
@ -201,7 +203,9 @@ bool Sprite3D::loadFromCache(const std::string& path)
}
for (ssize_t i = 0; i < _meshes.size(); i++) {
_meshes.at(i)->setGLProgramState(spritedata->glProgramStates.at(i));
// cloning is needed in order to have one state per sprite
auto glstate = spritedata->glProgramStates.at(i);
_meshes.at(i)->setGLProgramState(glstate->clone());
}
return true;
}
@ -277,7 +281,7 @@ bool Sprite3D::initWithFile(const std::string &path)
MeshDatas* meshdatas = new (std::nothrow) MeshDatas();
MaterialDatas* materialdatas = new (std::nothrow) MaterialDatas();
NodeDatas* nodeDatas = new (std::nothrow) NodeDatas();
NodeDatas* nodeDatas = new (std::nothrow) NodeDatas();
if (loadFromFile(path, nodeDatas, meshdatas, materialdatas))
{
if (initFrom(*nodeDatas, *meshdatas, *materialdatas))
@ -293,6 +297,7 @@ bool Sprite3D::initWithFile(const std::string &path)
Sprite3DCache::getInstance()->addSprite3DData(path, data);
CC_SAFE_DELETE(meshdatas);
_contentSize = getBoundingBox().size;
return true;
}
}
@ -336,22 +341,22 @@ bool Sprite3D::initFrom(const NodeDatas& nodeDatas, const MeshDatas& meshdatas,
return true;
}
Sprite3D* Sprite3D::createSprite3DNode(NodeData* nodedata,ModelData* modeldata,const MaterialDatas& matrialdatas)
Sprite3D* Sprite3D::createSprite3DNode(NodeData* nodedata,ModelData* modeldata,const MaterialDatas& materialdatas)
{
auto sprite = new (std::nothrow) Sprite3D();
if (sprite)
{
sprite->setName(nodedata->id);
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(modeldata->subMeshId));
if (modeldata->matrialId == "" && matrialdatas.materials.size())
if (modeldata->matrialId == "" && materialdatas.materials.size())
{
const NTextureData* textureData = matrialdatas.materials[0].getTextureData(NTextureData::Usage::Diffuse);
const NTextureData* textureData = materialdatas.materials[0].getTextureData(NTextureData::Usage::Diffuse);
if (!textureData->filename.empty())
mesh->setTexture(textureData->filename);
}
else
{
const NMaterialData* materialData=matrialdatas.getMaterialData(modeldata->matrialId);
const NMaterialData* materialData=materialdatas.getMaterialData(modeldata->matrialId);
if(materialData)
{
const NTextureData* textureData = materialData->getTextureData(NTextureData::Usage::Diffuse);
@ -391,13 +396,13 @@ Sprite3D* Sprite3D::createSprite3DNode(NodeData* nodedata,ModelData* modeldata,c
}
return sprite;
}
void Sprite3D::createAttachSprite3DNode(NodeData* nodedata,const MaterialDatas& matrialdatas)
void Sprite3D::createAttachSprite3DNode(NodeData* nodedata,const MaterialDatas& materialdatas)
{
for(const auto& it : nodedata->modelNodeDatas)
{
if(it && getAttachNode(nodedata->id))
{
auto sprite = createSprite3DNode(nodedata,it,matrialdatas);
auto sprite = createSprite3DNode(nodedata,it,materialdatas);
if (sprite)
{
getAttachNode(nodedata->id)->addChild(sprite);
@ -406,22 +411,45 @@ void Sprite3D::createAttachSprite3DNode(NodeData* nodedata,const MaterialDatas&
}
for(const auto& it : nodedata->children)
{
createAttachSprite3DNode(it,matrialdatas);
createAttachSprite3DNode(it,materialdatas);
}
}
void Sprite3D::setMaterial(Material *material)
{
setMaterial(material, -1);
}
void Sprite3D::setMaterial(Material *material, int meshIndex)
{
CCASSERT(material, "Invalid Material");
CCASSERT(meshIndex == -1 || (meshIndex >=0 && meshIndex < _meshes.size()), "Invalid meshIndex");
if (meshIndex == -1)
{
for(auto& mesh: _meshes)
{
mesh->setMaterial(material);
}
}
else
{
_meshes.at(meshIndex)->setMaterial(material);
}
}
void Sprite3D::genGLProgramState(bool useLight)
{
_shaderUsingLight = useLight;
std::unordered_map<const MeshVertexData*, GLProgramState*> glProgramestates;
for(auto& mesh : _meshVertexDatas)
for(auto& meshVertexData : _meshVertexDatas)
{
bool textured = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD);
bool hasSkin = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_INDEX)
&& mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_WEIGHT);
bool hasNormal = mesh->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_NORMAL);
GLProgram* glProgram = nullptr;
bool textured = meshVertexData->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_TEX_COORD);
bool hasSkin = meshVertexData->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_INDEX)
&& meshVertexData->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_BLEND_WEIGHT);
bool hasNormal = meshVertexData->hasVertexAttrib(GLProgram::VERTEX_ATTRIB_NORMAL);
const char* shader = nullptr;
if(textured)
{
@ -444,33 +472,40 @@ void Sprite3D::genGLProgramState(bool useLight)
{
shader = GLProgram::SHADER_3D_POSITION;
}
if (shader)
glProgram = GLProgramCache::getInstance()->getGLProgram(shader);
auto programstate = GLProgramState::create(glProgram);
CCASSERT(shader, "Couldn't find shader for sprite");
auto glProgram = GLProgramCache::getInstance()->getGLProgram(shader);
auto glprogramstate = GLProgramState::create(glProgram);
long offset = 0;
auto attributeCount = mesh->getMeshVertexAttribCount();
auto attributeCount = meshVertexData->getMeshVertexAttribCount();
for (auto k = 0; k < attributeCount; k++) {
auto meshattribute = mesh->getMeshVertexAttrib(k);
programstate->setVertexAttribPointer(s_attributeNames[meshattribute.vertexAttrib],
auto meshattribute = meshVertexData->getMeshVertexAttrib(k);
glprogramstate->setVertexAttribPointer(s_attributeNames[meshattribute.vertexAttrib],
meshattribute.size,
meshattribute.type,
GL_FALSE,
mesh->getVertexBuffer()->getSizePerVertex(),
meshVertexData->getVertexBuffer()->getSizePerVertex(),
(GLvoid*)offset);
offset += meshattribute.attribSizeBytes;
}
glProgramestates[mesh] = programstate;
glProgramestates[meshVertexData] = glprogramstate;
}
for (auto& it : _meshes) {
auto glProgramState = glProgramestates[it->getMeshIndexData()->getMeshVertexData()];
it->setGLProgramState(glProgramState);
for (auto& mesh : _meshes) {
auto glProgramState = glProgramestates[mesh->getMeshIndexData()->getMeshVertexData()];
// hack to prevent cloning the very first time
if (glProgramState->getReferenceCount() == 1)
mesh->setGLProgramState(glProgramState);
else
mesh->setGLProgramState(glProgramState->clone());
}
}
void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& matrialdatas, bool singleSprite)
void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& materialdatas, bool singleSprite)
{
Node* node=nullptr;
for(const auto& it : nodedata->modelNodeDatas)
@ -479,7 +514,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
{
if(it->bones.size() > 0 || singleSprite)
{
if(singleSprite)
if(singleSprite && root!=nullptr)
root->setName(nodedata->id);
auto mesh = Mesh::create(nodedata->id, getMeshIndexData(it->subMeshId));
if(mesh)
@ -492,14 +527,14 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
}
mesh->_visibleChanged = std::bind(&Sprite3D::onAABBDirty, this);
if (it->matrialId == "" && matrialdatas.materials.size())
if (it->matrialId == "" && materialdatas.materials.size())
{
const NTextureData* textureData = matrialdatas.materials[0].getTextureData(NTextureData::Usage::Diffuse);
const NTextureData* textureData = materialdatas.materials[0].getTextureData(NTextureData::Usage::Diffuse);
mesh->setTexture(textureData->filename);
}
else
{
const NMaterialData* materialData=matrialdatas.getMaterialData(it->matrialId);
const NMaterialData* materialData=materialdatas.getMaterialData(it->matrialId);
if(materialData)
{
const NTextureData* textureData = materialData->getTextureData(NTextureData::Usage::Diffuse);
@ -508,7 +543,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
auto tex = Director::getInstance()->getTextureCache()->addImage(textureData->filename);
if(tex)
{
Texture2D::TexParams texParams;
Texture2D::TexParams texParams;
texParams.minFilter = GL_LINEAR;
texParams.magFilter = GL_LINEAR;
texParams.wrapS = textureData->wrapS;
@ -536,7 +571,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
}
else
{
auto sprite = createSprite3DNode(nodedata,it,matrialdatas);
auto sprite = createSprite3DNode(nodedata,it,materialdatas);
if (sprite)
{
if(root)
@ -574,7 +609,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m
}
for(const auto& it : nodedata->children)
{
createNode(it,node, matrialdatas, nodedata->children.size() == 1);
createNode(it,node, materialdatas, nodedata->children.size() == 1);
}
}
@ -646,25 +681,6 @@ void Sprite3D::removeAllAttachNode()
_attachments.clear();
}
//Generate a dummy texture when the texture file is missing
static Texture2D * getDummyTexture()
{
auto texture = Director::getInstance()->getTextureCache()->getTextureForKey("/dummyTexture");
if(!texture)
{
#ifdef NDEBUG
unsigned char data[] ={0,0,0,0};//1*1 transparent picture
#else
unsigned char data[] ={255,0,0,255};//1*1 red picture
#endif
Image * image =new (std::nothrow) Image();
image->initWithRawData(data,sizeof(data),1,1,sizeof(unsigned char));
texture=Director::getInstance()->getTextureCache()->addImage(image,"/dummyTexture");
image->release();
}
return texture;
}
void Sprite3D::visit(cocos2d::Renderer *renderer, const cocos2d::Mat4 &parentTransform, uint32_t parentFlags)
{
// quick return if not visible. children won't be drawn.
@ -742,50 +758,16 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
genGLProgramState(usingLight);
}
int i = 0;
for (auto& mesh : _meshes) {
if (!mesh->isVisible())
{
i++;
continue;
}
auto programstate = mesh->getGLProgramState();
auto& meshCommand = mesh->getMeshCommand();
for (auto& mesh : _meshes)
{
mesh->draw(renderer,
_globalZOrder,
transform,
flags,
_lightMask,
Vec4(color.r, color.g, color.b, color.a),
_forceDepthWrite);
GLuint textureID = 0;
if(mesh->getTexture())
{
textureID = mesh->getTexture()->getName();
}else
{ //let the mesh use a dummy texture instead of the missing or crashing texture file
auto texture = getDummyTexture();
mesh->setTexture(texture);
textureID = texture->getName();
}
bool isTransparent = (mesh->_isTransparent || color.a < 1.f);
float globalZ = isTransparent ? 0 : _globalZOrder;
if (isTransparent)
flags |= Node::FLAGS_RENDER_AS_3D;
meshCommand.init(globalZ, textureID, programstate, _blend, mesh->getVertexBuffer(), mesh->getIndexBuffer(), mesh->getPrimitiveType(), mesh->getIndexFormat(), mesh->getIndexCount(), transform, flags);
meshCommand.setLightMask(_lightMask);
auto skin = mesh->getSkin();
if (skin)
{
meshCommand.setMatrixPaletteSize((int)skin->getMatrixPaletteSize());
meshCommand.setMatrixPalette(skin->getMatrixPalette());
}
//support tint and fade
meshCommand.setDisplayColor(Vec4(color.r, color.g, color.b, color.a));
if (_forceDepthWrite)
{
meshCommand.setDepthWriteEnabled(true);
}
meshCommand.setTransparent(isTransparent);
renderer->addCommand(&meshCommand);
}
}
@ -807,9 +789,9 @@ void Sprite3D::setBlendFunc(const BlendFunc &blendFunc)
if(_blend.src != blendFunc.src || _blend.dst != blendFunc.dst)
{
_blend = blendFunc;
for(auto& state : _meshes)
for(auto& mesh : _meshes)
{
state->setBlendFunc(blendFunc);
mesh->setBlendFunc(blendFunc);
}
}
}
@ -880,14 +862,16 @@ Rect Sprite3D::getBoundingBox() const
void Sprite3D::setCullFace(GLenum cullFace)
{
for (auto& it : _meshes) {
it->getMeshCommand().setCullFace(cullFace);
it->getMaterial()->getStateBlock()->setCullFaceSide((RenderState::CullFaceSide)cullFace);
// it->getMeshCommand().setCullFace(cullFace);
}
}
void Sprite3D::setCullFaceEnabled(bool enable)
{
for (auto& it : _meshes) {
it->getMeshCommand().setCullFaceEnabled(enable);
it->getMaterial()->getStateBlock()->setCullFace(enable);
// it->getMeshCommand().setCullFaceEnabled(enable);
}
}

View File

@ -177,6 +177,18 @@ public:
/**draw*/
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
/** Adds a new material to the sprite.
The Material will be applied to all the meshes that belong to the sprite.
Internally it will call `setMaterial(material,-1)`
*/
void setMaterial(Material* material);
/** Adds a new material to a particular mesh of the sprite.
meshIndex is the mesh that will be applied to.
if meshIndex == -1, then it will be applied to all the meshes that belong to the sprite.
*/
void setMaterial(Material* material, int meshIndex);
CC_CONSTRUCTOR_ACCESS:
Sprite3D();
@ -210,7 +222,7 @@ CC_CONSTRUCTOR_ACCESS:
/**get MeshIndexData by Id*/
MeshIndexData* getMeshIndexData(const std::string& indexId) const;
void addMesh(Mesh* mesh);
void addMesh(Mesh* mesh);
void onAABBDirty() { _aabbDirty = true; }

View File

@ -262,7 +262,7 @@ bool Terrain::initHeightMap(const char * heightMap)
Terrain::Terrain()
{
_alphaMap = nullptr;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
auto _backToForegroundListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED,
[this](EventCustom*)
{
@ -482,7 +482,7 @@ Terrain::~Terrain()
glDeleteBuffers(1,&(_chunkLodIndicesSkirtSet[i]._chunkIndices._indices));
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundListener);
#endif
}
@ -604,6 +604,20 @@ Terrain::QuadTree * Terrain::getQuadTree()
return _quadRoot;
}
std::vector<float> Terrain::getHeightData() const
{
std::vector<float> data;
data.resize(_imageWidth * _imageHeight);
for (int i = 0; i < _imageHeight; i++) {
for (int j = 0; j < _imageWidth; j++) {
int idx = i * _imageWidth + j;
data[idx] = (_vertices[idx]._position.y);
}
}
return data;
}
void Terrain::setAlphaMap(cocos2d::Texture2D * newAlphaMapTexture)
{
_alphaMap->release();
@ -1495,4 +1509,5 @@ Terrain::DetailMap::DetailMap()
_detailMapSrc = "";
_detailMapSize = 35;
}
NS_CC_END

View File

@ -384,6 +384,17 @@ public:
QuadTree * getQuadTree();
void reload();
/**
* get the terrain's size
*/
Size getTerrainSize() const { return Size(_imageWidth, _imageHeight); }
/**
* get the terrain's height data
*/
std::vector<float> getHeightData() const;
protected:
Terrain();
@ -458,7 +469,7 @@ protected:
GLint _alphaMapLocation;
GLint _alphaIsHasAlphaMapLocation;
GLint _detailMapSizeLocation[4];
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
EventListenerCustom* _backToForegroundListener;
#endif
};

View File

@ -9,6 +9,7 @@ set(COCOS_3D_SRC
3d/CCAnimate3D.cpp
3d/CCAnimation3D.cpp
3d/CCAttachNode.cpp
3d/CCBillBoard.cpp
3d/CCBundle3D.cpp
3d/CCBundleReader.cpp
3d/CCFrustum.cpp
@ -20,11 +21,10 @@ set(COCOS_3D_SRC
3d/CCPlane.cpp
3d/CCRay.cpp
3d/CCSkeleton3D.cpp
3d/CCSkybox.cpp
3d/CCSprite3D.cpp
3d/CCSprite3DMaterial.cpp
3d/CCBillBoard.cpp
3d/CCSkybox.cpp
3d/CCTextureCube.cpp
3d/CCTerrain.cpp
3d/CCTextureCube.cpp
)

View File

@ -37,6 +37,8 @@ cocos2d.cpp \
2d/CCComponentContainer.cpp \
2d/CCDrawNode.cpp \
2d/CCDrawingPrimitives.cpp \
2d/CCFastTMXLayer.cpp \
2d/CCFastTMXTiledMap.cpp \
2d/CCFont.cpp \
2d/CCFontAtlas.cpp \
2d/CCFontAtlasCache.cpp \
@ -71,14 +73,9 @@ cocos2d.cpp \
2d/CCSpriteBatchNode.cpp \
2d/CCSpriteFrame.cpp \
2d/CCSpriteFrameCache.cpp \
2d/MarchingSquare.cpp \
2d/SpritePolygon.cpp \
2d/SpritePolygonCache.cpp \
2d/CCTMXLayer.cpp \
2d/CCFastTMXLayer.cpp \
2d/CCTMXObjectGroup.cpp \
2d/CCTMXTiledMap.cpp \
2d/CCFastTMXTiledMap.cpp \
2d/CCTMXXMLParser.cpp \
2d/CCTextFieldTTF.cpp \
2d/CCTileMapAtlas.cpp \
@ -86,17 +83,20 @@ cocos2d.cpp \
2d/CCTransitionPageTurn.cpp \
2d/CCTransitionProgress.cpp \
2d/CCTweenFunction.cpp \
2d/MarchingSquare.cpp \
2d/SpritePolygon.cpp \
2d/SpritePolygonCache.cpp \
3d/CCFrustum.cpp \
3d/CCPlane.cpp \
platform/CCGLView.cpp \
platform/CCFileUtils.cpp \
platform/CCGLView.cpp \
platform/CCImage.cpp \
platform/CCSAXParser.cpp \
platform/CCThread.cpp \
platform/CCImage.cpp \
$(MATHNEONFILE) \
math/CCAffineTransform.cpp \
math/CCGeometry.cpp \
math/CCVertex.cpp \
$(MATHNEONFILE) \
math/Mat4.cpp \
math/Quaternion.cpp \
math/TransformUtils.cpp \
@ -107,19 +107,21 @@ base/CCAsyncTaskPool.cpp \
base/CCAutoreleasePool.cpp \
base/CCConfiguration.cpp \
base/CCConsole.cpp \
base/CCController-android.cpp \
base/CCController.cpp \
base/CCData.cpp \
base/CCDataVisitor.cpp \
base/CCDirector.cpp \
base/CCEvent.cpp \
base/CCEventAcceleration.cpp \
base/CCEventController.cpp \
base/CCEventCustom.cpp \
base/CCEventDispatcher.cpp \
base/CCEventFocus.cpp \
base/CCEventKeyboard.cpp \
base/CCEventController.cpp \
base/CCEventListener.cpp \
base/CCEventListenerController.cpp \
base/CCEventListenerAcceleration.cpp \
base/CCEventListenerController.cpp \
base/CCEventListenerCustom.cpp \
base/CCEventListenerFocus.cpp \
base/CCEventListenerKeyboard.cpp \
@ -130,32 +132,30 @@ base/CCEventTouch.cpp \
base/CCIMEDispatcher.cpp \
base/CCNS.cpp \
base/CCProfiling.cpp \
base/ccRandom.cpp \
base/CCRef.cpp \
base/CCScheduler.cpp \
base/CCScriptSupport.cpp \
base/CCTouch.cpp \
base/CCUserDefault.cpp \
base/CCUserDefault-android.cpp \
base/CCUserDefault.cpp \
base/CCValue.cpp \
base/ObjectFactory.cpp \
base/TGAlib.cpp \
base/ZipUtils.cpp \
base/allocator/CCAllocatorDiagnostics.cpp \
base/allocator/CCAllocatorGlobal.cpp \
base/allocator/CCAllocatorGlobalNewDelete.cpp \
base/atitc.cpp \
base/base64.cpp \
base/ccCArray.cpp \
base/ccFPSImages.c \
base/ccRandom.cpp \
base/ccTypes.cpp \
base/ccUTF8.cpp \
base/ccUtils.cpp \
base/etc1.cpp \
base/pvr.cpp \
base/s3tc.cpp \
base/CCController.cpp \
base/CCController-android.cpp \
base/allocator/CCAllocatorDiagnostics.cpp \
base/allocator/CCAllocatorGlobal.cpp \
base/allocator/CCAllocatorGlobalNewDelete.cpp \
base/ObjectFactory.cpp \
renderer/CCBatchCommand.cpp \
renderer/CCCustomCommand.cpp \
renderer/CCGLProgram.cpp \
@ -163,31 +163,43 @@ renderer/CCGLProgramCache.cpp \
renderer/CCGLProgramState.cpp \
renderer/CCGLProgramStateCache.cpp \
renderer/CCGroupCommand.cpp \
renderer/CCQuadCommand.cpp \
renderer/CCMaterial.cpp \
renderer/CCMeshCommand.cpp \
renderer/CCPass.cpp \
renderer/CCPrimitive.cpp \
renderer/CCPrimitiveCommand.cpp \
renderer/CCQuadCommand.cpp \
renderer/CCRenderCommand.cpp \
renderer/CCRenderState.cpp \
renderer/CCRenderer.cpp \
renderer/CCTechnique.cpp \
renderer/CCTexture2D.cpp \
renderer/CCTextureAtlas.cpp \
renderer/CCTextureCache.cpp \
renderer/ccGLStateCache.cpp \
renderer/ccShaders.cpp \
renderer/CCTrianglesCommand.cpp \
renderer/CCVertexIndexBuffer.cpp \
renderer/CCVertexIndexData.cpp \
renderer/CCPrimitive.cpp \
renderer/CCPrimitiveCommand.cpp \
renderer/CCTrianglesCommand.cpp \
renderer/ccGLStateCache.cpp \
renderer/ccShaders.cpp \
deprecated/CCArray.cpp \
deprecated/CCDeprecated.cpp \
deprecated/CCDictionary.cpp \
deprecated/CCNotificationCenter.cpp \
deprecated/CCSet.cpp \
deprecated/CCString.cpp \
deprecated/CCDictionary.cpp \
deprecated/CCDeprecated.cpp \
deprecated/CCNotificationCenter.cpp \
physics/CCPhysicsBody.cpp \
physics/CCPhysicsContact.cpp \
physics/CCPhysicsJoint.cpp \
physics/CCPhysicsShape.cpp \
physics/CCPhysicsWorld.cpp \
physics3d/CCPhysics3D.cpp \
physics3d/CCPhysics3DWorld.cpp \
physics3d/CCPhysics3DComponent.cpp \
physics3d/CCPhysics3DDebugDrawer.cpp \
physics3d/CCPhysics3DObject.cpp \
physics3d/CCPhysics3DShape.cpp \
physics3d/CCPhysicsSprite3D.cpp \
physics3d/CCPhysics3DConstraint.cpp \
../external/ConvertUTF/ConvertUTFWrapper.cpp \
../external/ConvertUTF/ConvertUTF.c \
../external/tinyxml2/tinyxml2.cpp \
@ -219,7 +231,6 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../external/poly2tri/sweep
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/. \
$(LOCAL_PATH)/platform \
$(LOCAL_PATH)/../external \
$(LOCAL_PATH)/../external/tinyxml2 \
@ -269,6 +280,7 @@ LOCAL_STATIC_LIBRARIES += cocos3d_static
LOCAL_STATIC_LIBRARIES += spine_static
LOCAL_STATIC_LIBRARIES += cocos_network_static
LOCAL_STATIC_LIBRARIES += audioengine_static
LOCAL_STATIC_LIBRARIES += bullet_static
include $(BUILD_STATIC_LIBRARY)
#==============================================================
@ -289,6 +301,7 @@ $(call import-module,network)
$(call import-module,ui)
$(call import-module,extensions)
$(call import-module,Box2D)
$(call import-module,bullet)
$(call import-module,curl/prebuilt/android)
$(call import-module,websockets/prebuilt/android)
$(call import-module,flatbuffers)

View File

@ -35,6 +35,7 @@ include(2d/CMakeLists.txt)
include(3d/CMakeLists.txt)
include(platform/CMakeLists.txt)
include(physics/CMakeLists.txt)
include(physics3d/CMakeLists.txt)
include(math/CMakeLists.txt)
include(renderer/CMakeLists.txt)
include(base/CMakeLists.txt)
@ -67,6 +68,7 @@ set(COCOS_SRC cocos2d.cpp
${COCOS_3D_SRC}
${COCOS_PLATFORM_SRC}
${COCOS_PHYSICS_SRC}
${COCOS_PHYSICS3D_SRC}
${COCOS_MATH_SRC}
${COCOS_RENDERER_SRC}
${COCOS_BASE_SRC}
@ -150,6 +152,10 @@ if(USE_BOX2D)
cocos_use_pkg(cocos2d Box2D)
endif()
if(USE_BULLET)
cocos_use_pkg(cocos2d BULLET)
endif()
set_target_properties(cocos2d
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"

View File

@ -23,11 +23,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ccdandroidUtils.h"
#include "cocos2d.h"
#include <jni.h>
#include <android/log.h>
#include "jni/JniHelper.h"
#include "platform/CCFileUtils.h"
USING_NS_CC;

View File

@ -29,6 +29,7 @@
#include <thread>
#include <algorithm>
#include "base/CCConsole.h"
#include "platform/CCFileUtils.h"
#include "mpg123.h"
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"
@ -96,8 +97,9 @@ void AudioCache::readDataTask()
case FileFormat::OGG:
{
vf = new OggVorbis_File;
if (ov_fopen(_fileFullPath.c_str(), vf)){
log("Input does not appear to be an Ogg bitstream.\n");
int openCode;
if (openCode = ov_fopen(FileUtils::getInstance()->getSuitableFOpen(_fileFullPath).c_str(), vf)){
log("Input does not appear to be an Ogg bitstream: %s. Code: 0x%x\n", _fileFullPath.c_str(), openCode);
goto ExitThread;
}

View File

@ -27,6 +27,7 @@
#include "AudioPlayer.h"
#include "AudioCache.h"
#include "base/CCConsole.h"
#include "platform/CCFileUtils.h"
#include "mpg123.h"
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"
@ -162,8 +163,9 @@ void AudioPlayer::rotateBufferThread(int offsetFrame)
case AudioCache::FileFormat::OGG:
{
vorbisFile = new OggVorbis_File;
if (ov_fopen(_audioCache->_fileFullPath.c_str(), vorbisFile)){
log("Input does not appear to be an Ogg bitstream.\n");
int openCode;
if (openCode = ov_fopen(FileUtils::getInstance()->getSuitableFOpen(_audioCache->_fileFullPath).c_str(), vorbisFile)){
log("Input does not appear to be an Ogg bitstream: %s. Code: 0x%x\n", _audioCache->_fileFullPath.c_str(), openCode);
goto ExitBufferThread;
}
if (offsetFrame != 0) {

View File

@ -43,7 +43,7 @@
#include "platform/win32/inet_pton_mingw.h"
#endif
#define bzero(a, b) memset(a, 0, b);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#include "inet_ntop_winrt.h"
#include "inet_pton_winrt.h"
#include "CCWinRTUtils.h"
@ -71,7 +71,7 @@
NS_CC_BEGIN
extern const char* cocos2dVersion(void);
//TODO: these general utils should be in a seperate class
//TODO: these general utils should be in a separate class
//
// Trimming functions were taken from: http://stackoverflow.com/a/217605
//
@ -243,7 +243,7 @@ static void _log(const char *format, va_list args)
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT || CC_TARGET_PLATFORM == CC_PLATFORM_WP8
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
WCHAR wszBuf[MAX_LOG_LENGTH] = {0};
MultiByteToWideChar(CP_UTF8, 0, buf, -1, wszBuf, sizeof(wszBuf));
OutputDebugStringW(wszBuf);
@ -330,7 +330,6 @@ Console::Console()
{
_commands[commands[i].name] = commands[i];
}
_writablePath = FileUtils::getInstance()->getWritablePath();
}
Console::~Console()
@ -352,7 +351,7 @@ bool Console::listenOnTCP(int port)
hints.ai_family = AF_INET; // AF_UNSPEC: Do we need IPv6 ?
hints.ai_socktype = SOCK_STREAM;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
WSADATA wsaData;
n = WSAStartup(MAKEWORD(2, 2),&wsaData);
@ -394,7 +393,7 @@ bool Console::listenOnTCP(int port)
break; /* success */
/* bind error, close and try next one */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
closesocket(listenfd);
#else
close(listenfd);
@ -481,7 +480,7 @@ void Console::commandExit(int fd, const std::string &args)
{
FD_CLR(fd, &_read_set);
_fds.erase(std::remove(_fds.begin(), _fds.end(), fd), _fds.end());
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
closesocket(fd);
#else
close(fd);
@ -870,9 +869,10 @@ void Console::commandUpload(int fd)
}
*ptr = 0;
std::string filepath = _writablePath + std::string(buf);
static std::string writablePath = FileUtils::getInstance()->getWritablePath();
std::string filepath = writablePath + std::string(buf);
FILE* fp = fopen(filepath.c_str(), "wb");
FILE* fp = fopen(FileUtils::getInstance()->getSuitableFOpen(filepath).c_str(), "wb");
if(!fp)
{
const char err[] = "can't create file!\n";
@ -1124,7 +1124,7 @@ void Console::loop()
//receive a SIGPIPE, which will cause linux system shutdown the sending process.
//Add this ioctl code to check if the socket has been closed by peer.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
u_long n = 0;
ioctlsocket(fd, FIONREAD, &n);
#else
@ -1169,14 +1169,14 @@ void Console::loop()
// clean up: ignore stdin, stdout and stderr
for(const auto &fd: _fds )
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
closesocket(fd);
#else
close(fd);
#endif
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
closesocket(_listenfd);
WSACleanup();
#else

View File

@ -140,8 +140,6 @@ protected:
bool _running;
bool _endThread;
std::string _writablePath;
std::map<std::string, Command> _commands;
// strings generated by cocos2d sent to the remote console

View File

@ -47,6 +47,7 @@ THE SOFTWARE.
#include "renderer/CCTextureCache.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCRenderState.h"
#include "2d/CCCamera.h"
#include "base/CCUserDefault.h"
#include "base/ccFPSImages.h"
@ -69,6 +70,10 @@ THE SOFTWARE.
#include "physics/CCPhysicsWorld.h"
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
#include "physics3d/CCPhysics3DWorld.h"
#endif
/**
Position of the FPS
@ -170,6 +175,7 @@ bool Director::init(void)
initMatrixStack();
_renderer = new (std::nothrow) Renderer;
RenderState::initialize();
return true;
}
@ -291,6 +297,13 @@ void Director::drawScene()
{
physicsWorld->update(_deltaTime, false);
}
#endif
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
auto physics3DWorld = _runningScene->getPhysics3DWorld();
if (physics3DWorld)
{
physics3DWorld->stepSimulate(_deltaTime);
}
#endif
//clear draw stats
_renderer->clearDrawStats();
@ -604,12 +617,7 @@ void Director::setProjection(Projection projection)
case Projection::_2D:
{
loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
if(getOpenGLView() != nullptr)
{
multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, getOpenGLView()->getOrientationMatrix());
}
#endif
Mat4 orthoMatrix;
Mat4::createOrthographicOffCenter(0, size.width, 0, size.height, -1024, 1024, &orthoMatrix);
multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, orthoMatrix);
@ -624,15 +632,7 @@ void Director::setProjection(Projection projection)
Mat4 matrixPerspective, matrixLookup;
loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
//if needed, we need to add a rotation for Landscape orientations on Windows Phone 8 since it is always in Portrait Mode
GLView* view = getOpenGLView();
if(getOpenGLView() != nullptr)
{
multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, getOpenGLView()->getOrientationMatrix());
}
#endif
// issue #1334
Mat4::createPerspective(60, (GLfloat)size.width/size.height, 10, zeye+size.height/2, &matrixPerspective);
@ -716,12 +716,6 @@ static void GLToClipTransform(Mat4 *transformOut)
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
auto projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
//if needed, we need to undo the rotation for Landscape orientation in order to get the correct positions
projection = Director::getInstance()->getOpenGLView()->getReverseOrientationMatrix() * projection;
#endif
auto modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
*transformOut = projection * modelview;
}
@ -1000,6 +994,8 @@ void Director::reset()
UserDefault::destroyInstance();
GL::invalidateStateCache();
RenderState::finalize();
destroyTextureCache();
}

View File

@ -132,7 +132,7 @@ static void setValueForKey(const char* pKey, const char* pValue)
// save file and free doc
if (doc)
{
doc->SaveFile(UserDefault::getInstance()->getXMLFilePath().c_str());
doc->SaveFile(FileUtils::getInstance()->getSuitableFOpen(UserDefault::getInstance()->getXMLFilePath()).c_str());
delete doc;
}
}
@ -484,7 +484,7 @@ bool UserDefault::createXMLFile()
return false;
}
pDoc->LinkEndChild(pRootEle);
bRet = tinyxml2::XML_SUCCESS == pDoc->SaveFile(_filePath.c_str());
bRet = tinyxml2::XML_SUCCESS == pDoc->SaveFile(FileUtils::getInstance()->getSuitableFOpen(_filePath).c_str());
if(pDoc)
{

View File

@ -245,7 +245,7 @@ public:
protected:
UserDefault();
~UserDefault();
virtual ~UserDefault();
private:

View File

@ -34,7 +34,7 @@ THE SOFTWARE.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "platform/android/CCFileUtils-android.h"
#elif(CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#elif(CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// for import ssize_t on win32 platform
#include "platform/CCStdC.h"
#endif

View File

@ -28,6 +28,8 @@
#include <new>
#include <exception>
#include <assert.h>
USING_NS_CC_ALLOCATOR;
#if CC_ENABLE_ALLOCATOR
@ -43,21 +45,27 @@ namespace
void* operator new[] (std::size_t size)
{
void* ptr = global.allocate(size);
#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
if (nullptr == ptr)
throw std::bad_alloc();
#endif
return ptr;
assert(ptr && "No memory");
// dissabling exceptions since cocos2d-x doesn't use them
//#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
// if (nullptr == ptr)
// throw std::bad_alloc();
//#endif
return ptr;
}
// @brief overrides global operator new
void* operator new(std::size_t size)
{
void* ptr = global.allocate(size);
#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
if (nullptr == ptr)
throw std::bad_alloc();
#endif
assert(ptr && "No memory");
// dissabling exceptions since cocos2d-x doesn't use them
//#if CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
// if (nullptr == ptr)
// throw std::bad_alloc();
//#endif
return ptr;
}

View File

@ -41,7 +41,7 @@
pthread_mutex_lock(&m);
#define MUTEX_UNLOCK(m) \
pthread_mutex_unlock(&m);
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#include "windows.h"
#define MUTEX HANDLE
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
@ -49,7 +49,7 @@
m = CreateMutex(0, FALSE, 0)
#define MUTEX_LOCK(m) \
WaitForSingleObject(m, INFINITE)
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#define MUTEX_INIT(m) \
m = CreateMutexEx(NULL,FALSE,0,NULL);
#define MUTEX_LOCK(m) \

View File

@ -252,6 +252,13 @@ THE SOFTWARE.
#define CC_USE_PHYSICS 1
#endif
/** Use 3d physics integration API. */
#ifndef CC_USE_3D_PHYSICS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#define CC_USE_3D_PHYSICS 1
#endif
#endif
/** Use culling or not. */
#ifndef CC_USE_CULLING
#define CC_USE_CULLING 1
@ -278,7 +285,7 @@ THE SOFTWARE.
/** Support webp or not. If your application don't use webp format picture, you can undefine this macro to save package size.
*/
#ifndef CC_USE_WEBP
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
#define CC_USE_WEBP 1
#endif
#endif // CC_USE_WEBP
@ -305,7 +312,7 @@ THE SOFTWARE.
* protected by default.
*/
#ifndef CC_CONSTRUCTOR_ACCESS
#define CC_CONSTRUCTOR_ACCESS protected
#define CC_CONSTRUCTOR_ACCESS public
#endif
/** @def CC_ENABLE_ALLOCATOR

View File

@ -74,16 +74,7 @@ void onCaptureScreen(const std::function<void(bool, const std::string&)>& afterC
}
glPixelStorei(GL_PACK_ALIGNMENT, 1);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
// The frame buffer is always created with portrait orientation on WP8.
// So if the current device orientation is landscape, we need to rotate the frame buffer.
auto renderTargetSize = glView->getRenerTargetSize();
CCASSERT(width * height == static_cast<int>(renderTargetSize.width * renderTargetSize.height), "The frame size is not matched");
glReadPixels(0, 0, (int)renderTargetSize.width, (int)renderTargetSize.height, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get());
#else
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer.get());
#endif
std::shared_ptr<GLubyte> flippedBuffer(new GLubyte[width * height * 4], [](GLubyte* p) { CC_SAFE_DELETE_ARRAY(p); });
if (!flippedBuffer)
@ -91,32 +82,10 @@ void onCaptureScreen(const std::function<void(bool, const std::string&)>& afterC
break;
}
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
if (width == static_cast<int>(renderTargetSize.width))
{
// The current device orientation is portrait.
for (int row = 0; row < height; ++row)
{
memcpy(flippedBuffer.get() + (height - row - 1) * width * 4, buffer.get() + row * width * 4, width * 4);
}
}
else
{
// The current device orientation is landscape.
for (int row = 0; row < width; ++row)
{
for (int col = 0; col < height; ++col)
{
*(int*)(flippedBuffer.get() + (height - col - 1) * width * 4 + row * 4) = *(int*)(buffer.get() + row * height * 4 + col * 4);
}
}
}
#else
for (int row = 0; row < height; ++row)
{
memcpy(flippedBuffer.get() + (height - row - 1) * width * 4, buffer.get() + row * width * 4, width * 4);
}
#endif
std::shared_ptr<Image> image(new Image);
if (image)

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
CC_DLL const char* cocos2dVersion()
{
return "cocos2d-x 3.6";
return "cocos2d-x 3.7-pre";
}
NS_CC_END

View File

@ -29,8 +29,8 @@ THE SOFTWARE.
#define __COCOS2D_H__
// 0x00 HI ME LO
// 00 03 03 00
#define COCOS2D_VERSION 0x00030600
// 00 03 07 00
#define COCOS2D_VERSION 0x00030700
//
// all cocos2d include files
@ -61,6 +61,7 @@ THE SOFTWARE.
#include "base/CCIMEDelegate.h"
#include "base/CCIMEDispatcher.h"
#include "base/ccUtils.h"
#include "base/CCAsyncTaskPool.h"
// EventDispatcher
#include "base/CCEventType.h"
@ -163,6 +164,10 @@ THE SOFTWARE.
#include "renderer/CCPrimitive.h"
#include "renderer/CCPrimitiveCommand.h"
#include "renderer/CCTrianglesCommand.h"
#include "renderer/CCMaterial.h"
#include "renderer/CCTechnique.h"
#include "renderer/CCPass.h"
#include "renderer/CCRenderState.h"
// physics
#include "physics/CCPhysicsBody.h"
@ -230,14 +235,6 @@ THE SOFTWARE.
#include "platform/winrt/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
#include "platform/winrt/CCApplication.h"
#include "platform/wp8/CCGLViewImpl-wp8.h"
#include "platform/winrt/CCGL.h"
#include "platform/winrt/CCStdC.h"
#include "platform/winrt/CCPrecompiledShaders.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WP8
// script_support
#include "base/CCScriptSupport.h"

View File

@ -131,11 +131,6 @@ public:
MULTIPLY_RESOLUTION,
};
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
#ifdef ABSOLUTE
#undef ABSOLUTE
#endif
#endif
enum class SizeType
{
ABSOLUTE,

View File

@ -38,8 +38,8 @@ NS_TIMELINE_BEGIN
Frame::Frame()
: _frameIndex(0)
, _tween(true)
, _tweenType(tweenfunc::TweenType::Linear)
, _enterWhenPassed(false)
, _tweenType(tweenfunc::TweenType::Linear)
, _timeline(nullptr)
, _node(nullptr)
{
@ -282,7 +282,7 @@ void SkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void SkewFrame::onApply(float percent)
{
if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
if ((nullptr != _node && _betweenSkewX != 0) || _betweenSkewY != 0)
{
float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY;
@ -342,7 +342,7 @@ void RotationSkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void RotationSkewFrame::onApply(float percent)
{
if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
if ((nullptr != _node && _betweenSkewX != 0) || _betweenSkewY != 0)
{
float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY;
@ -460,7 +460,7 @@ void ScaleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void ScaleFrame::onApply(float percent)
{
if (nullptr != _node && _betweenScaleX != 0 || _betweenScaleY != 0)
if ((nullptr != _node && _betweenScaleX != 0) || _betweenScaleY != 0)
{
float scaleX = _scaleX + _betweenScaleX * percent;
float scaleY = _scaleY + _betweenScaleY * percent;
@ -606,32 +606,20 @@ void InnerActionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void InnerActionFrame::setStartFrameIndex(int frameIndex)
{
if(_enterWithName)
{
CCLOG(" cannot set start when enter frame with name. setEnterWithName false firstly!");
throw std::exception();
}
CCASSERT(_enterWithName, " cannot setStartFrameIndex when enterWithName is set");
_startFrameIndex = frameIndex;
}
void InnerActionFrame::setEndFrameIndex(int frameIndex)
{
if(_enterWithName)
{
CCLOG(" cannot set end when enter frame with name. setEnterWithName false firstly!");
throw std::exception();
}
CCASSERT(_enterWithName, " cannot setEndFrameIndex when enterWithName is set");
_endFrameIndex = frameIndex;
}
void InnerActionFrame::setAnimationName(const std::string& animationName)
{
if(!_enterWithName)
{
CCLOG(" cannot set aniamtioname when enter frame with index. setEnterWithName true firstly!");
throw std::exception();
}
CCASSERT(!_enterWithName, " cannot set aniamtioname when enter frame with index. setEnterWithName true firstly!");
_animationName = animationName;
}
@ -694,7 +682,7 @@ void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void ColorFrame::onApply(float percent)
{
if (nullptr != _node && _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)
if ((nullptr != _node && _betweenRed != 0) || _betweenGreen != 0 || _betweenBlue != 0)
{
Color3B color;
color.r = _color.r+ _betweenRed * percent;

View File

@ -128,7 +128,7 @@ bool ComAudio::serialize(void* r)
}
if (strcmp(className, "CCBackgroundAudio") == 0)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
std::string::size_type pos = filePath.find(".mp3");
if (pos == filePath.npos)
{

View File

@ -53,7 +53,7 @@ typedef struct spSlot {
spSlot() :
data(0),
bone(0),
r(0), b(0), g(0), a(0),
r(0), g(0), b(0), a(0),
attachment(0),
attachmentVerticesCapacity(0),
attachmentVerticesCount(0),

6
cocos/editor-support/spine/proj.win32/libSpine.vcxproj Executable file → Normal file
View File

@ -83,9 +83,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
@ -93,9 +90,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>

View File

@ -55,7 +55,7 @@ typedef void (cocos2d::Ref::*SEL_HttpResponse)(HttpClient* client, HttpResponse*
* @lua NA
*/
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#ifdef DELETE
#undef DELETE
#endif

View File

@ -178,7 +178,7 @@ EventListenerPhysicsContact::EventListenerPhysicsContact()
: onContactBegin(nullptr)
, onContactPreSolve(nullptr)
, onContactPostSolve(nullptr)
, onContactSeperate(nullptr)
, onContactSeparate(nullptr)
{
}
@ -243,12 +243,12 @@ void EventListenerPhysicsContact::onEvent(EventCustom* event)
}
break;
}
case PhysicsContact::EventCode::SEPERATE:
case PhysicsContact::EventCode::SEPARATE:
{
if (onContactSeperate != nullptr
if (onContactSeparate != nullptr
&& hitTest(contact->getShapeA(), contact->getShapeB()))
{
onContactSeperate(*contact);
onContactSeparate(*contact);
}
break;
}
@ -286,7 +286,7 @@ bool EventListenerPhysicsContact::hitTest(PhysicsShape* shapeA, PhysicsShape* sh
bool EventListenerPhysicsContact::checkAvailable()
{
if (onContactBegin == nullptr && onContactPreSolve == nullptr
&& onContactPostSolve == nullptr && onContactSeperate == nullptr)
&& onContactPostSolve == nullptr && onContactSeparate == nullptr)
{
CCASSERT(false, "Invalid PhysicsContactListener.");
return false;
@ -304,7 +304,7 @@ EventListenerPhysicsContact* EventListenerPhysicsContact::clone()
obj->onContactBegin = onContactBegin;
obj->onContactPreSolve = onContactPreSolve;
obj->onContactPostSolve = onContactPostSolve;
obj->onContactSeperate = onContactSeperate;
obj->onContactSeparate = onContactSeparate;
return obj;
}
@ -362,7 +362,7 @@ EventListenerPhysicsContactWithBodies* EventListenerPhysicsContactWithBodies::cl
obj->onContactBegin = onContactBegin;
obj->onContactPreSolve = onContactPreSolve;
obj->onContactPostSolve = onContactPostSolve;
obj->onContactSeperate = onContactSeperate;
obj->onContactSeparate = onContactSeparate;
return obj;
}
@ -417,7 +417,7 @@ EventListenerPhysicsContactWithShapes* EventListenerPhysicsContactWithShapes::cl
obj->onContactBegin = onContactBegin;
obj->onContactPreSolve = onContactPreSolve;
obj->onContactPostSolve = onContactPostSolve;
obj->onContactSeperate = onContactSeperate;
obj->onContactSeparate = onContactSeparate;
return obj;
}
@ -469,7 +469,7 @@ EventListenerPhysicsContactWithGroup* EventListenerPhysicsContactWithGroup::clon
obj->onContactBegin = onContactBegin;
obj->onContactPreSolve = onContactPreSolve;
obj->onContactPostSolve = onContactPostSolve;
obj->onContactSeperate = onContactSeperate;
obj->onContactSeparate = onContactSeparate;
return obj;
}

View File

@ -74,7 +74,7 @@ public:
BEGIN,
PRESOLVE,
POSTSOLVE,
SEPERATE
SEPARATE
};
/** Get contact shape A. */
@ -98,7 +98,7 @@ public:
/**
* @brief Set data to contact.
* You must manage the memory yourself, Generally you can set data at contact begin, and distory it at contact seperate.
* You must manage the memory yourself, Generally you can set data at contact begin, and distory it at contact separate.
*
* @lua NA
*/
@ -235,9 +235,9 @@ public:
std::function<void(PhysicsContact& contact, const PhysicsContactPostSolve& solve)> onContactPostSolve;
/**
* @brief It will called at two shapes separated, and only call it once.
* onContactBegin and onContactSeperate will called in pairs.
* onContactBegin and onContactSeparate will called in pairs.
*/
std::function<void(PhysicsContact& contact)> onContactSeperate;
std::function<void(PhysicsContact& contact)> onContactSeparate;
protected:
bool init();

View File

@ -46,6 +46,7 @@ PhysicsShape::PhysicsShape()
, _area(0.0f)
, _mass(0.0f)
, _moment(0.0f)
, _sensor(false)
, _scaleX(1.0f)
, _scaleY(1.0f)
, _newScaleX(1.0f)
@ -250,6 +251,17 @@ void PhysicsShape::setFriction(float friction)
}
}
void PhysicsShape::setSensor(bool sensor)
{
if (sensor != _sensor)
{
for (cpShape* shape : _cpShapes)
{
cpShapeSetSensor(shape, sensor);
}
_sensor = sensor;
}
}
void PhysicsShape::recenterPoints(Vec2* points, int count, const Vec2& center)
{

View File

@ -212,6 +212,8 @@ public:
* @param material A PhysicsMaterial object.
*/
void setMaterial(const PhysicsMaterial& material);
inline bool isSensor() const { return _sensor; }
void setSensor(bool sensor);
/**
* Calculate the default moment value.
@ -346,6 +348,7 @@ protected:
float _area;
float _mass;
float _moment;
bool _sensor;
float _scaleX;
float _scaleY;
float _newScaleX;

View File

@ -320,7 +320,7 @@ void PhysicsWorld::collisionSeparateCallback(PhysicsContact& contact)
return;
}
contact.setEventCode(PhysicsContact::EventCode::SEPERATE);
contact.setEventCode(PhysicsContact::EventCode::SEPARATE);
contact.setWorld(this);
_scene->getEventDispatcher()->dispatchEvent(&contact);
}
@ -879,10 +879,10 @@ PhysicsWorld::PhysicsWorld()
, _updateTime(0.0f)
, _substeps(1)
, _cpSpace(nullptr)
, _updateBodyTransform(false)
, _scene(nullptr)
, _autoStep(true)
, _debugDraw(nullptr)
, _updateBodyTransform(false)
, _debugDrawMask(DEBUGDRAW_NONE)
{

View File

@ -0,0 +1,98 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
CC_DLL const char* physics3dVersion()
{
#if CC_ENABLE_BULLET_INTEGRATION
return "bullet2.82";
#endif
}
NS_CC_END
cocos2d::Vec3 convertbtVector3ToVec3( const btVector3 &btVec3 )
{
return cocos2d::Vec3(btVec3.x(), btVec3.y(), btVec3.z());
}
btVector3 convertVec3TobtVector3( const cocos2d::Vec3 &vec3 )
{
return btVector3(vec3.x, vec3.y, vec3.z);
}
cocos2d::Mat4 convertbtTransformToMat4( const btTransform &btTrans )
{
cocos2d::Mat4 mat;
auto rot = btTrans.getBasis();
auto row = rot.getRow(0);
mat.m[0] = row.getX();
mat.m[4] = row.getY();
mat.m[8] = row.getZ();
row = rot.getRow(1);
mat.m[1] = row.getX();
mat.m[5] = row.getY();
mat.m[9] = row.getZ();
row = rot.getRow(2);
mat.m[2] = row.getX();
mat.m[6] = row.getY();
mat.m[10] = row.getZ();
row = btTrans.getOrigin();
mat.m[12] = row.getX();
mat.m[13] = row.getY();
mat.m[14] = row.getZ();
return mat;
}
btTransform convertMat4TobtTransform( const cocos2d::Mat4 &mat4 )
{
btTransform btTrans;
btTrans.setFromOpenGLMatrix(mat4.m);
return btTrans;
}
cocos2d::Quaternion convertbtQuatToQuat( const btQuaternion &btQuat )
{
return cocos2d::Quaternion(btQuat.x(), btQuat.y(), btQuat.z(), btQuat.w());
}
btQuaternion convertQuatTobtQuat( const cocos2d::Quaternion &quat )
{
return btQuaternion(quat.x, quat.y, quat.z, quat.w);
}
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS

View File

@ -0,0 +1,69 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_3D_H__
#define __PHYSICS_3D_H__
#include "base/ccConfig.h"
#include "math/CCMath.h"
#if CC_USE_3D_PHYSICS
#include "CCPhysics3DShape.h"
#include "CCPhysicsSprite3D.h"
#include "CCPhysics3DWorld.h"
#include "CCPhysics3DDebugDrawer.h"
#include "CCPhysics3DObject.h"
#include "CCPhysics3DComponent.h"
#include "CCPhysics3DConstraint.h"
NS_CC_BEGIN
CC_DLL const char* physics3dVersion();
NS_CC_END
#if (CC_ENABLE_BULLET_INTEGRATION)
//include bullet header files
#include "bullet/LinearMath/btTransform.h"
#include "bullet/LinearMath/btVector3.h"
#include "bullet/LinearMath/btQuaternion.h"
#include "bullet/btBulletCollisionCommon.h"
#include "bullet/btBulletDynamicsCommon.h"
//convert between cocos and bullet
cocos2d::Vec3 convertbtVector3ToVec3(const btVector3 &btVec3);
btVector3 convertVec3TobtVector3(const cocos2d::Vec3 &vec3);
cocos2d::Mat4 convertbtTransformToMat4(const btTransform &btTrans);
btTransform convertMat4TobtTransform(const cocos2d::Mat4 &mat4);
cocos2d::Quaternion convertbtQuatToQuat(const btQuaternion &btQuat);
btQuaternion convertQuatTobtQuat(const cocos2d::Quaternion &quat);
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS
#endif // __PHYSICS_3D_H__

View File

@ -0,0 +1,244 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#include "2d/CCNode.h"
#include "2d/CCScene.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
Physics3DComponent::~Physics3DComponent()
{
CC_SAFE_RELEASE(_physics3DObj);
}
std::string& Physics3DComponent::getPhysics3DComponentName()
{
static std::string comName = "___Physics3DComponent___";
return comName;
}
bool Physics3DComponent::init()
{
setName(getPhysics3DComponentName());
return Component::init();
}
Physics3DComponent* Physics3DComponent::create(Physics3DObject* physicsObj, const cocos2d::Vec3& translateInPhysics, const cocos2d::Quaternion& rotInPhsyics)
{
auto ret = new (std::nothrow) Physics3DComponent();
if (ret && ret->init())
{
ret->setPhysics3DObject(physicsObj);
ret->setTransformInPhysics(translateInPhysics, rotInPhsyics);
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return nullptr;
}
void Physics3DComponent::setPhysics3DObject(Physics3DObject* physicsObj)
{
CC_SAFE_RETAIN(physicsObj);
CC_SAFE_RELEASE(_physics3DObj);
_physics3DObj = physicsObj;
}
Physics3DComponent::Physics3DComponent()
: _physics3DObj(nullptr)
, _syncFlag(Physics3DComponent::PhysicsSyncFlag::NODE_AND_NODE)
{
}
void Physics3DComponent::setEnabled(bool b)
{
bool oldBool = b;
Component::setEnabled(b);
if (_physics3DObj && oldBool != _enabled)
{
_enabled ? _physics3DObj->getPhysicsWorld()->addPhysics3DObject(_physics3DObj) : _physics3DObj->getPhysicsWorld()->removePhysics3DObject(_physics3DObj);
}
}
void Physics3DComponent::addToPhysicsWorld(Physics3DWorld* world)
{
//add component to physics world
if (_physics3DObj)
{
_physics3DObj->setPhysicsWorld(world);
world->addPhysics3DObject(_physics3DObj);
auto& components = world->_physicsComponents;
auto it = std::find(components.begin(), components.end(), this);
if (it == components.end())
{
auto parent = _owner->getParent();
while (parent) {
for (int i = 0; i < components.size(); i++) {
if (parent == components[i]->getOwner())
{
//insert it here
components.insert(components.begin() + i, this);
return;
}
}
parent = parent->getParent();
}
components.insert(components.begin(), this);
}
}
}
void Physics3DComponent::onEnter()
{
Component::onEnter();
if (_physics3DObj->getPhysicsWorld() == nullptr && _owner)
{
auto scene = _owner->getScene();
if (scene)
addToPhysicsWorld(scene->getPhysics3DWorld());
}
}
void Physics3DComponent::onExit()
{
Component::onExit();
setEnabled(false);
//remove component from physics world
if (_physics3DObj)
{
auto& components = _physics3DObj->getPhysicsWorld()->_physicsComponents;
auto it = std::find(components.begin(), components.end(), this);
if (it != components.end())
components.erase(it);
}
}
void Physics3DComponent::preSimulate()
{
if (((int)_syncFlag & (int)Physics3DComponent::PhysicsSyncFlag::NODE_TO_PHYSICS) && _physics3DObj && _owner)
{
syncToNode();
}
}
void Physics3DComponent::postSimulate()
{
if (((int)_syncFlag & (int)Physics3DComponent::PhysicsSyncFlag::PHYSICS_TO_NODE) && _physics3DObj && _owner)
{
syncToPhysics();
}
}
void Physics3DComponent::setTransformInPhysics(const cocos2d::Vec3& translateInPhysics, const cocos2d::Quaternion& rotInPhsyics)
{
Mat4::createRotation(rotInPhsyics, &_transformInPhysics);
_transformInPhysics.m[12] = translateInPhysics.x;
_transformInPhysics.m[13] = translateInPhysics.y;
_transformInPhysics.m[14] = translateInPhysics.z;
_invTransformInPhysics = _transformInPhysics.getInversed();
}
void Physics3DComponent::setSyncFlag(PhysicsSyncFlag syncFlag)
{
_syncFlag = syncFlag;
}
void Physics3DComponent::syncToPhysics()
{
if (_physics3DObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
Mat4 parentMat;
if (_owner->getParent())
parentMat = _owner->getParent()->getNodeToWorldTransform();
auto mat = parentMat.getInversed() * _physics3DObj->getWorldTransform();
//remove scale, no scale support for physics
float oneOverLen = 1.f / sqrtf(mat.m[0] * mat.m[0] + mat.m[1] * mat.m[1] + mat.m[2] * mat.m[2]);
mat.m[0] *= oneOverLen;
mat.m[1] *= oneOverLen;
mat.m[2] *= oneOverLen;
oneOverLen = 1.f / sqrtf(mat.m[4] * mat.m[4] + mat.m[5] * mat.m[5] + mat.m[6] * mat.m[6]);
mat.m[4] *= oneOverLen;
mat.m[5] *= oneOverLen;
mat.m[6] *= oneOverLen;
oneOverLen = 1.f / sqrtf(mat.m[8] * mat.m[8] + mat.m[9] * mat.m[9] + mat.m[10] * mat.m[10]);
mat.m[8] *= oneOverLen;
mat.m[9] *= oneOverLen;
mat.m[10] *= oneOverLen;
mat *= _transformInPhysics;
static Vec3 scale, translation;
static Quaternion quat;
mat.decompose(&scale, &quat, &translation);
_owner->setPosition3D(translation);
quat.normalize();
_owner->setRotationQuat(quat);
}
}
void Physics3DComponent::syncToNode()
{
if (_physics3DObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
auto mat = _owner->getNodeToWorldTransform();
//remove scale, no scale support for physics
float oneOverLen = 1.f / sqrtf(mat.m[0] * mat.m[0] + mat.m[1] * mat.m[1] + mat.m[2] * mat.m[2]);
mat.m[0] *= oneOverLen;
mat.m[1] *= oneOverLen;
mat.m[2] *= oneOverLen;
oneOverLen = 1.f / sqrtf(mat.m[4] * mat.m[4] + mat.m[5] * mat.m[5] + mat.m[6] * mat.m[6]);
mat.m[4] *= oneOverLen;
mat.m[5] *= oneOverLen;
mat.m[6] *= oneOverLen;
oneOverLen = 1.f / sqrtf(mat.m[8] * mat.m[8] + mat.m[9] * mat.m[9] + mat.m[10] * mat.m[10]);
mat.m[8] *= oneOverLen;
mat.m[9] *= oneOverLen;
mat.m[10] *= oneOverLen;
mat *= _invTransformInPhysics;
if (_physics3DObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
auto body = static_cast<Physics3DRigidBody*>(_physics3DObj)->getRigidBody();
auto motionState = body->getMotionState();
motionState->setWorldTransform(convertMat4TobtTransform(mat));
body->setMotionState(motionState);
}
}
}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS

View File

@ -0,0 +1,145 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_3D_COMPONENT_H__
#define __PHYSICS_3D_COMPONENT_H__
#include "base/ccConfig.h"
#include "math/CCMath.h"
#include "2d/CCComponent.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
class Physics3DObject;
class Physics3DWorld;
/** @brief Physics3DComponent: A component with 3D physics, you can add a rigid body to it, and then add this component to a node, the node will move and rotate with this rigid body */
class CC_DLL Physics3DComponent : public cocos2d::Component
{
friend class Physics3DWorld;
public:
enum class PhysicsSyncFlag
{
NONE = 0,
NODE_TO_PHYSICS = 1, //align node transform to the physics
PHYSICS_TO_NODE = 2, // align physics transform to the node
NODE_AND_NODE = NODE_TO_PHYSICS | PHYSICS_TO_NODE, //pre simulation, align the physics object to the node and align the node transform according to physics object after simulation
};
CREATE_FUNC(Physics3DComponent);
virtual ~Physics3DComponent();
virtual bool init() override;
/**
* create Physics3DComponent
* @param physicsObj pointer to a Physics object contain in the component
* @param translateInPhysics offset that the owner node in the physics object's space
* @param rotInPhsyics offset rotation that the owner node in the physics object's space
* @return created Physics3DComponent
*/
static Physics3DComponent* create(Physics3DObject* physicsObj, const cocos2d::Vec3& translateInPhysics = cocos2d::Vec3::ZERO, const cocos2d::Quaternion& rotInPhsyics = cocos2d::Quaternion::ZERO);
/**
* set Physics object to the component
*/
void setPhysics3DObject(Physics3DObject* physicsObj);
/**
* get physics object
*/
Physics3DObject* getPhysics3DObject() const { return _physics3DObj; }
/**
* get the component name, it is used to find whether it is Physics3DComponent
*/
static std::string& getPhysics3DComponentName();
/**
* set it enable or not
*/
virtual void setEnabled(bool b) override;
virtual void onEnter() override;
virtual void onExit() override;
/**
* add this component to physics world, called by scene
*/
void addToPhysicsWorld(Physics3DWorld* world);
/**
* The node's transform in physics object space
*/
void setTransformInPhysics(const cocos2d::Vec3& translateInPhysics, const cocos2d::Quaternion& rotInPhsyics);
/**
* synchronization between node and physics is time consuming, you can skip some synchronization using this function
*/
void setSyncFlag(PhysicsSyncFlag syncFlag);
/**
* align node and physics according to physics object
*/
void syncToPhysics();
/**
* align node and physics according to node
*/
void syncToNode();
CC_CONSTRUCTOR_ACCESS:
Physics3DComponent();
protected:
void preSimulate();
void postSimulate();
cocos2d::Mat4 _transformInPhysics; //transform in physics space
cocos2d::Mat4 _invTransformInPhysics;
Physics3DObject* _physics3DObj;
PhysicsSyncFlag _syncFlag;
};
// end of 3d group
/// @}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS
#endif // __PHYSICS_3D_COMPONENT_H__

View File

@ -0,0 +1,840 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
Physics3DConstraint::Physics3DConstraint()
: _bodyA(nullptr)
, _bodyB(nullptr)
, _constraint(nullptr)
, _type(Physics3DConstraint::ConstraintType::UNKNOWN)
, _userData(nullptr)
{
}
Physics3DConstraint::~Physics3DConstraint()
{
CC_SAFE_RELEASE(_bodyA);
CC_SAFE_RELEASE(_bodyB);
CC_SAFE_DELETE(_constraint);
}
float Physics3DConstraint::getBreakingImpulse() const
{
return _constraint->getBreakingImpulseThreshold();
}
void Physics3DConstraint::setBreakingImpulse(float impulse)
{
_constraint->setBreakingImpulseThreshold(impulse);
}
bool Physics3DConstraint::isEnabled() const
{
return _constraint->isEnabled();
}
void Physics3DConstraint::setEnabled(bool enabled)
{
return _constraint->setEnabled(enabled);
}
int Physics3DConstraint::getOverrideNumSolverIterations() const
{
return _constraint->getOverrideNumSolverIterations();
}
///override the number of constraint solver iterations used to solve this constraint
///-1 will use the default number of iterations, as specified in SolverInfo.m_numIterations
void Physics3DConstraint::setOverrideNumSolverIterations(int overideNumIterations)
{
_constraint->setOverrideNumSolverIterations(overideNumIterations);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Physics3DPointToPointConstraint* Physics3DPointToPointConstraint::create(Physics3DRigidBody* rbA, const cocos2d::Vec3& pivotPointInA)
{
auto ret = new (std::nothrow) Physics3DPointToPointConstraint();
if (ret && ret->init(rbA, pivotPointInA))
{
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return ret;
}
Physics3DPointToPointConstraint* Physics3DPointToPointConstraint::create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Vec3& pivotPointInA, const cocos2d::Vec3& pivotPointInB)
{
auto ret = new (std::nothrow) Physics3DPointToPointConstraint();
if (ret && ret->init(rbA, rbB, pivotPointInA, pivotPointInB))
{
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return ret;
}
bool Physics3DPointToPointConstraint::init(Physics3DRigidBody* rbA, const cocos2d::Vec3& pivotPointInA)
{
_constraint = new btPoint2PointConstraint(*rbA->getRigidBody(), convertVec3TobtVector3(pivotPointInA));
_bodyA = rbA;
_bodyA->retain();
return true;
}
bool Physics3DPointToPointConstraint::init(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Vec3& pivotPointInA, const cocos2d::Vec3& pivotPointInB)
{
_constraint = new btPoint2PointConstraint(*rbA->getRigidBody(), *rbB->getRigidBody(), convertVec3TobtVector3(pivotPointInA), convertVec3TobtVector3(pivotPointInB));
_bodyA = rbA;
_bodyB = rbB;
_bodyA->retain();
_bodyB->retain();
return true;
}
void Physics3DPointToPointConstraint::setPivotPointInA(const cocos2d::Vec3& pivotA)
{
auto point = convertVec3TobtVector3(pivotA);
static_cast<btPoint2PointConstraint*>(_constraint)->setPivotA(point);
}
void Physics3DPointToPointConstraint::setPivotPointInB(const cocos2d::Vec3&& pivotB)
{
auto point = convertVec3TobtVector3(pivotB);
static_cast<btPoint2PointConstraint*>(_constraint)->setPivotB(point);
}
cocos2d::Vec3 Physics3DPointToPointConstraint::getPivotPointInA() const
{
const auto& point = static_cast<btPoint2PointConstraint*>(_constraint)->getPivotInA();
return convertbtVector3ToVec3(point);
}
cocos2d::Vec3 Physics3DPointToPointConstraint::getPivotPointInB() const
{
const auto& point = static_cast<btPoint2PointConstraint*>(_constraint)->getPivotInB();
return convertbtVector3ToVec3(point);
}
Physics3DPointToPointConstraint::Physics3DPointToPointConstraint()
{
_type = Physics3DConstraint::ConstraintType::POINT_TO_POINT;
}
Physics3DPointToPointConstraint::~Physics3DPointToPointConstraint()
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Physics3DHingeConstraint* Physics3DHingeConstraint::create(Physics3DRigidBody* rbA, const cocos2d::Mat4& rbAFrame, bool useReferenceFrameA)
{
auto ret = new (std::nothrow) Physics3DHingeConstraint();
ret->_constraint = new btHingeConstraint(*rbA->getRigidBody(), convertMat4TobtTransform(rbAFrame), useReferenceFrameA);
ret->_bodyA = rbA;
rbA->retain();
ret->autorelease();
return ret;
}
Physics3DHingeConstraint* Physics3DHingeConstraint::create(Physics3DRigidBody* rbA, const cocos2d::Vec3& pivotInA, const cocos2d::Vec3& axisInA, bool useReferenceFrameA)
{
auto ret = new (std::nothrow) Physics3DHingeConstraint();
ret->_constraint = new btHingeConstraint(*rbA->getRigidBody(), convertVec3TobtVector3(pivotInA), convertVec3TobtVector3(axisInA), useReferenceFrameA);
ret->_bodyA = rbA;
rbA->retain();
ret->autorelease();
return ret;
}
Physics3DHingeConstraint* Physics3DHingeConstraint::create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Vec3& pivotInA,const cocos2d::Vec3& pivotInB, cocos2d::Vec3& axisInA, cocos2d::Vec3& axisInB, bool useReferenceFrameA)
{
auto ret = new (std::nothrow) Physics3DHingeConstraint();
ret->_constraint = new btHingeConstraint(*rbA->getRigidBody(), *rbB->getRigidBody(), convertVec3TobtVector3(pivotInA), convertVec3TobtVector3(pivotInB), convertVec3TobtVector3(axisInA), convertVec3TobtVector3(axisInB), useReferenceFrameA);
ret->_bodyA = rbA;
rbA->retain();
ret->_bodyB = rbB;
rbB->retain();
ret->autorelease();
return ret;
}
Physics3DHingeConstraint* Physics3DHingeConstraint::create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& rbAFrame, const cocos2d::Mat4& rbBFrame, bool useReferenceFrameA)
{
auto ret = new (std::nothrow) Physics3DHingeConstraint();
ret->_constraint = new btHingeConstraint(*rbA->getRigidBody(), *rbB->getRigidBody(), convertMat4TobtTransform(rbAFrame), convertMat4TobtTransform(rbBFrame), useReferenceFrameA);
ret->_bodyA = rbA;
rbA->retain();
ret->_bodyB = rbB;
rbB->retain();
ret->autorelease();
return ret;
}
cocos2d::Mat4 Physics3DHingeConstraint::getFrameOffsetA() const
{
const auto& transform = static_cast<btHingeConstraint*>(_constraint)->getFrameOffsetA();
return convertbtTransformToMat4(transform);
}
cocos2d::Mat4 Physics3DHingeConstraint::getFrameOffsetB() const
{
const auto& transform = static_cast<btHingeConstraint*>(_constraint)->getFrameOffsetB();
return convertbtTransformToMat4(transform);
}
void Physics3DHingeConstraint::setFrames(const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB)
{
auto transformA = convertMat4TobtTransform(frameA);
auto transformB = convertMat4TobtTransform(frameB);
static_cast<btHingeConstraint*>(_constraint)->setFrames(transformA, transformB);
}
void Physics3DHingeConstraint::setAngularOnly(bool angularOnly)
{
static_cast<btHingeConstraint*>(_constraint)->setAngularOnly(angularOnly);
}
void Physics3DHingeConstraint::enableAngularMotor(bool enableMotor, float targetVelocity, float maxMotorImpulse)
{
static_cast<btHingeConstraint*>(_constraint)->enableAngularMotor(enableMotor, targetVelocity, maxMotorImpulse);
}
void Physics3DHingeConstraint::enableMotor(bool enableMotor)
{
static_cast<btHingeConstraint*>(_constraint)->enableMotor(enableMotor);
}
void Physics3DHingeConstraint::setMaxMotorImpulse(float maxMotorImpulse)
{
static_cast<btHingeConstraint*>(_constraint)->setMaxMotorImpulse(maxMotorImpulse);
}
void Physics3DHingeConstraint::setMotorTarget(const cocos2d::Quaternion& qAinB, float dt)
{
static_cast<btHingeConstraint*>(_constraint)->setMotorTarget(convertQuatTobtQuat(qAinB), dt);
}
void Physics3DHingeConstraint::setMotorTarget(float targetAngle, float dt)
{
static_cast<btHingeConstraint*>(_constraint)->setMotorTarget(targetAngle, dt);
}
void Physics3DHingeConstraint::setLimit(float low, float high, float softness, float biasFactor, float relaxationFactor)
{
static_cast<btHingeConstraint*>(_constraint)->setLimit(low, high, softness, biasFactor, relaxationFactor);
}
void Physics3DHingeConstraint::setAxis(const cocos2d::Vec3& axisInA)
{
auto axis = convertVec3TobtVector3(axisInA);
static_cast<btHingeConstraint*>(_constraint)->setAxis(axis);
}
float Physics3DHingeConstraint::getLowerLimit() const
{
return static_cast<btHingeConstraint*>(_constraint)->getLowerLimit();
}
float Physics3DHingeConstraint::getUpperLimit() const
{
return static_cast<btHingeConstraint*>(_constraint)->getUpperLimit();
}
float Physics3DHingeConstraint::getHingeAngle()
{
return static_cast<btHingeConstraint*>(_constraint)->getHingeAngle();
}
float Physics3DHingeConstraint::getHingeAngle(const cocos2d::Mat4& transA, const cocos2d::Mat4& transB)
{
auto btTransA = convertMat4TobtTransform(transA);
auto btTransB = convertMat4TobtTransform(transB);
return static_cast<btHingeConstraint*>(_constraint)->getHingeAngle(btTransA, btTransB);
}
cocos2d::Mat4 Physics3DHingeConstraint::getAFrame()
{
const auto& trans = static_cast<btHingeConstraint*>(_constraint)->getAFrame();
return convertbtTransformToMat4(trans);
}
cocos2d::Mat4 Physics3DHingeConstraint::getBFrame()
{
const auto& trans = static_cast<btHingeConstraint*>(_constraint)->getBFrame();
return convertbtTransformToMat4(trans);
}
bool Physics3DHingeConstraint::getAngularOnly()
{
return static_cast<btHingeConstraint*>(_constraint)->getAngularOnly();
}
bool Physics3DHingeConstraint::getEnableAngularMotor()
{
return static_cast<btHingeConstraint*>(_constraint)->getEnableAngularMotor();
}
float Physics3DHingeConstraint::getMotorTargetVelosity()
{
return static_cast<btHingeConstraint*>(_constraint)->getMotorTargetVelosity();
}
float Physics3DHingeConstraint::getMaxMotorImpulse()
{
return static_cast<btHingeConstraint*>(_constraint)->getMaxMotorImpulse();
}
bool Physics3DHingeConstraint::getUseFrameOffset()
{
return static_cast<btHingeConstraint*>(_constraint)->getUseFrameOffset();
}
void Physics3DHingeConstraint::setUseFrameOffset(bool frameOffsetOnOff)
{
static_cast<btHingeConstraint*>(_constraint)->setUseFrameOffset(frameOffsetOnOff);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Physics3DSliderConstraint* Physics3DSliderConstraint::create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& frameInA, const cocos2d::Mat4& frameInB ,bool useLinearReferenceFrameA)
{
auto ret = new (std::nothrow) Physics3DSliderConstraint();
ret->_bodyA = rbA;
ret->_bodyB = rbB;
rbA->retain();
rbB->retain();
auto transformA = convertMat4TobtTransform(frameInA);
auto transformB = convertMat4TobtTransform(frameInB);
ret->_constraint = new btSliderConstraint(*rbA->getRigidBody(), *rbB->getRigidBody(), transformA, transformB, useLinearReferenceFrameA);
ret->autorelease();
return ret;
}
cocos2d::Mat4 Physics3DSliderConstraint::getFrameOffsetA() const
{
const auto& frameOff = static_cast<btSliderConstraint*>(_constraint)->getFrameOffsetA();
return convertbtTransformToMat4(frameOff);
}
cocos2d::Mat4 Physics3DSliderConstraint::getFrameOffsetB() const
{
const auto& frameOff = static_cast<btSliderConstraint*>(_constraint)->getFrameOffsetB();
return convertbtTransformToMat4(frameOff);
}
float Physics3DSliderConstraint::getLowerLinLimit()
{
return static_cast<btSliderConstraint*>(_constraint)->getLowerLinLimit();
}
void Physics3DSliderConstraint::setLowerLinLimit(float lowerLimit)
{
static_cast<btSliderConstraint*>(_constraint)->setLowerLinLimit(lowerLimit);
}
float Physics3DSliderConstraint::getUpperLinLimit()
{
return static_cast<btSliderConstraint*>(_constraint)->getUpperLinLimit();
}
void Physics3DSliderConstraint::setUpperLinLimit(float upperLimit)
{
static_cast<btSliderConstraint*>(_constraint)->setUpperLinLimit(upperLimit);
}
float Physics3DSliderConstraint::getLowerAngLimit()
{
return static_cast<btSliderConstraint*>(_constraint)->getLowerAngLimit();
}
void Physics3DSliderConstraint::setLowerAngLimit(float lowerLimit)
{
static_cast<btSliderConstraint*>(_constraint)->setLowerAngLimit(lowerLimit);
}
float Physics3DSliderConstraint::getUpperAngLimit()
{
return static_cast<btSliderConstraint*>(_constraint)->getUpperAngLimit();
}
void Physics3DSliderConstraint::setUpperAngLimit(float upperLimit)
{
static_cast<btSliderConstraint*>(_constraint)->setUpperAngLimit(upperLimit);
}
bool Physics3DSliderConstraint::getUseLinearReferenceFrameA()
{
return static_cast<btSliderConstraint*>(_constraint)->getUseLinearReferenceFrameA();
}
float Physics3DSliderConstraint::getSoftnessDirLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessDirLin();
}
float Physics3DSliderConstraint::getRestitutionDirLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionDirLin();
}
float Physics3DSliderConstraint::getDampingDirLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getDampingDirLin();
}
float Physics3DSliderConstraint::getSoftnessDirAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessDirAng();
}
float Physics3DSliderConstraint::getRestitutionDirAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionDirAng();
}
float Physics3DSliderConstraint::getDampingDirAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getDampingDirAng();
}
float Physics3DSliderConstraint::getSoftnessLimLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessLimLin();
}
float Physics3DSliderConstraint::getRestitutionLimLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionLimLin();
}
float Physics3DSliderConstraint::getDampingLimLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getDampingLimAng();
}
float Physics3DSliderConstraint::getSoftnessLimAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessLimAng();
}
float Physics3DSliderConstraint::getRestitutionLimAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionLimAng();
}
float Physics3DSliderConstraint::getDampingLimAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getDampingLimAng();
}
float Physics3DSliderConstraint::getSoftnessOrthoLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessOrthoLin();
}
float Physics3DSliderConstraint::getRestitutionOrthoLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionOrthoAng();
}
float Physics3DSliderConstraint::getDampingOrthoLin()
{
return static_cast<btSliderConstraint*>(_constraint)->getDampingOrthoLin();
}
float Physics3DSliderConstraint::getSoftnessOrthoAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessOrthoAng();
}
float Physics3DSliderConstraint::getRestitutionOrthoAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionOrthoAng();
}
float Physics3DSliderConstraint::getDampingOrthoAng()
{
return static_cast<btSliderConstraint*>(_constraint)->getDampingOrthoAng();
}
void Physics3DSliderConstraint::setSoftnessDirLin(float softnessDirLin)
{
static_cast<btSliderConstraint*>(_constraint)->setSoftnessDirLin(softnessDirLin);
}
void Physics3DSliderConstraint::setRestitutionDirLin(float restitutionDirLin)
{
static_cast<btSliderConstraint*>(_constraint)->setRestitutionDirLin(restitutionDirLin);
}
void Physics3DSliderConstraint::setDampingDirLin(float dampingDirLin)
{
static_cast<btSliderConstraint*>(_constraint)->setDampingDirLin(dampingDirLin);
}
void Physics3DSliderConstraint::setSoftnessDirAng(float softnessDirAng)
{
static_cast<btSliderConstraint*>(_constraint)->setSoftnessDirAng(softnessDirAng);
}
void Physics3DSliderConstraint::setRestitutionDirAng(float restitutionDirAng)
{
static_cast<btSliderConstraint*>(_constraint)->setRestitutionDirAng(restitutionDirAng);
}
void Physics3DSliderConstraint::setDampingDirAng(float dampingDirAng)
{
static_cast<btSliderConstraint*>(_constraint)->setDampingDirAng(dampingDirAng);
}
void Physics3DSliderConstraint::setSoftnessLimLin(float softnessLimLin)
{
static_cast<btSliderConstraint*>(_constraint)->setSoftnessLimLin(softnessLimLin);
}
void Physics3DSliderConstraint::setRestitutionLimLin(float restitutionLimLin)
{
static_cast<btSliderConstraint*>(_constraint)->setRestitutionDirLin(restitutionLimLin);
}
void Physics3DSliderConstraint::setDampingLimLin(float dampingLimLin)
{
static_cast<btSliderConstraint*>(_constraint)->setDampingLimLin(dampingLimLin);
}
void Physics3DSliderConstraint::setSoftnessLimAng(float softnessLimAng)
{
static_cast<btSliderConstraint*>(_constraint)->setSoftnessLimAng(softnessLimAng);
}
void Physics3DSliderConstraint::setRestitutionLimAng(float restitutionLimAng)
{
static_cast<btSliderConstraint*>(_constraint)->setRestitutionLimAng(restitutionLimAng);
}
void Physics3DSliderConstraint::setDampingLimAng(float dampingLimAng)
{
static_cast<btSliderConstraint*>(_constraint)->setDampingLimAng(dampingLimAng);
}
void Physics3DSliderConstraint::setSoftnessOrthoLin(float softnessOrthoLin)
{
static_cast<btSliderConstraint*>(_constraint)->setSoftnessOrthoLin(softnessOrthoLin);
}
void Physics3DSliderConstraint::setRestitutionOrthoLin(float restitutionOrthoLin)
{
static_cast<btSliderConstraint*>(_constraint)->setRestitutionOrthoLin(restitutionOrthoLin);
}
void Physics3DSliderConstraint::setDampingOrthoLin(float dampingOrthoLin)
{
static_cast<btSliderConstraint*>(_constraint)->setDampingLimLin(dampingOrthoLin);
}
void Physics3DSliderConstraint::setSoftnessOrthoAng(float softnessOrthoAng)
{
static_cast<btSliderConstraint*>(_constraint)->setSoftnessOrthoAng(softnessOrthoAng);
}
void Physics3DSliderConstraint::setRestitutionOrthoAng(float restitutionOrthoAng)
{
static_cast<btSliderConstraint*>(_constraint)->setRestitutionOrthoAng(restitutionOrthoAng);
}
void Physics3DSliderConstraint::setDampingOrthoAng(float dampingOrthoAng)
{
static_cast<btSliderConstraint*>(_constraint)->setDampingOrthoAng(dampingOrthoAng);
}
void Physics3DSliderConstraint::setPoweredLinMotor(bool onOff)
{
static_cast<btSliderConstraint*>(_constraint)->setPoweredLinMotor(onOff);
}
bool Physics3DSliderConstraint::getPoweredLinMotor()
{
return static_cast<btSliderConstraint*>(_constraint)->getPoweredLinMotor();
}
void Physics3DSliderConstraint::setTargetLinMotorVelocity(float targetLinMotorVelocity)
{
static_cast<btSliderConstraint*>(_constraint)->setTargetLinMotorVelocity(targetLinMotorVelocity);
}
float Physics3DSliderConstraint::getTargetLinMotorVelocity()
{
return static_cast<btSliderConstraint*>(_constraint)->getTargetLinMotorVelocity();
}
void Physics3DSliderConstraint::setMaxLinMotorForce(float maxLinMotorForce)
{
static_cast<btSliderConstraint*>(_constraint)->setMaxLinMotorForce(maxLinMotorForce);
}
float Physics3DSliderConstraint::getMaxLinMotorForce()
{
return static_cast<btSliderConstraint*>(_constraint)->getMaxLinMotorForce();
}
void Physics3DSliderConstraint::setPoweredAngMotor(bool onOff)
{
static_cast<btSliderConstraint*>(_constraint)->setPoweredAngMotor(onOff);
}
bool Physics3DSliderConstraint::getPoweredAngMotor()
{
return static_cast<btSliderConstraint*>(_constraint)->getPoweredAngMotor();
}
void Physics3DSliderConstraint::setTargetAngMotorVelocity(float targetAngMotorVelocity)
{
return static_cast<btSliderConstraint*>(_constraint)->setTargetAngMotorVelocity(targetAngMotorVelocity);
}
float Physics3DSliderConstraint::getTargetAngMotorVelocity()
{
return static_cast<btSliderConstraint*>(_constraint)->getTargetAngMotorVelocity();
}
void Physics3DSliderConstraint::setMaxAngMotorForce(float maxAngMotorForce)
{
return static_cast<btSliderConstraint*>(_constraint)->setMaxAngMotorForce(maxAngMotorForce);
}
float Physics3DSliderConstraint::getMaxAngMotorForce()
{
return static_cast<btSliderConstraint*>(_constraint)->getMaxAngMotorForce();
}
float Physics3DSliderConstraint::getLinearPos() const
{
return static_cast<btSliderConstraint*>(_constraint)->getLinearPos();
}
float Physics3DSliderConstraint::getAngularPos() const
{
return static_cast<btSliderConstraint*>(_constraint)->getAngularPos();
}
// access for UseFrameOffset
bool Physics3DSliderConstraint::getUseFrameOffset()
{
return static_cast<btSliderConstraint*>(_constraint)->getUseFrameOffset();
}
void Physics3DSliderConstraint::setUseFrameOffset(bool frameOffsetOnOff)
{
static_cast<btSliderConstraint*>(_constraint)->setUseFrameOffset(frameOffsetOnOff);
}
void Physics3DSliderConstraint::setFrames(const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB)
{
auto btFrameA = convertMat4TobtTransform(frameA);
auto btFrameB = convertMat4TobtTransform(frameB);
static_cast<btSliderConstraint*>(_constraint)->setFrames(btFrameA, btFrameB);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Physics3DConeTwistConstraint* Physics3DConeTwistConstraint::create(Physics3DRigidBody* rbA, const cocos2d::Mat4& frameA)
{
auto ret = new (std::nothrow) Physics3DConeTwistConstraint();
ret->_bodyA = rbA;
rbA->retain();
auto btFrame = convertMat4TobtTransform(frameA);
ret->_constraint = new btConeTwistConstraint(*rbA->getRigidBody(), btFrame);
ret->autorelease();
return ret;
}
Physics3DConeTwistConstraint* Physics3DConeTwistConstraint::create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB)
{
auto ret = new (std::nothrow) Physics3DConeTwistConstraint();
ret->_bodyA = rbA;
ret->_bodyB = rbB;
rbA->retain();
rbB->retain();
auto btFrameA = convertMat4TobtTransform(frameA);
auto btFrameB = convertMat4TobtTransform(frameB);
ret->_constraint = new btConeTwistConstraint(*rbA->getRigidBody(), *rbB->getRigidBody(), btFrameA, btFrameB);
ret->autorelease();
return ret;
}
void Physics3DConeTwistConstraint::setLimit(float swingSpan1,float swingSpan2,float twistSpan, float softness, float biasFactor, float relaxationFactor)
{
static_cast<btConeTwistConstraint*>(_constraint)->setLimit(swingSpan1, swingSpan2, twistSpan, softness, biasFactor, relaxationFactor);
}
cocos2d::Mat4 Physics3DConeTwistConstraint::getAFrame()
{
const auto& frame = static_cast<btConeTwistConstraint*>(_constraint)->getAFrame();
return convertbtTransformToMat4(frame);
}
cocos2d::Mat4 Physics3DConeTwistConstraint::getBFrame()
{
const auto& frame = static_cast<btConeTwistConstraint*>(_constraint)->getBFrame();
return convertbtTransformToMat4(frame);
}
float Physics3DConeTwistConstraint::getSwingSpan1()
{
return static_cast<btConeTwistConstraint*>(_constraint)->getSwingSpan1();
}
float Physics3DConeTwistConstraint::getSwingSpan2()
{
return static_cast<btConeTwistConstraint*>(_constraint)->getSwingSpan2();
}
float Physics3DConeTwistConstraint::getTwistSpan()
{
return static_cast<btConeTwistConstraint*>(_constraint)->getTwistSpan();
}
float Physics3DConeTwistConstraint::getTwistAngle()
{
return static_cast<btConeTwistConstraint*>(_constraint)->getTwistAngle();
}
void Physics3DConeTwistConstraint::setDamping(float damping)
{
static_cast<btConeTwistConstraint*>(_constraint)->setDamping(damping);
}
void Physics3DConeTwistConstraint::enableMotor(bool b)
{
static_cast<btConeTwistConstraint*>(_constraint)->enableMotor(b);
}
void Physics3DConeTwistConstraint::setMaxMotorImpulse(float maxMotorImpulse)
{
static_cast<btConeTwistConstraint*>(_constraint)->setMaxMotorImpulse(maxMotorImpulse);
}
void Physics3DConeTwistConstraint::setMaxMotorImpulseNormalized(float maxMotorImpulse)
{
static_cast<btConeTwistConstraint*>(_constraint)->setMaxMotorImpulseNormalized(maxMotorImpulse);
}
float Physics3DConeTwistConstraint::getFixThresh()
{
return static_cast<btConeTwistConstraint*>(_constraint)->getFixThresh();
}
void Physics3DConeTwistConstraint::setFixThresh(float fixThresh)
{
static_cast<btConeTwistConstraint*>(_constraint)->setFixThresh(fixThresh);
}
void Physics3DConeTwistConstraint::setMotorTarget(const btQuaternion &q)
{
static_cast<btConeTwistConstraint*>(_constraint)->setMotorTarget(q);
}
// same as above, but q is the desired rotation of frameA wrt frameB in constraint space
void Physics3DConeTwistConstraint::setMotorTargetInConstraintSpace(const btQuaternion &q)
{
static_cast<btConeTwistConstraint*>(_constraint)->setMotorTargetInConstraintSpace(q);
}
cocos2d::Vec3 Physics3DConeTwistConstraint::GetPointForAngle(float fAngleInRadians, float fLength) const
{
const auto& point = static_cast<btConeTwistConstraint*>(_constraint)->GetPointForAngle(fAngleInRadians, fLength);
return convertbtVector3ToVec3(point);
}
void Physics3DConeTwistConstraint::setFrames(const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB)
{
const auto& btFrameA = convertMat4TobtTransform(frameA);
const auto& btFrameB = convertMat4TobtTransform(frameB);
static_cast<btConeTwistConstraint*>(_constraint)->setFrames(btFrameA, btFrameB);
}
cocos2d::Mat4 Physics3DConeTwistConstraint::getFrameOffsetA() const
{
const auto& trans = static_cast<btConeTwistConstraint*>(_constraint)->getFrameOffsetA();
return convertbtTransformToMat4(trans);
}
cocos2d::Mat4 Physics3DConeTwistConstraint::getFrameOffsetB() const
{
const auto& trans = static_cast<btConeTwistConstraint*>(_constraint)->getFrameOffsetB();
return convertbtTransformToMat4(trans);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Physics3D6DofConstraint* Physics3D6DofConstraint::create(Physics3DRigidBody* rbB, const cocos2d::Mat4& frameInB, bool useLinearReferenceFrameB)
{
auto ret = new Physics3D6DofConstraint();
ret->_bodyB = rbB;
rbB->retain();
auto frameB = convertMat4TobtTransform(frameInB);
ret->_constraint = new btGeneric6DofConstraint(*rbB->getRigidBody(), frameB, useLinearReferenceFrameB);
ret->autorelease();
return ret;
}
Physics3D6DofConstraint* Physics3D6DofConstraint::create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& frameInA, const cocos2d::Mat4& frameInB, bool useLinearReferenceFrameA)
{
auto ret = new Physics3D6DofConstraint();
ret->_bodyA = rbA;
ret->_bodyB = rbB;
rbA->retain();
rbB->retain();
auto frameA = convertMat4TobtTransform(frameInA);
auto frameB = convertMat4TobtTransform(frameInB);
ret->_constraint = new btGeneric6DofConstraint(*rbA->getRigidBody(), *rbB->getRigidBody(), frameA, frameB, useLinearReferenceFrameA);
ret->autorelease();
return ret;
}
void Physics3D6DofConstraint::setLinearLowerLimit(const cocos2d::Vec3& linearLower)
{
auto lower = convertVec3TobtVector3(linearLower);
static_cast<btGeneric6DofConstraint*>(_constraint)->setLinearLowerLimit(lower);
}
cocos2d::Vec3 Physics3D6DofConstraint::getLinearLowerLimit()
{
btVector3 lower;
static_cast<btGeneric6DofConstraint*>(_constraint)->getLinearLowerLimit(lower);
return convertbtVector3ToVec3(lower);
}
void Physics3D6DofConstraint::setLinearUpperLimit(const cocos2d::Vec3& linearUpper)
{
auto upper = convertVec3TobtVector3(linearUpper);
static_cast<btGeneric6DofConstraint*>(_constraint)->setLinearUpperLimit(upper);
}
cocos2d::Vec3 Physics3D6DofConstraint::getLinearUpperLimit()
{
btVector3 upper;
static_cast<btGeneric6DofConstraint*>(_constraint)->getLinearUpperLimit(upper);
return convertbtVector3ToVec3(upper);
}
void Physics3D6DofConstraint::setAngularLowerLimit(const cocos2d::Vec3& angularLower)
{
auto lower = convertVec3TobtVector3(angularLower);
static_cast<btGeneric6DofConstraint*>(_constraint)->setAngularLowerLimit(lower);
}
cocos2d::Vec3 Physics3D6DofConstraint::getAngularLowerLimit()
{
btVector3 lower;
static_cast<btGeneric6DofConstraint*>(_constraint)->getAngularLowerLimit(lower);
return convertbtVector3ToVec3(lower);
}
void Physics3D6DofConstraint::setAngularUpperLimit(const cocos2d::Vec3& angularUpper)
{
auto upper = convertVec3TobtVector3(angularUpper);
static_cast<btGeneric6DofConstraint*>(_constraint)->setAngularUpperLimit(upper);
}
cocos2d::Vec3 Physics3D6DofConstraint::getAngularUpperLimit()
{
btVector3 upper;
static_cast<btGeneric6DofConstraint*>(_constraint)->getAngularUpperLimit(upper);
return convertbtVector3ToVec3(upper);
}
bool Physics3D6DofConstraint::isLimited(int limitIndex)
{
return static_cast<btGeneric6DofConstraint*>(_constraint)->isLimited(limitIndex);
}
bool Physics3D6DofConstraint::getUseFrameOffset()
{
return static_cast<btGeneric6DofConstraint*>(_constraint)->getUseFrameOffset();
}
void Physics3D6DofConstraint::setUseFrameOffset(bool frameOffsetOnOff)
{
static_cast<btGeneric6DofConstraint*>(_constraint)->setUseFrameOffset(frameOffsetOnOff);
}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS

View File

@ -0,0 +1,592 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_3D_CONSTRAINT_H__
#define __PHYSICS_3D_CONSTRAINT_H__
#include "math/CCMath.h"
#include "base/CCRef.h"
#include "base/ccConfig.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
class btTypedConstraint;
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
class Physics3DRigidBody;
/** @brief Physics3DConstraint: Constraint affects the movement of physics object, it usually connet one or two physics object. There are some types of physics constraints. */
class CC_DLL Physics3DConstraint : public Ref
{
public:
enum class ConstraintType
{
UNKNOWN,
POINT_TO_POINT,
HINGE,
SLIDER,
CONE_TWIST,
SIX_DOF,
};
/**
* get the impulse that break the constraint
*/
float getBreakingImpulse() const;
/**
* set the impulse that break the constraint
*/
void setBreakingImpulse(float impulse);
/**
* is it enabled
*/
bool isEnabled() const;
/**
* set enable or not
*/
void setEnabled(bool enabled);
/**
* get rigid body a
*/
Physics3DRigidBody* getBodyA() const { return _bodyA; }
/**
* get rigid body b
*/
Physics3DRigidBody* getBodyB() const { return _bodyB; }
/**
* get constraint type
*/
ConstraintType getConstraintType() const { return _type; }
/**
* get user data
*/
void setUserData(void* userData) { _userData = userData; }
/**
* get user data
*/
void* getUserData() const { return _userData; }
/**
* get override number of solver iterations
*/
int getOverrideNumSolverIterations() const;
///override the number of constraint solver iterations used to solve this constraint
///-1 will use the default number of iterations, as specified in SolverInfo.m_numIterations
void setOverrideNumSolverIterations(int overideNumIterations);
#if (CC_ENABLE_BULLET_INTEGRATION)
btTypedConstraint* getbtContraint() { return _constraint; }
#endif
protected:
Physics3DConstraint();
virtual ~Physics3DConstraint();
btTypedConstraint* _constraint;
Physics3DRigidBody* _bodyA;
Physics3DRigidBody* _bodyB;
ConstraintType _type;
void* _userData;
};
/**
* Point to point constraint limits the translation so that the local pivot points of 2 rigidbodies match in worldspace.
*/
class CC_DLL Physics3DPointToPointConstraint : public Physics3DConstraint
{
public:
/**
* create point to point constraint, limits the translation of local pivot point of rigid body A
* @param rbA The rigid body going to be fixed
* @param pivotPointInA local pivot point in A's local space
* @return created constraint
*/
static Physics3DPointToPointConstraint* create(Physics3DRigidBody* rbA, const cocos2d::Vec3& pivotPointInA);
/**
* create point to point constraint, make the local pivot points of 2 rigid bodies match in worldspace.
* @param rbA The rigid body A going to be fixed
* @param rbB The rigid body B going to be fixed
* @param pivotPointInA local pivot point in A's local space
* @param pivotPointInB local pivot point in B's local space
* @return created constraint
*/
static Physics3DPointToPointConstraint* create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Vec3& pivotPointInA, const cocos2d::Vec3& pivotPointInB);
/**
* set pivot point in A's local space
*/
void setPivotPointInA(const cocos2d::Vec3& pivotA);
/**
* set pivot point in B's local space
*/
void setPivotPointInB(const cocos2d::Vec3&& pivotB);
/**
* get pivot point in A's local space
*/
cocos2d::Vec3 getPivotPointInA() const;
/**
* get pivot point in B's local space
*/
cocos2d::Vec3 getPivotPointInB() const;
CC_CONSTRUCTOR_ACCESS:
Physics3DPointToPointConstraint();
virtual ~Physics3DPointToPointConstraint();
protected:
bool init(Physics3DRigidBody* rbA, const cocos2d::Vec3& pivotPointInA);
bool init(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Vec3& pivotPointInA, const cocos2d::Vec3& pivotPointInB);
};
/**
* Hinge constraint restricts two additional angular degrees of freedom, so the body can only rotate around one axis, the hinge axis. This can be useful to represent doors or wheels rotating around one axis.
* hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space
*/
class CC_DLL Physics3DHingeConstraint : public Physics3DConstraint
{
public:
/**
* create hinge constraint
* @param rbA rigid body A
* @param rbAFrame rigid body A's frame
* @param useReferenceFrameA use frame A as reference
*/
static Physics3DHingeConstraint* create(Physics3DRigidBody* rbA, const cocos2d::Mat4& rbAFrame, bool useReferenceFrameA = false);
/**
* create hinge constraint
* @param rbA rigid body A
* @param pivotInA pivot in rigid body A's local space
* @param axisInA axis in rigid body A's local space
* @param useReferenceFrameA use frame A as reference
*/
static Physics3DHingeConstraint* create(Physics3DRigidBody* rbA, const cocos2d::Vec3& pivotInA, const cocos2d::Vec3& axisInA, bool useReferenceFrameA = false);
/**
* create hinge constraint
* @param rbA rigid body A
* @param rbB rigid body B
* @param pivotInA pivot point in A's local space
* @param pivotInB pivot point in B's local space
* @param axisInA axis in A's local space
* @param axisInB axis in B's local space
* @param useReferenceFrameA use frame A as reference
*/
static Physics3DHingeConstraint* create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Vec3& pivotInA,const cocos2d::Vec3& pivotInB, cocos2d::Vec3& axisInA, cocos2d::Vec3& axisInB, bool useReferenceFrameA = false);
/**
* create hinge constraint
* @param rbA rigid body A
* @param rbB rigid body B
* @param rbAFrame rigid body A's frame
* @param rbBFrame rigid body B's frame
* @param useReferenceFrameA use frame A as reference
*/
static Physics3DHingeConstraint* create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& rbAFrame, const cocos2d::Mat4& rbBFrame, bool useReferenceFrameA = false);
/**
* get rigid body A's frame offset
*/
cocos2d::Mat4 getFrameOffsetA() const;
/**
* get rigid body B's frame offset
*/
cocos2d::Mat4 getFrameOffsetB() const;
/**
* set frames for rigid body A and B
*/
void setFrames(const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB);
/**
* set angular only
*/
void setAngularOnly(bool angularOnly);
/** enable angular motor */
void enableAngularMotor(bool enableMotor, float targetVelocity, float maxMotorImpulse);
// extra motor API, including ability to set a target rotation (as opposed to angular velocity)
// note: setMotorTarget sets angular velocity under the hood, so you must call it every tick to
// maintain a given angular target.
void enableMotor(bool enableMotor);
/** set max motor impulse */
void setMaxMotorImpulse(float maxMotorImpulse);
/**
* set motor target
*/
void setMotorTarget(const cocos2d::Quaternion& qAinB, float dt);
/** set motor target */
void setMotorTarget(float targetAngle, float dt);
/** set limit */
void setLimit(float low, float high, float _softness = 0.9f, float _biasFactor = 0.3f, float _relaxationFactor = 1.0f);
/**set axis*/
void setAxis(const cocos2d::Vec3& axisInA);
/**get lower limit*/
float getLowerLimit() const;
/**get upper limit*/
float getUpperLimit() const;
/**get hinge angle*/
float getHingeAngle();
/**get hinge angle*/
float getHingeAngle(const cocos2d::Mat4& transA, const cocos2d::Mat4& transB);
/**get A's frame */
cocos2d::Mat4 getAFrame();
/**get B's frame*/
cocos2d::Mat4 getBFrame();
/**get angular only*/
bool getAngularOnly();
/**get enable angular motor*/
bool getEnableAngularMotor();
/**get motor target velosity*/
float getMotorTargetVelosity();
/**get max motor impulse*/
float getMaxMotorImpulse();
/** access for UseFrameOffset*/
bool getUseFrameOffset();
/**set use frame offset*/
void setUseFrameOffset(bool frameOffsetOnOff);
CC_CONSTRUCTOR_ACCESS:
Physics3DHingeConstraint()
{
_type = ConstraintType::HINGE;
}
virtual ~Physics3DHingeConstraint(){}
};
/**
* It allows the body to rotate around x axis and translate along this axis.
* softness, restitution and damping for different cases
* DirLin - moving inside linear limits
* LimLin - hitting linear limit
* DirAng - moving inside angular limits
* LimAng - hitting angular limit
* OrthoLin, OrthoAng - against constraint axis
*/
class CC_DLL Physics3DSliderConstraint : public Physics3DConstraint
{
public:
/**
* create slider constraint
* @param rbA rigid body A
* @param rbB rigid body B
* @param frameInA frame in A's local space
* @param frameInB frame in B's local space
* @param useLinearReferenceFrameA use fixed frame A for linear limits
*/
static Physics3DSliderConstraint* create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& frameInA, const cocos2d::Mat4& frameInB ,bool useLinearReferenceFrameA);
/**get A's frame offset*/
cocos2d::Mat4 getFrameOffsetA() const;
/**get B's frame offset*/
cocos2d::Mat4 getFrameOffsetB() const;
/**get lower linear limit*/
float getLowerLinLimit();
/**set lower linear limit*/
void setLowerLinLimit(float lowerLimit);
/**get upper linear limit*/
float getUpperLinLimit();
/**set upper linear limit*/
void setUpperLinLimit(float upperLimit);
/**get lower angular limit*/
float getLowerAngLimit();
/**set lower angualr limit*/
void setLowerAngLimit(float lowerLimit);
/**get upper anglular limit*/
float getUpperAngLimit();
/**set upper anglular limit*/
void setUpperAngLimit(float upperLimit);
/**use A's frame as linear refference*/
bool getUseLinearReferenceFrameA();
float getSoftnessDirLin();
float getRestitutionDirLin();
float getDampingDirLin();
float getSoftnessDirAng();
float getRestitutionDirAng();
float getDampingDirAng();
float getSoftnessLimLin();
float getRestitutionLimLin();
float getDampingLimLin();
float getSoftnessLimAng();
float getRestitutionLimAng();
float getDampingLimAng();
float getSoftnessOrthoLin();
float getRestitutionOrthoLin();
float getDampingOrthoLin();
float getSoftnessOrthoAng();
float getRestitutionOrthoAng();
float getDampingOrthoAng();
void setSoftnessDirLin(float softnessDirLin);
void setRestitutionDirLin(float restitutionDirLin);
void setDampingDirLin(float dampingDirLin);
void setSoftnessDirAng(float softnessDirAng);
void setRestitutionDirAng(float restitutionDirAng);
void setDampingDirAng(float dampingDirAng);
void setSoftnessLimLin(float softnessLimLin);
void setRestitutionLimLin(float restitutionLimLin);
void setDampingLimLin(float dampingLimLin);
void setSoftnessLimAng(float softnessLimAng);
void setRestitutionLimAng(float restitutionLimAng);
void setDampingLimAng(float dampingLimAng);
void setSoftnessOrthoLin(float softnessOrthoLin);
void setRestitutionOrthoLin(float restitutionOrthoLin);
void setDampingOrthoLin(float dampingOrthoLin);
void setSoftnessOrthoAng(float softnessOrthoAng);
void setRestitutionOrthoAng(float restitutionOrthoAng);
void setDampingOrthoAng(float dampingOrthoAng);
void setPoweredLinMotor(bool onOff);
bool getPoweredLinMotor();
void setTargetLinMotorVelocity(float targetLinMotorVelocity);
float getTargetLinMotorVelocity();
void setMaxLinMotorForce(float maxLinMotorForce);
float getMaxLinMotorForce();
void setPoweredAngMotor(bool onOff);
bool getPoweredAngMotor();
void setTargetAngMotorVelocity(float targetAngMotorVelocity);
float getTargetAngMotorVelocity();
void setMaxAngMotorForce(float maxAngMotorForce);
float getMaxAngMotorForce();
float getLinearPos() const;
float getAngularPos() const;
/** access for UseFrameOffset*/
bool getUseFrameOffset();
/**set use frame offset*/
void setUseFrameOffset(bool frameOffsetOnOff);
/**set frames for rigid body A and B*/
void setFrames(const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB);
CC_CONSTRUCTOR_ACCESS:
Physics3DSliderConstraint()
{
_type = ConstraintType::SLIDER;
}
virtual ~Physics3DSliderConstraint(){}
};
/**
* It is a special point to point constraint that adds cone and twist axis limits. The x-axis serves as twist axis.
*/
class CC_DLL Physics3DConeTwistConstraint : public Physics3DConstraint
{
public:
/**
* create cone twist constraint
* rbA rigid body A
* frameA A's local frame
*/
static Physics3DConeTwistConstraint* create(Physics3DRigidBody* rbA, const cocos2d::Mat4& frameA);
/**
* create cone twist constraint
* rbA rigid body A
* rbB rigid body B
* frameA rigid body A's local frame
* frameB rigid body B's local frame
*/
static Physics3DConeTwistConstraint* create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB);
/**
* set limits
* @param swingSpan1 swing span1
* @param swingSpan2 swing span2
* @param twistSpan twist span
* @param softness 0->1, recommend ~0.8->1. Describes % of limits where movement is free. Beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached.
* @param biasFactor 0->1?, recommend 0.3 +/-0.3 or so. Strength with which constraint resists zeroth order (angular, not angular velocity) limit violation.
* @param relaxationFactor 0->1, recommend to stay near 1. the lower the value, the less the constraint will fight velocities which violate the angular limits.
*/
void setLimit(float swingSpan1,float swingSpan2,float twistSpan, float softness = 1.f, float biasFactor = 0.3f, float relaxationFactor = 1.0f);
/**get A's frame*/
cocos2d::Mat4 getAFrame();
/**get B's frame*/
cocos2d::Mat4 getBFrame();
/**get swing span1*/
float getSwingSpan1();
/**get swing span2*/
float getSwingSpan2();
/**get twist span*/
float getTwistSpan();
/**get twist angle*/
float getTwistAngle();
/**set damping*/
void setDamping(float damping);
/**enable motor*/
void enableMotor(bool b);
/**set max motor impulse*/
void setMaxMotorImpulse(float maxMotorImpulse);
/**set max motor impulse normalize*/
void setMaxMotorImpulseNormalized(float maxMotorImpulse);
/**get fix thresh*/
float getFixThresh();
/**set fix thresh*/
void setFixThresh(float fixThresh);
/**
* setMotorTarget
* @param q the desired rotation of bodyA wrt bodyB. Note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability), also don't forget to enableMotor()
*/
void setMotorTarget(const btQuaternion &q);
/** setMotorTarget, q is the desired rotation of frameA wrt frameB in constraint space*/
void setMotorTargetInConstraintSpace(const btQuaternion &q);
/**get point for angle*/
cocos2d::Vec3 GetPointForAngle(float fAngleInRadians, float fLength) const;
/**set A and B's frame*/
virtual void setFrames(const cocos2d::Mat4& frameA, const cocos2d::Mat4& frameB);
/**get A's frame offset*/
cocos2d::Mat4 getFrameOffsetA() const;
/**get B's frame offset*/
cocos2d::Mat4 getFrameOffsetB() const;
CC_CONSTRUCTOR_ACCESS:
Physics3DConeTwistConstraint()
{
_type = ConstraintType::CONE_TWIST;
}
virtual ~Physics3DConeTwistConstraint(){}
};
/**
* This generic constraint can emulate a variety of standard constraints, by configuring each of the 6 degrees of freedom (dof).
* The first 3 dof axis are linear axis, which represent translation of rigidbodies, and the latter 3 dof axis represent the angular motion.
* Each axis can be either locked, free or limited. All axis are locked by default.
* For each axis:
* Lowerlimit == Upperlimit -> axis is locked.
* Lowerlimit > Upperlimit -> axis is free
* Lowerlimit < Upperlimit -> axis it limited in that range
*/
class CC_DLL Physics3D6DofConstraint : public Physics3DConstraint
{
public:
/**
* create 6 dof constraint
* @param rbA rigid body A
* @param rbB rigid body B
* @param frameInA frame in A's local space
* @param frameInB frame in B's local space
* @param useLinearReferenceFrameA use fixed frame A for linear limits
*/
static Physics3D6DofConstraint* create(Physics3DRigidBody* rbA, Physics3DRigidBody* rbB, const cocos2d::Mat4& frameInA, const cocos2d::Mat4& frameInB, bool useLinearReferenceFrameA);
/**
* create 6 dof constraint
* @param rbB rigid body B
* @param frameInB frame in B's local space
* @param useLinearReferenceFrameB use fixed frame B for linear limits
*/
static Physics3D6DofConstraint* create(Physics3DRigidBody* rbB, const cocos2d::Mat4& frameInB, bool useLinearReferenceFrameB);
/**set linear lower limit*/
void setLinearLowerLimit(const cocos2d::Vec3& linearLower);
/**get linear lower limit*/
cocos2d::Vec3 getLinearLowerLimit();
/**set linear upper limit*/
void setLinearUpperLimit(const cocos2d::Vec3& linearUpper);
/**get linear upper limit*/
cocos2d::Vec3 getLinearUpperLimit();
/**set angular lower limit*/
void setAngularLowerLimit(const cocos2d::Vec3& angularLower);
/**get angular lower limit*/
cocos2d::Vec3 getAngularLowerLimit();
/**set angular upper limit*/
void setAngularUpperLimit(const cocos2d::Vec3& angularUpper);
/**get angular upper limit*/
cocos2d::Vec3 getAngularUpperLimit();
/**
* is limited?
* @param limitIndex first 3 are linear, next 3 are angular
*/
bool isLimited(int limitIndex);
/** access for UseFrameOffset*/
bool getUseFrameOffset();
/**set use frame offset*/
void setUseFrameOffset(bool frameOffsetOnOff);
CC_CONSTRUCTOR_ACCESS:
Physics3D6DofConstraint()
{
_type = ConstraintType::SIX_DOF;
}
virtual ~Physics3D6DofConstraint(){}
};
// end of 3d group
/// @}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif // CC_USE_3D_PHYSICS
#endif // __PHYSICS_3D_CONSTRAINT_H__

View File

@ -0,0 +1,203 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#include "base/CCConfiguration.h"
#include "base/ccMacros.h"
#include "base/CCDirector.h"
#include "renderer/CCGLProgram.h"
#include "renderer/CCRenderer.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCGLProgramCache.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
void Physics3DDebugDrawer::drawLine( const btVector3& from,const btVector3& to,const btVector3& color )
{
int count = 2;
ensureCapacity(count);
Vec3 col = convertbtVector3ToVec3(color);
V3F_V4F *lines = (V3F_V4F *)(_buffer + _bufferCount);
lines[0].vertex = convertbtVector3ToVec3(from);
lines[0].color = Vec4(col.x, col.y, col.z, 1.0f);
lines[1].vertex = convertbtVector3ToVec3(to);
lines[1].color = Vec4(col.x, col.y, col.z, 1.0f);
_bufferCount += count;
_dirty = true;
}
void Physics3DDebugDrawer::drawContactPoint( const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color )
{
drawLine(PointOnB, PointOnB + normalOnB * distance, color);
}
void Physics3DDebugDrawer::reportErrorWarning( const char* warningString )
{
CCLOG("%s", warningString);
}
void Physics3DDebugDrawer::draw3dText( const btVector3& location,const char* textString )
{
}
void Physics3DDebugDrawer::setDebugMode( int debugMode )
{
_debugMode = debugMode;
}
int Physics3DDebugDrawer::getDebugMode() const
{
return _debugMode;
}
void Physics3DDebugDrawer::draw( Renderer *renderer)
{
_customCommand.init(0, Mat4::IDENTITY, 0);
_customCommand.func = CC_CALLBACK_0(Physics3DDebugDrawer::drawImplementation, this, Mat4::IDENTITY, 0);
renderer->addCommand(&_customCommand);
}
Physics3DDebugDrawer::Physics3DDebugDrawer()
: _vao(0)
, _vbo(0)
, _bufferCapacity(0)
, _bufferCount(0)
, _buffer(nullptr)
, _blendFunc(BlendFunc::DISABLE)
, _dirty(true)
, _debugMode(DBG_DrawWireframe | DBG_DrawConstraints | DBG_DrawConstraintLimits)
{
init();
}
Physics3DDebugDrawer::~Physics3DDebugDrawer()
{
free(_buffer);
if (_vao)
{
glDeleteVertexArrays(1, &_vao);
_vao = 0;
}
if (_vbo)
{
glDeleteBuffers(1, &_vbo);
_vbo = 0;
}
}
void Physics3DDebugDrawer::ensureCapacity( int count )
{
CCASSERT(count>=0, "capacity must be >= 0");
if(_bufferCount + count > _bufferCapacity)
{
_bufferCapacity += MAX(_bufferCapacity, count);
_buffer = (V3F_V4F*)realloc(_buffer, _bufferCapacity*sizeof(V3F_V4F));
}
}
void Physics3DDebugDrawer::drawImplementation( const Mat4 &transform, uint32_t flags )
{
_program->use();
_program->setUniformsForBuiltins(transform);
glEnable(GL_DEPTH_TEST);
GL::blendFunc(_blendFunc.src, _blendFunc.dst);
if (_dirty)
{
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(V3F_V4F) * _bufferCapacity, _buffer, GL_STREAM_DRAW);
_dirty = false;
}
if (Configuration::getInstance()->supportsShareableVAO())
{
GL::bindVAO(_vao);
}
else
{
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
// vertex
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_V4F), (GLvoid *)offsetof(V3F_V4F, vertex));
// color
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(V3F_V4F), (GLvoid *)offsetof(V3F_V4F, color));
}
glDrawArrays(GL_LINES, 0, _bufferCount);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCount);
glDisable(GL_DEPTH_TEST);
}
void Physics3DDebugDrawer::init()
{
_program = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_COLOR);
ensureCapacity(512);
if (Configuration::getInstance()->supportsShareableVAO())
{
glGenVertexArrays(1, &_vao);
GL::bindVAO(_vao);
}
glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(V3F_V4F)* _bufferCapacity, _buffer, GL_STREAM_DRAW);
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_V4F), (GLvoid *)offsetof(V3F_V4F, vertex));
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR);
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(V3F_V4F), (GLvoid *)offsetof(V3F_V4F, color));
glBindBuffer(GL_ARRAY_BUFFER, 0);
if (Configuration::getInstance()->supportsShareableVAO())
{
GL::bindVAO(0);
}
}
void Physics3DDebugDrawer::clear()
{
_bufferCount = 0;
}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS

View File

@ -0,0 +1,108 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_3D_VIEWER_H__
#define __PHYSICS_3D_VIEWER_H__
#include "math/CCMath.h"
#include "base/CCRef.h"
#include "base/ccTypes.h"
#include "base/ccConfig.h"
#include "renderer/CCCustomCommand.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
#include "renderer/CCCustomCommand.h"
#include "bullet/LinearMath/btIDebugDraw.h"
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
class GLProgram;
class Renderer;
/** @brief Physics3DDebugDrawer: debug draw the physics object, used by Physics3DWorld */
class Physics3DDebugDrawer : public btIDebugDraw
{
public:
Physics3DDebugDrawer();
virtual ~Physics3DDebugDrawer();
void draw(cocos2d::Renderer *renderer);
// override function
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color) override;
virtual void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color) override;
virtual void reportErrorWarning(const char* warningString) override;
virtual void draw3dText(const btVector3& location,const char* textString) override;
virtual void setDebugMode(int debugMode) override;
virtual int getDebugMode() const override;
void clear();
protected:
void init();
void ensureCapacity(int count);
void drawImplementation(const cocos2d::Mat4 &transform, uint32_t flags);
protected:
struct V3F_V4F
{
cocos2d::Vec3 vertex;
cocos2d::Vec4 color;
};
GLuint _vao;
GLuint _vbo;
int _bufferCapacity;
GLsizei _bufferCount;
V3F_V4F* _buffer;
cocos2d::BlendFunc _blendFunc;
cocos2d::CustomCommand _customCommand;
cocos2d::GLProgram *_program;
bool _dirty;
int _debugMode;
};
// end of 3d group
/// @}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif // CC_USE_3D_PHYSICS
#endif // __PHYSICS_3D_VIEWER_H__

View File

@ -0,0 +1,377 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#include "base/ccUTF8.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
#include "bullet/btBulletCollisionCommon.h"
#include "bullet/btBulletDynamicsCommon.h"
NS_CC_BEGIN
Physics3DRigidBody::Physics3DRigidBody()
: _btRigidBody(nullptr)
, _physics3DShape(nullptr)
{
}
Physics3DRigidBody::~Physics3DRigidBody()
{
if (_physicsWorld)
{
for(auto constraint : _constraintList)
{
_physicsWorld->removePhysics3DConstraint(constraint);
}
_constraintList.clear();
}
auto ms = _btRigidBody->getMotionState();
CC_SAFE_DELETE(ms);
CC_SAFE_DELETE(_btRigidBody);
CC_SAFE_RELEASE(_physics3DShape);
}
Physics3DRigidBody* Physics3DRigidBody::create(Physics3DRigidBodyDes* info)
{
auto ret = new (std::nothrow) Physics3DRigidBody();
if (ret->init(info))
{
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return ret;
}
bool Physics3DRigidBody::init(Physics3DRigidBodyDes* info)
{
if (info->shape == nullptr)
return false;
btScalar mass = info->mass;
auto shape = info->shape->getbtShape();
auto localInertia = convertVec3TobtVector3(info->localInertia);
if (mass != 0.f)
{
shape->calculateLocalInertia(mass,localInertia);
}
auto transform = convertMat4TobtTransform(info->originalTransform);
btDefaultMotionState* myMotionState = new btDefaultMotionState(transform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
_btRigidBody = new btRigidBody(rbInfo);
_type = Physics3DObject::PhysicsObjType::RIGID_BODY;
_physics3DShape = info->shape;
_physics3DShape->retain();
if (info->disableSleep)
_btRigidBody->setActivationState(DISABLE_DEACTIVATION);
return true;
}
void Physics3DRigidBody::setActive(bool active)
{
if (_btRigidBody)
{
_btRigidBody->setActivationState(active ? ACTIVE_TAG : WANTS_DEACTIVATION);
}
}
void Physics3DRigidBody::applyForce( const cocos2d::Vec3& force, const cocos2d::Vec3& rel_pos )
{
_btRigidBody->applyForce(convertVec3TobtVector3(force), convertVec3TobtVector3(rel_pos));
}
void Physics3DRigidBody::setLinearVelocity( const cocos2d::Vec3& lin_vel )
{
_btRigidBody->setLinearVelocity(convertVec3TobtVector3(lin_vel));
}
void Physics3DRigidBody::applyCentralForce( const cocos2d::Vec3& force )
{
_btRigidBody->applyCentralForce(convertVec3TobtVector3(force));
}
void Physics3DRigidBody::applyCentralImpulse( const cocos2d::Vec3& impulse )
{
_btRigidBody->applyCentralImpulse(convertVec3TobtVector3(impulse));
}
void Physics3DRigidBody::applyTorque( const cocos2d::Vec3& torque )
{
_btRigidBody->applyTorque(convertVec3TobtVector3(torque));
}
void Physics3DRigidBody::applyTorqueImpulse( const cocos2d::Vec3& torque )
{
_btRigidBody->applyTorqueImpulse(convertVec3TobtVector3(torque));
}
void Physics3DRigidBody::applyImpulse( const cocos2d::Vec3& impulse, const cocos2d::Vec3& rel_pos )
{
_btRigidBody->applyImpulse(convertVec3TobtVector3(impulse), convertVec3TobtVector3(rel_pos));
}
void Physics3DRigidBody::applyDamping( float timeStep )
{
_btRigidBody->applyDamping(timeStep);
}
cocos2d::Vec3 Physics3DRigidBody::getLinearVelocity() const
{
return convertbtVector3ToVec3(_btRigidBody->getLinearVelocity());
}
void Physics3DRigidBody::setLinearFactor( const cocos2d::Vec3& linearFactor )
{
_btRigidBody->setLinearFactor(convertVec3TobtVector3(linearFactor));
}
cocos2d::Vec3 Physics3DRigidBody::getLinearFactor() const
{
return convertbtVector3ToVec3(_btRigidBody->getLinearFactor());
}
void Physics3DRigidBody::setAngularFactor( const cocos2d::Vec3& angFac )
{
_btRigidBody->setAngularFactor(convertVec3TobtVector3(angFac));
}
void Physics3DRigidBody::setAngularFactor( float angFac )
{
_btRigidBody->setAngularFactor(angFac);
}
cocos2d::Vec3 Physics3DRigidBody::getAngularFactor() const
{
return convertbtVector3ToVec3(_btRigidBody->getAngularFactor());
}
void Physics3DRigidBody::setAngularVelocity( const cocos2d::Vec3& ang_vel )
{
_btRigidBody->setAngularVelocity(convertVec3TobtVector3(ang_vel));
}
cocos2d::Vec3 Physics3DRigidBody::getAngularVelocity() const
{
return convertbtVector3ToVec3(_btRigidBody->getAngularVelocity());
}
void Physics3DRigidBody::setCenterOfMassTransform( const cocos2d::Mat4& xform )
{
_btRigidBody->setCenterOfMassTransform(convertMat4TobtTransform(xform));
}
cocos2d::Mat4 Physics3DRigidBody::getCenterOfMassTransform() const
{
return convertbtTransformToMat4(_btRigidBody->getCenterOfMassTransform());
}
void Physics3DRigidBody::setDamping( float lin_damping, float ang_damping )
{
_btRigidBody->setDamping(lin_damping, ang_damping);
}
float Physics3DRigidBody::getLinearDamping() const
{
return _btRigidBody->getLinearDamping();
}
float Physics3DRigidBody::getAngularDamping() const
{
return _btRigidBody->getAngularDamping();
}
void Physics3DRigidBody::setGravity( const cocos2d::Vec3& acceleration )
{
_btRigidBody->setGravity(convertVec3TobtVector3(acceleration));
}
cocos2d::Vec3 Physics3DRigidBody::getGravity() const
{
return convertbtVector3ToVec3(_btRigidBody->getGravity());
}
void Physics3DRigidBody::setInvInertiaDiagLocal( const cocos2d::Vec3& diagInvInertia )
{
_btRigidBody->setInvInertiaDiagLocal(convertVec3TobtVector3(diagInvInertia));
}
cocos2d::Vec3 Physics3DRigidBody::getInvInertiaDiagLocal() const
{
return convertbtVector3ToVec3(_btRigidBody->getInvInertiaDiagLocal());
}
void Physics3DRigidBody::setMassProps( float mass, const cocos2d::Vec3& inertia )
{
_btRigidBody->setMassProps(mass, convertVec3TobtVector3(inertia));
}
float Physics3DRigidBody::getInvMass() const
{
return _btRigidBody->getInvMass();
}
cocos2d::Vec3 Physics3DRigidBody::getTotalForce() const
{
return convertbtVector3ToVec3(_btRigidBody->getTotalForce());
}
cocos2d::Vec3 Physics3DRigidBody::getTotalTorque() const
{
return convertbtVector3ToVec3(_btRigidBody->getTotalTorque());
}
void Physics3DRigidBody::setRestitution( float rest )
{
_btRigidBody->setRestitution(rest);
}
float Physics3DRigidBody::getRestitution() const
{
return _btRigidBody->getRestitution();
}
void Physics3DRigidBody::setFriction( float frict )
{
_btRigidBody->setFriction(frict);
}
float Physics3DRigidBody::getFriction() const
{
return _btRigidBody->getFriction();
}
void Physics3DRigidBody::setRollingFriction( float frict )
{
_btRigidBody->setRollingFriction(frict);
}
float Physics3DRigidBody::getRollingFriction() const
{
return _btRigidBody->getRollingFriction();
}
void Physics3DRigidBody::setHitFraction( float hitFraction )
{
_btRigidBody->setHitFraction(hitFraction);
}
float Physics3DRigidBody::getHitFraction() const
{
return _btRigidBody->getHitFraction();
}
void Physics3DRigidBody::setCcdMotionThreshold( float ccdMotionThreshold )
{
_btRigidBody->setCcdMotionThreshold(ccdMotionThreshold);
}
float Physics3DRigidBody::getCcdMotionThreshold() const
{
return _btRigidBody->getCcdMotionThreshold();
}
void Physics3DRigidBody::setCcdSweptSphereRadius( float radius )
{
_btRigidBody->setCcdSweptSphereRadius(radius);
}
float Physics3DRigidBody::getCcdSweptSphereRadius() const
{
return _btRigidBody->getCcdSweptSphereRadius();
}
void Physics3DRigidBody::addConstraint( Physics3DConstraint *constraint )
{
auto iter = std::find(_constraintList.begin(), _constraintList.end(), constraint);
if (iter == _constraintList.end()){
_constraintList.push_back(constraint);
constraint->retain();
}
}
void Physics3DRigidBody::removeConstraint( Physics3DConstraint *constraint )
{
auto iter = std::find(_constraintList.begin(), _constraintList.end(), constraint);
if (iter != _constraintList.end()){
constraint->release();
_constraintList.erase(iter);
}
}
void Physics3DRigidBody::removeConstraint( unsigned int idx )
{
CCASSERT(idx < _constraintList.size(), "idx < _constraintList.size()");
removeConstraint(_constraintList[idx]);
}
Physics3DConstraint* Physics3DRigidBody::getConstraint( unsigned int idx ) const
{
CCASSERT(idx < _constraintList.size(), "idx < _constraintList.size()");
return _constraintList[idx];
}
unsigned int Physics3DRigidBody::getConstraintCount() const
{
return (unsigned int)_constraintList.size();
}
cocos2d::Mat4 Physics3DRigidBody::getWorldTransform() const
{
const auto& transform = _btRigidBody->getWorldTransform();
return convertbtTransformToMat4(transform);
}
void Physics3DRigidBody::setKinematic(bool kinematic)
{
if (kinematic)
{
_btRigidBody->setCollisionFlags(_btRigidBody->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);
_btRigidBody->setActivationState(DISABLE_DEACTIVATION);
}
else
{
_btRigidBody->setCollisionFlags(_btRigidBody->getCollisionFlags() & ~btCollisionObject::CF_KINEMATIC_OBJECT);
_btRigidBody->setActivationState(ACTIVE_TAG);
}
}
bool Physics3DRigidBody::isKinematic() const
{
if (_btRigidBody)
return _btRigidBody->isKinematicObject();
return false;
}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif // CC_USE_3D_PHYSICS

View File

@ -0,0 +1,370 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_3D_OBJECT_H__
#define __PHYSICS_3D_OBJECT_H__
#include "math/CCMath.h"
#include "base/CCRef.h"
#include "base/ccConfig.h"
#include <vector>
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
class btCollisionShape;
class btRigidBody;
class btPersistentManifold;
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
class Physics3DShape;
class Physics3DWorld;
class Physics3DConstraint;
class Physics3DObject;
/**
* @brief The collision information of Physics3DObject.
*/
struct CC_DLL Physics3DCollisionInfo
{
struct CollisionPoint
{
Vec3 localPositionOnA;
Vec3 worldPositionOnA;
Vec3 localPositionOnB;
Vec3 worldPositionOnB;
Vec3 worldNormalOnB;
};
Physics3DObject *objA;
Physics3DObject *objB;
std::vector<CollisionPoint> collisionPointList;
};
/**
* @brief Inherit from Ref, base class
*/
class CC_DLL Physics3DObject : public Ref
{
public:
typedef std::function<void(const Physics3DCollisionInfo &ci)> CollisionCallbackFunc;
enum class PhysicsObjType
{
UNKNOWN = 0,
RIGID_BODY,
};
/** Get the Physics3DObject Type. */
virtual PhysicsObjType getObjType() const { return _type; }
/** Set the user data. */
void setUserData(void* userData) { _userData = userData; }
/** Get the user data. */
void* getUserData() const { return _userData; }
/** Internal method. Set the pointer of Physics3DWorld. */
void setPhysicsWorld(Physics3DWorld* world) { _physicsWorld = world; };
/** Get the pointer of Physics3DWorld. */
Physics3DWorld* getPhysicsWorld() const { return _physicsWorld; }
/** Get the world matrix of Physics3DObject. */
virtual cocos2d::Mat4 getWorldTransform() const = 0;
/** Set the collision callback function. */
void setCollisionCallback(const CollisionCallbackFunc &func) { _collisionCallbackFunc = func; };
/** Get the collision callback function. */
const CollisionCallbackFunc& getCollisionCallback() const { return _collisionCallbackFunc; }
/** Check has collision callback function. */
bool needCollisionCallback() { return _collisionCallbackFunc != nullptr; };
/** Set the mask of Physics3DObject. */
void setMask(unsigned int mask) { _mask = mask; };
/** Get the mask of Physics3DObject. */
unsigned int getMask() const { return _mask; };
CC_CONSTRUCTOR_ACCESS:
Physics3DObject()
: _type(PhysicsObjType::UNKNOWN)
, _userData(nullptr)
, _isEnabled(true)
, _physicsWorld(nullptr)
, _mask(-1)
{
}
virtual ~Physics3DObject(){}
protected:
bool _isEnabled;
PhysicsObjType _type;
void* _userData;
Physics3DWorld* _physicsWorld;
CollisionCallbackFunc _collisionCallbackFunc;
unsigned int _mask;
};
/**
* @brief The description of Physics3DRigidBody.
*/
struct CC_DLL Physics3DRigidBodyDes
{
float mass; //Note: mass equals zero means static, default 0
cocos2d::Vec3 localInertia; //default (0, 0, 0)
Physics3DShape* shape;
cocos2d::Mat4 originalTransform;
bool disableSleep; //it is always active if disabled
Physics3DRigidBodyDes()
: mass(0.f)
, localInertia(0.f, 0.f, 0.f)
, shape(nullptr)
, disableSleep(false)
{
}
};
/**
* @brief Inherit from Physics3DObject, the main class for rigid body objects
*/
class CC_DLL Physics3DRigidBody : public Physics3DObject
{
friend class Physics3DWorld;
public:
/**
* Creates a Physics3DRigidBody with Physics3DRigidBody.
*
* @return An autoreleased Physics3DRigidBody object.
*/
static Physics3DRigidBody* create(Physics3DRigidBodyDes* info);
/** Get the pointer of btRigidBody. */
btRigidBody* getRigidBody() const { return _btRigidBody; }
/**
* Apply a force.
*
* @param force the value of the force
* @param rel_pos the position of the force
*/
void applyForce(const cocos2d::Vec3& force, const cocos2d::Vec3& rel_pos);
/**
* Apply a central force.
*
* @param force the value of the force
*/
void applyCentralForce(const cocos2d::Vec3& force);
/**
* Apply a central impulse.
*
* @param impulse the value of the impulse
*/
void applyCentralImpulse(const cocos2d::Vec3& impulse);
/**
* Apply a torque.
*
* @param torque the value of the torque
*/
void applyTorque(const cocos2d::Vec3& torque);
/**
* Apply a torque impulse.
*
* @param torque the value of the torque
*/
void applyTorqueImpulse(const cocos2d::Vec3& torque);
/**
* Apply a impulse.
*
* @param impulse the value of the impulse
* @param rel_pos the position of the impulse
*/
void applyImpulse(const cocos2d::Vec3& impulse, const cocos2d::Vec3& rel_pos);
/** Damps the velocity, using the given linearDamping and angularDamping. */
void applyDamping(float timeStep);
/** Set the linear velocity. */
void setLinearVelocity(const cocos2d::Vec3& lin_vel);
/** Get the linear velocity. */
cocos2d::Vec3 getLinearVelocity() const;
/** Set the linear factor. */
void setLinearFactor(const cocos2d::Vec3& linearFactor);
/** Get the linear factor. */
cocos2d::Vec3 getLinearFactor() const;
/** Set the angular factor. */
void setAngularFactor(const cocos2d::Vec3& angFac);
/** Set the angular factor, use unified factor. */
void setAngularFactor(float angFac);
/** Get the angular factor. */
cocos2d::Vec3 getAngularFactor() const;
/** Set the angular velocity. */
void setAngularVelocity(const cocos2d::Vec3& ang_vel);
/** Get the angular velocity. */
cocos2d::Vec3 getAngularVelocity() const;
/** Set the center of mass. */
void setCenterOfMassTransform(const cocos2d::Mat4& xform);
/** Get the center of mass. */
cocos2d::Mat4 getCenterOfMassTransform() const;
/** Set linear damping and angular damping. */
void setDamping(float lin_damping, float ang_damping);
/** Get linear damping. */
float getLinearDamping() const;
/** Get angular damping. */
float getAngularDamping() const;
/** Set the acceleration. */
void setGravity(const cocos2d::Vec3& acceleration);
/** Get the acceleration. */
cocos2d::Vec3 getGravity() const;
/** Set the inverse of local inertia. */
void setInvInertiaDiagLocal(const cocos2d::Vec3& diagInvInertia);
/** Get the inverse of local inertia. */
cocos2d::Vec3 getInvInertiaDiagLocal() const;
/** Set mass and inertia. */
void setMassProps(float mass, const cocos2d::Vec3& inertia);
/** Get inverse of mass. */
float getInvMass() const;
/** Get total force. */
cocos2d::Vec3 getTotalForce() const;
/** Get total torque. */
cocos2d::Vec3 getTotalTorque() const;
/** Set restitution. */
void setRestitution(float rest);
/** Get restitution. */
float getRestitution() const;
/** Set friction. */
void setFriction(float frict);
/** Get friction. */
float getFriction() const;
/** Set rolling friction. */
void setRollingFriction(float frict);
/** Get rolling friction. */
float getRollingFriction() const;
/** Set hit friction. */
void setHitFraction(float hitFraction);
/** Get hit friction. */
float getHitFraction() const;
/** Set motion threshold, don't do continuous collision detection if the motion (in one step) is less then ccdMotionThreshold */
void setCcdMotionThreshold(float ccdMotionThreshold);
/** Get motion threshold. */
float getCcdMotionThreshold() const;
/** Set swept sphere radius. */
void setCcdSweptSphereRadius(float radius);
/** Get swept sphere radius. */
float getCcdSweptSphereRadius() const;
/** Set kinematic object. */
void setKinematic(bool kinematic);
/** Check rigid body is kinematic object. */
bool isKinematic() const;
/** override. */
virtual cocos2d::Mat4 getWorldTransform() const override;
/** Get constraint by index. */
Physics3DConstraint* getConstraint(unsigned int idx) const;
/** Get the total number of constraints. */
unsigned int getConstraintCount() const;
/** Active or inactive. */
void setActive(bool active);
CC_CONSTRUCTOR_ACCESS:
Physics3DRigidBody();
virtual ~Physics3DRigidBody();
bool init(Physics3DRigidBodyDes* info);
void addConstraint(Physics3DConstraint *constraint);
void removeConstraint(Physics3DConstraint *constraint);
void removeConstraint(unsigned int idx);
protected:
btRigidBody* _btRigidBody;
Physics3DShape *_physics3DShape;
std::vector<Physics3DConstraint *> _constraintList;
};
// end of 3d group
/// @}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS
#endif // __PHYSICS_3D_OBJECT_H__

View File

@ -0,0 +1,208 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
#include "bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
NS_CC_BEGIN
Physics3DShape::ShapeType Physics3DShape::getShapeType() const
{
return _shapeType;
}
Physics3DShape::Physics3DShape()
: _shapeType(ShapeType::UNKNOWN)
{
#if (CC_ENABLE_BULLET_INTEGRATION)
_btShape = nullptr;
_heightfieldData = nullptr;
#endif
}
Physics3DShape::~Physics3DShape()
{
#if (CC_ENABLE_BULLET_INTEGRATION)
CC_SAFE_DELETE(_btShape);
CC_SAFE_DELETE_ARRAY(_heightfieldData);
for (auto iter : _compoundChildShapes){
CC_SAFE_RELEASE(iter);
}
_compoundChildShapes.clear();
#endif
}
Physics3DShape* Physics3DShape::createBox(const cocos2d::Vec3& extent)
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initBox(extent);
shape->autorelease();
return shape;
}
Physics3DShape* Physics3DShape::createSphere(float radius)
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initSphere(radius);
shape->autorelease();
return shape;
}
Physics3DShape* Physics3DShape::createCylinder(float radius, float height)
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initCylinder(radius, height);
shape->autorelease();
return shape;
}
Physics3DShape* Physics3DShape::createCapsule(float radius, float height)
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initCapsule(radius, height);
shape->autorelease();
return shape;
}
Physics3DShape* Physics3DShape::createConvexHull( const cocos2d::Vec3 *points, int numPoints )
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initConvexHull(points, numPoints);
shape->autorelease();
return shape;
}
Physics3DShape* Physics3DShape::createMesh( const cocos2d::Vec3 *triangles, int numTriangles )
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initMesh(triangles, numTriangles);
shape->autorelease();
return shape;
}
Physics3DShape* Physics3DShape::createHeightfield( int heightStickWidth,int heightStickLength
, const void* heightfieldData, float heightScale
, float minHeight, float maxHeight
, bool useFloatDatam, bool flipQuadEdges
, bool useDiamondSubdivision)
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initHeightfield(heightStickWidth, heightStickLength, heightfieldData, heightScale, minHeight, maxHeight, useFloatDatam, flipQuadEdges, useDiamondSubdivision);
shape->autorelease();
return shape;
}
Physics3DShape* Physics3DShape::createCompoundShape( const std::vector<std::pair<Physics3DShape *, Mat4>> &shapes )
{
auto shape = new (std::nothrow) Physics3DShape();
shape->initCompoundShape(shapes);
shape->autorelease();
return shape;
}
bool Physics3DShape::initBox(const cocos2d::Vec3& ext)
{
_shapeType = ShapeType::BOX;
_btShape = new btBoxShape(convertVec3TobtVector3(ext * 0.5f));
return true;
}
bool Physics3DShape::initSphere(float radius)
{
_shapeType = ShapeType::SPHERE;
_btShape = new btSphereShape(radius);
return true;
}
bool Physics3DShape::initCylinder(float radius, float height)
{
_shapeType = ShapeType::CYLINDER;
_btShape = new btCylinderShape(convertVec3TobtVector3(cocos2d::Vec3(radius, height, radius) * 0.5f));
return true;
}
bool Physics3DShape::initCapsule(float radius, float height)
{
_shapeType = ShapeType::CAPSULE;
_btShape = new btCapsuleShape(radius, height);
return true;
}
bool Physics3DShape::initConvexHull( const cocos2d::Vec3 *points, int numPoints )
{
_shapeType = ShapeType::CONVEX;
_btShape = new btConvexHullShape((btScalar *)points, numPoints, sizeof(cocos2d::Vec3));
return true;
}
bool Physics3DShape::initMesh( const cocos2d::Vec3 *triangles, int numTriangles )
{
_shapeType = ShapeType::MESH;
auto mesh = new btTriangleMesh(false);
for (int i = 0; i < numTriangles * 3; i += 3){
mesh->addTriangle(convertVec3TobtVector3(triangles[i]), convertVec3TobtVector3(triangles[i + 1]), convertVec3TobtVector3(triangles[i + 2]));
}
_btShape = new btBvhTriangleMeshShape(mesh, true);
return true;
}
bool Physics3DShape::initHeightfield( int heightStickWidth,int heightStickLength
, const void* heightfieldData, float heightScale
, float minHeight, float maxHeight
, bool useFloatDatam, bool flipQuadEdges
, bool useDiamondSubdivision)
{
_shapeType = ShapeType::HEIGHT_FIELD;
PHY_ScalarType type = PHY_UCHAR;
unsigned int dataSizeInByte = heightStickWidth * heightStickLength;
if (useFloatDatam){
type = PHY_FLOAT;
dataSizeInByte *= sizeof(float);
}
_heightfieldData = new unsigned char[dataSizeInByte];
memcpy(_heightfieldData, heightfieldData, dataSizeInByte);
auto heightfield = new btHeightfieldTerrainShape(heightStickWidth, heightStickLength, _heightfieldData, heightScale, minHeight, maxHeight, 1, type, flipQuadEdges);
heightfield->setUseDiamondSubdivision(useDiamondSubdivision);
_btShape = heightfield;
return true;
}
bool Physics3DShape::initCompoundShape( const std::vector<std::pair<Physics3DShape *, Mat4>> &shapes )
{
_shapeType = ShapeType::COMPOUND;
auto compound = new btCompoundShape;
for (auto iter : shapes){
compound->addChildShape(convertMat4TobtTransform(iter.second), iter.first->getbtShape());
CC_SAFE_RETAIN(iter.first);
_compoundChildShapes.push_back(iter.first);
}
_btShape = compound;
return true;
}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif // CC_USE_3D_PHYSICS

View File

@ -0,0 +1,169 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_3D_SHAPE_H__
#define __PHYSICS_3D_SHAPE_H__
#include "base/CCRef.h"
#include "base/ccConfig.h"
#include "math/CCMath.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
class btCollisionShape;
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
/**
* @brief Create a physical shape(box, sphere, cylinder, capsule, convexhull, mesh and heightfield)
*/
class CC_DLL Physics3DShape : public Ref
{
public:
enum class ShapeType
{
UNKNOWN = 0,
BOX,
SPHERE,
CYLINDER,
CAPSULE,
CONVEX,
MESH,
HEIGHT_FIELD,
COMPOUND
};
/**
* get shape type
*/
virtual ShapeType getShapeType() const;
/**
* create box shape
* @param extent The extent of sphere.
*/
static Physics3DShape* createBox(const cocos2d::Vec3& extent);
/**
* create sphere shape
* @param radius The radius of sphere.
*/
static Physics3DShape* createSphere(float radius);
/**
* create cylinder shape
* @param radius The radius of cylinder.
* @param height The height.
*/
static Physics3DShape* createCylinder(float radius, float height);
/**
* create capsule shape
* @param radius The radius of casule.
* @param height The height (cylinder part).
*/
static Physics3DShape* createCapsule(float radius, float height);
/**
* create convex hull
* @param points The vertices of convex hull
* @param numPoints The number of vertices.
*/
static Physics3DShape* createConvexHull(const cocos2d::Vec3 *points, int numPoints);
/**
* create mesh
* @param triangles The pointer of triangle list
* @param numTriangles The number of triangles.
*/
static Physics3DShape* createMesh(const cocos2d::Vec3 *triangles, int numTriangles);
/**
* create heightfield
* @param heightStickWidth The Width of heightfield
* @param heightStickLength The Length of heightfield.
* @param heightfieldData The Data of heightfield.
* @param minHeight The minHeight of heightfield.
* @param maxHeight The maxHeight of heightfield.
* @param flipQuadEdges if flip QuadEdges
*/
static Physics3DShape* createHeightfield(int heightStickWidth,int heightStickLength
, const void* heightfieldData, float heightScale
, float minHeight, float maxHeight
, bool useFloatDatam, bool flipQuadEdges, bool useDiamondSubdivision = false);
/**
* create Compound Shape
* @param shapes The list of child shape
*/
static Physics3DShape* createCompoundShape(const std::vector<std::pair<Physics3DShape *, Mat4>> &shapes);
#if CC_ENABLE_BULLET_INTEGRATION
btCollisionShape* getbtShape() const { return _btShape; }
#endif
protected:
Physics3DShape();
~Physics3DShape();
bool initBox(const cocos2d::Vec3& ext);
bool initSphere(float radius);
bool initCylinder(float radius, float height);
bool initCapsule(float radius, float height);
bool initConvexHull(const cocos2d::Vec3 *points, int numPoints);
bool initMesh(const cocos2d::Vec3 *triangles, int numTriangles);
bool initHeightfield(int heightStickWidth,int heightStickLength
, const void* heightfieldData, float heightScale
, float minHeight, float maxHeight
, bool useFloatDatam, bool flipQuadEdges
, bool useDiamondSubdivision);
bool initCompoundShape(const std::vector<std::pair<Physics3DShape *, Mat4>> &shapes);
ShapeType _shapeType; //shape type
#if (CC_ENABLE_BULLET_INTEGRATION)
btCollisionShape* _btShape;
unsigned char *_heightfieldData;
std::vector<Physics3DShape *> _compoundChildShapes;
#endif
};
// end of 3d group
/// @}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS
#endif // __PHYSICS_3D_SHAPE_H__

View File

@ -0,0 +1,331 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#include "renderer/CCRenderer.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
Physics3DWorld::Physics3DWorld()
: _btPhyiscsWorld(nullptr)
, _collisionConfiguration(nullptr)
, _dispatcher(nullptr)
, _broadphase(nullptr)
, _solver(nullptr)
, _debugDrawer(nullptr)
, _needCollisionChecking(false)
, _collisionCheckingFlag(false)
{
}
Physics3DWorld::~Physics3DWorld()
{
removeAllPhysics3DConstraints();
removeAllPhysics3DObjects();
CC_SAFE_DELETE(_collisionConfiguration);
CC_SAFE_DELETE(_dispatcher);
CC_SAFE_DELETE(_broadphase);
CC_SAFE_DELETE(_solver);
CC_SAFE_DELETE(_btPhyiscsWorld);
CC_SAFE_DELETE(_debugDrawer);
for (auto it : _physicsComponents)
it->setPhysics3DObject(nullptr);
_physicsComponents.clear();
}
Physics3DWorld* Physics3DWorld::create(Physics3DWorldDes* info)
{
auto world = new (std::nothrow) Physics3DWorld();
world->init(info);
world->autorelease();
return world;
}
bool Physics3DWorld::init(Physics3DWorldDes* info)
{
///collision configuration contains default setup for memory, collision setup
_collisionConfiguration = new (std::nothrow) btDefaultCollisionConfiguration();
//_collisionConfiguration->setConvexConvexMultipointIterations();
///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
_dispatcher = new (std::nothrow) btCollisionDispatcher(_collisionConfiguration);
_broadphase = new (std::nothrow) btDbvtBroadphase();
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver();
_solver = sol;
_btPhyiscsWorld = new btDiscreteDynamicsWorld(_dispatcher,_broadphase,_solver,_collisionConfiguration);
_btPhyiscsWorld->setGravity(convertVec3TobtVector3(info->gravity));
if (info->isDebugDrawEnabled)
{
_debugDrawer = new (std::nothrow) Physics3DDebugDrawer();
_btPhyiscsWorld->setDebugDrawer(_debugDrawer);
}
return true;
}
void Physics3DWorld::setDebugDrawEnable(bool enableDebugDraw)
{
if (enableDebugDraw && _btPhyiscsWorld->getDebugDrawer() == nullptr)
{
_debugDrawer = new (std::nothrow) Physics3DDebugDrawer();
}
enableDebugDraw ? _btPhyiscsWorld->setDebugDrawer(_debugDrawer) : _btPhyiscsWorld->setDebugDrawer(nullptr);
}
bool Physics3DWorld::isDebugDrawEnabled() const
{
return _btPhyiscsWorld->getDebugDrawer() != nullptr;
}
void Physics3DWorld::addPhysics3DObject(Physics3DObject* physicsObj)
{
auto it = std::find(_objects.begin(), _objects.end(), physicsObj);
if (it == _objects.end())
{
_objects.push_back(physicsObj);
physicsObj->retain();
if (physicsObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
_btPhyiscsWorld->addRigidBody(static_cast<Physics3DRigidBody*>(physicsObj)->getRigidBody());
}
_collisionCheckingFlag = true;
}
}
void Physics3DWorld::removePhysics3DObject(Physics3DObject* physicsObj)
{
auto it = std::find(_objects.begin(), _objects.end(), physicsObj);
if (it != _objects.end())
{
if (physicsObj->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
_btPhyiscsWorld->removeRigidBody(static_cast<Physics3DRigidBody*>(physicsObj)->getRigidBody());
}
physicsObj->release();
_objects.erase(it);
_collisionCheckingFlag = true;
}
}
void Physics3DWorld::removeAllPhysics3DObjects()
{
for (auto it : _objects) {
if (it->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
_btPhyiscsWorld->removeRigidBody(static_cast<Physics3DRigidBody*>(it)->getRigidBody());
}
it->release();
}
_objects.clear();
_collisionCheckingFlag = true;
}
void Physics3DWorld::addPhysics3DConstraint(Physics3DConstraint* constraint, bool disableCollisionsBetweenLinkedObjs)
{
auto body = constraint->getBodyA();
if (body)
body->addConstraint(constraint);
body = constraint->getBodyB();
if (body)
{
body->addConstraint(constraint);
}
_btPhyiscsWorld->addConstraint(constraint->getbtContraint(), disableCollisionsBetweenLinkedObjs);
}
void Physics3DWorld::removePhysics3DConstraint(Physics3DConstraint* constraint)
{
_btPhyiscsWorld->removeConstraint(constraint->getbtContraint());
auto bodyA = constraint->getBodyA();
auto bodyB = constraint->getBodyB();
if (bodyA)
bodyA->removeConstraint(constraint);
if (bodyB)
bodyB->removeConstraint(constraint);
}
void Physics3DWorld::removeAllPhysics3DConstraints()
{
for(auto it : _objects)
{
auto type = it->getObjType();
if (type == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
auto& constraints = static_cast<Physics3DRigidBody*>(it)->_constraintList;
for (auto constraint : constraints) {
_btPhyiscsWorld->removeConstraint(constraint->getbtContraint());
constraint->release();
}
constraints.clear();
}
}
}
void Physics3DWorld::stepSimulate(float dt)
{
if (_btPhyiscsWorld)
{
//should sync kinematic node before simulation
for (auto it : _physicsComponents)
{
it->preSimulate();
}
_btPhyiscsWorld->stepSimulation(dt, 3);
//sync dynamic node after simulation
for (auto it : _physicsComponents)
{
it->postSimulate();
}
if (needCollisionChecking())
collisionChecking();
}
}
void Physics3DWorld::debugDraw(Renderer* renderer)
{
if (_debugDrawer)
{
_debugDrawer->clear();
_btPhyiscsWorld->debugDrawWorld();
_debugDrawer->draw(renderer);
}
}
bool Physics3DWorld::rayCast(const cocos2d::Vec3& startPos, const cocos2d::Vec3& endPos, Physics3DWorld::HitResult* result)
{
auto btStart = convertVec3TobtVector3(startPos);
auto btEnd = convertVec3TobtVector3(endPos);
btCollisionWorld::ClosestRayResultCallback btResult(btStart, btEnd);
_btPhyiscsWorld->rayTest(btStart, btEnd, btResult);
if (btResult.hasHit())
{
result->hitObj = getPhysicsObject(btResult.m_collisionObject);
result->hitPosition = convertbtVector3ToVec3(btResult.m_hitPointWorld);
result->hitNormal = convertbtVector3ToVec3(btResult.m_hitNormalWorld);
return true;
}
result->hitObj = nullptr;
return false;
}
bool Physics3DWorld::sweepShape(Physics3DShape* shape, const cocos2d::Mat4& startTransform, const cocos2d::Mat4& endTransform, Physics3DWorld::HitResult* result)
{
CC_ASSERT(shape->getShapeType() != Physics3DShape::ShapeType::HEIGHT_FIELD && shape->getShapeType() != Physics3DShape::ShapeType::MESH);
auto btStart = convertMat4TobtTransform(startTransform);
auto btEnd = convertMat4TobtTransform(endTransform);
btCollisionWorld::ClosestConvexResultCallback btResult(btStart.getOrigin(), btEnd.getOrigin());
_btPhyiscsWorld->convexSweepTest((btConvexShape*)shape->getbtShape(), btStart, btEnd, btResult);
if (btResult.hasHit())
{
result->hitObj = getPhysicsObject(btResult.m_hitCollisionObject);
result->hitPosition = convertbtVector3ToVec3(btResult.m_hitPointWorld);
result->hitNormal = convertbtVector3ToVec3(btResult.m_hitNormalWorld);
return true;
}
result->hitObj = nullptr;
return false;
}
Physics3DObject* Physics3DWorld::getPhysicsObject(const btCollisionObject* btObj)
{
for(auto it : _objects)
{
if (it->getObjType() == Physics3DObject::PhysicsObjType::RIGID_BODY)
{
if (static_cast<Physics3DRigidBody*>(it)->getRigidBody() == btObj)
return it;
}
}
return nullptr;
}
void Physics3DWorld::collisionChecking()
{
int numManifolds = _dispatcher->getNumManifolds();
for (int i = 0; i < numManifolds; ++i){
btPersistentManifold * contactManifold = _dispatcher->getManifoldByIndexInternal(i);
int numContacts = contactManifold->getNumContacts();
if (0 < numContacts){
const btCollisionObject* obA = static_cast<const btCollisionObject*>(contactManifold->getBody0());
const btCollisionObject* obB = static_cast<const btCollisionObject*>(contactManifold->getBody1());
Physics3DObject *poA = getPhysicsObject(obA);
Physics3DObject *poB = getPhysicsObject(obB);
if (poA->needCollisionCallback() || poB->needCollisionCallback()){
Physics3DCollisionInfo ci;
ci.objA = poA;
ci.objB = poB;
for (int c = 0; c < numContacts; ++c){
btManifoldPoint& pt = contactManifold->getContactPoint(c);
Physics3DCollisionInfo::CollisionPoint cp = {
convertbtVector3ToVec3(pt.m_localPointA), convertbtVector3ToVec3(pt.m_positionWorldOnA)
, convertbtVector3ToVec3(pt.m_localPointB), convertbtVector3ToVec3(pt.m_positionWorldOnB)
, convertbtVector3ToVec3(pt.m_normalWorldOnB)
};
ci.collisionPointList.push_back(cp);
}
if (poA->needCollisionCallback()){
poA->getCollisionCallback()(ci);
}
if (poB->needCollisionCallback()){
poB->getCollisionCallback()(ci);
}
}
}
}
}
bool Physics3DWorld::needCollisionChecking()
{
if (_collisionCheckingFlag){
_needCollisionChecking = false;
for(auto it : _objects)
{
if (it->getCollisionCallback() != nullptr){
_needCollisionChecking = true;
break;
}
}
_collisionCheckingFlag = false;
}
return _needCollisionChecking;
}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif //CC_USE_3D_PHYSICS

View File

@ -0,0 +1,173 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_3D_WORLD_H__
#define __PHYSICS_3D_WORLD_H__
#include "math/CCMath.h"
#include "base/CCRef.h"
#include "base/ccConfig.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
class btDynamicsWorld;
class btDefaultCollisionConfiguration;
class btCollisionDispatcher;
class btDbvtBroadphase;
class btSequentialImpulseConstraintSolver;
class btRigidBody;
class btCollisionObject;
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
class Physics3DObject;
class Physics3DConstraint;
class Physics3DDebugDrawer;
class Physics3DComponent;
class Physics3DShape;
class Renderer;
/**
* @brief The description of Physics3DWorld.
*/
struct CC_DLL Physics3DWorldDes
{
bool isDebugDrawEnabled; //using physics debug draw?, false by default
cocos2d::Vec3 gravity;//gravity, (0, -9.8, 0)
Physics3DWorldDes()
{
isDebugDrawEnabled = false;
gravity = cocos2d::Vec3(0.f, -9.8f, 0.f);
}
};
/**
* @brief The physics information container, include Physics3DObjects, Physics3DConstraints, collision information and so on.
*/
class CC_DLL Physics3DWorld : public Ref
{
friend class Physics3DComponent;
public:
struct HitResult
{
cocos2d::Vec3 hitPosition;
cocos2d::Vec3 hitNormal;
Physics3DObject* hitObj;
};
/**
* Creates a Physics3DWorld with Physics3DWorldDes.
*
* @return An autoreleased Physics3DWorld object.
*/
static Physics3DWorld* create(Physics3DWorldDes* info);
/** Add a Physics3DObject. */
void addPhysics3DObject(Physics3DObject* physicsObj);
/** Remove a Physics3DObject. */
void removePhysics3DObject(Physics3DObject* physicsObj);
/** Remove all Physics3DObjects. */
void removeAllPhysics3DObjects();
/** Add a Physics3DConstraint. */
void addPhysics3DConstraint(Physics3DConstraint* constraint, bool disableCollisionsBetweenLinkedObjs = true);
/** Remove a Physics3DConstraint. */
void removePhysics3DConstraint(Physics3DConstraint* constraint);
/** Remove all Physics3DConstraint. */
void removeAllPhysics3DConstraints();
/** Simulate one frame. */
void stepSimulate(float dt);
/** Enable or disable debug drawing. */
void setDebugDrawEnable(bool enableDebugDraw);
/** Check debug drawing is enabled. */
bool isDebugDrawEnabled() const;
/** Internal method, the updater of debug drawing, need called each frame. */
void debugDraw(cocos2d::Renderer* renderer);
/** Get the list of Physics3DObjects. */
const std::vector<Physics3DObject*>& getPhysicsObjects() const { return _objects; }
/**
* Ray cast method
* @param startPos The start position of ray.
* @param endPos The end position of ray.
* @param result the result of ray cast.
*/
bool rayCast(const cocos2d::Vec3& startPos, const cocos2d::Vec3& endPos, HitResult* result);
/** Performs a swept shape cast on all objects in the Physics3DWorld. */
bool sweepShape(Physics3DShape* shape, const cocos2d::Mat4& startTransform, const cocos2d::Mat4& endTransform, HitResult* result);
CC_CONSTRUCTOR_ACCESS:
Physics3DWorld();
virtual ~Physics3DWorld();
bool init(Physics3DWorldDes* info);
Physics3DObject* getPhysicsObject(const btCollisionObject* btObj);
void collisionChecking();
bool needCollisionChecking();
protected:
std::vector<Physics3DObject*> _objects;
std::vector<Physics3DComponent*> _physicsComponents; //physics3d components
bool _needCollisionChecking;
bool _collisionCheckingFlag;
#if (CC_ENABLE_BULLET_INTEGRATION)
btDynamicsWorld* _btPhyiscsWorld;
btDefaultCollisionConfiguration* _collisionConfiguration;
btCollisionDispatcher* _dispatcher;
btDbvtBroadphase* _broadphase;
btSequentialImpulseConstraintSolver* _solver;
Physics3DDebugDrawer* _debugDrawer;
#endif // CC_ENABLE_BULLET_INTEGRATION
};
// end of 3d group
/// @}
NS_CC_END
#endif
#endif //CC_USE_3D_PHYSICS
#endif // __PHYSICS_3D_WORLD_H__

View File

@ -0,0 +1,86 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPhysics3D.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
PhysicsSprite3D* PhysicsSprite3D::create(const std::string &modelPath, Physics3DRigidBodyDes* rigidDes, const cocos2d::Vec3& translateInPhysics, const cocos2d::Quaternion& rotInPhsyics)
{
auto ret = new PhysicsSprite3D();
if (ret && ret->initWithFile(modelPath))
{
auto obj = Physics3DRigidBody::create(rigidDes);
ret->_physicsComponent = Physics3DComponent::create(obj);
ret->addComponent(ret->_physicsComponent);
ret->_contentSize = ret->getBoundingBox().size;
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return ret;
}
Physics3DObject* PhysicsSprite3D::getPhysicsObj() const
{
return _physicsComponent->getPhysics3DObject();
}
void PhysicsSprite3D::setSyncFlag(Physics3DComponent::PhysicsSyncFlag syncFlag)
{
if (_physicsComponent)
_physicsComponent->setSyncFlag(syncFlag);
}
void PhysicsSprite3D::syncToPhysics()
{
if (_physicsComponent)
_physicsComponent->syncToPhysics();
}
void PhysicsSprite3D::syncToNode()
{
if (_physicsComponent)
_physicsComponent->syncToNode();
}
PhysicsSprite3D::PhysicsSprite3D()
: _physicsComponent(nullptr)
{
}
PhysicsSprite3D::~PhysicsSprite3D()
{
}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif // CC_USE_3D_PHYSICS

View File

@ -0,0 +1,81 @@
/****************************************************************************
Copyright (c) 2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PHYSICS_SPRITE_3D_H__
#define __PHYSICS_SPRITE_3D_H__
#include "base/ccConfig.h"
#include "3d/CCSprite3D.h"
#include "CCPhysics3DObject.h"
#include "CCPhysics3DComponent.h"
#if CC_USE_3D_PHYSICS
#if (CC_ENABLE_BULLET_INTEGRATION)
NS_CC_BEGIN
/**
* @addtogroup _3d
* @{
*/
/**
* @brief Convenient class to create a rigid body with Sprite3D
*/
class CC_DLL PhysicsSprite3D : public cocos2d::Sprite3D
{
public:
/** creates a PhysicsSprite3D*/
static PhysicsSprite3D* create(const std::string &modelPath, Physics3DRigidBodyDes* rigidDes, const cocos2d::Vec3& translateInPhysics = cocos2d::Vec3::ZERO, const cocos2d::Quaternion& rotInPhsyics = cocos2d::Quaternion::ZERO);
/** Get the Physics3DObject. */
Physics3DObject* getPhysicsObj() const;
/** Set synchronization flag, see Physics3DComponent. */
void setSyncFlag(Physics3DComponent::PhysicsSyncFlag syncFlag);
/** Physics synchronize rendering. */
void syncToPhysics();
/** Rendering synchronize physics. */
void syncToNode();
CC_CONSTRUCTOR_ACCESS:
PhysicsSprite3D();
virtual ~PhysicsSprite3D();
protected:
Physics3DComponent* _physicsComponent;
};
// end of 3d group
/// @}
NS_CC_END
#endif // CC_ENABLE_BULLET_INTEGRATION
#endif // CC_USE_3D_PHYSICS
#endif // __PHYSICS_SPRITE_3D_H__

Some files were not shown because too many files have changed in this diff Show More