diff --git a/doc/tutorial/14_lol_lua.cpp b/doc/tutorial/14_lol_lua.cpp index 4c4d3d39..412795e5 100644 --- a/doc/tutorial/14_lol_lua.cpp +++ b/doc/tutorial/14_lol_lua.cpp @@ -44,7 +44,7 @@ public: return (stack << i).End(); } - LOLUA_DECLARE_RETURN_METHOD(AddTenInstance, GetPtr(), AddTenMethod, Get(), Get(), Get()); + LOLUA_DECLARE_RETURN_METHOD_ARGS(AddTenInstance, GetPtr(), AddTenMethod, Get(), Get(), Get()); static int _AddTenInstance(lua_State* l) { auto stack = LuaStack::Begin(l); @@ -75,7 +75,7 @@ public: return (stack << i).End(); } - LOLUA_DECLARE_VOID_METHOD(SetX, GetPtr(), SetXMethod, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(SetX, GetPtr(), SetXMethod, Get()); static int _SetX(lua_State* l) { auto stack = LuaStack::Begin(l); @@ -198,7 +198,7 @@ public: testvalue_num: %.2f, testvalue_int: %i, testvalue_uint: %i, testvalue_str: %s.\n", testvalue_num, testvalue_int, testvalue_uint, testvalue_str.C()); msg::info("Lua Vars: \ - function_return: %s, loluademo_return: %i, loluademo_inst_return: %.f, loluademo_getx: %i, loluademo_inst->m_x: %i.\n", + function_return: %s, loluademo_return: %i, loluademo_inst_return: %.2f, loluademo_getx: %i, loluademo_inst->m_x: %i.\n", function_return.C(), loluademo_return, loluademo_inst_return, loluademo_getx, loluademo_inst->m_x); #define /***/ _LOLUA_ARG_1(a00) (float)a00 diff --git a/src/easymesh/easymesh.h b/src/easymesh/easymesh.h index 8f93def3..31198e37 100644 --- a/src/easymesh/easymesh.h +++ b/src/easymesh/easymesh.h @@ -392,7 +392,11 @@ public: - offset : useless */ void AppendCog(int nbsides, float h, float d10, float d20, float d11, - float d21, float d12, float d22, float sidemul=0.f, bool offset=false); + float d21, float d12, float d22, float sidemul = 0.f, bool offset = false); + void AppendCog(int nbsides, float h, vec2 d0, vec2 d1, vec2 d2, float sidemul = 0.f, bool offset = false) + { + AppendCog(nbsides, h, d0.x, d0.y, d1.x, d1.y, d2.x, d2.y, sidemul, offset); + } //------------------------------------------------------------------------- //TODO : Mesh Bone operations diff --git a/src/easymesh/easymeshlua.cpp b/src/easymesh/easymeshlua.cpp index 4edd141c..3c932b47 100644 --- a/src/easymesh/easymeshlua.cpp +++ b/src/easymesh/easymeshlua.cpp @@ -89,7 +89,8 @@ EasyMeshLuaObject* EasyMeshLuaObject::New(lua_State* l, int arg_nb) //----------------------------------------------------------------------------- const LuaObjectLibrary* EasyMeshLuaObject::GetLib() { - typedef EasyMeshLuaObject EMLO; +#define EMLO EasyMeshLuaObject + static const LuaObjectLibrary lib = LuaObjectLibrary( "EasyMesh", //Statics @@ -181,6 +182,8 @@ const LuaObjectLibrary* EasyMeshLuaObject::GetLib() //Variables { { nullptr, nullptr, nullptr } }); return &lib; + +#undef EMLO } //----------------------------------------------------------------------------- diff --git a/src/easymesh/easymeshlua.h b/src/easymesh/easymeshlua.h index 5409fab3..6c786c55 100644 --- a/src/easymesh/easymeshlua.h +++ b/src/easymesh/easymeshlua.h @@ -29,589 +29,89 @@ public: static EasyMeshLuaObject* New(lua_State* l, int arg_nb); static const LuaObjectLibrary* GetLib(); - //------------------------------------------------------------------------- - static int AppendCylinder(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto nsides = s.Get(); - auto h = s.Get(); - auto d1 = s.Get(); - auto d2 = s.Get(); - auto dualside = s.Get(false); - auto smooth = s.Get(false); - auto close = s.Get(false); - m->m_instance.AppendCylinder(nsides, h, d1, d2, dualside, smooth, close); - return s.End(); - } - //LOLUA_DECLARE_VOID_METHOD(AppendSphere, GetPtr(), m_instance.AppendSphere, Get(), Get()); - static int AppendSphere(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto ndivisions = s.Get(); - auto d = s.Get(); - m->m_instance.AppendSphere(ndivisions, d); - return s.End(); - } +#define EMLO GetPtr() - static int AppendCapsule(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto ndivisions = s.Get(); - auto h = s.Get(); - auto d = s.Get(); - m->m_instance.AppendCapsule(ndivisions, h, d); - return s.End(); - } - static int AppendTorus(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto ndivisions = s.Get(); - auto d1 = s.Get(); - auto d2 = s.Get(); - m->m_instance.AppendTorus(ndivisions, d1, d2); - return s.End(); - } - static int AppendBox(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto size = s.Get(); - auto chamf = s.Get(0.f); - auto smooth = s.Get(false); - m->m_instance.AppendBox(size, chamf, smooth); - return s.End(); - } - static int AppendStar(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto nbranches = s.Get(); - auto d1 = s.Get(); - auto d2 = s.Get(); - auto fade = s.Get(false); - auto fade2 = s.Get(false); - m->m_instance.AppendStar(nbranches, d1, d2, fade, fade2); - return s.End(); - } - static int AppendExpandedStar(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto nbranches = s.Get(); - auto d1 = s.Get(); - auto d2 = s.Get(); - auto extrad = s.Get(0.f); - m->m_instance.AppendExpandedStar(nbranches, d1, d2, extrad); - return s.End(); - } - static int AppendDisc(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto nsides = s.Get(); - auto d = s.Get(); - auto fade = s.Get(false); - m->m_instance.AppendDisc(nsides, d, fade); - return s.End(); - } - static int AppendSimpleTriangle(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto d = s.Get(); - auto fade = s.Get(false); - m->m_instance.AppendSimpleTriangle(d, fade); - return s.End(); - } - static int AppendSimpleQuad(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto size = s.Get(); - auto fade = s.Get(false); - m->m_instance.AppendSimpleQuad(size, fade); - return s.End(); - } - static int AppendCog(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto nbsides = s.Get(); - auto h = s.Get(); - auto sidemul = s.Get(0.f); - auto d0 = s.Get(); - auto d1 = s.Get(); - auto d2 = s.Get(); - auto offset = s.Get(false); - m->m_instance.AppendCog(nbsides, h, d0.x, d0.y, d1.x, d1.y, d2.x, d2.y, sidemul, offset); - return s.End(); - } - //------------------------------------------------------------------------- - static int TranslateX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto f = s.Get(); - m->m_instance.TranslateX(f); - return s.End(); - } - static int TranslateY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto f = s.Get(); - m->m_instance.TranslateY(f); - return s.End(); - } - static int TranslateZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto f = s.Get(); - m->m_instance.TranslateZ(f); - return s.End(); - } - static int Translate(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto v = s.Get(); - m->m_instance.Translate(v); - return s.End(); - } - //------------------------------------------------------------------------- - static int RotateX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto a = s.Get(); - m->m_instance.RotateX(a); - return s.End(); - } - static int RotateY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto a = s.Get(); - m->m_instance.RotateY(a); - return s.End(); - } - static int RotateZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto a = s.Get(); - m->m_instance.RotateZ(a); - return s.End(); - } - static int Rotate(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto a = s.Get(); - auto v = s.Get(); - m->m_instance.Rotate(a, v); - return s.End(); - } - //------------------------------------------------------------------------- - static int ScaleX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto x = s.Get(); - m->m_instance.ScaleX(x); - return s.End(); - } - static int ScaleY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto y = s.Get(); - m->m_instance.ScaleY(y); - return s.End(); - } - static int ScaleZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto z = s.Get(); - m->m_instance.ScaleZ(z); - return s.End(); - } - static int Scale(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto v = s.Get(); - m->m_instance.Scale(v); - return s.End(); - } - //------------------------------------------------------------------------- - static int RadialJitter(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto f = s.Get(); - m->m_instance.RadialJitter(f); - return s.End(); - } - //------------------------------------------------------------------------- - static int TaperX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto y = s.Get(); - auto z = s.Get(); - auto xoff = s.Get(0.f); - auto abs = s.Get(true); - m->m_instance.TaperX(y, z, xoff, abs); - return s.End(); - } - static int TaperY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto x = s.Get(); - auto z = s.Get(); - auto yoff = s.Get(0.f); - auto abs = s.Get(true); - m->m_instance.TaperY(x, z, yoff, abs); - return s.End(); - } - static int TaperZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto x = s.Get(); - auto y = s.Get(); - auto zoff = s.Get(0.f); - auto abs = s.Get(true); - m->m_instance.TaperZ(x, y, zoff, abs); - return s.End(); - } - //------------------------------------------------------------------------- - static int TwistX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.TwistX(t, toff); - return s.End(); - } - static int TwistY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.TwistY(t, toff); - return s.End(); - } - static int TwistZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.TwistZ(t, toff); - return s.End(); - } - //------------------------------------------------------------------------- - static int ShearX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto y = s.Get(); - auto z = s.Get(); - auto xoff = s.Get(0.f); - auto abs = s.Get(true); - m->m_instance.ShearX(y, z, xoff, abs); - return s.End(); - } - static int ShearY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto x = s.Get(); - auto z = s.Get(); - auto yoff = s.Get(0.f); - auto abs = s.Get(true); - m->m_instance.ShearY(x, z, yoff, abs); - return s.End(); - } - static int ShearZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto x = s.Get(); - auto y = s.Get(); - auto zoff = s.Get(0.f); - auto abs = s.Get(true); - m->m_instance.ShearZ(x, y, zoff, abs); - return s.End(); - } //------------------------------------------------------------------------- - static int StretchX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto y = s.Get(); - auto z = s.Get(); - auto xoff = s.Get(0.f); - m->m_instance.StretchX(y, z, xoff); - return s.End(); - } - static int StretchY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto x = s.Get(); - auto z = s.Get(); - auto yoff = s.Get(0.f); - m->m_instance.StretchY(x, z, yoff); - return s.End(); - } - static int StretchZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto x = s.Get(); - auto y = s.Get(); - auto zoff = s.Get(0.f); - m->m_instance.StretchZ(x, y, zoff); - return s.End(); - } - //------------------------------------------------------------------------- - static int BendXY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.BendXY(t, toff); - return s.End(); - } - static int BendXZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.BendXZ(t, toff); - return s.End(); - } - static int BendYX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.BendYX(t, toff); - return s.End(); - } - static int BendYZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.BendYZ(t, toff); - return s.End(); - } - static int BendZX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.BendZX(t, toff); - return s.End(); - } - static int BendZY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto t = s.Get(); - auto toff = s.Get(0.f); - m->m_instance.BendZY(t, toff); - return s.End(); - } - //------------------------------------------------------------------------- - static int MirrorX(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.MirrorX(); - return s.End(); - } - static int MirrorY(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.MirrorY(); - return s.End(); - } - static int MirrorZ(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.MirrorZ(); - return s.End(); - } - //------------------------------------------------------------------------- - static int LoopStart(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto loopnb = s.Get(); - m->m_instance.LoopStart(loopnb); - return s.End(); - } - static int LoopEnd(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.LoopEnd(); - return s.End(); - } - static int OpenBrace(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.OpenBrace(); - return s.End(); - } - static int CloseBrace(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.CloseBrace(); - return s.End(); - } - //------------------------------------------------------------------------- - static int ToggleScaleWinding(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.ToggleScaleWinding(); - return s.End(); - } - static int ToggleQuadWeighting(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.ToggleQuadWeighting(); - return s.End(); - } - static int TogglePostBuildNormal(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.TogglePostBuildNormal(); - return s.End(); - } - static int ToggleVerticeNoCleanup(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.ToggleVerticeNoCleanup(); - return s.End(); - } - //------------------------------------------------------------------------- - static int VerticesMerge(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.VerticesMerge(); - return s.End(); - } - static int VerticesSeparate(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.VerticesSeparate(); - return s.End(); - } - static int VerticesCleanup(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - m->m_instance.VerticesCleanup(); - return s.End(); - } - //------------------------------------------------------------------------- - static int Duplicate(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto ds = s.Get(vec3(1.f)); - m->m_instance.DupAndScale(ds, true); - return s.End(); - } - static int Smooth(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto pass = s.Get(); - auto split_per_pass = s.Get(); - auto smooth_per_pass = s.Get(); - m->m_instance.SmoothMesh(pass, split_per_pass, smooth_per_pass); - return s.End(); - } - static int SplitTriangles(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto pass = s.Get(); - m->m_instance.SplitTriangles(pass); - return s.End(); - } - static int Chamfer(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto f = s.Get(); - m->m_instance.Chamfer(f); - return s.End(); - } - //------------------------------------------------------------------------- - static int SetCurColor(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto c = s.Get(); - m->m_instance.SetCurColor(c); - return s.End(); - } - static int SetCurColorA(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto c = s.Get(); - m->m_instance.SetCurColorA(c); - return s.End(); - } - static int SetCurColorB(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto c = s.Get(); - m->m_instance.SetCurColorB(c); - return s.End(); - } - static int SetVertColor(lua_State* l) - { - auto s = LuaStack::Begin(l); - auto m = s.GetPtr(); - auto c = s.Get(); - m->m_instance.SetVertColor(c); - return s.End(); - } + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendCylinder, EMLO, m_instance.AppendCylinder, Get(), Get(), Get(), Get(), Get(false), Get(false), Get(false)); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendSphere, EMLO, m_instance.AppendSphere, Get(), Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendCapsule, EMLO, m_instance.AppendCapsule, Get(), Get(), Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendTorus, EMLO, m_instance.AppendTorus, Get(), Get(), Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendBox, EMLO, m_instance.AppendBox, Get(), Get(0.f), Get(false)); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendStar, EMLO, m_instance.AppendStar, Get(), Get(), Get(), Get(false), Get(false)); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendExpandedStar, EMLO, m_instance.AppendExpandedStar, Get(), Get(), Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendDisc, EMLO, m_instance.AppendDisc, Get(), Get(), Get(false)); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendSimpleTriangle, EMLO, m_instance.AppendSimpleTriangle, Get(), Get(false)); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendSimpleQuad, EMLO, m_instance.AppendSimpleQuad, Get(), Get(false)); + LOLUA_DECLARE_VOID_METHOD_ARGS(AppendCog, EMLO, m_instance.AppendCog, Get(), Get(), Get(), Get(), Get(), Get(0.f), Get(false)); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(TranslateX, EMLO, m_instance.TranslateX, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(TranslateY, EMLO, m_instance.TranslateY, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(TranslateZ, EMLO, m_instance.TranslateZ, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(Translate, EMLO, m_instance.Translate, Get()); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(RotateX, EMLO, m_instance.RotateX, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(RotateY, EMLO, m_instance.RotateY, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(RotateZ, EMLO, m_instance.RotateZ, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(Rotate, EMLO, m_instance.Rotate, Get(), Get()); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(ScaleX, EMLO, m_instance.ScaleX, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(ScaleY, EMLO, m_instance.ScaleY, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(ScaleZ, EMLO, m_instance.ScaleZ, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(Scale, EMLO, m_instance.Scale, Get()); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(RadialJitter, EMLO, m_instance.RadialJitter, Get()); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(TaperX, EMLO, m_instance.TaperX, Get(), Get(), Get(0.f), Get(true)); + LOLUA_DECLARE_VOID_METHOD_ARGS(TaperY, EMLO, m_instance.TaperY, Get(), Get(), Get(0.f), Get(true)); + LOLUA_DECLARE_VOID_METHOD_ARGS(TaperZ, EMLO, m_instance.TaperZ, Get(), Get(), Get(0.f), Get(true)); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(TwistX, EMLO, m_instance.TwistX, Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(TwistY, EMLO, m_instance.TwistY, Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(TwistZ, EMLO, m_instance.TwistZ, Get(), Get(0.f)); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(ShearX, EMLO, m_instance.ShearX, Get(), Get(), Get(0.f), Get(true)); + LOLUA_DECLARE_VOID_METHOD_ARGS(ShearY, EMLO, m_instance.ShearY, Get(), Get(), Get(0.f), Get(true)); + LOLUA_DECLARE_VOID_METHOD_ARGS(ShearZ, EMLO, m_instance.ShearZ, Get(), Get(), Get(0.f), Get(true)); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(StretchX, EMLO, m_instance.StretchX, Get(), Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(StretchY, EMLO, m_instance.StretchY, Get(), Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(StretchZ, EMLO, m_instance.StretchZ, Get(), Get(), Get(0.f)); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(BendXY, EMLO, m_instance.BendXY, Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(BendXZ, EMLO, m_instance.BendXZ, Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(BendYX, EMLO, m_instance.BendYX, Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(BendYZ, EMLO, m_instance.BendYZ, Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(BendZX, EMLO, m_instance.BendZX, Get(), Get(0.f)); + LOLUA_DECLARE_VOID_METHOD_ARGS(BendZY, EMLO, m_instance.BendZY, Get(), Get(0.f)); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_VOID(MirrorX, EMLO, m_instance.MirrorX); + LOLUA_DECLARE_VOID_METHOD_VOID(MirrorY, EMLO, m_instance.MirrorY); + LOLUA_DECLARE_VOID_METHOD_VOID(MirrorZ, EMLO, m_instance.MirrorZ); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(LoopStart, EMLO, m_instance.LoopStart, Get()); + LOLUA_DECLARE_VOID_METHOD_VOID(LoopEnd, EMLO, m_instance.LoopEnd); + LOLUA_DECLARE_VOID_METHOD_VOID(OpenBrace, EMLO, m_instance.OpenBrace, Get()); + LOLUA_DECLARE_VOID_METHOD_VOID(CloseBrace, EMLO, m_instance.CloseBrace, Get()); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_VOID(ToggleScaleWinding, EMLO, m_instance.ToggleScaleWinding); + LOLUA_DECLARE_VOID_METHOD_VOID(ToggleQuadWeighting, EMLO, m_instance.ToggleQuadWeighting); + LOLUA_DECLARE_VOID_METHOD_VOID(TogglePostBuildNormal, EMLO, m_instance.TogglePostBuildNormal); + LOLUA_DECLARE_VOID_METHOD_VOID(ToggleVerticeNoCleanup, EMLO, m_instance.ToggleVerticeNoCleanup); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_VOID(VerticesMerge, EMLO, m_instance.VerticesMerge); + LOLUA_DECLARE_VOID_METHOD_VOID(VerticesSeparate, EMLO, m_instance.VerticesSeparate); + LOLUA_DECLARE_VOID_METHOD_VOID(VerticesCleanup, EMLO, m_instance.VerticesCleanup); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(Duplicate, EMLO, m_instance.DupAndScale, Get(vec3(1.f)), Get(true)); + LOLUA_DECLARE_VOID_METHOD_ARGS(Smooth, EMLO, m_instance.SmoothMesh, Get(), Get(), Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(SplitTriangles, EMLO, m_instance.SplitTriangles, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(Chamfer, EMLO, m_instance.Chamfer, Get()); + //------------------------------------------------------------------------- + LOLUA_DECLARE_VOID_METHOD_ARGS(SetCurColor, EMLO, m_instance.SetCurColor, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(SetCurColorA, EMLO, m_instance.SetCurColorA, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(SetCurColorB, EMLO, m_instance.SetCurColorB, Get()); + LOLUA_DECLARE_VOID_METHOD_ARGS(SetVertColor, EMLO, m_instance.SetVertColor, Get()); + /* (csgu|csgunion) { return token::T_CSGUNION; } (csgs|CsgSub) { return token::T_CSGSUBSTRACT; } @@ -620,6 +120,7 @@ public: (csgx|csgxor) { return token::T_CSGXOR; } */ + #undef EMLO }; //----------------------------------------------------------------------------- diff --git a/src/lolua/baselua.h b/src/lolua/baselua.h index bf5d25c6..ca30fa35 100644 --- a/src/lolua/baselua.h +++ b/src/lolua/baselua.h @@ -437,18 +437,39 @@ private: //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -#define LOLUA_DECLARE_VOID_METHOD(LUA_FUNC_NAME, INSTANCE_GET, INSTANCE_CALL, ...) \ +#define LOLUA_DECLARE_BEGIN(LUA_FUNC_NAME, INSTANCE_GET) \ static int LUA_FUNC_NAME(lua_State* l) \ { \ auto s = LuaStack::Begin(l); \ - auto o = s.INSTANCE_GET; \ - LOL_CALL(LOL_CAT(LOLUA_VAR_, LOL_CALL(LOL_COUNT_TO_12, (__VA_ARGS__))), (__VA_ARGS__)) \ - o->INSTANCE_CALL(LOL_CALL(LOL_CAT(LOLUA_ARG_, LOL_CALL(LOL_COUNT_TO_12, (__VA_ARGS__))), (__VA_ARGS__))); \ + auto o = s.INSTANCE_GET; + +#define LOLUA_DECLARE_VARS(...) \ + LOL_CALL(LOL_CAT(LOLUA_VAR_, LOL_CALL(LOL_COUNT_TO_12, (__VA_ARGS__))), (__VA_ARGS__)); + +#define LOLUA_DECLARE_CALL(INSTANCE_CALL, ...) \ + o->INSTANCE_CALL(LOL_CALL(LOL_CAT(LOLUA_ARG_, LOL_CALL(LOL_COUNT_TO_12, (__VA_ARGS__))), (__VA_ARGS__))); + +#define LOLUA_DECLARE_CALL_VOID(INSTANCE_CALL) \ + o->INSTANCE_CALL(); + +#define LOLUA_DECLARE_END \ return s.End(); \ } //----------------------------------------------------------------------------- -#define LOLUA_DECLARE_RETURN_METHOD(LUA_FUNC_NAME, INSTANCE_GET, INSTANCE_CALL, ...) \ +#define LOLUA_DECLARE_VOID_METHOD_VOID(LUA_FUNC_NAME, INSTANCE_GET, INSTANCE_CALL, ...) \ + LOLUA_DECLARE_BEGIN(LUA_FUNC_NAME, INSTANCE_GET); \ + LOLUA_DECLARE_CALL_VOID(INSTANCE_CALL) \ + LOLUA_DECLARE_END + +#define LOLUA_DECLARE_VOID_METHOD_ARGS(LUA_FUNC_NAME, INSTANCE_GET, INSTANCE_CALL, ...) \ + LOLUA_DECLARE_BEGIN(LUA_FUNC_NAME, INSTANCE_GET); \ + LOLUA_DECLARE_VARS(__VA_ARGS__) \ + LOLUA_DECLARE_CALL(INSTANCE_CALL, __VA_ARGS__) \ + LOLUA_DECLARE_END + +//----------------------------------------------------------------------------- +#define LOLUA_DECLARE_RETURN_METHOD_ARGS(LUA_FUNC_NAME, INSTANCE_GET, INSTANCE_CALL, ...) \ static int LUA_FUNC_NAME(lua_State* l) \ { \ auto s = LuaStack::Begin(l); \