diff --git a/src/easymesh/easymesh-parser.y b/src/easymesh/easymesh-parser.y index 1f182757..f7c30548 100644 --- a/src/easymesh/easymesh-parser.y +++ b/src/easymesh/easymesh-parser.y @@ -50,8 +50,8 @@ %token T_TRANSLATE T_SCALE %token T_CHAMFER -%token T_CYLINDER T_BOX T_SMOOTHCHAMFBOX T_FLATCHAMFBOX T_SPHERE T_STAR -%token T_EXPANDEDSTAR T_DISC T_TRIANGLE T_QUAD T_COG +%token T_CYLINDER T_BOX T_SMOOTHCHAMFBOX T_FLATCHAMFBOX T_SPHERE T_CAPSULE +%token T_STAR T_EXPANDEDSTAR T_DISC T_TRIANGLE T_QUAD T_COG %token T_END 0 %token T_ERROR @@ -147,6 +147,7 @@ primitive_command: $2.f2), $2.f3); } | T_SPHERE args4 { mc.m_mesh.AppendSphere($2.f0, vec3($2.f1, $2.f2, $2.f3)); } + | T_CAPSULE args3 { mc.m_mesh.AppendCapsule($2.f0, $2.f1, $2.f2); } | T_STAR args5 { mc.m_mesh.AppendStar((int)$2.f0, $2.f1, $2.f2, (int)$2.f3, (int)$2.f4); } | T_EXPANDEDSTAR args4 { mc.m_mesh.AppendExpandedStar((int)$2.f0, $2.f1, diff --git a/src/easymesh/easymesh-scanner.l b/src/easymesh/easymesh-scanner.l index 30f115e8..e8346be9 100644 --- a/src/easymesh/easymesh-scanner.l +++ b/src/easymesh/easymesh-scanner.l @@ -74,6 +74,7 @@ ac { return token::T_CYLINDER; } ab { return token::T_BOX; } ascb { return token::T_SMOOTHCHAMFBOX; } afcb { return token::T_FLATCHAMFBOX; } +acap { return token::T_CAPSULE; } asph { return token::T_SPHERE; } as { return token::T_STAR; } aes { return token::T_EXPANDEDSTAR; } diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index 624e6dea..9ce2b894 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -19,6 +19,19 @@ # include "config.h" #endif +#if defined _XBOX +# define _USE_MATH_DEFINES /* for M_PI */ +# include +# undef near /* Fuck Microsoft */ +# undef far /* Fuck Microsoft again */ +#elif defined _WIN32 +# define _USE_MATH_DEFINES /* for M_PI */ +# define WIN32_LEAN_AND_MEAN +# include +# undef near /* Fuck Microsoft */ +# undef far /* Fuck Microsoft again */ +#endif + #include "core.h" #include "easymesh/easymesh-compiler.h" @@ -347,20 +360,24 @@ void EasyMesh::AppendCylinder(int nsides, float h, float r1, float r2, } } -void EasyMesh::AppendSphere(int ndivisions, vec3 const &size) +void EasyMesh::AppendCapsule(int ndivisions, float h, float r) { int ibase = m_indices.Count(); Array vertices; + /* Fill in the icosahedron vertices, rotating them so that there + * is a vertex at [0 0 1] and [0 0 -1] after normalisation. */ float phi = 0.5f + 0.5f * sqrt(5.f); + mat3 mat = mat3::rotate(asin(1.f / sqrt(2.f + phi)) * (180.f / M_PI), + vec3(1.f, 0.f, 0.f)); for (int i = 0; i < 4; i++) { float x = (i & 1) ? 0.5f : -0.5f; float y = (i & 2) ? phi * 0.5f : phi * -0.5f; - vertices << vec3(x, y, 0.f); - vertices << vec3(0.f, x, y); - vertices << vec3(y, 0.f, x); + vertices << mat * vec3(x, y, 0.f); + vertices << mat * vec3(0.f, x, y); + vertices << mat * vec3(y, 0.f, x); } static int const trilist[] = @@ -375,33 +392,49 @@ void EasyMesh::AppendSphere(int ndivisions, vec3 const &size) for (unsigned i = 0; i < sizeof(trilist) / sizeof(*trilist); i += 3) { - vec3 const &p0 = vertices[trilist[i]]; - vec3 const &p1 = vertices[trilist[i + 1]]; - vec3 const &p2 = vertices[trilist[i + 2]]; + vec3 const &a = vertices[trilist[i]]; + vec3 const &b = vertices[trilist[i + 1]]; + vec3 const &c = vertices[trilist[i + 2]]; - vec3 const vx = 1.f / ndivisions * (p1 - p0); - vec3 const vy = 1.f / ndivisions * (p2 - p0); + vec3 const vb = 1.f / ndivisions * (b - a); + vec3 const vc = 1.f / ndivisions * (c - a); int line = ndivisions + 1; for (int v = 0, x = 0, y = 0; x < ndivisions + 1; v++) { - vec3 p = p0 + x * vx + y * vy; + vec3 p[] = { a + x * vb + y * vc, + p[0] + vb, + p[0] + vc, + p[0] + vb + vc }; + + /* FIXME: when we normalise here, we get a volume that is slightly + * smaller than the sphere of radius 1, since we are not using + * the midradius. */ + for (int k = 0; k < 4; k++) + p[k] = normalize(p[k]) * r; + + /* If this is a capsule, grow in the Z direction */ + if (h > 0.f) + { + for (int k = 0; k < 4; k++) + p[k].z += (p[k].z > 0.f) ? 0.5f * h : -0.5f * h; + } /* Add zero, one or two triangles */ if (y < line - 1) { - AddVertex(normalize(p) * size); - AddVertex(normalize(p + vx) * size); - AddVertex(normalize(p + vy) * size); + AddVertex(p[0]); + AddVertex(p[1]); + AddVertex(p[2]); AppendTriangle(0, 2, 1, m_vert.Count() - 3); } if (y < line - 2) { - AddVertex(normalize(p + vx) * size); - AddVertex(normalize(p + vx + vy) * size); - AddVertex(normalize(p + vy) * size); + AddVertex(p[1]); + AddVertex(p[3]); + AddVertex(p[2]); AppendTriangle(0, 2, 1, m_vert.Count() - 3); } @@ -418,6 +451,11 @@ void EasyMesh::AppendSphere(int ndivisions, vec3 const &size) ComputeNormals(ibase, m_indices.Count() - ibase); } +void EasyMesh::AppendSphere(int ndivisions, vec3 const &size) +{ + AppendCapsule(ndivisions, 0.f, size.x); +} + void EasyMesh::AppendBox(vec3 const &size, float chamf) { AppendBox(size, chamf, false); diff --git a/src/easymesh/easymesh.h b/src/easymesh/easymesh.h index 91951c43..9bed9b7c 100644 --- a/src/easymesh/easymesh.h +++ b/src/easymesh/easymesh.h @@ -66,6 +66,7 @@ private: void AppendCylinder(int nsides, float h, float r1, float r2, int dualside, int smooth); + void AppendCapsule(int ndivisions, float h, float r); void AppendSphere(int ndivisions, vec3 const &size); void AppendBox(vec3 const &size, float chamf = 0.f); void AppendSmoothChamfBox(vec3 const &size, float chamf); diff --git a/src/generated/easymesh-parser.cpp b/src/generated/easymesh-parser.cpp index 763faa40..662d43bd 100644 --- a/src/generated/easymesh-parser.cpp +++ b/src/generated/easymesh-parser.cpp @@ -679,121 +679,128 @@ namespace lol { /* Line 690 of lalr1.cc */ #line 150 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, - (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } + { mc.m_mesh.AppendCapsule((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } break; case 42: /* Line 690 of lalr1.cc */ -#line 152 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, - (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } +#line 151 "easymesh/easymesh-parser.y" + { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, + (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } break; case 43: /* Line 690 of lalr1.cc */ -#line 154 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } +#line 153 "easymesh/easymesh-parser.y" + { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, + (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } break; case 44: /* Line 690 of lalr1.cc */ #line 155 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } + { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } break; case 45: /* Line 690 of lalr1.cc */ #line 156 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } + { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } break; case 46: /* Line 690 of lalr1.cc */ #line 157 "easymesh/easymesh-parser.y" - { mc.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, - (yysemantic_stack_[(2) - (2)].args).f4, (yysemantic_stack_[(2) - (2)].args).f5, (yysemantic_stack_[(2) - (2)].args).f6, (int)(yysemantic_stack_[(2) - (2)].args).f7); } + { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } break; case 47: /* Line 690 of lalr1.cc */ -#line 161 "easymesh/easymesh-parser.y" - { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } +#line 158 "easymesh/easymesh-parser.y" + { mc.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, + (yysemantic_stack_[(2) - (2)].args).f4, (yysemantic_stack_[(2) - (2)].args).f5, (yysemantic_stack_[(2) - (2)].args).f6, (int)(yysemantic_stack_[(2) - (2)].args).f7); } break; case 48: /* Line 690 of lalr1.cc */ #line 162 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } break; case 49: /* Line 690 of lalr1.cc */ #line 163 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(2) - (2)].fval); } break; case 50: /* Line 690 of lalr1.cc */ #line 164 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(2) - (2)].fval); } break; case 51: /* Line 690 of lalr1.cc */ #line 165 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(2) - (2)].fval); } break; case 52: /* Line 690 of lalr1.cc */ #line 166 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(2) - (2)].fval); } break; case 53: /* Line 690 of lalr1.cc */ #line 167 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(2) - (2)].fval); } break; case 54: /* Line 690 of lalr1.cc */ #line 168 "easymesh/easymesh-parser.y" - { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(2) - (2)].fval); } + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(2) - (2)].fval); } break; case 55: /* Line 690 of lalr1.cc */ -#line 171 "easymesh/easymesh-parser.y" - { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } +#line 169 "easymesh/easymesh-parser.y" + { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(2) - (2)].fval); } break; case 56: /* Line 690 of lalr1.cc */ #line 172 "easymesh/easymesh-parser.y" + { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } + break; + + case 57: + +/* Line 690 of lalr1.cc */ +#line 173 "easymesh/easymesh-parser.y" { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } break; /* Line 690 of lalr1.cc */ -#line 797 "generated/easymesh-parser.cpp" +#line 804 "generated/easymesh-parser.cpp" default: break; } @@ -1067,20 +1074,20 @@ namespace lol { /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ - const signed char EasyMeshParser::yypact_ninf_ = -45; + const signed char EasyMeshParser::yypact_ninf_ = -46; const signed char EasyMeshParser::yypact_[] = { - 34, -29, 70, -6, -6, -6, -6, -45, -6, -6, - -6, -6, -45, -6, -6, -6, -6, -45, -6, -6, - -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, - -6, -6, -45, 12, 15, 34, 34, 69, -45, -45, - -45, -45, -45, -45, -6, -6, -6, -6, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -6, -6, -45, - -45, -45, -45, -45, -45, -45, -45, -45, -45, -6, - -6, -45, -45, -45, -45, -21, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45 + 35, -30, -7, 72, 72, 72, 72, -46, 72, 72, + 72, 72, -46, 72, 72, 72, 72, -46, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, -46, 12, 15, 35, 35, 71, -46, + -46, -46, -46, -46, -46, 72, 72, 72, 72, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, 72, 72, + -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, + -46, 72, 72, -46, -46, -46, -46, -22, -46, -46, + -46, -46, -46, -46, -46, -46, -46, -46, -46 }; /* YYDEFACT[S] -- default reduction number in state S. Performed when @@ -1092,29 +1099,29 @@ namespace lol { 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 34, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 0, 0, 3, 0, 5, 9, 11, - 12, 13, 55, 15, 0, 0, 0, 0, 14, 47, - 17, 16, 19, 23, 26, 29, 20, 24, 27, 30, - 21, 25, 28, 31, 22, 32, 18, 0, 0, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 0, - 0, 46, 1, 2, 4, 0, 10, 56, 48, 49, - 50, 51, 52, 53, 54, 8, 6 + 0, 0, 0, 7, 0, 0, 3, 0, 5, 9, + 11, 12, 13, 56, 15, 0, 0, 0, 0, 14, + 48, 17, 16, 19, 23, 26, 29, 20, 24, 27, + 30, 21, 25, 28, 31, 22, 32, 18, 0, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 0, 0, 47, 1, 2, 4, 0, 10, 57, + 49, 50, 51, 52, 53, 54, 55, 8, 6 }; /* YYPGOTO[NTERM-NUM]. */ const signed char EasyMeshParser::yypgoto_[] = { - -45, -45, -4, -45, -45, -45, -45, -17, -45, -45, - -45, 5, 39, 98, 3, 8, -9, -45, -45, -44 + -46, -46, -2, -46, -46, -46, -46, -18, -46, -46, + -46, 5, 40, 101, 3, -5, 0, -46, -46, -45 }; /* YYDEFGOTO[NTERM-NUM]. */ const signed char EasyMeshParser::yydefgoto_[] = { - -1, 33, 34, 35, 36, 96, 37, 38, 39, 40, - 41, 45, 46, 47, 67, 68, 69, 80, 81, 49 + -1, 34, 35, 36, 37, 98, 38, 39, 40, 41, + 42, 46, 47, 48, 68, 69, 70, 82, 83, 50 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1124,38 +1131,40 @@ namespace lol { const unsigned char EasyMeshParser::yytable_[] = { - 87, 88, 89, 90, 48, 51, 42, 43, 52, 53, - 44, 55, 82, 56, 57, 83, 59, 95, 60, 61, - 86, 63, 79, 91, 92, 66, 71, 72, 73, 42, - 75, 84, 85, 44, 74, 93, 94, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 77, 78, - 0, 32, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 54, 0, 42, 50, 0, 58, 44, - 0, 0, 0, 62, 0, 0, 64, 65, 0, 0, - 70, 0, 0, 0, 0, 0, 76 + 89, 90, 91, 92, 49, 52, 43, 44, 53, 54, + 45, 56, 84, 57, 58, 85, 60, 97, 61, 62, + 88, 64, 76, 93, 94, 67, 72, 73, 74, 43, + 51, 77, 81, 45, 86, 87, 95, 96, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 79, 80, 0, 33, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 55, 0, 43, 0, + 0, 59, 45, 0, 0, 0, 63, 0, 0, 65, + 66, 0, 0, 71, 0, 0, 0, 75, 0, 0, + 78 }; /* YYCHECK. */ const signed char EasyMeshParser::yycheck_[] = { - 44, 45, 46, 47, 1, 2, 35, 36, 3, 4, - 39, 6, 0, 8, 9, 0, 11, 38, 13, 14, - 37, 16, 31, 67, 68, 20, 23, 24, 25, 35, - 27, 35, 36, 39, 26, 79, 80, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 29, 30, - -1, 37, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 5, -1, 35, 36, -1, 10, 39, - -1, -1, -1, 15, -1, -1, 18, 19, -1, -1, - 22, -1, -1, -1, -1, -1, 28 + 45, 46, 47, 48, 1, 2, 36, 37, 3, 4, + 40, 6, 0, 8, 9, 0, 11, 39, 13, 14, + 38, 16, 27, 68, 69, 20, 23, 24, 25, 36, + 37, 28, 32, 40, 36, 37, 81, 82, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 30, 31, -1, 38, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 5, -1, 36, -1, + -1, 10, 40, -1, -1, -1, 15, -1, -1, 18, + 19, -1, -1, 22, -1, -1, -1, 26, -1, -1, + 29 }; /* STOS_[STATE-NUM] -- The (internal number of the) accessing @@ -1166,13 +1175,13 @@ namespace lol { 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 37, 41, 42, 43, 44, 46, 47, 48, - 49, 50, 35, 36, 39, 51, 52, 53, 54, 59, - 36, 54, 51, 51, 53, 51, 51, 51, 53, 51, - 51, 51, 53, 51, 53, 53, 51, 54, 55, 56, - 53, 54, 54, 54, 55, 54, 53, 52, 52, 56, - 57, 58, 0, 0, 42, 42, 47, 59, 59, 59, - 59, 59, 59, 59, 59, 38, 45 + 32, 33, 34, 38, 42, 43, 44, 45, 47, 48, + 49, 50, 51, 36, 37, 40, 52, 53, 54, 55, + 60, 37, 55, 52, 52, 54, 52, 52, 52, 54, + 52, 52, 52, 54, 52, 54, 54, 52, 55, 56, + 57, 54, 55, 55, 55, 54, 56, 55, 54, 53, + 53, 57, 58, 59, 0, 0, 43, 43, 48, 60, + 60, 60, 60, 60, 60, 60, 60, 39, 46 }; #if YYDEBUG @@ -1184,7 +1193,8 @@ namespace lol { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 91, 93, 45 + 285, 286, 287, 288, 289, 290, 291, 292, 91, 93, + 45 }; #endif @@ -1192,12 +1202,12 @@ namespace lol { const unsigned char EasyMeshParser::yyr1_[] = { - 0, 40, 41, 42, 42, 43, 43, 44, 45, 46, - 46, 47, 47, 47, 48, 48, 48, 48, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 59 + 0, 41, 42, 43, 43, 44, 44, 45, 46, 47, + 47, 48, 48, 48, 49, 49, 49, 49, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 60 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1208,8 +1218,8 @@ namespace lol { 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, - 2, 2, 2, 2, 2, 1, 2 + 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, + 2, 2, 2, 2, 2, 2, 1, 2 }; #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE @@ -1223,13 +1233,13 @@ namespace lol { "T_ROTATEY", "T_TAPERY", "T_SCALEY", "T_MIRRORY", "T_TRANSLATEZ", "T_ROTATEZ", "T_TAPERZ", "T_SCALEZ", "T_MIRRORZ", "T_TRANSLATE", "T_SCALE", "T_CHAMFER", "T_CYLINDER", "T_BOX", "T_SMOOTHCHAMFBOX", - "T_FLATCHAMFBOX", "T_SPHERE", "T_STAR", "T_EXPANDEDSTAR", "T_DISC", - "T_TRIANGLE", "T_QUAD", "T_COG", "T_ERROR", "NUMBER", "COLOR", "'['", - "']'", "'-'", "$accept", "mesh_description", "mesh_expression_list", - "mesh_expression", "mesh_open", "mesh_close", "mesh_command_list", - "mesh_command", "color_command", "transform_command", - "primitive_command", "args1", "args2", "args3", "args4", "args5", - "args6", "args7", "args8", "number", 0 + "T_FLATCHAMFBOX", "T_SPHERE", "T_CAPSULE", "T_STAR", "T_EXPANDEDSTAR", + "T_DISC", "T_TRIANGLE", "T_QUAD", "T_COG", "T_ERROR", "NUMBER", "COLOR", + "'['", "']'", "'-'", "$accept", "mesh_description", + "mesh_expression_list", "mesh_expression", "mesh_open", "mesh_close", + "mesh_command_list", "mesh_command", "color_command", + "transform_command", "primitive_command", "args1", "args2", "args3", + "args4", "args5", "args6", "args7", "args8", "number", 0 }; #endif @@ -1238,22 +1248,22 @@ namespace lol { const EasyMeshParser::rhs_number_type EasyMeshParser::yyrhs_[] = { - 41, 0, -1, 42, 0, -1, 43, -1, 43, 42, - -1, 46, -1, 44, 42, 45, -1, 37, -1, 38, - -1, 47, -1, 46, 47, -1, 48, -1, 49, -1, - 50, -1, 3, 54, -1, 3, 36, -1, 4, 54, - -1, 4, 36, -1, 22, 51, -1, 5, 51, -1, - 10, 51, -1, 15, 51, -1, 20, 53, -1, 6, - 51, -1, 11, 51, -1, 16, 51, -1, 7, 53, - -1, 12, 53, -1, 17, 53, -1, 8, 51, -1, - 13, 51, -1, 18, 51, -1, 21, 53, -1, 9, - -1, 14, -1, 19, -1, 23, 56, -1, 24, 53, - -1, 25, 54, -1, 26, 54, -1, 27, 54, -1, - 28, 55, -1, 29, 54, -1, 30, 53, -1, 31, - 52, -1, 32, 52, -1, 33, 58, -1, 59, -1, - 51, 59, -1, 52, 59, -1, 53, 59, -1, 54, - 59, -1, 55, 59, -1, 56, 59, -1, 57, 59, - -1, 35, -1, 39, 59, -1 + 42, 0, -1, 43, 0, -1, 44, -1, 44, 43, + -1, 47, -1, 45, 43, 46, -1, 38, -1, 39, + -1, 48, -1, 47, 48, -1, 49, -1, 50, -1, + 51, -1, 3, 55, -1, 3, 37, -1, 4, 55, + -1, 4, 37, -1, 22, 52, -1, 5, 52, -1, + 10, 52, -1, 15, 52, -1, 20, 54, -1, 6, + 52, -1, 11, 52, -1, 16, 52, -1, 7, 54, + -1, 12, 54, -1, 17, 54, -1, 8, 52, -1, + 13, 52, -1, 18, 52, -1, 21, 54, -1, 9, + -1, 14, -1, 19, -1, 23, 57, -1, 24, 54, + -1, 25, 55, -1, 26, 55, -1, 27, 55, -1, + 28, 54, -1, 29, 56, -1, 30, 55, -1, 31, + 54, -1, 32, 53, -1, 33, 53, -1, 34, 59, + -1, 60, -1, 52, 60, -1, 53, 60, -1, 54, + 60, -1, 55, 60, -1, 56, 60, -1, 57, 60, + -1, 58, 60, -1, 36, -1, 40, 60, -1 }; /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in @@ -1265,8 +1275,8 @@ namespace lol { 23, 26, 28, 30, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 83, 86, 89, 91, 93, 95, 98, 101, 104, - 107, 110, 113, 116, 119, 122, 125, 128, 130, 133, - 136, 139, 142, 145, 148, 151, 153 + 107, 110, 113, 116, 119, 122, 125, 128, 131, 133, + 136, 139, 142, 145, 148, 151, 154, 156 }; /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ @@ -1277,8 +1287,8 @@ namespace lol { 98, 102, 103, 104, 108, 109, 112, 113, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 140, 143, 144, 146, - 148, 150, 152, 154, 155, 156, 157, 161, 162, 163, - 164, 165, 166, 167, 168, 171, 172 + 148, 150, 151, 153, 155, 156, 157, 158, 162, 163, + 164, 165, 166, 167, 168, 169, 172, 173 }; // Print the state stack on the debug stream. @@ -1322,12 +1332,12 @@ namespace lol { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 39, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 40, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 37, 2, 38, 2, 2, 2, 2, 2, 2, + 2, 38, 2, 39, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1347,7 +1357,7 @@ namespace lol { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36 + 35, 36, 37 }; if ((unsigned int) t <= yyuser_token_number_max_) return translate_table[t]; @@ -1356,26 +1366,26 @@ namespace lol { } const int EasyMeshParser::yyeof_ = 0; - const int EasyMeshParser::yylast_ = 126; + const int EasyMeshParser::yylast_ = 130; const int EasyMeshParser::yynnts_ = 20; const int EasyMeshParser::yyempty_ = -2; - const int EasyMeshParser::yyfinal_ = 82; + const int EasyMeshParser::yyfinal_ = 84; const int EasyMeshParser::yyterror_ = 1; const int EasyMeshParser::yyerrcode_ = 256; - const int EasyMeshParser::yyntokens_ = 40; + const int EasyMeshParser::yyntokens_ = 41; - const unsigned int EasyMeshParser::yyuser_token_number_max_ = 291; + const unsigned int EasyMeshParser::yyuser_token_number_max_ = 292; const EasyMeshParser::token_number_type EasyMeshParser::yyundef_token_ = 2; } // lol /* Line 1136 of lalr1.cc */ -#line 1375 "generated/easymesh-parser.cpp" +#line 1385 "generated/easymesh-parser.cpp" /* Line 1138 of lalr1.cc */ -#line 175 "easymesh/easymesh-parser.y" +#line 176 "easymesh/easymesh-parser.y" void lol::EasyMeshParser::error(const EasyMeshParser::location_type& l, diff --git a/src/generated/easymesh-parser.h b/src/generated/easymesh-parser.h index 4a5ab3c0..4bdcaaaf 100644 --- a/src/generated/easymesh-parser.h +++ b/src/generated/easymesh-parser.h @@ -124,15 +124,16 @@ namespace lol { T_SMOOTHCHAMFBOX = 280, T_FLATCHAMFBOX = 281, T_SPHERE = 282, - T_STAR = 283, - T_EXPANDEDSTAR = 284, - T_DISC = 285, - T_TRIANGLE = 286, - T_QUAD = 287, - T_COG = 288, - T_ERROR = 289, - NUMBER = 290, - COLOR = 291 + T_CAPSULE = 283, + T_STAR = 284, + T_EXPANDEDSTAR = 285, + T_DISC = 286, + T_TRIANGLE = 287, + T_QUAD = 288, + T_COG = 289, + T_ERROR = 290, + NUMBER = 291, + COLOR = 292 }; }; @@ -312,7 +313,7 @@ namespace lol { } // lol /* Line 35 of lalr1.cc */ -#line 316 "generated/easymesh-parser.h" +#line 317 "generated/easymesh-parser.h" diff --git a/src/generated/easymesh-scanner.cpp b/src/generated/easymesh-scanner.cpp index bb045ec5..88a1754d 100644 --- a/src/generated/easymesh-scanner.cpp +++ b/src/generated/easymesh-scanner.cpp @@ -330,8 +330,8 @@ typedef unsigned char YY_CHAR; *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 43 -#define YY_END_OF_BUFFER 44 +#define YY_NUM_RULES 44 +#define YY_END_OF_BUFFER 45 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -339,15 +339,16 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[70] = +static yyconst flex_int16_t yy_accept[72] = { 0, - 0, 0, 44, 42, 41, 40, 42, 42, 37, 42, - 36, 38, 39, 42, 42, 42, 42, 17, 7, 0, - 0, 36, 36, 0, 22, 21, 28, 0, 0, 30, - 26, 29, 3, 18, 19, 20, 8, 9, 10, 1, - 14, 15, 16, 0, 4, 5, 6, 0, 0, 36, - 31, 27, 0, 0, 0, 2, 11, 12, 13, 32, - 24, 23, 25, 33, 0, 34, 0, 35, 0 + 0, 0, 45, 43, 42, 41, 43, 43, 38, 43, + 37, 39, 40, 43, 43, 43, 43, 17, 7, 0, + 0, 37, 37, 0, 22, 21, 29, 0, 0, 31, + 27, 30, 3, 18, 19, 20, 8, 9, 10, 1, + 14, 15, 16, 0, 4, 5, 6, 0, 0, 37, + 0, 32, 28, 0, 0, 0, 2, 11, 12, 13, + 33, 25, 24, 23, 26, 34, 0, 35, 0, 36, + 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -389,64 +390,64 @@ static yyconst flex_int32_t yy_meta[29] = 1, 1, 1, 1, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[78] = +static yyconst flex_int16_t yy_base[80] = { 0, - 0, 0, 94, 95, 95, 95, 0, 22, 24, 85, - 26, 95, 95, 30, 73, 10, 13, 34, 37, 0, - 83, 50, 59, 45, 95, 72, 95, 65, 74, 95, - 55, 95, 95, 95, 95, 95, 95, 95, 95, 74, - 95, 95, 95, 44, 95, 95, 95, 0, 78, 77, - 95, 95, 71, 70, 63, 95, 95, 95, 95, 0, - 95, 95, 95, 0, 0, 0, 0, 95, 95, 79, - 78, 77, 76, 75, 72, 71, 54 + 0, 0, 96, 97, 97, 97, 0, 22, 24, 87, + 26, 97, 97, 30, 75, 10, 13, 34, 37, 0, + 85, 50, 59, 45, 97, 58, 97, 68, 77, 97, + 57, 97, 97, 97, 97, 97, 97, 97, 97, 77, + 97, 97, 97, 46, 97, 97, 97, 0, 81, 80, + 66, 97, 97, 73, 72, 65, 97, 97, 97, 97, + 0, 97, 97, 97, 97, 0, 0, 0, 0, 97, + 97, 81, 80, 79, 78, 77, 75, 67, 54 } ; -static yyconst flex_int16_t yy_def[78] = +static yyconst flex_int16_t yy_def[80] = { 0, - 69, 1, 69, 69, 69, 69, 70, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 71, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 72, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 73, - 69, 69, 69, 74, 75, 76, 77, 69, 0, 69, - 69, 69, 69, 69, 69, 69, 69 + 71, 1, 71, 71, 71, 71, 72, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 73, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 74, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 75, 71, 71, 71, 71, 76, 77, 78, 79, 71, + 0, 71, 71, 71, 71, 71, 71, 71, 71 } ; -static yyconst flex_int16_t yy_nxt[124] = +static yyconst flex_int16_t yy_nxt[126] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, 13, 14, 4, 15, 4, 4, 4, 4, 4, 16, 4, 4, 17, 18, 19, 4, 4, 4, 21, 22, 21, 22, 21, 22, 24, 34, 35, 36, 37, 38, 39, 24, 25, 26, 27, 28, 29, 40, 44, 49, - 49, 30, 50, 31, 32, 68, 21, 22, 24, 41, - 42, 43, 45, 46, 47, 24, 23, 24, 54, 57, - 58, 59, 67, 66, 24, 55, 65, 64, 60, 48, - 20, 63, 62, 61, 50, 50, 56, 53, 52, 51, - 23, 33, 23, 69, 3, 69, 69, 69, 69, 69, - - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69 + 49, 30, 50, 31, 32, 70, 21, 22, 24, 41, + 42, 43, 45, 46, 47, 24, 23, 24, 69, 51, + 55, 58, 59, 60, 24, 52, 68, 56, 67, 66, + 61, 48, 20, 65, 64, 63, 62, 50, 50, 57, + 54, 53, 23, 33, 23, 71, 3, 71, 71, 71, + + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71 } ; -static yyconst flex_int16_t yy_chk[124] = +static yyconst flex_int16_t yy_chk[126] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 9, 9, 11, 11, 11, 16, 16, 16, 17, 17, 17, 11, 14, 14, 14, 14, 14, 18, 19, 24, - 24, 14, 24, 14, 14, 77, 22, 22, 22, 18, - 18, 18, 19, 19, 19, 22, 23, 23, 31, 44, - 44, 44, 76, 75, 23, 31, 74, 73, 72, 71, - 70, 55, 54, 53, 50, 49, 40, 29, 28, 26, - 21, 15, 10, 3, 69, 69, 69, 69, 69, 69, - - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69 + 24, 14, 24, 14, 14, 79, 22, 22, 22, 18, + 18, 18, 19, 19, 19, 22, 23, 23, 78, 26, + 31, 44, 44, 44, 23, 26, 77, 31, 76, 75, + 74, 73, 72, 56, 55, 54, 51, 50, 49, 40, + 29, 28, 21, 15, 10, 3, 71, 71, 71, 71, + + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71 } ; /* The intent behind this definition is that it'll catch @@ -495,7 +496,7 @@ typedef lol::EasyMeshParser::token_type token_type; #define yyterminate() return token::T_END #define YY_NO_UNISTD_H #define YY_USER_ACTION yylloc->columns(yyleng); -#line 499 "generated/easymesh-scanner.cpp" +#line 500 "generated/easymesh-scanner.cpp" #define INITIAL 0 @@ -608,7 +609,7 @@ YY_DECL yylloc->step(); -#line 612 "generated/easymesh-scanner.cpp" +#line 613 "generated/easymesh-scanner.cpp" if ( !(yy_init) ) { @@ -661,13 +662,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 70 ) + if ( yy_current_state >= 72 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 69 ); + while ( yy_current_state != 71 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); @@ -810,41 +811,46 @@ YY_RULE_SETUP case 25: YY_RULE_SETUP #line 77 "easymesh/easymesh-scanner.l" -{ return token::T_SPHERE; } +{ return token::T_CAPSULE; } YY_BREAK case 26: YY_RULE_SETUP #line 78 "easymesh/easymesh-scanner.l" -{ return token::T_STAR; } +{ return token::T_SPHERE; } YY_BREAK case 27: YY_RULE_SETUP #line 79 "easymesh/easymesh-scanner.l" -{ return token::T_EXPANDEDSTAR; } +{ return token::T_STAR; } YY_BREAK case 28: YY_RULE_SETUP #line 80 "easymesh/easymesh-scanner.l" -{ return token::T_DISC; } +{ return token::T_EXPANDEDSTAR; } YY_BREAK case 29: YY_RULE_SETUP #line 81 "easymesh/easymesh-scanner.l" -{ return token::T_TRIANGLE; } +{ return token::T_DISC; } YY_BREAK case 30: YY_RULE_SETUP #line 82 "easymesh/easymesh-scanner.l" -{ return token::T_QUAD; } +{ return token::T_TRIANGLE; } YY_BREAK case 31: YY_RULE_SETUP #line 83 "easymesh/easymesh-scanner.l" -{ return token::T_COG; } +{ return token::T_QUAD; } YY_BREAK case 32: YY_RULE_SETUP -#line 85 "easymesh/easymesh-scanner.l" +#line 84 "easymesh/easymesh-scanner.l" +{ return token::T_COG; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 86 "easymesh/easymesh-scanner.l" { uint32_t tmp = std::strtol(yytext + 1, NULL, 16); yylval->u32val = 0x11000000u * (tmp >> 8) @@ -853,9 +859,9 @@ YY_RULE_SETUP | 0x000000ffu; return token::COLOR; } YY_BREAK -case 33: +case 34: YY_RULE_SETUP -#line 92 "easymesh/easymesh-scanner.l" +#line 93 "easymesh/easymesh-scanner.l" { uint32_t tmp = std::strtol(yytext + 1, NULL, 16); yylval->u32val = 0x11000000u * (tmp >> 12) @@ -864,64 +870,64 @@ YY_RULE_SETUP | 0x00000011u * (tmp & 0xf); return token::COLOR; } YY_BREAK -case 34: +case 35: YY_RULE_SETUP -#line 99 "easymesh/easymesh-scanner.l" +#line 100 "easymesh/easymesh-scanner.l" { yylval->u32val = 0xffu | 0x100u * (uint32_t)std::strtol(yytext + 1, NULL, 16); return token::COLOR; } YY_BREAK -case 35: +case 36: YY_RULE_SETUP -#line 103 "easymesh/easymesh-scanner.l" +#line 104 "easymesh/easymesh-scanner.l" { yylval->u32val = (uint32_t)std::strtol(yytext + 1, NULL, 16); return token::COLOR; } YY_BREAK -case 36: +case 37: YY_RULE_SETUP -#line 106 "easymesh/easymesh-scanner.l" +#line 107 "easymesh/easymesh-scanner.l" { yylval->fval = std::atof(yytext); return token::NUMBER; } YY_BREAK -case 37: -YY_RULE_SETUP -#line 108 "easymesh/easymesh-scanner.l" -{ return token_type('-'); } - YY_BREAK case 38: YY_RULE_SETUP #line 109 "easymesh/easymesh-scanner.l" -{ return token_type('['); } +{ return token_type('-'); } YY_BREAK case 39: YY_RULE_SETUP #line 110 "easymesh/easymesh-scanner.l" -{ return token_type(']'); } +{ return token_type('['); } YY_BREAK case 40: YY_RULE_SETUP #line 111 "easymesh/easymesh-scanner.l" -{ /* ignore this */ } +{ return token_type(']'); } YY_BREAK case 41: -/* rule 41 can match eol */ YY_RULE_SETUP #line 112 "easymesh/easymesh-scanner.l" { /* ignore this */ } YY_BREAK case 42: +/* rule 42 can match eol */ YY_RULE_SETUP #line 113 "easymesh/easymesh-scanner.l" -{ return token::T_ERROR; } +{ /* ignore this */ } YY_BREAK case 43: YY_RULE_SETUP -#line 115 "easymesh/easymesh-scanner.l" +#line 114 "easymesh/easymesh-scanner.l" +{ return token::T_ERROR; } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 116 "easymesh/easymesh-scanner.l" ECHO; YY_BREAK -#line 925 "generated/easymesh-scanner.cpp" +#line 931 "generated/easymesh-scanner.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1303,7 +1309,7 @@ int yyFlexLexer::yy_get_next_buffer() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 70 ) + if ( yy_current_state >= 72 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1331,11 +1337,11 @@ int yyFlexLexer::yy_get_next_buffer() while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 70 ) + if ( yy_current_state >= 72 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 69); + yy_is_jam = (yy_current_state == 71); return yy_is_jam ? 0 : yy_current_state; } @@ -1822,7 +1828,7 @@ void EasyMeshfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 115 "easymesh/easymesh-scanner.l" +#line 116 "easymesh/easymesh-scanner.l" diff --git a/tutorial/05_easymesh.cpp b/tutorial/05_easymesh.cpp index 041f1067..9e062086 100644 --- a/tutorial/05_easymesh.cpp +++ b/tutorial/05_easymesh.cpp @@ -27,7 +27,8 @@ public: EasyMeshTutorial() { m_angle = 0; - m_mesh.Compile("sc#e94 scb#964 [acg10 5 8 8 2 2 0.1 0]"); + m_mesh.Compile("sc#e94 scb#964 [acap11 6 6 tx8]"); + m_mesh.Compile("sc#94e scb#649 [acap3 6 6 tx-8]"); m_camera = new Camera(vec3(0.f, 600.f, 0.f), vec3(0.f, 0.f, 0.f),