From c782d63befffa78d4a4fbf4fb39dbe677abf11ca Mon Sep 17 00:00:00 2001 From: yangxiao Date: Fri, 29 May 2015 16:45:33 +0800 Subject: [PATCH] add 3d navigation --- CMakeLists.txt | 17 + build/cocos2d-win32.sln | 12 +- build/cocos2d_libs.xcodeproj/project.pbxproj | 367 ++++++ build/cocos2d_tests.xcodeproj/project.pbxproj | 27 + cocos/2d/CCScene.cpp | 76 +- cocos/2d/CCScene.h | 27 +- cocos/2d/libcocos2d.vcxproj | 13 + cocos/2d/libcocos2d.vcxproj.filters | 33 + cocos/Android.mk | 7 + cocos/CMakeLists.txt | 6 + cocos/base/CCDirector.cpp | 11 + cocos/base/ccConfig.h | 5 + cocos/navmesh/CCNavMesh.cpp | 637 ++++++++++ cocos/navmesh/CCNavMesh.h | 139 +++ cocos/navmesh/CCNavMeshAgent.cpp | 408 +++++++ cocos/navmesh/CCNavMeshAgent.h | 239 ++++ cocos/navmesh/CCNavMeshDebugDraw.cpp | 183 +++ cocos/navmesh/CCNavMeshDebugDraw.h | 109 ++ cocos/navmesh/CCNavMeshObstacle.cpp | 148 +++ cocos/navmesh/CCNavMeshObstacle.h | 123 ++ cocos/navmesh/CCNavMeshTool.cpp | 289 +++++ cocos/navmesh/CCNavMeshTool.h | 135 +++ cocos/navmesh/CMakeLists.txt | 9 + tests/cpp-tests/CMakeLists.txt | 1 + .../Classes/NavMeshTest/NavMeshTest.cpp | 440 +++++++ .../Classes/NavMeshTest/NavMeshTest.h | 124 ++ tests/cpp-tests/Classes/controller.cpp | 1 + tests/cpp-tests/Classes/tests.h | 1 + .../Resources/NavMesh/all_tiles_tilecache.bin | Bin 0 -> 20240 bytes tests/cpp-tests/Resources/NavMesh/geomset.txt | 6 + .../Resources/NavMesh/maps/scenetex.png | Bin 0 -> 196 bytes tests/cpp-tests/Resources/NavMesh/scene.mtl | 15 + tests/cpp-tests/Resources/NavMesh/scene.obj | 1063 +++++++++++++++++ tests/cpp-tests/proj.android/jni/Android.mk | 1 + tests/cpp-tests/proj.win32/cpp-tests.vcxproj | 2 + .../proj.win32/cpp-tests.vcxproj.filters | 9 + tools/tojs/cocos2dx.ini | 2 +- tools/tolua/cocos2dx.ini | 2 +- 38 files changed, 4680 insertions(+), 7 deletions(-) create mode 100644 cocos/navmesh/CCNavMesh.cpp create mode 100644 cocos/navmesh/CCNavMesh.h create mode 100644 cocos/navmesh/CCNavMeshAgent.cpp create mode 100644 cocos/navmesh/CCNavMeshAgent.h create mode 100644 cocos/navmesh/CCNavMeshDebugDraw.cpp create mode 100644 cocos/navmesh/CCNavMeshDebugDraw.h create mode 100644 cocos/navmesh/CCNavMeshObstacle.cpp create mode 100644 cocos/navmesh/CCNavMeshObstacle.h create mode 100644 cocos/navmesh/CCNavMeshTool.cpp create mode 100644 cocos/navmesh/CCNavMeshTool.h create mode 100644 cocos/navmesh/CMakeLists.txt create mode 100644 tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp create mode 100644 tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h create mode 100644 tests/cpp-tests/Resources/NavMesh/all_tiles_tilecache.bin create mode 100644 tests/cpp-tests/Resources/NavMesh/geomset.txt create mode 100644 tests/cpp-tests/Resources/NavMesh/maps/scenetex.png create mode 100644 tests/cpp-tests/Resources/NavMesh/scene.mtl create mode 100644 tests/cpp-tests/Resources/NavMesh/scene.obj diff --git a/CMakeLists.txt b/CMakeLists.txt index dad20ba10b49..b9c4f058d491 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ 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_RECAST "Use Recast for navigation mesh" 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) @@ -267,6 +268,22 @@ else() add_definitions(-DCC_USE_3D_PHYSICS=0) endif(USE_BULLET) +# Recast (not prebuilded, exists as source) +if(USE_RECAST) + if(USE_PREBUILT_LIBS) + add_subdirectory(external/recast) + set(RECAST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external/recast) + set(RECAST_LIBRARIES recast) + else() + cocos_find_package(recast RECAST REQUIRED) + set(RECAST_LIBRARIES recast) + endif() + message(STATUS "Recast include dirs: ${RECAST_INCLUDE_DIRS}") + add_definitions(-DCC_USE_NAVMESH=1) +else() + add_definitions(-DCC_USE_NAVMESH=0) +endif(USE_RECAST) + # Tinyxml2 (not prebuilded, exists as source) if(USE_PREBUILT_LIBS) add_subdirectory(external/tinyxml2) diff --git a/build/cocos2d-win32.sln b/build/cocos2d-win32.sln index bf1f8bb66ae2..0e4094696eec 100644 --- a/build/cocos2d-win32.sln +++ b/build/cocos2d-win32.sln @@ -1,7 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 # Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +VisualStudioVersion = 12.0.31101.0 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 @@ -26,6 +25,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\external\Box EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet", "..\external\bullet\proj.win32\libbullet.vcxproj", "{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librecast", "..\external\recast\proj.win32\librecast.vcxproj", "{41E34993-647E-4282-8384-4AB1AE31A452}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM = Debug|ARM @@ -88,6 +89,12 @@ Global {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 + {41E34993-647E-4282-8384-4AB1AE31A452}.Debug|ARM.ActiveCfg = Debug|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.ActiveCfg = Debug|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.Build.0 = Debug|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Release|ARM.ActiveCfg = Release|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.ActiveCfg = Release|Win32 + {41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -96,6 +103,7 @@ Global {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} + {41E34993-647E-4282-8384-4AB1AE31A452} = {92D54E36-7916-48EF-A951-224DD3B25442} EndGlobalSection GlobalSection(DPCodeReviewSolutionGUID) = preSolution DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 87be2384e60c..9fcc576aaa38 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -2609,6 +2609,26 @@ B665E43B1AA80A6600DDB1C5 /* CCPUVortexAffectorTranslator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B665E1F01AA80A6500DDB1C5 /* CCPUVortexAffectorTranslator.cpp */; }; B665E43C1AA80A6600DDB1C5 /* CCPUVortexAffectorTranslator.h in Headers */ = {isa = PBXBuildFile; fileRef = B665E1F11AA80A6500DDB1C5 /* CCPUVortexAffectorTranslator.h */; }; B665E43D1AA80A6600DDB1C5 /* CCPUVortexAffectorTranslator.h in Headers */ = {isa = PBXBuildFile; fileRef = B665E1F11AA80A6500DDB1C5 /* CCPUVortexAffectorTranslator.h */; }; + B677B0C91B18492D006762CB /* CCNavMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0BF1B18492D006762CB /* CCNavMesh.cpp */; }; + B677B0CA1B18492D006762CB /* CCNavMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0BF1B18492D006762CB /* CCNavMesh.cpp */; }; + B677B0CB1B18492D006762CB /* CCNavMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C01B18492D006762CB /* CCNavMesh.h */; }; + B677B0CC1B18492D006762CB /* CCNavMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C01B18492D006762CB /* CCNavMesh.h */; }; + B677B0CD1B18492D006762CB /* CCNavMeshAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C11B18492D006762CB /* CCNavMeshAgent.cpp */; }; + B677B0CE1B18492D006762CB /* CCNavMeshAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C11B18492D006762CB /* CCNavMeshAgent.cpp */; }; + B677B0CF1B18492D006762CB /* CCNavMeshAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C21B18492D006762CB /* CCNavMeshAgent.h */; }; + B677B0D01B18492D006762CB /* CCNavMeshAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C21B18492D006762CB /* CCNavMeshAgent.h */; }; + B677B0D11B18492D006762CB /* CCNavMeshDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C31B18492D006762CB /* CCNavMeshDebugDraw.cpp */; }; + B677B0D21B18492D006762CB /* CCNavMeshDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C31B18492D006762CB /* CCNavMeshDebugDraw.cpp */; }; + B677B0D31B18492D006762CB /* CCNavMeshDebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C41B18492D006762CB /* CCNavMeshDebugDraw.h */; }; + B677B0D41B18492D006762CB /* CCNavMeshDebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C41B18492D006762CB /* CCNavMeshDebugDraw.h */; }; + B677B0D51B18492D006762CB /* CCNavMeshObstacle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C51B18492D006762CB /* CCNavMeshObstacle.cpp */; }; + B677B0D61B18492D006762CB /* CCNavMeshObstacle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C51B18492D006762CB /* CCNavMeshObstacle.cpp */; }; + B677B0D71B18492D006762CB /* CCNavMeshObstacle.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C61B18492D006762CB /* CCNavMeshObstacle.h */; }; + B677B0D81B18492D006762CB /* CCNavMeshObstacle.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C61B18492D006762CB /* CCNavMeshObstacle.h */; }; + B677B0D91B18492D006762CB /* CCNavMeshTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C71B18492D006762CB /* CCNavMeshTool.cpp */; }; + B677B0DA1B18492D006762CB /* CCNavMeshTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B677B0C71B18492D006762CB /* CCNavMeshTool.cpp */; }; + B677B0DB1B18492D006762CB /* CCNavMeshTool.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C81B18492D006762CB /* CCNavMeshTool.h */; }; + B677B0DC1B18492D006762CB /* CCNavMeshTool.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C81B18492D006762CB /* CCNavMeshTool.h */; }; B68778F81A8CA82E00643ABF /* CCParticle3DAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B68778F01A8CA82E00643ABF /* CCParticle3DAffector.cpp */; }; B68778F91A8CA82E00643ABF /* CCParticle3DAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B68778F01A8CA82E00643ABF /* CCParticle3DAffector.cpp */; }; B68778FA1A8CA82E00643ABF /* CCParticle3DAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = B68778F11A8CA82E00643ABF /* CCParticle3DAffector.h */; }; @@ -3459,6 +3479,88 @@ B6D38B8F1AC3AFAC00043997 /* CCTextureCube.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D38B881AC3AFAC00043997 /* CCTextureCube.cpp */; }; B6D38B901AC3AFAC00043997 /* CCTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D38B891AC3AFAC00043997 /* CCTextureCube.h */; }; B6D38B911AC3AFAC00043997 /* CCTextureCube.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D38B891AC3AFAC00043997 /* CCTextureCube.h */; }; + B6DD2FA71B04825B00E47F5F /* DebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F7A1B04825B00E47F5F /* DebugDraw.cpp */; }; + B6DD2FA81B04825B00E47F5F /* DebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F7A1B04825B00E47F5F /* DebugDraw.cpp */; }; + B6DD2FA91B04825B00E47F5F /* DebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F7B1B04825B00E47F5F /* DebugDraw.h */; }; + B6DD2FAA1B04825B00E47F5F /* DebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F7B1B04825B00E47F5F /* DebugDraw.h */; }; + B6DD2FAB1B04825B00E47F5F /* DetourDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F7C1B04825B00E47F5F /* DetourDebugDraw.cpp */; }; + B6DD2FAC1B04825B00E47F5F /* DetourDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F7C1B04825B00E47F5F /* DetourDebugDraw.cpp */; }; + B6DD2FAD1B04825B00E47F5F /* DetourDebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F7D1B04825B00E47F5F /* DetourDebugDraw.h */; }; + B6DD2FAE1B04825B00E47F5F /* DetourDebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F7D1B04825B00E47F5F /* DetourDebugDraw.h */; }; + B6DD2FAF1B04825B00E47F5F /* RecastDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F7E1B04825B00E47F5F /* RecastDebugDraw.cpp */; }; + B6DD2FB01B04825B00E47F5F /* RecastDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F7E1B04825B00E47F5F /* RecastDebugDraw.cpp */; }; + B6DD2FB11B04825B00E47F5F /* RecastDebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F7F1B04825B00E47F5F /* RecastDebugDraw.h */; }; + B6DD2FB21B04825B00E47F5F /* RecastDebugDraw.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F7F1B04825B00E47F5F /* RecastDebugDraw.h */; }; + B6DD2FB31B04825B00E47F5F /* RecastDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F801B04825B00E47F5F /* RecastDump.cpp */; }; + B6DD2FB41B04825B00E47F5F /* RecastDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F801B04825B00E47F5F /* RecastDump.cpp */; }; + B6DD2FB51B04825B00E47F5F /* RecastDump.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F811B04825B00E47F5F /* RecastDump.h */; }; + B6DD2FB61B04825B00E47F5F /* RecastDump.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F811B04825B00E47F5F /* RecastDump.h */; }; + B6DD2FB71B04825B00E47F5F /* DetourAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F831B04825B00E47F5F /* DetourAlloc.cpp */; }; + B6DD2FB81B04825B00E47F5F /* DetourAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F831B04825B00E47F5F /* DetourAlloc.cpp */; }; + B6DD2FB91B04825B00E47F5F /* DetourAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F841B04825B00E47F5F /* DetourAlloc.h */; }; + B6DD2FBA1B04825B00E47F5F /* DetourAlloc.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F841B04825B00E47F5F /* DetourAlloc.h */; }; + B6DD2FBB1B04825B00E47F5F /* DetourAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F851B04825B00E47F5F /* DetourAssert.h */; }; + B6DD2FBC1B04825B00E47F5F /* DetourAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F851B04825B00E47F5F /* DetourAssert.h */; }; + B6DD2FBD1B04825B00E47F5F /* DetourCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F861B04825B00E47F5F /* DetourCommon.cpp */; }; + B6DD2FBE1B04825B00E47F5F /* DetourCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F861B04825B00E47F5F /* DetourCommon.cpp */; }; + B6DD2FBF1B04825B00E47F5F /* DetourCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F871B04825B00E47F5F /* DetourCommon.h */; }; + B6DD2FC01B04825B00E47F5F /* DetourCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F871B04825B00E47F5F /* DetourCommon.h */; }; + B6DD2FC11B04825B00E47F5F /* DetourMath.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F881B04825B00E47F5F /* DetourMath.h */; }; + B6DD2FC21B04825B00E47F5F /* DetourMath.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F881B04825B00E47F5F /* DetourMath.h */; }; + B6DD2FC31B04825B00E47F5F /* DetourNavMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F891B04825B00E47F5F /* DetourNavMesh.cpp */; }; + B6DD2FC41B04825B00E47F5F /* DetourNavMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F891B04825B00E47F5F /* DetourNavMesh.cpp */; }; + B6DD2FC51B04825B00E47F5F /* DetourNavMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F8A1B04825B00E47F5F /* DetourNavMesh.h */; }; + B6DD2FC61B04825B00E47F5F /* DetourNavMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F8A1B04825B00E47F5F /* DetourNavMesh.h */; }; + B6DD2FC71B04825B00E47F5F /* DetourNavMeshBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F8B1B04825B00E47F5F /* DetourNavMeshBuilder.cpp */; }; + B6DD2FC81B04825B00E47F5F /* DetourNavMeshBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F8B1B04825B00E47F5F /* DetourNavMeshBuilder.cpp */; }; + B6DD2FC91B04825B00E47F5F /* DetourNavMeshBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F8C1B04825B00E47F5F /* DetourNavMeshBuilder.h */; }; + B6DD2FCA1B04825B00E47F5F /* DetourNavMeshBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F8C1B04825B00E47F5F /* DetourNavMeshBuilder.h */; }; + B6DD2FCB1B04825B00E47F5F /* DetourNavMeshQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F8D1B04825B00E47F5F /* DetourNavMeshQuery.cpp */; }; + B6DD2FCC1B04825B00E47F5F /* DetourNavMeshQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F8D1B04825B00E47F5F /* DetourNavMeshQuery.cpp */; }; + B6DD2FCD1B04825B00E47F5F /* DetourNavMeshQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F8E1B04825B00E47F5F /* DetourNavMeshQuery.h */; }; + B6DD2FCE1B04825B00E47F5F /* DetourNavMeshQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F8E1B04825B00E47F5F /* DetourNavMeshQuery.h */; }; + B6DD2FCF1B04825B00E47F5F /* DetourNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F8F1B04825B00E47F5F /* DetourNode.cpp */; }; + B6DD2FD01B04825B00E47F5F /* DetourNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F8F1B04825B00E47F5F /* DetourNode.cpp */; }; + B6DD2FD11B04825B00E47F5F /* DetourNode.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F901B04825B00E47F5F /* DetourNode.h */; }; + B6DD2FD21B04825B00E47F5F /* DetourNode.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F901B04825B00E47F5F /* DetourNode.h */; }; + B6DD2FD31B04825B00E47F5F /* DetourStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F911B04825B00E47F5F /* DetourStatus.h */; }; + B6DD2FD41B04825B00E47F5F /* DetourStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F911B04825B00E47F5F /* DetourStatus.h */; }; + B6DD2FD51B04825B00E47F5F /* DetourCrowd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F931B04825B00E47F5F /* DetourCrowd.cpp */; }; + B6DD2FD61B04825B00E47F5F /* DetourCrowd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F931B04825B00E47F5F /* DetourCrowd.cpp */; }; + B6DD2FD71B04825B00E47F5F /* DetourCrowd.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F941B04825B00E47F5F /* DetourCrowd.h */; }; + B6DD2FD81B04825B00E47F5F /* DetourCrowd.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F941B04825B00E47F5F /* DetourCrowd.h */; }; + B6DD2FD91B04825B00E47F5F /* DetourLocalBoundary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F951B04825B00E47F5F /* DetourLocalBoundary.cpp */; }; + B6DD2FDA1B04825B00E47F5F /* DetourLocalBoundary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F951B04825B00E47F5F /* DetourLocalBoundary.cpp */; }; + B6DD2FDB1B04825B00E47F5F /* DetourLocalBoundary.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F961B04825B00E47F5F /* DetourLocalBoundary.h */; }; + B6DD2FDC1B04825B00E47F5F /* DetourLocalBoundary.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F961B04825B00E47F5F /* DetourLocalBoundary.h */; }; + B6DD2FDD1B04825B00E47F5F /* DetourObstacleAvoidance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F971B04825B00E47F5F /* DetourObstacleAvoidance.cpp */; }; + B6DD2FDE1B04825B00E47F5F /* DetourObstacleAvoidance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F971B04825B00E47F5F /* DetourObstacleAvoidance.cpp */; }; + B6DD2FDF1B04825B00E47F5F /* DetourObstacleAvoidance.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F981B04825B00E47F5F /* DetourObstacleAvoidance.h */; }; + B6DD2FE01B04825B00E47F5F /* DetourObstacleAvoidance.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F981B04825B00E47F5F /* DetourObstacleAvoidance.h */; }; + B6DD2FE11B04825B00E47F5F /* DetourPathCorridor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F991B04825B00E47F5F /* DetourPathCorridor.cpp */; }; + B6DD2FE21B04825B00E47F5F /* DetourPathCorridor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F991B04825B00E47F5F /* DetourPathCorridor.cpp */; }; + B6DD2FE31B04825B00E47F5F /* DetourPathCorridor.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F9A1B04825B00E47F5F /* DetourPathCorridor.h */; }; + B6DD2FE41B04825B00E47F5F /* DetourPathCorridor.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F9A1B04825B00E47F5F /* DetourPathCorridor.h */; }; + B6DD2FE51B04825B00E47F5F /* DetourPathQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F9B1B04825B00E47F5F /* DetourPathQueue.cpp */; }; + B6DD2FE61B04825B00E47F5F /* DetourPathQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F9B1B04825B00E47F5F /* DetourPathQueue.cpp */; }; + B6DD2FE71B04825B00E47F5F /* DetourPathQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F9C1B04825B00E47F5F /* DetourPathQueue.h */; }; + B6DD2FE81B04825B00E47F5F /* DetourPathQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F9C1B04825B00E47F5F /* DetourPathQueue.h */; }; + B6DD2FE91B04825B00E47F5F /* DetourProximityGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F9D1B04825B00E47F5F /* DetourProximityGrid.cpp */; }; + B6DD2FEA1B04825B00E47F5F /* DetourProximityGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2F9D1B04825B00E47F5F /* DetourProximityGrid.cpp */; }; + B6DD2FEB1B04825B00E47F5F /* DetourProximityGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F9E1B04825B00E47F5F /* DetourProximityGrid.h */; }; + B6DD2FEC1B04825B00E47F5F /* DetourProximityGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2F9E1B04825B00E47F5F /* DetourProximityGrid.h */; }; + B6DD2FED1B04825B00E47F5F /* DetourTileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA01B04825B00E47F5F /* DetourTileCache.cpp */; }; + B6DD2FEE1B04825B00E47F5F /* DetourTileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA01B04825B00E47F5F /* DetourTileCache.cpp */; }; + B6DD2FEF1B04825B00E47F5F /* DetourTileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA11B04825B00E47F5F /* DetourTileCache.h */; }; + B6DD2FF01B04825B00E47F5F /* DetourTileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA11B04825B00E47F5F /* DetourTileCache.h */; }; + B6DD2FF11B04825B00E47F5F /* DetourTileCacheBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA21B04825B00E47F5F /* DetourTileCacheBuilder.cpp */; }; + B6DD2FF21B04825B00E47F5F /* DetourTileCacheBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA21B04825B00E47F5F /* DetourTileCacheBuilder.cpp */; }; + B6DD2FF31B04825B00E47F5F /* DetourTileCacheBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */; }; + B6DD2FF41B04825B00E47F5F /* DetourTileCacheBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */; }; + B6DD2FF51B04825B00E47F5F /* fastlz.c in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA51B04825B00E47F5F /* fastlz.c */; }; + B6DD2FF61B04825B00E47F5F /* fastlz.c in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA51B04825B00E47F5F /* fastlz.c */; }; + B6DD2FF71B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; }; + B6DD2FF81B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; }; D0FD03491A3B51AA00825BB5 /* CCAllocatorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = D0FD033B1A3B51AA00825BB5 /* CCAllocatorBase.h */; }; D0FD034A1A3B51AA00825BB5 /* CCAllocatorBase.h in Headers */ = {isa = PBXBuildFile; fileRef = D0FD033B1A3B51AA00825BB5 /* CCAllocatorBase.h */; }; D0FD034B1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D0FD033C1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp */; }; @@ -4892,6 +4994,16 @@ B665E1EF1AA80A6500DDB1C5 /* CCPUVortexAffector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCPUVortexAffector.h; path = Particle3D/PU/CCPUVortexAffector.h; sourceTree = ""; }; B665E1F01AA80A6500DDB1C5 /* CCPUVortexAffectorTranslator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCPUVortexAffectorTranslator.cpp; path = Particle3D/PU/CCPUVortexAffectorTranslator.cpp; sourceTree = ""; }; B665E1F11AA80A6500DDB1C5 /* CCPUVortexAffectorTranslator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCPUVortexAffectorTranslator.h; path = Particle3D/PU/CCPUVortexAffectorTranslator.h; sourceTree = ""; }; + B677B0BF1B18492D006762CB /* CCNavMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCNavMesh.cpp; path = ../cocos/navmesh/CCNavMesh.cpp; sourceTree = ""; }; + B677B0C01B18492D006762CB /* CCNavMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCNavMesh.h; path = ../cocos/navmesh/CCNavMesh.h; sourceTree = ""; }; + B677B0C11B18492D006762CB /* CCNavMeshAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCNavMeshAgent.cpp; path = ../cocos/navmesh/CCNavMeshAgent.cpp; sourceTree = ""; }; + B677B0C21B18492D006762CB /* CCNavMeshAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCNavMeshAgent.h; path = ../cocos/navmesh/CCNavMeshAgent.h; sourceTree = ""; }; + B677B0C31B18492D006762CB /* CCNavMeshDebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCNavMeshDebugDraw.cpp; path = ../cocos/navmesh/CCNavMeshDebugDraw.cpp; sourceTree = ""; }; + B677B0C41B18492D006762CB /* CCNavMeshDebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCNavMeshDebugDraw.h; path = ../cocos/navmesh/CCNavMeshDebugDraw.h; sourceTree = ""; }; + B677B0C51B18492D006762CB /* CCNavMeshObstacle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCNavMeshObstacle.cpp; path = ../cocos/navmesh/CCNavMeshObstacle.cpp; sourceTree = ""; }; + B677B0C61B18492D006762CB /* CCNavMeshObstacle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCNavMeshObstacle.h; path = ../cocos/navmesh/CCNavMeshObstacle.h; sourceTree = ""; }; + B677B0C71B18492D006762CB /* CCNavMeshTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CCNavMeshTool.cpp; path = ../cocos/navmesh/CCNavMeshTool.cpp; sourceTree = ""; }; + B677B0C81B18492D006762CB /* CCNavMeshTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCNavMeshTool.h; path = ../cocos/navmesh/CCNavMeshTool.h; sourceTree = ""; }; B67C624319D4186F00F11FC6 /* ccShader_3D_ColorNormal.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_ColorNormal.frag; sourceTree = ""; }; B67C624419D4186F00F11FC6 /* ccShader_3D_ColorNormalTex.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_ColorNormalTex.frag; sourceTree = ""; }; B67C624519D4186F00F11FC6 /* ccShader_3D_PositionNormalTex.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_PositionNormalTex.vert; sourceTree = ""; }; @@ -5324,6 +5436,47 @@ B6D38B951AC3B45600043997 /* ccShader_3D_Particle.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Particle.vert; sourceTree = ""; }; B6D38B961AC3B45600043997 /* ccShader_3D_Skybox.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Skybox.frag; sourceTree = ""; }; B6D38B971AC3B45600043997 /* ccShader_3D_Skybox.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Skybox.vert; sourceTree = ""; }; + B6DD2F7A1B04825B00E47F5F /* DebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DebugDraw.cpp; sourceTree = ""; }; + B6DD2F7B1B04825B00E47F5F /* DebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugDraw.h; sourceTree = ""; }; + B6DD2F7C1B04825B00E47F5F /* DetourDebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourDebugDraw.cpp; sourceTree = ""; }; + B6DD2F7D1B04825B00E47F5F /* DetourDebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourDebugDraw.h; sourceTree = ""; }; + B6DD2F7E1B04825B00E47F5F /* RecastDebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastDebugDraw.cpp; sourceTree = ""; }; + B6DD2F7F1B04825B00E47F5F /* RecastDebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecastDebugDraw.h; sourceTree = ""; }; + B6DD2F801B04825B00E47F5F /* RecastDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RecastDump.cpp; sourceTree = ""; }; + B6DD2F811B04825B00E47F5F /* RecastDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecastDump.h; sourceTree = ""; }; + B6DD2F831B04825B00E47F5F /* DetourAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourAlloc.cpp; sourceTree = ""; }; + B6DD2F841B04825B00E47F5F /* DetourAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourAlloc.h; sourceTree = ""; }; + B6DD2F851B04825B00E47F5F /* DetourAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourAssert.h; sourceTree = ""; }; + B6DD2F861B04825B00E47F5F /* DetourCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourCommon.cpp; sourceTree = ""; }; + B6DD2F871B04825B00E47F5F /* DetourCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourCommon.h; sourceTree = ""; }; + B6DD2F881B04825B00E47F5F /* DetourMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourMath.h; sourceTree = ""; }; + B6DD2F891B04825B00E47F5F /* DetourNavMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourNavMesh.cpp; sourceTree = ""; }; + B6DD2F8A1B04825B00E47F5F /* DetourNavMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourNavMesh.h; sourceTree = ""; }; + B6DD2F8B1B04825B00E47F5F /* DetourNavMeshBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourNavMeshBuilder.cpp; sourceTree = ""; }; + B6DD2F8C1B04825B00E47F5F /* DetourNavMeshBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourNavMeshBuilder.h; sourceTree = ""; }; + B6DD2F8D1B04825B00E47F5F /* DetourNavMeshQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourNavMeshQuery.cpp; sourceTree = ""; }; + B6DD2F8E1B04825B00E47F5F /* DetourNavMeshQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourNavMeshQuery.h; sourceTree = ""; }; + B6DD2F8F1B04825B00E47F5F /* DetourNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourNode.cpp; sourceTree = ""; }; + B6DD2F901B04825B00E47F5F /* DetourNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourNode.h; sourceTree = ""; }; + B6DD2F911B04825B00E47F5F /* DetourStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourStatus.h; sourceTree = ""; }; + B6DD2F931B04825B00E47F5F /* DetourCrowd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourCrowd.cpp; sourceTree = ""; }; + B6DD2F941B04825B00E47F5F /* DetourCrowd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourCrowd.h; sourceTree = ""; }; + B6DD2F951B04825B00E47F5F /* DetourLocalBoundary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourLocalBoundary.cpp; sourceTree = ""; }; + B6DD2F961B04825B00E47F5F /* DetourLocalBoundary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourLocalBoundary.h; sourceTree = ""; }; + B6DD2F971B04825B00E47F5F /* DetourObstacleAvoidance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourObstacleAvoidance.cpp; sourceTree = ""; }; + B6DD2F981B04825B00E47F5F /* DetourObstacleAvoidance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourObstacleAvoidance.h; sourceTree = ""; }; + B6DD2F991B04825B00E47F5F /* DetourPathCorridor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourPathCorridor.cpp; sourceTree = ""; }; + B6DD2F9A1B04825B00E47F5F /* DetourPathCorridor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourPathCorridor.h; sourceTree = ""; }; + B6DD2F9B1B04825B00E47F5F /* DetourPathQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourPathQueue.cpp; sourceTree = ""; }; + B6DD2F9C1B04825B00E47F5F /* DetourPathQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourPathQueue.h; sourceTree = ""; }; + B6DD2F9D1B04825B00E47F5F /* DetourProximityGrid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourProximityGrid.cpp; sourceTree = ""; }; + B6DD2F9E1B04825B00E47F5F /* DetourProximityGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourProximityGrid.h; sourceTree = ""; }; + B6DD2FA01B04825B00E47F5F /* DetourTileCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourTileCache.cpp; sourceTree = ""; }; + B6DD2FA11B04825B00E47F5F /* DetourTileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourTileCache.h; sourceTree = ""; }; + B6DD2FA21B04825B00E47F5F /* DetourTileCacheBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetourTileCacheBuilder.cpp; sourceTree = ""; }; + B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourTileCacheBuilder.h; sourceTree = ""; }; + B6DD2FA51B04825B00E47F5F /* fastlz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fastlz.c; sourceTree = ""; }; + B6DD2FA61B04825B00E47F5F /* fastlz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fastlz.h; sourceTree = ""; }; D0FD033B1A3B51AA00825BB5 /* CCAllocatorBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCAllocatorBase.h; sourceTree = ""; }; D0FD033C1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCAllocatorDiagnostics.cpp; sourceTree = ""; }; D0FD033D1A3B51AA00825BB5 /* CCAllocatorDiagnostics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCAllocatorDiagnostics.h; sourceTree = ""; }; @@ -5430,6 +5583,7 @@ 1A57033E180BD0490088DEC7 /* external */, 1551A341158F2AB200E66CFE /* Frameworks */, 46A170851807CE87005B8026 /* math */, + B6DD2F351B04805400E47F5F /* navmesh */, 1AAF5360180E3374000584C8 /* network */, 46A170611807CE7A005B8026 /* physics */, B6CAAFD11AF9A98E00B9B856 /* physics3d */, @@ -5931,6 +6085,7 @@ 1A57033E180BD0490088DEC7 /* external */ = { isa = PBXGroup; children = ( + B6DD2F731B04820C00E47F5F /* recast */, B6CAB0021AF9A9EE00B9B856 /* bullet */, 15FB20781AE7C57D00C31518 /* poly2tri */, 382383E11A258FA7002C4610 /* flatbuffers */, @@ -8511,6 +8666,116 @@ path = MiniCLTask; sourceTree = ""; }; + B6DD2F351B04805400E47F5F /* navmesh */ = { + isa = PBXGroup; + children = ( + B677B0BF1B18492D006762CB /* CCNavMesh.cpp */, + B677B0C01B18492D006762CB /* CCNavMesh.h */, + B677B0C11B18492D006762CB /* CCNavMeshAgent.cpp */, + B677B0C21B18492D006762CB /* CCNavMeshAgent.h */, + B677B0C31B18492D006762CB /* CCNavMeshDebugDraw.cpp */, + B677B0C41B18492D006762CB /* CCNavMeshDebugDraw.h */, + B677B0C51B18492D006762CB /* CCNavMeshObstacle.cpp */, + B677B0C61B18492D006762CB /* CCNavMeshObstacle.h */, + B677B0C71B18492D006762CB /* CCNavMeshTool.cpp */, + B677B0C81B18492D006762CB /* CCNavMeshTool.h */, + ); + name = navmesh; + sourceTree = ""; + }; + B6DD2F731B04820C00E47F5F /* recast */ = { + isa = PBXGroup; + children = ( + B6DD2F791B04825B00E47F5F /* DebugUtils */, + B6DD2F821B04825B00E47F5F /* Detour */, + B6DD2F921B04825B00E47F5F /* DetourCrowd */, + B6DD2F9F1B04825B00E47F5F /* DetourTileCache */, + B6DD2FA41B04825B00E47F5F /* fastlz */, + ); + name = recast; + sourceTree = ""; + }; + B6DD2F791B04825B00E47F5F /* DebugUtils */ = { + isa = PBXGroup; + children = ( + B6DD2F7A1B04825B00E47F5F /* DebugDraw.cpp */, + B6DD2F7B1B04825B00E47F5F /* DebugDraw.h */, + B6DD2F7C1B04825B00E47F5F /* DetourDebugDraw.cpp */, + B6DD2F7D1B04825B00E47F5F /* DetourDebugDraw.h */, + B6DD2F7E1B04825B00E47F5F /* RecastDebugDraw.cpp */, + B6DD2F7F1B04825B00E47F5F /* RecastDebugDraw.h */, + B6DD2F801B04825B00E47F5F /* RecastDump.cpp */, + B6DD2F811B04825B00E47F5F /* RecastDump.h */, + ); + name = DebugUtils; + path = ../external/recast/DebugUtils; + sourceTree = ""; + }; + B6DD2F821B04825B00E47F5F /* Detour */ = { + isa = PBXGroup; + children = ( + B6DD2F831B04825B00E47F5F /* DetourAlloc.cpp */, + B6DD2F841B04825B00E47F5F /* DetourAlloc.h */, + B6DD2F851B04825B00E47F5F /* DetourAssert.h */, + B6DD2F861B04825B00E47F5F /* DetourCommon.cpp */, + B6DD2F871B04825B00E47F5F /* DetourCommon.h */, + B6DD2F881B04825B00E47F5F /* DetourMath.h */, + B6DD2F891B04825B00E47F5F /* DetourNavMesh.cpp */, + B6DD2F8A1B04825B00E47F5F /* DetourNavMesh.h */, + B6DD2F8B1B04825B00E47F5F /* DetourNavMeshBuilder.cpp */, + B6DD2F8C1B04825B00E47F5F /* DetourNavMeshBuilder.h */, + B6DD2F8D1B04825B00E47F5F /* DetourNavMeshQuery.cpp */, + B6DD2F8E1B04825B00E47F5F /* DetourNavMeshQuery.h */, + B6DD2F8F1B04825B00E47F5F /* DetourNode.cpp */, + B6DD2F901B04825B00E47F5F /* DetourNode.h */, + B6DD2F911B04825B00E47F5F /* DetourStatus.h */, + ); + name = Detour; + path = ../external/recast/Detour; + sourceTree = ""; + }; + B6DD2F921B04825B00E47F5F /* DetourCrowd */ = { + isa = PBXGroup; + children = ( + B6DD2F931B04825B00E47F5F /* DetourCrowd.cpp */, + B6DD2F941B04825B00E47F5F /* DetourCrowd.h */, + B6DD2F951B04825B00E47F5F /* DetourLocalBoundary.cpp */, + B6DD2F961B04825B00E47F5F /* DetourLocalBoundary.h */, + B6DD2F971B04825B00E47F5F /* DetourObstacleAvoidance.cpp */, + B6DD2F981B04825B00E47F5F /* DetourObstacleAvoidance.h */, + B6DD2F991B04825B00E47F5F /* DetourPathCorridor.cpp */, + B6DD2F9A1B04825B00E47F5F /* DetourPathCorridor.h */, + B6DD2F9B1B04825B00E47F5F /* DetourPathQueue.cpp */, + B6DD2F9C1B04825B00E47F5F /* DetourPathQueue.h */, + B6DD2F9D1B04825B00E47F5F /* DetourProximityGrid.cpp */, + B6DD2F9E1B04825B00E47F5F /* DetourProximityGrid.h */, + ); + name = DetourCrowd; + path = ../external/recast/DetourCrowd; + sourceTree = ""; + }; + B6DD2F9F1B04825B00E47F5F /* DetourTileCache */ = { + isa = PBXGroup; + children = ( + B6DD2FA01B04825B00E47F5F /* DetourTileCache.cpp */, + B6DD2FA11B04825B00E47F5F /* DetourTileCache.h */, + B6DD2FA21B04825B00E47F5F /* DetourTileCacheBuilder.cpp */, + B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */, + ); + name = DetourTileCache; + path = ../external/recast/DetourTileCache; + sourceTree = ""; + }; + B6DD2FA41B04825B00E47F5F /* fastlz */ = { + isa = PBXGroup; + children = ( + B6DD2FA51B04825B00E47F5F /* fastlz.c */, + B6DD2FA61B04825B00E47F5F /* fastlz.h */, + ); + name = fastlz; + path = ../external/recast/fastlz; + sourceTree = ""; + }; D0FD03391A3B51AA00825BB5 /* allocator */ = { isa = PBXGroup; children = ( @@ -8612,12 +8877,15 @@ 50ABBD3E1925AB0000A911A9 /* CCGeometry.h in Headers */, B6CAB34F1AF9AA1A00B9B856 /* gim_geom_types.h in Headers */, 15AE1A7719AAD40300C27E9E /* b2EdgeAndPolygonContact.h in Headers */, + B6DD2FD11B04825B00E47F5F /* DetourNode.h in Headers */, 15AE18F719AAD35000C27E9E /* CCBatchNode.h in Headers */, 15AE181419AAD2F700C27E9E /* CCAnimationCurve.h in Headers */, 50ABBE631925AB6F00A911A9 /* CCEventListenerAcceleration.h in Headers */, B665E4281AA80A6600DDB1C5 /* CCPUUtil.h in Headers */, B665E2601AA80A6500DDB1C5 /* CCPUDoEnableComponentEventHandlerTranslator.h in Headers */, 15AE1C1419AAE2C600C27E9E /* CCPhysicsSprite.h in Headers */, + B6DD2FE71B04825B00E47F5F /* DetourPathQueue.h in Headers */, + B6DD2FBB1B04825B00E47F5F /* DetourAssert.h in Headers */, 46A170EE1807CECA005B8026 /* CCPhysicsShape.h in Headers */, B6CAB3D91AF9AA1A00B9B856 /* btSolverBody.h in Headers */, 15AE1A5C19AAD40300C27E9E /* b2Timer.h in Headers */, @@ -8656,12 +8924,14 @@ B665E2841AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandler.h in Headers */, B6CAB52D1AF9AA1A00B9B856 /* btSerializer.h in Headers */, B665E3E01AA80A6600DDB1C5 /* CCPUSimpleSpline.h in Headers */, + B6DD2FAD1B04825B00E47F5F /* DetourDebugDraw.h in Headers */, B665E42C1AA80A6600DDB1C5 /* CCPUVelocityMatchingAffector.h in Headers */, B665E3B41AA80A6500DDB1C5 /* CCPURendererTranslator.h in Headers */, B6CAAFF01AF9A9E100B9B856 /* CCPhysics3DDebugDrawer.h in Headers */, 1A57006B180BC5A10088DEC7 /* CCActionCatmullRom.h in Headers */, B665E3BC1AA80A6500DDB1C5 /* CCPURibbonTrailRender.h in Headers */, B6CAB3371AF9AA1A00B9B856 /* btQuantization.h in Headers */, + B677B0CB1B18492D006762CB /* CCNavMesh.h in Headers */, B6CAB4371AF9AA1A00B9B856 /* btGpu3DGridBroadphaseSharedCode.h in Headers */, B665E2A81AA80A6500DDB1C5 /* CCPUEventHandlerTranslator.h in Headers */, 4D76BE3C1A4AAF0A00102962 /* CCActionTimelineNode.h in Headers */, @@ -8675,6 +8945,7 @@ 15AE1BD319AAE01E00C27E9E /* CCControlPotentiometer.h in Headers */, 15AE1B6E19AADA9900C27E9E /* UIHelper.h in Headers */, B230ED7319B417AE00364AA8 /* CCTrianglesCommand.h in Headers */, + B6DD2FB11B04825B00E47F5F /* RecastDebugDraw.h in Headers */, B6CAB2F71AF9AA1A00B9B856 /* btTriangleBuffer.h in Headers */, B665E2D41AA80A6500DDB1C5 /* CCPUInterParticleColliderTranslator.h in Headers */, 15AE187F19AAD33D00C27E9E /* CCBKeyframe.h in Headers */, @@ -8692,7 +8963,9 @@ 15AE182A19AAD2F700C27E9E /* CCMeshSkin.h in Headers */, B276EF5F1988D1D500CD400F /* CCVertexIndexData.h in Headers */, 1A57007F180BC5A10088DEC7 /* CCActionInterval.h in Headers */, + B6DD2FDB1B04825B00E47F5F /* DetourLocalBoundary.h in Headers */, B6CAB3491AF9AA1A00B9B856 /* gim_clip_polygon.h in Headers */, + B677B0DB1B18492D006762CB /* CCNavMeshTool.h in Headers */, B6CAAFE41AF9A9E100B9B856 /* CCPhysics3D.h in Headers */, 15AE1A7F19AAD40300C27E9E /* b2DistanceJoint.h in Headers */, B665E3301AA80A6500DDB1C5 /* CCPUOnCountObserverTranslator.h in Headers */, @@ -8744,6 +9017,8 @@ 15AE191219AAD35000C27E9E /* CCProcessBase.h in Headers */, 15AE1BB619AADFEF00C27E9E /* SocketIO.h in Headers */, B665E2F41AA80A6500DDB1C5 /* CCPULineEmitterTranslator.h in Headers */, + B6DD2FB91B04825B00E47F5F /* DetourAlloc.h in Headers */, + B6DD2FF71B04825B00E47F5F /* fastlz.h in Headers */, B665E2D81AA80A6500DDB1C5 /* CCPUJetAffector.h in Headers */, 1A570093180BC5A10088DEC7 /* CCActionTween.h in Headers */, B6CAB3CF1AF9AA1A00B9B856 /* btSequentialImpulseConstraintSolver.h in Headers */, @@ -8817,6 +9092,7 @@ 15AE1B6C19AADA9900C27E9E /* UIWidget.h in Headers */, B665E2681AA80A6500DDB1C5 /* CCPUDoExpireEventHandlerTranslator.h in Headers */, 15FB208B1AE7C57D00C31518 /* utils.h in Headers */, + B6DD2FB51B04825B00E47F5F /* RecastDump.h in Headers */, B6CAB3411AF9AA1A00B9B856 /* gim_bitset.h in Headers */, 15AE180E19AAD2F700C27E9E /* CCAnimate3D.h in Headers */, 1A5701B3180BCB590088DEC7 /* CCFontFNT.h in Headers */, @@ -8834,6 +9110,7 @@ B6CAB3E91AF9AA1A00B9B856 /* btDiscreteDynamicsWorld.h in Headers */, B6CAB2F31AF9AA1A00B9B856 /* btTetrahedronShape.h in Headers */, B6CAB4231AF9AA1A00B9B856 /* btMLCPSolverInterface.h in Headers */, + B6DD2FE31B04825B00E47F5F /* DetourPathCorridor.h in Headers */, 50ED2BE019BEAF7900A0AB90 /* UIEditBoxImpl-win32.h in Headers */, B6CAB5011AF9AA1A00B9B856 /* btConvexHullComputer.h in Headers */, 15AE197119AAD35700C27E9E /* CCFrame.h in Headers */, @@ -8926,6 +9203,7 @@ B665E3081AA80A6500DDB1C5 /* CCPUMeshSurfaceEmitterTranslator.h in Headers */, 15AE184219AAD2F700C27E9E /* CCSprite3D.h in Headers */, B665E3181AA80A6500DDB1C5 /* CCPUObserverTranslator.h in Headers */, + B6DD2FC91B04825B00E47F5F /* DetourNavMeshBuilder.h in Headers */, B6CAB5111AF9AA1A00B9B856 /* btMatrix3x3.h in Headers */, B665E3201AA80A6500DDB1C5 /* CCPUOnClearObserverTranslator.h in Headers */, B665E2A01AA80A6500DDB1C5 /* CCPUEventHandler.h in Headers */, @@ -8974,6 +9252,7 @@ B6CAB50B1AF9AA1A00B9B856 /* btHashMap.h in Headers */, 15AE1A6719AAD40300C27E9E /* b2World.h in Headers */, B6CAB3571AF9AA1A00B9B856 /* gim_math.h in Headers */, + B677B0D71B18492D006762CB /* CCNavMeshObstacle.h in Headers */, 15AE199B19AAD39600C27E9E /* PageViewReader.h in Headers */, B665E2A41AA80A6500DDB1C5 /* CCPUEventHandlerManager.h in Headers */, 15AE1A6219AAD40300C27E9E /* b2Fixture.h in Headers */, @@ -9000,6 +9279,7 @@ 15AE188519AAD33D00C27E9E /* CCBSequence.h in Headers */, 15FB20951AE7C57D00C31518 /* cdt.h in Headers */, B665E3541AA80A6500DDB1C5 /* CCPUOnQuotaObserver.h in Headers */, + B6DD2FDF1B04825B00E47F5F /* DetourObstacleAvoidance.h in Headers */, B6CAB4F11AF9AA1A00B9B856 /* Win32ThreadSupport.h in Headers */, 50643BE219BFCF1800EF68ED /* CCPlatformConfig.h in Headers */, B29A7DF519EE1B7700872B35 /* Skeleton.h in Headers */, @@ -9009,6 +9289,7 @@ 5034CA49191D591100CE6051 /* ccShader_Label_df.frag in Headers */, 292DB14119B4574100A80320 /* UIEditBoxImpl.h in Headers */, B29A7DD919EE1B7700872B35 /* SkeletonRenderer.h in Headers */, + B6DD2FC11B04825B00E47F5F /* DetourMath.h in Headers */, 50CB247919D9C5A100687767 /* AudioEngine-inl.h in Headers */, 1A01C68C18F57BE800EFE3A6 /* CCDeprecated.h in Headers */, B6CAB0001AF9A9E100B9B856 /* CCPhysicsSprite3D.h in Headers */, @@ -9032,6 +9313,7 @@ 15AE1A5419AAD40300C27E9E /* b2GrowableStack.h in Headers */, 15AE1B4E19AADA9900C27E9E /* UIListView.h in Headers */, 1A570284180BCC900088DEC7 /* CCSpriteBatchNode.h in Headers */, + B6DD2FD71B04825B00E47F5F /* DetourCrowd.h in Headers */, 5034CA2B191D591100CE6051 /* ccShader_PositionTextureA8Color.vert in Headers */, B665E2041AA80A6500DDB1C5 /* CCPUAlignAffectorTranslator.h in Headers */, B6CAB3A11AF9AA1A00B9B856 /* btKinematicCharacterController.h in Headers */, @@ -9056,6 +9338,7 @@ B665E3501AA80A6500DDB1C5 /* CCPUOnPositionObserverTranslator.h in Headers */, B68778FA1A8CA82E00643ABF /* CCParticle3DAffector.h in Headers */, 15AE1BA019AADFDF00C27E9E /* UILayout.h in Headers */, + B677B0CF1B18492D006762CB /* CCNavMeshAgent.h in Headers */, 1A570294180BCCAB0088DEC7 /* CCAnimation.h in Headers */, B665E4081AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitter.h in Headers */, B6CAB28B1AF9AA1A00B9B856 /* btCapsuleShape.h in Headers */, @@ -9231,6 +9514,7 @@ B6CAB1FF1AF9AA1A00B9B856 /* btDispatcher.h in Headers */, 15AE188B19AAD33D00C27E9E /* CCControlLoader.h in Headers */, B29A7DF719EE1B7700872B35 /* Attachment.h in Headers */, + B6DD2FA91B04825B00E47F5F /* DebugDraw.h in Headers */, 15FB208D1AE7C57D00C31518 /* poly2tri.h in Headers */, B6CAB3091AF9AA1A00B9B856 /* btTriangleMesh.h in Headers */, B6CAB4AF1AF9AA1A00B9B856 /* SpuCollisionTaskProcess.h in Headers */, @@ -9247,10 +9531,12 @@ B6CAB1E31AF9AA1A00B9B856 /* btBulletDynamicsCommon.h in Headers */, 382384311A259112002C4610 /* ParticleReader.h in Headers */, B6CAB3BD1AF9AA1A00B9B856 /* btGeneric6DofSpringConstraint.h in Headers */, + B6DD2FBF1B04825B00E47F5F /* DetourCommon.h in Headers */, B665E3D01AA80A6600DDB1C5 /* CCPUScriptCompiler.h in Headers */, 5034CA35191D591100CE6051 /* ccShader_PositionTexture.frag in Headers */, 15AE1BB219AADFEF00C27E9E /* HttpClient.h in Headers */, B6CAB3FD1AF9AA1A00B9B856 /* btMultiBodyConstraint.h in Headers */, + B6DD2FF31B04825B00E47F5F /* DetourTileCacheBuilder.h in Headers */, 15AE197619AAD35700C27E9E /* CCTimelineMacro.h in Headers */, 50ABBE6F1925AB6F00A911A9 /* CCEventListenerKeyboard.h in Headers */, 15AE1A5619AAD40300C27E9E /* b2Math.h in Headers */, @@ -9328,7 +9614,9 @@ B665E2881AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.h in Headers */, B665E2441AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffector.h in Headers */, B665E2281AA80A6500DDB1C5 /* CCPUBillboardChain.h in Headers */, + B6DD2FD31B04825B00E47F5F /* DetourStatus.h in Headers */, 15AE18A919AAD33D00C27E9E /* CCSpriteLoader.h in Headers */, + B677B0D31B18492D006762CB /* CCNavMeshDebugDraw.h in Headers */, 15AE198419AAD36400C27E9E /* WidgetReaderProtocol.h in Headers */, B6CAB53D1AF9AA1A00B9B856 /* cl_MiniCL_Defs.h in Headers */, 50ABBEC91925AB6F00A911A9 /* firePngData.h in Headers */, @@ -9462,6 +9750,7 @@ B6CAB2EB1AF9AA1A00B9B856 /* btStaticPlaneShape.h in Headers */, 3EACC9A219F5014D00EB3C5E /* CCCamera.h in Headers */, B6CAB5331AF9AA1A00B9B856 /* btTransformUtil.h in Headers */, + B6DD2FEF1B04825B00E47F5F /* DetourTileCache.h in Headers */, 50ABBECD1925AB6F00A911A9 /* s3tc.h in Headers */, B6CAB3651AF9AA1A00B9B856 /* btContinuousConvexCollision.h in Headers */, 15AE1BD119AAE01E00C27E9E /* CCControlHuePicker.h in Headers */, @@ -9470,7 +9759,10 @@ 50ABBE771925AB6F00A911A9 /* CCEventListenerTouch.h in Headers */, 5034CA33191D591100CE6051 /* ccShader_PositionTexture_uColor.frag in Headers */, B665E4341AA80A6600DDB1C5 /* CCPUVertexEmitter.h in Headers */, + B6DD2FEB1B04825B00E47F5F /* DetourProximityGrid.h in Headers */, + B6DD2FC51B04825B00E47F5F /* DetourNavMesh.h in Headers */, 50ABC0171926664800A911A9 /* CCImage.h in Headers */, + B6DD2FCD1B04825B00E47F5F /* DetourNavMeshQuery.h in Headers */, 50ABBDA91925AB4100A911A9 /* CCRenderCommand.h in Headers */, B6CAB3791AF9AA1A00B9B856 /* btGjkEpaPenetrationDepthSolver.h in Headers */, 50ABBD951925AB4100A911A9 /* CCGLProgramState.h in Headers */, @@ -9578,8 +9870,10 @@ B6CAB4061AF9AA1A00B9B856 /* btMultiBodyDynamicsWorld.h in Headers */, ED74D76A1A5B8A2600157FD4 /* CCPhysicsHelper.h in Headers */, 5034CA40191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */, + B6DD2FD41B04825B00E47F5F /* DetourStatus.h in Headers */, B665E2891AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.h in Headers */, 15AE184719AAD2F700C27E9E /* CCSprite3DMaterial.h in Headers */, + B6DD2FC21B04825B00E47F5F /* DetourMath.h in Headers */, B6CAB5101AF9AA1A00B9B856 /* btList.h in Headers */, 15AE1BFC19AAE01E00C27E9E /* CCControlUtils.h in Headers */, 15AE193519AAD35100C27E9E /* CCActionObject.h in Headers */, @@ -9595,7 +9889,9 @@ B257B4511989D5E800D9A687 /* CCPrimitive.h in Headers */, 50643BE319BFCF1800EF68ED /* CCPlatformConfig.h in Headers */, B665E27D1AA80A6500DDB1C5 /* CCPUDoScaleEventHandler.h in Headers */, + B6DD2FE81B04825B00E47F5F /* DetourPathQueue.h in Headers */, B6CAB29E1AF9AA1A00B9B856 /* btConeShape.h in Headers */, + B677B0D81B18492D006762CB /* CCNavMeshObstacle.h in Headers */, 15AE181F19AAD2F700C27E9E /* CCBundle3DData.h in Headers */, 15AE193119AAD35100C27E9E /* CCActionManagerEx.h in Headers */, 15AE185B19AAD31200C27E9E /* CDOpenALSupport.h in Headers */, @@ -9619,6 +9915,7 @@ B6CAB32E1AF9AA1A00B9B856 /* btGImpactMassUtil.h in Headers */, B6CAB43C1AF9AA1A00B9B856 /* btGpu3DGridBroadphaseSharedTypes.h in Headers */, 50643BD619BFAEDA00EF68ED /* CCPlatformDefine.h in Headers */, + B6DD2FCE1B04825B00E47F5F /* DetourNavMeshQuery.h in Headers */, 1A570068180BC5A10088DEC7 /* CCActionCamera.h in Headers */, B29A7E1E19EE1B7700872B35 /* PolygonBatch.h in Headers */, B6CAB4E61AF9AA1A00B9B856 /* SpuSampleTaskProcess.h in Headers */, @@ -9634,6 +9931,7 @@ B665E4311AA80A6600DDB1C5 /* CCPUVelocityMatchingAffectorTranslator.h in Headers */, B6CAB2C21AF9AA1A00B9B856 /* btEmptyShape.h in Headers */, B665E3C51AA80A6600DDB1C5 /* CCPUScaleAffectorTranslator.h in Headers */, + B6DD2FF81B04825B00E47F5F /* fastlz.h in Headers */, B665E4351AA80A6600DDB1C5 /* CCPUVertexEmitter.h in Headers */, B665E2451AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffector.h in Headers */, B6CAB3381AF9AA1A00B9B856 /* btQuantization.h in Headers */, @@ -9691,6 +9989,7 @@ B6CAB5341AF9AA1A00B9B856 /* btTransformUtil.h in Headers */, 1A570088180BC5A10088DEC7 /* CCActionPageTurn3D.h in Headers */, 15AE1B9319AADA9A00C27E9E /* UIHelper.h in Headers */, + B677B0DC1B18492D006762CB /* CCNavMeshTool.h in Headers */, 50ABBD9E1925AB4100A911A9 /* ccGLStateCache.h in Headers */, B665E2111AA80A6500DDB1C5 /* CCPUBaseForceAffector.h in Headers */, B665E30D1AA80A6500DDB1C5 /* CCPUNoise.h in Headers */, @@ -9749,6 +10048,7 @@ 50ABBD571925AB0000A911A9 /* TransformUtils.h in Headers */, B665E2711AA80A6500DDB1C5 /* CCPUDoFreezeEventHandlerTranslator.h in Headers */, 1A570115180BC8EE0088DEC7 /* CCDrawNode.h in Headers */, + B677B0D41B18492D006762CB /* CCNavMeshDebugDraw.h in Headers */, B6CAB2341AF9AA1A00B9B856 /* btCollisionWorld.h in Headers */, 1A57011E180BC90D0088DEC7 /* CCGrabber.h in Headers */, B6CAB4A21AF9AA1A00B9B856 /* PosixThreadSupport.h in Headers */, @@ -9801,13 +10101,16 @@ B665E3E51AA80A6600DDB1C5 /* CCPUSineForceAffector.h in Headers */, 182C5CE81A9D725400C30D34 /* UserCameraReader.h in Headers */, 15AE1A4C19AAD3D500C27E9E /* b2EdgeShape.h in Headers */, + B6DD2FB21B04825B00E47F5F /* RecastDebugDraw.h in Headers */, B6CAB39C1AF9AA1A00B9B856 /* btVoronoiSimplexSolver.h in Headers */, B6CAB2701AF9AA1A00B9B856 /* btSphereSphereCollisionAlgorithm.h in Headers */, 1A5701B4180BCB590088DEC7 /* CCFontFNT.h in Headers */, + B6DD2FBC1B04825B00E47F5F /* DetourAssert.h in Headers */, 15AE18D419AAD33D00C27E9E /* CCParticleSystemQuadLoader.h in Headers */, B665E3411AA80A6500DDB1C5 /* CCPUOnEventFlagObserverTranslator.h in Headers */, B6CAB5041AF9AA1A00B9B856 /* btDefaultMotionState.h in Headers */, B6CAB52A1AF9AA1A00B9B856 /* btScalar.h in Headers */, + B6DD2FF41B04825B00E47F5F /* DetourTileCacheBuilder.h in Headers */, B29A7DFA19EE1B7700872B35 /* Json.h in Headers */, 3823842B1A2590F9002C4610 /* NodeReader.h in Headers */, B6CAB3241AF9AA1A00B9B856 /* btGeometryOperations.h in Headers */, @@ -9821,6 +10124,7 @@ 15AE18CB19AAD33D00C27E9E /* CCMenuLoader.h in Headers */, B665E4011AA80A6600DDB1C5 /* CCPUSphereCollider.h in Headers */, B6CAB31E1AF9AA1A00B9B856 /* btContactProcessing.h in Headers */, + B6DD2FC61B04825B00E47F5F /* DetourNavMesh.h in Headers */, 1A5701BC180BCB5A0088DEC7 /* CCLabel.h in Headers */, B665E2D51AA80A6500DDB1C5 /* CCPUInterParticleColliderTranslator.h in Headers */, 1A5701C0180BCB5A0088DEC7 /* CCLabelAtlas.h in Headers */, @@ -9838,6 +10142,7 @@ B6CAB4EE1AF9AA1A00B9B856 /* vectormath2bullet.h in Headers */, 15AE1BBA19AADFF000C27E9E /* HttpClient.h in Headers */, B6CAB2241AF9AA1A00B9B856 /* btCollisionConfiguration.h in Headers */, + B6DD2FCA1B04825B00E47F5F /* DetourNavMeshBuilder.h in Headers */, 292DB14619B4574100A80320 /* UIEditBoxImpl-android.h in Headers */, B6CAB49E1AF9AA1A00B9B856 /* PlatformDefinitions.h in Headers */, B665E2DD1AA80A6500DDB1C5 /* CCPUJetAffectorTranslator.h in Headers */, @@ -9871,6 +10176,7 @@ 15AE196219AAD35100C27E9E /* CCSSceneReader.h in Headers */, 1A01C69518F57BE800EFE3A6 /* CCFloat.h in Headers */, B665E2011AA80A6500DDB1C5 /* CCPUAlignAffector.h in Headers */, + B6DD2FEC1B04825B00E47F5F /* DetourProximityGrid.h in Headers */, B6CAB49C1AF9AA1A00B9B856 /* HeapManager.h in Headers */, 1A5701CA180BCB5A0088DEC7 /* CCLabelTextFormatter.h in Headers */, B6CAB25C1AF9AA1A00B9B856 /* btHashedSimplePairCache.h in Headers */, @@ -9910,8 +10216,10 @@ 1A5701E9180BCB8C0088DEC7 /* CCTransition.h in Headers */, 15AE198F19AAD36E00C27E9E /* CheckBoxReader.h in Headers */, B665E3911AA80A6500DDB1C5 /* CCPUPlaneCollider.h in Headers */, + B6DD2FAE1B04825B00E47F5F /* DetourDebugDraw.h in Headers */, 382384011A258FA7002C4610 /* util.h in Headers */, 18956BB51A9DFBFD006E9155 /* Particle3DReader.h in Headers */, + B6DD2FD81B04825B00E47F5F /* DetourCrowd.h in Headers */, B6CAB34A1AF9AA1A00B9B856 /* gim_clip_polygon.h in Headers */, B665E3F91AA80A6600DDB1C5 /* CCPUSlaveEmitterTranslator.h in Headers */, B665E2551AA80A6500DDB1C5 /* CCPUDoAffectorEventHandler.h in Headers */, @@ -9948,12 +10256,14 @@ 1A57020B180BCBDF0088DEC7 /* CCMotionStreak.h in Headers */, B665E2211AA80A6500DDB1C5 /* CCPUBehaviourManager.h in Headers */, 15AE195219AAD35100C27E9E /* CCDecorativeDisplay.h in Headers */, + B6DD2FAA1B04825B00E47F5F /* DebugDraw.h in Headers */, 15AE196619AAD35100C27E9E /* CCTween.h in Headers */, 15AE194619AAD35100C27E9E /* CCComAttribute.h in Headers */, B6CAB5181AF9AA1A00B9B856 /* btMotionState.h in Headers */, B6CAAFE51AF9A9E100B9B856 /* CCPhysics3D.h in Headers */, B6CAB1F41AF9AA1A00B9B856 /* btCollisionAlgorithm.h in Headers */, 382384241A2590DA002C4610 /* GameMapReader.h in Headers */, + B6DD2FDC1B04825B00E47F5F /* DetourLocalBoundary.h in Headers */, 15AE1ABD19AAD40300C27E9E /* b2PolygonAndCircleContact.h in Headers */, 15AE1AA819AAD40300C27E9E /* b2Island.h in Headers */, B665E2391AA80A6500DDB1C5 /* CCPUBoxEmitterTranslator.h in Headers */, @@ -9974,6 +10284,7 @@ 15FB20961AE7C57D00C31518 /* cdt.h in Headers */, 15AE1AC919AAD40300C27E9E /* b2Joint.h in Headers */, 382383EF1A258FA7002C4610 /* flatbuffers.h in Headers */, + B677B0CC1B18492D006762CB /* CCNavMesh.h in Headers */, B6D38B911AC3AFAC00043997 /* CCTextureCube.h in Headers */, B665E2811AA80A6500DDB1C5 /* CCPUDoScaleEventHandlerTranslator.h in Headers */, 15AE196819AAD35100C27E9E /* CCUtilMath.h in Headers */, @@ -10028,6 +10339,7 @@ B6CAB1F81AF9AA1A00B9B856 /* btDbvt.h in Headers */, B665E35D1AA80A6500DDB1C5 /* CCPUOnRandomObserver.h in Headers */, 1A570281180BCC900088DEC7 /* CCSprite.h in Headers */, + B6DD2FD21B04825B00E47F5F /* DetourNode.h in Headers */, 1A570285180BCC900088DEC7 /* CCSpriteBatchNode.h in Headers */, 15AE193B19AAD35100C27E9E /* CCArmatureDataManager.h in Headers */, 1A570289180BCC900088DEC7 /* CCSpriteFrame.h in Headers */, @@ -10070,6 +10382,7 @@ 1A5702ED180BCE750088DEC7 /* CCTileMapAtlas.h in Headers */, 15AE195E19AAD35100C27E9E /* CCSkin.h in Headers */, B6CAB3CC1AF9AA1A00B9B856 /* btPoint2PointConstraint.h in Headers */, + B6DD2FE01B04825B00E47F5F /* DetourObstacleAvoidance.h in Headers */, B6CAB5081AF9AA1A00B9B856 /* btGeometryUtil.h in Headers */, 1A5702F1180BCE750088DEC7 /* CCTMXLayer.h in Headers */, 15FB20771AE7BF8600C31518 /* MarchingSquare.h in Headers */, @@ -10138,6 +10451,7 @@ 15AE1BBE19AADFF000C27E9E /* SocketIO.h in Headers */, B665E3351AA80A6500DDB1C5 /* CCPUOnEmissionObserver.h in Headers */, B665E3811AA80A6500DDB1C5 /* CCPUParticleSystem3DTranslator.h in Headers */, + B6DD2FBA1B04825B00E47F5F /* DetourAlloc.h in Headers */, B6CAB4D21AF9AA1A00B9B856 /* SpuConvexPenetrationDepthSolver.h in Headers */, B665E2151AA80A6500DDB1C5 /* CCPUBaseForceAffectorTranslator.h in Headers */, 1A01C69B18F57BE800EFE3A6 /* CCSet.h in Headers */, @@ -10169,8 +10483,10 @@ B6CAB3761AF9AA1A00B9B856 /* btGjkEpa2.h in Headers */, 182C5CD91A98F30500C30D34 /* Sprite3DReader.h in Headers */, 50ABBE301925AB6F00A911A9 /* ccConfig.h in Headers */, + B6DD2FE41B04825B00E47F5F /* DetourPathCorridor.h in Headers */, 15AE195819AAD35100C27E9E /* CCInputDelegate.h in Headers */, B6CAB3281AF9AA1A00B9B856 /* btGImpactBvh.h in Headers */, + B6DD2FB61B04825B00E47F5F /* RecastDump.h in Headers */, 50ABBDAC1925AB4100A911A9 /* CCRenderCommandPool.h in Headers */, B6CAB24C1AF9AA1A00B9B856 /* btConvexPlaneCollisionAlgorithm.h in Headers */, B665E3CD1AA80A6600DDB1C5 /* CCPUScaleVelocityAffectorTranslator.h in Headers */, @@ -10269,6 +10585,7 @@ 299CF1FE19A434BC00C378C1 /* ccRandom.h in Headers */, B665E3BD1AA80A6500DDB1C5 /* CCPURibbonTrailRender.h in Headers */, 50ABBDBC1925AB4100A911A9 /* CCTextureAtlas.h in Headers */, + B6DD2FC01B04825B00E47F5F /* DetourCommon.h in Headers */, B6CAAFE91AF9A9E100B9B856 /* CCPhysics3DComponent.h in Headers */, 15AE182319AAD2F700C27E9E /* CCBundleReader.h in Headers */, 182C5CB51A95964F00C30D34 /* Node3DReader.h in Headers */, @@ -10306,6 +10623,7 @@ B6CAB3001AF9AA1A00B9B856 /* btTriangleIndexVertexArray.h in Headers */, B6CAB3881AF9AA1A00B9B856 /* btPersistentManifold.h in Headers */, B68779031A8CA82E00643ABF /* CCParticle3DRender.h in Headers */, + B6DD2FF01B04825B00E47F5F /* DetourTileCache.h in Headers */, 15AE195A19AAD35100C27E9E /* CCProcessBase.h in Headers */, 15AE193D19AAD35100C27E9E /* CCArmatureDefine.h in Headers */, B6CAB37A1AF9AA1A00B9B856 /* btGjkEpaPenetrationDepthSolver.h in Headers */, @@ -10379,6 +10697,7 @@ 15AE18D219AAD33D00C27E9E /* CCNodeLoaderListener.h in Headers */, 15AE184D19AAD30800C27E9E /* SimpleAudioEngine.h in Headers */, B665E3551AA80A6500DDB1C5 /* CCPUOnQuotaObserver.h in Headers */, + B677B0D01B18492D006762CB /* CCNavMeshAgent.h in Headers */, B665E3C91AA80A6600DDB1C5 /* CCPUScaleVelocityAffector.h in Headers */, B665E3FD1AA80A6600DDB1C5 /* CCPUSphere.h in Headers */, B68778FB1A8CA82E00643ABF /* CCParticle3DAffector.h in Headers */, @@ -10535,6 +10854,7 @@ 15AE189D19AAD33D00C27E9E /* CCNodeLoader.cpp in Sources */, B665E2461AA80A6500DDB1C5 /* CCPUCollisionAvoidanceAffectorTranslator.cpp in Sources */, B68779041A8CA82E00643ABF /* CCParticleSystem3D.cpp in Sources */, + B6DD2FB71B04825B00E47F5F /* DetourAlloc.cpp in Sources */, 5027253C190BF1B900AAF4ED /* cocos2d.cpp in Sources */, 50ABC0611926664800A911A9 /* CCCommon-mac.mm in Sources */, 50ABBDB11925AB4100A911A9 /* ccShaders.cpp in Sources */, @@ -10560,6 +10880,7 @@ B6CAB41F1AF9AA1A00B9B856 /* btMLCPSolver.cpp in Sources */, 46A170E61807CECA005B8026 /* CCPhysicsBody.cpp in Sources */, B665E40A1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */, + B677B0D91B18492D006762CB /* CCNavMeshTool.cpp in Sources */, 50ABBDA71925AB4100A911A9 /* CCRenderCommand.cpp in Sources */, B665E35E1AA80A6500DDB1C5 /* CCPUOnRandomObserverTranslator.cpp in Sources */, B6CAB2931AF9AA1A00B9B856 /* btCompoundShape.cpp in Sources */, @@ -10634,6 +10955,7 @@ B6CAB4D91AF9AA1A00B9B856 /* SpuMinkowskiPenetrationDepthSolver.cpp in Sources */, B665E3CE1AA80A6600DDB1C5 /* CCPUScriptCompiler.cpp in Sources */, 15AE18E819AAD35000C27E9E /* CCActionManagerEx.cpp in Sources */, + B677B0CD1B18492D006762CB /* CCNavMeshAgent.cpp in Sources */, B29A7DDB19EE1B7700872B35 /* Event.c in Sources */, 15AE191B19AAD35000C27E9E /* CCTransformHelp.cpp in Sources */, 15AE190319AAD35000C27E9E /* CCComRender.cpp in Sources */, @@ -10655,6 +10977,7 @@ B6CAB2451AF9AA1A00B9B856 /* btConvexConvexAlgorithm.cpp in Sources */, 15AE1B9D19AADFDF00C27E9E /* UIVBox.cpp in Sources */, B665E2B61AA80A6500DDB1C5 /* CCPUForceFieldAffector.cpp in Sources */, + B6DD2FD51B04825B00E47F5F /* DetourCrowd.cpp in Sources */, 1A570079180BC5A10088DEC7 /* CCActionInstant.cpp in Sources */, 15AE1A7019AAD40300C27E9E /* b2Contact.cpp in Sources */, 15AE18A619AAD33D00C27E9E /* CCScrollViewLoader.cpp in Sources */, @@ -10662,6 +10985,7 @@ 15AE184419AAD2F700C27E9E /* CCSprite3DMaterial.cpp in Sources */, 50ABBE591925AB6F00A911A9 /* CCEventKeyboard.cpp in Sources */, B665E2FA1AA80A6500DDB1C5 /* CCPUMaterialManager.cpp in Sources */, + B6DD2FAF1B04825B00E47F5F /* RecastDebugDraw.cpp in Sources */, B29A7DDF19EE1B7700872B35 /* IkConstraintData.c in Sources */, B665E3921AA80A6500DDB1C5 /* CCPUPlaneColliderTranslator.cpp in Sources */, 1A57007D180BC5A10088DEC7 /* CCActionInterval.cpp in Sources */, @@ -10679,6 +11003,7 @@ B665E3CA1AA80A6600DDB1C5 /* CCPUScaleVelocityAffectorTranslator.cpp in Sources */, 1A57008D180BC5A10088DEC7 /* CCActionTiledGrid.cpp in Sources */, B665E26E1AA80A6500DDB1C5 /* CCPUDoFreezeEventHandlerTranslator.cpp in Sources */, + B6DD2FF11B04825B00E47F5F /* DetourTileCacheBuilder.cpp in Sources */, B665E1FE1AA80A6500DDB1C5 /* CCPUAlignAffector.cpp in Sources */, B665E2961AA80A6500DDB1C5 /* CCPUEmitterManager.cpp in Sources */, 1A570091180BC5A10088DEC7 /* CCActionTween.cpp in Sources */, @@ -10715,11 +11040,13 @@ B6CAAFF61AF9A9E100B9B856 /* CCPhysics3DShape.cpp in Sources */, B6CAB3071AF9AA1A00B9B856 /* btTriangleMesh.cpp in Sources */, B29A7E1319EE1B7700872B35 /* Bone.c in Sources */, + B677B0C91B18492D006762CB /* CCNavMesh.cpp in Sources */, B665E1F61AA80A6500DDB1C5 /* CCPUAffectorManager.cpp in Sources */, 292DB14919B4574100A80320 /* UIEditBoxImpl-ios.mm in Sources */, B6CAB2511AF9AA1A00B9B856 /* btEmptyCollisionAlgorithm.cpp in Sources */, 15AE181019AAD2F700C27E9E /* CCAnimation3D.cpp in Sources */, 1A01C68418F57BE800EFE3A6 /* CCArray.cpp in Sources */, + B6DD2FDD1B04825B00E47F5F /* DetourObstacleAvoidance.cpp in Sources */, 1A570112180BC8EE0088DEC7 /* CCDrawNode.cpp in Sources */, B6CAB4B11AF9AA1A00B9B856 /* SpuContactManifoldCollisionAlgorithm.cpp in Sources */, 15AE186D19AAD31D00C27E9E /* SimpleAudioEngine_objc.m in Sources */, @@ -10734,6 +11061,7 @@ 382383FE1A258FA7002C4610 /* idl_parser.cpp in Sources */, 1A57011F180BC90D0088DEC7 /* CCGrid.cpp in Sources */, B665E26A1AA80A6500DDB1C5 /* CCPUDoFreezeEventHandler.cpp in Sources */, + B6DD2FD91B04825B00E47F5F /* DetourLocalBoundary.cpp in Sources */, 15AE187A19AAD33D00C27E9E /* CCBAnimationManager.cpp in Sources */, 15AE1B6D19AADA9900C27E9E /* UIHelper.cpp in Sources */, 15AE1A8A19AAD40300C27E9E /* b2PulleyJoint.cpp in Sources */, @@ -10746,6 +11074,7 @@ B6CAB2D51AF9AA1A00B9B856 /* btOptimizedBvh.cpp in Sources */, 50CB247B19D9C5A100687767 /* AudioEngine-inl.mm in Sources */, 1A5701A1180BCB590088DEC7 /* CCFontAtlas.cpp in Sources */, + B6DD2FC71B04825B00E47F5F /* DetourNavMeshBuilder.cpp in Sources */, B29A7DFF19EE1B7700872B35 /* Json.c in Sources */, B6CAB3111AF9AA1A00B9B856 /* btUniformScalingShape.cpp in Sources */, 15AE1A8619AAD40300C27E9E /* b2MouseJoint.cpp in Sources */, @@ -10759,6 +11088,7 @@ 1A5701B1180BCB590088DEC7 /* CCFontFNT.cpp in Sources */, B6CAB4A51AF9AA1A00B9B856 /* SequentialThreadSupport.cpp in Sources */, 15AE181619AAD2F700C27E9E /* CCAttachNode.cpp in Sources */, + B6DD2FE91B04825B00E47F5F /* DetourProximityGrid.cpp in Sources */, B29A7DED19EE1B7700872B35 /* IkConstraint.c in Sources */, 18956BB21A9DFBFD006E9155 /* Particle3DReader.cpp in Sources */, 1A5701B5180BCB590088DEC7 /* CCFontFreeType.cpp in Sources */, @@ -10788,6 +11118,7 @@ B6CAB3D51AF9AA1A00B9B856 /* btSolve2LinearConstraint.cpp in Sources */, B6CAB2591AF9AA1A00B9B856 /* btHashedSimplePairCache.cpp in Sources */, 382F7ADC1AB1292A002EBECF /* CCObjectExtensionData.cpp in Sources */, + B6DD2FAB1B04825B00E47F5F /* DetourDebugDraw.cpp in Sources */, 15AE191719AAD35000C27E9E /* CCSpriteFrameCacheHelper.cpp in Sources */, B665E2E21AA80A6500DDB1C5 /* CCPULineAffectorTranslator.cpp in Sources */, B6CAB2A31AF9AA1A00B9B856 /* btConvexHullShape.cpp in Sources */, @@ -10812,6 +11143,7 @@ 3EACC9A419F5014D00EB3C5E /* CCLight.cpp in Sources */, B6CAB4C91AF9AA1A00B9B856 /* SpuCollisionShapes.cpp in Sources */, B6CAB38B1AF9AA1A00B9B856 /* btPolyhedralContactClipping.cpp in Sources */, + B677B0D51B18492D006762CB /* CCNavMeshObstacle.cpp in Sources */, B665E42E1AA80A6600DDB1C5 /* CCPUVelocityMatchingAffectorTranslator.cpp in Sources */, 1A5701E2180BCB8C0088DEC7 /* CCScene.cpp in Sources */, B6CAB5351AF9AA1A00B9B856 /* btVector3.cpp in Sources */, @@ -10875,6 +11207,7 @@ B665E3FE1AA80A6600DDB1C5 /* CCPUSphereCollider.cpp in Sources */, B6CAB3591AF9AA1A00B9B856 /* gim_memory.cpp in Sources */, B665E25A1AA80A6500DDB1C5 /* CCPUDoEnableComponentEventHandler.cpp in Sources */, + B6DD2FB31B04825B00E47F5F /* RecastDump.cpp in Sources */, B6CAB2BB1AF9AA1A00B9B856 /* btCylinderShape.cpp in Sources */, 15AE1BD019AAE01E00C27E9E /* CCControlHuePicker.cpp in Sources */, B6CAAFFA1AF9A9E100B9B856 /* CCPhysics3DWorld.cpp in Sources */, @@ -10916,6 +11249,7 @@ B29A7DF319EE1B7700872B35 /* AttachmentLoader.c in Sources */, B6CAB3331AF9AA1A00B9B856 /* btGImpactShape.cpp in Sources */, 382383F01A258FA7002C4610 /* flatc.cpp in Sources */, + B6DD2FA71B04825B00E47F5F /* DebugDraw.cpp in Sources */, B665E31A1AA80A6500DDB1C5 /* CCPUOnClearObserver.cpp in Sources */, 1A57028A180BCC900088DEC7 /* CCSpriteFrameCache.cpp in Sources */, 15AE18E619AAD35000C27E9E /* CCActionFrameEasing.cpp in Sources */, @@ -10936,6 +11270,7 @@ 1A570296180BCCAB0088DEC7 /* CCAnimationCache.cpp in Sources */, B29A7E1B19EE1B7700872B35 /* SkeletonJson.c in Sources */, 50ABBE351925AB6F00A911A9 /* CCConsole.cpp in Sources */, + B6DD2FED1B04825B00E47F5F /* DetourTileCache.cpp in Sources */, B665E3FA1AA80A6600DDB1C5 /* CCPUSphere.cpp in Sources */, 50ABBEAF1925AB6F00A911A9 /* CCUserDefault.cpp in Sources */, 15AE1BCB19AAE01E00C27E9E /* CCControlButton.cpp in Sources */, @@ -11005,6 +11340,7 @@ B665E3621AA80A6500DDB1C5 /* CCPUOnTimeObserver.cpp in Sources */, 15AE18DF19AAD35000C27E9E /* TriggerBase.cpp in Sources */, 15AE1A7219AAD40300C27E9E /* b2ContactSolver.cpp in Sources */, + B6DD2FE11B04825B00E47F5F /* DetourPathCorridor.cpp in Sources */, B665E2BE1AA80A6500DDB1C5 /* CCPUGeometryRotator.cpp in Sources */, 3823841A1A2590D2002C4610 /* ComAudioReader.cpp in Sources */, 15AE1BC519AAE00000C27E9E /* AssetsManager.cpp in Sources */, @@ -11037,6 +11373,7 @@ 1A570310180BCF190088DEC7 /* CCComponentContainer.cpp in Sources */, 15AE190719AAD35000C27E9E /* CCDatas.cpp in Sources */, 1A01C69C18F57BE800EFE3A6 /* CCString.cpp in Sources */, + B6DD2FCB1B04825B00E47F5F /* DetourNavMeshQuery.cpp in Sources */, B6CAB26D1AF9AA1A00B9B856 /* btSphereSphereCollisionAlgorithm.cpp in Sources */, B6CAB3251AF9AA1A00B9B856 /* btGImpactBvh.cpp in Sources */, B665E2721AA80A6500DDB1C5 /* CCPUDoPlacementParticleEventHandler.cpp in Sources */, @@ -11091,6 +11428,7 @@ 15AE18FA19AAD35000C27E9E /* CCColliderDetector.cpp in Sources */, 50ABBEA71925AB6F00A911A9 /* CCTouch.cpp in Sources */, 15AE191319AAD35000C27E9E /* CCSGUIReader.cpp in Sources */, + B6DD2FBD1B04825B00E47F5F /* DetourCommon.cpp in Sources */, 15AE186819AAD31D00C27E9E /* CDXMacOSXSupport.mm in Sources */, B665E3221AA80A6500DDB1C5 /* CCPUOnCollisionObserver.cpp in Sources */, 15AE191519AAD35000C27E9E /* CCSkin.cpp in Sources */, @@ -11134,6 +11472,7 @@ B665E2921AA80A6500DDB1C5 /* CCPUEmitter.cpp in Sources */, 15B3708419EE414C00ABE682 /* Downloader.cpp in Sources */, 50ABC0631926664800A911A9 /* CCDevice-mac.mm in Sources */, + B677B0D11B18492D006762CB /* CCNavMeshDebugDraw.cpp in Sources */, 15AE1A2819AAD3D500C27E9E /* b2Collision.cpp in Sources */, 15AE1B6719AADA9900C27E9E /* UIScale9Sprite.cpp in Sources */, 292DB14319B4574100A80320 /* UIEditBoxImpl-android.cpp in Sources */, @@ -11173,6 +11512,7 @@ B665E4021AA80A6600DDB1C5 /* CCPUSphereColliderTranslator.cpp in Sources */, 15AE1A3619AAD3D500C27E9E /* b2PolygonShape.cpp in Sources */, D0FD03531A3B51AA00825BB5 /* CCAllocatorGlobalNewDelete.cpp in Sources */, + B6DD2FE51B04825B00E47F5F /* DetourPathQueue.cpp in Sources */, B665E39A1AA80A6500DDB1C5 /* CCPUPointEmitterTranslator.cpp in Sources */, 50ABBD9B1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */, 15AE188119AAD33D00C27E9E /* CCBReader.cpp in Sources */, @@ -11218,12 +11558,15 @@ B6CAB3811AF9AA1A00B9B856 /* btMinkowskiPenetrationDepthSolver.cpp in Sources */, B6CAB4AD1AF9AA1A00B9B856 /* SpuCollisionTaskProcess.cpp in Sources */, 50ABBE9F1925AB6F00A911A9 /* CCScheduler.cpp in Sources */, + B6DD2FC31B04825B00E47F5F /* DetourNavMesh.cpp in Sources */, + B6DD2FCF1B04825B00E47F5F /* DetourNode.cpp in Sources */, 15AE1C1119AAE2C600C27E9E /* CCPhysicsDebugNode.cpp in Sources */, B665E2521AA80A6500DDB1C5 /* CCPUDoAffectorEventHandler.cpp in Sources */, 50ABC0151926664800A911A9 /* CCImage.cpp in Sources */, 50ABBE231925AB6F00A911A9 /* base64.cpp in Sources */, B665E3AA1AA80A6500DDB1C5 /* CCPURandomiserTranslator.cpp in Sources */, 15AE1B5D19AADA9900C27E9E /* UITextBMFont.cpp in Sources */, + B6DD2FF51B04825B00E47F5F /* fastlz.c in Sources */, B665E3561AA80A6500DDB1C5 /* CCPUOnQuotaObserverTranslator.cpp in Sources */, 382384361A259126002C4610 /* ProjectNodeReader.cpp in Sources */, B665E37A1AA80A6500DDB1C5 /* CCPUParticleSystem3D.cpp in Sources */, @@ -11301,6 +11644,7 @@ B665E38F1AA80A6500DDB1C5 /* CCPUPlaneCollider.cpp in Sources */, B665E21B1AA80A6500DDB1C5 /* CCPUBehaviour.cpp in Sources */, B6CAB2CA1AF9AA1A00B9B856 /* btMinkowskiSumShape.cpp in Sources */, + B6DD2FE61B04825B00E47F5F /* DetourPathQueue.cpp in Sources */, B665E38B1AA80A6500DDB1C5 /* CCPUPlane.cpp in Sources */, B665E2731AA80A6500DDB1C5 /* CCPUDoPlacementParticleEventHandler.cpp in Sources */, 15AE1C0519AAE01E00C27E9E /* CCTableViewCell.cpp in Sources */, @@ -11323,6 +11667,7 @@ B665E35B1AA80A6500DDB1C5 /* CCPUOnRandomObserver.cpp in Sources */, 50ABC0161926664800A911A9 /* CCImage.cpp in Sources */, B665E3AB1AA80A6500DDB1C5 /* CCPURandomiserTranslator.cpp in Sources */, + B6DD2FE21B04825B00E47F5F /* DetourPathCorridor.cpp in Sources */, 1A01C6A518F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */, 292DB14E19B4574100A80320 /* UIEditBoxImpl-mac.mm in Sources */, B6CAB4BC1AF9AA1A00B9B856 /* SpuGatheringCollisionDispatcher.cpp in Sources */, @@ -11344,11 +11689,13 @@ 50ABBE561925AB6F00A911A9 /* CCEventFocus.cpp in Sources */, 382F7ADD1AB1292A002EBECF /* CCObjectExtensionData.cpp in Sources */, 15AE183D19AAD2F700C27E9E /* CCSkeleton3D.cpp in Sources */, + B6DD2FF21B04825B00E47F5F /* DetourTileCacheBuilder.cpp in Sources */, 503DD8E11926736A00CD74DD /* CCApplication-ios.mm in Sources */, 15AE1AAC19AAD40300C27E9E /* b2WorldCallbacks.cpp in Sources */, B6CAB20C1AF9AA1A00B9B856 /* btQuantizedBvh.cpp in Sources */, B6CAB3F21AF9AA1A00B9B856 /* btSimpleDynamicsWorld.cpp in Sources */, 15AE18C719AAD33D00C27E9E /* CCMenuItemImageLoader.cpp in Sources */, + B6DD2FF61B04825B00E47F5F /* fastlz.c in Sources */, 50ABC01A1926664800A911A9 /* CCSAXParser.cpp in Sources */, B29A7E1C19EE1B7700872B35 /* SkeletonJson.c in Sources */, B2CC507C19776DD10041958E /* CCPhysicsJoint.cpp in Sources */, @@ -11380,6 +11727,7 @@ B29A7E0C19EE1B7700872B35 /* Atlas.c in Sources */, 15AE185E19AAD31200C27E9E /* CocosDenshion.m in Sources */, B665E2071AA80A6500DDB1C5 /* CCPUBaseCollider.cpp in Sources */, + B6DD2FB01B04825B00E47F5F /* RecastDebugDraw.cpp in Sources */, 46A170FE1807CECB005B8026 /* CCPhysicsContact.cpp in Sources */, 1A570062180BC5A10088DEC7 /* CCAction.cpp in Sources */, 1A570066180BC5A10088DEC7 /* CCActionCamera.cpp in Sources */, @@ -11478,6 +11826,7 @@ 50ABBE761925AB6F00A911A9 /* CCEventListenerTouch.cpp in Sources */, 15AE1AD219AAD40300C27E9E /* b2RopeJoint.cpp in Sources */, B29A7DCC19EE1B7700872B35 /* Skeleton.c in Sources */, + B6DD2FEE1B04825B00E47F5F /* DetourTileCache.cpp in Sources */, B6CAB2B41AF9AA1A00B9B856 /* btConvexShape.cpp in Sources */, 15AE1A4919AAD3D500C27E9E /* b2CircleShape.cpp in Sources */, 15AE184119AAD2F700C27E9E /* CCSprite3D.cpp in Sources */, @@ -11499,6 +11848,7 @@ 15AE1A3E19AAD3D500C27E9E /* b2CollidePolygon.cpp in Sources */, 15AE1AB219AAD40300C27E9E /* b2CircleContact.cpp in Sources */, B29A7E2619EE1B7700872B35 /* Attachment.c in Sources */, + B6DD2FDA1B04825B00E47F5F /* DetourLocalBoundary.cpp in Sources */, 15AE18C119AAD33D00C27E9E /* CCLayerColorLoader.cpp in Sources */, 50ABBD551925AB0000A911A9 /* TransformUtils.cpp in Sources */, B665E2CF1AA80A6500DDB1C5 /* CCPUInterParticleCollider.cpp in Sources */, @@ -11506,6 +11856,7 @@ 15AE193619AAD35100C27E9E /* CCArmature.cpp in Sources */, 1A57007A180BC5A10088DEC7 /* CCActionInstant.cpp in Sources */, 15AE1AC419AAD40300C27E9E /* b2FrictionJoint.cpp in Sources */, + B6DD2FDE1B04825B00E47F5F /* DetourObstacleAvoidance.cpp in Sources */, 15AE1BEC19AAE01E00C27E9E /* CCControlColourPicker.cpp in Sources */, B6CAB2361AF9AA1A00B9B856 /* btCompoundCollisionAlgorithm.cpp in Sources */, 382383FD1A258FA7002C4610 /* idl_gen_text.cpp in Sources */, @@ -11549,6 +11900,7 @@ B6CAB3341AF9AA1A00B9B856 /* btGImpactShape.cpp in Sources */, B6CAB4C61AF9AA1A00B9B856 /* boxBoxDistance.cpp in Sources */, 1A57008E180BC5A10088DEC7 /* CCActionTiledGrid.cpp in Sources */, + B677B0CE1B18492D006762CB /* CCNavMeshAgent.cpp in Sources */, B6CAB2A01AF9AA1A00B9B856 /* btConvex2dShape.cpp in Sources */, 1A570092180BC5A10088DEC7 /* CCActionTween.cpp in Sources */, 1A570099180BC5C10088DEC7 /* CCAtlasNode.cpp in Sources */, @@ -11556,6 +11908,7 @@ B6CAAFF31AF9A9E100B9B856 /* CCPhysics3DObject.cpp in Sources */, B665E2931AA80A6500DDB1C5 /* CCPUEmitter.cpp in Sources */, 50ABBD4D1925AB0000A911A9 /* MathUtil.cpp in Sources */, + B6DD2FCC1B04825B00E47F5F /* DetourNavMeshQuery.cpp in Sources */, 50ABBE3E1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */, B6CAB4B21AF9AA1A00B9B856 /* SpuContactManifoldCollisionAlgorithm.cpp in Sources */, 1A57009F180BC5D20088DEC7 /* CCNode.cpp in Sources */, @@ -11577,6 +11930,7 @@ B6CAB3F81AF9AA1A00B9B856 /* btMultiBody.cpp in Sources */, 503DD8E21926736A00CD74DD /* CCCommon-ios.mm in Sources */, 292DB14A19B4574100A80320 /* UIEditBoxImpl-ios.mm in Sources */, + B677B0D61B18492D006762CB /* CCNavMeshObstacle.cpp in Sources */, B6CAB2561AF9AA1A00B9B856 /* btGhostObject.cpp in Sources */, 15AE1A9419AAD40300C27E9E /* b2BlockAllocator.cpp in Sources */, B29A7E3C19EE1B7700872B35 /* Animation.c in Sources */, @@ -11598,6 +11952,7 @@ 1A5701A6180BCB590088DEC7 /* CCFontAtlasCache.cpp in Sources */, 15AE192B19AAD35100C27E9E /* TriggerObj.cpp in Sources */, B6CAAFEB1AF9A9E100B9B856 /* CCPhysics3DConstraint.cpp in Sources */, + B677B0D21B18492D006762CB /* CCNavMeshDebugDraw.cpp in Sources */, 4D76BE3B1A4AAF0A00102962 /* CCActionTimelineNode.cpp in Sources */, 15AE198519AAD36400C27E9E /* WidgetReader.cpp in Sources */, B665E36B1AA80A6500DDB1C5 /* CCPUOnVelocityObserver.cpp in Sources */, @@ -11637,6 +11992,7 @@ B665E3771AA80A6500DDB1C5 /* CCPUParticleFollowerTranslator.cpp in Sources */, B6CAB4CA1AF9AA1A00B9B856 /* SpuCollisionShapes.cpp in Sources */, 15AE1B7C19AADA9A00C27E9E /* UISlider.cpp in Sources */, + B6DD2FC41B04825B00E47F5F /* DetourNavMesh.cpp in Sources */, B6CAAFFB1AF9A9E100B9B856 /* CCPhysics3DWorld.cpp in Sources */, B665E3471AA80A6500DDB1C5 /* CCPUOnExpireObserverTranslator.cpp in Sources */, B6CAB2A41AF9AA1A00B9B856 /* btConvexHullShape.cpp in Sources */, @@ -11708,6 +12064,7 @@ 503DD8ED1926736A00CD74DD /* CCGLViewImpl-ios.mm in Sources */, 15AE197719AAD35700C27E9E /* CCActionTimeline.cpp in Sources */, 15AE19B419AAD39700C27E9E /* TextAtlasReader.cpp in Sources */, + B6DD2FA81B04825B00E47F5F /* DebugDraw.cpp in Sources */, B665E2A31AA80A6500DDB1C5 /* CCPUEventHandlerManager.cpp in Sources */, B6CAB3601AF9AA1A00B9B856 /* gim_tri_collision.cpp in Sources */, 15AE194019AAD35100C27E9E /* CCBone.cpp in Sources */, @@ -11734,9 +12091,11 @@ B6CAB1FA1AF9AA1A00B9B856 /* btDbvtBroadphase.cpp in Sources */, 15AE1A4319AAD3D500C27E9E /* b2DynamicTree.cpp in Sources */, 15AE1A3A19AAD3D500C27E9E /* b2BroadPhase.cpp in Sources */, + B6DD2FC81B04825B00E47F5F /* DetourNavMeshBuilder.cpp in Sources */, B665E42B1AA80A6600DDB1C5 /* CCPUVelocityMatchingAffector.cpp in Sources */, B665E3371AA80A6500DDB1C5 /* CCPUOnEmissionObserverTranslator.cpp in Sources */, 15AE19B619AAD39700C27E9E /* TextBMFontReader.cpp in Sources */, + B6DD2FBE1B04825B00E47F5F /* DetourCommon.cpp in Sources */, 15AE1BFD19AAE01E00C27E9E /* CCInvocation.cpp in Sources */, B24AA98A195A675C007B4522 /* CCFastTMXTiledMap.cpp in Sources */, 38F5263F1A48363B000DB7F7 /* ArmatureNodeReader.cpp in Sources */, @@ -11832,6 +12191,7 @@ 1A5702F7180BCE750088DEC7 /* CCTMXTiledMap.cpp in Sources */, 50ABBEC61925AB6F00A911A9 /* etc1.cpp in Sources */, 50ABBE8C1925AB6F00A911A9 /* CCNS.cpp in Sources */, + B6DD2FAC1B04825B00E47F5F /* DetourDebugDraw.cpp in Sources */, B29A7DE019EE1B7700872B35 /* IkConstraintData.c in Sources */, B6CAB40C1AF9AA1A00B9B856 /* btMultiBodyJointMotor.cpp in Sources */, B6CAB2D21AF9AA1A00B9B856 /* btMultiSphereShape.cpp in Sources */, @@ -11923,9 +12283,11 @@ B6CAB3821AF9AA1A00B9B856 /* btMinkowskiPenetrationDepthSolver.cpp in Sources */, B6CAB3641AF9AA1A00B9B856 /* btContinuousConvexCollision.cpp in Sources */, 52B47A2F1A5349A3004E4C60 /* HttpAsynConnection.m in Sources */, + B6DD2FB41B04825B00E47F5F /* RecastDump.cpp in Sources */, B665E23B1AA80A6500DDB1C5 /* CCPUCircleEmitter.cpp in Sources */, 15AE1B8019AADA9A00C27E9E /* UITextAtlas.cpp in Sources */, 15AE195919AAD35100C27E9E /* CCProcessBase.cpp in Sources */, + B6DD2FB81B04825B00E47F5F /* DetourAlloc.cpp in Sources */, B665E3FF1AA80A6600DDB1C5 /* CCPUSphereCollider.cpp in Sources */, 15AE18D319AAD33D00C27E9E /* CCParticleSystemQuadLoader.cpp in Sources */, B6CAB4CE1AF9AA1A00B9B856 /* SpuContactResult.cpp in Sources */, @@ -11939,6 +12301,7 @@ 15AE195719AAD35100C27E9E /* CCInputDelegate.cpp in Sources */, B6CAB32A1AF9AA1A00B9B856 /* btGImpactCollisionAlgorithm.cpp in Sources */, 15AE1B8A19AADA9A00C27E9E /* UIImageView.cpp in Sources */, + B6DD2FD61B04825B00E47F5F /* DetourCrowd.cpp in Sources */, 50ABBD391925AB0000A911A9 /* CCAffineTransform.cpp in Sources */, B6CAB5421AF9AA1A00B9B856 /* MiniCL.cpp in Sources */, B6CAB4AE1AF9AA1A00B9B856 /* SpuCollisionTaskProcess.cpp in Sources */, @@ -12027,6 +12390,7 @@ 50ABBD5D1925AB0000A911A9 /* Vec3.cpp in Sources */, B6CAB2061AF9AA1A00B9B856 /* btOverlappingPairCache.cpp in Sources */, 38B8E2D619E66581002D7CE7 /* CSLoader.cpp in Sources */, + B677B0CA1B18492D006762CB /* CCNavMesh.cpp in Sources */, B665E3B31AA80A6500DDB1C5 /* CCPURendererTranslator.cpp in Sources */, B6CAAFE71AF9A9E100B9B856 /* CCPhysics3DComponent.cpp in Sources */, B6CAB2141AF9AA1A00B9B856 /* btActivatingCollisionAlgorithm.cpp in Sources */, @@ -12057,6 +12421,7 @@ D0FD034C1A3B51AA00825BB5 /* CCAllocatorDiagnostics.cpp in Sources */, B665E31F1AA80A6500DDB1C5 /* CCPUOnClearObserverTranslator.cpp in Sources */, B665E4331AA80A6600DDB1C5 /* CCPUVertexEmitter.cpp in Sources */, + B677B0DA1B18492D006762CB /* CCNavMeshTool.cpp in Sources */, B665E3C71AA80A6600DDB1C5 /* CCPUScaleVelocityAffector.cpp in Sources */, B6CAB26E1AF9AA1A00B9B856 /* btSphereSphereCollisionAlgorithm.cpp in Sources */, 50ABBED01925AB6F00A911A9 /* TGAlib.cpp in Sources */, @@ -12074,7 +12439,9 @@ B6CAB3121AF9AA1A00B9B856 /* btUniformScalingShape.cpp in Sources */, 1A1645B3191B726C008C7C7F /* ConvertUTFWrapper.cpp in Sources */, 15B3708519EE414C00ABE682 /* Downloader.cpp in Sources */, + B6DD2FEA1B04825B00E47F5F /* DetourProximityGrid.cpp in Sources */, 1ABA68AF1888D700007D1BB4 /* CCFontCharMap.cpp in Sources */, + B6DD2FD01B04825B00E47F5F /* DetourNode.cpp in Sources */, B6CAB2DE1AF9AA1A00B9B856 /* btScaledBvhTriangleMeshShape.cpp in Sources */, 15AE180D19AAD2F700C27E9E /* CCAnimate3D.cpp in Sources */, B6CAB1EE1AF9AA1A00B9B856 /* btBroadphaseProxy.cpp in Sources */, diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index c51f3af65659..2d6b5cad3dae 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -834,6 +834,8 @@ B603F1B51AC8FBFB00A9579C /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; }; B609E67319C18DAD003D0074 /* BillBoardTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B609E67119C18DAD003D0074 /* BillBoardTest.cpp */; }; B609E67419C18DAD003D0074 /* BillBoardTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B609E67119C18DAD003D0074 /* BillBoardTest.cpp */; }; + B61E90CB1B12B74B00BE69EA /* NavMesh in Resources */ = {isa = PBXBuildFile; fileRef = B61E90CA1B12B74B00BE69EA /* NavMesh */; }; + B61E90CC1B12B74B00BE69EA /* NavMesh in Resources */ = {isa = PBXBuildFile; fileRef = B61E90CA1B12B74B00BE69EA /* NavMesh */; }; B6337DF71ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */; }; B6337DF81ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */; }; B639932E1A490EC700B07923 /* Particle3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B639932C1A490EC700B07923 /* Particle3DTest.cpp */; }; @@ -844,6 +846,8 @@ 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 */; }; + B6DD2FFC1B04979C00E47F5F /* NavMeshTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FFA1B04979C00E47F5F /* NavMeshTest.cpp */; }; + B6DD2FFD1B04979C00E47F5F /* NavMeshTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FFA1B04979C00E47F5F /* NavMeshTest.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 */; }; @@ -1784,6 +1788,7 @@ B603F1B31AC8FBFB00A9579C /* TerrainTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TerrainTest; path = "../tests/cpp-tests/Resources/TerrainTest"; sourceTree = ""; }; B609E67119C18DAD003D0074 /* BillBoardTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BillBoardTest.cpp; path = BillBoardTest/BillBoardTest.cpp; sourceTree = ""; }; B609E67219C18DAD003D0074 /* BillBoardTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BillBoardTest.h; path = BillBoardTest/BillBoardTest.h; sourceTree = ""; }; + B61E90CA1B12B74B00BE69EA /* NavMesh */ = {isa = PBXFileReference; lastKnownFileType = folder; name = NavMesh; path = "../tests/cpp-tests/Resources/NavMesh"; sourceTree = ""; }; B6337DF51ABA9B44005AEF24 /* PerformanceParticle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceParticle3DTest.cpp; sourceTree = ""; }; B6337DF61ABA9B44005AEF24 /* PerformanceParticle3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceParticle3DTest.h; sourceTree = ""; }; B639932C1A490EC700B07923 /* Particle3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Particle3DTest.cpp; path = Particle3DTest/Particle3DTest.cpp; sourceTree = ""; }; @@ -1793,6 +1798,8 @@ B6C039D819C95D83007207DC /* LightTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LightTest.h; path = LightTest/LightTest.h; sourceTree = ""; }; B6CAB54C1AF9AA6C00B9B856 /* Physics3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Physics3DTest.cpp; path = Physics3DTest/Physics3DTest.cpp; sourceTree = ""; }; B6CAB54D1AF9AA6C00B9B856 /* Physics3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Physics3DTest.h; path = Physics3DTest/Physics3DTest.h; sourceTree = ""; }; + B6DD2FFA1B04979C00E47F5F /* NavMeshTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NavMeshTest.cpp; path = NavMeshTest/NavMeshTest.cpp; sourceTree = ""; }; + B6DD2FFB1B04979C00E47F5F /* NavMeshTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NavMeshTest.h; path = NavMeshTest/NavMeshTest.h; sourceTree = ""; }; C04F93581941B05400E9FEAB /* TileMapTest2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TileMapTest2.cpp; sourceTree = ""; }; C04F93591941B05400E9FEAB /* TileMapTest2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TileMapTest2.h; sourceTree = ""; }; C08689C018D370C90093E810 /* background.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = background.caf; path = "../tests/cpp-tests/Resources/background.caf"; sourceTree = ""; }; @@ -2211,6 +2218,7 @@ 1AC3592418CECF0A00F37B72 /* Classes */ = { isa = PBXGroup; children = ( + B6DD2FF91B04972B00E47F5F /* NavMeshTest */, B6CAB54B1AF9AA4B00B9B856 /* Physics3DTest */, 5046AB471AF2A8D80060550B /* MaterialSystemTest */, 6886696E1AE8E8A000C2CFD9 /* SpritePolygonTest */, @@ -3253,6 +3261,7 @@ 1AC35CA818CED83500F37B72 /* Resources */ = { isa = PBXGroup; children = ( + B61E90CA1B12B74B00BE69EA /* NavMesh */, 5046AB5A1AF2C4180060550B /* Materials */, B603F1B31AC8FBFB00A9579C /* TerrainTest */, B63993301A49359F00B07923 /* Particle3D */, @@ -4062,6 +4071,15 @@ name = Physics3DTest; sourceTree = ""; }; + B6DD2FF91B04972B00E47F5F /* NavMeshTest */ = { + isa = PBXGroup; + children = ( + B6DD2FFA1B04979C00E47F5F /* NavMeshTest.cpp */, + B6DD2FFB1B04979C00E47F5F /* NavMeshTest.h */, + ); + name = NavMeshTest; + sourceTree = ""; + }; D0FD03611A3B543700825BB5 /* AllocatorTest */ = { isa = PBXGroup; children = ( @@ -4273,6 +4291,11 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0600; + TargetAttributes = { + 1D6058900D05DD3D006BFB54 = { + DevelopmentTeam = U7E7529TA5; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "cocos2d_tests" */; compatibilityVersion = "Xcode 3.2"; @@ -4567,6 +4590,7 @@ 1AC35CDE18CED84500F37B72 /* components in Resources */, 1AC35D0818CED84500F37B72 /* TileMaps in Resources */, 1AC35CE218CED84500F37B72 /* effect1.raw in Resources */, + B61E90CB1B12B74B00BE69EA /* NavMesh in Resources */, 1AC35CF218CED84500F37B72 /* Hello.png in Resources */, 1AC35CA518CECF1E00F37B72 /* Icon.icns in Resources */, 5046AB5B1AF2C4180060550B /* Materials in Resources */, @@ -4665,6 +4689,7 @@ 1AC35C8F18CECF1400F37B72 /* Icon-152.png in Resources */, 1AC35CE718CED84500F37B72 /* effect2.ogg in Resources */, 38FA2E77194AECF800FF2BE4 /* ActionTimeline in Resources */, + B61E90CC1B12B74B00BE69EA /* NavMesh in Resources */, 1AC35C9718CECF1400F37B72 /* Icon-80.png in Resources */, 1AC35CEB18CED84500F37B72 /* fileLookup.plist in Resources */, 527B1F3519EF9CF8000A1F82 /* Default-736h@3x.png in Resources */, @@ -4957,6 +4982,7 @@ 1AC35BE718CECF0C00F37B72 /* CCControlScene.cpp in Sources */, B609E67319C18DAD003D0074 /* BillBoardTest.cpp in Sources */, 292CF01419A1965E00E8E6A0 /* UIEditBoxTest.cpp in Sources */, + B6DD2FFC1B04979C00E47F5F /* NavMeshTest.cpp in Sources */, D0FD03641A3B546400825BB5 /* AllocatorTest.cpp in Sources */, 29080DBF191B595E0066F8DF /* UIPageViewTest_Editor.cpp in Sources */, 1AC35B5F18CECF0C00F37B72 /* DataVisitorTest.cpp in Sources */, @@ -5267,6 +5293,7 @@ 1AC35BFC18CECF0C00F37B72 /* NotificationCenterTest.cpp in Sources */, 29FBBBFF196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */, 1AC35C3618CECF0C00F37B72 /* PerformanceSpriteTest.cpp in Sources */, + B6DD2FFD1B04979C00E47F5F /* NavMeshTest.cpp in Sources */, B6C039DA19C95D83007207DC /* LightTest.cpp in Sources */, 1AC35C3C18CECF0C00F37B72 /* PerformanceTouchesTest.cpp in Sources */, 29080DA2191B595E0066F8DF /* GUIEditorTest.cpp in Sources */, diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp index 252c3952a890..045c726a9e3b 100644 --- a/cocos/2d/CCScene.cpp +++ b/cocos/2d/CCScene.cpp @@ -42,6 +42,10 @@ THE SOFTWARE. #include "physics3d/CCPhysics3DComponent.h" #endif +#if CC_USE_NAVMESH +#include "navmesh/CCNavMesh.h" +#endif + NS_CC_BEGIN Scene::Scene() @@ -52,6 +56,10 @@ Scene::Scene() #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION _physics3DWorld = nullptr; _physics3dDebugCamera = nullptr; +#endif +#if CC_USE_NAVMESH + _navMesh = nullptr; + _navMeshDebugCamera = nullptr; #endif _ignoreAnchorPointForPosition = true; setAnchorPoint(Vec2(0.5f, 0.5f)); @@ -74,11 +82,26 @@ Scene::~Scene() #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION CC_SAFE_RELEASE(_physics3DWorld); CC_SAFE_RELEASE(_physics3dDebugCamera); +#endif +#if CC_USE_NAVMESH + CC_SAFE_RELEASE(_navMesh); #endif Director::getInstance()->getEventDispatcher()->removeEventListener(_event); CC_SAFE_RELEASE(_event); } +#if CC_USE_NAVMESH +void Scene::setNavMesh(NavMesh* navMesh) +{ + if (_navMesh != navMesh) + { + CC_SAFE_RETAIN(navMesh); + CC_SAFE_RELEASE(_navMesh); + _navMesh = navMesh; + } +} +#endif + bool Scene::init() { auto size = Director::getInstance()->getWinSize(); @@ -168,6 +191,12 @@ void Scene::render(Renderer* renderer) camera->clearBackground(1.0); //visit the scene visit(renderer, transform, 0); +#if CC_USE_NAVMESH + if (_navMesh && _navMeshDebugCamera == camera) + { + _navMesh->debugDraw(renderer); + } +#endif renderer->render(); @@ -211,17 +240,62 @@ void Scene::setPhysics3DDebugCamera(Camera* camera) } #endif -#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION)) +#if CC_USE_NAVMESH +void Scene::setNavMeshDebugCamera(Camera *camera) +{ + CC_SAFE_RETAIN(camera); + CC_SAFE_RELEASE(_navMeshDebugCamera); + _navMeshDebugCamera = camera; +} + +void Scene::addChildToNavMesh(Node* child) +{ + if (_navMesh) + { + std::function addToNavMeshFunc = nullptr; + addToNavMeshFunc = [this, &addToNavMeshFunc](Node* node) -> void + { + auto agCom = static_cast(node->getComponent(NavMeshAgent::getNavMeshAgentComponentName())); + if (agCom) + { + agCom->onEnter(); + } + + auto obCom = static_cast(node->getComponent(NavMeshObstacle::getNavMeshObstacleComponentName())); + if (obCom) + { + obCom->onEnter(); + } + + auto& children = node->getChildren(); + for (const auto &n : children) { + addToNavMeshFunc(n); + } + }; + + addToNavMeshFunc(child); + } +} + +#endif + +#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION) || CC_USE_NAVMESH) void Scene::addChild(Node* child, int zOrder, int tag) { Node::addChild(child, zOrder, tag); addChildToPhysicsWorld(child); +#if CC_USE_NAVMESH + addChildToNavMesh(child); +#endif } void Scene::addChild(Node* child, int zOrder, const std::string &name) { Node::addChild(child, zOrder, name); addChildToPhysicsWorld(child); +#if CC_USE_NAVMESH + addChildToNavMesh(child); +#endif } Scene* Scene::createWithPhysics() diff --git a/cocos/2d/CCScene.h b/cocos/2d/CCScene.h index 0b3701f0647f..76656444327d 100644 --- a/cocos/2d/CCScene.h +++ b/cocos/2d/CCScene.h @@ -44,6 +44,10 @@ class PhysicsWorld; #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION class Physics3DWorld; #endif +#if CC_USE_NAVMESH +class NavMesh; +#endif + /** * @addtogroup _2d * @{ @@ -90,7 +94,7 @@ class CC_DLL Scene : public Node const std::vector& getCameras() const { return _cameras; } /** Get the default camera. - * @js NA + * @js NA * @return The default camera of scene. */ Camera* getDefaultCamera() const { return _defaultCamera; } @@ -139,7 +143,7 @@ class CC_DLL Scene : public Node private: CC_DISALLOW_COPY_AND_ASSIGN(Scene); -#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION)) +#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION) || CC_USE_NAVMESH) public: virtual void addChild(Node* child, int zOrder, int tag) override; virtual void addChild(Node* child, int zOrder, const std::string &name) override; @@ -186,6 +190,25 @@ class CC_DLL Scene : public Node Camera* _physics3dDebugCamera; // #endif #endif // (CC_USE_PHYSICS || CC_USE_3D_PHYSICS) + +#if CC_USE_NAVMESH +public: + /** set navigation mesh */ + void setNavMesh(NavMesh* navMesh); + /** get navigation mesh */ + NavMesh* getNavMesh() const { return _navMesh; } + /** + * Set NavMesh debug draw camera. + */ + void setNavMeshDebugCamera(Camera *camera); + +protected: + void addChildToNavMesh(Node* child); + +protected: + NavMesh* _navMesh; + Camera * _navMeshDebugCamera; +#endif }; // end of _2d group diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index 66e821a166e9..0d2d9df1abe1 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -564,6 +564,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + + + + @@ -1152,6 +1157,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* + + + + + @@ -1338,6 +1348,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.* {012dff48-a13f-4f52-b07b-f8b9d21ce95b} + + {41e34993-647e-4282-8384-4ab1ae31a452} + {b7c2a162-dec9-4418-972e-240ab3cbfcae} diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index 0fa1979adb9e..fa754658c773 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -271,6 +271,9 @@ {e492faef-2169-4117-8d73-e0c66271fe25} + + {0f3fa25d-9e2b-4a2e-a1df-834b796b3fb3} + @@ -1872,6 +1875,21 @@ renderer + + navmesh + + + navmesh + + + navmesh + + + navmesh + + + navmesh + base @@ -3665,6 +3683,21 @@ renderer + + navmesh + + + navmesh + + + navmesh + + + navmesh + + + navmesh + base diff --git a/cocos/Android.mk b/cocos/Android.mk index 951fadcf2b50..10b62707c0c4 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -203,6 +203,11 @@ physics3d/CCPhysics3DObject.cpp \ physics3d/CCPhysics3DShape.cpp \ physics3d/CCPhysicsSprite3D.cpp \ physics3d/CCPhysics3DConstraint.cpp \ +navmesh/CCNavMesh.cpp \ +navmesh/CCNavMeshAgent.cpp \ +navmesh/CCNavMeshDebugDraw.cpp \ +navmesh/CCNavMeshObstacle.cpp \ +navmesh/CCNavMeshTool.cpp \ ../external/ConvertUTF/ConvertUTFWrapper.cpp \ ../external/ConvertUTF/ConvertUTF.c \ ../external/tinyxml2/tinyxml2.cpp \ @@ -258,6 +263,7 @@ LOCAL_STATIC_LIBRARIES += cocos_tiff_static LOCAL_STATIC_LIBRARIES += cocos_webp_static LOCAL_STATIC_LIBRARIES += cocos_chipmunk_static LOCAL_STATIC_LIBRARIES += cocos_zlib_static +LOCAL_STATIC_LIBRARIES += recast_static LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dxandroid_static @@ -305,6 +311,7 @@ $(call import-module,ui) $(call import-module,extensions) $(call import-module,Box2D) $(call import-module,bullet) +$(call import-module,recast) $(call import-module,curl/prebuilt/android) $(call import-module,websockets/prebuilt/android) $(call import-module,flatbuffers) diff --git a/cocos/CMakeLists.txt b/cocos/CMakeLists.txt index 3a4e88b45354..53ea160c86cd 100644 --- a/cocos/CMakeLists.txt +++ b/cocos/CMakeLists.txt @@ -37,6 +37,7 @@ include(platform/CMakeLists.txt) include(physics/CMakeLists.txt) include(physics3d/CMakeLists.txt) include(math/CMakeLists.txt) +include(navmesh/CMakeLists.txt) include(renderer/CMakeLists.txt) include(base/CMakeLists.txt) include(deprecated/CMakeLists.txt) @@ -70,6 +71,7 @@ set(COCOS_SRC cocos2d.cpp ${COCOS_PHYSICS_SRC} ${COCOS_PHYSICS3D_SRC} ${COCOS_MATH_SRC} + ${COCOS_NAVMESH_SRC} ${COCOS_RENDERER_SRC} ${COCOS_BASE_SRC} ${COCOS_AUDIO_SRC} @@ -156,6 +158,10 @@ if(USE_BULLET) cocos_use_pkg(cocos2d BULLET) endif() +if(USE_RECAST) + cocos_use_pkg(cocos2d RECAST) +endif() + set_target_properties(cocos2d PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index b9dfcaf99a3c..1a5c7b720276 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -74,6 +74,10 @@ THE SOFTWARE. #include "physics3d/CCPhysics3DWorld.h" #endif +#if CC_USE_NAVMESH +#include "navmesh/CCNavMesh.h" +#endif + /** Position of the FPS @@ -304,6 +308,13 @@ void Director::drawScene() { physics3DWorld->stepSimulate(_deltaTime); } +#endif +#if CC_USE_NAVMESH + auto navMesh = _runningScene->getNavMesh(); + if (navMesh) + { + navMesh->update(_deltaTime); + } #endif //clear draw stats _renderer->clearDrawStats(); diff --git a/cocos/base/ccConfig.h b/cocos/base/ccConfig.h index 550b9ba7ac0c..0d32b51f542a 100644 --- a/cocos/base/ccConfig.h +++ b/cocos/base/ccConfig.h @@ -260,6 +260,11 @@ THE SOFTWARE. #endif #endif +/** Use 3D navigation API */ +#ifndef CC_USE_NAVMESH +#define CC_USE_NAVMESH 1 +#endif + /** Use culling or not. */ #ifndef CC_USE_CULLING #define CC_USE_CULLING 1 diff --git a/cocos/navmesh/CCNavMesh.cpp b/cocos/navmesh/CCNavMesh.cpp new file mode 100644 index 000000000000..966b5bb8030a --- /dev/null +++ b/cocos/navmesh/CCNavMesh.cpp @@ -0,0 +1,637 @@ +/**************************************************************************** + 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 "navmesh/CCNavMesh.h" +#if CC_USE_NAVMESH + +#include "platform/CCFileUtils.h" +#include "renderer/CCRenderer.h" +#include "recast/Detour/DetourCommon.h" +#include "recast/DebugUtils/DetourDebugDraw.h" +#include + +NS_CC_BEGIN + +struct TileCacheSetHeader +{ + int magic; + int version; + int numTiles; + dtNavMeshParams meshParams; + dtTileCacheParams cacheParams; +}; + +struct TileCacheTileHeader +{ + dtCompressedTileRef tileRef; + int dataSize; +}; + +static unsigned char* parseRow(unsigned char* buf, unsigned char* bufEnd, char* row, int len) +{ + bool start = true; + bool done = false; + int n = 0; + while (!done && buf < bufEnd) + { + char c = *buf; + buf++; + // multirow + switch (c) + { + case '\n': + if (start) break; + done = true; + break; + case '\r': + break; + case '\t': + case ' ': + if (start) break; + default: + start = false; + row[n++] = c; + if (n >= len - 1) + done = true; + break; + } + } + row[n] = '\0'; + return buf; +} + +static const int TILECACHESET_MAGIC = 'T' << 24 | 'S' << 16 | 'E' << 8 | 'T'; //'TSET'; +static const int TILECACHESET_VERSION = 1; +static const int MAX_AGENTS = 128; + +NavMesh* NavMesh::create(const std::string &navFilePath, const std::string &geomFilePath) +{ + auto ref = new (std::nothrow) NavMesh(); + if (ref && ref->initWithFilePath(navFilePath, geomFilePath)) + { + ref->autorelease(); + return ref; + } + CC_SAFE_DELETE(ref); + return nullptr; +} + +NavMesh::NavMesh() + : _navMesh(nullptr) + , _navMeshQuery(nullptr) + , _crowed(nullptr) + , _tileCache(nullptr) + , _allocator(nullptr) + , _compressor(nullptr) + , _meshProcess(nullptr) + , _geomData(nullptr) + , _isDebugDrawEnabled(false) +{ + +} + +NavMesh::~NavMesh() +{ + dtFreeTileCache(_tileCache); + dtFreeCrowd(_crowed); + dtFreeNavMesh(_navMesh); + dtFreeNavMeshQuery(_navMeshQuery); + CC_SAFE_DELETE(_allocator); + CC_SAFE_DELETE(_compressor); + CC_SAFE_DELETE(_meshProcess); + CC_SAFE_DELETE(_geomData); + + for (auto iter : _agentList){ + CC_SAFE_RELEASE(iter); + } + _agentList.clear(); + + for (auto iter : _obstacleList){ + CC_SAFE_RELEASE(iter); + } + _obstacleList.clear(); +} + +bool NavMesh::initWithFilePath(const std::string &navFilePath, const std::string &geomFilePath) +{ + _navFilePath = navFilePath; + _geomFilePath = geomFilePath; + if (!read()) return false; + return true; +} + +bool NavMesh::read() +{ + if (!loadGeomFile()) return false; + if (!loadNavMeshFile()) return false; + + return true; +} + +bool NavMesh::loadNavMeshFile() +{ + auto data = FileUtils::getInstance()->getDataFromFile(_navFilePath); + if (data.isNull()) return false; + + // Read header. + unsigned int offset = 0; + TileCacheSetHeader header = *((TileCacheSetHeader*)(data.getBytes() + offset)); + offset += sizeof(TileCacheSetHeader); + if (header.magic != TILECACHESET_MAGIC) + { + return false; + } + if (header.version != TILECACHESET_VERSION) + { + return false; + } + + _navMesh = dtAllocNavMesh(); + if (!_navMesh) + { + return false; + } + dtStatus status = _navMesh->init(&header.meshParams); + if (dtStatusFailed(status)) + { + return false; + } + + _tileCache = dtAllocTileCache(); + if (!_tileCache) + { + return false; + } + + _allocator = new LinearAllocator(32000); + _compressor = new FastLZCompressor; + _meshProcess = new MeshProcess(_geomData); + status = _tileCache->init(&header.cacheParams, _allocator, _compressor, _meshProcess); + + if (dtStatusFailed(status)) + { + return false; + } + + // Read tiles. + for (int i = 0; i < header.numTiles; ++i) + { + TileCacheTileHeader tileHeader = *((TileCacheTileHeader*)(data.getBytes() + offset)); + offset += sizeof(TileCacheTileHeader); + if (!tileHeader.tileRef || !tileHeader.dataSize) + break; + + unsigned char* tileData = (unsigned char*)dtAlloc(tileHeader.dataSize, DT_ALLOC_PERM); + if (!tileData) break; + memcpy(tileData, (data.getBytes() + offset), tileHeader.dataSize); + offset += tileHeader.dataSize; + + dtCompressedTileRef tile = 0; + _tileCache->addTile(tileData, tileHeader.dataSize, DT_COMPRESSEDTILE_FREE_DATA, &tile); + + if (tile) + _tileCache->buildNavMeshTile(tile, _navMesh); + } + + //create crowed + _crowed = dtAllocCrowd(); + _crowed->init(MAX_AGENTS, header.cacheParams.walkableRadius, _navMesh); + + //create NavMeshQuery + _navMeshQuery = dtAllocNavMeshQuery(); + _navMeshQuery->init(_navMesh, 2048); + + _agentList.assign(MAX_AGENTS, nullptr); + _obstacleList.assign(header.cacheParams.maxObstacles, nullptr); + //duDebugDrawNavMesh(&_debugDraw, *_navMesh, DU_DRAWNAVMESH_OFFMESHCONS); + return true; +} + +bool NavMesh::loadGeomFile() +{ + unsigned char* buf = 0; + auto data = FileUtils::getInstance()->getDataFromFile(_geomFilePath); + if (data.isNull()) return false; + buf = data.getBytes(); + _geomData = new GeomData; + _geomData->offMeshConCount = 0; + + unsigned char* src = buf; + unsigned char* srcEnd = buf + data.getSize(); + char row[512]; + while (src < srcEnd) + { + // Parse one row + row[0] = '\0'; + src = parseRow(src, srcEnd, row, sizeof(row) / sizeof(char)); + if (row[0] == 'c') + { + // Off-mesh connection + if (_geomData->offMeshConCount < GeomData::MAX_OFFMESH_CONNECTIONS) + { + float* v = &_geomData->offMeshConVerts[_geomData->offMeshConCount * 3 * 2]; + int bidir, area = 0, flags = 0; + float rad; + sscanf(row + 1, "%f %f %f %f %f %f %f %d %d %d", + &v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &rad, &bidir, &area, &flags); + _geomData->offMeshConRads[_geomData->offMeshConCount] = rad; + _geomData->offMeshConDirs[_geomData->offMeshConCount] = (unsigned char)bidir; + _geomData->offMeshConAreas[_geomData->offMeshConCount] = (unsigned char)area; + _geomData->offMeshConFlags[_geomData->offMeshConCount] = (unsigned short)flags; + _geomData->offMeshConCount++; + } + } + } + + return true; +} + +void NavMesh::dtDraw() +{ + drawObstacles(); + _debugDraw.depthMask(false); + duDebugDrawNavMeshWithClosedList(&_debugDraw, *_navMesh, *_navMeshQuery, DU_DRAWNAVMESH_OFFMESHCONS | DU_DRAWNAVMESH_CLOSEDLIST/* | DU_DRAWNAVMESH_COLOR_TILES*/); + drawAgents(); + drawOffMeshConnections(); + _debugDraw.depthMask(true); +} + +void cocos2d::NavMesh::drawOffMeshConnections() +{ + unsigned int conColor = duRGBA(192, 0, 128, 192); + unsigned int baseColor = duRGBA(0, 0, 0, 64); + _debugDraw.begin(DU_DRAW_LINES, 2.0f); + for (int i = 0; i < _geomData->offMeshConCount; ++i) + { + float* v = &_geomData->offMeshConVerts[i * 3 * 2]; + + _debugDraw.vertex(v[0], v[1], v[2], baseColor); + _debugDraw.vertex(v[0], v[1] + 0.2f, v[2], baseColor); + + _debugDraw.vertex(v[3], v[4], v[5], baseColor); + _debugDraw.vertex(v[3], v[4] + 0.2f, v[5], baseColor); + + duAppendCircle(&_debugDraw, v[0], v[1] + 0.1f, v[2], _geomData->offMeshConRads[i], baseColor); + duAppendCircle(&_debugDraw, v[3], v[4] + 0.1f, v[5], _geomData->offMeshConRads[i], baseColor); + + if (/*hilight*/true) + { + duAppendArc(&_debugDraw, v[0], v[1], v[2], v[3], v[4], v[5], 0.25f, + (_geomData->offMeshConDirs[i] & 1) ? 0.6f : 0.0f, 0.6f, conColor); + } + } + _debugDraw.end(); +} + +void cocos2d::NavMesh::drawObstacles() +{ + // Draw obstacles + for (auto iter : _obstacleList) + { + if (iter){ + const dtTileCacheObstacle* ob = _tileCache->getObstacleByRef(iter->_obstacleID); + if (ob->state == DT_OBSTACLE_EMPTY) continue; + float bmin[3], bmax[3]; + _tileCache->getObstacleBounds(ob, bmin, bmax); + + unsigned int col = 0; + if (ob->state == DT_OBSTACLE_PROCESSING) + col = duRGBA(255, 255, 0, 128); + else if (ob->state == DT_OBSTACLE_PROCESSED) + col = duRGBA(255, 192, 0, 192); + else if (ob->state == DT_OBSTACLE_REMOVING) + col = duRGBA(220, 0, 0, 128); + + duDebugDrawCylinder(&_debugDraw, bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2], col); + duDebugDrawCylinderWire(&_debugDraw, bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2], duDarkenCol(col), 2); + } + } +} + +void cocos2d::NavMesh::drawAgents() +{ + for (auto iter : _agentList) + { + if (iter){ + auto agent = _crowed->getAgent(iter->_agentID); + float r = iter->getRadius(); + float h = iter->getHeight(); + + unsigned int col = duRGBA(0, 0, 0, 32); + duDebugDrawCircle(&_debugDraw, agent->npos[0], agent->npos[1], agent->npos[2], r, col, 2.0f); + + col = duRGBA(220, 220, 220, 128); + if (agent->targetState == DT_CROWDAGENT_TARGET_REQUESTING || agent->targetState == DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE) + col = duLerpCol(col, duRGBA(128, 0, 255, 128), 32); + else if (agent->targetState == DT_CROWDAGENT_TARGET_WAITING_FOR_PATH) + col = duLerpCol(col, duRGBA(128, 0, 255, 128), 128); + else if (agent->targetState == DT_CROWDAGENT_TARGET_FAILED) + col = duRGBA(255, 32, 16, 128); + else if (agent->targetState == DT_CROWDAGENT_TARGET_VELOCITY) + col = duLerpCol(col, duRGBA(64, 255, 0, 128), 128); + + duDebugDrawCylinder(&_debugDraw, agent->npos[0] - r, agent->npos[1] + r*0.1f, agent->npos[2] - r, + agent->npos[0] + r, agent->npos[1] + h, agent->npos[2] + r, col); + + } + } + + // Velocity stuff. + for (auto iter : _agentList) + { + if (iter){ + auto agent = _crowed->getAgent(iter->_agentID); + + const float radius = agent->params.radius; + const float height = agent->params.height; + const float* pos = agent->npos; + const float* vel = agent->vel; +// const float* dvel = agent->dvel; + + unsigned int col = duRGBA(220, 220, 220, 192); + if (agent->targetState == DT_CROWDAGENT_TARGET_REQUESTING || agent->targetState == DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE) + col = duLerpCol(col, duRGBA(128, 0, 255, 192), 32); + else if (agent->targetState == DT_CROWDAGENT_TARGET_WAITING_FOR_PATH) + col = duLerpCol(col, duRGBA(128, 0, 255, 192), 128); + else if (agent->targetState == DT_CROWDAGENT_TARGET_FAILED) + col = duRGBA(255, 32, 16, 192); + else if (agent->targetState == DT_CROWDAGENT_TARGET_VELOCITY) + col = duLerpCol(col, duRGBA(64, 255, 0, 192), 128); + + duDebugDrawCircle(&_debugDraw, pos[0], pos[1] + height, pos[2], radius, col, 2.0f); + + //duDebugDrawArrow(&_debugDraw, pos[0], pos[1] + height, pos[2], + // pos[0] + dvel[0], pos[1] + height + dvel[1], pos[2] + dvel[2], + // 0.0f, 0.4f, duRGBA(0, 192, 255, 192), 2.0f); + + duDebugDrawArrow(&_debugDraw, pos[0], pos[1] + height, pos[2], + pos[0] + vel[0], pos[1] + height + vel[1], pos[2] + vel[2], + 0.0f, 0.4f, duRGBA(0, 0, 0, 160), 2.0f); + } + } +} + +void NavMesh::removeNavMeshObstacle(NavMeshObstacle *obstacle) +{ + auto iter = std::find(_obstacleList.begin(), _obstacleList.end(), obstacle); + if (iter != _obstacleList.end()){ + obstacle->removeFrom(_tileCache); + obstacle->release(); + _obstacleList[iter - _obstacleList.begin()] = nullptr; + } +} + +void NavMesh::addNavMeshObstacle(NavMeshObstacle *obstacle) +{ + auto iter = std::find(_obstacleList.begin(), _obstacleList.end(), nullptr); + if (iter != _obstacleList.end()){ + obstacle->addTo(_tileCache); + obstacle->retain(); + _obstacleList[iter - _obstacleList.begin()] = obstacle; + } +} + +void NavMesh::removeNavMeshAgent(NavMeshAgent *agent) +{ + auto iter = std::find(_agentList.begin(), _agentList.end(), agent); + if (iter != _agentList.end()){ + agent->removeFrom(_crowed); + agent->setNavMeshQuery(nullptr); + agent->release(); + _agentList[iter - _agentList.begin()] = nullptr; + } +} + +void NavMesh::addNavMeshAgent(NavMeshAgent *agent) +{ + auto iter = std::find(_agentList.begin(), _agentList.end(), nullptr); + if (iter != _agentList.end()){ + agent->addTo(_crowed); + agent->setNavMeshQuery(_navMeshQuery); + agent->retain(); + _agentList[iter - _agentList.begin()] = agent; + } +} + +bool NavMesh::isDebugDrawEnabled() const +{ + return _isDebugDrawEnabled; +} + +void NavMesh::setDebugDrawEnable(bool enable) +{ + _isDebugDrawEnabled = enable; +} + +void NavMesh::debugDraw(Renderer* renderer) +{ + if (_isDebugDrawEnabled){ + _debugDraw.clear(); + dtDraw(); + _debugDraw.draw(renderer); + } +} + +void NavMesh::update(float dt) +{ + for (auto iter : _agentList){ + if (iter) + iter->preUpdate(dt); + } + + for (auto iter : _obstacleList){ + if (iter) + iter->preUpdate(dt); + } + + if (_crowed) + _crowed->update(dt, nullptr); + + if (_tileCache) + _tileCache->update(dt, _navMesh); + + for (auto iter : _agentList){ + if (iter) + iter->postUpdate(dt); + } + + for (auto iter : _obstacleList){ + if (iter) + iter->postUpdate(dt); + } +} + +void cocos2d::NavMesh::findPath(const Vec3 &start, const Vec3 &end, std::vector &pathPoints) +{ + static const int MAX_POLYS = 256; + static const int MAX_SMOOTH = 2048; + int pathIterNum = 0; + float ext[3]; + ext[0] = 2; ext[1] = 4; ext[2] = 2; + dtQueryFilter filter; + dtPolyRef startRef, endRef; + dtPolyRef polys[MAX_POLYS]; + int npolys = 0; + _navMeshQuery->findNearestPoly(&start.x, ext, &filter, &startRef, 0); + _navMeshQuery->findNearestPoly(&end.x, ext, &filter, &endRef, 0); + _navMeshQuery->findPath(startRef, endRef, &start.x, &end.x, &filter, polys, &npolys, MAX_POLYS); + + if (npolys) + { + //// Iterate over the path to find smooth path on the detail mesh surface. + //dtPolyRef polys[MAX_POLYS]; + //memcpy(polys, polys, sizeof(dtPolyRef)*npolys); + //int npolys = npolys; + + float iterPos[3], targetPos[3]; + _navMeshQuery->closestPointOnPoly(startRef, &start.x, iterPos, 0); + _navMeshQuery->closestPointOnPoly(polys[npolys - 1], &end.x, targetPos, 0); + + static const float STEP_SIZE = 0.5f; + static const float SLOP = 0.01f; + + int nsmoothPath = 0; + //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], iterPos); + //m_nsmoothPath++; + + pathPoints.push_back(Vec3(iterPos[0], iterPos[1], iterPos[2])); + nsmoothPath++; + + // Move towards target a small advancement at a time until target reached or + // when ran out of memory to store the path. + while (npolys && nsmoothPath < MAX_SMOOTH) + { + // Find location to steer towards. + float steerPos[3]; + unsigned char steerPosFlag; + dtPolyRef steerPosRef; + + if (!getSteerTarget(_navMeshQuery, iterPos, targetPos, SLOP, + polys, npolys, steerPos, steerPosFlag, steerPosRef)) + break; + + bool endOfPath = (steerPosFlag & DT_STRAIGHTPATH_END) ? true : false; + bool offMeshConnection = (steerPosFlag & DT_STRAIGHTPATH_OFFMESH_CONNECTION) ? true : false; + + // Find movement delta. + float delta[3], len; + dtVsub(delta, steerPos, iterPos); + len = dtMathSqrtf(dtVdot(delta, delta)); + // If the steer target is end of path or off-mesh link, do not move past the location. + if ((endOfPath || offMeshConnection) && len < STEP_SIZE) + len = 1; + else + len = STEP_SIZE / len; + float moveTgt[3]; + dtVmad(moveTgt, iterPos, delta, len); + + // Move + float result[3]; + dtPolyRef visited[16]; + int nvisited = 0; + _navMeshQuery->moveAlongSurface(polys[0], iterPos, moveTgt, &filter, + result, visited, &nvisited, 16); + + npolys = fixupCorridor(polys, npolys, MAX_POLYS, visited, nvisited); + npolys = fixupShortcuts(polys, npolys, _navMeshQuery); + + float h = 0; + _navMeshQuery->getPolyHeight(polys[0], result, &h); + result[1] = h; + dtVcopy(iterPos, result); + + // Handle end of path and off-mesh links when close enough. + if (endOfPath && inRange(iterPos, steerPos, SLOP, 1.0f)) + { + // Reached end of path. + dtVcopy(iterPos, targetPos); + if (nsmoothPath < MAX_SMOOTH) + { + //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], iterPos); + //m_nsmoothPath++; + pathPoints.push_back(Vec3(iterPos[0], iterPos[1], iterPos[2])); + nsmoothPath++; + } + break; + } + else if (offMeshConnection && inRange(iterPos, steerPos, SLOP, 1.0f)) + { + // Reached off-mesh connection. + float startPos[3], endPos[3]; + + // Advance the path up to and over the off-mesh connection. + dtPolyRef prevRef = 0, polyRef = polys[0]; + int npos = 0; + while (npos < npolys && polyRef != steerPosRef) + { + prevRef = polyRef; + polyRef = polys[npos]; + npos++; + } + for (int i = npos; i < npolys; ++i) + polys[i - npos] = polys[i]; + npolys -= npos; + + // Handle the connection. + dtStatus status = _navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, startPos, endPos); + if (dtStatusSucceed(status)) + { + if (nsmoothPath < MAX_SMOOTH) + { + //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], startPos); + //m_nsmoothPath++; + pathPoints.push_back(Vec3(startPos[0], startPos[1], startPos[2])); + nsmoothPath++; + // Hack to make the dotted path not visible during off-mesh connection. + if (nsmoothPath & 1) + { + //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], startPos); + //m_nsmoothPath++; + pathPoints.push_back(Vec3(startPos[0], startPos[1], startPos[2])); + nsmoothPath++; + } + } + // Move position at the other side of the off-mesh link. + dtVcopy(iterPos, endPos); + float eh = 0.0f; + _navMeshQuery->getPolyHeight(polys[0], iterPos, &eh); + iterPos[1] = eh; + } + } + + // Store results. + if (nsmoothPath < MAX_SMOOTH) + { + //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], iterPos); + //m_nsmoothPath++; + + pathPoints.push_back(Vec3(iterPos[0], iterPos[1], iterPos[2])); + nsmoothPath++; + } + } + } +} + +NS_CC_END + +#endif //CC_USE_NAVMESH diff --git a/cocos/navmesh/CCNavMesh.h b/cocos/navmesh/CCNavMesh.h new file mode 100644 index 000000000000..242210af6eaa --- /dev/null +++ b/cocos/navmesh/CCNavMesh.h @@ -0,0 +1,139 @@ +/**************************************************************************** + 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 __CCNAV_MESH_H__ +#define __CCNAV_MESH_H__ + +#include "base/ccConfig.h" +#if CC_USE_NAVMESH + +#include "base/CCRef.h" +#include "math/Vec3.h" +#include "recast/Detour/DetourNavMesh.h" +#include "recast/Detour/DetourNavMeshQuery.h" +#include "recast/DetourCrowd/DetourCrowd.h" +#include "recast/DetourTileCache/DetourTileCache.h" +#include +#include + +#include "navmesh/CCNavMeshAgent.h" +#include "navmesh/CCNavMeshDebugDraw.h" +#include "navmesh/CCNavMeshObstacle.h" +#include "navmesh/CCNavMeshTool.h" + + +NS_CC_BEGIN + +/** + * @addtogroup 3d + * @{ + */ +class Renderer; +/** @brief NavMesh: The NavMesh information container, include mesh, tileCache, and so on. */ +class CC_DLL NavMesh : public Ref +{ +public: + + /** + Create navmesh + + @param navFilePath The NavMesh File path. + @param geomFilePath The geometry File Path,include offmesh information,etc. + */ + static NavMesh* create(const std::string &navFilePath, const std::string &geomFilePath); + + /** update navmesh. */ + void update(float dt); + + /** Internal method, the updater of debug drawing, need called each frame. */ + void debugDraw(Renderer* renderer); + + /** Enable debug draw or disable. */ + void setDebugDrawEnable(bool enable); + + /** Check enabled debug draw. */ + bool isDebugDrawEnabled() const; + + /** add a agent to navmesh. */ + void addNavMeshAgent(NavMeshAgent *agent); + + /** remove a agent from navmesh. */ + void removeNavMeshAgent(NavMeshAgent *agent); + + /** add a obstacle to navmesh. */ + void addNavMeshObstacle(NavMeshObstacle *obstacle); + + /** remove a obstacle from navmesh. */ + void removeNavMeshObstacle(NavMeshObstacle *obstacle); + + /** + find a path on navmesh + + @param start The start search position in world coordinate system. + @param end The end search position in world coordinate system. + @param pathPoints the key points of path. + */ + void findPath(const Vec3 &start, const Vec3 &end, std::vector &pathPoints); + +CC_CONSTRUCTOR_ACCESS: + NavMesh(); + virtual ~NavMesh(); + +protected: + + bool initWithFilePath(const std::string &navFilePath, const std::string &geomFilePath); + bool read(); + bool loadNavMeshFile(); + bool loadGeomFile(); + void dtDraw(); + void drawAgents(); + void drawObstacles(); + void drawOffMeshConnections(); + +protected: + + dtNavMesh *_navMesh; + dtNavMeshQuery *_navMeshQuery; + dtCrowd *_crowed; + dtTileCache *_tileCache; + LinearAllocator *_allocator; + FastLZCompressor *_compressor; + MeshProcess *_meshProcess; + GeomData *_geomData; + + std::vector _agentList; + std::vector _obstacleList; + NavMeshDebugDraw _debugDraw; + std::string _navFilePath; + std::string _geomFilePath; + bool _isDebugDrawEnabled; +}; + +/** @} */ + +NS_CC_END + +#endif //CC_USE_NAVMESH + +#endif // __CCNAV_MESH_H__ diff --git a/cocos/navmesh/CCNavMeshAgent.cpp b/cocos/navmesh/CCNavMeshAgent.cpp new file mode 100644 index 000000000000..91d2fec40094 --- /dev/null +++ b/cocos/navmesh/CCNavMeshAgent.cpp @@ -0,0 +1,408 @@ +/**************************************************************************** + 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 "navmesh/CCNavMeshAgent.h" +#if CC_USE_NAVMESH + +#include "navmesh/CCNavMesh.h" +#include "recast/DetourCrowd/DetourCrowd.h" +#include "2d/CCNode.h" +#include "2d/CCScene.h" +#include + +NS_CC_BEGIN + +NavMeshAgentParam::NavMeshAgentParam() +: radius(0.6f) +, height(2.0f) +, maxAcceleration(8.0f) +, maxSpeed(3.5f) +, collisionQueryRange(radius * 12.0f) +, pathOptimizationRange(radius * 30.0f) +, updateFlags(DT_CROWD_ANTICIPATE_TURNS | DT_CROWD_OPTIMIZE_VIS | DT_CROWD_OPTIMIZE_TOPO | DT_CROWD_OBSTACLE_AVOIDANCE) +, obstacleAvoidanceType(3) +, separationWeight(2.0f) +, queryFilterType(0) +{ + +} + +NavMeshAgent* NavMeshAgent::create(const NavMeshAgentParam ¶m) +{ + auto ref = new (std::nothrow) NavMeshAgent(); + if (ref && ref->initWith(param)) + { + ref->autorelease(); + return ref; + } + CC_SAFE_DELETE(ref); + return nullptr; +} + +const std::string& NavMeshAgent::getNavMeshAgentComponentName() +{ + static std::string comName = "___NavMeshAgentComponent___"; + return comName; +} + +cocos2d::NavMeshAgent::NavMeshAgent() + : _agentID(-1) + , _needAutoOrientation(true) + , _crowd(nullptr) + , _needUpdateAgent(true) + , _needMove(false) + , _navMeshQuery(nullptr) + , _rotRefAxes(Vec3::UNIT_Z) + , _totalTimeAfterMove(0.0f) + , _userData(nullptr) + , _state(DT_CROWDAGENT_STATE_WALKING) + , _syncFlag(NODE_AND_NODE) +{ + +} + +cocos2d::NavMeshAgent::~NavMeshAgent() +{ +} + +bool NavMeshAgent::initWith(const NavMeshAgentParam ¶m) +{ + _param = param; + setName(getNavMeshAgentComponentName()); + return true; +} + +void cocos2d::NavMeshAgent::setNavMeshQuery(dtNavMeshQuery *query) +{ + _navMeshQuery = query; +} + +void cocos2d::NavMeshAgent::removeFrom(dtCrowd *crowed) +{ + crowed->removeAgent(_agentID); + _crowd = nullptr; + _agentID = -1; +} + +void cocos2d::NavMeshAgent::addTo(dtCrowd *crowed) +{ + _crowd = crowed; + dtCrowdAgentParams ap; + convertTodtAgentParam(_param, ap); + Mat4 mat = _owner->getNodeToWorldTransform(); + _agentID = _crowd->addAgent(&mat.m[12], &ap); +} + +void cocos2d::NavMeshAgent::convertTodtAgentParam(const NavMeshAgentParam &inParam, dtCrowdAgentParams &outParam) +{ + memset(&outParam, 0, sizeof(outParam)); + outParam.collisionQueryRange = inParam.collisionQueryRange; + outParam.height = inParam.height; + outParam.maxAcceleration = inParam.maxAcceleration; + outParam.maxSpeed = inParam.maxSpeed; + outParam.obstacleAvoidanceType = inParam.obstacleAvoidanceType; + outParam.pathOptimizationRange = inParam.pathOptimizationRange; + outParam.queryFilterType = inParam.queryFilterType; + outParam.radius = inParam.radius; + outParam.separationWeight = inParam.separationWeight; + outParam.updateFlags = inParam.updateFlags; +} + +void cocos2d::NavMeshAgent::onExit() +{ + if (_agentID == -1) return; + Component::onExit(); + + auto scene = _owner->getScene(); + if (scene && scene->getNavMesh()){ + scene->getNavMesh()->removeNavMeshAgent(this); + } +} + +void cocos2d::NavMeshAgent::onEnter() +{ + if (_agentID != -1) return; + Component::onEnter(); + auto scene = _owner->getScene(); + if (scene && scene->getNavMesh()){ + scene->getNavMesh()->addNavMeshAgent(this); + } +} + +float NavMeshAgent::getMaxSpeed() const +{ + return _param.maxSpeed; +} + +void NavMeshAgent::setSeparationWeight(float weight) +{ + _param.separationWeight = weight; + _needUpdateAgent = true; +} + +float NavMeshAgent::getSeparationWeight() const +{ + return _param.separationWeight; +} + +void cocos2d::NavMeshAgent::setObstacleAvoidanceType(unsigned char type) +{ + _param.obstacleAvoidanceType = type; + _needUpdateAgent = true; +} + +unsigned char NavMeshAgent::getObstacleAvoidanceType() const +{ + return _param.obstacleAvoidanceType; +} + +Vec3 NavMeshAgent::getCurrentVelocity() const +{ + if (_crowd){ + auto agent = _crowd->getAgent(_agentID); + if (agent){ + return Vec3(agent->vel[0], agent->vel[1], agent->vel[2]); + } + } + return Vec3::ZERO; +} + +void NavMeshAgent::setMaxSpeed(float maxSpeed) +{ + _param.maxSpeed = maxSpeed; + _needUpdateAgent = true; +} + +float NavMeshAgent::getMaxAcceleration() const +{ + return _param.maxAcceleration; +} + +void NavMeshAgent::setMaxAcceleration(float maxAcceleration) +{ + _param.maxAcceleration = maxAcceleration; + _needUpdateAgent = true; +} + +float NavMeshAgent::getHeight() const +{ + return _param.height; +} + +void NavMeshAgent::setHeight(float height) +{ + _param.height = height; + _needUpdateAgent = true; +} + +float NavMeshAgent::getRadius() const +{ + return _param.radius; +} + +void NavMeshAgent::setRadius(float radius) +{ + _param.radius = radius; + _needUpdateAgent = true; +} + +void NavMeshAgent::move(const Vec3 &destination, const MoveCallback &callback) +{ + _destination = destination; + _moveCallback = callback; + _needMove = true; + _needUpdateAgent = true; +} + +OffMeshLinkData NavMeshAgent::getCurrentOffMeshLinkData() +{ + OffMeshLinkData data; + if (_crowd && isOnOffMeshLink()){ + auto agentAnim = _crowd->getEditableAgentAnim(_agentID); + if (agentAnim){ + Mat4 mat; + if (_owner && _owner->getParent()) + mat = _owner->getParent()->getWorldToNodeTransform(); + mat.transformPoint(agentAnim->startPos, &data.startPosition); + mat.transformPoint(agentAnim->endPos, &data.endPosition); + } + } + return data; +} + +bool NavMeshAgent::isOnOffMeshLink() +{ + return _state == DT_CROWDAGENT_STATE_OFFMESH; +} + +void cocos2d::NavMeshAgent::completeOffMeshLink() +{ + if (_crowd && isOnOffMeshLink()){ + _state = DT_CROWDAGENT_STATE_WALKING; + _needUpdateAgent = true; + } +} + +void NavMeshAgent::setAutoTraverseOffMeshLink(bool isAuto) +{ + if (_crowd && isOnOffMeshLink()){ + auto agentAnim = _crowd->getEditableAgentAnim(_agentID); + if (agentAnim){ + agentAnim->active = isAuto; + } + } +} + +void NavMeshAgent::stop() +{ + if (_state != DT_CROWDAGENT_STATE_INVALID) return; + _state = DT_CROWDAGENT_STATE_INVALID; + _needUpdateAgent = true; +} + +void NavMeshAgent::setOrientationRefAxes(const Vec3 &rotRefAxes) +{ + _rotRefAxes = rotRefAxes; +} + +void cocos2d::NavMeshAgent::setAutoOrientation(bool isAuto) +{ + _needAutoOrientation = isAuto; +} + +void NavMeshAgent::resume() +{ + if (_state != DT_CROWDAGENT_STATE_INVALID) return; + _state = DT_CROWDAGENT_STATE_WALKING; + _needUpdateAgent = true; +} + +void NavMeshAgent::pause() +{ + if (_state == DT_CROWDAGENT_STATE_INVALID) return; + _state = DT_CROWDAGENT_STATE_INVALID; + _needUpdateAgent = true; +} + +void NavMeshAgent::preUpdate(float delta) +{ + if (_state != DT_CROWDAGENT_STATE_INVALID) + _totalTimeAfterMove += delta; + if (_moveCallback && _state != DT_CROWDAGENT_STATE_INVALID) + _moveCallback(this, _totalTimeAfterMove); + + if ((_syncFlag & NODE_TO_AGENT) != 0) + syncToAgent(); + + if (_needMove && _crowd && _navMeshQuery){ + if (_state == DT_CROWDAGENT_STATE_OFFMESH) return; + _state = DT_CROWDAGENT_STATE_WALKING; + _totalTimeAfterMove = 0.0f; + dtPolyRef pRef = 0; + float nearestPos[3]; + _navMeshQuery->findNearestPoly(&_destination.x, _crowd->getQueryExtents(), _crowd->getFilter(0), &pRef, nearestPos); + _crowd->requestMoveTarget(_agentID, pRef, nearestPos); + _needMove = false; + } +} + +void NavMeshAgent::postUpdate(float delta) +{ + if ((_syncFlag & AGENT_TO_NODE) != 0) + syncToNode(); +} + +void NavMeshAgent::syncToNode() +{ + const dtCrowdAgent *agent = nullptr; + if (_crowd){ + agent = _crowd->getAgent(_agentID); + } + + if (agent){ + Mat4 wtop; + Vec3 pos; + if (_owner->getParent()) + wtop = _owner->getParent()->getWorldToNodeTransform(); + wtop.transformPoint(Vec3(agent->npos[0], agent->npos[1], agent->npos[2]), &pos); + _owner->setPosition3D(pos); + _state = agent->state; + if (_needAutoOrientation){ + if ( fabs(agent->vel[0]) > 0.3f || fabs(agent->vel[1]) > 0.3f || fabs(agent->vel[2]) > 0.3f) + { + Vec3 axes(_rotRefAxes); + axes.normalize(); + Vec3 dir; + wtop.transformVector(Vec3(agent->vel[0], agent->vel[1], agent->vel[2]), &dir); + dir.normalize(); + float cosTheta = Vec3::dot(axes, dir); + Vec3 rotAxes; + Vec3::cross(axes, dir, &rotAxes); + Quaternion rot = Quaternion(rotAxes, acosf(cosTheta)); + _owner->setRotationQuat(rot); + } + } + } +} + +void NavMeshAgent::syncToAgent() +{ + if (_crowd){ + auto agent = _crowd->getEditableAgent(_agentID); + Mat4 mat = _owner->getNodeToWorldTransform(); + agent->npos[0] = mat.m[12]; + agent->npos[1] = mat.m[13]; + agent->npos[2] = mat.m[14]; + //if (_needAutoOrientation){ + // Vec3 vel = mat * _rotRefAxes; + // agent->vel[0] = vel.x; + // agent->vel[1] = vel.y; + // agent->vel[2] = vel.z; + //} + if (_needUpdateAgent){ + dtCrowdAgentParams ap; + convertTodtAgentParam(_param, ap); + agent->params = ap; + agent->state = _state; + _needUpdateAgent = false; + } + } +} + +Vec3 NavMeshAgent::getVelocity() const +{ + const dtCrowdAgent *agent = nullptr; + if (_crowd){ + agent = _crowd->getAgent(_agentID); + } + if (agent) + { + return Vec3(agent->vel[0], agent->vel[1], agent->vel[2]); + } + return Vec3::ZERO; +} + +NS_CC_END + +#endif //CC_USE_NAVMESH diff --git a/cocos/navmesh/CCNavMeshAgent.h b/cocos/navmesh/CCNavMeshAgent.h new file mode 100644 index 000000000000..f7d434d08a11 --- /dev/null +++ b/cocos/navmesh/CCNavMeshAgent.h @@ -0,0 +1,239 @@ +/**************************************************************************** + 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 __CCNAV_MESH_AGENT_H__ +#define __CCNAV_MESH_AGENT_H__ + +#include "base/ccConfig.h" +#if CC_USE_NAVMESH +#include "2d/CCComponent.h" + +#include "base/CCRef.h" +#include "math/Vec3.h" +#include "recast/DetourCrowd/DetourCrowd.h" + +class dtNavMeshQuery; +NS_CC_BEGIN + +/** + * @addtogroup 3d + * @{ + */ +struct CC_DLL NavMeshAgentParam +{ + NavMeshAgentParam(); + + float radius; ///< Agent radius. [Limit: >= 0] + float height; ///< Agent height. [Limit: > 0] + float maxAcceleration; ///< Maximum allowed acceleration. [Limit: >= 0] + float maxSpeed; ///< Maximum allowed speed. [Limit: >= 0] + + /// Defines how close a collision element must be before it is considered for steering behaviors. [Limits: > 0] + float collisionQueryRange; + + float pathOptimizationRange; ///< The path visibility optimization range. [Limit: > 0] + + /// How aggresive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0] + float separationWeight; + + /// Flags that impact steering behavior. (See: #UpdateFlags) + unsigned char updateFlags; + + /// The index of the avoidance configuration to use for the agent. + /// [Limits: 0 <= value <= #DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS] + unsigned char obstacleAvoidanceType; + + /// The index of the query filter used by this agent. + unsigned char queryFilterType; +}; + +struct CC_DLL OffMeshLinkData +{ + Vec3 startPosition;//position in local coordinate system. + Vec3 endPosition;//position in local coordinate system. +}; + +/** @brief NavMeshAgent: The code wrapping of dtCrowdAgent, use component mode. */ +class CC_DLL NavMeshAgent : public Component +{ + friend class NavMesh; +public: + + enum NavMeshAgentSyncFlag + { + NONE = 0, + NODE_TO_AGENT = 1, + AGENT_TO_NODE = 2, + NODE_AND_NODE = NODE_TO_AGENT | AGENT_TO_NODE, + }; + + typedef std::function MoveCallback; + + /** + Create agent + + @param param The parameters of agent. + */ + static NavMeshAgent* create(const NavMeshAgentParam ¶m); + static const std::string& getNavMeshAgentComponentName(); + + virtual void onEnter() override; + virtual void onExit() override; + + /** set agent radius */ + void setRadius(float radius); + + /** get agent radius */ + float getRadius() const; + + /** set agent height */ + void setHeight(float height); + + /** get agent height */ + float getHeight() const; + + /** set maximal acceleration of agent*/ + void setMaxAcceleration(float maxAcceleration); + + /** get maximal acceleration of agent*/ + float getMaxAcceleration() const; + + /** set maximal speed of agent */ + void setMaxSpeed(float maxSpeed); + + /** get maximal speed of agent */ + float getMaxSpeed() const; + + /** set separation weight */ + void setSeparationWeight(float weight); + + /** get separation weight */ + float getSeparationWeight() const; + + /** set obstacle avoidance type */ + void setObstacleAvoidanceType(unsigned char type); + + /** get obstacle avoidance type */ + unsigned char getObstacleAvoidanceType() const; + + /** get current velocity */ + Vec3 getCurrentVelocity() const; + + /** + Move agent to a destination + + @param destination The position in world coordinate system. + @param callback Use this function can catch movement state. + */ + void move(const Vec3 &destination, const MoveCallback &callback = nullptr); + + /** puase movement */ + void pause(); + + /** resume movement */ + void resume(); + + /** stop movement */ + void stop(); + + /** + Set the reference axes of agent's orientation + + @param rotRefAxes The value of reference axes in local coordinate system. + */ + void setOrientationRefAxes(const Vec3 &rotRefAxes); + + /**Set automatic Orientation */ + void setAutoOrientation(bool isAuto); + + /**Set automatic Traverse OffMeshLink */ + void setAutoTraverseOffMeshLink(bool isAuto); + + /**Check agent arrived OffMeshLink */ + bool isOnOffMeshLink(); + + /**Traverse OffMeshLink manually*/ + void completeOffMeshLink(); + + /**Get current OffMeshLink information*/ + OffMeshLinkData getCurrentOffMeshLinkData(); + + void setUserData(void *data) { _userData = data; }; + void* getUserData() const { return _userData; }; + + /** + * synchronization between node and agent is time consuming, you can skip some synchronization using this function + */ + void setSyncFlag(const NavMeshAgentSyncFlag &flag) { _syncFlag = flag; } + NavMeshAgentSyncFlag getSyncFlag() const { return _syncFlag; } + + /** synchronize parameter to agent. */ + void syncToAgent(); + + /** synchronize parameter to node. */ + void syncToNode(); + + /** get current velocity */ + Vec3 getVelocity() const; + +CC_CONSTRUCTOR_ACCESS: + NavMeshAgent(); + virtual ~NavMeshAgent(); + +private: + + bool initWith(const NavMeshAgentParam ¶m); + void addTo(dtCrowd *crowed); + void removeFrom(dtCrowd *crowed); + void setNavMeshQuery(dtNavMeshQuery *query); + void preUpdate(float delta); + void postUpdate(float delta); + static void convertTodtAgentParam(const NavMeshAgentParam &inParam, dtCrowdAgentParams &outParam); + +private: + + MoveCallback _moveCallback; + NavMeshAgentParam _param; + NavMeshAgentSyncFlag _syncFlag; + Vec3 _origination; + Vec3 _destination; + Vec3 _rotRefAxes; + unsigned char _state; + bool _needAutoOrientation; + int _agentID; + bool _needUpdateAgent; + bool _needMove; + float _totalTimeAfterMove; + void *_userData; + dtCrowd *_crowd; + dtNavMeshQuery *_navMeshQuery; +}; + +/** @} */ + +NS_CC_END + +#endif //CC_USE_NAVMESH + +#endif // __CCNAV_MESH_AGENT_H__ diff --git a/cocos/navmesh/CCNavMeshDebugDraw.cpp b/cocos/navmesh/CCNavMeshDebugDraw.cpp new file mode 100644 index 000000000000..459c655e6491 --- /dev/null +++ b/cocos/navmesh/CCNavMeshDebugDraw.cpp @@ -0,0 +1,183 @@ +/**************************************************************************** + 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 "navmesh/CCNavMeshDebugDraw.h" +#if CC_USE_NAVMESH + +#include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCRenderer.h" +#include "renderer/CCRenderState.h" +#include "base/CCDirector.h" +#include "base/ccMacros.h" + +NS_CC_BEGIN + +NavMeshDebugDraw::NavMeshDebugDraw() +: _primitiveType(GL_POINTS) +, _dirtyBuffer(true) +, _currentPrimitive(nullptr) +, _currentDepthMask(true) +{ + _stateBlock = RenderState::StateBlock::create(); + _stateBlock->setCullFace(true); + _stateBlock->setCullFaceSide(RenderState::CullFaceSide::CULL_FACE_SIDE_BACK); + _stateBlock->setDepthTest(true); + _stateBlock->setBlend(true); + _stateBlock->setBlendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED); + CC_SAFE_RETAIN(_stateBlock); + + _customCmd.set3D(true); + _customCmd.setTransparent(true); + _program = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_COLOR); + glGenBuffers(1, &_vbo); +} + +void NavMeshDebugDraw::vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v) +{ + +} + +void NavMeshDebugDraw::vertex(const float* pos, unsigned int color, const float* uv) +{ + vertex(pos[0], pos[1], pos[2], color, uv[0], uv[1]); +} + +void NavMeshDebugDraw::vertex(const float x, const float y, const float z, unsigned int color) +{ + if (!_currentPrimitive) return; + V3F_C4F vertex = { Vec3(x, y, z), getColor(color) }; + _vertices.push_back(vertex); + _dirtyBuffer = true; +} + +void NavMeshDebugDraw::vertex(const float* pos, unsigned int color) +{ + vertex(pos[0], pos[1], pos[2], color); +} + +NavMeshDebugDraw::~NavMeshDebugDraw() +{ + CC_SAFE_RELEASE(_stateBlock); + for (auto iter : _primitiveList){ + delete iter; + } + glDeleteBuffers(1, &_vbo); +} + +void NavMeshDebugDraw::depthMask(bool state) +{ + _currentDepthMask = state; +} + +void NavMeshDebugDraw::begin(duDebugDrawPrimitives prim, float size /*= 1.0f*/) +{ + if (_currentPrimitive) return; + _currentPrimitive = new Primitive; + _currentPrimitive->type = getPrimitiveType(prim); + _currentPrimitive->depthMask = _currentDepthMask; + _currentPrimitive->start = _vertices.size(); + _currentPrimitive->size = size; +} + +void NavMeshDebugDraw::end() +{ + if (!_currentPrimitive) return; + _currentPrimitive->end = _vertices.size(); + _primitiveList.push_back(_currentPrimitive); + _currentPrimitive = nullptr; +} + +Vec4 NavMeshDebugDraw::getColor(unsigned int col) +{ + const unsigned int r = col & 0xff; + const unsigned int g = (col >> 8) & 0xff; + const unsigned int b = (col >> 16) & 0xff; + const unsigned int a = (col >> 24) & 0xff; + + float factor = 1.0f / 255.0f; + return Vec4(r, g, b, a) * factor; +} + +GLenum NavMeshDebugDraw::getPrimitiveType(duDebugDrawPrimitives prim) +{ + switch (prim) + { + case DU_DRAW_POINTS: + return GL_POINTS; + case DU_DRAW_LINES: + return GL_LINES; + case DU_DRAW_TRIS: + return GL_TRIANGLES; + default: + return GL_POINTS; + } +} + +void NavMeshDebugDraw::drawImplement(const cocos2d::Mat4& transform, uint32_t flags) +{ + _program->use(); + _program->setUniformsForBuiltins(transform); + + glBindBuffer(GL_ARRAY_BUFFER, _vbo); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_C4F), (GLvoid *)offsetof(V3F_C4F, position)); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(V3F_C4F), (GLvoid *)offsetof(V3F_C4F, color)); + if (_dirtyBuffer){ + glBufferData(GL_ARRAY_BUFFER, sizeof(V3F_C4F)* _vertices.size(), &_vertices[0], GL_STATIC_DRAW); + _dirtyBuffer = false; + } + for (auto &iter : _primitiveList){ + _stateBlock->setDepthWrite(iter->depthMask); + if (iter->type == GL_POINTS){ + //glPointSize(iter->size); + } + else if (iter->type == GL_LINES){ + glLineWidth(iter->size); + } + _stateBlock->bind(); + glDrawArrays(iter->type, iter->start, iter->end - iter->start); + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, iter->end - iter->start); + } + glBindBuffer(GL_ARRAY_BUFFER, 0); +} + +void NavMeshDebugDraw::draw(Renderer* renderer) +{ + _customCmd.init(0, Mat4::IDENTITY, Node::FLAGS_RENDER_AS_3D); + _customCmd.func = CC_CALLBACK_0(NavMeshDebugDraw::drawImplement, this, Mat4::IDENTITY, 0); + renderer->addCommand(&_customCmd); +} + +void NavMeshDebugDraw::clear() +{ + _vertices.clear(); + for (auto iter : _primitiveList){ + delete iter; + } + _primitiveList.clear(); +} + +NS_CC_END + +#endif //CC_USE_NAVMESH diff --git a/cocos/navmesh/CCNavMeshDebugDraw.h b/cocos/navmesh/CCNavMeshDebugDraw.h new file mode 100644 index 000000000000..528737806dd0 --- /dev/null +++ b/cocos/navmesh/CCNavMeshDebugDraw.h @@ -0,0 +1,109 @@ +/**************************************************************************** + 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 __CCNAV_MESH_DEBUG_DRAW_H__ +#define __CCNAV_MESH_DEBUG_DRAW_H__ + +#include "base/ccConfig.h" +#if CC_USE_NAVMESH + +#include "renderer/CCGLProgram.h" +#include "renderer/CCCustomCommand.h" +#include "renderer/CCRenderState.h" +#include "math/Vec3.h" +#include "recast/DebugUtils/DebugDraw.h" +#include +#include + +NS_CC_BEGIN + +/** + * @addtogroup 3d + * @{ + */ +class Renderer; +class NavMeshDebugDraw : public duDebugDraw +{ +public: + NavMeshDebugDraw(); + virtual ~NavMeshDebugDraw(); + + virtual void depthMask(bool state); + virtual void texture(bool state){}; + virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f) override; + + virtual void vertex(const float* pos, unsigned int color) override; + virtual void vertex(const float x, const float y, const float z, unsigned int color) override; + + virtual void vertex(const float* pos, unsigned int color, const float* uv) override; + virtual void vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v) override; + + virtual void end() override; + + void draw(Renderer* renderer); + + void clear(); + +private: + + GLenum getPrimitiveType(duDebugDrawPrimitives prim); + void drawImplement(const cocos2d::Mat4& transform, uint32_t flags); + static Vec4 getColor(unsigned int col); + +private: + + struct V3F_C4F + { + Vec3 position; + Vec4 color; + }; + + struct Primitive + { + GLenum type; + bool depthMask; + unsigned short start; + unsigned short end; + float size; + }; + + std::vector _vertices; + std::vector _primitiveList; + Primitive *_currentPrimitive; + GLProgram *_program; + CustomCommand _customCmd; + RenderState::StateBlock* _stateBlock; + GLenum _primitiveType; + bool _currentDepthMask; + GLuint _vbo; + bool _dirtyBuffer; +}; + +/** @} */ + +NS_CC_END + +#endif //CC_USE_NAVMESH + +#endif // __CCNAV_MESH_DEBUG_DRAW_H__ diff --git a/cocos/navmesh/CCNavMeshObstacle.cpp b/cocos/navmesh/CCNavMeshObstacle.cpp new file mode 100644 index 000000000000..e17986504b17 --- /dev/null +++ b/cocos/navmesh/CCNavMeshObstacle.cpp @@ -0,0 +1,148 @@ +/**************************************************************************** + 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 "navmesh/CCNavMeshObstacle.h" +#if CC_USE_NAVMESH + +#include "navmesh/CCNavMesh.h" +#include "2d/CCNode.h" +#include "2d/CCScene.h" +#include "recast/DetourTileCache/DetourTileCache.h" + +NS_CC_BEGIN + +NavMeshObstacle* NavMeshObstacle::create(float radius, float height) +{ + auto ref = new (std::nothrow) NavMeshObstacle(); + if (ref && ref->initWith(radius, height)) + { + ref->autorelease(); + return ref; + } + CC_SAFE_DELETE(ref); + return nullptr; +} + +const std::string& NavMeshObstacle::getNavMeshObstacleComponentName() +{ + static std::string comName = "___NavMeshObstacleComponent___"; + return comName; +} + +NavMeshObstacle::NavMeshObstacle() +: _radius(0.0f) +, _height(0.0f) +, _tileCache(nullptr) +, _obstacleID(-1) +, _syncFlag(NODE_AND_NODE) +{ + +} + +cocos2d::NavMeshObstacle::~NavMeshObstacle() +{ + +} + +bool NavMeshObstacle::initWith(float radius, float height) +{ + _radius = radius; + _height = height; + setName(getNavMeshObstacleComponentName()); + return true; +} + +void cocos2d::NavMeshObstacle::removeFrom(dtTileCache *tileCache) +{ + _tileCache->removeObstacle(_obstacleID); + _tileCache = nullptr; + _obstacleID = -1; +} + +void cocos2d::NavMeshObstacle::addTo(dtTileCache *tileCache) +{ + _tileCache = tileCache; + Mat4 mat = _owner->getNodeToWorldTransform(); + _tileCache->addObstacle(&mat.m[12], _radius, _height, &_obstacleID); +} + +void cocos2d::NavMeshObstacle::onExit() +{ + if (_obstacleID == -1) return; + Component::onExit(); + auto scene = _owner->getScene(); + if (scene && scene->getNavMesh()){ + scene->getNavMesh()->removeNavMeshObstacle(this); + } +} + +void cocos2d::NavMeshObstacle::onEnter() +{ + if (_obstacleID != -1) return; + Component::onEnter(); + auto scene = _owner->getScene(); + if (scene && scene->getNavMesh()){ + scene->getNavMesh()->addNavMeshObstacle(this); + } +} + +void cocos2d::NavMeshObstacle::postUpdate(float delta) +{ + if ((_syncFlag & OBSTACLE_TO_NODE) != 0) + syncToNode(); +} + +void cocos2d::NavMeshObstacle::preUpdate(float delta) +{ + if ((_syncFlag & NODE_TO_OBSTACLE) != 0) + syncToObstacle(); +} + +void NavMeshObstacle::syncToNode() +{ + if (_tileCache){ + auto obstacle = _tileCache->getObstacleByRef(_obstacleID); + Vec3 localPos = Vec3(obstacle->pos[0], obstacle->pos[1], obstacle->pos[2]); + if (_owner->getParent()) + _owner->getParent()->getWorldToNodeTransform().transformPoint(localPos, &localPos); + _owner->setPosition3D(localPos); + } +} + +void NavMeshObstacle::syncToObstacle() +{ + if (_tileCache){ + auto obstacle = _tileCache->getObstacleByRef(_obstacleID); + Vec3 worldPos = Vec3(obstacle->pos[0], obstacle->pos[1], obstacle->pos[2]); + Mat4 mat = _owner->getNodeToWorldTransform(); + if (mat.m[12] != obstacle->pos[0] && mat.m[13] != obstacle->pos[1] && mat.m[14] != obstacle->pos[2]){ + _tileCache->removeObstacle(_obstacleID); + _tileCache->addObstacle(&mat.m[12], _radius, _height, &_obstacleID); + } + } +} + +NS_CC_END + +#endif //CC_USE_NAVMESH diff --git a/cocos/navmesh/CCNavMeshObstacle.h b/cocos/navmesh/CCNavMeshObstacle.h new file mode 100644 index 000000000000..0edc7dcb5519 --- /dev/null +++ b/cocos/navmesh/CCNavMeshObstacle.h @@ -0,0 +1,123 @@ +/**************************************************************************** + 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 __CCNAV_MESH_OBSTACLE_H__ +#define __CCNAV_MESH_OBSTACLE_H__ + +#include "base/ccConfig.h" +#if CC_USE_NAVMESH + +#include "2d/CCComponent.h" + +#include "base/CCRef.h" +#include "math/Vec3.h" +#include "recast/Detour/DetourNavMesh.h" +#include "recast/DetourTileCache/DetourTileCache.h" + +NS_CC_BEGIN + +/** + * @addtogroup 3d + * @{ + */ + +/** @brief NavMeshObstacle: The code wrapping of dtTileCacheObstacle, use component mode. */ +class CC_DLL NavMeshObstacle : public Component +{ + friend class NavMesh; +public: + + enum NavMeshObstacleSyncFlag + { + NONE = 0, + NODE_TO_OBSTACLE = 1, + OBSTACLE_TO_NODE = 2, + NODE_AND_NODE = NODE_TO_OBSTACLE | OBSTACLE_TO_NODE, + }; + + /** + Create obstacle, shape is cylinder + + @param radius The radius of obstacle. + @param height The height of obstacle. + */ + static NavMeshObstacle* create(float radius, float height); + static const std::string& getNavMeshObstacleComponentName(); + + virtual void onEnter() override; + virtual void onExit() override; + + /** Set radius of obstacle */ + void setRadius(float radius); + + /** Get radius of obstacle */ + float getRadius() const { return _radius; } + + /** Set height of obstacle */ + void setHeight(float height); + + /** Get height of obstacle */ + float getHeight() const { return _height; } + + /** + * synchronization between node and obstacle is time consuming, you can skip some synchronization using this function + */ + void setSyncFlag(const NavMeshObstacleSyncFlag &flag) { _syncFlag = flag; } + NavMeshObstacleSyncFlag getSyncFlag() const { return _syncFlag; } + + /** synchronize parameter to obstacle. */ + void syncToObstacle(); + + /** synchronize parameter to node. */ + void syncToNode(); + +CC_CONSTRUCTOR_ACCESS: + NavMeshObstacle(); + virtual ~NavMeshObstacle(); + + bool initWith(float radius, float height); + +private: + + void addTo(dtTileCache *tileCache); + void removeFrom(dtTileCache *tileCache); + void preUpdate(float delta); + void postUpdate(float delta); + +private: + + float _radius; + float _height; + NavMeshObstacleSyncFlag _syncFlag; + dtObstacleRef _obstacleID; + dtTileCache *_tileCache; +}; + +/** @} */ + +NS_CC_END + +#endif //CC_USE_NAVMESH + +#endif // __CCNAV_MESH_OBSTACLE_H__ diff --git a/cocos/navmesh/CCNavMeshTool.cpp b/cocos/navmesh/CCNavMeshTool.cpp new file mode 100644 index 000000000000..200cc75f8fa0 --- /dev/null +++ b/cocos/navmesh/CCNavMeshTool.cpp @@ -0,0 +1,289 @@ +/**************************************************************************** + 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 "navmesh/CCNavMeshTool.h" +#if CC_USE_NAVMESH + +#include "recast/Detour/DetourCommon.h" +#include "recast/Detour/DetourNavMeshBuilder.h" +#include "recast/fastlz/fastlz.h" + +NS_CC_BEGIN + +LinearAllocator::LinearAllocator(const int cap) +: buffer(0) +, capacity(0) +, top(0) +, high(0) +{ + resize(cap); +} + +LinearAllocator::~LinearAllocator() +{ + dtFree(buffer); +} + +void LinearAllocator::free(void* /*ptr*/) +{ + +} + +void* LinearAllocator::alloc(const int size) +{ + if (!buffer) + return 0; + if (top + size > capacity) + return 0; + unsigned char* mem = &buffer[top]; + top += size; + return mem; +} + +void LinearAllocator::reset() +{ + high = dtMax(high, top); + top = 0; +} + +void LinearAllocator::resize(const int cap) +{ + if (buffer) dtFree(buffer); + buffer = (unsigned char*)dtAlloc(cap, DT_ALLOC_PERM); + capacity = cap; +} + +int FastLZCompressor::maxCompressedSize(const int bufferSize) +{ + return (int)(bufferSize* 1.05f); +} + +dtStatus cocos2d::FastLZCompressor::decompress(const unsigned char* compressed, const int compressedSize + , unsigned char* buffer, const int maxBufferSize, int* bufferSize) +{ + *bufferSize = fastlz_decompress(compressed, compressedSize, buffer, maxBufferSize); + return *bufferSize < 0 ? DT_FAILURE : DT_SUCCESS; +} + +dtStatus cocos2d::FastLZCompressor::compress(const unsigned char* buffer, const int bufferSize + , unsigned char* compressed, const int /*maxCompressedSize*/, int* compressedSize) +{ + *compressedSize = fastlz_compress((const void *const)buffer, bufferSize, compressed); + return DT_SUCCESS; +} + +MeshProcess::MeshProcess(const GeomData *geom) + : data(geom) +{ +} + +MeshProcess::~MeshProcess() +{ + +} + +void MeshProcess::process(struct dtNavMeshCreateParams* params + , unsigned char* polyAreas, unsigned short* polyFlags) +{ + // Update poly flags from areas. + for (int i = 0; i < params->polyCount; ++i) + { + if (polyAreas[i] == DT_TILECACHE_WALKABLE_AREA) + polyAreas[i] = 0; + + if (polyAreas[i] == 0) + polyFlags[i] = 1; + + //if (polyAreas[i] == SAMPLE_POLYAREA_GROUND || + // polyAreas[i] == SAMPLE_POLYAREA_GRASS || + // polyAreas[i] == SAMPLE_POLYAREA_ROAD) + //{ + // polyFlags[i] = SAMPLE_POLYFLAGS_WALK; + //} + //else if (polyAreas[i] == SAMPLE_POLYAREA_WATER) + //{ + // polyFlags[i] = SAMPLE_POLYFLAGS_SWIM; + //} + //else if (polyAreas[i] == SAMPLE_POLYAREA_DOOR) + //{ + // polyFlags[i] = SAMPLE_POLYFLAGS_WALK | SAMPLE_POLYFLAGS_DOOR; + //} + } + + // Pass in off-mesh connections. + params->offMeshConVerts = data->offMeshConVerts; + params->offMeshConRad = data->offMeshConRads; + params->offMeshConDir = data->offMeshConDirs; + params->offMeshConAreas = data->offMeshConAreas; + params->offMeshConFlags = data->offMeshConFlags; + params->offMeshConUserID = data->offMeshConId; + params->offMeshConCount = data->offMeshConCount; +} + +bool getSteerTarget(dtNavMeshQuery* navQuery, const float* startPos, const float* endPos, const float minTargetDist, const dtPolyRef* path, const int pathSize, float* steerPos, unsigned char& steerPosFlag, dtPolyRef& steerPosRef, float* outPoints /*= 0*/, int* outPointCount /*= 0*/) +{ + // Find steer target. + static const int MAX_STEER_POINTS = 3; + float steerPath[MAX_STEER_POINTS * 3]; + unsigned char steerPathFlags[MAX_STEER_POINTS]; + dtPolyRef steerPathPolys[MAX_STEER_POINTS]; + int nsteerPath = 0; + navQuery->findStraightPath(startPos, endPos, path, pathSize, + steerPath, steerPathFlags, steerPathPolys, &nsteerPath, MAX_STEER_POINTS); + if (!nsteerPath) + return false; + + if (outPoints && outPointCount) + { + *outPointCount = nsteerPath; + for (int i = 0; i < nsteerPath; ++i) + dtVcopy(&outPoints[i * 3], &steerPath[i * 3]); + } + + + // Find vertex far enough to steer to. + int ns = 0; + while (ns < nsteerPath) + { + // Stop at Off-Mesh link or when point is further than slop away. + if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) || + !inRange(&steerPath[ns * 3], startPos, minTargetDist, 1000.0f)) + break; + ns++; + } + // Failed to find good point to steer to. + if (ns >= nsteerPath) + return false; + + dtVcopy(steerPos, &steerPath[ns * 3]); + steerPos[1] = startPos[1]; + steerPosFlag = steerPathFlags[ns]; + steerPosRef = steerPathPolys[ns]; + + return true; +} + +int fixupShortcuts(dtPolyRef* path, int npath, dtNavMeshQuery* navQuery) +{ + if (npath < 3) + return npath; + + // Get connected polygons + static const int maxNeis = 16; + dtPolyRef neis[maxNeis]; + int nneis = 0; + + const dtMeshTile* tile = 0; + const dtPoly* poly = 0; + if (dtStatusFailed(navQuery->getAttachedNavMesh()->getTileAndPolyByRef(path[0], &tile, &poly))) + return npath; + + for (unsigned int k = poly->firstLink; k != DT_NULL_LINK; k = tile->links[k].next) + { + const dtLink* link = &tile->links[k]; + if (link->ref != 0) + { + if (nneis < maxNeis) + neis[nneis++] = link->ref; + } + } + + // If any of the neighbour polygons is within the next few polygons + // in the path, short cut to that polygon directly. + static const int maxLookAhead = 6; + int cut = 0; + for (int i = dtMin(maxLookAhead, npath) - 1; i > 1 && cut == 0; i--) { + for (int j = 0; j < nneis; j++) + { + if (path[i] == neis[j]) { + cut = i; + break; + } + } + } + if (cut > 1) + { + int offset = cut - 1; + npath -= offset; + for (int i = 1; i < npath; i++) + path[i] = path[i + offset]; + } + + return npath; +} + +int fixupCorridor(dtPolyRef* path, const int npath, const int maxPath, const dtPolyRef* visited, const int nvisited) +{ + int furthestPath = -1; + int furthestVisited = -1; + + // Find furthest common polygon. + for (int i = npath - 1; i >= 0; --i) + { + bool found = false; + for (int j = nvisited - 1; j >= 0; --j) + { + if (path[i] == visited[j]) + { + furthestPath = i; + furthestVisited = j; + found = true; + } + } + if (found) + break; + } + + // If no intersection found just return current path. + if (furthestPath == -1 || furthestVisited == -1) + return npath; + + // Concatenate paths. + + // Adjust beginning of the buffer to include the visited. + const int req = nvisited - furthestVisited; + const int orig = dtMin(furthestPath + 1, npath); + int size = dtMax(0, npath - orig); + if (req + size > maxPath) + size = maxPath - req; + if (size) + memmove(path + req, path + orig, size*sizeof(dtPolyRef)); + + // Store visited + for (int i = 0; i < req; ++i) + path[i] = visited[(nvisited - 1) - i]; + + return req + size; +} + +bool inRange(const float* v1, const float* v2, const float r, const float h) +{ + const float dx = v2[0] - v1[0]; + const float dy = v2[1] - v1[1]; + const float dz = v2[2] - v1[2]; + return (dx*dx + dz*dz) < r*r && fabsf(dy) < h; +} + +NS_CC_END + +#endif //CC_USE_NAVMESH diff --git a/cocos/navmesh/CCNavMeshTool.h b/cocos/navmesh/CCNavMeshTool.h new file mode 100644 index 000000000000..47299a56a5bc --- /dev/null +++ b/cocos/navmesh/CCNavMeshTool.h @@ -0,0 +1,135 @@ +/**************************************************************************** + 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 __CCNAV_MESH_TOOL_H__ +#define __CCNAV_MESH_TOOL_H__ + +#include "base/ccConfig.h" +#if CC_USE_NAVMESH + +#include "platform/CCPlatformMacros.h" +#include "math/CCMath.h" + +#include "recast/Detour/DetourCommon.h" +#include "recast/Detour/DetourNavMesh.h" +#include "recast/Detour/DetourNavMeshQuery.h" +#include "recast/DetourTileCache/DetourTileCache.h" +#include "recast/DetourTileCache/DetourTileCacheBuilder.h" + +NS_CC_BEGIN + +/** + * @addtogroup 3d + * @{ + */ + +struct LinearAllocator : public dtTileCacheAlloc +{ + unsigned char* buffer; + int capacity; + int top; + int high; + + LinearAllocator(const int cap); + + ~LinearAllocator(); + + void resize(const int cap); + + virtual void reset(); + + virtual void* alloc(const int size); + + virtual void free(void* /*ptr*/); +}; + +struct FastLZCompressor : public dtTileCacheCompressor +{ + virtual int maxCompressedSize(const int bufferSize); + + virtual dtStatus compress(const unsigned char* buffer, const int bufferSize, + unsigned char* compressed, const int /*maxCompressedSize*/, int* compressedSize); + + virtual dtStatus decompress(const unsigned char* compressed, const int compressedSize, + unsigned char* buffer, const int maxBufferSize, int* bufferSize); +}; + +struct GeomData +{ + static const int MAX_OFFMESH_CONNECTIONS = 256; + float offMeshConVerts[MAX_OFFMESH_CONNECTIONS * 3 * 2]; + float offMeshConRads[MAX_OFFMESH_CONNECTIONS]; + unsigned char offMeshConDirs[MAX_OFFMESH_CONNECTIONS]; + unsigned char offMeshConAreas[MAX_OFFMESH_CONNECTIONS]; + unsigned short offMeshConFlags[MAX_OFFMESH_CONNECTIONS]; + unsigned int offMeshConId[MAX_OFFMESH_CONNECTIONS]; + int offMeshConCount; +}; + +struct MeshProcess : public dtTileCacheMeshProcess +{ + const GeomData *data; + + MeshProcess(const GeomData *geom); + virtual ~MeshProcess(); + + //void init(InputGeom* geom) + //{ + // m_geom = geom; + //} + + virtual void process(struct dtNavMeshCreateParams* params, + unsigned char* polyAreas, unsigned short* polyFlags) override; +}; + +bool inRange(const float* v1, const float* v2, const float r, const float h); + +int fixupCorridor(dtPolyRef* path, const int npath, const int maxPath, + const dtPolyRef* visited, const int nvisited); + +// This function checks if the path has a small U-turn, that is, +// a polygon further in the path is adjacent to the first polygon +// in the path. If that happens, a shortcut is taken. +// This can happen if the target (T) location is at tile boundary, +// and we're (S) approaching it parallel to the tile edge. +// The choice at the vertex can be arbitrary, +// +---+---+ +// |:::|:::| +// +-S-+-T-+ +// |:::| | <-- the step can end up in here, resulting U-turn path. +// +---+---+ +int fixupShortcuts(dtPolyRef* path, int npath, dtNavMeshQuery* navQuery); + +bool getSteerTarget(dtNavMeshQuery* navQuery, const float* startPos, const float* endPos, + const float minTargetDist, + const dtPolyRef* path, const int pathSize, + float* steerPos, unsigned char& steerPosFlag, dtPolyRef& steerPosRef, + float* outPoints = 0, int* outPointCount = 0); +/** @} */ + +NS_CC_END + +#endif //CC_USE_NAVMESH + +#endif // __CCNAV_MESH_H__ diff --git a/cocos/navmesh/CMakeLists.txt b/cocos/navmesh/CMakeLists.txt new file mode 100644 index 000000000000..7a4249e14bdc --- /dev/null +++ b/cocos/navmesh/CMakeLists.txt @@ -0,0 +1,9 @@ + +set(COCOS_NAVMESH_SRC + + navmesh/CCNavMesh.cpp + navmesh/CCNavMeshAgent.cpp + navmesh/CCNavMeshDebugDraw.cpp + navmesh/CCNavMeshObstacle.cpp + navmesh/CCNavMeshTool.cpp +) diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index 9325b1eebb3d..36dfb8a705aa 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -103,6 +103,7 @@ set(TESTS_SRC Classes/NewAudioEngineTest/NewAudioEngineTest.cpp Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp Classes/NewRendererTest/NewRendererTest.cpp + Classes/NavMeshTest/NavMeshTest.cpp Classes/NodeTest/NodeTest.cpp Classes/OpenURLTest/OpenURLTest.cpp Classes/ParallaxTest/ParallaxTest.cpp diff --git a/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp new file mode 100644 index 000000000000..ee5d8dcbdcc7 --- /dev/null +++ b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp @@ -0,0 +1,440 @@ +/**************************************************************************** + Copyright (c) 2012 cocos2d-x.org + 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 "NavMeshTest.h" +#include "physics3d/CCPhysics3DWorld.h" +#include "physics3d/CCPhysics3D.h" +#include "3d/CCBundle3D.h" +#include "2d/CCLight.h" + +USING_NS_CC_EXT; +USING_NS_CC; + +struct AgentUserData +{ + float time; +}; + +NavMeshTests::NavMeshTests() +{ +#if CC_USE_NAVMESH == 0 + ADD_TEST_CASE(NavMeshDisabled); +#else + ADD_TEST_CASE(NavMeshBasicTestDemo); + ADD_TEST_CASE(NavMeshAdvanceTestDemo); +#endif +}; + +#if CC_USE_NAVMESH == 0 +void NavMeshDisabled::onEnter() +{ + TTFConfig ttfConfig("fonts/arial.ttf", 16); + auto label = Label::createWithTTF(ttfConfig, "Should define CC_USE_NAVMESH\n to run this test case"); + + auto size = Director::getInstance()->getWinSize(); + label->setPosition(Vec2(size.width / 2, size.height / 2)); + + addChild(label); + + TestCase::onEnter(); +} +#else + +NavMeshBaseTestDemo::NavMeshBaseTestDemo(void) + : _camera(nullptr) + , _needMoveAgents(false) +{ + +} + +NavMeshBaseTestDemo::~NavMeshBaseTestDemo(void) +{ + for (auto iter : _agents){ + AgentUserData *data = static_cast(iter.first->getUserData()); + delete data; + } +} + +bool NavMeshBaseTestDemo::init() +{ + if (!TestCase::init()) return false; + + if (initWithPhysics()){ + + _angle = 0.0f; + + Size size = Director::getInstance()->getWinSize(); + _camera = Camera::createPerspective(30.0f, size.width / size.height, 1.0f, 1000.0f); + _camera->setPosition3D(Vec3(0.0f, 50.0f, 100.0f)); + _camera->lookAt(Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f)); + _camera->setCameraFlag(CameraFlag::USER1); + this->addChild(_camera); + + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesBegan = CC_CALLBACK_2(NavMeshBaseTestDemo::onTouchesBegan, this); + listener->onTouchesMoved = CC_CALLBACK_2(NavMeshBaseTestDemo::onTouchesMoved, this); + listener->onTouchesEnded = CC_CALLBACK_2(NavMeshBaseTestDemo::onTouchesEnded, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); + + initScene(); + scheduleUpdate(); + } + + + return true; +} + +void NavMeshBaseTestDemo::onTouchesBegan(const std::vector& touches, cocos2d::Event *event) +{ + _needMoveAgents = true; + touchesBegan(touches, event); +} + +void NavMeshBaseTestDemo::onTouchesMoved(const std::vector& touches, cocos2d::Event *event) +{ + if (touches.size() && _camera) + { + auto touch = touches[0]; + auto delta = touch->getDelta(); + + _angle -= CC_DEGREES_TO_RADIANS(delta.x); + _camera->setPosition3D(Vec3(100.0f * sinf(_angle), 50.0f, 100.0f * cosf(_angle))); + _camera->lookAt(Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f)); + + if (delta.lengthSquared() > 16) + { + _needMoveAgents = false; + } + } + touchesMoved(touches, event); +} + +void NavMeshBaseTestDemo::onTouchesEnded(const std::vector& touches, cocos2d::Event *event) +{ + touchesEnded(touches, event); +} + +void NavMeshBaseTestDemo::initScene() +{ + getPhysics3DWorld()->setDebugDrawEnable(false); + //create mesh + std::vector trianglesList; + auto bundle = Bundle3D::createBundle(); + MeshDatas meshs; + MaterialDatas materials; + NodeDatas nodeDatas; + bundle->loadObj(meshs, materials, nodeDatas, "NavMesh/scene.obj"); + Bundle3D::destroyBundle(bundle); + for (auto iter : meshs.meshDatas){ + int preVertexSize = iter->getPerVertexSize() / sizeof(float); + for (auto indexArray : iter->subMeshIndices){ + for (auto i : indexArray){ + trianglesList.push_back(Vec3(iter->vertex[i * preVertexSize], iter->vertex[i * preVertexSize + 1], iter->vertex[i * preVertexSize + 2])); + } + } + } + + Physics3DRigidBodyDes rbDes; + rbDes.mass = 0.0f; + rbDes.shape = Physics3DShape::createMesh(&trianglesList[0], (int)trianglesList.size() / 3); + auto rigidBody = Physics3DRigidBody::create(&rbDes); + auto component = Physics3DComponent::create(rigidBody); + auto sprite = Sprite3D::create("NavMesh/scene.obj"); + sprite->addComponent(component); + sprite->setCameraMask((unsigned short)CameraFlag::USER1); + this->addChild(sprite); + setPhysics3DDebugCamera(_camera); + + auto navMesh = NavMesh::create("NavMesh/all_tiles_tilecache.bin", "NavMesh/geomset.txt"); + navMesh->setDebugDrawEnable(true); + setNavMesh(navMesh); + setNavMeshDebugCamera(_camera); + + + auto ambientLight = AmbientLight::create(Color3B(64, 64, 64)); + ambientLight->setCameraMask((unsigned short)CameraFlag::USER1); + this->addChild(ambientLight); + + auto dirLight = DirectionLight::create(Vec3(1.2f, -1.1f, 0.5f), Color3B(255, 255, 255)); + dirLight->setCameraMask((unsigned short)CameraFlag::USER1); + this->addChild(dirLight); +} + +void NavMeshBaseTestDemo::createAgent(const Vec3 &pos) +{ + std::string filePath = "Sprite3DTest/girl.c3b"; + NavMeshAgentParam param; + param.radius = 2.0f; + param.height = 8.0f; + param.maxSpeed = 8.0f; + auto agent = NavMeshAgent::create(param); + auto agentNode = Sprite3D::create(filePath); + agent->setOrientationRefAxes(Vec3(-1.0f, 0.0f, 1.0f)); + AgentUserData *data = new AgentUserData{ 0.0f }; + agent->setUserData(data); + agentNode->setScale(0.05f); + agentNode->addComponent(agent); + + auto node = Node::create(); + node->addChild(agentNode); + node->setPosition3D(pos); + node->setCameraMask((unsigned short)CameraFlag::USER1); + this->addChild(node); + + + auto animation = Animation3D::create(filePath); + auto animate = Animate3D::create(animation); + if (animate){ + agentNode->runAction(RepeatForever::create(animate)); + animate->setSpeed(0); + } + + _agents.push_back(std::make_pair(agent, animate)); +} + +void NavMeshBaseTestDemo::createObstacle(const Vec3 &pos) +{ + auto obstacle = NavMeshObstacle::create(2.0f, 8.0f); + auto obstacleNode = Sprite3D::create("Sprite3DTest/cylinder.c3b"); + obstacleNode->setPosition3D(pos + Vec3(0.0f, -0.5f, 0.0f)); + obstacleNode->setRotation3D(Vec3(-90.0f, 0.0f, 0.0f)); + obstacleNode->setScale(0.3f); + obstacleNode->addComponent(obstacle); + obstacleNode->setCameraMask((unsigned short)CameraFlag::USER1); + this->addChild(obstacleNode); +} + +Vec3 jump(const Vec3* pV1, const Vec3* pV2, float height, float t) +{ + Vec3 pOut; + pOut.x = pV1->x + t * (pV2->x - pV1->x); + pOut.y = pV1->y + t * (pV2->y - pV1->y); + pOut.z = pV1->z + t * (pV2->z - pV1->z); + pOut.y += height * sinf(M_PI * t); + return pOut; +} + +void NavMeshBaseTestDemo::moveAgents(const cocos2d::Vec3 &des) +{ + for (auto iter : _agents){ + NavMeshAgent::MoveCallback callback = [](NavMeshAgent *agent, float totalTimeAfterMove){ + AgentUserData *data = static_cast(agent->getUserData()); + if (agent->isOnOffMeshLink()){ + agent->setAutoTraverseOffMeshLink(false); + agent->setAutoOrientation(false); + OffMeshLinkData linkdata = agent->getCurrentOffMeshLinkData(); + + agent->getOwner()->setPosition3D(jump(&linkdata.startPosition, &linkdata.endPosition, 10.0f, data->time)); + Vec3 dir = linkdata.endPosition - linkdata.startPosition; + dir.y = 0.0f; + dir.normalize(); + Vec3 axes; + Vec3 refAxes = Vec3(-1.0f, 0.0f, 1.0f); + refAxes.normalize(); + Vec3::cross(refAxes, dir, &axes); + float angle = Vec3::dot(refAxes, dir); + agent->getOwner()->setRotationQuat(Quaternion(axes, acosf(angle))); + data->time += 0.01f; + if (1.0f < data->time){ + agent->completeOffMeshLink(); + agent->setAutoOrientation(true); + data->time = 0.0f; + } + } + }; + iter.first->move(des, callback); + } +} + +void NavMeshBaseTestDemo::update(float delta) +{ + for (auto iter : _agents){ + float speed = iter.first->getCurrentVelocity().length() * 0.2; + iter.second->setSpeed(0.0f < speed ? speed : 0.0f); + } +} + +NavMeshBasicTestDemo::NavMeshBasicTestDemo(void) +{ + +} + +NavMeshBasicTestDemo::~NavMeshBasicTestDemo(void) +{ +} + +std::string NavMeshBasicTestDemo::title() const +{ + return "Navigation Mesh Test"; +} + +std::string NavMeshBasicTestDemo::subtitle() const +{ + return "Basic Test"; +} + +void NavMeshBasicTestDemo::touchesEnded(const std::vector& touches, cocos2d::Event *event) +{ + if (!_needMoveAgents) return; + if (!touches.empty()){ + auto touch = touches[0]; + auto location = touch->getLocationInView(); + Vec3 nearP(location.x, location.y, 0.0f), farP(location.x, location.y, 1.0f); + + auto size = Director::getInstance()->getWinSize(); + _camera->unproject(size, &nearP, &nearP); + _camera->unproject(size, &farP, &farP); + + Physics3DWorld::HitResult result; + getPhysics3DWorld()->rayCast(nearP, farP, &result); + moveAgents(result.hitPosition); + } +} + +bool NavMeshBasicTestDemo::init() +{ + if (!NavMeshBaseTestDemo::init()) return false; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + _debugLabel = Label::createWithTTF(ttfConfig, "Debug Draw ON"); + _debugLabel->retain(); + auto menuItem1 = MenuItemLabel::create(_debugLabel, [=](Ref*){ + bool enabledDebug = !getNavMesh()->isDebugDrawEnabled(); + getNavMesh()->setDebugDrawEnable(enabledDebug); + if (enabledDebug){ + _debugLabel->setString("Debug Draw ON"); + } + else{ + _debugLabel->setString("Debug Draw OFF"); + } + }); + menuItem1->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); + menuItem1->setPosition(Vec2(VisibleRect::left().x, VisibleRect::top().y - 100)); + auto menu = Menu::create(menuItem1, nullptr); + menu->setPosition(Vec2::ZERO); + addChild(menu); + + Physics3DWorld::HitResult result; + getPhysics3DWorld()->rayCast(Vec3(0.0f, 50.0f, 0.0f), Vec3(0.0f, -50.0f, 0.0f), &result); + createAgent(result.hitPosition); + + return true; +} + +NavMeshAdvanceTestDemo::NavMeshAdvanceTestDemo(void) +{ + +} + +NavMeshAdvanceTestDemo::~NavMeshAdvanceTestDemo(void) +{ + +} + +bool NavMeshAdvanceTestDemo::init() +{ + if (!NavMeshBaseTestDemo::init()) return false; + + TTFConfig ttfConfig("fonts/arial.ttf", 15); + _obstacleLabel = Label::createWithTTF(ttfConfig, "Create Obstacle"); + _obstacleLabel->retain(); + _agentLabel = Label::createWithTTF(ttfConfig, "Create Agent"); + _agentLabel->retain(); + _debugLabel = Label::createWithTTF(ttfConfig, "Debug Draw ON"); + _debugLabel->retain(); + + auto menuItem0 = MenuItemLabel::create(_obstacleLabel, [=](Ref*){ + float x = cocos2d::random(-50.0f, 50.0f); + float z = cocos2d::random(-50.0f, 50.0f); + Physics3DWorld::HitResult result; + getPhysics3DWorld()->rayCast(Vec3(x, 50.0f, z), Vec3(x, -50.0f, z), &result); + createObstacle(result.hitPosition); + }); + menuItem0->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); + menuItem0->setPosition(Vec2(VisibleRect::left().x, VisibleRect::top().y - 50)); + + auto menuItem1 = MenuItemLabel::create(_agentLabel, [=](Ref*){ + float x = cocos2d::random(-50.0f, 50.0f); + float z = cocos2d::random(-50.0f, 50.0f); + Physics3DWorld::HitResult result; + getPhysics3DWorld()->rayCast(Vec3(x, 50.0f, z), Vec3(x, -50.0f, z), &result); + createAgent(result.hitPosition); + }); + menuItem1->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); + menuItem1->setPosition(Vec2(VisibleRect::left().x, VisibleRect::top().y - 100)); + + auto menuItem2 = MenuItemLabel::create(_debugLabel, [=](Ref*){ + bool enabledDebug = !getNavMesh()->isDebugDrawEnabled(); + getNavMesh()->setDebugDrawEnable(enabledDebug); + if (enabledDebug){ + _debugLabel->setString("Debug Draw ON"); + } + else{ + _debugLabel->setString("Debug Draw OFF"); + } + }); + menuItem2->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT); + menuItem2->setPosition(Vec2(VisibleRect::left().x, VisibleRect::top().y - 150)); + + auto menu = Menu::create(menuItem0, menuItem1, menuItem2, nullptr); + menu->setPosition(Vec2::ZERO); + addChild(menu); + + Physics3DWorld::HitResult result; + getPhysics3DWorld()->rayCast(Vec3(0.0f, 50.0f, 0.0f), Vec3(0.0f, -50.0f, 0.0f), &result); + createAgent(result.hitPosition); + + return true; +} + +std::string NavMeshAdvanceTestDemo::title() const +{ + return "Navigation Mesh Test"; +} + +std::string NavMeshAdvanceTestDemo::subtitle() const +{ + return "Advance Test"; +} + +void NavMeshAdvanceTestDemo::touchesEnded(const std::vector& touches, cocos2d::Event *event) +{ + if (!_needMoveAgents) return; + if (!touches.empty()){ + auto touch = touches[0]; + auto location = touch->getLocationInView(); + Vec3 nearP(location.x, location.y, 0.0f), farP(location.x, location.y, 1.0f); + + auto size = Director::getInstance()->getWinSize(); + _camera->unproject(size, &nearP, &nearP); + _camera->unproject(size, &farP, &farP); + + Physics3DWorld::HitResult result; + getPhysics3DWorld()->rayCast(nearP, farP, &result); + moveAgents(result.hitPosition); + } +} + +#endif diff --git a/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h new file mode 100644 index 000000000000..4c707afcd025 --- /dev/null +++ b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.h @@ -0,0 +1,124 @@ +/**************************************************************************** + Copyright (c) 2013 cocos2d-x.org + + 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 _NAVMESH_TEST_H_ +#define _NAVMESH_TEST_H_ + +#include "../testBasic.h" +#include "../BaseTest.h" +#include "navmesh/CCNavMesh.h" +#include + +DEFINE_TEST_SUITE(NavMeshTests); + +#if CC_USE_NAVMESH == 0 +class NavMeshDisabled : public TestCase +{ +public: + CREATE_FUNC(NavMeshDisabled); + + virtual void onEnter() override; +}; +#else + +class NavMeshBaseTestDemo : public TestCase +{ +public: + CREATE_FUNC(NavMeshBaseTestDemo); + NavMeshBaseTestDemo(void); + virtual ~NavMeshBaseTestDemo(void); + + // overrides + virtual bool init() override; + virtual void update(float delta) override; + virtual void onTouchesBegan(const std::vector& touches, cocos2d::Event *event); + virtual void onTouchesMoved(const std::vector& touches, cocos2d::Event *event); + virtual void onTouchesEnded(const std::vector& touches, cocos2d::Event *event); + +protected: + + void initScene(); + void createAgent(const cocos2d::Vec3 &pos); + void createObstacle(const cocos2d::Vec3 &pos); + void moveAgents(const cocos2d::Vec3 &des); + virtual void touchesBegan(const std::vector& touches, cocos2d::Event *event){}; + virtual void touchesMoved(const std::vector& touches, cocos2d::Event *event){}; + virtual void touchesEnded(const std::vector& touches, cocos2d::Event *event){}; + +protected: + cocos2d::Camera *_camera; + float _angle; + std::vector > _agents; + bool _needMoveAgents; +}; + +class NavMeshBasicTestDemo : public NavMeshBaseTestDemo +{ +public: + CREATE_FUNC(NavMeshBasicTestDemo); + NavMeshBasicTestDemo(void); + virtual ~NavMeshBasicTestDemo(void); + + // overrides + virtual bool init() override; + virtual std::string title() const override; + virtual std::string subtitle() const override; + +protected: + + virtual void touchesBegan(const std::vector& touches, cocos2d::Event *event){}; + virtual void touchesMoved(const std::vector& touches, cocos2d::Event *event){}; + virtual void touchesEnded(const std::vector& touches, cocos2d::Event *event); + +protected: + cocos2d::Label *_debugLabel; +}; + +class NavMeshAdvanceTestDemo : public NavMeshBaseTestDemo +{ +public: + CREATE_FUNC(NavMeshAdvanceTestDemo); + NavMeshAdvanceTestDemo(void); + virtual ~NavMeshAdvanceTestDemo(void); + + // overrides + virtual bool init() override; + virtual std::string title() const override; + virtual std::string subtitle() const override; + +protected: + + virtual void touchesBegan(const std::vector& touches, cocos2d::Event *event){}; + virtual void touchesMoved(const std::vector& touches, cocos2d::Event *event){}; + virtual void touchesEnded(const std::vector& touches, cocos2d::Event *event); + +protected: + cocos2d::Label *_obstacleLabel; + cocos2d::Label *_agentLabel; + cocos2d::Label *_debugLabel; +}; + +#endif + +#endif diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 8baf84845c54..28f97c7d037c 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -46,6 +46,7 @@ class RootTests : public TestList addTest("Fonts", []() { return new FontTests(); }); addTest("Interval", [](){return new IntervalTests(); }); addTest("Material System", [](){return new MaterialSystemTest(); }); + addTest("Navigation Mesh", [](){return new NavMeshTests(); }); addTest("Node: BillBoard Test", [](){ return new BillBoardTests(); }); addTest("Node: Camera 3D Test", [](){ return new Camera3DTests(); }); addTest("Node: Clipping", []() { return new ClippingNodeTests(); }); diff --git a/tests/cpp-tests/Classes/tests.h b/tests/cpp-tests/Classes/tests.h index 5a23eee399a8..0e07c5da60f7 100644 --- a/tests/cpp-tests/Classes/tests.h +++ b/tests/cpp-tests/Classes/tests.h @@ -82,6 +82,7 @@ #include "LightTest/LightTest.h" #include "Particle3DTest/Particle3DTest.h" #include "Physics3DTest/Physics3DTest.h" +#include "NavMeshTest/NavMeshTest.h" #include "OpenURLTest/OpenURLTest.h" #include "AllocatorTest/AllocatorTest.h" diff --git a/tests/cpp-tests/Resources/NavMesh/all_tiles_tilecache.bin b/tests/cpp-tests/Resources/NavMesh/all_tiles_tilecache.bin new file mode 100644 index 0000000000000000000000000000000000000000..5383ff4d0a7fa442effa7a24bb730939a2df2783 GIT binary patch literal 20240 zcmeHP3v^sZdH#1-(rUHZT}hT@y)50eB-@fL-3^(=Ceg+TPC{Fp zjeQqns7=F81?&R zcJ9uuR!&k#>(cJgdgso}z4w27^UwFs-0MrufAb|F5xEdw{QG77gWs!n?i}G)*qCK) zvF+}C`_4W3=o`QdF7swot4^)0@N$W-(?^?s2}yzTw}UAMhcLN!s9 z7TMx`J(Ntbw5>#0NEh=Zp{hl;&bDllm`6Qln+{0a=>92xF8sh;%Xt176;}A=*{gi1 zpAP-S<^!RPgD{BnZyr@43BwT~*!5rWTkacFqsK%JBde@WVzz28{uU9sb8Z6AoXWxnILXdo1|fnMo{>JvQL zI@Pf~j^E%Dh9rk^WL3mr@Uf7iiu?9``VgU5grE44f{M3Ln=*mkCv&$9s<+A9$-Q%* z*gL(hacb;1v{>3}%vW!*z21^SIn)wWy%OHimBLS%f1mL~oe5TNoqfxq8pCG_kDZvH1|X`RB=6FRYA2BR2gwpIo&)_ z139tH4+{iyf#)QGv-L=W8|dFckgT5e7eY72bp2S06sO2#8ytq zeCF`Ba+wD#InpCBEx89(dI>oS3{~r^OKEcS8(+5H2_I7q?cNQP*mXI4pb&&Eq6x=Uj$KOY;OVC9=4aD(t=e(7W z*gLAyj3L3T-NJpoN4;M9i4XXpJ!7OpyVv~!w!G|mf@lkC4{HPd+L^Ct5AmxCG4}6pLWLo3#>pv1 zP>nqM`Ey^?2>OsSf)ZsiGZI*tt(=tE&Jm}B%t;7%9CBLRaW1nmTRADSjashE#2wR% z)i_}S5pocqo49RRi=P3YfhBccKQW}X``+7@?U+EPV?b99gojg0GKJDMb+Iosxy!s! z`lVC6ft-Z4b>(Ul@a7^qDF43W8WQTK;SZ}O1F}`qszxL93D)fvlm*D*zKXT6CVEtpU|tS+ z!k&=7dS{EKQ-nOrguE|4lG9kv%EHJFGSeqh{{&rh3JUYPK6L;g*}eWGqI`jzoZ`Z-DP<@taQ(k^w4u>C!C-=q^J=PSN9T%{kJT7S=BkHYhDaC2+a39X8Pn*>A$v0tdxF zb}KJs=eJaL3={iMPuRsWpCXNTm^r%&< zI46U%!>MQlRsq@DqIyRqHGA^d?8vdHliR1ZY%eAmD`CkVpwBvj0J0#m#^Zgv-SeSDBUGRf~~vMu2MCd5V084;tCneX2*grXd(^vNACA)4y@(rq0 za)YY1uMjGqE8yZfnUS%nt}!J@H?6Wee(jVk$LTyX>j{}!y;inebzc?}C0wmSzITRd z-=QKt9bScnk&LSL>FgS=La3I*lfHzthgLo3aVGTy(52T^OD?=kYVtP$;Pl%ne_{wo zp4_gwM<yQ?0NQ*fXPHk)XgP(4x@{;g#-+`V%wHi`*K3GCw zM!(dVJz7G@T=6X*DyY(nWJe$E)N?k6$nbE_2!GFzVa(qWOSQU-%MXRBuv8tA>GVH) zgHXFW<6RcU2X^erXD|_>FeJSnEL3~} z_{`$6-_*v%We4&&H3^51nrJi{nNP0| z)ughR@G^NsqKqWzD3F7$JG6t;>WpzuHx}i+KSWbZt={WpB;gH7LW>OF^p;AzL5G-C z(8VPW%yew%vEhcH$EE|zgr0yfxP_O2JhVbwjQ_y>%vh|rRz!+xGnR63^^((~>X7XE z353QWbtT5j?Vb%Su18Uxh9^B)=xp`YO^O;jb=Sz9V`IA)I+>znr3(Bu6<3{1)8LM6 z>g~+^Rr~EygP1GXah?9RiPwiv=&Q7aI%Y`s?_vk}ZBU&vwnaW^o>kqdYbFb`5>>7` zPA%C}d8bL)W+L|?Wm9)!E9G(3BHm*~0bWH8<(lNTWxfTxYbNr!ELZx}M{&{wPRc#4 zT6#Fj1KDGmRxRcE=rB#H--^wM8RSW^s~>)oNc~wHnQuc z?!uM7qwN93`>zVgMkOf~)9WJbQ0@q-%WZ>dd`N*~Iw}}`8Pic=gKR)lX!KW?vw8#J zx6)oKWwv&|TIq267RycoyS$y#5j!3z>4=dYbTNgkn%`5k+1kA%YA9Nw_H#|k8nrSV zxbv0ptW~B4Dp*Hbf=owSg6uf@1qd=?Z%EiCsJURtV8~+Bu-h)T+v}Ee!c`u^wE!GjkqnOVXn9z4oL`ToNByJ)eosAFjO3=#!((^_9dc^ z#(C7}b1lD0Vc{$_>J6#-j5^PkYQ%rlJgQ z=Q(vH=fq3e>Py-ZC2h%)HqJw;nfKx~8;Wf>YQ#}6kA72nE}ZW9J{0K9cuQ6<_7-N% z(BZEB!)i@&dN|J?eC>4I*mT3L?H6L?$1*DA?;Vq*s?8MVTr>H;Ur&+s816&+IowrE z2luf&ILni`!S<X9h5alvG0@VyhuK(qxA?K=uo6n4D_uU!L|J`7iu zyA{=T+gq=n(XFKzmGtr$)!W{!GGD!kP5?mfsf4?45S{GRUFZc?UdG>W2y|kb1(HYR zt4BCVqo^mO?RwNvrK#|Z99umQ+KuN-JS;@5{Di7y?#1y|5+H*Z?iOB#c-{+f*WqhT z&*Z|2Yeh68%On?-#0{B6*$_dPbtZq99NB4$%tm@u%Ro-ba;^nhJ}g((s<2KfOc*o& zK5WkGseB&!66D-{<%H~EE)X}{3aEm_8(g=~@VJ7aVOB zVXk5QZgUMPVsj10?>5(%&~BfItAu1d6-s+?6=n|Mb*u3IAN=w*z>aBrtpZk}TtJcz zW7^8KHR#)?LXz94^e`;IW)g|~r0n>`B&q-DpXB|jB+Mb3wZ^Mv;L*lgwzkR|Z=lS0 zh%PZv@VMwvoQ$p9T?vW8P)GhO#XgqgPE6l4$h!EF6UC*+m`oJGPi z(S|XT_m3RoPPrMZSLh%UJpaOwd{CASPgDo_S#fx}aYkx&oDt#h#A8|$rBUX=k`O|4 ztbYQbZn89Nf4-zw!3-z5e!3(RgYbJ?or5UzgpM-nA#ZtNrdQ&ihIx3(5Kf!uFod2i ziCI5ncPDb1-pX#}WmL2zx+weq$V5H>`JRM`HlQ=eTXC(36xYm7d`RA!x+pH5*ug5F zO0)y(WfQqO4Sj&igGsq&MkN`PN=AU&??z1;k&*1a<`^dG+77+>k7F}S*LIXm(eAls zGn&5cIKgOyUs)#i|x!s-FBUeI_=C! z-FBUoI_=C$-FBUsI_=C&-FBUwI_=C)-FBU!I_=C+-S#FNE87lzSKxRdHiei4m!m1X zn*W-7&vjQ&zD4gzM?p&#V$bumgjAxK4;%kv?RYaA}cr22sVkwd(ZFk_QqQcy@Y7jeYKyoV|nJCj+rT_>|nJCj+rT_>|nJCj+rT_>|n zJCj+rT_>|nJCj+rT_>|nJCj+ry$Q#Gen@s#=ynWB?Q6_;#xj9(%L?xee7z9vBBq7mC9f|UlHE8_J;XOqm--N#V-318Ly3-*M)Zxs#bm+vy&AoHo8Vwb7zb6NeW z)d8GzFHXWPQ%XNM7dR?hSdJ)vnhYJj$6cmIrg?Q{mkGNYc*!ZQlKpv62lOrzrj>|F zahEBv2QB8ZdbM03a`j(Tiy0@{Qez&<@6W(0Ux78sErV)&9vC_L=no2^sBtsPtm~6L z%sQ>h?J@QCbQgQ>L?|i7>C@z>3tJb zPdiG(`qigC(Qc1i^#QKDbi0bF@A#3I(>6DERRPb@RSR%oaECG0bZ2WzuoSB zyaF!wL??%5LSQ?3VKtWiRqPcbvNAmm#d23Hi!t zsTJ3XNOA4FUP;{3otC~5I({5qJE9o?#dggqop!@2i|v|KI_-v47TYzeblMH8EVgS_>9iYG zS!~y=(zctKq0X@Xm&yq3`u|HLglEAs--k!6cR1-<09w!yfc%mWRsx_Kt%LGEk!m4N zTY+IWsQwD?6e-NL!BUJ{_^K?_#Ixv{%<@%l^(l0Ifb(m`Cw7AQ6NR(Mt7^fk=2zS( zv4!ZPa6I;HFrNVuESG)!q@2{XSs)ZVhG-z#&)(tu^4$2?` zW7_vmwf6|s{~i~qtRwV>VzzzIQTF`R~C*QOL7#q1*AbZlO!8TdXV0uOYsb+=9K( z#jL2>m0+I8HgEO8T2xWgH%%#p#b)-zmOkVTccj09< z$?aG1R*#AxMPI4vSCKvsst=oMKm4n>HXRSbyE`|8<(X(pUc$RUuux+bXjlUhiHD={ zHaz%b3_I{tY@gmaNpa^SW_C`%x3{Rc55B)N6aGD4I_K+aLW#s|@|&{lf??tE#C*Dayh<`PF_{SAGYIlnEm~A_3F zVk7l?NTy=Xs&7%-r0n=cg>~lV^;P4q&6=xbxe#rx8V7LoolsX_xN7|dUiFKGtI|vy zw7H+Wm{sY|Y9}KoZk=g94pr30b@;1e_)D7bhl_0i?y;#em(t-GP{G{TIUW6LY~jk* zkrPU3bYx-XqYgT(sZm{6z&6hLL^sJTtq(W#Hw3gc+K`H zr~4;0;GyB+6U|Qq%-X$psSN@E-lCNnfk5sf1Z15SKNd5@kL5U(@N)`c{Z+sBX+*JE z=~f*C%pPCKUb^!MS@Qu5XJDjNcKlm~1>B?lRX@ZI+bn`l8-tT`=8g~H8E@i%OS)Io z%bpin(jC{M2EAi5)yH!Qec6<~tkit+u?XH~h(b;eVQ#i<5$uER+3ZiZ9z$8S;*Q6) zxi-UGk2n~x<{}2H->tbyF#wWI48Z-)(y!~LV=*BSn zFaZ-DMXUf^3+@q>8k2dsIzPQOU76}L8l zrg?ShoZVcNY6` zbkH6rR;*xPp&`nz`VLonjx78wXe_)QVjqUw77N6I#e(%ee~AIIV+RWZmPmmTGq5au u-qz@Lv#;if>=$}lcsKh|87w{TzM`GFlrBQMrh1ds2<@?}?+2hb!~Z7+C_2#q literal 0 HcmV?d00001 diff --git a/tests/cpp-tests/Resources/NavMesh/geomset.txt b/tests/cpp-tests/Resources/NavMesh/geomset.txt new file mode 100644 index 000000000000..472cb4524c0e --- /dev/null +++ b/tests/cpp-tests/Resources/NavMesh/geomset.txt @@ -0,0 +1,6 @@ +f Meshes/scene.obj +c -1.415108 11.074799 40.988361 19.871681 8.906498 40.807953 0.600000 1 5 8 +c 24.950050 8.906502 39.621304 33.185913 7.342701 22.568581 0.600000 1 5 8 +c 32.954346 7.342701 18.303593 33.168766 8.489700 -2.227217 0.600000 1 5 8 +c 30.448170 8.489697 -10.263871 14.368065 9.219200 -24.601736 0.600000 1 5 8 +c 12.478474 9.219200 -23.165859 -0.123363 0.999996 -23.276600 0.600000 0 5 8 diff --git a/tests/cpp-tests/Resources/NavMesh/maps/scenetex.png b/tests/cpp-tests/Resources/NavMesh/maps/scenetex.png new file mode 100644 index 0000000000000000000000000000000000000000..ce473f8dac5b741941d24b1259d891e02cf9d357 GIT binary patch literal 196 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1SD0tpLGH$#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!V5FyuV@QVc+w+XP3bMGpd}2Ru6{1-oD!M + @@ -389,6 +390,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y + diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters index 55a4a2425445..69be11928724 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters @@ -364,6 +364,9 @@ {4fd79779-ff32-4400-aa05-af4fd7f0f4a0} + + {8c06b227-cf6c-4e4b-8312-94f834bdeeea} + {f7e74952-eece-467a-b27a-2e92db013997} @@ -951,6 +954,9 @@ Classes\MaterialSystemTest + + Classes\NavMeshTest + Classes\Scene3DTest @@ -1736,6 +1742,9 @@ Classes\MaterialSystemTest + + Classes\NavMeshTest + Classes\Scene3DTest diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 5f054a91719c..ec0ed41801ba 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -121,7 +121,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat Component::[serialize], EventListenerCustom::[init], EventListener::[init], - Scene::[getCameras getLights initWithPhysics createWithPhysics getPhysicsWorld getPhysics3DWorld setPhysics3DDebugCamera], + Scene::[getCameras getLights initWithPhysics createWithPhysics getPhysicsWorld getPhysics3DWorld setPhysics3DDebugCamera setNavMesh getNavMesh setNavMeshDebugCamera], Animate3D::[*], Sprite3D::[*], AttachNode::[*], diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 3a5c0900eb11..105dde77e92e 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -123,7 +123,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS TurnOffTiles::[shuffle], LabelTTF::[*], LabelBMFont::[*], - Scene::[getCameras getLights .*(Physics).*], + Scene::[getCameras getLights .*(Physics).* .*(NavMesh).*], Animate3D::[*], Sprite3D::[*], AttachNode::[*],