Merge pull request #12373 from samuele3hu/v3_navigation

Add the Lua bindings for NavMesh and the related test case.
This commit is contained in:
子龙山人 2015-06-17 11:36:52 +08:00
commit 0915565b8d
21 changed files with 1333 additions and 12 deletions

View File

@ -40,6 +40,7 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; }; 1502702D1AD3BDBC0089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; }; 1502702E1AD3BDC90089CD03 /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
150983E11B1C514B007F3818 /* NavMesh in Resources */ = {isa = PBXBuildFile; fileRef = B61E90CA1B12B74B00BE69EA /* NavMesh */; };
150F918819DA409E00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; }; 150F918819DA409E00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; };
150F918919DA409F00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; }; 150F918919DA409F00B89F57 /* lua_test_bindings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150F918619DA409E00B89F57 /* lua_test_bindings.cpp */; };
1531B2501AE013DE0075DB94 /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = 29AFEF6619ACCAA000F6B10A /* Test.html */; }; 1531B2501AE013DE0075DB94 /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = 29AFEF6619ACCAA000F6B10A /* Test.html */; };
@ -64,6 +65,7 @@
15B914491B15721400C6B95B /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; }; 15B914491B15721400C6B95B /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
15B9144A1B15A18C00C6B95B /* Materials in Resources */ = {isa = PBXBuildFile; fileRef = 5046AB5A1AF2C4180060550B /* Materials */; }; 15B9144A1B15A18C00C6B95B /* Materials in Resources */ = {isa = PBXBuildFile; fileRef = 5046AB5A1AF2C4180060550B /* Materials */; };
15B9144B1B15A18C00C6B95B /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; }; 15B9144B1B15A18C00C6B95B /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
15BF83C71B1D9E8900D518FA /* NavMesh in Resources */ = {isa = PBXBuildFile; fileRef = B61E90CA1B12B74B00BE69EA /* NavMesh */; };
15C64825165F3934007D4F18 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; }; 15C64825165F3934007D4F18 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; };
15C64827165F394E007D4F18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; }; 15C64827165F394E007D4F18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64826165F394E007D4F18 /* QuartzCore.framework */; };
15C64829165F396B007D4F18 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64828165F396B007D4F18 /* OpenAL.framework */; }; 15C64829165F396B007D4F18 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64828165F396B007D4F18 /* OpenAL.framework */; };
@ -4465,6 +4467,7 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
150983E11B1C514B007F3818 /* NavMesh in Resources */,
15B914491B15721400C6B95B /* Shaders3D in Resources */, 15B914491B15721400C6B95B /* Shaders3D in Resources */,
15B914481B156A3700C6B95B /* Materials in Resources */, 15B914481B156A3700C6B95B /* Materials in Resources */,
1531B2501AE013DE0075DB94 /* Test.html in Resources */, 1531B2501AE013DE0075DB94 /* Test.html in Resources */,
@ -4514,6 +4517,7 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
15BF83C71B1D9E8900D518FA /* NavMesh in Resources */,
15B9144A1B15A18C00C6B95B /* Materials in Resources */, 15B9144A1B15A18C00C6B95B /* Materials in Resources */,
15B9144B1B15A18C00C6B95B /* Shaders3D in Resources */, 15B9144B1B15A18C00C6B95B /* Shaders3D in Resources */,
1531B2511AE013F00075DB94 /* Test.html in Resources */, 1531B2511AE013F00075DB94 /* Test.html in Resources */,

View File

@ -19,11 +19,13 @@ include_directories(
${cocos_root}/cocos/platform ${cocos_root}/cocos/platform
${cocos_root}/cocos/audio/include ${cocos_root}/cocos/audio/include
${cocos_root}/cocos/physics3d ${cocos_root}/cocos/physics3d
${cocos_root}/cocos/navmesh
manual manual
manual/extension manual/extension
manual/cocostudio manual/cocostudio
manual/ui manual/ui
manual/cocos2d manual/cocos2d
manual/navmesh
auto auto
) )
@ -110,6 +112,8 @@ set(lua_bindings_manual_files
manual/video/lua_cocos2dx_experimental_video_manual.cpp manual/video/lua_cocos2dx_experimental_video_manual.cpp
manual/audioengine/lua_cocos2dx_audioengine_manual.cpp manual/audioengine/lua_cocos2dx_audioengine_manual.cpp
manual/physics3d/lua_cocos2dx_physics3d_manual.cpp manual/physics3d/lua_cocos2dx_physics3d_manual.cpp
manual/navmesh/lua_cocos2dx_navmesh_conversions.cpp
manual/navmesh/lua_cocos2dx_navmesh_manual.cpp
) )
set(lua_bindings_auto_files set(lua_bindings_auto_files
@ -128,6 +132,7 @@ set(lua_bindings_auto_files
auto/lua_cocos2dx_ui_auto.cpp auto/lua_cocos2dx_ui_auto.cpp
auto/lua_cocos2dx_audioengine_auto.cpp auto/lua_cocos2dx_audioengine_auto.cpp
auto/lua_cocos2dx_physics3d_auto.cpp auto/lua_cocos2dx_physics3d_auto.cpp
auto/lua_cocos2dx_navmesh_auto.cpp
) )
if(MACOSX) if(MACOSX)

View File

@ -2530,6 +2530,159 @@ tolua_lerror:
#endif //CC_USE_PHYSICS #endif //CC_USE_PHYSICS
#if CC_USE_NAVMESH
#include "navmesh/CCNavMesh.h"
int lua_cocos2dx_Scene_setNavMeshDebugCamera(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Scene* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Scene",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Scene*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Scene_setNavMeshDebugCamera'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Camera* arg0;
ok &= luaval_to_object<cocos2d::Camera>(tolua_S, 2, "cc.Camera",&arg0, "cc.Scene:setNavMeshDebugCamera");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Scene_setNavMeshDebugCamera'", nullptr);
return 0;
}
cobj->setNavMeshDebugCamera(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Scene:setNavMeshDebugCamera",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Scene_setNavMeshDebugCamera'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Scene_setNavMesh(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Scene* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Scene",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Scene*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Scene_setNavMesh'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::NavMesh* arg0;
ok &= luaval_to_object<cocos2d::NavMesh>(tolua_S, 2, "cc.NavMesh",&arg0, "cc.Scene:setNavMesh");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Scene_setNavMesh'", nullptr);
return 0;
}
cobj->setNavMesh(arg0);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Scene:setNavMesh",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Scene_setNavMesh'.",&tolua_err);
#endif
return 0;
}
int lua_cocos2dx_Scene_getNavMesh(lua_State* tolua_S)
{
int argc = 0;
cocos2d::Scene* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.Scene",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::Scene*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Scene_getNavMesh'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 0)
{
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Scene_getNavMesh'", nullptr);
return 0;
}
cocos2d::NavMesh* ret = cobj->getNavMesh();
object_to_luaval<cocos2d::NavMesh>(tolua_S, "cc.NavMesh",(cocos2d::NavMesh*)ret);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Scene:getNavMesh",argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Scene_getNavMesh'.",&tolua_err);
#endif
return 0;
}
#endif //#if CC_USE_NAVMESH
static int tolua_cocos2d_Spawn_create(lua_State* tolua_S) static int tolua_cocos2d_Spawn_create(lua_State* tolua_S)
{ {
if (NULL == tolua_S) if (NULL == tolua_S)
@ -4771,6 +4924,12 @@ static void extendScene(lua_State* tolua_S)
tolua_function(tolua_S, "getPhysics3DWorld", lua_cocos2dx_Scene_getPhysics3DWorld); tolua_function(tolua_S, "getPhysics3DWorld", lua_cocos2dx_Scene_getPhysics3DWorld);
tolua_function(tolua_S, "setPhysics3DDebugCamera", lua_cocos2dx_Scene_setPhysics3DDebugCamera); tolua_function(tolua_S, "setPhysics3DDebugCamera", lua_cocos2dx_Scene_setPhysics3DDebugCamera);
#endif #endif
#if CC_USE_NAVMESH
tolua_function(tolua_S, "setNavMeshDebugCamera", lua_cocos2dx_Scene_setNavMeshDebugCamera);
tolua_function(tolua_S, "setNavMesh", lua_cocos2dx_Scene_setNavMesh);
tolua_function(tolua_S, "getNavMesh", lua_cocos2dx_Scene_getNavMesh);
#endif
} }
lua_pop(tolua_S, 1); lua_pop(tolua_S, 1);
} }

View File

@ -0,0 +1,216 @@
/****************************************************************************
Copyright (c) 2013-2014 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 "lua_cocos2dx_navmesh_conversions.h"
#include "base/ccConfig.h"
#if CC_USE_NAVMESH
#include "LuaBasicConversions.h"
#include "navmesh/CCNavMeshAgent.h"
#if COCOS2D_DEBUG >=1
extern void luaval_to_native_err(lua_State* L,const char* msg,tolua_Error* err, const char* funcName);
#endif
bool luaval_to_navmeshagentparam(lua_State* L, int lo, cocos2d::NavMeshAgentParam* outValue , const char* funcName)
{
if (nullptr == L || nullptr == outValue)
return false;
bool ok = true;
tolua_Error tolua_err;
if (!tolua_istable(L, lo, 0, &tolua_err) )
{
#if COCOS2D_DEBUG >=1
luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
ok = false;
}
if (ok)
{
lua_pushstring(L, "radius");
lua_gettable(L,lo);
outValue->radius = lua_isnumber(L, -1)? (float)lua_tonumber(L, -1) : 0.6;
lua_pop(L,1);
lua_pushstring(L, "height");
lua_gettable(L,lo);
outValue->height = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 2.0;
lua_pop(L,1);
lua_pushstring(L, "maxAcceleration");
lua_gettable(L, lo);
outValue->maxAcceleration = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 8.0;
lua_pop(L, 1);
lua_pushstring(L, "maxSpeed");
lua_gettable(L, lo);
outValue->maxSpeed = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 3.5;
lua_pop(L, 1);
lua_pushstring(L, "collisionQueryRange");
lua_gettable(L, lo);
outValue->collisionQueryRange = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : outValue->radius * 12.0;
lua_pop(L, 1);
lua_pushstring(L, "pathOptimizationRange");
lua_gettable(L, lo);
outValue->pathOptimizationRange = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : outValue->radius * 30.0;
lua_pop(L, 1);
lua_pushstring(L, "separationWeight");
lua_gettable(L, lo);
outValue->separationWeight = lua_isnumber(L, -1)?(float)lua_tonumber(L, -1) : 2.0;
lua_pop(L, 1);
lua_pushstring(L, "updateFlags");
lua_gettable(L, lo);
outValue->updateFlags = lua_isnumber(L, -1)?(unsigned char)lua_tonumber(L, -1) : DT_CROWD_ANTICIPATE_TURNS | DT_CROWD_OPTIMIZE_VIS | DT_CROWD_OPTIMIZE_TOPO | DT_CROWD_OBSTACLE_AVOIDANCE;
lua_pop(L, 1);
lua_pushstring(L, "obstacleAvoidanceType");
lua_gettable(L, lo);
outValue->obstacleAvoidanceType = lua_isnumber(L, -1)?(unsigned char)lua_tonumber(L, -1) : 3;
lua_pop(L, 1);
lua_pushstring(L, "queryFilterType");
lua_gettable(L, lo);
outValue->queryFilterType = lua_isnumber(L, -1)?(unsigned char)lua_tonumber(L, -1) : 0;
lua_pop(L, 1);
return true;
}
return false;
}
bool luaval_to_offmeshlinkdata(lua_State* L, int lo, cocos2d::OffMeshLinkData* outValue , const char* funcName)
{
if (nullptr == L || nullptr == outValue)
return false;
bool ok = true;
tolua_Error tolua_err;
if (!tolua_istable(L, lo, 0, &tolua_err) )
{
#if COCOS2D_DEBUG >=1
luaval_to_native_err(L,"#ferror:",&tolua_err,funcName);
#endif
ok = false;
}
if (ok)
{
lua_pushstring(L, "startPosition");
lua_gettable(L,lo);
ok &= luaval_to_vec3(L, lua_gettop(L), &outValue->startPosition);
if(!ok)
{
lua_pop(L, 1);
return false;
}
lua_pop(L,1);
lua_pushstring(L, "endPosition");
ok &= luaval_to_vec3(L, lua_gettop(L), &outValue->endPosition);
if(!ok)
{
lua_pop(L, 1);
return false;
}
lua_pop(L,1);
return true;
}
return false;
}
void navmeshagentparam_to_luaval(lua_State* L,const cocos2d::NavMeshAgentParam& inValue)
{
if (nullptr == L)
return;
lua_newtable(L);
lua_pushstring(L, "radius");
lua_pushnumber(L, (lua_Number)inValue.radius);
lua_rawset(L, -3);
lua_pushstring(L, "height");
lua_pushnumber(L, (lua_Number)inValue.height);
lua_rawset(L, -3);
lua_pushstring(L, "maxAcceleration");
lua_pushnumber(L, (lua_Number)inValue.maxAcceleration);
lua_rawset(L, -3);
lua_pushstring(L, "maxSpeed");
lua_pushnumber(L, (lua_Number)inValue.maxSpeed);
lua_rawset(L, -3);
lua_pushstring(L, "collisionQueryRange");
lua_pushnumber(L, (lua_Number)inValue.collisionQueryRange);
lua_rawset(L, -3);
lua_pushstring(L, "pathOptimizationRange");
lua_pushnumber(L, (lua_Number)inValue.pathOptimizationRange);
lua_rawset(L, -3);
lua_pushstring(L, "separationWeight");
lua_pushnumber(L, (lua_Number)inValue.separationWeight);
lua_rawset(L, -3);
lua_pushstring(L, "updateFlags");
lua_pushnumber(L, (lua_Number)inValue.updateFlags);
lua_rawset(L, -3);
lua_pushstring(L, "obstacleAvoidanceType");
lua_pushnumber(L, (lua_Number)inValue.obstacleAvoidanceType);
lua_rawset(L, -3);
lua_pushstring(L, "queryFilterType");
lua_pushnumber(L, (lua_Number)inValue.queryFilterType);
lua_rawset(L, -3);
}
void offmeshlinkdata_to_luaval(lua_State* L,const cocos2d::OffMeshLinkData& inValue)
{
if (nullptr == L)
return;
lua_newtable(L);
lua_pushstring(L, "startPosition");
vec3_to_luaval(L, inValue.startPosition);
lua_rawset(L, -3);
lua_pushstring(L, "endPosition");
vec3_to_luaval(L, inValue.endPosition);
lua_rawset(L, -3);
}
#endif

View File

@ -0,0 +1,50 @@
/****************************************************************************
Copyright (c) 2013-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 __COCOS_SCRIPTING_LUA_BINDING_MANUAL_NAVMESH_LUA_NAVMESH_CONVERSIONS_H__
#define __COCOS_SCRIPTING_LUA_BINDING_MANUAL_NAVMESH_LUA_NAVMESH_CONVERSIONS_H__
#if CC_USE_NAVMESH
extern "C" {
#include "lua.h"
#include "tolua++.h"
}
#include "tolua_fix.h"
namespace cocos2d
{
struct NavMeshAgentParam;
struct OffMeshLinkData;
}
extern bool luaval_to_navmeshagentparam(lua_State* L, int lo, cocos2d::NavMeshAgentParam* outValue , const char* funcName = "");
extern bool luaval_to_offmeshlinkdata(lua_State* L, int lo, cocos2d::OffMeshLinkData* outValue , const char* funcName = "");
extern void navmeshagentparam_to_luaval(lua_State* L,const cocos2d::NavMeshAgentParam& inValue);
extern void offmeshlinkdata_to_luaval(lua_State* L,const cocos2d::OffMeshLinkData& inValue);
#endif // #if CC_USE_NAVMESH
#endif // __COCOS_SCRIPTING_LUA_BINDING_MANUAL_NAVMESH_LUA_NAVMESH_CONVERSIONS_H__

View File

@ -0,0 +1,148 @@
/****************************************************************************
Copyright (c) 2014 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 "platform/CCPlatformConfig.h"
#include "base/ccConfig.h"
#if CC_USE_NAVMESH
#include "lua_cocos2dx_navmesh_manual.h"
#include "lua_cocos2dx_navmesh_auto.hpp"
#include "tolua_fix.h"
#include "LuaBasicConversions.h"
#include "CCLuaEngine.h"
#include "navmesh/CCNavMesh.h"
int lua_cocos2dx_navmesh_NavMeshAgent_move(lua_State* tolua_S)
{
int argc = 0;
cocos2d::NavMeshAgent* cobj = nullptr;
bool ok = true;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if COCOS2D_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"cc.NavMeshAgent",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (cocos2d::NavMeshAgent*)tolua_tousertype(tolua_S,1,0);
#if COCOS2D_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_navmesh_NavMeshAgent_move'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
if (argc == 1)
{
cocos2d::Vec3 arg0;
ok &= luaval_to_vec3(tolua_S, 2, &arg0, "cc.NavMeshAgent:move");
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_navmesh_NavMeshAgent_move'", nullptr);
return 0;
}
cobj->move(arg0);
lua_settop(tolua_S, 1);
return 1;
}
if (argc == 2)
{
cocos2d::Vec3 arg0;
LUA_FUNCTION handler;
ok &= luaval_to_vec3(tolua_S, 2, &arg0, "cc.NavMeshAgent:move");
#if COCOS2D_DEBUG >= 1
if (!toluafix_isfunction(tolua_S,3,"LUA_FUNCTION",0,&tolua_err)) {
goto tolua_lerror;
}
#endif
handler = toluafix_ref_function(tolua_S, 3, 0);
if(!ok)
{
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_navmesh_NavMeshAgent_move'", nullptr);
return 0;
}
cobj->move(arg0, [=](cocos2d::NavMeshAgent *agent, float totalTimeAfterMove){
object_to_luaval<cocos2d::NavMeshAgent>(tolua_S, "cc.NavMeshAgent",(cocos2d::NavMeshAgent*)agent);
tolua_pushnumber(tolua_S, (lua_Number)totalTimeAfterMove);
LuaEngine::getInstance()->getLuaStack()->executeFunctionByHandler(handler, 2);
});
ScriptHandlerMgr::getInstance()->addCustomHandler((void*)cobj, handler);
lua_settop(tolua_S, 1);
return 1;
}
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.NavMeshAgent:move",argc, 1);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_navmesh_NavMeshAgent_move'.",&tolua_err);
#endif
return 0;
}
static void extendNavMeshAgent(lua_State* L)
{
lua_pushstring(L, "cc.NavMeshAgent");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-1))
{
tolua_function(L, "move", lua_cocos2dx_navmesh_NavMeshAgent_move);
}
lua_pop(L, 1);
}
static int register_all_navmesh_manual(lua_State* L)
{
if (nullptr == L)
return 0;
extendNavMeshAgent(L);
return 1;
}
int register_navmesh_module(lua_State* L)
{
lua_getglobal(L, "_G");
if (lua_istable(L,-1))//stack:...,_G,
{
register_all_cocos2dx_navmesh(L);
register_all_navmesh_manual(L);
}
lua_pop(L, 1);
return 1;
}
#endif

View File

@ -0,0 +1,57 @@
/****************************************************************************
Copyright (c) 2014 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 COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_PHYSICS3D_LUA_COCOS2DX_NAVMESH_MANUAL_H__
#define COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_PHYSICS3D_LUA_COCOS2DX_NAVMESH_MANUAL_H__
#if CC_USE_NAVMESH
#ifdef __cplusplus
extern "C" {
#endif
#include "tolua++.h"
#ifdef __cplusplus
}
#endif
/**
* @addtogroup lua
* @{
*/
/**
* Call this function can import the lua bindings for the navmesh module.
* After registering, we could call the related navmesh code conveniently in the lua.
* If you don't want to use the navmesh module in the lua, you only don't call this registering function.
* If you don't register the navmesh module, the package size would become smaller .
* The current mechanism,this function is called in the lua_module_register.h
*/
TOLUA_API int register_navmesh_module(lua_State* L);
// end group
/// @}
#endif // #if CC_USE_NAVMESH
#endif // #ifndef COCOS_SCRIPTING_LUA_BINDINGS_MANUAL_PHYSICS3D_LUA_COCOS2DX_NAVMESH_MANUAL_H__

View File

@ -120,6 +120,11 @@ LOCAL_SRC_FILES += ../manual/extension/lua_cocos2dx_extension_manual.cpp \
LOCAL_SRC_FILES += ../manual/physics3d/lua_cocos2dx_physics3d_manual.cpp \ LOCAL_SRC_FILES += ../manual/physics3d/lua_cocos2dx_physics3d_manual.cpp \
../auto/lua_cocos2dx_physics3d_auto.cpp \ ../auto/lua_cocos2dx_physics3d_auto.cpp \
#navmesh
LOCAL_SRC_FILES += ../manual/navmesh/lua_cocos2dx_navmesh_conversions.cpp \
../manual/navmesh/lua_cocos2dx_navmesh_manual.cpp \
../auto/lua_cocos2dx_navmesh_auto.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../../../../external/lua/luajit/include \ $(LOCAL_PATH)/../../../../external/lua/luajit/include \
$(LOCAL_PATH)/../../../2d \ $(LOCAL_PATH)/../../../2d \
@ -131,6 +136,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../../../editor-support/spine \ $(LOCAL_PATH)/../../../editor-support/spine \
$(LOCAL_PATH)/../../../ui \ $(LOCAL_PATH)/../../../ui \
$(LOCAL_PATH)/../../../physics3d \ $(LOCAL_PATH)/../../../physics3d \
$(LOCAL_PATH)/../../../navmesh \
$(LOCAL_PATH)/../../../../extensions \ $(LOCAL_PATH)/../../../../extensions \
$(LOCAL_PATH)/../auto \ $(LOCAL_PATH)/../auto \
$(LOCAL_PATH)/../manual \ $(LOCAL_PATH)/../manual \
@ -144,6 +150,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../manual/cocosbuilder \ $(LOCAL_PATH)/../manual/cocosbuilder \
$(LOCAL_PATH)/../manual/spine \ $(LOCAL_PATH)/../manual/spine \
$(LOCAL_PATH)/../manual/ui \ $(LOCAL_PATH)/../manual/ui \
$(LOCAL_PATH)/../manual/navmesh \
$(LOCAL_PATH)/../../../../external/xxtea \ $(LOCAL_PATH)/../../../../external/xxtea \
$(LOCAL_PATH)/../../../.. \ $(LOCAL_PATH)/../../../.. \
$(LOCAL_PATH)/../../../../external/lua $(LOCAL_PATH)/../../../../external/lua
@ -162,6 +169,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../external/lua/tolua \
$(LOCAL_PATH)/../manual/spine \ $(LOCAL_PATH)/../manual/spine \
$(LOCAL_PATH)/../manual/extension \ $(LOCAL_PATH)/../manual/extension \
$(LOCAL_PATH)/../manual/ui \ $(LOCAL_PATH)/../manual/ui \
$(LOCAL_PATH)/../manual/navmesh \
$(LOCAL_PATH)/../../../.. $(LOCAL_PATH)/../../../..
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_android_static LOCAL_WHOLE_STATIC_LIBRARIES := cocos2d_lua_android_static

View File

@ -11,6 +11,18 @@
150906F119D556C8002C4D97 /* lua_cocos2dx_audioengine_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDB0419C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.hpp */; }; 150906F119D556C8002C4D97 /* lua_cocos2dx_audioengine_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDB0419C5E5FE0055CDCD /* lua_cocos2dx_audioengine_auto.hpp */; };
150906F219D556CE002C4D97 /* lua_cocos2dx_audioengine_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0819C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.cpp */; }; 150906F219D556CE002C4D97 /* lua_cocos2dx_audioengine_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E2BDB0819C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.cpp */; };
150906F319D556D1002C4D97 /* lua_cocos2dx_audioengine_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDB0919C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.h */; }; 150906F319D556D1002C4D97 /* lua_cocos2dx_audioengine_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E2BDB0919C5E6100055CDCD /* lua_cocos2dx_audioengine_manual.h */; };
150983D01B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150983CE1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp */; };
150983D11B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150983CE1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp */; };
150983D21B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 150983CF1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp */; };
150983D31B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 150983CF1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp */; };
150983D71B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150983D51B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp */; };
150983D81B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150983D51B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp */; };
150983D91B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 150983D61B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h */; };
150983DA1B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h in Headers */ = {isa = PBXBuildFile; fileRef = 150983D61B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h */; };
150983DD1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150983DB1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp */; };
150983DE1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 150983DB1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp */; };
150983DF1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150983DC1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h */; };
150983E01B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = 150983DC1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h */; };
15415A7019A71768004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74C18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp */; }; 15415A7019A71768004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74C18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp */; };
15415A7119A71782004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74C18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp */; }; 15415A7119A71782004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE74C18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp */; };
15415A7219A718FB004F1E71 /* lua_cocos2dx_3d_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1516227F19A0F3E3006099B8 /* lua_cocos2dx_3d_auto.cpp */; }; 15415A7219A718FB004F1E71 /* lua_cocos2dx_3d_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1516227F19A0F3E3006099B8 /* lua_cocos2dx_3d_auto.cpp */; };
@ -278,6 +290,12 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
150983CE1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_navmesh_auto.cpp; sourceTree = "<group>"; };
150983CF1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_navmesh_auto.hpp; sourceTree = "<group>"; };
150983D51B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lua_cocos2dx_navmesh_manual.cpp; path = navmesh/lua_cocos2dx_navmesh_manual.cpp; sourceTree = "<group>"; };
150983D61B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_cocos2dx_navmesh_manual.h; path = navmesh/lua_cocos2dx_navmesh_manual.h; sourceTree = "<group>"; };
150983DB1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lua_cocos2dx_navmesh_conversions.cpp; path = navmesh/lua_cocos2dx_navmesh_conversions.cpp; sourceTree = "<group>"; };
150983DC1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lua_cocos2dx_navmesh_conversions.h; path = navmesh/lua_cocos2dx_navmesh_conversions.h; sourceTree = "<group>"; };
1516227F19A0F3E3006099B8 /* lua_cocos2dx_3d_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_3d_auto.cpp; sourceTree = "<group>"; }; 1516227F19A0F3E3006099B8 /* lua_cocos2dx_3d_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lua_cocos2dx_3d_auto.cpp; sourceTree = "<group>"; };
1516228019A0F3E3006099B8 /* lua_cocos2dx_3d_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_3d_auto.hpp; sourceTree = "<group>"; }; 1516228019A0F3E3006099B8 /* lua_cocos2dx_3d_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = lua_cocos2dx_3d_auto.hpp; sourceTree = "<group>"; };
1540AF55193EC30500717D8E /* xxtea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xxtea.cpp; sourceTree = "<group>"; }; 1540AF55193EC30500717D8E /* xxtea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xxtea.cpp; sourceTree = "<group>"; };
@ -448,6 +466,17 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
150983D41B1C3F2D007F3818 /* navmesh */ = {
isa = PBXGroup;
children = (
150983DB1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp */,
150983DC1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h */,
150983D51B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp */,
150983D61B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h */,
);
name = navmesh;
sourceTree = "<group>";
};
1540AF54193EC30500717D8E /* xxtea */ = { 1540AF54193EC30500717D8E /* xxtea */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -593,6 +622,8 @@
1AACE74818BC45C200215002 /* auto */ = { 1AACE74818BC45C200215002 /* auto */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
150983CE1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp */,
150983CF1B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp */,
15A561E31B00A09A005D4720 /* lua_cocos2dx_physics3d_auto.cpp */, 15A561E31B00A09A005D4720 /* lua_cocos2dx_physics3d_auto.cpp */,
15A561E41B00A09A005D4720 /* lua_cocos2dx_physics3d_auto.hpp */, 15A561E41B00A09A005D4720 /* lua_cocos2dx_physics3d_auto.hpp */,
15C9A10C1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp */, 15C9A10C1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp */,
@ -631,6 +662,7 @@
1AACE75B18BC45C200215002 /* manual */ = { 1AACE75B18BC45C200215002 /* manual */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
150983D41B1C3F2D007F3818 /* navmesh */,
15A561E91B00A3D0005D4720 /* physics3d */, 15A561E91B00A3D0005D4720 /* physics3d */,
3E2BDB0719C5E6100055CDCD /* audioengine */, 3E2BDB0719C5E6100055CDCD /* audioengine */,
158C128419A0FA1300781A76 /* 3d */, 158C128419A0FA1300781A76 /* 3d */,
@ -839,8 +871,10 @@
15C1C2ED19874CBE00A46ACC /* CCLuaObjcBridge.h in Headers */, 15C1C2ED19874CBE00A46ACC /* CCLuaObjcBridge.h in Headers */,
15C1C2EE19874CBE00A46ACC /* tolua_fix.h in Headers */, 15C1C2EE19874CBE00A46ACC /* tolua_fix.h in Headers */,
155C7E2019A71CCC00F08B25 /* LuaSkeletonAnimation.h in Headers */, 155C7E2019A71CCC00F08B25 /* LuaSkeletonAnimation.h in Headers */,
150983D91B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h in Headers */,
1595523C1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp in Headers */, 1595523C1A25E1C5001E9FC9 /* lua_cocos2dx_csloader_auto.hpp in Headers */,
15415AB719A71A53004F1E71 /* io.h in Headers */, 15415AB719A71A53004F1E71 /* io.h in Headers */,
150983DF1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h in Headers */,
566F016119B5EB0F00FCA620 /* CustomGUIReader.h in Headers */, 566F016119B5EB0F00FCA620 /* CustomGUIReader.h in Headers */,
15C1C2DC19874B4400A46ACC /* xxtea.h in Headers */, 15C1C2DC19874B4400A46ACC /* xxtea.h in Headers */,
15415AD319A71A53004F1E71 /* timeout.h in Headers */, 15415AD319A71A53004F1E71 /* timeout.h in Headers */,
@ -852,6 +886,7 @@
15C1C2D8198749BC00A46ACC /* lua_cocos2dx_manual.hpp in Headers */, 15C1C2D8198749BC00A46ACC /* lua_cocos2dx_manual.hpp in Headers */,
155C7E0819A71C7B00F08B25 /* lua_cocos2dx_extension_manual.h in Headers */, 155C7E0819A71C7B00F08B25 /* lua_cocos2dx_extension_manual.h in Headers */,
155C7E1819A71CB300F08B25 /* lua_xml_http_request.h in Headers */, 155C7E1819A71CB300F08B25 /* lua_xml_http_request.h in Headers */,
150983D21B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp in Headers */,
155C7DFC19A71C5300F08B25 /* lua_cocos2dx_coco_studio_manual.hpp in Headers */, 155C7DFC19A71C5300F08B25 /* lua_cocos2dx_coco_studio_manual.hpp in Headers */,
15C1C2D9198749BC00A46ACC /* lua_cocos2dx_physics_manual.hpp in Headers */, 15C1C2D9198749BC00A46ACC /* lua_cocos2dx_physics_manual.hpp in Headers */,
15C1C2DA198749BC00A46ACC /* LuaScriptHandlerMgr.h in Headers */, 15C1C2DA198749BC00A46ACC /* LuaScriptHandlerMgr.h in Headers */,
@ -869,6 +904,7 @@
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
150983E01B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.h in Headers */,
15EFA64D198B3342000C57D3 /* lauxlib.h in Headers */, 15EFA64D198B3342000C57D3 /* lauxlib.h in Headers */,
15415AA819A71A53004F1E71 /* auxiliar.h in Headers */, 15415AA819A71A53004F1E71 /* auxiliar.h in Headers */,
155C7E1119A71C9F00F08B25 /* lua_extensions.h in Headers */, 155C7E1119A71C9F00F08B25 /* lua_extensions.h in Headers */,
@ -904,6 +940,7 @@
155C7E0D19A71C9300F08B25 /* lua_cocos2dx_network_manual.h in Headers */, 155C7E0D19A71C9300F08B25 /* lua_cocos2dx_network_manual.h in Headers */,
15EFA63F198B32BB000C57D3 /* Cocos2dxLuaLoader.h in Headers */, 15EFA63F198B32BB000C57D3 /* Cocos2dxLuaLoader.h in Headers */,
15EFA640198B32BB000C57D3 /* LuaBasicConversions.h in Headers */, 15EFA640198B32BB000C57D3 /* LuaBasicConversions.h in Headers */,
150983D31B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.hpp in Headers */,
15415AB419A71A53004F1E71 /* inet.h in Headers */, 15415AB419A71A53004F1E71 /* inet.h in Headers */,
15EFA641198B32BB000C57D3 /* CCLuaObjcBridge.h in Headers */, 15EFA641198B32BB000C57D3 /* CCLuaObjcBridge.h in Headers */,
15EFA642198B32BB000C57D3 /* tolua_fix.h in Headers */, 15EFA642198B32BB000C57D3 /* tolua_fix.h in Headers */,
@ -919,6 +956,7 @@
15C9A1131AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp in Headers */, 15C9A1131AE4973400C15443 /* lua_cocos2dx_experimental_webview_manual.hpp in Headers */,
15EFA62E198B3220000C57D3 /* lua_cocos2dx_manual.hpp in Headers */, 15EFA62E198B3220000C57D3 /* lua_cocos2dx_manual.hpp in Headers */,
15C9A10F1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp in Headers */, 15C9A10F1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.hpp in Headers */,
150983DA1B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.h in Headers */,
15EFA62F198B3220000C57D3 /* lua_cocos2dx_physics_manual.hpp in Headers */, 15EFA62F198B3220000C57D3 /* lua_cocos2dx_physics_manual.hpp in Headers */,
155C7E0919A71C8500F08B25 /* lua_cocos2dx_extension_manual.h in Headers */, 155C7E0919A71C8500F08B25 /* lua_cocos2dx_extension_manual.h in Headers */,
155C7E1919A71CB500F08B25 /* lua_xml_http_request.h in Headers */, 155C7E1919A71CB500F08B25 /* lua_xml_http_request.h in Headers */,
@ -1009,6 +1047,7 @@
15415A7319A718FB004F1E71 /* lua_cocos2dx_cocosbuilder_auto.cpp in Sources */, 15415A7319A718FB004F1E71 /* lua_cocos2dx_cocosbuilder_auto.cpp in Sources */,
150906F219D556CE002C4D97 /* lua_cocos2dx_audioengine_manual.cpp in Sources */, 150906F219D556CE002C4D97 /* lua_cocos2dx_audioengine_manual.cpp in Sources */,
15415A7519A718FB004F1E71 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */, 15415A7519A718FB004F1E71 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */,
150983DD1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp in Sources */,
15B5754F1A6F4D1500041C20 /* lua-cocos-studio-conversions.cpp in Sources */, 15B5754F1A6F4D1500041C20 /* lua-cocos-studio-conversions.cpp in Sources */,
15415A7619A718FB004F1E71 /* lua_cocos2dx_ui_auto.cpp in Sources */, 15415A7619A718FB004F1E71 /* lua_cocos2dx_ui_auto.cpp in Sources */,
15415A7719A718FB004F1E71 /* lua_cocos2dx_spine_auto.cpp in Sources */, 15415A7719A718FB004F1E71 /* lua_cocos2dx_spine_auto.cpp in Sources */,
@ -1020,6 +1059,7 @@
15415ACD19A71A53004F1E71 /* tcp.c in Sources */, 15415ACD19A71A53004F1E71 /* tcp.c in Sources */,
15AC69DB1987710400D17520 /* tolua_map.c in Sources */, 15AC69DB1987710400D17520 /* tolua_map.c in Sources */,
15415AD519A71A53004F1E71 /* udp.c in Sources */, 15415AD519A71A53004F1E71 /* udp.c in Sources */,
150983D01B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp in Sources */,
15415ADD19A71A53004F1E71 /* usocket.c in Sources */, 15415ADD19A71A53004F1E71 /* usocket.c in Sources */,
15AC69DC1987710400D17520 /* tolua_push.c in Sources */, 15AC69DC1987710400D17520 /* tolua_push.c in Sources */,
15AC69DD1987710400D17520 /* tolua_to.c in Sources */, 15AC69DD1987710400D17520 /* tolua_to.c in Sources */,
@ -1060,6 +1100,7 @@
155C7E2219A71CD300F08B25 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */, 155C7E2219A71CD300F08B25 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */,
155C7DFA19A71C4C00F08B25 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */, 155C7DFA19A71C4C00F08B25 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */,
155C7E2619A71CDD00F08B25 /* lua_cocos2dx_ui_manual.cpp in Sources */, 155C7E2619A71CDD00F08B25 /* lua_cocos2dx_ui_manual.cpp in Sources */,
150983D71B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp in Sources */,
15415A7019A71768004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */, 15415A7019A71768004F1E71 /* lua_cocos2dx_extension_auto.cpp in Sources */,
155C7DF619A71C3E00F08B25 /* lua_cocos2dx_cocosdenshion_manual.cpp in Sources */, 155C7DF619A71C3E00F08B25 /* lua_cocos2dx_cocosdenshion_manual.cpp in Sources */,
15415AA519A71A53004F1E71 /* auxiliar.c in Sources */, 15415AA519A71A53004F1E71 /* auxiliar.c in Sources */,
@ -1094,12 +1135,14 @@
15415AC219A71A53004F1E71 /* options.c in Sources */, 15415AC219A71A53004F1E71 /* options.c in Sources */,
15EFA645198B32DB000C57D3 /* xxtea.cpp in Sources */, 15EFA645198B32DB000C57D3 /* xxtea.cpp in Sources */,
15EFA632198B328B000C57D3 /* CCLuaBridge.cpp in Sources */, 15EFA632198B328B000C57D3 /* CCLuaBridge.cpp in Sources */,
150983D11B1C0554007F3818 /* lua_cocos2dx_navmesh_auto.cpp in Sources */,
15EFA633198B328B000C57D3 /* CCLuaEngine.cpp in Sources */, 15EFA633198B328B000C57D3 /* CCLuaEngine.cpp in Sources */,
155C7DEE19A71BFC00F08B25 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */, 155C7DEE19A71BFC00F08B25 /* lua_cocos2dx_experimental_video_auto.cpp in Sources */,
15EFA634198B328B000C57D3 /* CCLuaStack.cpp in Sources */, 15EFA634198B328B000C57D3 /* CCLuaStack.cpp in Sources */,
15EFA635198B328B000C57D3 /* CCLuaValue.cpp in Sources */, 15EFA635198B328B000C57D3 /* CCLuaValue.cpp in Sources */,
15EFA636198B328B000C57D3 /* Cocos2dxLuaLoader.cpp in Sources */, 15EFA636198B328B000C57D3 /* Cocos2dxLuaLoader.cpp in Sources */,
155C7DEB19A71BE900F08B25 /* lua_cocos2dx_cocosbuilder_auto.cpp in Sources */, 155C7DEB19A71BE900F08B25 /* lua_cocos2dx_cocosbuilder_auto.cpp in Sources */,
150983DE1B1C4860007F3818 /* lua_cocos2dx_navmesh_conversions.cpp in Sources */,
15EFA637198B328B000C57D3 /* LuaBasicConversions.cpp in Sources */, 15EFA637198B328B000C57D3 /* LuaBasicConversions.cpp in Sources */,
15EFA638198B328B000C57D3 /* CCLuaObjcBridge.mm in Sources */, 15EFA638198B328B000C57D3 /* CCLuaObjcBridge.mm in Sources */,
155C7E1719A71CAF00F08B25 /* lua_xml_http_request.cpp in Sources */, 155C7E1719A71CAF00F08B25 /* lua_xml_http_request.cpp in Sources */,
@ -1137,6 +1180,7 @@
15C9A10E1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp in Sources */, 15C9A10E1AE4972500C15443 /* lua_cocos2dx_experimental_webview_auto.cpp in Sources */,
15415AAA19A71A53004F1E71 /* buffer.c in Sources */, 15415AAA19A71A53004F1E71 /* buffer.c in Sources */,
155C7E2319A71CD500F08B25 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */, 155C7E2319A71CD500F08B25 /* lua_cocos2dx_experimental_video_manual.cpp in Sources */,
150983D81B1C3F3E007F3818 /* lua_cocos2dx_navmesh_manual.cpp in Sources */,
155C7DFB19A71C4E00F08B25 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */, 155C7DFB19A71C4E00F08B25 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */,
155C7E2719A71CDE00F08B25 /* lua_cocos2dx_ui_manual.cpp in Sources */, 155C7E2719A71CDE00F08B25 /* lua_cocos2dx_ui_manual.cpp in Sources */,
15415AB619A71A53004F1E71 /* io.c in Sources */, 15415AB619A71A53004F1E71 /* io.c in Sources */,
@ -1192,7 +1236,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx; SDKROOT = macosx;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../3d $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua $(SRCROOT)/../../../editor-support/cocostudio/ActionTimeline $(SRCROOT)/../../../physics3d"; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../3d $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua $(SRCROOT)/../../../editor-support/cocostudio/ActionTimeline $(SRCROOT)/../../../physics3d $(SRCROOT)/../../../navmesh";
}; };
name = Debug; name = Debug;
}; };
@ -1226,7 +1270,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx; SDKROOT = macosx;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../3d $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua $(SRCROOT)/../../../editor-support/cocostudio/ActionTimeline $(SRCROOT)/../../../physics3d"; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../3d $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua $(SRCROOT)/../../../editor-support/cocostudio/ActionTimeline $(SRCROOT)/../../../physics3d $(SRCROOT)/../../../navmesh";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
}; };
name = Release; name = Release;

View File

@ -41,6 +41,7 @@
<ClCompile Include="..\auto\lua_cocos2dx_experimental_video_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_experimental_video_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_experimental_webview_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_experimental_webview_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_extension_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_extension_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_navmesh_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_physics3d_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_physics3d_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_physics_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_physics_auto.cpp" />
<ClCompile Include="..\auto\lua_cocos2dx_spine_auto.cpp" /> <ClCompile Include="..\auto\lua_cocos2dx_spine_auto.cpp" />
@ -68,6 +69,8 @@
<ClCompile Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.cpp" /> <ClCompile Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.cpp" />
<ClCompile Include="..\manual\extension\lua_cocos2dx_extension_manual.cpp" /> <ClCompile Include="..\manual\extension\lua_cocos2dx_extension_manual.cpp" />
<ClCompile Include="..\manual\LuaBasicConversions.cpp" /> <ClCompile Include="..\manual\LuaBasicConversions.cpp" />
<ClCompile Include="..\manual\navmesh\lua_cocos2dx_navmesh_conversions.cpp" />
<ClCompile Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.cpp" />
<ClCompile Include="..\manual\network\lua_cocos2dx_network_manual.cpp" /> <ClCompile Include="..\manual\network\lua_cocos2dx_network_manual.cpp" />
<ClCompile Include="..\manual\network\lua_extensions.c" /> <ClCompile Include="..\manual\network\lua_extensions.c" />
<ClCompile Include="..\manual\network\Lua_web_socket.cpp" /> <ClCompile Include="..\manual\network\Lua_web_socket.cpp" />
@ -113,6 +116,7 @@
<ClInclude Include="..\auto\lua_cocos2dx_experimental_video_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_experimental_video_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_experimental_webview_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_experimental_webview_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_extension_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_extension_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_navmesh_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_physics3d_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_physics3d_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_physics_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_physics_auto.hpp" />
<ClInclude Include="..\auto\lua_cocos2dx_spine_auto.hpp" /> <ClInclude Include="..\auto\lua_cocos2dx_spine_auto.hpp" />
@ -140,6 +144,8 @@
<ClInclude Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.hpp" /> <ClInclude Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.hpp" />
<ClInclude Include="..\manual\extension\lua_cocos2dx_extension_manual.h" /> <ClInclude Include="..\manual\extension\lua_cocos2dx_extension_manual.h" />
<ClInclude Include="..\manual\LuaBasicConversions.h" /> <ClInclude Include="..\manual\LuaBasicConversions.h" />
<ClInclude Include="..\manual\navmesh\lua_cocos2dx_navmesh_conversions.h" />
<ClInclude Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.h" />
<ClInclude Include="..\manual\network\lua_cocos2dx_network_manual.h" /> <ClInclude Include="..\manual\network\lua_cocos2dx_network_manual.h" />
<ClInclude Include="..\manual\network\lua_extensions.h" /> <ClInclude Include="..\manual\network\lua_extensions.h" />
<ClInclude Include="..\manual\network\Lua_web_socket.h" /> <ClInclude Include="..\manual\network\Lua_web_socket.h" />
@ -273,7 +279,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\2d;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\ui;$(EngineRoot)external;$(EngineRoot)external\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\2d;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\navmesh;$(EngineRoot)external;$(EngineRoot)external\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)cocos\scripting\lua-bindings\manual\navmesh;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -305,7 +311,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$
<ClCompile> <ClCompile>
<Optimization>MinSpace</Optimization> <Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\physics3d;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)cocos\scripting\lua-bindings\manual\navmesh;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -76,6 +76,9 @@
<Filter Include="manual\physics3d"> <Filter Include="manual\physics3d">
<UniqueIdentifier>{3934b26e-18b0-465a-a89e-69a3417d107e}</UniqueIdentifier> <UniqueIdentifier>{3934b26e-18b0-465a-a89e-69a3417d107e}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="manual\navmesh">
<UniqueIdentifier>{fa8be49e-8b79-4dc5-8f28-febde1347eda}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\auto\lua_cocos2dx_auto.cpp"> <ClCompile Include="..\auto\lua_cocos2dx_auto.cpp">
@ -282,6 +285,15 @@
<ClCompile Include="..\manual\physics3d\lua_cocos2dx_physics3d_manual.cpp"> <ClCompile Include="..\manual\physics3d\lua_cocos2dx_physics3d_manual.cpp">
<Filter>manual\physics3d</Filter> <Filter>manual\physics3d</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\auto\lua_cocos2dx_navmesh_auto.cpp">
<Filter>auto</Filter>
</ClCompile>
<ClCompile Include="..\manual\navmesh\lua_cocos2dx_navmesh_conversions.cpp">
<Filter>manual\navmesh</Filter>
</ClCompile>
<ClCompile Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.cpp">
<Filter>manual\navmesh</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp"> <ClInclude Include="..\auto\lua_cocos2dx_auto.hpp">
@ -494,6 +506,15 @@
<ClInclude Include="..\manual\physics3d\lua_cocos2dx_physics3d_manual.h"> <ClInclude Include="..\manual\physics3d\lua_cocos2dx_physics3d_manual.h">
<Filter>manual\physics3d</Filter> <Filter>manual\physics3d</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\auto\lua_cocos2dx_navmesh_auto.hpp">
<Filter>auto</Filter>
</ClInclude>
<ClInclude Include="..\manual\navmesh\lua_cocos2dx_navmesh_conversions.h">
<Filter>manual\navmesh</Filter>
</ClInclude>
<ClInclude Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.h">
<Filter>manual\navmesh</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\script\CCBReaderLoad.lua"> <None Include="..\script\CCBReaderLoad.lua">

View File

@ -11,6 +11,7 @@
#include "3d/lua_cocos2dx_3d_manual.h" #include "3d/lua_cocos2dx_3d_manual.h"
#include "audioengine/lua_cocos2dx_audioengine_manual.h" #include "audioengine/lua_cocos2dx_audioengine_manual.h"
#include "physics3d/lua_cocos2dx_physics3d_manual.h" #include "physics3d/lua_cocos2dx_physics3d_manual.h"
#include "navmesh/lua_cocos2dx_navmesh_manual.h"
int lua_module_register(lua_State* L) int lua_module_register(lua_State* L)
@ -28,6 +29,10 @@ int lua_module_register(lua_State* L)
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
register_physics3d_module(L); register_physics3d_module(L);
#endif #endif
#if CC_USE_NAVMESH
register_navmesh_module(L);
#endif
return 1; return 1;
} }

View File

@ -160,18 +160,25 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
</DllDataFileName> </DllDataFileName>
</Midl> </Midl>
<PreBuildEvent> <PreBuildEvent>
<Command>xcopy "$(ProjectDir)..\..\res" "$(OutDir)res" /D /E /I /F /Y <Command>
xcopy "$(ProjectDir)..\..\src" "$(OutDir)src" /D /E /I /F /Y </Command>
xcopy "$(ProjectDir)..\..\..\..\tests\cpp-tests\Resources" "$(OutDir)res" /D /E /I /F /Y
xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)src\cocos" /D /E /I /F /Y
xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\script" "$(OutDir)script" /D /E /I /F /Y
xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
<Message>copy files</Message> <Message>copy files</Message>
</PreBuildEvent> </PreBuildEvent>
<PreLinkEvent> <PreLinkEvent>
<Command> <Command>
</Command> </Command>
</PreLinkEvent> </PreLinkEvent>
<CustomBuildStep>
<Command>xcopy "$(ProjectDir)..\..\res" "$(OutDir)res" /D /E /I /F /Y
xcopy "$(ProjectDir)..\..\src" "$(OutDir)src" /D /E /I /F /Y
xcopy "$(ProjectDir)..\..\..\..\tests\cpp-tests\Resources" "$(OutDir)res" /D /E /I /F /Y
xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)src\cocos" /D /E /I /F /Y
xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\script" "$(OutDir)script" /D /E /I /F /Y
xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>xxx.txt</Outputs>
</CustomBuildStep>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\Classes\AppDelegate.h" /> <ClInclude Include="..\Classes\AppDelegate.h" />

View File

@ -0,0 +1,445 @@
local AgentUserData =
{
time = 0
}
local function jump(v1, v2, height, t)
local out = {}
out.x = v1.x + t * (v2.x - v1.x)
out.y = v1.y + t * (v2.y - v1.y)
out.z = v1.z + t * (v2.z - v1.z)
out.y = out.y + height * math.sin(math.pi * t)
return out
end
local actionManager = cc.Director:getInstance():getActionManager()
----------------------------------------
----NavMeshBaseTestDemo
----------------------------------------
local NavMeshBaseTestDemo = class("NavMeshBaseTestDemo", function ()
-- body
local scene = cc.Scene:createWithPhysics()
return scene
end)
function NavMeshBaseTestDemo:ctor()
TestCastScene.initWithLayer(self)
TestCastScene.titleLabel:setString(self:title())
TestCastScene.subtitleLabel:setString(self:subtitle())
self:init()
local function onNodeEvent(event)
if "enter" == event then
self:onEnter()
elseif "exit" == event then
self:onExit()
end
end
self:registerScriptHandler(onNodeEvent)
end
function NavMeshBaseTestDemo:title()
return "Physics3D Test"
end
function NavMeshBaseTestDemo:subtitle()
return ""
end
function NavMeshBaseTestDemo:init()
self._angle = 0.0
self._agents = {}
local size = cc.Director:getInstance():getWinSize()
self._camera = cc.Camera:createPerspective(30.0, size.width / size.height, 1.0, 1000.0)
self._camera:setPosition3D(cc.vec3(0.0, 50.0, 100.0))
self._camera:lookAt(cc.vec3(0.0, 0.0, 0.0), cc.vec3(0.0, 1.0, 0.0))
self._camera:setCameraFlag(cc.CameraFlag.USER1)
self:addChild(self._camera)
self:registerTouchEvent()
self:initScene()
self:scheduleUpdateWithPriorityLua(function(dt)
if #self._agents == 0 then
return
end
if not self._resumeFlag and nil ~= self._agentNode then
self._resumeFlag = true
actionManager:resumeTarget(self._agentNode)
end
local currentVelocity = nil
local speed = 0
for i = 1, #self._agents do
currentVelocity = self._agents[i][1]:getCurrentVelocity()
speed = math.sqrt(currentVelocity.x * currentVelocity.x + currentVelocity.y * currentVelocity.y + currentVelocity.z * currentVelocity.z) * 0.2
if speed < 0 then
speed = 0.0
end
self._agents[i][2]:setSpeed(speed)
end
end, 0)
self:extend()
end
function NavMeshBaseTestDemo:onEnter()
local hitResult = {}
local ret = false
local physicsWorld = self:getPhysics3DWorld()
ret, hitResult = physicsWorld:rayCast(cc.vec3(0.0, 50.0, 0.0), cc.vec3(0.0, -50.0, 0.0), hitResult)
self:createAgent(hitResult.hitPosition)
end
function NavMeshBaseTestDemo:onExit()
self:unscheduleUpdate()
end
function NavMeshBaseTestDemo:registerTouchEvent()
end
function NavMeshBaseTestDemo:extend()
end
function NavMeshBaseTestDemo:initScene()
self:getPhysics3DWorld():setDebugDrawEnable(false)
local trianglesList = cc.Bundle3D:getTrianglesList("NavMesh/scene.obj")
local rbDes = {}
rbDes.mass = 0.0
rbDes.shape = cc.Physics3DShape:createMesh(trianglesList, math.floor(#trianglesList / 3))
local rigidBody = cc.Physics3DRigidBody:create(rbDes)
local component = cc.Physics3DComponent:create(rigidBody)
local sprite = cc.Sprite3D:create("NavMesh/scene.obj")
sprite:addComponent(component)
sprite:setCameraMask(cc.CameraFlag.USER1)
self:addChild(sprite)
self:setPhysics3DDebugCamera(self._camera)
local navMesh = cc.NavMesh:create("NavMesh/all_tiles_tilecache.bin", "NavMesh/geomset.txt")
navMesh:setDebugDrawEnable(true)
self:setNavMesh(navMesh)
self:setNavMeshDebugCamera(self._camera)
local ambientLight = cc.AmbientLight:create(cc.c3b(64, 64, 64))
ambientLight:setCameraMask(cc.CameraFlag.USER1)
self:addChild(ambientLight)
local dirLight = cc.DirectionLight:create(cc.vec3(1.2, -1.1, 0.5), cc.c3b(255, 255, 255))
dirLight:setCameraMask(cc.CameraFlag.USER1)
self:addChild(dirLight)
end
function NavMeshBaseTestDemo:createAgent(pos)
local filePath = "Sprite3DTest/girl.c3b"
local navMeshAgentParam = {}
navMeshAgentParam.radius = 2.0
navMeshAgentParam.height = 8.0
navMeshAgentParam.maxSpeed = 8.0
local agent = cc.NavMeshAgent:create(navMeshAgentParam)
local agentNode = cc.Sprite3D:create(filePath)
agent:setOrientationRefAxes(cc.vec3(-1.0, 0.0, 1.0))
agent.userdata = 0.0
agentNode:setScale(0.05)
agentNode:addComponent(agent)
local node = cc.Node:create()
node:addChild(agentNode)
node:setPosition3D(pos)
node:setCameraMask(cc.CameraFlag.USER1)
self:addChild(node)
local animation = cc.Animation3D:create(filePath)
local animate = cc.Animate3D:create(animation)
if nil ~= animate then
agentNode:runAction(cc.RepeatForever:create(animate))
animate:setSpeed(0.0)
end
self._agents[#self._agents + 1] = {agent, animate}
end
function NavMeshBaseTestDemo:createObstacle(pos)
local obstacle = cc.NavMeshObstacle:create(2.0, 8.0)
local obstacleNode = cc.Sprite3D:create("Sprite3DTest/cylinder.c3b")
obstacleNode:setPosition3D(cc.vec3(pos.x, pos.y -0.5, pos.z))
obstacleNode:setRotation3D(cc.vec3(-90.0, 0.0, 0.0))
obstacleNode:setScale(0.3)
obstacleNode:addComponent(obstacle)
obstacleNode:setCameraMask(cc.CameraFlag.USER1)
self:addChild(obstacleNode)
end
function NavMeshBaseTestDemo:moveAgents(des)
if #self._agents == 0 then
return
end
local agent = nil
for i = 1, #self._agents do
self._agents[i][1]:move(des, function (agent, totalTimeAfterMove)
local data = agent.userdata
if agent:isOnOffMeshLink() then
agent:setAutoTraverseOffMeshLink(false)
agent:setAutoOrientation(false)
local linkdata = agent:getCurrentOffMeshLinkData()
agent:getOwner():setPosition3D(jump(linkdata.startPosition, linkdata.endPosition, 10.0, data))
local dir = cc.vec3(linkdata.endPosition.x - linkdata.startPosition.x, linkdata.endPosition.y - linkdata.startPosition.y, linkdata.endPosition.z - linkdata.startPosition.z)
dir.y = 0.0
dir = cc.vec3normalize(dir)
local axes = cc.vec3(0.0, 0.0, 0.0)
local refAxes = cc.vec3(-1.0, 0.0, 1.0)
refAxes = cc.vec3normalize(refAxes)
axes = vec3_cross(refAxes, dir, axes)
local angle = refAxes.x * dir.x + refAxes.y * dir.y + refAxes.z * dir.z
local quaternion = cc.quaternion_createFromAxisAngle(axes, math.acos(angle))
agent:getOwner():setRotationQuat(quaternion)
agent.userdata = agent.userdata + 0.01
if 1.0 < agent.userdata then
agent:completeOffMeshLink()
agent:setAutoOrientation(true)
agent.userdata = 0.0
end
end
end)
end
end
----------------------------------------
----NavMeshBaseTestDemo
----------------------------------------
local NavMeshBasicTestDemo = class("NavMeshBasicTestDemo", NavMeshBaseTestDemo)
function NavMeshBasicTestDemo:title()
return "Navigation Mesh Test"
end
function NavMeshBasicTestDemo:subtitle()
return "Basic Test"
end
function NavMeshBasicTestDemo:registerTouchEvent()
local listener = cc.EventListenerTouchAllAtOnce:create()
listener:registerScriptHandler(function(touches, event)
self._needMoveAgents = true
end,cc.Handler.EVENT_TOUCHES_BEGAN)
listener:registerScriptHandler(function(touches, event)
if #touches > 0 and self._camera ~= nil then
local touch = touches[1]
local delta = touch:getDelta()
self._angle = self._angle - delta.x * math.pi / 180.0
self._camera:setPosition3D(cc.vec3(100.0 * math.sin(self._angle), 50.0, 100.0 * math.cos(self._angle)))
self._camera:lookAt(cc.vec3(0.0, 0.0, 0.0), cc.vec3(0.0, 1.0, 0.0))
if (delta.x * delta.x + delta.y * delta.y) > 16 then
self._needMoveAgents = false
end
end
end, cc.Handler.EVENT_TOUCHES_MOVED)
listener:registerScriptHandler(function(touches, event)
if not self._needMoveAgents then
return
end
local physicsWorld = self:getPhysics3DWorld()
if #touches > 0 then
local touch = touches[1]
local location = touch:getLocationInView()
local nearP = cc.vec3(location.x, location.y, 0.0)
local farP = cc.vec3(location.x, location.y, 1.0)
local size = cc.Director:getInstance():getWinSize()
nearP = self._camera:unproject(size, nearP, nearP)
farP = self._camera:unproject(size, farP, farP)
local hitResult = {}
local ret = false
ret, hitResult = physicsWorld:rayCast(nearP, farP, hitResult)
self:moveAgents(hitResult.hitPosition)
end
end, cc.Handler.EVENT_TOUCHES_ENDED)
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
end
function NavMeshBasicTestDemo:extend()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 15
local debugLabel = cc.Label:createWithTTF(ttfConfig,"Debug Draw ON")
local menuItem = cc.MenuItemLabel:create(debugLabel)
menuItem:registerScriptTapHandler(function (tag, sender)
local scene = cc.Director:getInstance():getRunningScene()
local enabledDebug = not scene:getNavMesh():isDebugDrawEnabled()
scene:getNavMesh():setDebugDrawEnable(enabledDebug)
if enabledDebug then
debugLabel:setString("DebugDraw ON")
else
debugLabel:setString("DebugDraw OFF")
end
end)
menuItem:setAnchorPoint(cc.p(0.0, 1.0))
menuItem:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 100))
local menu = cc.Menu:create(menuItem)
menu:setPosition(cc.p(0.0, 0.0))
self:addChild(menu)
end
----------------------------------------
----NavMeshAdvanceTestDemo
----------------------------------------
local NavMeshAdvanceTestDemo = class("NavMeshAdvanceTestDemo", NavMeshBaseTestDemo)
function NavMeshAdvanceTestDemo:title()
return "Navigation Mesh Test"
end
function NavMeshAdvanceTestDemo:subtitle()
return "Advance Test"
end
function NavMeshAdvanceTestDemo:registerTouchEvent()
local listener = cc.EventListenerTouchAllAtOnce:create()
listener:registerScriptHandler(function(touches, event)
self._needMoveAgents = true
end,cc.Handler.EVENT_TOUCHES_BEGAN)
listener:registerScriptHandler(function(touches, event)
if #touches > 0 and self._camera ~= nil then
local touch = touches[1]
local delta = touch:getDelta()
self._angle = self._angle - delta.x * math.pi / 180.0
self._camera:setPosition3D(cc.vec3(100.0 * math.sin(self._angle), 50.0, 100.0 * math.cos(self._angle)))
self._camera:lookAt(cc.vec3(0.0, 0.0, 0.0), cc.vec3(0.0, 1.0, 0.0))
if (delta.x * delta.x + delta.y * delta.y) > 16 then
self._needMoveAgents = false
end
end
end, cc.Handler.EVENT_TOUCHES_MOVED)
listener:registerScriptHandler(function(touches, event)
if not self._needMoveAgents then
return
end
local physicsWorld = self:getPhysics3DWorld()
if #touches > 0 then
local touch = touches[1]
local location = touch:getLocationInView()
local nearP = cc.vec3(location.x, location.y, 0.0)
local farP = cc.vec3(location.x, location.y, 1.0)
local size = cc.Director:getInstance():getWinSize()
nearP = self._camera:unproject(size, nearP, nearP)
farP = self._camera:unproject(size, farP, farP)
local hitResult = {}
local ret = false
ret, hitResult = physicsWorld:rayCast(nearP, farP, hitResult)
self:moveAgents(hitResult.hitPosition)
end
end, cc.Handler.EVENT_TOUCHES_ENDED)
local eventDispatcher = self:getEventDispatcher()
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
end
function NavMeshAdvanceTestDemo:extend()
local ttfConfig = {}
ttfConfig.fontFilePath = "fonts/arial.ttf"
ttfConfig.fontSize = 15
local obstacleLabel = cc.Label:createWithTTF(ttfConfig,"Create Obstacle")
local menuItem0 = cc.MenuItemLabel:create(obstacleLabel)
menuItem0:registerScriptTapHandler(function (tag, sender)
local scene = cc.Director:getInstance():getRunningScene()
local x = math.random(-50, 50)
local z = math.random(-50.0, 50.0)
local hitResult = {}
local ret = false
ret, hitResult = scene:getPhysics3DWorld():rayCast(cc.vec3(x, 50.0, z), cc.vec3(x, -50.0, z), hitResult)
self:createObstacle(hitResult.hitPosition)
end)
menuItem0:setAnchorPoint(cc.p(0.0, 1.0))
menuItem0:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 50))
local agentLabel = cc.Label:createWithTTF(ttfConfig,"Create Agent")
local menuItem1 = cc.MenuItemLabel:create(agentLabel)
menuItem1:registerScriptTapHandler(function (tag, sender)
local scene = cc.Director:getInstance():getRunningScene()
local x = math.random(-50, 50)
local z = math.random(-50.0, 50.0)
local hitResult = {}
local ret = false
ret, hitResult = scene:getPhysics3DWorld():rayCast(cc.vec3(x, 50.0, z), cc.vec3(x, -50.0, z), hitResult)
self:createAgent(hitResult.hitPosition)
end)
menuItem1:setAnchorPoint(cc.p(0.0, 1.0))
menuItem1:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 100))
local debugLabel = cc.Label:createWithTTF(ttfConfig,"Debug Draw ON")
local menuItem2 = cc.MenuItemLabel:create(debugLabel)
menuItem2:registerScriptTapHandler(function (tag, sender)
local scene = cc.Director:getInstance():getRunningScene()
local enabledDebug = not scene:getNavMesh():isDebugDrawEnabled()
scene:getNavMesh():setDebugDrawEnable(enabledDebug)
if enabledDebug then
debugLabel:setString("DebugDraw ON")
else
debugLabel:setString("DebugDraw OFF")
end
end)
menuItem2:setAnchorPoint(cc.p(0.0, 1.0))
menuItem2:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 150))
local menu = cc.Menu:create(menuItem0, menuItem1, menuItem2)
menu:setPosition(cc.p(0.0, 0.0))
self:addChild(menu)
end
----------------------------------------
----NavMeshTest
----------------------------------------
function NavMeshTest()
Helper.usePhysics = true
TestCastScene.createFunctionTable =
{
NavMeshBasicTestDemo.create,
NavMeshAdvanceTestDemo.create,
}
local scene = NavMeshBasicTestDemo.create()
scene:addChild(CreateBackMenuItem())
return scene
end

View File

@ -141,3 +141,72 @@ function createTestLayer(title, subtitle)
Helper.subtitleLabel:setString(subTitleStr) Helper.subtitleLabel:setString(subTitleStr)
return layer return layer
end end
TestCastScene = {
index = 1,
createFunctioinTable = nil,
titleLabel = nil,
subtitleLabel = nil
}
function TestCastScene.nextAction()
TestCastScene.index = TestCastScene.index + 1
if TestCastScene.index > table.getn(TestCastScene.createFunctionTable) then
TestCastScene.index = 1
end
return TestCastScene.newScene()
end
function TestCastScene.backAction()
TestCastScene.index = TestCastScene.index - 1
if TestCastScene.index == 0 then
TestCastScene.index = table.getn(TestCastScene.createFunctionTable)
end
return TestCastScene.newScene()
end
function TestCastScene.restartAction()
return TestCastScene.newScene()
end
function TestCastScene.newScene()
local scene = TestCastScene.createFunctionTable[TestCastScene.index]()
scene:addChild(CreateBackMenuItem())
cc.Director:getInstance():replaceScene(scene)
end
function TestCastScene.initWithLayer(scene)
local size = cc.Director:getInstance():getWinSize()
TestCastScene.titleLabel = cc.Label:createWithTTF("", s_arialPath, 28)
TestCastScene.titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
scene:addChild(TestCastScene.titleLabel, 1)
TestCastScene.titleLabel:setPosition(size.width / 2, size.height - 50)
TestCastScene.subtitleLabel = cc.Label:createWithTTF("", s_thonburiPath, 16)
TestCastScene.subtitleLabel:setAnchorPoint(cc.p(0.5, 0.5))
scene:addChild(TestCastScene.subtitleLabel, 1)
TestCastScene.subtitleLabel:setPosition(size.width / 2, size.height - 80)
-- menu
local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
item1:registerScriptTapHandler(TestCastScene.backAction)
item2:registerScriptTapHandler(TestCastScene.restartAction)
item3:registerScriptTapHandler(TestCastScene.nextAction)
local menu = cc.Menu:create()
menu:addChild(item1)
menu:addChild(item2)
menu:addChild(item3)
menu:setPosition(cc.p(0, 0))
item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2))
item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2))
item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2))
scene:addChild(menu, 1)
local background = cc.Layer:create()
scene:addChild(background, -10)
end

View File

@ -63,6 +63,7 @@ require "SpritePolygonTest/SpritePolygonTest"
require "Physics3DTest/Physics3DTest" require "Physics3DTest/Physics3DTest"
require "Scene3DTest/Scene3DTest" require "Scene3DTest/Scene3DTest"
require "MaterialSystemTest/MaterialSystemTest" require "MaterialSystemTest/MaterialSystemTest"
require "NavMeshTest/NavMeshTest"
local LINE_SPACE = 40 local LINE_SPACE = 40
@ -115,6 +116,7 @@ local _allTests = {
{ isSupported = true, name = "MenuTest" , create_func = MenuTestMain }, { isSupported = true, name = "MenuTest" , create_func = MenuTestMain },
{ isSupported = true, name = "MotionStreakTest" , create_func = MotionStreakTest }, { isSupported = true, name = "MotionStreakTest" , create_func = MotionStreakTest },
{ isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain }, { isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain },
{ isSupported = true, name = "NavMeshTest" , create_func = NavMeshTest },
{ isSupported = true, name = "NewEventDispatcherTest" , create_func = NewEventDispatcherTest }, { isSupported = true, name = "NewEventDispatcherTest" , create_func = NewEventDispatcherTest },
{ isSupported = true, name = "NodeTest" , create_func = CocosNodeTest }, { isSupported = true, name = "NodeTest" , create_func = CocosNodeTest },
{ isSupported = true, name = "OpenGLTest" , create_func= OpenGLTestMain }, { isSupported = true, name = "OpenGLTest" , create_func= OpenGLTestMain },
@ -216,6 +218,10 @@ function CreateTestMenu()
testMenuItem:setEnabled(false) testMenuItem:setEnabled(false)
end end
if obj.name == "NavMeshTest" and nil == cc.NavMesh then
testMenuItem:setEnabled(false)
end
testMenuItem:registerScriptTapHandler(menuCallback) testMenuItem:registerScriptTapHandler(menuCallback)
testMenuItem:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE))) testMenuItem:setPosition(cc.p(s.width / 2, (s.height - (index) * LINE_SPACE)))
MainMenu:addChild(testMenuItem, index + 10000, index + 10000) MainMenu:addChild(testMenuItem, index + 10000, index + 10000)

@ -1 +1 @@
Subproject commit 956a4f04cc55c2a5cff0b637d8465b09b20abc2a Subproject commit b384d93865d9a9499eed7f6f4b961a58c067fec0

View File

@ -11,6 +11,7 @@
#include "3d/lua_cocos2dx_3d_manual.h" #include "3d/lua_cocos2dx_3d_manual.h"
#include "audioengine/lua_cocos2dx_audioengine_manual.h" #include "audioengine/lua_cocos2dx_audioengine_manual.h"
#include "physics3d/lua_cocos2dx_physics3d_manual.h" #include "physics3d/lua_cocos2dx_physics3d_manual.h"
#include "navmesh/lua_cocos2dx_navmesh_manual.h"
static int lua_module_register(lua_State* L) static int lua_module_register(lua_State* L)
{ {
@ -26,6 +27,9 @@ static int lua_module_register(lua_State* L)
register_audioengine_module(L); register_audioengine_module(L);
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
register_physics3d_module(L); register_physics3d_module(L);
#endif
#if CC_USE_NAVMESH
register_navmesh_module(L);
#endif #endif
return 1; return 1;
} }

View File

@ -42,7 +42,7 @@ skip = Mesh::[create getAABB getVertexBuffer hasVertexAttrib getSkin getMeshInde
BillBoard::[draw], BillBoard::[draw],
Sprite3DCache::[addSprite3DData getSpriteData], Sprite3DCache::[addSprite3DData getSpriteData],
Terrain::[lookForIndicesLODSkrit lookForIndicesLOD insertIndicesLOD insertIndicesLODSkirt getIntersectionPoint getAABB getQuadTree create ^getHeight$], Terrain::[lookForIndicesLODSkrit lookForIndicesLOD insertIndicesLOD insertIndicesLODSkirt getIntersectionPoint getAABB getQuadTree create ^getHeight$],
Bundle3D::[calculateAABB loadMeshDatas getTrianglesList] Bundle3D::[calculateAABB loadMeshDatas getTrianglesList loadObj]
rename_functions = rename_functions =

View File

@ -0,0 +1,66 @@
[cocos2dx_navmesh]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = cocos2dx_navmesh
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = cc
macro_judgement = #if CC_USE_NAVMESH
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
clang_flags = -nostdinc -x c++ -std=c++11 -D CC_USE_NAVMESH
win32_clang_flags = -U __SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external -I%(cocosdir)s/external/recast/Detour -I%(cocosdir)s/external/recast/DetourCrowd -I%(cocosdir)s/external/recast/DetourTileCache -I%(cocosdir)s/external/recast/DebugUtils -I%(cocosdir)s/external/recast/fastlz -I%(cocosdir)s/external/recast/Recast -I%(cocosdir)s/external/lua/luajit/include -I%(cocosdir)s/external/lua/tolua -I%(cocosdir)s/cocos/scripting/lua-bindings/manual
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/navmesh/CCNavMesh.h %(cocosdir)s/cocos/scripting/lua-bindings/manual/navmesh/lua_cocos2dx_navmesh_conversions.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = NavMesh NavMeshAgent NavMeshObstacle
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = NavMesh::[findPath],
NavMeshObstacle::[setRadius setHeight],
NavMeshAgent::[move]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no

View File

@ -149,6 +149,7 @@ def main():
'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \ 'cocos2dx_csloader.ini' : ('cocos2dx_csloader', 'lua_cocos2dx_csloader_auto'), \
'cocos2dx_experimental_webview.ini' : ('cocos2dx_experimental_webview', 'lua_cocos2dx_experimental_webview_auto'), \ 'cocos2dx_experimental_webview.ini' : ('cocos2dx_experimental_webview', 'lua_cocos2dx_experimental_webview_auto'), \
'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'lua_cocos2dx_physics3d_auto'), \ 'cocos2dx_physics3d.ini' : ('cocos2dx_physics3d', 'lua_cocos2dx_physics3d_auto'), \
'cocos2dx_navmesh.ini' : ('cocos2dx_navmesh', 'lua_cocos2dx_navmesh_auto'), \
} }
target = 'lua' target = 'lua'
generator_py = '%s/generator.py' % cxx_generator_root generator_py = '%s/generator.py' % cxx_generator_root