@@ -27,26 +27,33 @@ class EasyMeshTutorial : public WorldEntity | |||
public: | |||
EasyMeshTutorial() | |||
{ | |||
m_gears.Push(EasyMesh(), mat4(1.0f), 0.0f); | |||
m_gears.Push(EasyMesh(), mat4(1.0f), 0.0f); | |||
m_gears.Push(EasyMesh(), mat4(1.0f), 180.0f / 18); | |||
m_gears.Push(EasyMesh(), mat4(1.0f), 180.0f / 18); | |||
m_gears.Push(EasyMesh(), mat4(1.0f), 180.0f / 18); | |||
EasyMeshLuaLoader EzMhLoader; | |||
EzMhLoader.ExecLua("05_easymesh.lua"); | |||
EasyMeshLuaObject* gears0 = EzMhLoader.GetPtr<EasyMeshLuaObject>("g0"); | |||
EasyMeshLuaObject* gears1 = EzMhLoader.GetPtr<EasyMeshLuaObject>("g1"); | |||
EasyMeshLuaObject* gears2 = EzMhLoader.GetPtr<EasyMeshLuaObject>("g2"); | |||
EasyMeshLuaObject* gears3 = EzMhLoader.GetPtr<EasyMeshLuaObject>("g3"); | |||
EasyMeshLuaObject* gears4 = EzMhLoader.GetPtr<EasyMeshLuaObject>("g4"); | |||
m_gears.Push(gears0->GetMesh(), mat4(1.0f), 0.0f); | |||
m_gears.Push(gears1->GetMesh(), mat4(1.0f), 0.0f); | |||
m_gears.Push(gears2->GetMesh(), mat4(1.0f), 180.0f / 18); | |||
m_gears.Push(gears3->GetMesh(), mat4(1.0f), 180.0f / 18); | |||
m_gears.Push(gears4->GetMesh(), mat4(1.0f), 180.0f / 18); | |||
/* | |||
m_gears[0].m1.Compile("[sc#00f ab 8 1 8 ty -.25]" | |||
"[sc#f9f scb#f9f acg 12 10 5 5 20 20 5 5 0.1 0 s .1 .1 .1 ty -.1 csgu]" | |||
"[sc#fff scb#000 acg 12 10 10 10 20 20 5 5 0.1 0 s .05 .05 .05 tx -1.5 ty .3 csgu]" | |||
"[sc#00f ab 5 3 9 tx 2.5 csgs]" | |||
"[[ sc#fff ab 3 1.4 2 tx -2 tz -2 " | |||
"[sc#fff ab 2.1 .7 1.1 ty .5 tx -1.4 tz -1.4 csgs] mz] csgu]"); | |||
//m_gears[0].m1.Compile("[sc#f9f scb#f9f acg 12 10 5 5 20 20 5 5 0.1 0 s .1 .1 .1 [sc#00f ab 3 1 2 ty .25 tx 1 csgs]]"); | |||
m_gears[1].m1.Compile("sc#ff9 scb#ff9 acg 54 10 95 95 90 90 -5 -5 0.1 0 s .1 .1 .1"); | |||
//m_gears[2].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1 [sc#00f scb#00f ab 2 2 2 tx 1.5]"); | |||
//m_gears[3].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1 [sc#00f scb#00f ab 2 2 2 tx 1.5]"); | |||
//m_gears[4].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1 [sc#00f scb#00f ab 2 2 2 tx 1.5]"); | |||
m_gears[2].m1.Compile("[sc#0f0 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#00f ab 2 2 2 tx 0 csgu]]"); | |||
m_gears[3].m1.Compile("[sc#0f0 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#00f ab 2 2 2 tx 0 csgs]]"); | |||
m_gears[4].m1.Compile("[sc#0f0 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#00f ab 2 2 2 tx 0 csga]]"); | |||
*/ | |||
m_angle = 0; | |||
@@ -0,0 +1,81 @@ | |||
do_g0 = false | |||
do_g1 = false | |||
do_g2 = true | |||
do_g3 = true | |||
do_g4 = true | |||
-- Gear 0: New style | |||
g0 = EasyMesh.New(); | |||
if do_g0 then | |||
g0:BraceOpen() | |||
g0:SetColor("#00f") | |||
g0:AddBox(8, 1, 8) | |||
g0:TranslateY(-.25) | |||
g0:BraceClose() | |||
g0:BraceOpen() | |||
g0:SetColor("#f9f") | |||
g0:SetColorB("#f9f") | |||
g0:AddCog(12, 10, 5, 5, 20, 20, 5, 5, 0.1, 0) | |||
g0:Scale(.1) | |||
g0:TranslateY(-.1) | |||
-- csgu | |||
g0:BraceClose() | |||
g0:BraceOpen() | |||
g0:SetColor("#fff") | |||
g0:SetColorB("#000") | |||
g0:AddCog(12, 10, 10, 10, 20, 20, 5, 5, 0.1, 0) | |||
g0:Scale(.05) | |||
g0:TranslateX(-1.5) | |||
g0:TranslateY(.3) | |||
-- csgu | |||
g0:BraceClose() | |||
g0:BraceOpen() | |||
g0:SetColor("#00f") | |||
g0:AddBox(5, 3, 9) | |||
g0:TranslateX(2.5) | |||
-- csgs | |||
g0:BraceClose() | |||
g0:BraceOpen() | |||
g0:BraceOpen() | |||
g0:SetColor("#fff") | |||
g0:AddBox(3, 1.4, 2) | |||
g0:TranslateX(-2) | |||
g0:TranslateZ(-2) | |||
g0:BraceOpen() | |||
g0:SetColor("#fff") | |||
g0:AddBox(2.1, .7, 1.1) | |||
g0:TranslateY(.5) | |||
g0:TranslateX(-1.4) | |||
g0:TranslateZ(-1.4) | |||
-- csgs | |||
g0:BraceClose() | |||
g0:MirrorZ() | |||
g0:BraceClose() | |||
-- csgu | |||
g0:BraceClose() | |||
end | |||
-- Gear 1: Old style | |||
g1 = EasyMesh.New(); | |||
if do_g1 then | |||
g1:sc("#ff9"); g1:scb("#ff9"); g1:acog(54, 10, 95, 95, 90, 90, -5, -5, 0.1, 0); g1:s(.1); | |||
end | |||
-- Other Gears | |||
g2 = EasyMesh.New(); | |||
if do_g2 then | |||
g2:bop(); g2:sc("#0f0"); g2:ab(2, 2, 2); g2:t(.8); g2:rx(20); g2:ry(20); g2:bop(); g2:sc("#00f"); g2:ab(2); g2:tx(0); --csgu | |||
g2:bcl(); g2:bcl(); | |||
end | |||
g3 = EasyMesh.New(); | |||
if do_g3 then | |||
g3:bop(); g3:sc("#0f0"); g3:ab(2); g3:t(.8); g3:rx(20); g3:ry(20); g3:bop(); g3:sc("#00f"); g3:ab(2); g3:tx(0); --csgs | |||
g3:bcl(); g3:bcl(); | |||
end | |||
g4 = EasyMesh.New(); | |||
if do_g4 then | |||
g3:bop(); g3:sc("#0f0"); g3:ab(2); g3:t(.8); g3:rx(20); g3:ry(20); g3:bop(); g3:sc("#00f"); g3:ab(2); g3:tx(0); --csga | |||
g3:bcl(); g3:bcl(); | |||
end |
@@ -1,71 +1,76 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<ItemGroup Label="ProjectConfigurations"> | |||
<ProjectConfiguration Include="Debug|ORBIS"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>ORBIS</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|Win32"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>Win32</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|x64"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>x64</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|Xbox 360"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>Xbox 360</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|ORBIS"> | |||
<Configuration>Release</Configuration> | |||
<Platform>ORBIS</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|Win32"> | |||
<Configuration>Release</Configuration> | |||
<Platform>Win32</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|x64"> | |||
<Configuration>Release</Configuration> | |||
<Platform>x64</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|Xbox 360"> | |||
<Configuration>Release</Configuration> | |||
<Platform>Xbox 360</Platform> | |||
</ProjectConfiguration> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClCompile Include="05_easymesh.cpp" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="$(SolutionDir)\..\src\lolcore.vcxproj"> | |||
<Project>{9e62f2fe-3408-4eae-8238-fd84238ceeda}</Project> | |||
</ProjectReference> | |||
<ProjectReference Include="$(SolutionDir)\..\src\bullet\lolbullet.vcxproj"> | |||
<Project>{83d3b207-c601-4025-8f41-01dedc354661}</Project> | |||
</ProjectReference> | |||
<ProjectReference Include="$(SolutionDir)\..\src\lua\lollua.vcxproj"> | |||
<Project>{d84021ca-b233-4e0f-8a52-071b83bbccc4}</Project> | |||
</ProjectReference> | |||
</ItemGroup> | |||
<PropertyGroup Label="Globals"> | |||
<ProjectGuid>{1c5b8702-290c-42da-aa9e-671348f5b747}</ProjectGuid> | |||
<ConfigurationType>Application</ConfigurationType> | |||
<Keyword>Win32Proj</Keyword> | |||
</PropertyGroup> | |||
<Import Project="$(SolutionDir)\msbuild\lol.config.props" /> | |||
<ImportGroup Label="ExtensionSettings"> | |||
<Import Project="$(SolutionDir)\msbuild\lolfx.props" /> | |||
</ImportGroup> | |||
<ImportGroup Label="PropertySheets"> | |||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |||
<Import Project="$(SolutionDir)\msbuild\lol.vars.props" /> | |||
</ImportGroup> | |||
<PropertyGroup Label="UserMacros" /> | |||
<Import Project="$(SolutionDir)\msbuild\lol.rules.props" /> | |||
<ItemDefinitionGroup /> | |||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |||
<ImportGroup Label="ExtensionTargets"> | |||
<Import Project="$(SolutionDir)\msbuild\lolfx.targets" /> | |||
</ImportGroup> | |||
</Project> | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
<ItemGroup Label="ProjectConfigurations"> | |||
<ProjectConfiguration Include="Debug|ORBIS"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>ORBIS</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|Win32"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>Win32</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|x64"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>x64</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Debug|Xbox 360"> | |||
<Configuration>Debug</Configuration> | |||
<Platform>Xbox 360</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|ORBIS"> | |||
<Configuration>Release</Configuration> | |||
<Platform>ORBIS</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|Win32"> | |||
<Configuration>Release</Configuration> | |||
<Platform>Win32</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|x64"> | |||
<Configuration>Release</Configuration> | |||
<Platform>x64</Platform> | |||
</ProjectConfiguration> | |||
<ProjectConfiguration Include="Release|Xbox 360"> | |||
<Configuration>Release</Configuration> | |||
<Platform>Xbox 360</Platform> | |||
</ProjectConfiguration> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ClCompile Include="05_easymesh.cpp" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="$(SolutionDir)\..\src\lolcore.vcxproj"> | |||
<Project>{9e62f2fe-3408-4eae-8238-fd84238ceeda}</Project> | |||
</ProjectReference> | |||
<ProjectReference Include="$(SolutionDir)\..\src\bullet\lolbullet.vcxproj"> | |||
<Project>{83d3b207-c601-4025-8f41-01dedc354661}</Project> | |||
</ProjectReference> | |||
<ProjectReference Include="$(SolutionDir)\..\src\lua\lollua.vcxproj"> | |||
<Project>{d84021ca-b233-4e0f-8a52-071b83bbccc4}</Project> | |||
</ProjectReference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Include="05_easymesh.lua"> | |||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> | |||
</None> | |||
</ItemGroup> | |||
<PropertyGroup Label="Globals"> | |||
<ProjectGuid>{1c5b8702-290c-42da-aa9e-671348f5b747}</ProjectGuid> | |||
<ConfigurationType>Application</ConfigurationType> | |||
<Keyword>Win32Proj</Keyword> | |||
</PropertyGroup> | |||
<Import Project="$(SolutionDir)\msbuild\lol.config.props" /> | |||
<ImportGroup Label="ExtensionSettings"> | |||
<Import Project="$(SolutionDir)\msbuild\lolfx.props" /> | |||
</ImportGroup> | |||
<ImportGroup Label="PropertySheets"> | |||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |||
<Import Project="$(SolutionDir)\msbuild\lol.vars.props" /> | |||
</ImportGroup> | |||
<PropertyGroup Label="UserMacros" /> | |||
<Import Project="$(SolutionDir)\msbuild\lol.rules.props" /> | |||
<ItemDefinitionGroup /> | |||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |||
<ImportGroup Label="ExtensionTargets"> | |||
<Import Project="$(SolutionDir)\msbuild\lolfx.targets" /> | |||
</ImportGroup> | |||
</Project> |
@@ -493,7 +493,7 @@ public: | |||
array<vec2, vec2> m_texcoord_custom_build2[MeshType::MAX]; | |||
uint32_t m_texcoord_build_type[MeshType::MAX]; | |||
uint32_t m_texcoord_build_type2[MeshType::MAX]; | |||
uint32_t m_build_flags; | |||
uint32_t m_build_flags = MeshBuildOperation::PreventVertCleanup; | |||
}; | |||
//VDictType -- A safe enum for VertexDictionnary operations. ------------------ | |||
@@ -57,91 +57,93 @@ EasyMeshLuaObject* EasyMeshLuaObject::New(LuaState* l, int arg_nb) | |||
//----------------------------------------------------------------------------- | |||
const LuaObjectLib* EasyMeshLuaObject::GetLib() | |||
{ | |||
typedef EasyMeshLuaObject EMLO; | |||
static const LuaObjectLib lib = LuaObjectLib( | |||
"EasyMesh", | |||
//Statics | |||
{ /*{ nullptr, nullptr }*/ }, | |||
{ { nullptr, nullptr } }, | |||
//Methods | |||
{ | |||
//----------------------------------------------------------------- | |||
{ "AddCylinder", &AppendCylinder }, { "ac", &AppendCylinder }, | |||
{ "AddSphere", &AppendSphere }, { "asph", &AppendSphere }, | |||
{ "AddCapsule", &AppendCapsule }, { "acap", &AppendCapsule }, | |||
{ "AddTorus", &AppendTorus }, { "ato", &AppendTorus }, | |||
{ "AddBox", &AppendBox }, { "ab", &AppendBox }, | |||
{ "AddStar", &AppendStar }, { "as", &AppendStar }, | |||
{ "AddExpandedStar", &AppendExpandedStar }, { "aes", &AppendExpandedStar }, | |||
{ "AddDisc", &AppendDisc }, { "ad", &AppendDisc }, | |||
{ "AddTriangle", &AppendSimpleTriangle }, { "at", &AppendSimpleTriangle }, | |||
{ "AddQuad", &AppendSimpleQuad }, { "aq", &AppendSimpleQuad }, | |||
{ "AddCog", &AppendCog }, { "acog", &AppendCog }, | |||
{ "AddCylinder", &EMLO::AppendCylinder }, { "ac", &EMLO::AppendCylinder }, | |||
{ "AddSphere", &EMLO::AppendSphere }, { "asph", &EMLO::AppendSphere }, | |||
{ "AddCapsule", &EMLO::AppendCapsule }, { "acap", &EMLO::AppendCapsule }, | |||
{ "AddTorus", &EMLO::AppendTorus }, { "ato", &EMLO::AppendTorus }, | |||
{ "AddBox", &EMLO::AppendBox }, { "ab", &EMLO::AppendBox }, | |||
{ "AddStar", &EMLO::AppendStar }, { "as", &EMLO::AppendStar }, | |||
{ "AddExpandedStar", &EMLO::AppendExpandedStar }, { "aes", &EMLO::AppendExpandedStar }, | |||
{ "AddDisc", &EMLO::AppendDisc }, { "ad", &EMLO::AppendDisc }, | |||
{ "AddTriangle", &EMLO::AppendSimpleTriangle }, { "at", &EMLO::AppendSimpleTriangle }, | |||
{ "AddQuad", &EMLO::AppendSimpleQuad }, { "aq", &EMLO::AppendSimpleQuad }, | |||
{ "AddCog", &EMLO::AppendCog }, { "acog", &EMLO::AppendCog }, | |||
//----------------------------------------------------------------- | |||
{ "setcolor", &SetCurColor }, { "sc", &SetCurColor }, | |||
{ "setcolora", &SetCurColorA }, { "sca", &SetCurColorA }, | |||
{ "setcolorb", &SetCurColorB }, { "scb", &SetCurColorB }, | |||
{ "setcolorv", &SetVertColor }, { "scv", &SetVertColor }, | |||
{ "SetColor", &EMLO::SetCurColor }, { "sc", &EMLO::SetCurColor }, | |||
{ "SetColorA", &EMLO::SetCurColorA }, { "sca", &EMLO::SetCurColorA }, | |||
{ "SetColorB", &EMLO::SetCurColorB }, { "scb", &EMLO::SetCurColorB }, | |||
{ "SetColorV", &EMLO::SetVertColor }, { "scv", &EMLO::SetVertColor }, | |||
//----------------------------------------------------------------- | |||
{ "TranslateX", &TranslateX }, { "tx", &TranslateX }, | |||
{ "TranslateY", &TranslateY }, { "ty", &TranslateY }, | |||
{ "TranslateZ", &TranslateZ }, { "tz", &TranslateZ }, | |||
{ "TranslateX", &EMLO::TranslateX }, { "tx", &EMLO::TranslateX }, | |||
{ "TranslateY", &EMLO::TranslateY }, { "ty", &EMLO::TranslateY }, | |||
{ "TranslateZ", &EMLO::TranslateZ }, { "tz", &EMLO::TranslateZ }, | |||
{ "Translate", &Translate }, { "t", &Translate }, | |||
//----------------------------------------------------------------- | |||
{ "RotateX", &RotateX }, { "rx", &RotateX }, | |||
{ "RotateY", &RotateY }, { "ry", &RotateY }, | |||
{ "RotateZ", &RotateZ }, { "rz", &RotateZ }, | |||
{ "RotateX", &EMLO::RotateX }, { "rx", &EMLO::RotateX }, | |||
{ "RotateY", &EMLO::RotateY }, { "ry", &EMLO::RotateY }, | |||
{ "RotateZ", &EMLO::RotateZ }, { "rz", &EMLO::RotateZ }, | |||
{ "Rotate", &Rotate }, { "r", &Rotate }, | |||
//----------------------------------------------------------------- | |||
{ "ScaleX", &ScaleX }, { "sx", &ScaleX }, | |||
{ "ScaleY", &ScaleY }, { "sy", &ScaleY }, | |||
{ "ScaleZ", &ScaleZ }, { "sz", &ScaleZ }, | |||
{ "Scale", &Scale }, { "s", &Scale }, | |||
{ "ScaleX", &EMLO::ScaleX }, { "sx", &EMLO::ScaleX }, | |||
{ "ScaleY", &EMLO::ScaleY }, { "sy", &EMLO::ScaleY }, | |||
{ "ScaleZ", &EMLO::ScaleZ }, { "sz", &EMLO::ScaleZ }, | |||
{ "Scale", &EMLO::Scale }, { "s", &EMLO::Scale }, | |||
//----------------------------------------------------------------- | |||
{ "RadialJitter", &RadialJitter }, { "rj", &RadialJitter }, | |||
{ "RadialJitter", &EMLO::RadialJitter }, { "rj", &EMLO::RadialJitter }, | |||
//----------------------------------------------------------------- | |||
{ "TaperX", &TaperX }, { "tax", &TaperX }, | |||
{ "TaperY", &TaperY }, { "tay", &TaperY }, | |||
{ "TaperZ", &TaperZ }, { "taz", &TaperZ }, | |||
{ "TaperX", &EMLO::TaperX }, { "tax", &EMLO::TaperX }, | |||
{ "TaperY", &EMLO::TaperY }, { "tay", &EMLO::TaperY }, | |||
{ "TaperZ", &EMLO::TaperZ }, { "taz", &EMLO::TaperZ }, | |||
//----------------------------------------------------------------- | |||
{ "TwistX", &TwistX }, { "twx", &TwistX }, | |||
{ "TwistY", &TwistY }, { "twy", &TwistY }, | |||
{ "TwistZ", &TwistZ }, { "twz", &TwistZ }, | |||
{ "TwistX", &EMLO::TwistX }, { "twx", &EMLO::TwistX }, | |||
{ "TwistY", &EMLO::TwistY }, { "twy", &EMLO::TwistY }, | |||
{ "TwistZ", &EMLO::TwistZ }, { "twz", &EMLO::TwistZ }, | |||
//----------------------------------------------------------------- | |||
{ "ShearX", &ShearX }, { "shx", &ShearX }, | |||
{ "ShearY", &ShearY }, { "shy", &ShearY }, | |||
{ "ShearZ", &ShearZ }, { "shz", &ShearZ }, | |||
{ "ShearX", &EMLO::ShearX }, { "shx", &EMLO::ShearX }, | |||
{ "ShearY", &EMLO::ShearY }, { "shy", &EMLO::ShearY }, | |||
{ "ShearZ", &EMLO::ShearZ }, { "shz", &EMLO::ShearZ }, | |||
//----------------------------------------------------------------- | |||
{ "StretchX", &StretchX }, { "stx", &StretchX }, | |||
{ "StretchY", &StretchY }, { "sty", &StretchY }, | |||
{ "StretchZ", &StretchZ }, { "stz", &StretchZ }, | |||
{ "StretchX", &EMLO::StretchX }, { "stx", &EMLO::StretchX }, | |||
{ "StretchY", &EMLO::StretchY }, { "sty", &EMLO::StretchY }, | |||
{ "StretchZ", &EMLO::StretchZ }, { "stz", &EMLO::StretchZ }, | |||
//----------------------------------------------------------------- | |||
{ "BendXY", &BendXY }, { "bdxy", &BendXY }, | |||
{ "BendXZ", &BendXZ }, { "bdxz", &BendXZ }, | |||
{ "BendYX", &BendYX }, { "bdyx", &BendYX }, | |||
{ "BendYZ", &BendYZ }, { "bdyz", &BendYZ }, | |||
{ "BendZX", &BendZX }, { "bdzx", &BendZX }, | |||
{ "BendZY", &BendZY }, { "bdzy", &BendZY }, | |||
{ "BendXY", &EMLO::BendXY }, { "bdxy", &EMLO::BendXY }, | |||
{ "BendXZ", &EMLO::BendXZ }, { "bdxz", &EMLO::BendXZ }, | |||
{ "BendYX", &EMLO::BendYX }, { "bdyx", &EMLO::BendYX }, | |||
{ "BendYZ", &EMLO::BendYZ }, { "bdyz", &EMLO::BendYZ }, | |||
{ "BendZX", &EMLO::BendZX }, { "bdzx", &EMLO::BendZX }, | |||
{ "BendZY", &EMLO::BendZY }, { "bdzy", &EMLO::BendZY }, | |||
//----------------------------------------------------------------- | |||
{ "MirrorX", &MirrorX }, { "mx", &MirrorX }, | |||
{ "MirrorY", &MirrorY }, { "my", &MirrorY }, | |||
{ "MirrorZ", &MirrorZ }, { "mz", &MirrorZ }, | |||
{ "MirrorX", &EMLO::MirrorX }, { "mx", &EMLO::MirrorX }, | |||
{ "MirrorY", &EMLO::MirrorY }, { "my", &EMLO::MirrorY }, | |||
{ "MirrorZ", &EMLO::MirrorZ }, { "mz", &EMLO::MirrorZ }, | |||
//----------------------------------------------------------------- | |||
{ "Loop", &LoopStart }, { "lp", &LoopStart }, | |||
{ "LoopDo", &LoopEnd }, { "ld", &LoopEnd }, | |||
{ "BraceOpen", &OpenBrace }, { "bop", &OpenBrace }, | |||
{ "BraceClose", &CloseBrace }, { "bcl", &CloseBrace }, | |||
{ "Loop", &EMLO::LoopStart }, { "lp", &EMLO::LoopStart }, | |||
{ "LoopDo", &EMLO::LoopEnd }, { "ld", &EMLO::LoopEnd }, | |||
{ "BraceOpen", &EMLO::OpenBrace }, { "bop", &EMLO::OpenBrace }, | |||
{ "BraceClose", &EMLO::CloseBrace }, { "bcl", &EMLO::CloseBrace }, | |||
//----------------------------------------------------------------- | |||
{ "VerticeMerge", &VerticesMerge }, { "vm", &VerticesMerge }, | |||
{ "VerticeSeparate", &VerticesSeparate }, { "vs", &VerticesSeparate }, | |||
{ "VerticeMerge", &EMLO::VerticesMerge }, { "vm", &EMLO::VerticesMerge }, | |||
{ "VerticeSeparate", &EMLO::VerticesSeparate }, { "vs", &EMLO::VerticesSeparate }, | |||
{ "VerticesCleanup", &EMLO::VerticesCleanup }, { "vc", &EMLO::VerticesCleanup }, | |||
//----------------------------------------------------------------- | |||
{ "Duplicate", &Duplicate }, { "dup", &Duplicate }, | |||
{ "Smooth", &Smooth }, { "smth", &Smooth }, | |||
{ "SplitTriangles", &SplitTriangles }, { "splt", &SplitTriangles }, | |||
{ "Chamfer", &Chamfer }, { "cf", &Chamfer }, | |||
{ "Duplicate", &EMLO::Duplicate }, { "dup", &EMLO::Duplicate }, | |||
{ "Smooth", &EMLO::Smooth }, { "smth", &EMLO::Smooth }, | |||
{ "SplitTriangles", &EMLO::SplitTriangles }, { "splt", &EMLO::SplitTriangles }, | |||
{ "Chamfer", &EMLO::Chamfer }, { "cf", &EMLO::Chamfer }, | |||
//----------------------------------------------------------------- | |||
{ "ToggleScaleWinding", &ToggleScaleWinding }, { "tsw", &ToggleScaleWinding }, | |||
{ "ToggleQuadWeighting", &ToggleQuadWeighting }, { "tqw", &ToggleQuadWeighting }, | |||
{ "TogglePostBuildNormal", &TogglePostBuildNormal }, { "tpbn", &TogglePostBuildNormal }, | |||
{ "ToggleVerticeNoCleanup", &ToggleVerticeNoCleanup }, { "tvnc", &ToggleVerticeNoCleanup }, | |||
{ "ToggleScaleWinding", &EMLO::ToggleScaleWinding }, { "tsw", &EMLO::ToggleScaleWinding }, | |||
{ "ToggleQuadWeighting", &EMLO::ToggleQuadWeighting }, { "tqw", &EMLO::ToggleQuadWeighting }, | |||
{ "TogglePostBuildNormal", &EMLO::TogglePostBuildNormal }, { "tpbn", &EMLO::TogglePostBuildNormal }, | |||
{ "ToggleVerticeNoCleanup", &EMLO::ToggleVerticeNoCleanup }, { "tvnc", &EMLO::ToggleVerticeNoCleanup }, | |||
//----------------------------------------------------------------- | |||
}, | |||
//Variables | |||
@@ -32,6 +32,7 @@ public: | |||
//------------------------------------------------------------------------- | |||
EasyMeshLuaObject(); | |||
virtual ~EasyMeshLuaObject(); | |||
EasyMesh& GetMesh() { return m_instance; } | |||
//------------------------------------------------------------------------- | |||
static EasyMeshLuaObject* New(LuaState* l, int arg_nb); | |||
@@ -558,6 +559,14 @@ public: | |||
m->m_instance.VerticesSeparate(); | |||
return 0; | |||
} | |||
static int VerticesCleanup(LuaState* l) | |||
{ | |||
LuaStack s(l); | |||
EzMeshPtr m; | |||
s >> m; | |||
m->m_instance.VerticesCleanup(); | |||
return 0; | |||
} | |||
//------------------------------------------------------------------------- | |||
static int Duplicate(LuaState* l) | |||
{ | |||
@@ -602,7 +611,7 @@ public: | |||
EzMeshPtr m; | |||
s >> m; | |||
LuaVec4 c; | |||
if (s.GetArgs() == 1 && !c.IsValid(l, 2)) | |||
if (s.GetArgs() == 2 && !c.IsValid(l, 2)) | |||
{ | |||
LuaString str; | |||
s >> str; | |||
@@ -25,21 +25,21 @@ class LuaBaseData | |||
{ | |||
friend class Lolua::Loader; | |||
static int LuaPanic(LuaState* L) | |||
static int LuaPanic(LuaState* l) | |||
{ | |||
char const *message = lua_tostring(L, -1); | |||
char const *message = lua_tostring(l, -1); | |||
Log::Error("%s\n", message); | |||
DebugAbort(); | |||
return 0; | |||
} | |||
static int LuaDoFile(LuaState *L) | |||
static int LuaDoFile(LuaState *l) | |||
{ | |||
if (lua_isnoneornil(L, 1)) | |||
if (lua_isnoneornil(l, 1)) | |||
return LUA_ERRFILE; | |||
LuaCharPtr var; var.Get(L, 1); | |||
char const *filename = var;// lua_tostring(L, 1); | |||
LuaCharPtr var; var.Get(l, 1); | |||
char const *filename = var;// lua_tostring(l, 1); | |||
int status = LUA_ERRFILE; | |||
array<String> pathlist = System::GetPathList(filename); | |||
@@ -53,15 +53,21 @@ class LuaBaseData | |||
f.Close(); | |||
Log::Debug("loading Lua file %s\n", pathlist[i].C()); | |||
status = luaL_dostring(L, s.C()); | |||
status = luaL_dostring(l, s.C()); | |||
break; | |||
} | |||
} | |||
if (status == LUA_ERRFILE) | |||
Log::Error("could not find Lua file %s\n", filename); | |||
else if (status == 1) | |||
{ | |||
LuaString error; error.Get(l, -1); | |||
Log::Error("Lua error %s\n", error().C()); | |||
lua_pop(l, 1); | |||
} | |||
lua_pop(L, 1); | |||
lua_pop(l, 1); | |||
return status; | |||
} | |||