Changeset 2152
- Timestamp:
- Dec 19, 2012, 9:49:58 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/easymesh/easymesh-parser.y
r2151 r2152 38 38 /* Can't use uin32_t here for some reason */ 39 39 unsigned u32val; 40 struct { float f0, f1, f2, f3, f4, f5, f6, f7 ; } args;40 struct { float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; } args; 41 41 } 42 42 … … 61 61 62 62 %type <fval> number 63 %type <args> args1 args2 args3 args4 args5 args6 args7 args8 63 %type <args> args1 args2 args3 args4 args5 args6 args7 args8 args9 args10 64 64 65 65 %{ … … 158 158 | T_TRIANGLE args2 { mc.m_mesh.AppendSimpleTriangle($2.f0, (int)$2.f1); } 159 159 | T_QUAD args2 { mc.m_mesh.AppendSimpleQuad($2.f0, (int)$2.f1); } 160 | T_COG args 8{ mc.m_mesh.AppendCog((int)$2.f0, $2.f1,161 $2.f2 / 2, $2.f3 / 2, $2.f2, $2.f3, $2.f4,162 $2.f 5, $2.f6, (int)$2.f7); }160 | T_COG args10 { mc.m_mesh.AppendCog((int)$2.f0, $2.f1, 161 $2.f2, $2.f3, $2.f4, $2.f5, $2.f6, 162 $2.f7, $2.f8, (int)$2.f9); } 163 163 ; 164 164 … … 171 171 args7: args6 number { $$ = $1; $$.f6 = $2; } ; 172 172 args8: args7 number { $$ = $1; $$.f7 = $2; } ; 173 args9: args8 number { $$ = $1; $$.f8 = $2; } ; 174 args10: args9 number { $$ = $1; $$.f9 = $2; } ; 173 175 174 176 number: -
trunk/src/easymesh/easymesh.cpp
r2151 r2152 792 792 /* FIXME: enforce this some other way */ 793 793 if (r12 < 0) 794 {795 r10 *= 2.5;796 r20 *= 2.5;797 794 h = -h; 798 }799 795 800 796 mat3 rotmat = mat3::rotate(180.0f / nbsides, 0.f, 1.f, 0.f); -
trunk/src/generated/easymesh-parser.cpp
r2151 r2152 1 /* A Bison parser, made by GNU Bison 2. 4.2. */1 /* A Bison parser, made by GNU Bison 2.5. */ 2 2 3 3 /* Skeleton implementation for Bison LALR(1) parsers in C++ 4 4 5 Copyright (C) 2002-201 0Free Software Foundation, Inc.5 Copyright (C) 2002-2011 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify … … 36 36 /* First part of user declarations. */ 37 37 38 /* Line 310of lalr1.cc */38 /* Line 293 of lalr1.cc */ 39 39 #line 1 "easymesh/easymesh-parser.y" 40 40 … … 62 62 63 63 64 /* Line 310of lalr1.cc */64 /* Line 293 of lalr1.cc */ 65 65 #line 66 "generated/easymesh-parser.cpp" 66 66 … … 70 70 /* User implementation prologue. */ 71 71 72 /* Line 316of lalr1.cc */72 /* Line 299 of lalr1.cc */ 73 73 #line 65 "easymesh/easymesh-parser.y" 74 74 … … 79 79 80 80 81 /* Line 316of lalr1.cc */81 /* Line 299 of lalr1.cc */ 82 82 #line 83 "generated/easymesh-parser.cpp" 83 83 … … 94 94 #endif 95 95 96 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 97 If N is 0, then set CURRENT to the empty location which ends 98 the previous symbol: RHS[0] (always defined). */ 99 100 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 101 #ifndef YYLLOC_DEFAULT 102 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 103 do \ 104 if (N) \ 105 { \ 106 (Current).begin = YYRHSLOC (Rhs, 1).begin; \ 107 (Current).end = YYRHSLOC (Rhs, N).end; \ 108 } \ 109 else \ 110 { \ 111 (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ 112 } \ 113 while (false) 114 #endif 115 96 116 /* Suppress unused-variable warnings by "using" E. */ 97 117 #define YYUSE(e) ((void) (e)) … … 145 165 namespace lol { 146 166 147 /* Line 379 of lalr1.cc */ 148 #line 149 "generated/easymesh-parser.cpp" 149 #if YYERROR_VERBOSE 167 /* Line 382 of lalr1.cc */ 168 #line 169 "generated/easymesh-parser.cpp" 150 169 151 170 /* Return YYSTR after stripping away unnecessary quotes and … … 186 205 } 187 206 188 #endif189 207 190 208 /// Build a parser object. … … 287 305 #endif 288 306 307 inline bool 308 EasyMeshParser::yy_pact_value_is_default_ (int yyvalue) 309 { 310 return yyvalue == yypact_ninf_; 311 } 312 313 inline bool 314 EasyMeshParser::yy_table_value_is_error_ (int yyvalue) 315 { 316 return yyvalue == yytable_ninf_; 317 } 318 289 319 int 290 320 EasyMeshParser::parse () … … 308 338 location_type yylloc; 309 339 /// The locations where the error started and ended. 310 location_type yyerror_range[ 2];340 location_type yyerror_range[3]; 311 341 312 342 /// $$. … … 346 376 /* Try to take a decision without lookahead. */ 347 377 yyn = yypact_[yystate]; 348 if (yy n == yypact_ninf_)378 if (yy_pact_value_is_default_ (yyn)) 349 379 goto yydefault; 350 380 … … 379 409 if (yyn <= 0) 380 410 { 381 if (yy n == 0 || yyn == yytable_ninf_)382 goto yyerrlab;411 if (yy_table_value_is_error_ (yyn)) 412 goto yyerrlab; 383 413 yyn = -yyn; 384 414 goto yyreduce; … … 436 466 case 7: 437 467 438 /* Line 6 77of lalr1.cc */468 /* Line 690 of lalr1.cc */ 439 469 #line 89 "easymesh/easymesh-parser.y" 440 470 { mc.m_mesh.OpenBrace(); } … … 443 473 case 8: 444 474 445 /* Line 6 77of lalr1.cc */475 /* Line 690 of lalr1.cc */ 446 476 #line 93 "easymesh/easymesh-parser.y" 447 477 { mc.m_mesh.CloseBrace(); } … … 450 480 case 14: 451 481 452 /* Line 6 77of lalr1.cc */482 /* Line 690 of lalr1.cc */ 453 483 #line 108 "easymesh/easymesh-parser.y" 454 484 { mc.m_mesh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } … … 457 487 case 15: 458 488 459 /* Line 6 77of lalr1.cc */489 /* Line 690 of lalr1.cc */ 460 490 #line 109 "easymesh/easymesh-parser.y" 461 491 { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val); … … 466 496 case 16: 467 497 468 /* Line 6 77of lalr1.cc */498 /* Line 690 of lalr1.cc */ 469 499 #line 112 "easymesh/easymesh-parser.y" 470 500 { mc.m_mesh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } … … 473 503 case 17: 474 504 475 /* Line 6 77of lalr1.cc */505 /* Line 690 of lalr1.cc */ 476 506 #line 113 "easymesh/easymesh-parser.y" 477 507 { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val); … … 482 512 case 18: 483 513 484 /* Line 6 77of lalr1.cc */514 /* Line 690 of lalr1.cc */ 485 515 #line 119 "easymesh/easymesh-parser.y" 486 516 { mc.m_mesh.Chamfer((yysemantic_stack_[(2) - (2)].args).f0); } … … 489 519 case 19: 490 520 491 /* Line 6 77of lalr1.cc */521 /* Line 690 of lalr1.cc */ 492 522 #line 120 "easymesh/easymesh-parser.y" 493 523 { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } … … 496 526 case 20: 497 527 498 /* Line 6 77of lalr1.cc */528 /* Line 690 of lalr1.cc */ 499 529 #line 121 "easymesh/easymesh-parser.y" 500 530 { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } … … 503 533 case 21: 504 534 505 /* Line 6 77of lalr1.cc */535 /* Line 690 of lalr1.cc */ 506 536 #line 122 "easymesh/easymesh-parser.y" 507 537 { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } … … 510 540 case 22: 511 541 512 /* Line 6 77of lalr1.cc */542 /* Line 690 of lalr1.cc */ 513 543 #line 123 "easymesh/easymesh-parser.y" 514 544 { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } … … 517 547 case 23: 518 548 519 /* Line 6 77of lalr1.cc */549 /* Line 690 of lalr1.cc */ 520 550 #line 124 "easymesh/easymesh-parser.y" 521 551 { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); } … … 524 554 case 24: 525 555 526 /* Line 6 77of lalr1.cc */556 /* Line 690 of lalr1.cc */ 527 557 #line 125 "easymesh/easymesh-parser.y" 528 558 { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); } … … 531 561 case 25: 532 562 533 /* Line 6 77of lalr1.cc */563 /* Line 690 of lalr1.cc */ 534 564 #line 126 "easymesh/easymesh-parser.y" 535 565 { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); } … … 538 568 case 26: 539 569 540 /* Line 6 77of lalr1.cc */570 /* Line 690 of lalr1.cc */ 541 571 #line 127 "easymesh/easymesh-parser.y" 542 572 { mc.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } … … 545 575 case 27: 546 576 547 /* Line 6 77of lalr1.cc */577 /* Line 690 of lalr1.cc */ 548 578 #line 128 "easymesh/easymesh-parser.y" 549 579 { mc.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } … … 552 582 case 28: 553 583 554 /* Line 6 77of lalr1.cc */584 /* Line 690 of lalr1.cc */ 555 585 #line 129 "easymesh/easymesh-parser.y" 556 586 { mc.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } … … 559 589 case 29: 560 590 561 /* Line 6 77of lalr1.cc */591 /* Line 690 of lalr1.cc */ 562 592 #line 130 "easymesh/easymesh-parser.y" 563 593 { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 1.0, 1.0)); } … … 566 596 case 30: 567 597 568 /* Line 6 77of lalr1.cc */598 /* Line 690 of lalr1.cc */ 569 599 #line 131 "easymesh/easymesh-parser.y" 570 600 { mc.m_mesh.Scale(vec3(1.0, (yysemantic_stack_[(2) - (2)].args).f0, 1.0)); } … … 573 603 case 31: 574 604 575 /* Line 6 77of lalr1.cc */605 /* Line 690 of lalr1.cc */ 576 606 #line 132 "easymesh/easymesh-parser.y" 577 607 { mc.m_mesh.Scale(vec3(1.0, 1.0, (yysemantic_stack_[(2) - (2)].args).f0)); } … … 580 610 case 32: 581 611 582 /* Line 6 77of lalr1.cc */612 /* Line 690 of lalr1.cc */ 583 613 #line 133 "easymesh/easymesh-parser.y" 584 614 { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } … … 587 617 case 33: 588 618 589 /* Line 6 77of lalr1.cc */619 /* Line 690 of lalr1.cc */ 590 620 #line 134 "easymesh/easymesh-parser.y" 591 621 { mc.m_mesh.MirrorX(); } … … 594 624 case 34: 595 625 596 /* Line 6 77of lalr1.cc */626 /* Line 690 of lalr1.cc */ 597 627 #line 135 "easymesh/easymesh-parser.y" 598 628 { mc.m_mesh.MirrorY(); } … … 601 631 case 35: 602 632 603 /* Line 6 77of lalr1.cc */633 /* Line 690 of lalr1.cc */ 604 634 #line 136 "easymesh/easymesh-parser.y" 605 635 { mc.m_mesh.MirrorZ(); } … … 608 638 case 36: 609 639 610 /* Line 6 77of lalr1.cc */640 /* Line 690 of lalr1.cc */ 611 641 #line 137 "easymesh/easymesh-parser.y" 612 642 { mc.m_mesh.ToggleScaleWinding(); } … … 615 645 case 37: 616 646 617 /* Line 6 77of lalr1.cc */647 /* Line 690 of lalr1.cc */ 618 648 #line 141 "easymesh/easymesh-parser.y" 619 649 { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, … … 624 654 case 38: 625 655 626 /* Line 6 77of lalr1.cc */656 /* Line 690 of lalr1.cc */ 627 657 #line 144 "easymesh/easymesh-parser.y" 628 658 { mc.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } … … 631 661 case 39: 632 662 633 /* Line 6 77of lalr1.cc */663 /* Line 690 of lalr1.cc */ 634 664 #line 145 "easymesh/easymesh-parser.y" 635 665 { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, … … 639 669 case 40: 640 670 641 /* Line 6 77of lalr1.cc */671 /* Line 690 of lalr1.cc */ 642 672 #line 147 "easymesh/easymesh-parser.y" 643 673 { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, … … 647 677 case 41: 648 678 649 /* Line 6 77of lalr1.cc */679 /* Line 690 of lalr1.cc */ 650 680 #line 149 "easymesh/easymesh-parser.y" 651 681 { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0, … … 655 685 case 42: 656 686 657 /* Line 6 77of lalr1.cc */687 /* Line 690 of lalr1.cc */ 658 688 #line 151 "easymesh/easymesh-parser.y" 659 689 { mc.m_mesh.AppendCapsule((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } … … 662 692 case 43: 663 693 664 /* Line 6 77of lalr1.cc */694 /* Line 690 of lalr1.cc */ 665 695 #line 152 "easymesh/easymesh-parser.y" 666 696 { mc.m_mesh.AppendTorus((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } … … 669 699 case 44: 670 700 671 /* Line 6 77of lalr1.cc */701 /* Line 690 of lalr1.cc */ 672 702 #line 153 "easymesh/easymesh-parser.y" 673 703 { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, … … 677 707 case 45: 678 708 679 /* Line 6 77of lalr1.cc */709 /* Line 690 of lalr1.cc */ 680 710 #line 155 "easymesh/easymesh-parser.y" 681 711 { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, … … 685 715 case 46: 686 716 687 /* Line 6 77of lalr1.cc */717 /* Line 690 of lalr1.cc */ 688 718 #line 157 "easymesh/easymesh-parser.y" 689 719 { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } … … 692 722 case 47: 693 723 694 /* Line 6 77of lalr1.cc */724 /* Line 690 of lalr1.cc */ 695 725 #line 158 "easymesh/easymesh-parser.y" 696 726 { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } … … 699 729 case 48: 700 730 701 /* Line 6 77of lalr1.cc */731 /* Line 690 of lalr1.cc */ 702 732 #line 159 "easymesh/easymesh-parser.y" 703 733 { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } … … 706 736 case 49: 707 737 708 /* Line 6 77of lalr1.cc */738 /* Line 690 of lalr1.cc */ 709 739 #line 160 "easymesh/easymesh-parser.y" 710 740 { mc.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 711 (yysemantic_stack_[(2) - (2)].args).f2 / 2, (yysemantic_stack_[(2) - (2)].args).f3 / 2, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, (yysemantic_stack_[(2) - (2)].args).f4,712 (yysemantic_stack_[(2) - (2)].args).f 5, (yysemantic_stack_[(2) - (2)].args).f6, (int)(yysemantic_stack_[(2) - (2)].args).f7); }741 (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, 742 (yysemantic_stack_[(2) - (2)].args).f7, (yysemantic_stack_[(2) - (2)].args).f8, (int)(yysemantic_stack_[(2) - (2)].args).f9); } 713 743 break; 714 744 715 745 case 50: 716 746 717 /* Line 6 77of lalr1.cc */747 /* Line 690 of lalr1.cc */ 718 748 #line 165 "easymesh/easymesh-parser.y" 719 749 { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } … … 722 752 case 51: 723 753 724 /* Line 6 77of lalr1.cc */754 /* Line 690 of lalr1.cc */ 725 755 #line 166 "easymesh/easymesh-parser.y" 726 756 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(2) - (2)].fval); } … … 729 759 case 52: 730 760 731 /* Line 6 77of lalr1.cc */761 /* Line 690 of lalr1.cc */ 732 762 #line 167 "easymesh/easymesh-parser.y" 733 763 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(2) - (2)].fval); } … … 736 766 case 53: 737 767 738 /* Line 6 77of lalr1.cc */768 /* Line 690 of lalr1.cc */ 739 769 #line 168 "easymesh/easymesh-parser.y" 740 770 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(2) - (2)].fval); } … … 743 773 case 54: 744 774 745 /* Line 6 77of lalr1.cc */775 /* Line 690 of lalr1.cc */ 746 776 #line 169 "easymesh/easymesh-parser.y" 747 777 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(2) - (2)].fval); } … … 750 780 case 55: 751 781 752 /* Line 6 77of lalr1.cc */782 /* Line 690 of lalr1.cc */ 753 783 #line 170 "easymesh/easymesh-parser.y" 754 784 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(2) - (2)].fval); } … … 757 787 case 56: 758 788 759 /* Line 6 77of lalr1.cc */789 /* Line 690 of lalr1.cc */ 760 790 #line 171 "easymesh/easymesh-parser.y" 761 791 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(2) - (2)].fval); } … … 764 794 case 57: 765 795 766 /* Line 6 77of lalr1.cc */796 /* Line 690 of lalr1.cc */ 767 797 #line 172 "easymesh/easymesh-parser.y" 768 798 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(2) - (2)].fval); } … … 771 801 case 58: 772 802 773 /* Line 677 of lalr1.cc */ 774 #line 175 "easymesh/easymesh-parser.y" 803 /* Line 690 of lalr1.cc */ 804 #line 173 "easymesh/easymesh-parser.y" 805 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f8 = (yysemantic_stack_[(2) - (2)].fval); } 806 break; 807 808 case 59: 809 810 /* Line 690 of lalr1.cc */ 811 #line 174 "easymesh/easymesh-parser.y" 812 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f9 = (yysemantic_stack_[(2) - (2)].fval); } 813 break; 814 815 case 60: 816 817 /* Line 690 of lalr1.cc */ 818 #line 177 "easymesh/easymesh-parser.y" 775 819 { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } 776 820 break; 777 821 778 case 59:779 780 /* Line 6 77of lalr1.cc */781 #line 17 6"easymesh/easymesh-parser.y"822 case 61: 823 824 /* Line 690 of lalr1.cc */ 825 #line 178 "easymesh/easymesh-parser.y" 782 826 { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } 783 827 break; … … 785 829 786 830 787 /* Line 6 77of lalr1.cc */788 #line 789"generated/easymesh-parser.cpp"831 /* Line 690 of lalr1.cc */ 832 #line 833 "generated/easymesh-parser.cpp" 789 833 default: 790 834 break; 791 835 } 836 /* User semantic actions sometimes alter yychar, and that requires 837 that yytoken be updated with the new translation. We take the 838 approach of translating immediately before every use of yytoken. 839 One alternative is translating here after every semantic action, 840 but that translation would be missed if the semantic action 841 invokes YYABORT, YYACCEPT, or YYERROR immediately after altering 842 yychar. In the case of YYABORT or YYACCEPT, an incorrect 843 destructor might then be invoked immediately. In the case of 844 YYERROR, subsequent parser actions might lead to an incorrect 845 destructor call or verbose syntax error message before the 846 lookahead is translated. */ 792 847 YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); 793 848 … … 813 868 `------------------------------------*/ 814 869 yyerrlab: 870 /* Make sure we have latest lookahead translation. See comments at 871 user semantic actions for why this is necessary. */ 872 yytoken = yytranslate_ (yychar); 873 815 874 /* If not already recovering from an error, report this error. */ 816 875 if (!yyerrstatus_) 817 876 { 818 877 ++yynerrs_; 878 if (yychar == yyempty_) 879 yytoken = yyempty_; 819 880 error (yylloc, yysyntax_error_ (yystate, yytoken)); 820 881 } 821 882 822 yyerror_range[ 0] = yylloc;883 yyerror_range[1] = yylloc; 823 884 if (yyerrstatus_ == 3) 824 885 { … … 855 916 goto yyerrorlab; 856 917 857 yyerror_range[ 0] = yylocation_stack_[yylen - 1];918 yyerror_range[1] = yylocation_stack_[yylen - 1]; 858 919 /* Do not reclaim the symbols of the rule which action triggered 859 920 this YYERROR. */ … … 872 933 { 873 934 yyn = yypact_[yystate]; 874 if ( yyn != yypact_ninf_)935 if (!yy_pact_value_is_default_ (yyn)) 875 936 { 876 937 yyn += yyterror_; … … 887 948 YYABORT; 888 949 889 yyerror_range[ 0] = yylocation_stack_[0];950 yyerror_range[1] = yylocation_stack_[0]; 890 951 yydestruct_ ("Error: popping", 891 952 yystos_[yystate], … … 896 957 } 897 958 898 yyerror_range[ 1] = yylloc;959 yyerror_range[2] = yylloc; 899 960 // Using YYLLOC is tempting, but would change the location of 900 961 // the lookahead. YYLOC is available though. 901 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);962 YYLLOC_DEFAULT (yyloc, yyerror_range, 2); 902 963 yysemantic_stack_.push (yylval); 903 964 yylocation_stack_.push (yyloc); … … 922 983 yyreturn: 923 984 if (yychar != yyempty_) 924 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); 985 { 986 /* Make sure we have latest lookahead translation. See comments 987 at user semantic actions for why this is necessary. */ 988 yytoken = yytranslate_ (yychar); 989 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, 990 &yylloc); 991 } 925 992 926 993 /* Do not reclaim the symbols of the rule which action triggered … … 941 1008 // Generate an error message. 942 1009 std::string 943 EasyMeshParser::yysyntax_error_ (int yystate, int tok) 944 { 945 std::string res; 946 YYUSE (yystate); 947 #if YYERROR_VERBOSE 948 int yyn = yypact_[yystate]; 949 if (yypact_ninf_ < yyn && yyn <= yylast_) 1010 EasyMeshParser::yysyntax_error_ (int yystate, int yytoken) 1011 { 1012 std::string yyres; 1013 // Number of reported tokens (one for the "unexpected", one per 1014 // "expected"). 1015 size_t yycount = 0; 1016 // Its maximum. 1017 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1018 // Arguments of yyformat. 1019 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1020 1021 /* There are many possibilities here to consider: 1022 - If this state is a consistent state with a default action, then 1023 the only way this function was invoked is if the default action 1024 is an error action. In that case, don't check for expected 1025 tokens because there are none. 1026 - The only way there can be no lookahead present (in yytoken) is 1027 if this state is a consistent state with a default action. 1028 Thus, detecting the absence of a lookahead is sufficient to 1029 determine that there is no unexpected or expected token to 1030 report. In that case, just report a simple "syntax error". 1031 - Don't assume there isn't a lookahead just because this state is 1032 a consistent state with a default action. There might have 1033 been a previous inconsistent state, consistent state with a 1034 non-default action, or user semantic action that manipulated 1035 yychar. 1036 - Of course, the expected token list depends on states to have 1037 correct lookahead information, and it depends on the parser not 1038 to perform extra reductions after fetching a lookahead from the 1039 scanner and before detecting a syntax error. Thus, state 1040 merging (from LALR or IELR) and default reductions corrupt the 1041 expected token list. However, the list is correct for 1042 canonical LR with one exception: it will still contain any 1043 token that will not be accepted due to an error action in a 1044 later state. 1045 */ 1046 if (yytoken != yyempty_) 950 1047 { 951 /* Start YYX at -YYN if negative to avoid negative indexes in 952 YYCHECK. */ 953 int yyxbegin = yyn < 0 ? -yyn : 0; 954 955 /* Stay within bounds of both yycheck and yytname. */ 956 int yychecklim = yylast_ - yyn + 1; 957 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; 958 int count = 0; 959 for (int x = yyxbegin; x < yyxend; ++x) 960 if (yycheck_[x + yyn] == x && x != yyterror_) 961 ++count; 962 963 // FIXME: This method of building the message is not compatible 964 // with internationalization. It should work like yacc.c does it. 965 // That is, first build a string that looks like this: 966 // "syntax error, unexpected %s or %s or %s" 967 // Then, invoke YY_ on this string. 968 // Finally, use the string as a format to output 969 // yytname_[tok], etc. 970 // Until this gets fixed, this message appears in English only. 971 res = "syntax error, unexpected "; 972 res += yytnamerr_ (yytname_[tok]); 973 if (count < 5) 974 { 975 count = 0; 976 for (int x = yyxbegin; x < yyxend; ++x) 977 if (yycheck_[x + yyn] == x && x != yyterror_) 978 { 979 res += (!count++) ? ", expecting " : " or "; 980 res += yytnamerr_ (yytname_[x]); 981 } 982 } 1048 yyarg[yycount++] = yytname_[yytoken]; 1049 int yyn = yypact_[yystate]; 1050 if (!yy_pact_value_is_default_ (yyn)) 1051 { 1052 /* Start YYX at -YYN if negative to avoid negative indexes in 1053 YYCHECK. In other words, skip the first -YYN actions for 1054 this state because they are default actions. */ 1055 int yyxbegin = yyn < 0 ? -yyn : 0; 1056 /* Stay within bounds of both yycheck and yytname. */ 1057 int yychecklim = yylast_ - yyn + 1; 1058 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; 1059 for (int yyx = yyxbegin; yyx < yyxend; ++yyx) 1060 if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ 1061 && !yy_table_value_is_error_ (yytable_[yyx + yyn])) 1062 { 1063 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1064 { 1065 yycount = 1; 1066 break; 1067 } 1068 else 1069 yyarg[yycount++] = yytname_[yyx]; 1070 } 1071 } 983 1072 } 984 else 985 #endif 986 res = YY_("syntax error"); 987 return res; 1073 1074 char const* yyformat = 0; 1075 switch (yycount) 1076 { 1077 #define YYCASE_(N, S) \ 1078 case N: \ 1079 yyformat = S; \ 1080 break 1081 YYCASE_(0, YY_("syntax error")); 1082 YYCASE_(1, YY_("syntax error, unexpected %s")); 1083 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1084 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1085 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1086 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1087 #undef YYCASE_ 1088 } 1089 1090 // Argument number. 1091 size_t yyi = 0; 1092 for (char const* yyp = yyformat; *yyp; ++yyp) 1093 if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) 1094 { 1095 yyres += yytnamerr_ (yyarg[yyi++]); 1096 ++yyp; 1097 } 1098 else 1099 yyres += *yyp; 1100 return yyres; 988 1101 } 989 1102 … … 991 1104 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 992 1105 STATE-NUM. */ 993 const signed char EasyMeshParser::yypact_ninf_ = - 10;1106 const signed char EasyMeshParser::yypact_ninf_ = -48; 994 1107 const signed char 995 1108 EasyMeshParser::yypact_[] = 996 1109 { 997 -3, 11, 87, 6, 6, 6, 6, -10, 6, 6,998 6, 6, -10, 6, 6, 6, 6, -10, 6, 6,999 - 10, 6, 6, 6, 6, 6, 6, 6, 6, 6,1000 6, 6, 6, 6, 6, -10, 36, 43, -3, -3,1001 7 3, -10, -10, -10, -10, -10, -10, 6, 6, 6,1002 6, -10, -10, -10, -10, -10, -10, -10, -10, -10,1003 - 10, -10, -10, -10, -10, -10, -10, -10, -10, -10,1004 6, 6, -10, -10, -10, -10, -10, -10, -10, -10,1005 - 10, -10, -10, 6, 6, -10, -10, -10, -10, -10,1006 10, -10, -10, -10, -10, -10, -10, -10, -10, -10,1007 - 10, -101110 37, -27, 89, -32, -32, -32, -32, -48, -32, -32, 1111 -32, -32, -48, -32, -32, -32, -32, -48, -32, -32, 1112 -48, -32, -32, -32, -32, -32, -32, -32, -32, -32, 1113 -32, -32, -32, -32, -32, -48, 5, 13, 37, 37, 1114 75, -48, -48, -48, -48, -48, -48, -32, -32, -32, 1115 -32, -48, -48, -48, -48, -48, -48, -48, -48, -48, 1116 -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, 1117 -32, -32, -48, -48, -48, -48, -48, -48, -48, -48, 1118 -48, -48, -48, -32, -32, -32, -32, -48, -48, -48, 1119 -48, -48, -25, -48, -48, -48, -48, -48, -48, -48, 1120 -48, -48, -48, -48, -48, -48 1008 1121 }; 1009 1122 1010 /* YYDEFACT[S] -- default r ule to reduce with in state S when YYTABLE1011 doesn't specify something else to do. Zero means the default is an1012 error. */1123 /* YYDEFACT[S] -- default reduction number in state S. Performed when 1124 YYTABLE doesn't specify something else to do. Zero means the 1125 default is an error. */ 1013 1126 const unsigned char 1014 1127 EasyMeshParser::yydefact_[] = … … 1018 1131 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1019 1132 0, 0, 0, 0, 0, 7, 0, 0, 3, 0, 1020 5, 9, 11, 12, 13, 58, 15, 0, 0, 0,1133 5, 9, 11, 12, 13, 60, 15, 0, 0, 0, 1021 1134 0, 14, 50, 17, 16, 19, 23, 26, 29, 20, 1022 1135 24, 27, 30, 21, 25, 28, 31, 22, 32, 18, 1023 1136 0, 0, 37, 38, 39, 40, 41, 42, 44, 45, 1024 46, 47, 48, 0, 0, 49, 43, 1, 2, 4,1025 0, 10, 59, 51, 52, 53, 54, 55, 56, 57,1026 8, 61137 46, 47, 48, 0, 0, 0, 0, 49, 43, 1, 1138 2, 4, 0, 10, 61, 51, 52, 53, 54, 55, 1139 56, 57, 58, 59, 8, 6 1027 1140 }; 1028 1141 … … 1031 1144 EasyMeshParser::yypgoto_[] = 1032 1145 { 1033 -10, -10, -4, -10, -10, -10, -10, 14, -10, -10, 1034 -10, 107, 26, 37, 44, 31, 30, -10, -10, -9 1146 -48, -48, -19, -48, -48, -48, -48, -15, -48, -48, 1147 -48, 109, -4, -1, 6, -7, 1, -48, -48, -48, 1148 -48, -47 1035 1149 }; 1036 1150 … … 1039 1153 EasyMeshParser::yydefgoto_[] = 1040 1154 { 1041 -1, 36, 37, 38, 39, 101, 40, 41, 42, 43, 1042 44, 48, 49, 50, 70, 71, 72, 84, 85, 52 1155 -1, 36, 37, 38, 39, 105, 40, 41, 42, 43, 1156 44, 48, 49, 50, 70, 71, 72, 84, 85, 86, 1157 87, 52 1043 1158 }; 1044 1159 1045 1160 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 1046 1161 positive, shift that token. If negative, reduce the rule which 1047 number is the opposite. If zero, do what YYDEFACT says. */1162 number is the opposite. If YYTABLE_NINF_, syntax error. */ 1048 1163 const signed char EasyMeshParser::yytable_ninf_ = -1; 1049 1164 const unsigned char 1050 1165 EasyMeshParser::yytable_[] = 1051 1166 { 1052 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1167 94, 95, 96, 97, 57, 89, 45, 51, 54, 61, 1168 47, 45, 46, 90, 65, 47, 104, 67, 68, 91, 1169 92, 78, 73, 98, 99, 93, 77, 81, 82, 80, 1170 74, 75, 76, 88, 83, 79, 100, 101, 102, 103, 1171 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1053 1172 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1054 1173 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1055 31, 32, 33, 34, 89, 90, 87, 35, 92, 93, 1056 94, 95, 57, 88, 45, 51, 54, 61, 47, 45, 1057 46, 100, 65, 47, 91, 67, 68, 81, 82, 78, 1058 73, 96, 97, 83, 77, 0, 0, 80, 74, 75, 1059 76, 86, 0, 79, 98, 99, 1, 2, 3, 4, 1174 31, 32, 33, 34, 0, 0, 0, 35, 1, 2, 1175 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1176 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1177 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1178 33, 34, 55, 56, 0, 58, 0, 59, 60, 0, 1179 62, 0, 63, 64, 0, 66, 0, 45, 53, 0, 1180 69, 47 1181 }; 1182 1183 /* YYCHECK. */ 1184 const signed char 1185 EasyMeshParser::yycheck_[] = 1186 { 1187 47, 48, 49, 50, 5, 0, 38, 1, 2, 10, 1188 42, 38, 39, 0, 15, 42, 41, 18, 19, 38, 1189 39, 28, 23, 70, 71, 40, 27, 31, 32, 30, 1190 24, 25, 26, 34, 33, 29, 83, 84, 85, 86, 1191 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1192 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1193 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1194 33, 34, 35, 36, -1, -1, -1, 40, 3, 4, 1060 1195 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1061 1196 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 1062 1197 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 1063 55, 56, 0, 58, 0, 59, 60, 0, 62, 0, 1064 63, 64, 0, 66, 0, 45, 53, 0, 69, 47 1065 }; 1066 1067 /* YYCHECK. */ 1068 const signed char 1069 EasyMeshParser::yycheck_[] = 1070 { 1071 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1072 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1073 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1074 33, 34, 35, 36, 38, 39, 0, 40, 47, 48, 1075 49, 50, 5, 0, 38, 1, 2, 10, 42, 38, 1076 39, 41, 15, 42, 40, 18, 19, 31, 32, 28, 1077 23, 70, 71, 33, 27, -1, -1, 30, 24, 25, 1078 26, 34, -1, 29, 83, 84, 3, 4, 5, 6, 1079 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1080 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 1081 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 1082 3, 4, -1, 6, -1, 8, 9, -1, 11, -1, 1083 13, 14, -1, 16, -1, 38, 39, -1, 21, 42 1198 35, 36, 3, 4, -1, 6, -1, 8, 9, -1, 1199 11, -1, 13, 14, -1, 16, -1, 38, 39, -1, 1200 21, 42 1084 1201 }; 1085 1202 … … 1094 1211 32, 33, 34, 35, 36, 40, 44, 45, 46, 47, 1095 1212 49, 50, 51, 52, 53, 38, 39, 42, 54, 55, 1096 56, 57, 6 2, 39, 57, 54, 54, 56, 54, 54,1213 56, 57, 64, 39, 57, 54, 54, 56, 54, 54, 1097 1214 54, 56, 54, 54, 54, 56, 54, 56, 56, 54, 1098 1215 57, 58, 59, 56, 57, 57, 57, 56, 58, 57, 1099 56, 55, 55, 59, 60, 61, 56, 0, 0, 45,1100 45, 50, 62, 62, 62, 62, 62, 62, 62, 62,1101 41, 481216 56, 55, 55, 59, 60, 61, 62, 63, 56, 0, 1217 0, 45, 45, 50, 64, 64, 64, 64, 64, 64, 1218 64, 64, 64, 64, 41, 48 1102 1219 }; 1103 1220 … … 1125 1242 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 1126 1243 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 1127 54, 55, 56, 57, 58, 59, 60, 61, 62, 62 1244 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 1245 64, 64 1128 1246 }; 1129 1247 … … 1137 1255 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1138 1256 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1139 1, 2, 2, 2, 2, 2, 2, 2, 1, 2 1257 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1258 1, 2 1140 1259 }; 1141 1260 … … 1157 1276 "mesh_open", "mesh_close", "mesh_command_list", "mesh_command", 1158 1277 "color_command", "transform_command", "primitive_command", "args1", 1159 "args2", "args3", "args4", "args5", "args6", "args7", "args8", "number", 0 1278 "args2", "args3", "args4", "args5", "args6", "args7", "args8", "args9", 1279 "args10", "number", 0 1160 1280 }; 1161 1281 #endif … … 1179 1299 57, -1, 29, 56, -1, 36, 56, -1, 30, 58, 1180 1300 -1, 31, 57, -1, 32, 56, -1, 33, 55, -1, 1181 34, 55, -1, 35, 6 1, -1, 62, -1, 54, 62,1182 -1, 55, 6 2, -1, 56, 62, -1, 57, 62, -1,1183 58, 6 2, -1, 59, 62, -1, 60, 62, -1, 38,1184 -1, 42, 62, -11301 34, 55, -1, 35, 63, -1, 64, -1, 54, 64, 1302 -1, 55, 64, -1, 56, 64, -1, 57, 64, -1, 1303 58, 64, -1, 59, 64, -1, 60, 64, -1, 61, 1304 64, -1, 62, 64, -1, 38, -1, 42, 64, -1 1185 1305 }; 1186 1306 … … 1195 1315 80, 83, 86, 89, 91, 93, 95, 97, 100, 103, 1196 1316 106, 109, 112, 115, 118, 121, 124, 127, 130, 133, 1197 136, 138, 141, 144, 147, 150, 153, 156, 159, 161 1317 136, 138, 141, 144, 147, 150, 153, 156, 159, 162, 1318 165, 167 1198 1319 }; 1199 1320 … … 1207 1328 131, 132, 133, 134, 135, 136, 137, 141, 144, 145, 1208 1329 147, 149, 151, 152, 153, 155, 157, 158, 159, 160, 1209 165, 166, 167, 168, 169, 170, 171, 172, 175, 176 1330 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 1331 177, 178 1210 1332 }; 1211 1333 … … 1285 1407 1286 1408 const int EasyMeshParser::yyeof_ = 0; 1287 const int EasyMeshParser::yylast_ = 1 29;1288 const int EasyMeshParser::yynnts_ = 2 0;1409 const int EasyMeshParser::yylast_ = 131; 1410 const int EasyMeshParser::yynnts_ = 22; 1289 1411 const int EasyMeshParser::yyempty_ = -2; 1290 const int EasyMeshParser::yyfinal_ = 8 7;1412 const int EasyMeshParser::yyfinal_ = 89; 1291 1413 const int EasyMeshParser::yyterror_ = 1; 1292 1414 const int EasyMeshParser::yyerrcode_ = 256; … … 1299 1421 } // lol 1300 1422 1301 /* Line 1 053of lalr1.cc */1302 #line 1 303"generated/easymesh-parser.cpp"1303 1304 1305 /* Line 1 055of lalr1.cc */1306 #line 1 79"easymesh/easymesh-parser.y"1423 /* Line 1136 of lalr1.cc */ 1424 #line 1425 "generated/easymesh-parser.cpp" 1425 1426 1427 /* Line 1138 of lalr1.cc */ 1428 #line 181 "easymesh/easymesh-parser.y" 1307 1429 1308 1430 -
trunk/src/generated/easymesh-parser.h
r2116 r2152 1 /* A Bison parser, made by GNU Bison 2. 4.2. */1 /* A Bison parser, made by GNU Bison 2.5. */ 2 2 3 3 /* Skeleton interface for Bison LALR(1) parsers in C++ 4 4 5 Copyright (C) 2002-201 0Free Software Foundation, Inc.5 Copyright (C) 2002-2011 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify … … 41 41 #include <iostream> 42 42 #include "stack.hh" 43 44 45 namespace lol {46 47 /* Line 34 of lalr1.cc */48 #line 49 "generated/easymesh-parser.h"49 class position;50 class location;51 52 } // lol53 54 /* Line 34 of lalr1.cc */55 #line 56 "generated/easymesh-parser.h"56 57 43 #include "location.hh" 58 44 … … 75 61 #endif 76 62 77 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].78 If N is 0, then set CURRENT to the empty location which ends79 the previous symbol: RHS[0] (always defined). */80 81 #ifndef YYLLOC_DEFAULT82 # define YYLLOC_DEFAULT(Current, Rhs, N) \83 do { \84 if (N) \85 { \86 (Current).begin = (Rhs)[1].begin; \87 (Current).end = (Rhs)[N].end; \88 } \89 else \90 { \91 (Current).begin = (Current).end = (Rhs)[0].end; \92 } \93 } while (false)94 #endif95 96 63 97 64 namespace lol { 98 65 99 /* Line 3 4of lalr1.cc */100 #line 101"generated/easymesh-parser.h"66 /* Line 35 of lalr1.cc */ 67 #line 68 "generated/easymesh-parser.h" 101 68 102 69 /// A Bison parser. … … 109 76 { 110 77 111 /* Line 3 4of lalr1.cc */78 /* Line 35 of lalr1.cc */ 112 79 #line 36 "easymesh/easymesh-parser.y" 113 80 … … 115 82 /* Can't use uin32_t here for some reason */ 116 83 unsigned u32val; 117 struct { float f0, f1, f2, f3, f4, f5, f6, f7 ; } args;118 119 120 121 /* Line 3 4of lalr1.cc */122 #line 123"generated/easymesh-parser.h"84 struct { float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; } args; 85 86 87 88 /* Line 35 of lalr1.cc */ 89 #line 90 "generated/easymesh-parser.h" 123 90 }; 124 91 #else … … 243 210 location_stack_type yylocation_stack_; 244 211 212 /// Whether the given \c yypact_ value indicates a defaulted state. 213 /// \param yyvalue the value to check 214 static bool yy_pact_value_is_default_ (int yyvalue); 215 216 /// Whether the given \c yytable_ value indicates a syntax error. 217 /// \param yyvalue the value to check 218 static bool yy_table_value_is_error_ (int yyvalue); 219 245 220 /// Internal symbol numbers. 246 221 typedef unsigned char token_number_type; … … 250 225 static const signed char yypact_ninf_; 251 226 252 /// For a state, default r ule to reduce.227 /// For a state, default reduction number. 253 228 /// Unless\a yytable_ specifies something else to do. 254 229 /// Zero means the default is an error. … … 281 256 #endif 282 257 283 #if YYERROR_VERBOSE284 258 /// Convert the symbol name \a n to a form suitable for a diagnostic. 285 virtual std::string yytnamerr_ (const char *n); 286 #endif 259 static std::string yytnamerr_ (const char *n); 287 260 288 261 #if YYDEBUG … … 342 315 } // lol 343 316 344 /* Line 3 4of lalr1.cc */345 #line 3 46"generated/easymesh-parser.h"317 /* Line 35 of lalr1.cc */ 318 #line 319 "generated/easymesh-parser.h" 346 319 347 320 -
trunk/src/generated/location.hh
r2116 r2152 1 /* A Bison parser, made by GNU Bison 2. 4.2. */1 /* A Bison parser, made by GNU Bison 2.5. */ 2 2 3 3 /* Locations for Bison parsers in C++ 4 4 5 Copyright (C) 2002-2007, 2009-201 0Free Software Foundation, Inc.5 Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify -
trunk/src/generated/lolfx-parser.cpp
r2116 r2152 1 /* A Bison parser, made by GNU Bison 2. 4.2. */1 /* A Bison parser, made by GNU Bison 2.5. */ 2 2 3 3 /* Skeleton implementation for Bison LALR(1) parsers in C++ 4 4 5 Copyright (C) 2002-201 0Free Software Foundation, Inc.5 Copyright (C) 2002-2011 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify … … 36 36 /* First part of user declarations. */ 37 37 38 /* Line 310of lalr1.cc */38 /* Line 293 of lalr1.cc */ 39 39 #line 1 "gpu/lolfx-parser.y" 40 40 … … 59 59 60 60 61 /* Line 310of lalr1.cc */61 /* Line 293 of lalr1.cc */ 62 62 #line 63 "generated/lolfx-parser.cpp" 63 63 … … 67 67 /* User implementation prologue. */ 68 68 69 /* Line 316of lalr1.cc */69 /* Line 299 of lalr1.cc */ 70 70 #line 241 "gpu/lolfx-parser.y" 71 71 … … 76 76 77 77 78 /* Line 316of lalr1.cc */78 /* Line 299 of lalr1.cc */ 79 79 #line 80 "generated/lolfx-parser.cpp" 80 80 … … 91 91 #endif 92 92 93 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 94 If N is 0, then set CURRENT to the empty location which ends 95 the previous symbol: RHS[0] (always defined). */ 96 97 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 98 #ifndef YYLLOC_DEFAULT 99 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 100 do \ 101 if (N) \ 102 { \ 103 (Current).begin = YYRHSLOC (Rhs, 1).begin; \ 104 (Current).end = YYRHSLOC (Rhs, N).end; \ 105 } \ 106 else \ 107 { \ 108 (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ 109 } \ 110 while (false) 111 #endif 112 93 113 /* Suppress unused-variable warnings by "using" E. */ 94 114 #define YYUSE(e) ((void) (e)) … … 142 162 namespace lol { 143 163 144 /* Line 379 of lalr1.cc */ 145 #line 146 "generated/lolfx-parser.cpp" 146 #if YYERROR_VERBOSE 164 /* Line 382 of lalr1.cc */ 165 #line 166 "generated/lolfx-parser.cpp" 147 166 148 167 /* Return YYSTR after stripping away unnecessary quotes and … … 183 202 } 184 203 185 #endif186 204 187 205 /// Build a parser object. … … 284 302 #endif 285 303 304 inline bool 305 LolFxParser::yy_pact_value_is_default_ (int yyvalue) 306 { 307 return yyvalue == yypact_ninf_; 308 } 309 310 inline bool 311 LolFxParser::yy_table_value_is_error_ (int yyvalue) 312 { 313 return yyvalue == yytable_ninf_; 314 } 315 286 316 int 287 317 LolFxParser::parse () … … 305 335 location_type yylloc; 306 336 /// The locations where the error started and ended. 307 location_type yyerror_range[ 2];337 location_type yyerror_range[3]; 308 338 309 339 /// $$. … … 343 373 /* Try to take a decision without lookahead. */ 344 374 yyn = yypact_[yystate]; 345 if (yy n == yypact_ninf_)375 if (yy_pact_value_is_default_ (yyn)) 346 376 goto yydefault; 347 377 … … 376 406 if (yyn <= 0) 377 407 { 378 if (yy n == 0 || yyn == yytable_ninf_)379 goto yyerrlab;408 if (yy_table_value_is_error_ (yyn)) 409 goto yyerrlab; 380 410 yyn = -yyn; 381 411 goto yyreduce; … … 433 463 case 202: 434 464 435 /* Line 6 77of lalr1.cc */465 /* Line 690 of lalr1.cc */ 436 466 #line 728 "gpu/lolfx-parser.y" 437 467 { std::cout << "New tech " << std::endl; } … … 440 470 case 203: 441 471 442 /* Line 6 77of lalr1.cc */472 /* Line 690 of lalr1.cc */ 443 473 #line 736 "gpu/lolfx-parser.y" 444 474 { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } … … 447 477 case 204: 448 478 449 /* Line 6 77of lalr1.cc */479 /* Line 690 of lalr1.cc */ 450 480 #line 737 "gpu/lolfx-parser.y" 451 481 { std::cout << "New name " << (yysemantic_stack_[(1) - (1)].sval) << std::endl; } … … 454 484 case 207: 455 485 456 /* Line 6 77of lalr1.cc */486 /* Line 690 of lalr1.cc */ 457 487 #line 750 "gpu/lolfx-parser.y" 458 488 { std::cout << "New pass " << std::endl; } … … 461 491 case 226: 462 492 463 /* Line 6 77of lalr1.cc */493 /* Line 690 of lalr1.cc */ 464 494 #line 786 "gpu/lolfx-parser.y" 465 495 { std::cout << "new shader" << std::endl; } … … 468 498 469 499 470 /* Line 6 77of lalr1.cc */471 #line 472 "generated/lolfx-parser.cpp"500 /* Line 690 of lalr1.cc */ 501 #line 502 "generated/lolfx-parser.cpp" 472 502 default: 473 503 break; 474 504 } 505 /* User semantic actions sometimes alter yychar, and that requires 506 that yytoken be updated with the new translation. We take the 507 approach of translating immediately before every use of yytoken. 508 One alternative is translating here after every semantic action, 509 but that translation would be missed if the semantic action 510 invokes YYABORT, YYACCEPT, or YYERROR immediately after altering 511 yychar. In the case of YYABORT or YYACCEPT, an incorrect 512 destructor might then be invoked immediately. In the case of 513 YYERROR, subsequent parser actions might lead to an incorrect 514 destructor call or verbose syntax error message before the 515 lookahead is translated. */ 475 516 YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); 476 517 … … 496 537 `------------------------------------*/ 497 538 yyerrlab: 539 /* Make sure we have latest lookahead translation. See comments at 540 user semantic actions for why this is necessary. */ 541 yytoken = yytranslate_ (yychar); 542 498 543 /* If not already recovering from an error, report this error. */ 499 544 if (!yyerrstatus_) 500 545 { 501 546 ++yynerrs_; 547 if (yychar == yyempty_) 548 yytoken = yyempty_; 502 549 error (yylloc, yysyntax_error_ (yystate, yytoken)); 503 550 } 504 551 505 yyerror_range[ 0] = yylloc;552 yyerror_range[1] = yylloc; 506 553 if (yyerrstatus_ == 3) 507 554 { … … 538 585 goto yyerrorlab; 539 586 540 yyerror_range[ 0] = yylocation_stack_[yylen - 1];587 yyerror_range[1] = yylocation_stack_[yylen - 1]; 541 588 /* Do not reclaim the symbols of the rule which action triggered 542 589 this YYERROR. */ … … 555 602 { 556 603 yyn = yypact_[yystate]; 557 if ( yyn != yypact_ninf_)604 if (!yy_pact_value_is_default_ (yyn)) 558 605 { 559 606 yyn += yyterror_; … … 570 617 YYABORT; 571 618 572 yyerror_range[ 0] = yylocation_stack_[0];619 yyerror_range[1] = yylocation_stack_[0]; 573 620 yydestruct_ ("Error: popping", 574 621 yystos_[yystate], … … 579 626 } 580 627 581 yyerror_range[ 1] = yylloc;628 yyerror_range[2] = yylloc; 582 629 // Using YYLLOC is tempting, but would change the location of 583 630 // the lookahead. YYLOC is available though. 584 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);631 YYLLOC_DEFAULT (yyloc, yyerror_range, 2); 585 632 yysemantic_stack_.push (yylval); 586 633 yylocation_stack_.push (yyloc); … … 605 652 yyreturn: 606 653 if (yychar != yyempty_) 607 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); 654 { 655 /* Make sure we have latest lookahead translation. See comments 656 at user semantic actions for why this is necessary. */ 657 yytoken = yytranslate_ (yychar); 658 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, 659 &yylloc); 660 } 608 661 609 662 /* Do not reclaim the symbols of the rule which action triggered … … 624 677 // Generate an error message. 625 678 std::string 626 LolFxParser::yysyntax_error_ (int yystate, int tok)679 LolFxParser::yysyntax_error_ (int yystate, int yytoken) 627 680 { 628 std::string res; 629 YYUSE (yystate); 630 #if YYERROR_VERBOSE 631 int yyn = yypact_[yystate]; 632 if (yypact_ninf_ < yyn && yyn <= yylast_) 681 std::string yyres; 682 // Number of reported tokens (one for the "unexpected", one per 683 // "expected"). 684 size_t yycount = 0; 685 // Its maximum. 686 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 687 // Arguments of yyformat. 688 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 689 690 /* There are many possibilities here to consider: 691 - If this state is a consistent state with a default action, then 692 the only way this function was invoked is if the default action 693 is an error action. In that case, don't check for expected 694 tokens because there are none. 695 - The only way there can be no lookahead present (in yytoken) is 696 if this state is a consistent state with a default action. 697 Thus, detecting the absence of a lookahead is sufficient to 698 determine that there is no unexpected or expected token to 699 report. In that case, just report a simple "syntax error". 700 - Don't assume there isn't a lookahead just because this state is 701 a consistent state with a default action. There might have 702 been a previous inconsistent state, consistent state with a 703 non-default action, or user semantic action that manipulated 704 yychar. 705 - Of course, the expected token list depends on states to have 706 correct lookahead information, and it depends on the parser not 707 to perform extra reductions after fetching a lookahead from the 708 scanner and before detecting a syntax error. Thus, state 709 merging (from LALR or IELR) and default reductions corrupt the 710 expected token list. However, the list is correct for 711 canonical LR with one exception: it will still contain any 712 token that will not be accepted due to an error action in a 713 later state. 714 */ 715 if (yytoken != yyempty_) 633 716 { 634 /* Start YYX at -YYN if negative to avoid negative indexes in 635 YYCHECK. */ 636 int yyxbegin = yyn < 0 ? -yyn : 0; 637 638 /* Stay within bounds of both yycheck and yytname. */ 639 int yychecklim = yylast_ - yyn + 1; 640 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; 641 int count = 0; 642 for (int x = yyxbegin; x < yyxend; ++x) 643 if (yycheck_[x + yyn] == x && x != yyterror_) 644 ++count; 645 646 // FIXME: This method of building the message is not compatible 647 // with internationalization. It should work like yacc.c does it. 648 // That is, first build a string that looks like this: 649 // "syntax error, unexpected %s or %s or %s" 650 // Then, invoke YY_ on this string. 651 // Finally, use the string as a format to output 652 // yytname_[tok], etc. 653 // Until this gets fixed, this message appears in English only. 654 res = "syntax error, unexpected "; 655 res += yytnamerr_ (yytname_[tok]); 656 if (count < 5) 657 { 658 count = 0; 659 for (int x = yyxbegin; x < yyxend; ++x) 660 if (yycheck_[x + yyn] == x && x != yyterror_) 661 { 662 res += (!count++) ? ", expecting " : " or "; 663 res += yytnamerr_ (yytname_[x]); 664 } 665 } 717 yyarg[yycount++] = yytname_[yytoken]; 718 int yyn = yypact_[yystate]; 719 if (!yy_pact_value_is_default_ (yyn)) 720 { 721 /* Start YYX at -YYN if negative to avoid negative indexes in 722 YYCHECK. In other words, skip the first -YYN actions for 723 this state because they are default actions. */ 724 int yyxbegin = yyn < 0 ? -yyn : 0; 725 /* Stay within bounds of both yycheck and yytname. */ 726 int yychecklim = yylast_ - yyn + 1; 727 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; 728 for (int yyx = yyxbegin; yyx < yyxend; ++yyx) 729 if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ 730 && !yy_table_value_is_error_ (yytable_[yyx + yyn])) 731 { 732 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 733 { 734 yycount = 1; 735 break; 736 } 737 else 738 yyarg[yycount++] = yytname_[yyx]; 739 } 740 } 666 741 } 667 else 668 #endif 669 res = YY_("syntax error"); 670 return res; 742 743 char const* yyformat = 0; 744 switch (yycount) 745 { 746 #define YYCASE_(N, S) \ 747 case N: \ 748 yyformat = S; \ 749 break 750 YYCASE_(0, YY_("syntax error")); 751 YYCASE_(1, YY_("syntax error, unexpected %s")); 752 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 753 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 754 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 755 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 756 #undef YYCASE_ 757 } 758 759 // Argument number. 760 size_t yyi = 0; 761 for (char const* yyp = yyformat; *yyp; ++yyp) 762 if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) 763 { 764 yyres += yytnamerr_ (yyarg[yyi++]); 765 ++yyp; 766 } 767 else 768 yyres += *yyp; 769 return yyres; 671 770 } 672 771 … … 747 846 }; 748 847 749 /* YYDEFACT[S] -- default r ule to reduce with in state S when YYTABLE750 doesn't specify something else to do. Zero means the default is an751 error. */848 /* YYDEFACT[S] -- default reduction number in state S. Performed when 849 YYTABLE doesn't specify something else to do. Zero means the 850 default is an error. */ 752 851 const unsigned short int 753 852 LolFxParser::yydefact_[] = … … 856 955 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 857 956 positive, shift that token. If negative, reduce the rule which 858 number is the opposite. If zero, do what YYDEFACT says. */957 number is the opposite. If YYTABLE_NINF_, syntax error. */ 859 958 const short int LolFxParser::yytable_ninf_ = -323; 860 959 const short int … … 3792 3891 } // lol 3793 3892 3794 /* Line 1 053of lalr1.cc */3795 #line 3 796"generated/lolfx-parser.cpp"3796 3797 3798 /* Line 1 055of lalr1.cc */3893 /* Line 1136 of lalr1.cc */ 3894 #line 3895 "generated/lolfx-parser.cpp" 3895 3896 3897 /* Line 1138 of lalr1.cc */ 3799 3898 #line 1298 "gpu/lolfx-parser.y" 3800 3899 -
trunk/src/generated/lolfx-parser.h
r2116 r2152 1 /* A Bison parser, made by GNU Bison 2. 4.2. */1 /* A Bison parser, made by GNU Bison 2.5. */ 2 2 3 3 /* Skeleton interface for Bison LALR(1) parsers in C++ 4 4 5 Copyright (C) 2002-201 0Free Software Foundation, Inc.5 Copyright (C) 2002-2011 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify … … 41 41 #include <iostream> 42 42 #include "stack.hh" 43 44 45 namespace lol {46 47 /* Line 34 of lalr1.cc */48 #line 49 "generated/lolfx-parser.h"49 class position;50 class location;51 52 } // lol53 54 /* Line 34 of lalr1.cc */55 #line 56 "generated/lolfx-parser.h"56 57 43 #include "location.hh" 58 44 … … 75 61 #endif 76 62 77 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].78 If N is 0, then set CURRENT to the empty location which ends79 the previous symbol: RHS[0] (always defined). */80 81 #ifndef YYLLOC_DEFAULT82 # define YYLLOC_DEFAULT(Current, Rhs, N) \83 do { \84 if (N) \85 { \86 (Current).begin = (Rhs)[1].begin; \87 (Current).end = (Rhs)[N].end; \88 } \89 else \90 { \91 (Current).begin = (Current).end = (Rhs)[0].end; \92 } \93 } while (false)94 #endif95 96 63 97 64 namespace lol { 98 65 99 /* Line 3 4of lalr1.cc */100 #line 101"generated/lolfx-parser.h"66 /* Line 35 of lalr1.cc */ 67 #line 68 "generated/lolfx-parser.h" 101 68 102 69 /// A Bison parser. … … 109 76 { 110 77 111 /* Line 3 4of lalr1.cc */78 /* Line 35 of lalr1.cc */ 112 79 #line 34 "gpu/lolfx-parser.y" 113 80 … … 119 86 120 87 121 /* Line 3 4of lalr1.cc */122 #line 123"generated/lolfx-parser.h"88 /* Line 35 of lalr1.cc */ 89 #line 90 "generated/lolfx-parser.h" 123 90 }; 124 91 #else … … 641 608 location_stack_type yylocation_stack_; 642 609 610 /// Whether the given \c yypact_ value indicates a defaulted state. 611 /// \param yyvalue the value to check 612 static bool yy_pact_value_is_default_ (int yyvalue); 613 614 /// Whether the given \c yytable_ value indicates a syntax error. 615 /// \param yyvalue the value to check 616 static bool yy_table_value_is_error_ (int yyvalue); 617 643 618 /// Internal symbol numbers. 644 619 typedef unsigned short int token_number_type; … … 648 623 static const short int yypact_ninf_; 649 624 650 /// For a state, default r ule to reduce.625 /// For a state, default reduction number. 651 626 /// Unless\a yytable_ specifies something else to do. 652 627 /// Zero means the default is an error. … … 679 654 #endif 680 655 681 #if YYERROR_VERBOSE682 656 /// Convert the symbol name \a n to a form suitable for a diagnostic. 683 virtual std::string yytnamerr_ (const char *n); 684 #endif 657 static std::string yytnamerr_ (const char *n); 685 658 686 659 #if YYDEBUG … … 740 713 } // lol 741 714 742 /* Line 3 4of lalr1.cc */743 #line 7 44"generated/lolfx-parser.h"715 /* Line 35 of lalr1.cc */ 716 #line 717 "generated/lolfx-parser.h" 744 717 745 718 -
trunk/src/generated/position.hh
r2116 r2152 1 /* A Bison parser, made by GNU Bison 2. 4.2. */1 /* A Bison parser, made by GNU Bison 2.5. */ 2 2 3 3 /* Positions for Bison parsers in C++ 4 4 5 Copyright (C) 2002-2007, 2009-201 0Free Software Foundation, Inc.5 Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify -
trunk/src/generated/stack.hh
r2116 r2152 1 /* A Bison parser, made by GNU Bison 2. 4.2. */1 /* A Bison parser, made by GNU Bison 2.5. */ 2 2 3 3 /* Stack handling for Bison parsers in C++ 4 4 5 Copyright (C) 2002-201 0Free Software Foundation, Inc.5 Copyright (C) 2002-2011 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify … … 39 39 namespace lol { 40 40 41 /* Line 1 066of lalr1.cc */41 /* Line 1149 of lalr1.cc */ 42 42 #line 43 "generated/stack.hh" 43 43 template <class T, class S = std::deque<T> > … … 129 129 } // lol 130 130 131 /* Line 1 152of lalr1.cc */131 /* Line 1235 of lalr1.cc */ 132 132 #line 133 "generated/stack.hh" 133 133 -
trunk/tutorial/05_easymesh.cpp
r2151 r2152 21 21 { 22 22 public: 23 void AddPiece(int x, int y, int h, int dx, int dy, int dh)24 {25 m_mesh.OpenBrace();26 for (int j = 0; j < y; ++j)27 for (int i = 0; i < x; ++i)28 {29 m_mesh.OpenBrace();30 m_mesh.Compile("ad12,2.2,0 ty.1 ac12,.2,2.4,2.2,0,1 ty.8 ac12,1.7,2.4,2.4,0,1 ty2.5");31 m_mesh.Translate(vec3(i * 8.f, (h - 1) * 3.2f, j * 8.f));32 m_mesh.CloseBrace();33 }34 m_mesh.OpenBrace();35 m_mesh.AppendFlatChamfBox(vec3(x * 8.f, h * 3.2f, y * 8.f), -.1f);36 m_mesh.Translate(vec3((x - 1) * 4.f, (h - 1) * 1.6f, (y - 1) * 4.f));37 m_mesh.CloseBrace();38 m_mesh.Translate(vec3(dx * 8.f, dh * 3.2f, dy * 8.f));39 40 m_mesh.CloseBrace();41 }42 43 23 EasyMeshTutorial() 44 24 { 25 m_gears.Push(EasyMesh(), mat4(1.0f), 0.0f); 26 m_gears.Push(EasyMesh(), mat4(1.0f), 0.0f); 27 m_gears.Push(EasyMesh(), mat4(1.0f), 180.0f / 18); 28 m_gears.Push(EasyMesh(), mat4(1.0f), 180.0f / 18); 29 m_gears.Push(EasyMesh(), mat4(1.0f), 180.0f / 18); 30 31 m_gears[0].m1.Compile("sc#f9f scb#f9f acg 12 10 5 5 20 20 5 5 0.1 0"); 32 m_gears[1].m1.Compile("sc#ff9 scb#ff9 acg 54 10 95 95 90 90 -5 -5 0.1 0"); 33 m_gears[2].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0"); 34 m_gears[3].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0"); 35 m_gears[4].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0"); 36 45 37 m_angle = 0; 46 47 //m_mesh.Compile("sc#ffb scb#ffb acg 12 10 30 30 5 5 0.1 0");48 m_mesh.Compile("sc#ffb scb#ffb acg 12 10 30 30 -5 -5 0.1 0");49 50 #if 051 m_mesh.Compile("sc#8d3 [ato40 10 40 rx20 ry130 tx30]");52 53 m_mesh.OpenBrace();54 m_mesh.Compile("sc#800 [asph10 25 25 25]");55 m_mesh.Compile("ty50");56 m_mesh.RadialJitter(0.2f);57 m_mesh.Compile("ty-50 tx-40");58 m_mesh.CloseBrace();59 #endif60 61 #if 062 //m_mesh.Compile("sc#94e scb#649 [asph3 7 7 7 tx-6 tz-9]");63 //m_mesh.Compile("sc#49e scb#469 [asph31 7 7 7 tx-6 tz9]");64 m_mesh.Compile("sc#1c1 scb#1c1");65 AddPiece(16, 16, 1, -8, -8, -4);66 67 /* Flat white LOL */68 m_mesh.Compile("sc#ccc scb#ccc");69 70 AddPiece(1, 4, 1, -7, -7, -3);71 AddPiece(2, 1, 1, -6, -4, -3);72 73 AddPiece(1, 4, 1, -3, -7, -3);74 AddPiece(2, 1, 1, -2, -7, -3);75 AddPiece(2, 1, 1, -2, -4, -3);76 AddPiece(1, 2, 1, -1, -6, -3);77 78 AddPiece(1, 4, 1, 1, -7, -3);79 AddPiece(2, 1, 1, 2, -4, -3);80 81 /* High red LOL */82 m_mesh.Compile("sc#e33 scb#e33");83 84 AddPiece(3, 1, 3, 3, 4, -3);85 AddPiece(1, 1, 3, 5, 4, 0);86 AddPiece(1, 1, 3, 5, 4, 3);87 AddPiece(1, 1, 3, 5, 4, 6);88 89 AddPiece(3, 1, 3, -1, 4, -3);90 AddPiece(1, 1, 3, 1, 4, 0);91 AddPiece(1, 1, 3, 1, 4, 3);92 AddPiece(1, 1, 3, -1, 4, 0);93 AddPiece(1, 1, 3, -1, 4, 3);94 AddPiece(3, 1, 3, -1, 4, 6);95 96 AddPiece(3, 1, 3, -5, 4, -3);97 AddPiece(1, 1, 3, -3, 4, 0);98 AddPiece(1, 1, 3, -3, 4, 3);99 AddPiece(1, 1, 3, -3, 4, 6);100 101 /* Some random crap */102 m_mesh.Compile("sc#e0e scb#e0e");103 AddPiece(1, 1, 1, -1, 0, 2);104 m_mesh.Compile("sc#0ee scb#0ee");105 AddPiece(2, 1, 1, -1, 0, 1);106 m_mesh.Compile("sc#e94 scb#e94");107 AddPiece(1, 1, 1, 0, 0, 0);108 m_mesh.Compile("sc#94e scb#94e");109 AddPiece(2, 1, 1, 0, 0, -1);110 m_mesh.Compile("sc#9e4 scb#9e4");111 AddPiece(1, 2, 3, -1, -1, -2);112 m_mesh.Compile("sc#49e scb#49e");113 AddPiece(2, 3, 1, 0, -1, -2);114 m_mesh.Compile("sc#4e9 scb#4e9");115 AddPiece(6, 2, 1, -2, 0, -3);116 m_mesh.Compile("sc#e49 scb#e49");117 AddPiece(6, 2, 1, -2, -2, -3);118 #endif119 120 /* Center everything -- is it needed? */121 // m_mesh.Compile("tx4 tz4");122 38 123 39 m_camera = new Camera(vec3(0.f, 600.f, 0.f), … … 126 42 m_camera->SetPerspective(70.f, 960.f, 600.f, .1f, 1000.f); 127 43 m_camera->SetTarget(vec3(0.f, -10.f, 0.f)); 128 m_camera->SetPosition(vec3(-1 00.f, 60.f, 0.f));44 m_camera->SetPosition(vec3(-150.f, 100.f, 0.f)); 129 45 Ticker::Ref(m_camera); 130 46 131 47 m_ready = false; 48 } 49 50 ~EasyMeshTutorial() 51 { 52 Ticker::Unref(m_camera); 132 53 } 133 54 … … 136 57 WorldEntity::TickGame(seconds); 137 58 138 m_angle += seconds * 80.0f; 59 m_angle += seconds * 70.0f; 60 m_mat = mat4::rotate(10.0f, vec3(0, 0, 1)) 61 * mat4::rotate(m_angle, vec3(0, 1, 0)); 139 62 140 mat4 anim = mat4::rotate(m_angle, vec3(0, 1, 0)); 141 mat4 model = mat4::translate(vec3(0, 0, 0)); 63 m_gears[0].m3 += seconds * 150.0f; 64 m_gears[1].m3 += seconds * 150.0f * -2 / 9; 65 m_gears[2].m3 += seconds * 150.0f * -2 / 3; 66 m_gears[3].m3 += seconds * 150.0f * -2 / 3; 67 m_gears[4].m3 += seconds * 150.0f * -2 / 3; 142 68 143 m_matrix = model * anim; 69 m_gears[0].m2 = mat4::translate(vec3(0, 0, 0)) 70 * mat4::rotate(m_gears[0].m3, vec3(0, 1, 0)); 71 m_gears[1].m2 = mat4::translate(vec3(0, 0, 0)) 72 * mat4::rotate(m_gears[1].m3, vec3(0, 1, 0)); 73 m_gears[2].m2 = mat4::translate(vec3(0, 0, 55)) 74 * mat4::rotate(m_gears[2].m3, vec3(0, 1, 0)); 75 m_gears[3].m2 = mat4::translate(vec3(55 * lol::sqrt(3.f) * 0.5f, 0, -55 * 0.5f)) 76 * mat4::rotate(m_gears[3].m3, vec3(0, 1, 0)); 77 m_gears[4].m2 = mat4::translate(vec3(-55 * lol::sqrt(3.f) * 0.5f, 0, -55 * 0.5f)) 78 * mat4::rotate(m_gears[4].m3, vec3(0, 1, 0)); 144 79 } 145 80 … … 150 85 if (!m_ready) 151 86 { 152 m_mesh.MeshConvert(); 87 for (int i = 0; i < m_gears.Count(); i++) 88 m_gears[i].m1.MeshConvert(); 153 89 m_ready = true; 154 90 } … … 156 92 Video::SetClearColor(vec4(0.0f, 0.0f, 0.0f, 1.0f)); 157 93 158 m_mesh.Render(m_matrix); 159 m_mesh.Render(mat4::translate(vec3(-65, 0, -65) * lol::sqrt(0.5)) * mat4::rotate(-m_angle, vec3(0, 1, 0))); 160 m_mesh.Render(mat4::translate(vec3(0, 0, 65)) * mat4::rotate(-m_angle, vec3(0, 1, 0))); 161 m_mesh.Render(mat4::translate(vec3(-65, 0, 65)) * mat4::rotate(m_angle, vec3(0, 1, 0))); 94 for (int i = 0; i < m_gears.Count(); i++) 95 m_gears[i].m1.Render(m_mat * m_gears[i].m2); 162 96 } 163 97 164 98 private: 99 Array<EasyMesh, mat4, float> m_gears; 165 100 float m_angle; 166 mat4 m_matrix; 167 EasyMesh m_mesh; 101 mat4 m_mat; 168 102 Camera *m_camera; 169 103
Note: See TracChangeset
for help on using the changeset viewer.