mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' into v3_CameraMaskFor2DAnd3DRendering
Conflicts: cocos/renderer/CCGLProgramCache.cpp tests/cpp-tests/Classes/controller.cpp
This commit is contained in:
commit
84540c1ff4
|
@ -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/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -37,4 +37,4 @@ before_install:
|
|||
# whitelist
|
||||
branches:
|
||||
only:
|
||||
- v3.6
|
||||
- v3
|
||||
|
|
9
AUTHORS
9
AUTHORS
|
@ -1091,6 +1091,7 @@ Developers:
|
|||
|
||||
loadrunner
|
||||
Added romanian languange support
|
||||
Added sensor property for PhysicsShape
|
||||
|
||||
Almax27
|
||||
RenderQueue command buffer optimize.
|
||||
|
@ -1106,13 +1107,21 @@ 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
|
||||
Fixed memory leak of WebView on iOS
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
|
|
21
CHANGELOG
21
CHANGELOG
|
@ -1,4 +1,23 @@
|
|||
cocos2d-x-3.6 ??
|
||||
cocos2d-x-3.7 ??
|
||||
[NEW] 3d: added physics3d support
|
||||
[NEW] C++: added ActionFloat
|
||||
[NEW] C++: support physical keyboard on WinRT
|
||||
[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
|
||||
[FIX] Sprite3D: setGLProgram() does not work
|
||||
[FIX] Terrain: terrain is on top of particles, particles can not be seen
|
||||
[FIX] WebView: memory leak on iOS
|
||||
|
||||
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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
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
|
||||
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
|
||||
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
|
||||
{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
|
||||
EndGlobalSection
|
||||
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}
|
||||
EndGlobalSection
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -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
|
|
@ -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}
|
|
@ -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}"
|
||||
|
|
|
@ -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
|
@ -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;
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
@echo off
|
||||
SETLOCAL
|
||||
|
||||
:start
|
||||
mkdir win32-msvc-vs2012-x86
|
||||
cd win32-msvc-vs2012-x86
|
||||
cmake -G "Visual Studio 11" ../..
|
||||
pause
|
|
@ -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))
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
/// @}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ std::set<unsigned int>* BMFontConfiguration::parseConfigFile(const std::string&
|
|||
int parseCount = 0;
|
||||
while (next)
|
||||
{
|
||||
lineLength = next - base;
|
||||
lineLength = ((int)(next - base));
|
||||
memcpy(line, contents + parseCount, lineLength);
|
||||
line[lineLength] = 0;
|
||||
|
||||
|
|
|
@ -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,49 @@ 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);
|
||||
|
||||
outRect.origin.x = blendImageMinX;
|
||||
outRect.origin.y = -blendImageMaxY;
|
||||
|
||||
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];
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -52,6 +52,7 @@ class Renderer;
|
|||
class Director;
|
||||
class GLProgram;
|
||||
class GLProgramState;
|
||||
class Material;
|
||||
#if CC_USE_PHYSICS
|
||||
class PhysicsBody;
|
||||
class PhysicsWorld;
|
||||
|
|
|
@ -164,7 +164,7 @@ bool ParticleSystem::initWithFile(const std::string& plistFile)
|
|||
{
|
||||
bool ret = false;
|
||||
_plistFile = FileUtils::getInstance()->fullPathForFilename(plistFile);
|
||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(_plistFile.c_str());
|
||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(_plistFile);
|
||||
|
||||
CCASSERT( !dict.empty(), "Particles: file not found");
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -20,20 +20,18 @@
|
|||
<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>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_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>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -50,7 +48,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 +76,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 +117,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 +131,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 +164,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>
|
||||
|
@ -436,6 +434,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClCompile Include="..\base\CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="..\base\CCNS.cpp" />
|
||||
<ClCompile Include="..\base\CCProfiling.cpp" />
|
||||
<ClCompile Include="..\base\CCProperties.cpp" />
|
||||
<ClCompile Include="..\base\ccRandom.cpp" />
|
||||
<ClCompile Include="..\base\CCRef.cpp" />
|
||||
<ClCompile Include="..\base\CCScheduler.cpp" />
|
||||
|
@ -567,6 +566,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,17 +598,22 @@ 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" />
|
||||
<ClCompile Include="..\renderer\CCTrianglesCommand.cpp" />
|
||||
<ClCompile Include="..\renderer\CCVertexAttribBinding.cpp" />
|
||||
<ClCompile Include="..\renderer\CCVertexIndexBuffer.cpp" />
|
||||
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
|
||||
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
|
||||
|
@ -985,6 +997,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ClInclude Include="..\base\CCMap.h" />
|
||||
<ClInclude Include="..\base\CCNS.h" />
|
||||
<ClInclude Include="..\base\CCProfiling.h" />
|
||||
<ClInclude Include="..\base\CCProperties.h" />
|
||||
<ClInclude Include="..\base\CCProtocols.h" />
|
||||
<ClInclude Include="..\base\ccRandom.h" />
|
||||
<ClInclude Include="..\base\CCRef.h" />
|
||||
|
@ -1142,6 +1155,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,18 +1194,23 @@ 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" />
|
||||
<ClInclude Include="..\renderer\CCTrianglesCommand.h" />
|
||||
<ClInclude Include="..\renderer\CCVertexAttribBinding.h" />
|
||||
<ClInclude Include="..\renderer\CCVertexIndexBuffer.h" />
|
||||
<ClInclude Include="..\renderer\CCVertexIndexData.h" />
|
||||
<ClInclude Include="..\storage\local-storage\LocalStorage.h" />
|
||||
|
@ -1307,6 +1333,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
|||
<ProjectReference Include="..\..\external\Box2D\proj.win32\libbox2d.vcxproj">
|
||||
<Project>{929480e7-23c0-4df6-8456-096d71547116}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\external\bullet\proj.win32\libbullet.vcxproj">
|
||||
<Project>{012dff48-a13f-4f52-b07b-f8b9d21ce95b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\editor-support\spine\proj.win32\libSpine.vcxproj">
|
||||
<Project>{b7c2a162-dec9-4418-972e-240ab3cbfcae}</Project>
|
||||
</ProjectReference>
|
||||
|
|
|
@ -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,48 @@
|
|||
<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>
|
||||
<ClCompile Include="..\base\CCProperties.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCVertexAttribBinding.cpp">
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||
|
@ -3575,6 +3620,48 @@
|
|||
<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>
|
||||
<ClInclude Include="..\base\CCProperties.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCVertexAttribBinding.h">
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\math\Mat4.inl">
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -284,6 +284,7 @@
|
|||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCMap.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNS.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProfiling.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProperties.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProtocols.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\ccRandom.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCRef.h" />
|
||||
|
@ -488,18 +489,23 @@
|
|||
<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" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTrianglesCommand.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexAttribBinding.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexBuffer.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexData.h" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.h" />
|
||||
|
@ -879,6 +885,7 @@
|
|||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCIMEDispatcher.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCNS.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProfiling.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProperties.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\ccRandom.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCRef.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCScheduler.cpp" />
|
||||
|
@ -1051,17 +1058,22 @@
|
|||
<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" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCTrianglesCommand.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexAttribBinding.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexBuffer.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexIndexData.cpp" />
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.cpp" />
|
||||
|
|
|
@ -1773,6 +1773,24 @@
|
|||
<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>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProperties.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexAttribBinding.h">
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\cocos2d.cpp" />
|
||||
|
@ -3369,6 +3387,24 @@
|
|||
<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>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\base\CCProperties.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\renderer\CCVertexAttribBinding.cpp">
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="2d">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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'">
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -26,24 +26,107 @@
|
|||
#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 "renderer/CCVertexAttribBinding.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 +135,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 +256,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 +269,105 @@ 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);
|
||||
}
|
||||
|
||||
if (_material)
|
||||
{
|
||||
for (auto technique: _material->getTechniques())
|
||||
{
|
||||
for (auto pass: technique->getPasses())
|
||||
{
|
||||
auto vertexAttribBinding = VertexAttribBinding::create(_meshIndexData, pass->getGLProgramState());
|
||||
pass->setVertexAttribBinding(vertexAttribBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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(const auto pass : technique->_passes)
|
||||
{
|
||||
auto programState = pass->getGLProgramState();
|
||||
programState->setUniformVec4("u_color", color);
|
||||
|
||||
if (_skin)
|
||||
programState->setUniformVec4v("u_matrixPalette", (GLsizei)_skin->getMatrixPaletteSize(), _skin->getMatrixPalette());
|
||||
|
||||
if (scene && scene->getLights().size() > 0)
|
||||
setLightUniforms(pass, scene, color, lightMask);
|
||||
}
|
||||
|
||||
renderer->addCommand(&_meshCommand);
|
||||
}
|
||||
|
||||
void Mesh::setSkin(MeshSkin* skin)
|
||||
|
@ -214,13 +395,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 +455,185 @@ 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(Pass* pass, Scene* scene, const Vec4& color, unsigned int lightmask)
|
||||
{
|
||||
CCASSERT(pass, "Invalid Pass");
|
||||
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();
|
||||
|
||||
auto glProgramState = pass->getGLProgramState();
|
||||
auto attributes = pass->getVertexAttributeBinding()->getVertexAttribsFlags();
|
||||
|
||||
if (attributes & (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.size(), &s_dirLightUniformColorValues[0]);
|
||||
glProgramState->setUniformVec3v(s_dirLightUniformDirName, s_dirLightUniformDirValues.size(), &s_dirLightUniformDirValues[0]);
|
||||
}
|
||||
|
||||
if (0 < maxPointLight)
|
||||
{
|
||||
glProgramState->setUniformVec3v(s_pointLightUniformColorName, s_pointLightUniformColorValues.size(), &s_pointLightUniformColorValues[0]);
|
||||
glProgramState->setUniformVec3v(s_pointLightUniformPositionName, s_pointLightUniformPositionValues.size(), &s_pointLightUniformPositionValues[0]);
|
||||
glProgramState->setUniformFloatv(s_pointLightUniformRangeInverseName, s_pointLightUniformRangeInverseValues.size(), &s_pointLightUniformRangeInverseValues[0]);
|
||||
}
|
||||
|
||||
if (0 < maxSpotLight)
|
||||
{
|
||||
glProgramState->setUniformVec3v(s_spotLightUniformColorName, s_spotLightUniformColorValues.size(), &s_spotLightUniformColorValues[0]);
|
||||
glProgramState->setUniformVec3v(s_spotLightUniformPositionName, s_spotLightUniformPositionValues.size(), &s_spotLightUniformPositionValues[0]);
|
||||
glProgramState->setUniformVec3v(s_spotLightUniformDirName, s_spotLightUniformDirValues.size(), &s_spotLightUniformDirValues[0]);
|
||||
glProgramState->setUniformFloatv(s_spotLightUniformInnerAngleCosName, s_spotLightUniformInnerAngleCosValues.size(), &s_spotLightUniformInnerAngleCosValues[0]);
|
||||
glProgramState->setUniformFloatv(s_spotLightUniformOuterAngleCosName, s_spotLightUniformOuterAngleCosValues.size(), &s_spotLightUniformOuterAngleCosValues[0]);
|
||||
glProgramState->setUniformFloatv(s_spotLightUniformRangeInverseName, s_spotLightUniformRangeInverseValues.size(), &s_spotLightUniformRangeInverseValues[0]);
|
||||
}
|
||||
|
||||
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 +656,4 @@ GLuint Mesh::getIndexBuffer() const
|
|||
{
|
||||
return _meshIndexData->getIndexBuffer()->getVBO();
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -46,6 +46,11 @@ class MeshSkin;
|
|||
class MeshIndexData;
|
||||
class GLProgramState;
|
||||
class GLProgram;
|
||||
class Material;
|
||||
class Renderer;
|
||||
class Scene;
|
||||
class Pass;
|
||||
|
||||
/**
|
||||
* @brief Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on
|
||||
*/
|
||||
|
@ -92,11 +97,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 +122,7 @@ public:
|
|||
*
|
||||
* @lua NA
|
||||
*/
|
||||
GLProgramState* getGLProgramState() const { return _glProgramState; }
|
||||
GLProgramState* getGLProgramState() const;
|
||||
|
||||
/**name getter */
|
||||
const std::string& getName() const { return _name; }
|
||||
|
@ -153,21 +158,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 +189,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(Pass* pass, 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;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,12 +41,15 @@
|
|||
#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
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
std::string s_attributeNames[] = {GLProgram::ATTRIBUTE_NAME_POSITION, GLProgram::ATTRIBUTE_NAME_COLOR, GLProgram::ATTRIBUTE_NAME_TEX_COORD, GLProgram::ATTRIBUTE_NAME_TEX_COORD1, GLProgram::ATTRIBUTE_NAME_TEX_COORD2,GLProgram::ATTRIBUTE_NAME_TEX_COORD3,GLProgram::ATTRIBUTE_NAME_NORMAL, GLProgram::ATTRIBUTE_NAME_BLEND_WEIGHT, GLProgram::ATTRIBUTE_NAME_BLEND_INDEX};
|
||||
static GLProgramState* getGLProgramStateForAttribs(MeshVertexData* meshVertexData, bool usesLight);
|
||||
|
||||
Sprite3D* Sprite3D::create()
|
||||
{
|
||||
|
@ -61,10 +64,9 @@ Sprite3D* Sprite3D::create()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Sprite3D* Sprite3D::create(const std::string &modelPath)
|
||||
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))
|
||||
|
@ -76,7 +78,7 @@ Sprite3D* Sprite3D::create(const std::string &modelPath)
|
|||
CC_SAFE_DELETE(sprite);
|
||||
return nullptr;
|
||||
}
|
||||
Sprite3D* Sprite3D::create(const std::string &modelPath, const std::string &texturePath)
|
||||
Sprite3D* Sprite3D::create(const std::string& modelPath, const std::string& texturePath)
|
||||
{
|
||||
auto sprite = create(modelPath);
|
||||
if (sprite)
|
||||
|
@ -87,12 +89,12 @@ Sprite3D* Sprite3D::create(const std::string &modelPath, const std::string &text
|
|||
return sprite;
|
||||
}
|
||||
|
||||
void Sprite3D::createAsync(const std::string &modelPath, const std::function<void(Sprite3D*, void*)>& callback, void* callbackparam)
|
||||
void Sprite3D::createAsync(const std::string& modelPath, const std::function<void(Sprite3D*, void*)>& callback, void* callbackparam)
|
||||
{
|
||||
createAsync(modelPath, "", callback, callbackparam);
|
||||
}
|
||||
|
||||
void Sprite3D::createAsync(const std::string &modelPath, const std::string &texturePath, const std::function<void(Sprite3D*, void*)>& callback, void* callbackparam)
|
||||
void Sprite3D::createAsync(const std::string& modelPath, const std::string& texturePath, const std::function<void(Sprite3D*, void*)>& callback, void* callbackparam)
|
||||
{
|
||||
Sprite3D *sprite = new (std::nothrow) Sprite3D();
|
||||
if (sprite->loadFromCache(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;
|
||||
}
|
||||
|
@ -245,6 +249,7 @@ Sprite3D::Sprite3D()
|
|||
, _lightMask(-1)
|
||||
, _shaderUsingLight(false)
|
||||
, _forceDepthWrite(false)
|
||||
, _usingAutogeneratedGLProgram(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -265,7 +270,7 @@ bool Sprite3D::init()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Sprite3D::initWithFile(const std::string &path)
|
||||
bool Sprite3D::initWithFile(const std::string& path)
|
||||
{
|
||||
_meshes.clear();
|
||||
_meshVertexDatas.clear();
|
||||
|
@ -277,7 +282,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 +298,7 @@ bool Sprite3D::initWithFile(const std::string &path)
|
|||
|
||||
Sprite3DCache::getInstance()->addSprite3DData(path, data);
|
||||
CC_SAFE_DELETE(meshdatas);
|
||||
_contentSize = getBoundingBox().size;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -336,22 +342,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);
|
||||
|
@ -360,7 +366,7 @@ Sprite3D* Sprite3D::createSprite3DNode(NodeData* nodedata,ModelData* modeldata,c
|
|||
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;
|
||||
|
@ -391,13 +397,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,71 +412,68 @@ void Sprite3D::createAttachSprite3DNode(NodeData* nodedata,const MaterialDatas&
|
|||
}
|
||||
for(const auto& it : nodedata->children)
|
||||
{
|
||||
createAttachSprite3DNode(it,matrialdatas);
|
||||
}
|
||||
}
|
||||
void Sprite3D::genGLProgramState(bool useLight)
|
||||
{
|
||||
_shaderUsingLight = useLight;
|
||||
|
||||
std::unordered_map<const MeshVertexData*, GLProgramState*> glProgramestates;
|
||||
for(auto& mesh : _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;
|
||||
const char* shader = nullptr;
|
||||
if(textured)
|
||||
{
|
||||
if (hasSkin)
|
||||
{
|
||||
if (hasNormal && _shaderUsingLight)
|
||||
shader = GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE;
|
||||
else
|
||||
shader = GLProgram::SHADER_3D_SKINPOSITION_TEXTURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasNormal && _shaderUsingLight)
|
||||
shader = GLProgram::SHADER_3D_POSITION_NORMAL_TEXTURE;
|
||||
else
|
||||
shader = GLProgram::SHADER_3D_POSITION_TEXTURE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shader = GLProgram::SHADER_3D_POSITION;
|
||||
}
|
||||
if (shader)
|
||||
glProgram = GLProgramCache::getInstance()->getGLProgram(shader);
|
||||
|
||||
auto programstate = GLProgramState::create(glProgram);
|
||||
long offset = 0;
|
||||
auto attributeCount = mesh->getMeshVertexAttribCount();
|
||||
for (auto k = 0; k < attributeCount; k++) {
|
||||
auto meshattribute = mesh->getMeshVertexAttrib(k);
|
||||
programstate->setVertexAttribPointer(s_attributeNames[meshattribute.vertexAttrib],
|
||||
meshattribute.size,
|
||||
meshattribute.type,
|
||||
GL_FALSE,
|
||||
mesh->getVertexBuffer()->getSizePerVertex(),
|
||||
(GLvoid*)offset);
|
||||
offset += meshattribute.attribSizeBytes;
|
||||
}
|
||||
|
||||
glProgramestates[mesh] = programstate;
|
||||
}
|
||||
|
||||
for (auto& it : _meshes) {
|
||||
auto glProgramState = glProgramestates[it->getMeshIndexData()->getMeshVertexData()];
|
||||
it->setGLProgramState(glProgramState);
|
||||
createAttachSprite3DNode(it,materialdatas);
|
||||
}
|
||||
}
|
||||
|
||||
void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& matrialdatas, bool singleSprite)
|
||||
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
|
||||
{
|
||||
auto mesh = _meshes.at(meshIndex);
|
||||
mesh->setMaterial(material);
|
||||
}
|
||||
|
||||
_usingAutogeneratedGLProgram = false;
|
||||
}
|
||||
|
||||
Material* Sprite3D::getMaterial(int meshIndex) const
|
||||
{
|
||||
CCASSERT(meshIndex >=0 && meshIndex < _meshes.size(), "Invalid meshIndex");
|
||||
return _meshes.at(meshIndex)->getMaterial();
|
||||
}
|
||||
|
||||
|
||||
void Sprite3D::genGLProgramState(bool useLight)
|
||||
{
|
||||
_shaderUsingLight = useLight;
|
||||
|
||||
std::unordered_map<const MeshVertexData*, GLProgramState*> glProgramestates;
|
||||
for(auto meshVertexData : _meshVertexDatas)
|
||||
{
|
||||
auto glprogramstate = getGLProgramStateForAttribs(meshVertexData, useLight);
|
||||
glProgramestates[meshVertexData] = 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& materialdatas, bool singleSprite)
|
||||
{
|
||||
Node* node=nullptr;
|
||||
for(const auto& it : nodedata->modelNodeDatas)
|
||||
|
@ -479,7 +482,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 +495,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 +511,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 +539,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 +577,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 +649,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.
|
||||
|
@ -729,9 +713,11 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|||
|
||||
//check light and determine the shader used
|
||||
const auto& scene = Director::getInstance()->getRunningScene();
|
||||
if (scene)
|
||||
|
||||
// Don't override GLProgramState if using manually set Material
|
||||
if (_usingAutogeneratedGLProgram && scene)
|
||||
{
|
||||
const auto& lights = scene->getLights();
|
||||
const auto lights = scene->getLights();
|
||||
bool usingLight = false;
|
||||
for (const auto light : lights) {
|
||||
usingLight = ((unsigned int)light->getLightFlag() & _lightMask) > 0;
|
||||
|
@ -739,53 +725,21 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|||
break;
|
||||
}
|
||||
if (usingLight != _shaderUsingLight)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -798,8 +752,8 @@ void Sprite3D::setGLProgramState(GLProgramState *glProgramState)
|
|||
}
|
||||
void Sprite3D::setGLProgram(GLProgram *glprogram)
|
||||
{
|
||||
Node::setGLProgram(glprogram);
|
||||
setGLProgramState(getGLProgramState());
|
||||
auto glProgramState = GLProgramState::create(glprogram);
|
||||
setGLProgramState(glProgramState);
|
||||
}
|
||||
|
||||
void Sprite3D::setBlendFunc(const BlendFunc &blendFunc)
|
||||
|
@ -807,9 +761,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 +834,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -989,4 +945,45 @@ Sprite3DCache::~Sprite3DCache()
|
|||
removeAllSprite3DData();
|
||||
}
|
||||
|
||||
//
|
||||
// MARK: Helpers
|
||||
//
|
||||
static GLProgramState* getGLProgramStateForAttribs(MeshVertexData* meshVertexData, bool usesLight)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (hasSkin)
|
||||
{
|
||||
if (hasNormal && usesLight)
|
||||
shader = GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE;
|
||||
else
|
||||
shader = GLProgram::SHADER_3D_SKINPOSITION_TEXTURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasNormal && usesLight)
|
||||
shader = GLProgram::SHADER_3D_POSITION_NORMAL_TEXTURE;
|
||||
else
|
||||
shader = GLProgram::SHADER_3D_POSITION_TEXTURE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shader = GLProgram::SHADER_3D_POSITION;
|
||||
}
|
||||
|
||||
CCASSERT(shader, "Couldn't find shader for sprite");
|
||||
|
||||
auto glProgram = GLProgramCache::getInstance()->getGLProgram(shader);
|
||||
auto glprogramstate = GLProgramState::create(glProgram);
|
||||
|
||||
return glprogramstate;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -177,6 +177,24 @@ 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);
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
Material* getMaterial(int meshIndex) const;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
|
||||
Sprite3D();
|
||||
|
@ -210,7 +228,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; }
|
||||
|
||||
|
@ -234,6 +252,7 @@ protected:
|
|||
unsigned int _lightMask;
|
||||
bool _shaderUsingLight; // is current shader using light ?
|
||||
bool _forceDepthWrite; // Always write to depth buffer
|
||||
bool _usingAutogeneratedGLProgram;
|
||||
|
||||
struct AsyncLoadParam
|
||||
{
|
||||
|
@ -309,10 +328,6 @@ protected:
|
|||
std::unordered_map<std::string, Sprite3DData*> _spriteDatas; //cached sprite datas
|
||||
};
|
||||
|
||||
/// @cond
|
||||
extern std::string CC_DLL s_attributeNames[];//attribute names array
|
||||
/// @endcond
|
||||
|
||||
// end of 3d group
|
||||
/// @}
|
||||
|
||||
|
|
|
@ -262,8 +262,10 @@ 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)
|
||||
auto _backToForegroundListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED,
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||
_customCommand.setTransparent(false);
|
||||
_customCommand.set3D(true);
|
||||
auto _backToForegroundListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED,
|
||||
[this](EventCustom*)
|
||||
{
|
||||
reload();
|
||||
|
@ -482,7 +484,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 +606,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 +1511,5 @@ Terrain::DetailMap::DetailMap()
|
|||
_detailMapSrc = "";
|
||||
_detailMapSize = 35;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
||||
)
|
||||
|
|
|
@ -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,31 @@ base/CCEventTouch.cpp \
|
|||
base/CCIMEDispatcher.cpp \
|
||||
base/CCNS.cpp \
|
||||
base/CCProfiling.cpp \
|
||||
base/ccRandom.cpp \
|
||||
base/CCProperties.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 +164,44 @@ 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/CCVertexAttribBinding.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 +233,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 +282,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 +303,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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,616 @@
|
|||
/**
|
||||
Copyright 2013 BlackBerry Inc.
|
||||
Copyright (c) 2015 Chukong Technologies
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Original file from GamePlay3D: http://gameplay3d.org
|
||||
|
||||
This file was modified to fit the cocos2d-x project
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __cocos2d_libs__CCProperties__
|
||||
#define __cocos2d_libs__CCProperties__
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
|
||||
#include "renderer/CCTexture2D.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "base/CCRef.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "base/CCVector.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Properties;
|
||||
class Vec2;
|
||||
class Vec3;
|
||||
class Vec4;
|
||||
class Mat4;
|
||||
class Data;
|
||||
class Data;
|
||||
|
||||
|
||||
/**
|
||||
* Defines a properties file for loading text files.
|
||||
*
|
||||
* A properties file has very simple syntax and can contain only namespaces and
|
||||
* name/value pairs (the properties of a namespace).
|
||||
* The file can have any file extension a user specifies.
|
||||
*
|
||||
* Here's an example of a simple
|
||||
* file that uses all the available features of the markup language:
|
||||
|
||||
@verbatim
|
||||
// This is a comment.
|
||||
|
||||
// This property is in the default namespace:
|
||||
integerProperty = 5
|
||||
|
||||
// This line defines a namespace of type "mynamespace" without an ID:
|
||||
mynamespace
|
||||
{
|
||||
// This namespace can be retrieved by searching for its ID, "spriteTexture",
|
||||
// or by its name "texture":
|
||||
texture spriteTexture
|
||||
{
|
||||
fileName = sprite.png
|
||||
width = 64
|
||||
height = 64
|
||||
}
|
||||
|
||||
// This property is in the "space" namespace:
|
||||
booleanProperty = true
|
||||
|
||||
// It's legal to have a name without a value if you leave out the '=' character:
|
||||
foo
|
||||
|
||||
// In fact, the '=' character is optional if you'd rather write:
|
||||
bar 23
|
||||
|
||||
// But don't write this or you'll get an error:
|
||||
// illegalProperty =
|
||||
|
||||
// Or this:
|
||||
// = 15
|
||||
|
||||
// Properties objects let you retrieve values as various types.
|
||||
floatProperty = 3.333
|
||||
stringProperty = This is a string.
|
||||
vector3Property = 1.0, 5.0, 3.55
|
||||
colorProperty = 1.0, 0.4, 0.0, 1.0
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
* Retrieving information out of a file like this could be done in two ways. If the
|
||||
* available namespaces and name/value pairs are known in advance they can be queried by ID or name.
|
||||
* For example, if the namespace "spriteTexture" and its properties are required then they can
|
||||
* be retrieved with a call to getNamespace() followed by calls to getString() and getInt().
|
||||
* A namespace is stored and retrieved as a Properties object.
|
||||
* Reading the spriteTexture properties out of the file above in this way could be done with the following code:
|
||||
|
||||
@verbatim
|
||||
// Create the top-level Properties object.
|
||||
Properties* properties = Properties::create("example.properties");
|
||||
// Retrieve the "spriteTexture" namespace.
|
||||
Properties* spriteTexture = properties->getNamespace("spriteTexture");
|
||||
|
||||
// Get the values of known texture properties out of the namespace.
|
||||
const char* fileName = spriteTexture->getString("fileName");
|
||||
int width = spriteTexture->getInt("width");
|
||||
int height = spriteTexture->getInt("height");
|
||||
|
||||
// Deleting the top-level Properties object will clean up all nested namespaces.
|
||||
SAFE_DELETE(properties);
|
||||
@endverbatim
|
||||
|
||||
* On the other hand, if the structure of the file is not known in advance its
|
||||
* namespaces and name/value pairs can be retrieved one by one using the getNextNamespace()
|
||||
* and getNextProperty() methods. The following method prints the contents of any properties file
|
||||
* to the console:
|
||||
|
||||
@verbatim
|
||||
void printProperties(Properties* properties)
|
||||
{
|
||||
// Print the name and ID of the current namespace.
|
||||
const char* spacename = properties->getNamespace();
|
||||
const char* id = properties->getId();
|
||||
GP_WARN("Namespace: %s ID: %s\n{", spacename, id);
|
||||
|
||||
// Print all properties in this namespace.
|
||||
const char* name = properties->getNextProperty();
|
||||
const char* value = NULL;
|
||||
while (name != NULL)
|
||||
{
|
||||
value = properties->getString(name);
|
||||
GP_WARN("%s = %s", name, value);
|
||||
name = properties->getNextProperty();
|
||||
}
|
||||
GP_WARN("}\n");
|
||||
|
||||
// Print the properties of every namespace within this one.
|
||||
Properties* space = properties->getNextNamespace();
|
||||
while (space != NULL)
|
||||
{
|
||||
printProperties(space);
|
||||
space = properties->getNextNamespace();
|
||||
}
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
* Note that this method does not keep track of the namespace hierarchy, but could be
|
||||
* modified to do so. Also note that nothing in a properties file indicates the type
|
||||
* of a property. If the type is unknown, its string can be retrieved and interpreted
|
||||
* as necessary.
|
||||
*/
|
||||
class CC_DLL Properties
|
||||
{
|
||||
friend class Game;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Data types supported by the properties class.
|
||||
*/
|
||||
enum Type
|
||||
{
|
||||
NONE,
|
||||
STRING,
|
||||
NUMBER,
|
||||
VECTOR2,
|
||||
VECTOR3,
|
||||
VECTOR4,
|
||||
MATRIX
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a Properties runtime settings from the specified URL, where the URL is of
|
||||
* the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>"
|
||||
* (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).
|
||||
*
|
||||
* @param url The URL to create the properties from.
|
||||
*
|
||||
* @return The created Properties or NULL if there was an error.
|
||||
* @script{create}
|
||||
*/
|
||||
static Properties* create(const std::string& url);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~Properties();
|
||||
|
||||
/**
|
||||
* Get the name of the next property.
|
||||
*
|
||||
* If a valid next property is returned, the value of the property can be
|
||||
* retrieved using any of the get methods in this class, passing NULL for
|
||||
// the property name.
|
||||
*
|
||||
* @return The name of the next property, or NULL if there are no properties remaining.
|
||||
*/
|
||||
const char* getNextProperty();
|
||||
|
||||
/**
|
||||
* Get the next namespace.
|
||||
*/
|
||||
Properties* getNextNamespace();
|
||||
|
||||
/**
|
||||
* Rewind the getNextProperty() and getNextNamespace() iterators
|
||||
* to the beginning of the file.
|
||||
*/
|
||||
void rewind();
|
||||
|
||||
/**
|
||||
* Get a specific namespace by ID or name. This method will optionally
|
||||
* perform a depth-first search on all namespaces and inner namespaces
|
||||
* within this Property.
|
||||
*
|
||||
* @param id The ID or name of the namespace to find.
|
||||
* @param searchNames If true, namespace names are used in the search,
|
||||
* instead of namespace IDs. By default this parameter is false
|
||||
* and namespace IDs are searched.
|
||||
* @param recurse If true, perform a depth-first search, otherwise search
|
||||
* only the immediate child namespaces.
|
||||
*
|
||||
* @return A properties object with the given ID or name.
|
||||
*/
|
||||
Properties* getNamespace(const char* id, bool searchNames = false, bool recurse = true) const;
|
||||
|
||||
/**
|
||||
* Get the name of this Property's namespace.
|
||||
*
|
||||
* @return The name of this Property's namespace.
|
||||
*/
|
||||
const char* getNamespace() const;
|
||||
|
||||
/**
|
||||
* Get the ID of this Property's namespace. The ID should be a unique identifier,
|
||||
* but its uniqueness is not enforced.
|
||||
*
|
||||
* @return The ID of this Property's namespace.
|
||||
*/
|
||||
const char* getId() const;
|
||||
|
||||
/**
|
||||
* Check if a property with the given name is specified in this Properties object.
|
||||
*
|
||||
* @param name The name of the property to query.
|
||||
*
|
||||
* @return True if the property exists, false otherwise.
|
||||
*/
|
||||
bool exists(const char* name) const;
|
||||
|
||||
/**
|
||||
* Returns the type of a property.
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's type.
|
||||
*
|
||||
* @return The type of the property.
|
||||
*/
|
||||
Type getType(const char* name = NULL) const;
|
||||
|
||||
/**
|
||||
* Get the value of the given property as a string. This can always be retrieved,
|
||||
* whatever the intended type of the property.
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param defaultValue The default value to return if the specified property does not exist.
|
||||
*
|
||||
* @return The value of the given property as a string, or the empty string if no property with that name exists.
|
||||
*/
|
||||
const char* getString(const char* name = NULL, const char* defaultValue = NULL) const;
|
||||
|
||||
/**
|
||||
* Sets the value of the property with the specified name.
|
||||
*
|
||||
* If there is no property in this namespace with the current name,
|
||||
* one is added. Otherwise, the value of the first property with the
|
||||
* specified name is updated.
|
||||
*
|
||||
* If name is NULL, the value current property (see getNextProperty) is
|
||||
* set, unless there is no current property, in which case false
|
||||
* is returned.
|
||||
*
|
||||
* @param name The name of the property to set.
|
||||
* @param value The property value.
|
||||
*
|
||||
* @return True if the property was set, false otherwise.
|
||||
*/
|
||||
bool setString(const char* name, const char* value);
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a boolean.
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param defaultValue the default value to return if the specified property does not exist within the properties file.
|
||||
*
|
||||
* @return true if the property exists and its value is "true", otherwise false.
|
||||
*/
|
||||
bool getBool(const char* name = NULL, bool defaultValue = false) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as an integer.
|
||||
* If the property does not exist, zero will be returned.
|
||||
* If the property exists but could not be scanned, an error will be logged and zero will be returned.
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
*
|
||||
* @return The value of the given property interpreted as an integer.
|
||||
* Zero if the property does not exist or could not be scanned.
|
||||
*/
|
||||
int getInt(const char* name = NULL) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a floating-point number.
|
||||
* If the property does not exist, zero will be returned.
|
||||
* If the property exists but could not be scanned, an error will be logged and zero will be returned.
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
*
|
||||
* @return The value of the given property interpreted as a float.
|
||||
* Zero if the property does not exist or could not be scanned.
|
||||
*/
|
||||
float getFloat(const char* name = NULL) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a long integer.
|
||||
* If the property does not exist, zero will be returned.
|
||||
* If the property exists but could not be scanned, an error will be logged and zero will be returned.
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
*
|
||||
* @return The value of the given property interpreted as a long.
|
||||
* Zero if the property does not exist or could not be scanned.
|
||||
*/
|
||||
long getLong(const char* name = NULL) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a Matrix.
|
||||
* If the property does not exist, out will be set to the identity matrix.
|
||||
* If the property exists but could not be scanned, an error will be logged and out will be set
|
||||
* to the identity matrix.
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param out The matrix to set to this property's interpreted value.
|
||||
*
|
||||
* @return True on success, false if the property does not exist or could not be scanned.
|
||||
*/
|
||||
bool getMat4(const char* name, Mat4* out) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a Vector2.
|
||||
* If the property does not exist, out will be set to Vector2(0.0f, 0.0f).
|
||||
* If the property exists but could not be scanned, an error will be logged and out will be set
|
||||
* to Vector2(0.0f, 0.0f).
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param out The vector to set to this property's interpreted value.
|
||||
*
|
||||
* @return True on success, false if the property does not exist or could not be scanned.
|
||||
*/
|
||||
bool getVec2(const char* name, Vec2* out) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a Vector3.
|
||||
* If the property does not exist, out will be set to Vector3(0.0f, 0.0f, 0.0f).
|
||||
* If the property exists but could not be scanned, an error will be logged and out will be set
|
||||
* to Vector3(0.0f, 0.0f, 0.0f).
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param out The vector to set to this property's interpreted value.
|
||||
*
|
||||
* @return True on success, false if the property does not exist or could not be scanned.
|
||||
*/
|
||||
bool getVec3(const char* name, Vec3* out) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a Vector4.
|
||||
* If the property does not exist, out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
|
||||
* If the property exists but could not be scanned, an error will be logged and out will be set
|
||||
* to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param out The vector to set to this property's interpreted value.
|
||||
*
|
||||
* @return True on success, false if the property does not exist or could not be scanned.
|
||||
*/
|
||||
bool getVec4(const char* name, Vec4* out) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as a Quaternion specified as an axis angle.
|
||||
* If the property does not exist, out will be set to Quaternion().
|
||||
* If the property exists but could not be scanned, an error will be logged and out will be set
|
||||
* to Quaternion().
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param out The quaternion to set to this property's interpreted value.
|
||||
*
|
||||
* @return True on success, false if the property does not exist or could not be scanned.
|
||||
*/
|
||||
bool getQuaternionFromAxisAngle(const char* name, Quaternion* out) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as an RGB color in hex and write this color to a Vector3.
|
||||
* E.g. 0xff0000 represents red and sets the vector to (1, 0, 0).
|
||||
* If the property does not exist, out will be set to Vector3(0.0f, 0.0f, 0.0f).
|
||||
* If the property exists but could not be scanned, an error will be logged and out will be set
|
||||
* to Vector3(0.0f, 0.0f, 0.0f).
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param out The vector to set to this property's interpreted value.
|
||||
*
|
||||
* @return True on success, false if the property does not exist or could not be scanned.
|
||||
*/
|
||||
bool getColor(const char* name, Vec3* out) const;
|
||||
|
||||
/**
|
||||
* Interpret the value of the given property as an RGBA color in hex and write this color to a Vector4.
|
||||
* E.g. 0xff0000ff represents opaque red and sets the vector to (1, 0, 0, 1).
|
||||
* If the property does not exist, out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
|
||||
* If the property exists but could not be scanned, an error will be logged and out will be set
|
||||
* to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
|
||||
*
|
||||
* @param name The name of the property to interpret, or NULL to return the current property's value.
|
||||
* @param out The vector to set to this property's interpreted value.
|
||||
*
|
||||
* @return True on success, false if the property does not exist or could not be scanned.
|
||||
*/
|
||||
bool getColor(const char* name, Vec4* out) const;
|
||||
|
||||
/**
|
||||
* Gets the file path for the given property if the file exists.
|
||||
*
|
||||
* This method will first search for the file relative to the working directory.
|
||||
* If the file is not found then it will search relative to the directory the bundle file is in.
|
||||
*
|
||||
* @param name The name of the property.
|
||||
* @param path The string to copy the path to if the file exists.
|
||||
*
|
||||
* @return True if the property exists and the file exists, false otherwise.
|
||||
*
|
||||
* @script{ignore}
|
||||
*/
|
||||
bool getPath(const char* name, std::string* path) const;
|
||||
|
||||
/**
|
||||
* Returns the value of a variable that is set in this Properties object.
|
||||
*
|
||||
* Variables take on the format ${name} and are inherited from parent Property objects.
|
||||
*
|
||||
* @param name Name of the variable to get.
|
||||
* @param defaultValue Value to return if the variable is not found.
|
||||
*
|
||||
* @return The value of the specified variable, or defaultValue if not found.
|
||||
*/
|
||||
const char* getVariable(const char* name, const char* defaultValue = NULL) const;
|
||||
|
||||
/**
|
||||
* Sets the value of the specified variable.
|
||||
*
|
||||
* @param name Name of the variable to set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
void setVariable(const char* name, const char* value);
|
||||
|
||||
/**
|
||||
* Attempts to parse the specified string as a Vector2 value.
|
||||
*
|
||||
* On error, false is returned and the output is set to all zero values.
|
||||
*
|
||||
* @param str The string to parse.
|
||||
* @param out The value to populate if successful.
|
||||
*
|
||||
* @return True if a valid Vector2 was parsed, false otherwise.
|
||||
*/
|
||||
static bool parseVec2(const char* str, Vec2* out);
|
||||
|
||||
/**
|
||||
* Attempts to parse the specified string as a Vector3 value.
|
||||
*
|
||||
* On error, false is returned and the output is set to all zero values.
|
||||
*
|
||||
* @param str The string to parse.
|
||||
* @param out The value to populate if successful.
|
||||
*
|
||||
* @return True if a valid Vector3 was parsed, false otherwise.
|
||||
*/
|
||||
static bool parseVec3(const char* str, Vec3* out);
|
||||
|
||||
/**
|
||||
* Attempts to parse the specified string as a Vector4 value.
|
||||
*
|
||||
* On error, false is returned and the output is set to all zero values.
|
||||
*
|
||||
* @param str The string to parse.
|
||||
* @param out The value to populate if successful.
|
||||
*
|
||||
* @return True if a valid Vector4 was parsed, false otherwise.
|
||||
*/
|
||||
static bool parseVec4(const char* str, Vec4* out);
|
||||
|
||||
/**
|
||||
* Attempts to parse the specified string as an axis-angle value.
|
||||
*
|
||||
* The specified string is expected to contain four comma-separated
|
||||
* values, where the first three values represents the axis and the
|
||||
* fourth value represents the angle, in degrees.
|
||||
*
|
||||
* On error, false is returned and the output is set to all zero values.
|
||||
*
|
||||
* @param str The string to parse.
|
||||
* @param out A Quaternion populated with the orientation of the axis-angle, if successful.
|
||||
*
|
||||
* @return True if a valid axis-angle was parsed, false otherwise.
|
||||
*/
|
||||
static bool parseAxisAngle(const char* str, Quaternion* out);
|
||||
|
||||
/**
|
||||
* Atempts to parse the specified string as an RGB color value.
|
||||
*
|
||||
* @param str The string to parse.
|
||||
* @param out The value to populate if successful.
|
||||
*
|
||||
* @return True if a valid RGB color was parsed, false otherwise.
|
||||
*/
|
||||
static bool parseColor(const char* str, Vec3* out);
|
||||
|
||||
/**
|
||||
* Atempts to parse the specified string as an RGBA color value.
|
||||
*
|
||||
* @param str The string to parse.
|
||||
* @param out The value to populate if successful.
|
||||
*
|
||||
* @return True if a valid RGBA color was parsed, false otherwise.
|
||||
*/
|
||||
static bool parseColor(const char* str, Vec4* out);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Internal structure containing a single property.
|
||||
*/
|
||||
struct Property
|
||||
{
|
||||
std::string name;
|
||||
std::string value;
|
||||
Property(const std::string& aname, const std::string& avalue) : name(aname), value(avalue) { }
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
Properties();
|
||||
|
||||
/**
|
||||
* Constructs the Properties class from a file.
|
||||
*
|
||||
* @param stream The stream used for reading the properties from file.
|
||||
*/
|
||||
Properties(Data* data, ssize_t* dataIdx);
|
||||
Properties(const Properties& copy);
|
||||
|
||||
/**
|
||||
* Constructor. Read from the beginning of namespace specified.
|
||||
*/
|
||||
Properties(Data* data, ssize_t* dataIdx, const std::string& name, const char* id, const char* parentID, Properties* parent);
|
||||
|
||||
// Data manipulation methods
|
||||
void readProperties();
|
||||
void skipWhiteSpace();
|
||||
char* trimWhiteSpace(char* str);
|
||||
signed char readChar();
|
||||
char* readLine(char* output, int num);
|
||||
bool seekFromCurrent(int offset);
|
||||
bool eof();
|
||||
|
||||
// Called after create(); copies info from parents into derived namespaces.
|
||||
void resolveInheritance(const char* id = NULL);
|
||||
|
||||
// Called by resolveInheritance().
|
||||
void mergeWith(Properties* overrides);
|
||||
|
||||
// Clones the Properties object.
|
||||
Properties* clone();
|
||||
|
||||
void setDirectoryPath(const std::string* path);
|
||||
void setDirectoryPath(const std::string& path);
|
||||
|
||||
/**
|
||||
* Reads the next character from the Data. Returns EOF if the end of the Data is reached.
|
||||
*/
|
||||
|
||||
// XXX: hack in order to simulate GamePlay's Stream with Cocos2d's Data
|
||||
ssize_t *_dataIdx;
|
||||
Data *_data;
|
||||
|
||||
std::string _namespace;
|
||||
std::string _id;
|
||||
std::string _parentID;
|
||||
std::list<Property> _properties;
|
||||
std::list<Property>::iterator _propertiesItr;
|
||||
std::vector<Properties*> _namespaces;
|
||||
std::vector<Properties*>::const_iterator _namespacesItr;
|
||||
std::vector<Property>* _variables;
|
||||
std::string* _dirPath;
|
||||
Properties* _parent;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cocos2d_libs__CCProperties__
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -245,7 +245,7 @@ public:
|
|||
|
||||
protected:
|
||||
UserDefault();
|
||||
~UserDefault();
|
||||
virtual ~UserDefault();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -8,10 +8,6 @@ endif()
|
|||
# todo: also base/CCController-android.cpp
|
||||
|
||||
set(COCOS_BASE_SRC
|
||||
base/allocator/CCAllocatorDiagnostics.cpp
|
||||
base/allocator/CCAllocatorGlobal.cpp
|
||||
base/allocator/CCAllocatorGlobalNewDelete.cpp
|
||||
base/ccFPSImages.c
|
||||
base/CCAsyncTaskPool.cpp
|
||||
base/CCAutoreleasePool.cpp
|
||||
base/CCConfiguration.cpp
|
||||
|
@ -40,6 +36,7 @@ set(COCOS_BASE_SRC
|
|||
base/CCIMEDispatcher.cpp
|
||||
base/CCNS.cpp
|
||||
base/CCProfiling.cpp
|
||||
base/CCProperties.cpp
|
||||
base/CCRef.cpp
|
||||
base/CCScheduler.cpp
|
||||
base/CCScriptSupport.cpp
|
||||
|
@ -49,9 +46,13 @@ set(COCOS_BASE_SRC
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_CC_BEGIN
|
|||
|
||||
CC_DLL const char* cocos2dVersion()
|
||||
{
|
||||
return "cocos2d-x 3.6";
|
||||
return "cocos2d-x 3.7-github";
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
200
cocos/cocos2d.h
200
cocos/cocos2d.h
|
@ -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
|
||||
|
@ -38,107 +38,108 @@ THE SOFTWARE.
|
|||
#include "base/ccConfig.h"
|
||||
|
||||
// base
|
||||
#include "base/CCAsyncTaskPool.h"
|
||||
#include "base/CCAutoreleasePool.h"
|
||||
#include "base/CCConfiguration.h"
|
||||
#include "base/CCConsole.h"
|
||||
#include "base/CCData.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCIMEDelegate.h"
|
||||
#include "base/CCIMEDispatcher.h"
|
||||
#include "base/CCMap.h"
|
||||
#include "base/CCNS.h"
|
||||
#include "base/CCProfiling.h"
|
||||
#include "base/CCProperties.h"
|
||||
#include "base/CCRef.h"
|
||||
#include "base/CCRefPtr.h"
|
||||
#include "base/CCVector.h"
|
||||
#include "base/CCMap.h"
|
||||
#include "base/CCAutoreleasePool.h"
|
||||
#include "base/CCNS.h"
|
||||
#include "base/CCData.h"
|
||||
#include "base/CCScheduler.h"
|
||||
#include "base/CCUserDefault.h"
|
||||
#include "base/CCValue.h"
|
||||
#include "base/CCVector.h"
|
||||
#include "base/ZipUtils.h"
|
||||
#include "base/base64.h"
|
||||
#include "base/ccConfig.h"
|
||||
#include "base/ccMacros.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "base/CCConfiguration.h"
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCScheduler.h"
|
||||
#include "base/base64.h"
|
||||
#include "base/ZipUtils.h"
|
||||
#include "base/CCProfiling.h"
|
||||
#include "base/CCConsole.h"
|
||||
#include "base/ccUTF8.h"
|
||||
#include "base/CCUserDefault.h"
|
||||
#include "base/CCIMEDelegate.h"
|
||||
#include "base/CCIMEDispatcher.h"
|
||||
#include "base/ccUtils.h"
|
||||
|
||||
// EventDispatcher
|
||||
#include "base/CCEventType.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventListenerTouch.h"
|
||||
#include "base/CCEventTouch.h"
|
||||
#include "base/CCEventListenerKeyboard.h"
|
||||
#include "base/CCEventKeyboard.h"
|
||||
#include "base/CCEventListenerMouse.h"
|
||||
#include "base/CCEventMouse.h"
|
||||
#include "base/CCEventAcceleration.h"
|
||||
#include "base/CCEventListenerAcceleration.h"
|
||||
#include "base/CCEventCustom.h"
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventDispatcher.h"
|
||||
#include "base/CCEventFocus.h"
|
||||
#include "base/CCEventKeyboard.h"
|
||||
#include "base/CCEventListenerAcceleration.h"
|
||||
#include "base/CCEventListenerCustom.h"
|
||||
#include "base/CCEventListenerFocus.h"
|
||||
#include "base/CCEventListenerKeyboard.h"
|
||||
#include "base/CCEventListenerMouse.h"
|
||||
#include "base/CCEventListenerTouch.h"
|
||||
#include "base/CCEventMouse.h"
|
||||
#include "base/CCEventTouch.h"
|
||||
#include "base/CCEventType.h"
|
||||
|
||||
// math
|
||||
#include "math/CCAffineTransform.h"
|
||||
#include "math/CCGeometry.h"
|
||||
#include "math/CCVertex.h"
|
||||
#include "math/Mat4.h"
|
||||
#include "math/MathUtil.h"
|
||||
#include "math/Quaternion.h"
|
||||
#include "math/Vec2.h"
|
||||
#include "math/Vec3.h"
|
||||
#include "math/Vec4.h"
|
||||
#include "math/Mat4.h"
|
||||
#include "math/Quaternion.h"
|
||||
#include "math/MathUtil.h"
|
||||
#include "math/CCVertex.h"
|
||||
|
||||
// actions
|
||||
#include "2d/CCAction.h"
|
||||
#include "2d/CCActionInterval.h"
|
||||
#include "2d/CCActionCamera.h"
|
||||
#include "2d/CCActionManager.h"
|
||||
#include "2d/CCActionEase.h"
|
||||
#include "2d/CCActionPageTurn3D.h"
|
||||
#include "2d/CCActionGrid.h"
|
||||
#include "2d/CCActionProgressTimer.h"
|
||||
#include "2d/CCActionGrid3D.h"
|
||||
#include "2d/CCActionTiledGrid.h"
|
||||
#include "2d/CCActionInstant.h"
|
||||
#include "2d/CCActionTween.h"
|
||||
#include "2d/CCActionCatmullRom.h"
|
||||
#include "2d/CCActionEase.h"
|
||||
#include "2d/CCActionGrid.h"
|
||||
#include "2d/CCActionGrid3D.h"
|
||||
#include "2d/CCActionInstant.h"
|
||||
#include "2d/CCActionInterval.h"
|
||||
#include "2d/CCActionManager.h"
|
||||
#include "2d/CCActionPageTurn3D.h"
|
||||
#include "2d/CCActionProgressTimer.h"
|
||||
#include "2d/CCActionTiledGrid.h"
|
||||
#include "2d/CCActionTween.h"
|
||||
#include "2d/CCTweenFunction.h"
|
||||
|
||||
// 2d nodes
|
||||
#include "2d/CCNode.h"
|
||||
#include "2d/CCProtectedNode.h"
|
||||
#include "2d/CCAtlasNode.h"
|
||||
#include "2d/CCDrawingPrimitives.h"
|
||||
#include "2d/CCClippingNode.h"
|
||||
#include "2d/CCClippingRectangleNode.h"
|
||||
#include "2d/CCDrawNode.h"
|
||||
#include "2d/CCLabelAtlas.h"
|
||||
#include "2d/CCLabelTTF.h"
|
||||
#include "2d/CCLabelBMFont.h"
|
||||
#include "2d/CCLabel.h"
|
||||
#include "2d/CCDrawingPrimitives.h"
|
||||
#include "2d/CCFontFNT.h"
|
||||
#include "2d/CCLabel.h"
|
||||
#include "2d/CCLabelAtlas.h"
|
||||
#include "2d/CCLabelBMFont.h"
|
||||
#include "2d/CCLabelTTF.h"
|
||||
#include "2d/CCLayer.h"
|
||||
#include "2d/CCMenu.h"
|
||||
#include "2d/CCMenuItem.h"
|
||||
#include "2d/CCMotionStreak.h"
|
||||
#include "2d/CCNode.h"
|
||||
#include "2d/CCNodeGrid.h"
|
||||
#include "2d/CCParticleBatchNode.h"
|
||||
#include "2d/CCParticleExamples.h"
|
||||
#include "2d/CCParticleSystem.h"
|
||||
#include "2d/CCParticleSystemQuad.h"
|
||||
#include "2d/CCProgressTimer.h"
|
||||
#include "2d/CCProtectedNode.h"
|
||||
#include "2d/CCRenderTexture.h"
|
||||
#include "2d/CCScene.h"
|
||||
#include "2d/CCTransition.h"
|
||||
#include "2d/CCTransitionPageTurn.h"
|
||||
#include "2d/CCTransitionProgress.h"
|
||||
#include "2d/CCMenu.h"
|
||||
#include "2d/CCMenuItem.h"
|
||||
#include "2d/CCClippingNode.h"
|
||||
#include "2d/CCClippingRectangleNode.h"
|
||||
#include "2d/CCMotionStreak.h"
|
||||
#include "2d/CCProgressTimer.h"
|
||||
#include "2d/CCRenderTexture.h"
|
||||
#include "2d/CCNodeGrid.h"
|
||||
#include "2d/CCParticleBatchNode.h"
|
||||
#include "2d/CCParticleSystem.h"
|
||||
#include "2d/CCParticleExamples.h"
|
||||
#include "2d/CCParticleSystemQuad.h"
|
||||
|
||||
// 2d utils
|
||||
#include "2d/CCCamera.h"
|
||||
#include "2d/CCGrabber.h"
|
||||
#include "2d/CCGrid.h"
|
||||
|
||||
#include "2d/CCCamera.h"
|
||||
#include "2d/CCLight.h"
|
||||
|
||||
// include
|
||||
|
@ -146,40 +147,45 @@ THE SOFTWARE.
|
|||
|
||||
// renderer
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
#include "renderer/CCGroupCommand.h"
|
||||
#include "renderer/CCQuadCommand.h"
|
||||
#include "renderer/CCRenderCommand.h"
|
||||
#include "renderer/CCRenderCommandPool.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCGLProgram.h"
|
||||
#include "renderer/CCGLProgramCache.h"
|
||||
#include "renderer/CCGLProgramState.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
#include "renderer/ccShaders.h"
|
||||
#include "renderer/CCTexture2D.h"
|
||||
#include "renderer/CCTextureCache.h"
|
||||
#include "renderer/CCVertexIndexBuffer.h"
|
||||
#include "renderer/CCVertexIndexData.h"
|
||||
#include "renderer/CCGroupCommand.h"
|
||||
#include "renderer/CCMaterial.h"
|
||||
#include "renderer/CCPass.h"
|
||||
#include "renderer/CCPrimitive.h"
|
||||
#include "renderer/CCPrimitiveCommand.h"
|
||||
#include "renderer/CCQuadCommand.h"
|
||||
#include "renderer/CCRenderCommand.h"
|
||||
#include "renderer/CCRenderCommandPool.h"
|
||||
#include "renderer/CCRenderState.h"
|
||||
#include "renderer/CCRenderer.h"
|
||||
#include "renderer/CCTechnique.h"
|
||||
#include "renderer/CCTexture2D.h"
|
||||
#include "renderer/CCTextureCache.h"
|
||||
#include "renderer/CCTrianglesCommand.h"
|
||||
#include "renderer/CCVertexAttribBinding.h"
|
||||
#include "renderer/CCVertexIndexBuffer.h"
|
||||
#include "renderer/CCVertexIndexData.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
#include "renderer/ccShaders.h"
|
||||
|
||||
// physics
|
||||
#include "physics/CCPhysicsBody.h"
|
||||
#include "physics/CCPhysicsContact.h"
|
||||
#include "physics/CCPhysicsShape.h"
|
||||
#include "physics/CCPhysicsJoint.h"
|
||||
#include "physics/CCPhysicsShape.h"
|
||||
#include "physics/CCPhysicsWorld.h"
|
||||
|
||||
// platform
|
||||
#include "platform/CCDevice.h"
|
||||
#include "platform/CCCommon.h"
|
||||
#include "platform/CCDevice.h"
|
||||
#include "platform/CCFileUtils.h"
|
||||
#include "platform/CCImage.h"
|
||||
#include "platform/CCSAXParser.h"
|
||||
#include "platform/CCThread.h"
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "platform/CCSAXParser.h"
|
||||
#include "platform/CCThread.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||
#include "platform/ios/CCApplication-ios.h"
|
||||
|
@ -230,14 +236,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"
|
||||
|
||||
|
@ -262,8 +260,8 @@ THE SOFTWARE.
|
|||
#include "2d/CCTMXTiledMap.h"
|
||||
#include "2d/CCTMXXMLParser.h"
|
||||
#include "2d/CCTileMapAtlas.h"
|
||||
#include "2d/CCFastTMXTiledMap.h"
|
||||
#include "2d/CCFastTMXLayer.h"
|
||||
#include "2d/CCFastTMXTiledMap.h"
|
||||
|
||||
// component
|
||||
#include "2d/CCComponent.h"
|
||||
|
@ -271,34 +269,34 @@ THE SOFTWARE.
|
|||
|
||||
//3d
|
||||
#include "3d/CCAABB.h"
|
||||
#include "3d/CCOBB.h"
|
||||
#include "3d/CCRay.h"
|
||||
#include "3d/CCSprite3D.h"
|
||||
#include "3d/CCMesh.h"
|
||||
#include "3d/CCMeshSkin.h"
|
||||
#include "3d/CCAnimate3D.h"
|
||||
#include "3d/CCAnimation3D.h"
|
||||
#include "3d/CCSprite3DMaterial.h"
|
||||
#include "3d/CCAttachNode.h"
|
||||
#include "3d/CCMeshVertexIndexData.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
#include "3d/CCBillBoard.h"
|
||||
#include "3d/CCFrustum.h"
|
||||
#include "3d/CCMesh.h"
|
||||
#include "3d/CCMeshSkin.h"
|
||||
#include "3d/CCMeshVertexIndexData.h"
|
||||
#include "3d/CCOBB.h"
|
||||
#include "3d/CCPlane.h"
|
||||
#include "3d/CCTextureCube.h"
|
||||
#include "3d/CCRay.h"
|
||||
#include "3d/CCSkeleton3D.h"
|
||||
#include "3d/CCSkybox.h"
|
||||
#include "3d/CCSprite3D.h"
|
||||
#include "3d/CCSprite3DMaterial.h"
|
||||
#include "3d/CCTerrain.h"
|
||||
#include "3d/CCTextureCube.h"
|
||||
|
||||
// Deprecated include
|
||||
#include "deprecated/CCDictionary.h"
|
||||
#include "deprecated/CCArray.h"
|
||||
#include "deprecated/CCSet.h"
|
||||
#include "deprecated/CCInteger.h"
|
||||
#include "deprecated/CCFloat.h"
|
||||
#include "deprecated/CCDouble.h"
|
||||
#include "deprecated/CCBool.h"
|
||||
#include "deprecated/CCString.h"
|
||||
#include "deprecated/CCDictionary.h"
|
||||
#include "deprecated/CCDouble.h"
|
||||
#include "deprecated/CCFloat.h"
|
||||
#include "deprecated/CCInteger.h"
|
||||
#include "deprecated/CCNotificationCenter.h"
|
||||
#include "deprecated/CCSet.h"
|
||||
#include "deprecated/CCString.h"
|
||||
// CCDeprecated.h must be included at the end
|
||||
#include "deprecated/CCDeprecated.h"
|
||||
|
||||
|
|
|
@ -131,11 +131,6 @@ public:
|
|||
MULTIPLY_RESOLUTION,
|
||||
};
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
#ifdef ABSOLUTE
|
||||
#undef ABSOLUTE
|
||||
#endif
|
||||
#endif
|
||||
enum class SizeType
|
||||
{
|
||||
ABSOLUTE,
|
||||
|
|
|
@ -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;
|
||||
|
@ -400,7 +400,7 @@ void PositionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
|
|||
|
||||
void PositionFrame::onApply(float percent)
|
||||
{
|
||||
if (nullptr != _node && (_betweenX != 0 || _betweenY != 0))
|
||||
if ((nullptr != _node) && (_betweenX != 0 || _betweenY != 0))
|
||||
{
|
||||
Point p;
|
||||
p.x = _position.x + _betweenX * percent;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -83,21 +83,19 @@
|
|||
<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>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<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>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "SocketIO.h"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include "base/CCDirector.h"
|
||||
#include "base/CCScheduler.h"
|
||||
#include "WebSocket.h"
|
||||
#include "HttpClient.h"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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__
|
|
@ -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
|
|
@ -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__
|
|
@ -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() const
|
||||
{
|
||||
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
|
||||
{
|
||||
const auto& trans = static_cast<btHingeConstraint*>(_constraint)->getAFrame();
|
||||
return convertbtTransformToMat4(trans);
|
||||
}
|
||||
cocos2d::Mat4 Physics3DHingeConstraint::getBFrame() const
|
||||
{
|
||||
const auto& trans = static_cast<btHingeConstraint*>(_constraint)->getBFrame();
|
||||
return convertbtTransformToMat4(trans);
|
||||
}
|
||||
|
||||
bool Physics3DHingeConstraint::getAngularOnly() const
|
||||
{
|
||||
return static_cast<btHingeConstraint*>(_constraint)->getAngularOnly();
|
||||
}
|
||||
bool Physics3DHingeConstraint::getEnableAngularMotor() const
|
||||
{
|
||||
return static_cast<btHingeConstraint*>(_constraint)->getEnableAngularMotor();
|
||||
}
|
||||
float Physics3DHingeConstraint::getMotorTargetVelosity() const
|
||||
{
|
||||
return static_cast<btHingeConstraint*>(_constraint)->getMotorTargetVelosity();
|
||||
}
|
||||
float Physics3DHingeConstraint::getMaxMotorImpulse() const
|
||||
{
|
||||
return static_cast<btHingeConstraint*>(_constraint)->getMaxMotorImpulse();
|
||||
}
|
||||
|
||||
bool Physics3DHingeConstraint::getUseFrameOffset() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getLowerLinLimit();
|
||||
}
|
||||
void Physics3DSliderConstraint::setLowerLinLimit(float lowerLimit)
|
||||
{
|
||||
static_cast<btSliderConstraint*>(_constraint)->setLowerLinLimit(lowerLimit);
|
||||
}
|
||||
float Physics3DSliderConstraint::getUpperLinLimit() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getUpperLinLimit();
|
||||
}
|
||||
void Physics3DSliderConstraint::setUpperLinLimit(float upperLimit)
|
||||
{
|
||||
static_cast<btSliderConstraint*>(_constraint)->setUpperLinLimit(upperLimit);
|
||||
}
|
||||
float Physics3DSliderConstraint::getLowerAngLimit() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getLowerAngLimit();
|
||||
}
|
||||
void Physics3DSliderConstraint::setLowerAngLimit(float lowerLimit)
|
||||
{
|
||||
static_cast<btSliderConstraint*>(_constraint)->setLowerAngLimit(lowerLimit);
|
||||
}
|
||||
float Physics3DSliderConstraint::getUpperAngLimit() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getUpperAngLimit();
|
||||
}
|
||||
void Physics3DSliderConstraint::setUpperAngLimit(float upperLimit)
|
||||
{
|
||||
static_cast<btSliderConstraint*>(_constraint)->setUpperAngLimit(upperLimit);
|
||||
}
|
||||
bool Physics3DSliderConstraint::getUseLinearReferenceFrameA() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getUseLinearReferenceFrameA();
|
||||
}
|
||||
float Physics3DSliderConstraint::getSoftnessDirLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessDirLin();
|
||||
}
|
||||
float Physics3DSliderConstraint::getRestitutionDirLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionDirLin();
|
||||
}
|
||||
float Physics3DSliderConstraint::getDampingDirLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getDampingDirLin();
|
||||
}
|
||||
float Physics3DSliderConstraint::getSoftnessDirAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessDirAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getRestitutionDirAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionDirAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getDampingDirAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getDampingDirAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getSoftnessLimLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessLimLin();
|
||||
}
|
||||
float Physics3DSliderConstraint::getRestitutionLimLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionLimLin();
|
||||
}
|
||||
float Physics3DSliderConstraint::getDampingLimLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getDampingLimAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getSoftnessLimAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessLimAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getRestitutionLimAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionLimAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getDampingLimAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getDampingLimAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getSoftnessOrthoLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessOrthoLin();
|
||||
}
|
||||
float Physics3DSliderConstraint::getRestitutionOrthoLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionOrthoAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getDampingOrthoLin() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getDampingOrthoLin();
|
||||
}
|
||||
float Physics3DSliderConstraint::getSoftnessOrthoAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getSoftnessOrthoAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getRestitutionOrthoAng() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getRestitutionOrthoAng();
|
||||
}
|
||||
float Physics3DSliderConstraint::getDampingOrthoAng() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getPoweredLinMotor();
|
||||
}
|
||||
void Physics3DSliderConstraint::setTargetLinMotorVelocity(float targetLinMotorVelocity)
|
||||
{
|
||||
static_cast<btSliderConstraint*>(_constraint)->setTargetLinMotorVelocity(targetLinMotorVelocity);
|
||||
}
|
||||
float Physics3DSliderConstraint::getTargetLinMotorVelocity() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getTargetLinMotorVelocity();
|
||||
}
|
||||
void Physics3DSliderConstraint::setMaxLinMotorForce(float maxLinMotorForce)
|
||||
{
|
||||
static_cast<btSliderConstraint*>(_constraint)->setMaxLinMotorForce(maxLinMotorForce);
|
||||
}
|
||||
float Physics3DSliderConstraint::getMaxLinMotorForce() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getMaxLinMotorForce();
|
||||
}
|
||||
void Physics3DSliderConstraint::setPoweredAngMotor(bool onOff)
|
||||
{
|
||||
static_cast<btSliderConstraint*>(_constraint)->setPoweredAngMotor(onOff);
|
||||
}
|
||||
bool Physics3DSliderConstraint::getPoweredAngMotor() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getPoweredAngMotor();
|
||||
}
|
||||
void Physics3DSliderConstraint::setTargetAngMotorVelocity(float targetAngMotorVelocity)
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->setTargetAngMotorVelocity(targetAngMotorVelocity);
|
||||
}
|
||||
float Physics3DSliderConstraint::getTargetAngMotorVelocity() const
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->getTargetAngMotorVelocity();
|
||||
}
|
||||
void Physics3DSliderConstraint::setMaxAngMotorForce(float maxAngMotorForce)
|
||||
{
|
||||
return static_cast<btSliderConstraint*>(_constraint)->setMaxAngMotorForce(maxAngMotorForce);
|
||||
}
|
||||
float Physics3DSliderConstraint::getMaxAngMotorForce() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
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
|
||||
{
|
||||
const auto& frame = static_cast<btConeTwistConstraint*>(_constraint)->getAFrame();
|
||||
return convertbtTransformToMat4(frame);
|
||||
}
|
||||
cocos2d::Mat4 Physics3DConeTwistConstraint::getBFrame() const
|
||||
{
|
||||
const auto& frame = static_cast<btConeTwistConstraint*>(_constraint)->getBFrame();
|
||||
return convertbtTransformToMat4(frame);
|
||||
}
|
||||
|
||||
float Physics3DConeTwistConstraint::getSwingSpan1() const
|
||||
{
|
||||
return static_cast<btConeTwistConstraint*>(_constraint)->getSwingSpan1();
|
||||
}
|
||||
float Physics3DConeTwistConstraint::getSwingSpan2() const
|
||||
{
|
||||
return static_cast<btConeTwistConstraint*>(_constraint)->getSwingSpan2();
|
||||
}
|
||||
float Physics3DConeTwistConstraint::getTwistSpan() const
|
||||
{
|
||||
return static_cast<btConeTwistConstraint*>(_constraint)->getTwistSpan();
|
||||
}
|
||||
float Physics3DConeTwistConstraint::getTwistAngle() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
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() const
|
||||
{
|
||||
btVector3 upper;
|
||||
static_cast<btGeneric6DofConstraint*>(_constraint)->getAngularUpperLimit(upper);
|
||||
return convertbtVector3ToVec3(upper);
|
||||
}
|
||||
|
||||
bool Physics3D6DofConstraint::isLimited(int limitIndex) const
|
||||
{
|
||||
return static_cast<btGeneric6DofConstraint*>(_constraint)->isLimited(limitIndex);
|
||||
}
|
||||
|
||||
bool Physics3D6DofConstraint::getUseFrameOffset() const
|
||||
{
|
||||
return static_cast<btGeneric6DofConstraint*>(_constraint)->getUseFrameOffset();
|
||||
}
|
||||
void Physics3D6DofConstraint::setUseFrameOffset(bool frameOffsetOnOff) const
|
||||
{
|
||||
static_cast<btGeneric6DofConstraint*>(_constraint)->setUseFrameOffset(frameOffsetOnOff);
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // CC_ENABLE_BULLET_INTEGRATION
|
||||
|
||||
#endif //CC_USE_3D_PHYSICS
|
|
@ -0,0 +1,593 @@
|
|||
/****************************************************************************
|
||||
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() const;
|
||||
/**get hinge angle*/
|
||||
float getHingeAngle(const cocos2d::Mat4& transA, const cocos2d::Mat4& transB);
|
||||
|
||||
/**get A's frame */
|
||||
cocos2d::Mat4 getAFrame() const;
|
||||
/**get B's frame*/
|
||||
cocos2d::Mat4 getBFrame() const;
|
||||
/**get angular only*/
|
||||
bool getAngularOnly() const;
|
||||
/**get enable angular motor*/
|
||||
bool getEnableAngularMotor() const;
|
||||
/**get motor target velosity*/
|
||||
float getMotorTargetVelosity() const;
|
||||
/**get max motor impulse*/
|
||||
float getMaxMotorImpulse() const;
|
||||
|
||||
/** access for UseFrameOffset*/
|
||||
bool getUseFrameOffset() const;
|
||||
/**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() const;
|
||||
/**set lower linear limit*/
|
||||
void setLowerLinLimit(float lowerLimit);
|
||||
/**get upper linear limit*/
|
||||
float getUpperLinLimit() const;
|
||||
/**set upper linear limit*/
|
||||
void setUpperLinLimit(float upperLimit);
|
||||
/**get lower angular limit*/
|
||||
float getLowerAngLimit() const;
|
||||
/**set lower angualr limit*/
|
||||
void setLowerAngLimit(float lowerLimit);
|
||||
/**get upper anglular limit*/
|
||||
float getUpperAngLimit() const;
|
||||
/**set upper anglular limit*/
|
||||
void setUpperAngLimit(float upperLimit);
|
||||
/**use A's frame as linear refference*/
|
||||
bool getUseLinearReferenceFrameA() const;
|
||||
|
||||
float getSoftnessDirLin() const;
|
||||
float getRestitutionDirLin() const;
|
||||
float getDampingDirLin() const;
|
||||
float getSoftnessDirAng() const;
|
||||
float getRestitutionDirAng() const;
|
||||
float getDampingDirAng() const;
|
||||
float getSoftnessLimLin() const;
|
||||
float getRestitutionLimLin() const;
|
||||
float getDampingLimLin() const;
|
||||
float getSoftnessLimAng() const;
|
||||
float getRestitutionLimAng() const;
|
||||
float getDampingLimAng() const;
|
||||
float getSoftnessOrthoLin() const;
|
||||
float getRestitutionOrthoLin() const;
|
||||
float getDampingOrthoLin() const;
|
||||
float getSoftnessOrthoAng() const;
|
||||
float getRestitutionOrthoAng() const;
|
||||
float getDampingOrthoAng() const;
|
||||
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() const;
|
||||
void setTargetLinMotorVelocity(float targetLinMotorVelocity);
|
||||
float getTargetLinMotorVelocity() const;
|
||||
void setMaxLinMotorForce(float maxLinMotorForce);
|
||||
float getMaxLinMotorForce() const;
|
||||
void setPoweredAngMotor(bool onOff);
|
||||
bool getPoweredAngMotor() const;
|
||||
void setTargetAngMotorVelocity(float targetAngMotorVelocity);
|
||||
float getTargetAngMotorVelocity() const;
|
||||
void setMaxAngMotorForce(float maxAngMotorForce);
|
||||
float getMaxAngMotorForce() const;
|
||||
|
||||
float getLinearPos() const;
|
||||
float getAngularPos() const;
|
||||
|
||||
/** access for UseFrameOffset*/
|
||||
bool getUseFrameOffset() const;
|
||||
/**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() const;
|
||||
/**get B's frame*/
|
||||
cocos2d::Mat4 getBFrame() const;
|
||||
|
||||
/**get swing span1*/
|
||||
float getSwingSpan1() const;
|
||||
/**get swing span2*/
|
||||
float getSwingSpan2() const;
|
||||
/**get twist span*/
|
||||
float getTwistSpan() const;
|
||||
/**get twist angle*/
|
||||
float getTwistAngle() const;
|
||||
|
||||
/**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() const;
|
||||
/**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() const;
|
||||
|
||||
/**set linear upper limit*/
|
||||
void setLinearUpperLimit(const cocos2d::Vec3& linearUpper);
|
||||
|
||||
/**get linear upper limit*/
|
||||
cocos2d::Vec3 getLinearUpperLimit() const;
|
||||
|
||||
/**set angular lower limit*/
|
||||
void setAngularLowerLimit(const cocos2d::Vec3& angularLower);
|
||||
|
||||
/**get angular lower limit*/
|
||||
cocos2d::Vec3 getAngularLowerLimit() const;
|
||||
|
||||
/**set angular upper limit*/
|
||||
void setAngularUpperLimit(const cocos2d::Vec3& angularUpper);
|
||||
|
||||
/**get angular upper limit*/
|
||||
cocos2d::Vec3 getAngularUpperLimit() const;
|
||||
|
||||
/**
|
||||
* is limited?
|
||||
* @param limitIndex first 3 are linear, next 3 are angular
|
||||
*/
|
||||
bool isLimited(int limitIndex) const;
|
||||
|
||||
/** access for UseFrameOffset*/
|
||||
bool getUseFrameOffset() const;
|
||||
/**set use frame offset*/
|
||||
void setUseFrameOffset(bool frameOffsetOnOff) const;
|
||||
|
||||
|
||||
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__
|
|
@ -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
|
|
@ -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__
|
|
@ -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
|
|
@ -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__
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue