#include "Base.h" #include "ScriptController.h" #include "lua_MeshSkin.h" #include "Animation.h" #include "AnimationTarget.h" #include "Base.h" #include "Game.h" #include "Joint.h" #include "MeshSkin.h" #include "Node.h" #include "ScriptListener.h" #include "Transform.h" #include "lua_CurveInterpolationType.h" namespace gameplay { void luaRegister_MeshSkin() { const luaL_Reg lua_members[] = { {"getBindShape", lua_MeshSkin_getBindShape}, {"getJoint", lua_MeshSkin_getJoint}, {"getJointCount", lua_MeshSkin_getJointCount}, {"getJointIndex", lua_MeshSkin_getJointIndex}, {"getMatrixPalette", lua_MeshSkin_getMatrixPalette}, {"getMatrixPaletteSize", lua_MeshSkin_getMatrixPaletteSize}, {"getModel", lua_MeshSkin_getModel}, {"getRootJoint", lua_MeshSkin_getRootJoint}, {"setBindShape", lua_MeshSkin_setBindShape}, {"setRootJoint", lua_MeshSkin_setRootJoint}, {"transformChanged", lua_MeshSkin_transformChanged}, {NULL, NULL} }; const luaL_Reg* lua_statics = NULL; std::vector scopePath; ScriptUtil::registerClass("MeshSkin", lua_members, NULL, NULL, lua_statics, scopePath); } static MeshSkin* getInstance(lua_State* state) { void* userdata = luaL_checkudata(state, 1, "MeshSkin"); luaL_argcheck(state, userdata != NULL, 1, "'MeshSkin' expected."); return (MeshSkin*)((ScriptUtil::LuaObject*)userdata)->instance; } int lua_MeshSkin_getBindShape(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { MeshSkin* instance = getInstance(state); void* returnPtr = (void*)&(instance->getBindShape()); if (returnPtr) { ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Matrix"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } else { lua_pushstring(state, "lua_MeshSkin_getBindShape - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_getJoint(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TUSERDATA) && lua_type(state, 2) == LUA_TNUMBER) { // Get parameter 1 off the stack. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2); MeshSkin* instance = getInstance(state); void* returnPtr = (void*)instance->getJoint(param1); if (returnPtr) { ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Joint"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } else if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL)) { // Get parameter 1 off the stack. const char* param1 = ScriptUtil::getString(2, false); MeshSkin* instance = getInstance(state); void* returnPtr = (void*)instance->getJoint(param1); if (returnPtr) { ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Joint"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } else { lua_pushstring(state, "lua_MeshSkin_getJoint - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_getJointCount(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { MeshSkin* instance = getInstance(state); unsigned int result = instance->getJointCount(); // Push the return value onto the stack. lua_pushunsigned(state, result); return 1; } else { lua_pushstring(state, "lua_MeshSkin_getJointCount - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_getJointIndex(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL)) { // Get parameter 1 off the stack. Joint* param1 = ScriptUtil::getObjectPointer(2, "Joint", false); MeshSkin* instance = getInstance(state); int result = instance->getJointIndex(param1); // Push the return value onto the stack. lua_pushinteger(state, result); return 1; } else { lua_pushstring(state, "lua_MeshSkin_getJointIndex - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_getMatrixPalette(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { MeshSkin* instance = getInstance(state); void* returnPtr = (void*)instance->getMatrixPalette(); if (returnPtr) { ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Vector4"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } else { lua_pushstring(state, "lua_MeshSkin_getMatrixPalette - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_getMatrixPaletteSize(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { MeshSkin* instance = getInstance(state); unsigned int result = instance->getMatrixPaletteSize(); // Push the return value onto the stack. lua_pushunsigned(state, result); return 1; } else { lua_pushstring(state, "lua_MeshSkin_getMatrixPaletteSize - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_getModel(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { MeshSkin* instance = getInstance(state); void* returnPtr = (void*)instance->getModel(); if (returnPtr) { ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Model"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } else { lua_pushstring(state, "lua_MeshSkin_getModel - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_getRootJoint(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 1: { if ((lua_type(state, 1) == LUA_TUSERDATA)) { MeshSkin* instance = getInstance(state); void* returnPtr = (void*)instance->getRootJoint(); if (returnPtr) { ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject)); object->instance = returnPtr; object->owns = false; luaL_getmetatable(state, "Joint"); lua_setmetatable(state, -2); } else { lua_pushnil(state); } return 1; } else { lua_pushstring(state, "lua_MeshSkin_getRootJoint - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 1)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_setBindShape(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA)) { // Get parameter 1 off the stack. float* param1 = ScriptUtil::getFloatPointer(2); MeshSkin* instance = getInstance(state); instance->setBindShape(param1); return 0; } else { lua_pushstring(state, "lua_MeshSkin_setBindShape - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_setRootJoint(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 2: { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL)) { // Get parameter 1 off the stack. Joint* param1 = ScriptUtil::getObjectPointer(2, "Joint", false); MeshSkin* instance = getInstance(state); instance->setRootJoint(param1); return 0; } else { lua_pushstring(state, "lua_MeshSkin_setRootJoint - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 2)."); lua_error(state); break; } } return 0; } int lua_MeshSkin_transformChanged(lua_State* state) { // Get the number of parameters. int paramCount = lua_gettop(state); // Attempt to match the parameters to a valid binding. switch (paramCount) { case 3: { if ((lua_type(state, 1) == LUA_TUSERDATA) && (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) && lua_type(state, 3) == LUA_TNUMBER) { // Get parameter 1 off the stack. Transform* param1 = ScriptUtil::getObjectPointer(2, "Transform", false); // Get parameter 2 off the stack. long param2 = (long)luaL_checklong(state, 3); MeshSkin* instance = getInstance(state); instance->transformChanged(param1, param2); return 0; } else { lua_pushstring(state, "lua_MeshSkin_transformChanged - Failed to match the given parameters to a valid function signature."); lua_error(state); } break; } default: { lua_pushstring(state, "Invalid number of parameters (expected 3)."); lua_error(state); break; } } return 0; } }