2019-11-23 20:27:39 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
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.
|
|
|
|
****************************************************************************/
|
2022-08-08 18:02:17 +08:00
|
|
|
#include "scripting/lua-bindings/manual/3d/axlua_3d_manual.h"
|
|
|
|
#include "scripting/lua-bindings/auto/axlua_3d_auto.hpp"
|
2019-11-23 20:27:39 +08:00
|
|
|
#include "scripting/lua-bindings/manual/LuaBasicConversions.h"
|
|
|
|
#include "scripting/lua-bindings/manual/CCLuaEngine.h"
|
|
|
|
#include "3d/CCBundle3D.h"
|
2022-07-05 14:48:46 +08:00
|
|
|
#include "3d/CCMeshRenderer.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
#include "3d/CCTerrain.h"
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_MeshRenderer_getAABB(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::MeshRenderer* cobj = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.MeshRenderer", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::MeshRenderer*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_MeshRenderer_getAABB'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* ret = const_cast<ax::AABB*>(&(cobj->getAABB()));
|
|
|
|
object_to_luaval<ax::AABB>(L, "ax.AABB", (ax::AABB*)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.MeshRenderer:getAABB", argc, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_MeshRenderer_getAABB'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_MeshRenderer_createAsync(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
int argc = 0;
|
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertable(L, 1, "ax.MeshRenderer", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 3)
|
|
|
|
{
|
|
|
|
std::string modelPath;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_std_string(L, 2, &modelPath, "ax.MeshRenderer:createAsync");
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!ok)
|
|
|
|
break;
|
|
|
|
std::string texturePath;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_std_string(L, 3, &texturePath, "ax.MeshRenderer:createAsync");
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!ok)
|
|
|
|
break;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!toluafix_isfunction(L, 4, "LUA_FUNCTION", 0, &tolua_err))
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
goto tolua_lerror;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-25 10:04:45 +08:00
|
|
|
LUA_FUNCTION handler = toluafix_ref_function(L, 4, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::MeshRenderer::createAsync(
|
2021-11-15 19:05:08 +08:00
|
|
|
modelPath, texturePath,
|
2022-08-08 18:02:17 +08:00
|
|
|
[=](ax::MeshRenderer* mesh, void* callbackparam) {
|
2021-12-25 10:04:45 +08:00
|
|
|
auto stack = LuaEngine::getInstance()->getLuaStack();
|
2022-07-05 14:48:46 +08:00
|
|
|
int id = (mesh) ? (int)mesh->_ID : -1;
|
|
|
|
int* luaID = (mesh) ? &mesh->_luaID : nullptr;
|
2022-07-12 21:31:54 +08:00
|
|
|
toluafix_pushusertype_ccobject(stack->getLuaState(), id, luaID, (void*)mesh, "ax.MeshRenderer");
|
2021-12-25 10:04:45 +08:00
|
|
|
stack->executeFunctionByHandler(handler, 1);
|
|
|
|
},
|
|
|
|
nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_settop(L, 1);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
} while (0);
|
2021-12-25 10:04:45 +08:00
|
|
|
ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
|
|
|
std::string modelPath;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_std_string(L, 2, &modelPath, "ax.MeshRenderer:createAsync");
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!ok)
|
|
|
|
break;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!toluafix_isfunction(L, 3, "LUA_FUNCTION", 0, &tolua_err))
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
goto tolua_lerror;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
LUA_FUNCTION handler = toluafix_ref_function(L, 3, 0);
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::MeshRenderer::createAsync(
|
2021-12-25 10:04:45 +08:00
|
|
|
modelPath,
|
2022-08-08 18:02:17 +08:00
|
|
|
[=](ax::MeshRenderer* mesh, void* callbackparam) {
|
2021-12-25 10:04:45 +08:00
|
|
|
auto stack = LuaEngine::getInstance()->getLuaStack();
|
2022-07-05 14:48:46 +08:00
|
|
|
int id = (mesh) ? (int)mesh->_ID : -1;
|
|
|
|
int* luaID = (mesh) ? &mesh->_luaID : nullptr;
|
2022-07-12 21:31:54 +08:00
|
|
|
toluafix_pushusertype_ccobject(stack->getLuaState(), id, luaID, (void*)mesh, "ax.MeshRenderer");
|
2021-12-25 10:04:45 +08:00
|
|
|
stack->executeFunctionByHandler(handler, 1);
|
|
|
|
},
|
|
|
|
nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_settop(L, 1);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
} while (0);
|
2021-12-25 10:04:45 +08:00
|
|
|
ok = true;
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d", "ax.MeshRenderer:createAsync", argc, 3);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_MeshRenderer_createAsync'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-05 14:48:46 +08:00
|
|
|
static void extendMeshRenderer(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
lua_pushstring(L, "ax.MeshRenderer");
|
2019-11-23 20:27:39 +08:00
|
|
|
lua_rawget(L, LUA_REGISTRYINDEX);
|
2021-12-25 10:04:45 +08:00
|
|
|
if (lua_istable(L, -1))
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_function(L, "getAABB", axlua_3d_MeshRenderer_getAABB);
|
|
|
|
tolua_function(L, "createAsync", axlua_3d_MeshRenderer_createAsync);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
lua_pop(L, 1);
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
bool luaval_to_terraindata(lua_State* L, int lo, ax::Terrain::TerrainData* outValue, const char* funcName = "")
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
if (nullptr == L || nullptr == outValue)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool ok = true;
|
|
|
|
tolua_Error tolua_err;
|
|
|
|
if (!tolua_istable(L, lo, 0, &tolua_err))
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2021-12-25 10:04:45 +08:00
|
|
|
luaval_to_native_err(L, "#ferror:", &tolua_err, funcName);
|
2019-11-23 20:27:39 +08:00
|
|
|
ok = false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ok)
|
|
|
|
{
|
|
|
|
lua_pushstring(L, "_chunkSize");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!lua_isnil(L, lua_gettop(L)))
|
|
|
|
{
|
|
|
|
luaval_to_size(L, lua_gettop(L), &(outValue->_chunkSize));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
outValue->_chunkSize = ax::Size(32, 32);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
lua_pop(L, 1);
|
|
|
|
|
|
|
|
lua_pushstring(L, "_heightMapSrc");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
2019-11-23 20:27:39 +08:00
|
|
|
outValue->_heightMapSrc = tolua_tocppstring(L, -1, "");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_pushstring(L, "_alphaMapSrc");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
2019-11-23 20:27:39 +08:00
|
|
|
outValue->_alphaMapSrc = const_cast<char*>(tolua_tocppstring(L, -1, ""));
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_pushstring(L, "_detailMaps");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
2019-11-23 20:27:39 +08:00
|
|
|
if (lua_istable(L, -1))
|
|
|
|
{
|
|
|
|
size_t len = lua_objlen(L, -1);
|
|
|
|
for (size_t i = 0; i < len; i++)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pushnumber(L, i + 1);
|
|
|
|
lua_gettable(L, -2);
|
2019-11-23 20:27:39 +08:00
|
|
|
if (lua_istable(L, -1))
|
|
|
|
{
|
|
|
|
lua_pushstring(L, "_detailMapSrc");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, -2);
|
2019-11-23 20:27:39 +08:00
|
|
|
outValue->_detailMaps[i]._detailMapSrc = tolua_tocppstring(L, -1, "");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_pushstring(L, "_detailMapSize");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, -2);
|
|
|
|
outValue->_detailMaps[i]._detailMapSize = lua_isnil(L, -1) ? 0.0f : (float)lua_tonumber(L, -1);
|
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
lua_pop(L, 1);
|
|
|
|
}
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_pushstring(L, "_mapHeight");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
|
|
|
outValue->_mapHeight = lua_isnil(L, -1) ? 2.0f : (float)lua_tonumber(L, -1);
|
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_pushstring(L, "_mapScale");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
|
|
|
outValue->_mapScale = lua_isnil(L, -1) ? 0.1f : (float)lua_tonumber(L, -1);
|
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_pushstring(L, "_detailMapAmount");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
|
|
|
outValue->_detailMapAmount = lua_isnil(L, -1) ? 0 : (int)lua_tonumber(L, -1);
|
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
lua_pushstring(L, "_skirtHeightRatio");
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_gettable(L, lo);
|
|
|
|
outValue->_skirtHeightRatio = lua_isnil(L, -1) ? 1.0f : (float)lua_tonumber(L, -1);
|
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
void terraindata_to_luaval(lua_State* L, const ax::Terrain::TerrainData& inValue)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
if (nullptr == L)
|
|
|
|
return;
|
|
|
|
|
|
|
|
lua_newtable(L);
|
|
|
|
lua_pushstring(L, "_chunkSize");
|
|
|
|
size_to_luaval(L, inValue._chunkSize);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
if (inValue._heightMapSrc.length() > 0)
|
|
|
|
{
|
|
|
|
lua_pushstring(L, "_heightMapSrc");
|
|
|
|
lua_pushstring(L, inValue._heightMapSrc.c_str());
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!inValue._alphaMapSrc.empty())
|
|
|
|
{
|
|
|
|
lua_pushstring(L, "_alphaMapSrc");
|
|
|
|
lua_pushstring(L, inValue._alphaMapSrc.c_str());
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
|
|
|
|
|
|
|
lua_pushstring(L, "_detailMaps");
|
|
|
|
lua_newtable(L);
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pushnumber(L, (lua_Number)i + 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
lua_newtable(L);
|
|
|
|
|
|
|
|
lua_pushstring(L, "_detailMapSrc");
|
|
|
|
lua_pushstring(L, inValue._detailMaps[i]._detailMapSrc.c_str());
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
lua_pushstring(L, "_detailMapSize");
|
|
|
|
lua_pushnumber(L, (lua_Number)inValue._detailMaps[i]._detailMapSize);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
lua_pushstring(L, "_mapHeight");
|
|
|
|
lua_pushnumber(L, (lua_Number)inValue._mapHeight);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
lua_pushstring(L, "_mapScale");
|
|
|
|
lua_pushnumber(L, (lua_Number)inValue._mapScale);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
lua_pushstring(L, "_detailMapAmount");
|
|
|
|
lua_pushnumber(L, (lua_Number)inValue._detailMapAmount);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
lua_pushstring(L, "_skirtHeightRatio");
|
|
|
|
lua_pushnumber(L, (lua_Number)inValue._skirtHeightRatio);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Terrain_create(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
int argc = 0;
|
|
|
|
bool ok = true;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertable(L, 1, "ax.Terrain", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Terrain::TerrainData arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
ok &= luaval_to_terraindata(L, 2, &arg0);
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid arguments in function 'axlua_3d_Terrain_create'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Terrain* ret = ax::Terrain::create(arg0);
|
|
|
|
object_to_luaval<ax::Terrain>(L, "ax.Terrain", (ax::Terrain*)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Terrain::TerrainData arg0;
|
|
|
|
ax::Terrain::CrackFixedType arg1;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
ok &= luaval_to_terraindata(L, 2, &arg0);
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_int32(L, 3, (int*)&arg1, "ax.Terrain:create");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid arguments in function 'axlua_3d_Terrain_create'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Terrain* ret = ax::Terrain::create(arg0, arg1);
|
|
|
|
object_to_luaval<ax::Terrain>(L, "ax.Terrain", (ax::Terrain*)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n ", "ax.Terrain:create", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_Terrain_create'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Terrain_getHeight(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Terrain* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Terrain", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::Terrain*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_Terrain_getHeight'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec2 arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec2(L, 2, &arg0, "ax.Terrain:getHeight");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
double ret = cobj->getHeight(arg0);
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_pushnumber(L, (lua_Number)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec2 arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec2(L, 2, &arg0, "ax.Terrain:getHeight");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3* arg1;
|
|
|
|
ok &= luaval_to_object<ax::Vec3>(L, 3, "ax.Vec3", &arg1, "ax.Terrain:getHeight");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
double ret = cobj->getHeight(arg0, arg1);
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_pushnumber(L, (lua_Number)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
vec3_to_luaval(L, *arg1);
|
|
|
|
return 2;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
double arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_number(L, 2, &arg0, "ax.Terrain:getHeight");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
double arg1;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_number(L, 3, &arg1, "ax.Terrain:getHeight");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
double ret = cobj->getHeight(arg0, arg1);
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_pushnumber(L, (lua_Number)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 3)
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
double arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_number(L, 2, &arg0, "ax.Terrain:getHeight");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
double arg1;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_number(L, 3, &arg1, "ax.Terrain:getHeight");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg2;
|
2019-11-23 20:27:39 +08:00
|
|
|
ok &= luaval_to_vec3(L, 4, &arg2);
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
double ret = cobj->getHeight(arg0, arg1, &arg2);
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_pushnumber(L, (lua_Number)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
vec3_to_luaval(L, arg2);
|
|
|
|
return 2;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.Terrain:getHeight", argc, 2);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_Terrain_getHeight'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Terrain_getIntersectionPoint(lua_State* tolua_S)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Terrain* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(tolua_S, 1, "ax.Terrain", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::Terrain*)tolua_tousertype(tolua_S, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(tolua_S, "invalid 'cobj' in function 'axlua_3d_Terrain_getIntersectionPoint'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
argc = lua_gettop(tolua_S) - 1;
|
2021-12-25 10:04:45 +08:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* arg0 = nullptr;
|
|
|
|
ok &= luaval_to_object<ax::Ray>(tolua_S, 2, "ax.Ray", &arg0, "ax.Terrain:getIntersectionPoint");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg1;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(tolua_S, 3, &arg1, "ax.Terrain:getIntersectionPoint");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
bool ret = cobj->getIntersectionPoint(*arg0, arg1);
|
|
|
|
tolua_pushboolean(tolua_S, (bool)ret);
|
|
|
|
vec3_to_luaval(tolua_S, arg1);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
ok = true;
|
2021-12-25 10:04:45 +08:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* arg0;
|
|
|
|
ok &= luaval_to_object<ax::Ray>(tolua_S, 2, "ax.Ray", &arg0, "ax.Terrain:getIntersectionPoint");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 ret = cobj->getIntersectionPoint(*arg0);
|
2019-11-23 20:27:39 +08:00
|
|
|
vec3_to_luaval(tolua_S, ret);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
ok = true;
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.Terrain:getIntersectionPoint",
|
2021-12-25 10:04:45 +08:00
|
|
|
argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(tolua_S, "#ferror in function 'axlua_3d_Terrain_getIntersectionPoint'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
return 0;
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void extendTerrain(lua_State* L)
|
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
lua_pushstring(L, "ax.Terrain");
|
2019-11-23 20:27:39 +08:00
|
|
|
lua_rawget(L, LUA_REGISTRYINDEX);
|
2021-12-25 10:04:45 +08:00
|
|
|
if (lua_istable(L, -1))
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_function(L, "create", axlua_3d_Terrain_create);
|
|
|
|
tolua_function(L, "getHeight", axlua_3d_Terrain_getHeight);
|
|
|
|
tolua_function(L, "getIntersectionPoint", axlua_3d_Terrain_getIntersectionPoint);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
lua_pop(L, 1);
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Bundle3D_getTrianglesList(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
int argc = 0;
|
|
|
|
bool ok = true;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertable(L, 1, "ax.Bundle3D", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (argc == 1)
|
|
|
|
{
|
|
|
|
std::string arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_std_string(L, 2, &arg0, "ax.Bundle3D:getTrianglesList");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid arguments in function 'axlua_3d_Bundle3D_getTrianglesList'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
std::vector<ax::Vec3> ret = ax::Bundle3D::getTrianglesList(arg0);
|
2021-12-25 10:04:45 +08:00
|
|
|
std_vector_vec3_to_luaval(L, ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d\n ", "ax.Bundle3D:getTrianglesList", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_Bundle3D_getTrianglesList'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void extendBundle3D(lua_State* L)
|
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
lua_pushstring(L, "ax.Bundle3D");
|
2019-11-23 20:27:39 +08:00
|
|
|
lua_rawget(L, LUA_REGISTRYINDEX);
|
2021-12-25 10:04:45 +08:00
|
|
|
if (lua_istable(L, -1))
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_function(L, "getTrianglesList", axlua_3d_Bundle3D_getTrianglesList);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
lua_pop(L, 1);
|
|
|
|
}
|
|
|
|
|
2022-08-29 20:51:22 +08:00
|
|
|
static int register_all_ax_3d_manual(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
if (nullptr == L)
|
|
|
|
return 0;
|
|
|
|
|
2022-07-05 14:48:46 +08:00
|
|
|
extendMeshRenderer(L);
|
2019-11-23 20:27:39 +08:00
|
|
|
extendTerrain(L);
|
|
|
|
extendBundle3D(L);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_reset(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_reset'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->reset();
|
|
|
|
lua_settop(L, 1);
|
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:reset", argc, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_reset'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_set(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_set'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg0;
|
|
|
|
ax::Vec3 arg1;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.AABB:set");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 3, &arg1, "ax.AABB:set");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->set(arg0, arg1);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:set", argc, 2);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_set'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_transform(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_transform'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Mat4 arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_mat4(L, 2, &arg0, "ax.AABB:transform");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->transform(arg0);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:transform", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_transform'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_getCenter(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_getCenter'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 ret = cobj->getCenter();
|
2019-11-23 20:27:39 +08:00
|
|
|
vec3_to_luaval(L, ret);
|
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:getCenter", argc, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_getCenter'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_isEmpty(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_isEmpty'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
bool ret = cobj->isEmpty();
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_pushboolean(L, (bool)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:isEmpty", argc, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_isEmpty'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_getCorners(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_getCorners'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3* arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ok &= luaval_to_object<ax::Vec3>(L, 2, "ax.Vec3", &arg0, "ax.AABB:getCorners");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->getCorners(arg0);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:getCorners", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_getCorners'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_updateMinMax(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_updateMinMax'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
const ax::Vec3* arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
ssize_t arg1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
ok &= luaval_to_object<const ax::Vec3>(L, 2, "ax.Vec3", &arg0, "ax.AABB:updateMinMax");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_ssize_t(L, 3, &arg1, "ax.AABB:updateMinMax");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->updateMinMax(arg0, arg1);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:updateMinMax", argc, 2);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_updateMinMax'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_containPoint(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_AABB_containPoint'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.AABB:containPoint");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
bool ret = cobj->containPoint(arg0);
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_pushboolean(L, (bool)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:containPoint", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_containPoint'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_constructor(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.AABB:AABB");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg1;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 3, &arg1, "ax.AABB:AABB");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = new ax::AABB(arg0, arg1);
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_pushusertype(L, (void*)cobj, "ax.AABB");
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_register_gc(L, lua_gettop(L));
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 0)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = new ax::AABB();
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_pushusertype(L, (void*)cobj, "ax.AABB");
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_register_gc(L, lua_gettop(L));
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.AABB:AABB", argc, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_AABB_constructor'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_AABB_min(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_AABB_min'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_min);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_AABB_min'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_AABB_min(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_AABB_min'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_min);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_AABB_min'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_AABB_max(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_AABB_max'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_max);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_AABB_max'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_AABB_max(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.AABB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_AABB_max'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_max);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_Ray_direction'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_AABB_finalize(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* self = (ax::AABB*)tolua_tousertype(L, 1, 0);
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_SAFE_DELETE(self);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
int lua_register_axis_3d_AABB(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_usertype(L, "ax.AABB");
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_cclass(L, "AABB", "ax.AABB", "", axlua_3d_AABB_finalize);
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
tolua_beginmodule(L, "AABB");
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_variable(L, "_min", axlua_3d_get_AABB_min, axlua_3d_set_AABB_min);
|
|
|
|
tolua_variable(L, "_max", axlua_3d_get_AABB_max, axlua_3d_set_AABB_max);
|
|
|
|
tolua_function(L, "new", axlua_3d_AABB_constructor);
|
|
|
|
tolua_function(L, "reset", axlua_3d_AABB_reset);
|
|
|
|
tolua_function(L, "set", axlua_3d_AABB_set);
|
|
|
|
tolua_function(L, "transform", axlua_3d_AABB_transform);
|
|
|
|
tolua_function(L, "getCenter", axlua_3d_AABB_getCenter);
|
|
|
|
tolua_function(L, "isEmpty", axlua_3d_AABB_isEmpty);
|
|
|
|
tolua_function(L, "getCorners", axlua_3d_AABB_getCorners);
|
|
|
|
tolua_function(L, "updateMinMax", axlua_3d_AABB_updateMinMax);
|
|
|
|
tolua_function(L, "containPoint", axlua_3d_AABB_containPoint);
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_endmodule(L);
|
2022-08-08 18:02:17 +08:00
|
|
|
auto typeName = typeid(ax::AABB).name();
|
2022-07-12 21:31:54 +08:00
|
|
|
g_luaType[reinterpret_cast<uintptr_t>(typeName)] = "ax.AABB";
|
|
|
|
g_typeCast[typeName] = "ax.AABB";
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_reset(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_OBB_reset'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 0)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->reset();
|
|
|
|
lua_settop(L, 1);
|
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.OBB:reset", argc, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_OBB_reset'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_set(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_OBB_set'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 5)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg0;
|
|
|
|
ax::Vec3 arg1;
|
|
|
|
ax::Vec3 arg2;
|
|
|
|
ax::Vec3 arg3;
|
|
|
|
ax::Vec3 arg4;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.OBB:set");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 3, &arg1, "ax.OBB:set");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 4, &arg2, "ax.OBB:set");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 5, &arg3, "ax.OBB:set");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 6, &arg4, "ax.OBB:set");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->set(arg0, arg1, arg2, arg3, arg4);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.OBB:set", argc, 5);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_OBB_set'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_transform(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_OBB_transform'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Mat4 arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_mat4(L, 2, &arg0, "ax.OBB:transform");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->transform(arg0);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.OBB:transform", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_OBB_transform'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_containPoint(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_OBB_containPoint'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.OBB:containPoint");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
bool ret = cobj->containPoint(arg0);
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_pushboolean(L, (bool)ret);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.OBB:containPoint", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_OBB_containPoint'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_constructor(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::AABB* arg0;
|
|
|
|
ok &= luaval_to_object<ax::AABB>(L, 2, "ax.AABB", &arg0, "ax.OBB:OBB");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = new ax::OBB(*arg0);
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_pushusertype(L, (void*)cobj, "ax.OBB");
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_register_gc(L, lua_gettop(L));
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 0)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = new ax::OBB();
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_pushusertype(L, (void*)cobj, "ax.OBB");
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_register_gc(L, lua_gettop(L));
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
const ax::Vec3* arg0;
|
|
|
|
ok &= luaval_to_object<const ax::Vec3>(L, 2, "ax.Vec3", &arg0, "ax.OBB:OBB");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-11-23 20:27:39 +08:00
|
|
|
int arg1;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_int32(L, 3, (int*)&arg1, "ax.OBB:OBB");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = new ax::OBB(arg0, arg1);
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_pushusertype(L, (void*)cobj, "ax.OBB");
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_register_gc(L, lua_gettop(L));
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.OBB:OBB", argc, 2);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_OBB_constructor'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_intersects(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_OBB_intersects'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
if (1 == argc)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* arg0;
|
|
|
|
ok &= luaval_to_object<ax::OBB>(L, 2, "ax.OBB", &arg0, "ax.OBB:intersects");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
bool ret = self->intersects(*arg0);
|
|
|
|
tolua_pushboolean(L, ret);
|
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.OBB:intersects", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_OBB_intersects'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_OBB_center(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_OBB_center'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_center);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_OBB_center'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_OBB_center(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_OBB_center'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_center);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_OBB_center'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_OBB_xAxis(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_OBB_xAxis'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_xAxis);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_OBB_xAxis'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_OBB_xAxis(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_OBB_xAxis'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_xAxis);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_OBB_center'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_OBB_yAxis(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_OBB_yAxis'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_yAxis);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_OBB_yAxis'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_OBB_yAxis(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_OBB_yAxis'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_yAxis);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_OBB_yAxis'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_OBB_zAxis(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_OBB_zAxis'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_zAxis);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_OBB_zAxis'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_OBB_zAxis(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_OBB_zAxis'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_zAxis);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_OBB_zAxis'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_OBB_extents(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_OBB_extents'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_extents);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_OBB_extents'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_OBB_extents(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_OBB_extents'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_extents);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_OBB_extents'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_getCorners(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* cobj = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.OBB", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_OBB_getCorners'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3* arg0;
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
size_t len = lua_objlen(L, 2);
|
2021-12-25 10:04:45 +08:00
|
|
|
if (len == 0)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
|
|
|
luaL_error(L, "Table's len equal 0");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
arg0 = new ax::Vec3[len];
|
2021-12-25 10:04:45 +08:00
|
|
|
for (int i = 1; i <= len; i++)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pushnumber(L, i);
|
|
|
|
lua_gettable(L, 2);
|
2019-11-23 20:27:39 +08:00
|
|
|
if (lua_isnil(L, -1))
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
arg0[i - 1] = ax::Vec3(0, 0, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
luaval_to_vec3(L, -1, &arg0[i - 1], "ax.OBB:getCorners");
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
lua_pop(L, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
cobj->getCorners(arg0);
|
|
|
|
|
|
|
|
lua_newtable(L);
|
|
|
|
|
|
|
|
for (int i = 1; i <= len; i++)
|
|
|
|
{
|
|
|
|
lua_pushnumber(L, i);
|
|
|
|
vec3_to_luaval(L, arg0[i - 1]);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_SAFE_DELETE_ARRAY(arg0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.OBB:getCorners", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_OBB_getCorners'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_OBB_finalize(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* self = (ax::OBB*)tolua_tousertype(L, 1, 0);
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_SAFE_DELETE(self);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
int lua_register_axis_3d_OBB(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_usertype(L, "ax.OBB");
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_cclass(L, "OBB", "ax.OBB", "", axlua_3d_OBB_finalize);
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
tolua_beginmodule(L, "OBB");
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_variable(L, "_center", axlua_3d_get_OBB_center, axlua_3d_set_OBB_center);
|
|
|
|
tolua_variable(L, "_xAxis", axlua_3d_get_OBB_xAxis, axlua_3d_set_OBB_xAxis);
|
|
|
|
tolua_variable(L, "_yAxis", axlua_3d_get_OBB_yAxis, axlua_3d_set_OBB_yAxis);
|
|
|
|
tolua_variable(L, "_zAxis", axlua_3d_get_OBB_zAxis, axlua_3d_set_OBB_zAxis);
|
|
|
|
tolua_variable(L, "_extents", axlua_3d_get_OBB_extents, axlua_3d_set_OBB_extents);
|
|
|
|
tolua_function(L, "new", axlua_3d_OBB_constructor);
|
|
|
|
tolua_function(L, "reset", axlua_3d_OBB_reset);
|
|
|
|
tolua_function(L, "set", axlua_3d_OBB_set);
|
|
|
|
tolua_function(L, "transform", axlua_3d_OBB_transform);
|
|
|
|
tolua_function(L, "containPoint", axlua_3d_OBB_containPoint);
|
|
|
|
tolua_function(L, "intersects", axlua_3d_OBB_intersects);
|
|
|
|
tolua_function(L, "getCorners", axlua_3d_OBB_getCorners);
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_endmodule(L);
|
2022-08-08 18:02:17 +08:00
|
|
|
auto typeName = typeid(ax::OBB).name();
|
2022-07-12 21:31:54 +08:00
|
|
|
g_luaType[reinterpret_cast<uintptr_t>(typeName)] = "ax.OBB";
|
|
|
|
g_typeCast[typeName] = "ax.OBB";
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Ray_set(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Ray", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_Ray_set'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg0;
|
|
|
|
ax::Vec3 arg1;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.Ray:set");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 3, &arg1, "ax.Ray:set");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->set(arg0, arg1);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.Ray:set", argc, 2);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_Ray_set'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Ray_transform(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Ray", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!cobj)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'cobj' in function 'axlua_3d_Ray_transform'", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
2019-11-23 20:27:39 +08:00
|
|
|
if (argc == 1)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Mat4 arg0;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_mat4(L, 2, &arg0, "ax.Ray:transform");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
cobj->transform(arg0);
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.Ray:transform", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_Ray_transform'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Ray_intersects(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* self = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Ray", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_Ray_intersects'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
if (1 == argc)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::OBB* arg0 = nullptr;
|
|
|
|
ok &= luaval_to_object<ax::OBB>(L, 2, "ax.OBB", &arg0, "ax.Ray:intersects");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
if (!ok)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
float distance;
|
|
|
|
bool ret = self->intersects(*arg0, &distance);
|
|
|
|
tolua_pushboolean(L, ret);
|
|
|
|
tolua_pushnumber(L, (lua_Number)distance);
|
|
|
|
return 2;
|
|
|
|
}
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.Ray:intersects", argc, 1);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_Ray_intersects'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Ray_constructor(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* cobj = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
bool ok = true;
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
|
|
|
#endif
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 2)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg0;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 2, &arg0, "ax.Ray:Ray");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Vec3 arg1;
|
2022-07-12 21:31:54 +08:00
|
|
|
ok &= luaval_to_vec3(L, 3, &arg1, "ax.Ray:Ray");
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = new ax::Ray(arg0, arg1);
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_pushusertype(L, (void*)cobj, "ax.Ray");
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_register_gc(L, lua_gettop(L));
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (argc == 0)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
cobj = new ax::Ray();
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_pushusertype(L, (void*)cobj, "ax.Ray");
|
2021-12-25 10:04:45 +08:00
|
|
|
tolua_register_gc(L, lua_gettop(L));
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
} while (0);
|
|
|
|
ok = true;
|
2022-07-12 21:31:54 +08:00
|
|
|
luaL_error(L, "%s has wrong number of arguments: %d, was expecting %d \n", "ax.Ray:Ray", argc, 0);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_Ray_constructor'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_Ray_origin(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Ray", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_Ray_origin'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_origin);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_Ray_origin'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_Ray_origin(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Ray", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_Ray_origin'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_origin);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_Ray_origin'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_get_Ray_direction(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Ray", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_get_Ray_direction'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
vec3_to_luaval(L, self->_direction);
|
|
|
|
return 1;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_get_Ray_direction'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_set_Ray_direction(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
int argc = 0;
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* self = nullptr;
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_Error tolua_err;
|
2022-07-12 21:31:54 +08:00
|
|
|
if (!tolua_isusertype(L, 1, "ax.Ray", 0, &tolua_err))
|
2021-12-25 10:04:45 +08:00
|
|
|
goto tolua_lerror;
|
2019-11-23 20:27:39 +08:00
|
|
|
#endif
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
self = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (nullptr == self)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "invalid 'self' in function 'axlua_3d_set_Ray_direction'\n", nullptr);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
argc = lua_gettop(L) - 1;
|
|
|
|
|
|
|
|
if (1 == argc)
|
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
if (!tolua_istable(L, 2, 0, &tolua_err))
|
|
|
|
goto tolua_lerror;
|
|
|
|
#endif
|
|
|
|
luaval_to_vec3(L, 2, &self->_direction);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
#if _AX_DEBUG >= 1
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_lerror:
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_error(L, "#ferror in function 'axlua_3d_set_Ray_direction'.", &tolua_err);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
int axlua_3d_Ray_finalize(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-08 18:02:17 +08:00
|
|
|
ax::Ray* self = (ax::Ray*)tolua_tousertype(L, 1, 0);
|
2022-07-16 10:43:05 +08:00
|
|
|
AX_SAFE_DELETE(self);
|
2019-11-23 20:27:39 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-07-12 21:31:54 +08:00
|
|
|
int lua_register_axis_3d_Ray(lua_State* L)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_usertype(L, "ax.Ray");
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_cclass(L, "Ray", "ax.Ray", "", axlua_3d_Ray_finalize);
|
2021-12-25 10:04:45 +08:00
|
|
|
|
|
|
|
tolua_beginmodule(L, "Ray");
|
2022-08-08 18:02:17 +08:00
|
|
|
tolua_variable(L, "_origin", axlua_3d_get_Ray_origin, axlua_3d_set_Ray_origin);
|
|
|
|
tolua_variable(L, "_direction", axlua_3d_get_Ray_direction, axlua_3d_set_Ray_direction);
|
|
|
|
tolua_function(L, "new", axlua_3d_Ray_constructor);
|
|
|
|
tolua_function(L, "set", axlua_3d_Ray_set);
|
|
|
|
tolua_function(L, "transform", axlua_3d_Ray_transform);
|
|
|
|
tolua_function(L, "intersects", axlua_3d_Ray_intersects);
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_endmodule(L);
|
2022-08-08 18:02:17 +08:00
|
|
|
auto typeName = typeid(ax::Ray).name();
|
2022-07-12 21:31:54 +08:00
|
|
|
g_luaType[reinterpret_cast<uintptr_t>(typeName)] = "ax.Ray";
|
|
|
|
g_typeCast[typeName] = "ax.Ray";
|
2019-11-23 20:27:39 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int register_all_cocos3d_manual_class(lua_State* L)
|
|
|
|
{
|
2022-07-12 21:31:54 +08:00
|
|
|
tolua_module(L, "ax", 0);
|
|
|
|
tolua_beginmodule(L, "ax");
|
|
|
|
lua_register_axis_3d_AABB(L);
|
|
|
|
lua_register_axis_3d_OBB(L);
|
|
|
|
lua_register_axis_3d_Ray(L);
|
2019-11-23 20:27:39 +08:00
|
|
|
tolua_endmodule(L);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int register_cocos3d_module(lua_State* L)
|
|
|
|
{
|
|
|
|
lua_getglobal(L, "_G");
|
2021-12-25 10:04:45 +08:00
|
|
|
if (lua_istable(L, -1)) // stack:...,_G,
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2022-08-29 20:51:22 +08:00
|
|
|
register_all_ax_3d(L);
|
|
|
|
register_all_ax_3d_manual(L);
|
2019-11-23 20:27:39 +08:00
|
|
|
register_all_cocos3d_manual_class(L);
|
|
|
|
}
|
|
|
|
lua_pop(L, 1);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|