Browse Source

MeshViewer TWEAK

EasyMesh Parser/Scanner & Functions revamp to be more like real logical functions.
EZMesh & URO : Added "//" comments to Parser/Scanner
undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 11 years ago
parent
commit
4b3686a927
10 changed files with 1435 additions and 784 deletions
  1. +160
    -101
      src/easymesh/easymesh-parser.y
  2. +83
    -66
      src/easymesh/easymesh-scanner.l
  3. +27
    -27
      src/easymesh/easymesh.cpp
  4. +40
    -39
      src/easymesh/easymesh.h
  5. +757
    -356
      src/generated/easymesh-parser.cpp
  6. +14
    -9
      src/generated/easymesh-parser.h
  7. +342
    -182
      src/generated/easymesh-scanner.cpp
  8. +1
    -1
      test/data/mesh-buffer.txt
  9. +4
    -2
      test/meshviewer.cpp
  10. +7
    -1
      test/meshviewer.vcxproj

+ 160
- 101
src/easymesh/easymesh-parser.y View File

@@ -33,10 +33,13 @@

%union
{
float fval;
float fval;
int ival;
bool bval;
float vval[4];
int ivval[4];
/* Can't use uin32_t here for some reason */
unsigned u32val;
struct { float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; } args;
}

%start mesh_description
@@ -56,11 +59,19 @@
%token T_END 0
%token T_ERROR

%token <fval> NUMBER
%token <fval> F_NUMBER
%token <ival> I_NUMBER
%token <bval> BOOLEAN
%token <u32val> COLOR

%type <fval> number
%type <args> args1 args2 args3 args4 args5 args6 args7 args8 args9 args10
/* Base Number types */
%type <fval> fv
%type <ival> iv
/* Vector types */
%type <vval> v3
%type <vval> v4
/* Special types */
%type <bval> bv

%{
#include "easymesh/easymesh-compiler.h"
@@ -78,7 +89,7 @@

mesh_description:
mesh_expression_list T_END
;
;

mesh_expression_list:
mesh_expression
@@ -88,131 +99,179 @@ mesh_expression_list:
mesh_expression:
mesh_command_list
| mesh_open mesh_expression_list mesh_close
;
;

mesh_open:
'[' { mc.m_mesh.OpenBrace(); }
;
;

mesh_close:
']' { mc.m_mesh.CloseBrace(); }
;
;

mesh_command_list:
mesh_command
| mesh_command_list mesh_command
;
;

mesh_command:
color_command
| transform_command
| primitive_command
;
;

color_command:
T_COLOR args4 { mc.m_mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
| T_COLOR COLOR { uint32_t x = $2;
vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
mc.m_mesh.SetCurColor(vec4(v) * (1.f / 255)); }
| T_BGCOLOR args4 { mc.m_mesh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
| T_BGCOLOR COLOR { uint32_t x = $2;
vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
mc.m_mesh.SetCurColor2(vec4(v) * (1.f / 255)); }
;
T_COLOR fv fv fv fv { mc.m_mesh.SetCurColor(vec4($2, $3, $4, $5)); }
| T_COLOR v4 { mc.m_mesh.SetCurColor(vec4($2[0], $2[1], $2[2], $2[3])); }
| T_COLOR COLOR { uint32_t x = $2;
ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
mc.m_mesh.SetCurColor(vec4(v) * (1.f / 255.f)); }
| T_BGCOLOR fv fv fv fv { mc.m_mesh.SetCurColor2(vec4($2, $3, $4, $5)); }
| T_BGCOLOR v4 { mc.m_mesh.SetCurColor2(vec4($2[0], $2[1], $2[2], $2[3])); }
| T_BGCOLOR COLOR { uint32_t x = $2;
ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
mc.m_mesh.SetCurColor2(vec4(v) * (1.f / 255.f)); }
;

transform_command:
T_CHAMFER args1 { mc.m_mesh.Chamfer($2.f0); }
| T_TRANSLATEX args1 { mc.m_mesh.Translate(vec3($2.f0, 0, 0)); }
| T_TRANSLATEY args1 { mc.m_mesh.Translate(vec3(0, $2.f0, 0)); }
| T_TRANSLATEZ args1 { mc.m_mesh.Translate(vec3(0, 0, $2.f0)); }
| T_TRANSLATE args3 { mc.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); }
| T_ROTATEX args1 { mc.m_mesh.RotateX($2.f0); }
| T_ROTATEY args1 { mc.m_mesh.RotateY($2.f0); }
| T_ROTATEZ args1 { mc.m_mesh.RotateZ($2.f0); }
| T_TAPERX args3 { mc.m_mesh.TaperX($2.f0, $2.f1, $2.f2); }
| T_TAPERX args4 { mc.m_mesh.TaperX($2.f0, $2.f1, $2.f2, $2.f3); }
| T_TAPERY args3 { mc.m_mesh.TaperY($2.f0, $2.f1, $2.f2); }
| T_TAPERY args4 { mc.m_mesh.TaperY($2.f0, $2.f1, $2.f2, $2.f3); }
| T_TAPERZ args3 { mc.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); }
| T_TAPERZ args4 { mc.m_mesh.TaperZ($2.f0, $2.f1, $2.f2, $2.f3); }
| T_TWISTX args2 { mc.m_mesh.TwistX($2.f0, $2.f1); }
| T_TWISTY args2 { mc.m_mesh.TwistY($2.f0, $2.f1); }
| T_TWISTZ args2 { mc.m_mesh.TwistZ($2.f0, $2.f1); }
| T_SHEARX args3 { mc.m_mesh.ShearX($2.f0, $2.f1, $2.f2); }
| T_SHEARX args4 { mc.m_mesh.ShearX($2.f0, $2.f1, $2.f2, $2.f3); }
| T_SHEARY args3 { mc.m_mesh.ShearY($2.f0, $2.f1, $2.f2); }
| T_SHEARY args4 { mc.m_mesh.ShearY($2.f0, $2.f1, $2.f2, $2.f3); }
| T_SHEARZ args3 { mc.m_mesh.ShearZ($2.f0, $2.f1, $2.f2); }
| T_SHEARZ args4 { mc.m_mesh.ShearZ($2.f0, $2.f1, $2.f2, $2.f3); }
| T_STRETCHX args3 { mc.m_mesh.StretchX($2.f0, $2.f1, $2.f2); }
| T_STRETCHY args3 { mc.m_mesh.StretchY($2.f0, $2.f1, $2.f2); }
| T_STRETCHZ args3 { mc.m_mesh.StretchZ($2.f0, $2.f1, $2.f2); }
| T_BENDXY args2 { mc.m_mesh.BendXY($2.f0, $2.f1); }
| T_BENDXZ args2 { mc.m_mesh.BendXZ($2.f0, $2.f1); }
| T_BENDYX args2 { mc.m_mesh.BendYX($2.f0, $2.f1); }
| T_BENDYZ args2 { mc.m_mesh.BendYZ($2.f0, $2.f1); }
| T_BENDZX args2 { mc.m_mesh.BendZX($2.f0, $2.f1); }
| T_BENDZY args2 { mc.m_mesh.BendZY($2.f0, $2.f1); }
| T_SCALEX args1 { mc.m_mesh.Scale(vec3($2.f0, 1.0, 1.0)); }
| T_SCALEY args1 { mc.m_mesh.Scale(vec3(1.0, $2.f0, 1.0)); }
| T_SCALEZ args1 { mc.m_mesh.Scale(vec3(1.0, 1.0, $2.f0)); }
| T_SCALE args3 { mc.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); }
T_CHAMFER fv { mc.m_mesh.Chamfer($2); }
| T_TRANSLATEX fv { mc.m_mesh.Translate(vec3($2, 0.f, 0.f)); }
| T_TRANSLATEY fv { mc.m_mesh.Translate(vec3(0.f, $2, 0.f)); }
| T_TRANSLATEZ fv { mc.m_mesh.Translate(vec3(0.f, 0.f, $2)); }
| T_TRANSLATE fv fv fv { mc.m_mesh.Translate(vec3($2, $3, $4)); }
| T_TRANSLATE v3 { mc.m_mesh.Translate(vec3($2[0], $2[1], $2[2])); }
| T_ROTATEX fv { mc.m_mesh.RotateX($2); }
| T_ROTATEY fv { mc.m_mesh.RotateY($2); }
| T_ROTATEZ fv { mc.m_mesh.RotateZ($2); }
| T_TAPERX fv fv fv bv { mc.m_mesh.TaperX($2, $3, $4, $5); }
| T_TAPERX fv fv fv { mc.m_mesh.TaperX($2, $3, $4); }
| T_TAPERX fv fv { mc.m_mesh.TaperX($2, $3); }
| T_TAPERY fv fv fv bv { mc.m_mesh.TaperY($2, $3, $4, $5); }
| T_TAPERY fv fv fv { mc.m_mesh.TaperY($2, $3, $4); }
| T_TAPERY fv fv { mc.m_mesh.TaperY($2, $3); }
| T_TAPERZ fv fv fv bv { mc.m_mesh.TaperZ($2, $3, $4, $5); }
| T_TAPERZ fv fv fv { mc.m_mesh.TaperZ($2, $3, $4); }
| T_TAPERZ fv fv { mc.m_mesh.TaperZ($2, $3); }
| T_TWISTX fv fv { mc.m_mesh.TwistX($2, $3); }
| T_TWISTX fv { mc.m_mesh.TwistX($2); }
| T_TWISTY fv fv { mc.m_mesh.TwistY($2, $3); }
| T_TWISTY fv { mc.m_mesh.TwistY($2); }
| T_TWISTZ fv fv { mc.m_mesh.TwistZ($2, $3); }
| T_TWISTZ fv { mc.m_mesh.TwistZ($2); }
| T_SHEARX fv fv fv bv { mc.m_mesh.ShearX($2, $3, $4, $5); }
| T_SHEARX fv fv fv { mc.m_mesh.ShearX($2, $3, $4); }
| T_SHEARX fv fv { mc.m_mesh.ShearX($2, $3); }
| T_SHEARY fv fv fv bv { mc.m_mesh.ShearY($2, $3, $4, $5); }
| T_SHEARY fv fv fv { mc.m_mesh.ShearY($2, $3, $4); }
| T_SHEARY fv fv { mc.m_mesh.ShearY($2, $3); }
| T_SHEARZ fv fv fv bv { mc.m_mesh.ShearZ($2, $3, $4, $5); }
| T_SHEARZ fv fv fv { mc.m_mesh.ShearZ($2, $3, $4); }
| T_SHEARZ fv fv { mc.m_mesh.ShearZ($2, $3); }
| T_STRETCHX fv fv fv { mc.m_mesh.StretchX($2, $3, $4); }
| T_STRETCHX fv fv { mc.m_mesh.StretchX($2, $3); }
| T_STRETCHY fv fv fv { mc.m_mesh.StretchY($2, $3, $4); }
| T_STRETCHY fv fv { mc.m_mesh.StretchY($2, $3); }
| T_STRETCHZ fv fv fv { mc.m_mesh.StretchZ($2, $3, $4); }
| T_STRETCHZ fv fv { mc.m_mesh.StretchZ($2, $3); }
| T_BENDXY fv fv { mc.m_mesh.BendXY($2, $3); }
| T_BENDXY fv { mc.m_mesh.BendXY($2); }
| T_BENDXZ fv fv { mc.m_mesh.BendXZ($2, $3); }
| T_BENDXZ fv { mc.m_mesh.BendXZ($2); }
| T_BENDYX fv fv { mc.m_mesh.BendYX($2, $3); }
| T_BENDYX fv { mc.m_mesh.BendYX($2); }
| T_BENDYZ fv fv { mc.m_mesh.BendYZ($2, $3); }
| T_BENDYZ fv { mc.m_mesh.BendYZ($2); }
| T_BENDZX fv fv { mc.m_mesh.BendZX($2, $3); }
| T_BENDZX fv { mc.m_mesh.BendZX($2); }
| T_BENDZY fv fv { mc.m_mesh.BendZY($2, $3); }
| T_BENDZY fv { mc.m_mesh.BendZY($2); }
| T_SCALEX fv { mc.m_mesh.Scale(vec3($2, 1.f, 1.f)); }
| T_SCALEY fv { mc.m_mesh.Scale(vec3(1.f, $2, 1.f)); }
| T_SCALEZ fv { mc.m_mesh.Scale(vec3(1.f, 1.f, $2)); }
| T_SCALE fv fv fv { mc.m_mesh.Scale(vec3($2, $3, $4)); }
| T_SCALE v3 { mc.m_mesh.Scale(vec3($2[0], $2[1], $2[2])); }
| T_SCALE fv { mc.m_mesh.Scale(vec3($2, $2, $2)); }
| T_MIRRORX { mc.m_mesh.MirrorX(); }
| T_MIRRORY { mc.m_mesh.MirrorY(); }
| T_MIRRORZ { mc.m_mesh.MirrorZ(); }
| T_RADIALJITTER args1 { mc.m_mesh.RadialJitter($2.f0); }
| T_SPLITTRIANGLE args1 { mc.m_mesh.SplitTriangles($2.f0); }
| T_SMOOTHMESH args3 { mc.m_mesh.SmoothMesh($2.f0, $2.f1, $2.f2); }
| T_RADIALJITTER fv { mc.m_mesh.RadialJitter($2); }
| T_SPLITTRIANGLE iv { mc.m_mesh.SplitTriangles($2); }
| T_SMOOTHMESH iv iv iv { mc.m_mesh.SmoothMesh($2, $3, $4); }
| T_TOGGLESCALEWINDING { mc.m_mesh.ToggleScaleWinding(); }
| T_CSGUNION { mc.m_mesh.CsgUnion(); }
| T_CSGSUBSTRACT { mc.m_mesh.CsgSubstract(); }
| T_CSGSUBSTRACTLOSS { mc.m_mesh.CsgSubstractLoss(); }
| T_CSGAND { mc.m_mesh.CsgAnd(); }
| T_CSGXOR { mc.m_mesh.CsgXor(); }
;
;

primitive_command:
T_CYLINDER args6 { mc.m_mesh.AppendCylinder((int)$2.f0, $2.f1,
$2.f2, $2.f3,
(int)$2.f4, (int)$2.f5, 0); }
| T_CYLINDER args7 { mc.m_mesh.AppendCylinder((int)$2.f0, $2.f1,
$2.f2, $2.f3,
(int)$2.f4, (int)$2.f5, (int)$2.f6); }
| T_BOX args3 { mc.m_mesh.AppendBox(vec3($2.f0, $2.f1, $2.f2)); }
| T_SMOOTHCHAMFBOX args4 { mc.m_mesh.AppendSmoothChamfBox(vec3($2.f0, $2.f1,
$2.f2), $2.f3); }
| T_FLATCHAMFBOX args4 { mc.m_mesh.AppendFlatChamfBox(vec3($2.f0, $2.f1,
$2.f2), $2.f3); }
| T_SPHERE args2 { mc.m_mesh.AppendSphere($2.f0, $2.f1); }
| T_CAPSULE args3 { mc.m_mesh.AppendCapsule($2.f0, $2.f1, $2.f2); }
| T_TORUS args3 { mc.m_mesh.AppendTorus((int)$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,
$2.f2, $2.f3); }
| T_DISC args3 { mc.m_mesh.AppendDisc((int)$2.f0, $2.f1, (int)$2.f2); }
| T_TRIANGLE args2 { mc.m_mesh.AppendSimpleTriangle($2.f0, (int)$2.f1); }
| T_QUAD args2 { mc.m_mesh.AppendSimpleQuad($2.f0, (int)$2.f1); }
| T_COG args10 { mc.m_mesh.AppendCog((int)$2.f0, $2.f1,
$2.f2, $2.f3, $2.f4, $2.f5, $2.f6,
$2.f7, $2.f8, (int)$2.f9); }
;

args1: number { $$.f0 = $1; } ;
args2: args1 number { $$ = $1; $$.f1 = $2; } ;
args3: args2 number { $$ = $1; $$.f2 = $2; } ;
args4: args3 number { $$ = $1; $$.f3 = $2; } ;
args5: args4 number { $$ = $1; $$.f4 = $2; } ;
args6: args5 number { $$ = $1; $$.f5 = $2; } ;
args7: args6 number { $$ = $1; $$.f6 = $2; } ;
args8: args7 number { $$ = $1; $$.f7 = $2; } ;
args9: args8 number { $$ = $1; $$.f8 = $2; } ;
args10: args9 number { $$ = $1; $$.f9 = $2; } ;

number:
NUMBER { $$ = $1; }
| '-' number { $$ = -$2; }
;
T_CYLINDER iv fv fv fv bv bv bv { mc.m_mesh.AppendCylinder($2, $3, $4, $5, $6, $7, $8); }
| T_CYLINDER iv fv fv fv bv bv { mc.m_mesh.AppendCylinder($2, $3, $4, $5, $6, $7); }
| T_CYLINDER iv fv fv fv bv { mc.m_mesh.AppendCylinder($2, $3, $4, $5, $6); }
| T_CYLINDER iv fv fv fv { mc.m_mesh.AppendCylinder($2, $3, $4, $5); }
| T_BOX fv fv fv fv { mc.m_mesh.AppendBox(vec3($2, $3, $4), $5); }
| T_BOX fv fv fv { mc.m_mesh.AppendBox(vec3($2, $3, $4)); }
| T_BOX fv { mc.m_mesh.AppendBox(vec3($2, $2, $2)); }
| T_BOX v3 fv { mc.m_mesh.AppendBox(vec3($2[0], $2[1], $2[2]), $3); }
| T_BOX v3 { mc.m_mesh.AppendBox(vec3($2[0], $2[1], $2[2])); }
| T_SMOOTHCHAMFBOX fv fv fv fv { mc.m_mesh.AppendSmoothChamfBox(vec3($2, $3, $4), $5); }
| T_SMOOTHCHAMFBOX fv fv { mc.m_mesh.AppendSmoothChamfBox(vec3($2, $2, $2), $3); }
| T_SMOOTHCHAMFBOX v3 fv { mc.m_mesh.AppendSmoothChamfBox(vec3($2[0], $2[1], $2[2]), $3); }
| T_FLATCHAMFBOX fv fv fv fv { mc.m_mesh.AppendFlatChamfBox(vec3($2, $3, $4), $5); }
| T_FLATCHAMFBOX fv fv { mc.m_mesh.AppendFlatChamfBox(vec3($2, $2, $2), $3); }
| T_FLATCHAMFBOX v3 fv { mc.m_mesh.AppendFlatChamfBox(vec3($2[0], $2[1], $2[2]), $3); }
| T_SPHERE iv fv { mc.m_mesh.AppendSphere($2, $3); }
| T_CAPSULE iv fv fv { mc.m_mesh.AppendCapsule($2, $3, $4); }
| T_TORUS iv fv fv { mc.m_mesh.AppendTorus($2, $3, $4); }
| T_STAR iv fv fv bv bv { mc.m_mesh.AppendStar($2, $3, $4, $5, $6); }
| T_STAR iv fv fv bv { mc.m_mesh.AppendStar($2, $3, $4, $5); }
| T_STAR iv fv fv { mc.m_mesh.AppendStar($2, $3, $4); }
| T_EXPANDEDSTAR iv fv fv fv { mc.m_mesh.AppendExpandedStar($2, $3, $4, $5); }
| T_EXPANDEDSTAR iv fv fv { mc.m_mesh.AppendExpandedStar($2, $3, $4); }
| T_DISC iv fv bv { mc.m_mesh.AppendDisc($2, $3, $4); }
| T_DISC iv fv { mc.m_mesh.AppendDisc($2, $3); }
| T_TRIANGLE fv bv { mc.m_mesh.AppendSimpleTriangle($2, $3); }
| T_TRIANGLE fv { mc.m_mesh.AppendSimpleTriangle($2); }
| T_QUAD fv bv { mc.m_mesh.AppendSimpleQuad($2, $3); }
| T_QUAD fv { mc.m_mesh.AppendSimpleQuad($2); }
| T_COG iv fv fv fv fv fv fv fv fv bv { mc.m_mesh.AppendCog($2, $3, $4, $5, $6, $7, $8, $9, $10, $11); }
| T_COG iv fv fv fv fv fv fv fv fv { mc.m_mesh.AppendCog($2, $3, $4, $5, $6, $7, $8, $9, $10); }
| T_COG iv fv fv fv fv fv fv fv { mc.m_mesh.AppendCog($2, $3, $4, $5, $6, $7, $8, $9); }
;

/* Base Number types */
fv:
F_NUMBER { $$ = $1; }
| '-' fv { $$ = -$2; }
| I_NUMBER { $$ = (float)$1; }
| '-' iv { $$ = -(float)$2; }
;

iv:
I_NUMBER { $$ = $1; }
| '-' iv { $$ = -$2; }
| F_NUMBER { $$ = (int)$1; }
| '-' fv { $$ = -(int)$2; }
;

/* Vector types */
v3:
'('fv')' { $$[0] = $2; $$[1] = $2; $$[2] = $2; }
| '('fv fv fv')' { $$[0] = $2; $$[1] = $3; $$[2] = $4; }
;

v4:
'('fv')' { $$[0] = $2; $$[1] = $2; $$[2] = $2; $$[3] = $2; }
| '('fv fv fv fv')' { $$[0] = $2; $$[1] = $3; $$[2] = $4; $$[3] = $5; }
;
/* Special types */
bv:
BOOLEAN { $$ = $1; }
| I_NUMBER { $$ = !!$1; }
| F_NUMBER { $$ = !!$1; }
;

%%



+ 83
- 66
src/easymesh/easymesh-scanner.l View File

@@ -43,72 +43,73 @@ typedef lol::EasyMeshParser::token_type token_type;

%%

%{
/* reset location at the beginning of yylex() */
%{ /* reset location at the beginning of yylex() */
yylloc->step();
%}

sc { return token::T_COLOR; }
scb { return token::T_BGCOLOR; }

ch { return token::T_CHAMFER; }
tx { return token::T_TRANSLATEX; }
ty { return token::T_TRANSLATEY; }
tz { return token::T_TRANSLATEZ; }
t { return token::T_TRANSLATE; }
rx { return token::T_ROTATEX; }
ry { return token::T_ROTATEY; }
rz { return token::T_ROTATEZ; }
tax { return token::T_TAPERX; }
tay { return token::T_TAPERY; }
taz { return token::T_TAPERZ; }
twx { return token::T_TWISTX; }
twy { return token::T_TWISTY; }
twz { return token::T_TWISTZ; }
shx { return token::T_SHEARX; }
shy { return token::T_SHEARY; }
shz { return token::T_SHEARZ; }
stx { return token::T_STRETCHX; }
sty { return token::T_STRETCHY; }
stz { return token::T_STRETCHZ; }
bdxy { return token::T_BENDXY; }
bdxz { return token::T_BENDXZ; }
bdyx { return token::T_BENDYX; }
bdyz { return token::T_BENDYZ; }
bdzx { return token::T_BENDZX; }
bdzy { return token::T_BENDZY; }
sx { return token::T_SCALEX; }
sy { return token::T_SCALEY; }
sz { return token::T_SCALEZ; }
s { return token::T_SCALE; }
tsw { return token::T_TOGGLESCALEWINDING; }
mx { return token::T_MIRRORX; }
my { return token::T_MIRRORY; }
mz { return token::T_MIRRORZ; }
rj { return token::T_RADIALJITTER; }
splt { return token::T_SPLITTRIANGLE; }
smth { return token::T_SMOOTHMESH; }

csgu { return token::T_CSGUNION; }
csgs { return token::T_CSGSUBSTRACT; }
csgsl { return token::T_CSGSUBSTRACTLOSS; }
csga { return token::T_CSGAND; }
csgx { return token::T_CSGXOR; }

ab { return token::T_BOX; }
ac { return token::T_CYLINDER; }
acap { return token::T_CAPSULE; }
acg { return token::T_COG; }
ad { return token::T_DISC; }
aes { return token::T_EXPANDEDSTAR; }
afcb { return token::T_FLATCHAMFBOX; }
aq { return token::T_QUAD; }
as { return token::T_STAR; }
ascb { return token::T_SMOOTHCHAMFBOX; }
asph { return token::T_SPHERE; }
at { return token::T_TRIANGLE; }
ato { return token::T_TORUS; }

(sc|setcolor) { return token::T_COLOR; }
(scb|setbgcolor) { return token::T_BGCOLOR; }

(ch|chamfer) { return token::T_CHAMFER; }
(tx|translatex) { return token::T_TRANSLATEX; }
(ty|translatey) { return token::T_TRANSLATEY; }
(tz|translatez) { return token::T_TRANSLATEZ; }
(t|translate) { return token::T_TRANSLATE; }
(rx|rotatex) { return token::T_ROTATEX; }
(ry|rotatey) { return token::T_ROTATEY; }
(rz|rotatez) { return token::T_ROTATEZ; }
(tax|taperx) { return token::T_TAPERX; }
(tay|tapery) { return token::T_TAPERY; }
(taz|taperz) { return token::T_TAPERZ; }
(twx|twistx) { return token::T_TWISTX; }
(twy|twisty) { return token::T_TWISTY; }
(twz|twistz) { return token::T_TWISTZ; }
(shx|shearx) { return token::T_SHEARX; }
(shy|sheary) { return token::T_SHEARY; }
(shz|shearz) { return token::T_SHEARZ; }
(stx|stretchx) { return token::T_STRETCHX; }
(sty|stretchy) { return token::T_STRETCHY; }
(stz|stretchz) { return token::T_STRETCHZ; }
(bdxy|bendxy) { return token::T_BENDXY; }
(bdxz|bendxz) { return token::T_BENDXZ; }
(bdyx|bendyx) { return token::T_BENDYX; }
(bdyz|bendyz) { return token::T_BENDYZ; }
(bdzx|bendzx) { return token::T_BENDZX; }
(bdzy|bendzy) { return token::T_BENDZY; }
(sx|scalex) { return token::T_SCALEX; }
(sy|scaley) { return token::T_SCALEY; }
(sz|scalez) { return token::T_SCALEZ; }
(s|scale) { return token::T_SCALE; }
(tsw|scalewinding) { return token::T_TOGGLESCALEWINDING; }
(mx|mirrorx) { return token::T_MIRRORX; }
(my|mirrory) { return token::T_MIRRORY; }
(mz|mirrorz) { return token::T_MIRRORZ; }
(rj|radialjitter) { return token::T_RADIALJITTER; }
(splt|splittriangle) { return token::T_SPLITTRIANGLE; }
(smth|smooth) { return token::T_SMOOTHMESH; }

(csgu|csgunion) { return token::T_CSGUNION; }
(csgs|csgsubstract) { return token::T_CSGSUBSTRACT; }
(csgsl|csgsubstractloss) { return token::T_CSGSUBSTRACTLOSS; }
(csga|csgand) { return token::T_CSGAND; }
(csgx|csgxor) { return token::T_CSGXOR; }

(ab|addbox) { return token::T_BOX; }
(ac|addcylinder) { return token::T_CYLINDER; }
(acap|addcapsule) { return token::T_CAPSULE; }
(acg|addcog) { return token::T_COG; }
(ad|adddisc) { return token::T_DISC; }
(aes|addexpandedstar) { return token::T_EXPANDEDSTAR; }
(afcb|addflatchamfbox) { return token::T_FLATCHAMFBOX; }
(aq|addquad) { return token::T_QUAD; }
(as|addstar) { return token::T_STAR; }
(ascb|addsmoothchamfbox) { return token::T_SMOOTHCHAMFBOX; }
(asph|adsphere) { return token::T_SPHERE; }
(at|addtriangle) { return token::T_TRIANGLE; }
(ato|addtorus) { return token::T_TORUS; }

%{ /* ======= BASE DATA TYPES ========================================= */ %}
%{ /* COLOR */ %}
#[0-9a-fA-F]{3} {
uint32_t tmp = std::strtol(yytext + 1, nullptr, 16);
yylval->u32val = 0x11000000u * (tmp >> 8)
@@ -130,9 +131,25 @@ ato { return token::T_TORUS; }
#[0-9a-fA-F]{8} {
yylval->u32val = (uint32_t)std::strtol(yytext + 1, nullptr, 16);
return token::COLOR; }
[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? {
yylval->fval = std::atof(yytext); return token::NUMBER; }
- { return token_type('-'); }

%{ /* ======= BASE DATA TYPES ========================================= */ %}
%{ /* BOOL */ %}
true { yylval->bval = true; return token::BOOLEAN; }
false { yylval->bval = false; return token::BOOLEAN; }
%{ /* FLOAT */ %}
[-+]?[0-9]*\.[0-9]+([eE][-+]?[0-9]+)? {
yylval->fval = (float)std::atof(yytext); return token::F_NUMBER; }
%{ /* INT */ %}
[-+]?[0-9]+ {
yylval->ival = std::atoi(yytext); return token::I_NUMBER; }

%{ /* ======= COMMENTS ======= */ %}
"//"[^\n\r]*[\n\r] { /* ignore this */ }

%{ /* Semantics tokens */ %}
"-" { return token_type('-'); }
"(" { return token_type('('); }
")" { return token_type(')'); }
"[" { return token_type('['); }
"]" { return token_type(']'); }
[ ,] { /* ignore this */ }


+ 27
- 27
src/easymesh/easymesh.cpp View File

@@ -1225,35 +1225,35 @@ void EasyMesh::RadialJitter(float r)
}

//-----------------------------------------------------------------------------
void EasyMesh::TaperX(float ny, float nz, float xoff, int absolute) { DoMeshTransform(MeshTransform::Taper, Axis::X, Axis::X, ny, nz, xoff, absolute); }
void EasyMesh::TaperY(float nx, float nz, float yoff, int absolute) { DoMeshTransform(MeshTransform::Taper, Axis::Y, Axis::Y, nz, nx, yoff, absolute); }
void EasyMesh::TaperZ(float nx, float ny, float zoff, int absolute) { DoMeshTransform(MeshTransform::Taper, Axis::Z, Axis::Z, nx, ny, zoff, absolute); }
void EasyMesh::TaperX(float ny, float nz, float xoff, bool absolute) { DoMeshTransform(MeshTransform::Taper, Axis::X, Axis::X, ny, nz, xoff, absolute); }
void EasyMesh::TaperY(float nx, float nz, float yoff, bool absolute) { DoMeshTransform(MeshTransform::Taper, Axis::Y, Axis::Y, nz, nx, yoff, absolute); }
void EasyMesh::TaperZ(float nx, float ny, float zoff, bool absolute) { DoMeshTransform(MeshTransform::Taper, Axis::Z, Axis::Z, nx, ny, zoff, absolute); }

//-----------------------------------------------------------------------------
void EasyMesh::TwistX(float t, float toff) { DoMeshTransform(MeshTransform::Twist, Axis::X, Axis::X, t, t, toff, 0); }
void EasyMesh::TwistY(float t, float toff) { DoMeshTransform(MeshTransform::Twist, Axis::Y, Axis::Y, t, t, toff, 0); }
void EasyMesh::TwistZ(float t, float toff) { DoMeshTransform(MeshTransform::Twist, Axis::Z, Axis::Z, t, t, toff, 0); }
void EasyMesh::TwistX(float t, float toff) { DoMeshTransform(MeshTransform::Twist, Axis::X, Axis::X, t, t, toff); }
void EasyMesh::TwistY(float t, float toff) { DoMeshTransform(MeshTransform::Twist, Axis::Y, Axis::Y, t, t, toff); }
void EasyMesh::TwistZ(float t, float toff) { DoMeshTransform(MeshTransform::Twist, Axis::Z, Axis::Z, t, t, toff); }

//-----------------------------------------------------------------------------
void EasyMesh::ShearX(float ny, float nz, float xoff, int absolute) { DoMeshTransform(MeshTransform::Shear, Axis::X, Axis::X, ny, nz, xoff, absolute); }
void EasyMesh::ShearY(float nx, float nz, float yoff, int absolute) { DoMeshTransform(MeshTransform::Shear, Axis::Y, Axis::Y, nz, nx, yoff, absolute); }
void EasyMesh::ShearZ(float nx, float ny, float zoff, int absolute) { DoMeshTransform(MeshTransform::Shear, Axis::Z, Axis::Z, nx, ny, zoff, absolute); }
void EasyMesh::ShearX(float ny, float nz, float xoff, bool absolute) { DoMeshTransform(MeshTransform::Shear, Axis::X, Axis::X, ny, nz, xoff, absolute); }
void EasyMesh::ShearY(float nx, float nz, float yoff, bool absolute) { DoMeshTransform(MeshTransform::Shear, Axis::Y, Axis::Y, nz, nx, yoff, absolute); }
void EasyMesh::ShearZ(float nx, float ny, float zoff, bool absolute) { DoMeshTransform(MeshTransform::Shear, Axis::Z, Axis::Z, nx, ny, zoff, absolute); }

//-----------------------------------------------------------------------------
void EasyMesh::StretchX(float ny, float nz, float xoff) { DoMeshTransform(MeshTransform::Stretch, Axis::X, Axis::X, ny, nz, xoff, 0); }
void EasyMesh::StretchY(float nx, float nz, float yoff) { DoMeshTransform(MeshTransform::Stretch, Axis::Y, Axis::Y, nz, nx, yoff, 0); }
void EasyMesh::StretchZ(float nx, float ny, float zoff) { DoMeshTransform(MeshTransform::Stretch, Axis::Z, Axis::Z, nx, ny, zoff, 0); }
void EasyMesh::StretchX(float ny, float nz, float xoff) { DoMeshTransform(MeshTransform::Stretch, Axis::X, Axis::X, ny, nz, xoff); }
void EasyMesh::StretchY(float nx, float nz, float yoff) { DoMeshTransform(MeshTransform::Stretch, Axis::Y, Axis::Y, nz, nx, yoff); }
void EasyMesh::StretchZ(float nx, float ny, float zoff) { DoMeshTransform(MeshTransform::Stretch, Axis::Z, Axis::Z, nx, ny, zoff); }

//-----------------------------------------------------------------------------
void EasyMesh::BendXY(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::X, Axis::Y, t, t, toff, 0); }
void EasyMesh::BendXZ(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::X, Axis::Z, t, t, toff, 0); }
void EasyMesh::BendYX(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Y, Axis::X, t, t, toff, 0); }
void EasyMesh::BendYZ(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Y, Axis::Z, t, t, toff, 0); }
void EasyMesh::BendZX(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Z, Axis::X, t, t, toff, 0); }
void EasyMesh::BendZY(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Z, Axis::Y, t, t, toff, 0); }
void EasyMesh::BendXY(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::X, Axis::Y, t, t, toff); }
void EasyMesh::BendXZ(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::X, Axis::Z, t, t, toff); }
void EasyMesh::BendYX(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Y, Axis::X, t, t, toff); }
void EasyMesh::BendYZ(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Y, Axis::Z, t, t, toff); }
void EasyMesh::BendZX(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Z, Axis::X, t, t, toff); }
void EasyMesh::BendZY(float t, float toff) { DoMeshTransform(MeshTransform::Bend, Axis::Z, Axis::Y, t, t, toff); }

//-----------------------------------------------------------------------------
void EasyMesh::DoMeshTransform(MeshTransform ct, Axis axis0, Axis axis1, float n0, float n1, float noff, int absolute)
void EasyMesh::DoMeshTransform(MeshTransform ct, Axis axis0, Axis axis1, float n0, float n1, float noff, bool absolute)
{
for (int i = m_cursors.Last().m1; i < m_vert.Count(); i++)
{
@@ -1347,7 +1347,7 @@ void EasyMesh::DupAndScale(vec3 const &s)

//-----------------------------------------------------------------------------
void EasyMesh::AppendCylinder(int nsides, float h, float d1, float d2,
int dualside, int smooth, int close)
bool dualside, bool smooth, bool close)
{
//XXX : This operation is done to convert radius to diameter without changing all the code.
float r1 = d1 * .5f;
@@ -1836,7 +1836,7 @@ void EasyMesh::AppendBox(vec3 const &size, float chamf, bool smooth)

//-----------------------------------------------------------------------------
void EasyMesh::AppendStar(int nbranches, float d1, float d2,
int fade, int fade2)
bool fade, bool fade2)
{
//XXX : This operation is done to convert radius to diameter without changing all the code.
float r1 = d1 * .5f;
@@ -1919,7 +1919,7 @@ void EasyMesh::AppendExpandedStar(int nbranches, float d1, float d2, float extra
}

//-----------------------------------------------------------------------------
void EasyMesh::AppendDisc(int nsides, float d, int fade)
void EasyMesh::AppendDisc(int nsides, float d, bool fade)
{
//XXX : This operation is done to convert radius to diameter without changing all the code.
float r = d * .5f;
@@ -1944,7 +1944,7 @@ void EasyMesh::AppendDisc(int nsides, float d, int fade)
}

//-----------------------------------------------------------------------------
void EasyMesh::AppendSimpleTriangle(float d, int fade)
void EasyMesh::AppendSimpleTriangle(float d, bool fade)
{
//XXX : This operation is done to convert radius to diameter without changing all the code.
float size = d * .5f;
@@ -1966,13 +1966,13 @@ void EasyMesh::AppendSimpleTriangle(float d, int fade)
}

//-----------------------------------------------------------------------------
void EasyMesh::AppendSimpleQuad(float size, int fade)
void EasyMesh::AppendSimpleQuad(float size, bool fade)
{
AppendSimpleQuad(vec2(size * .5f), vec2(size * -.5f), 0.f, fade);
}

//-----------------------------------------------------------------------------
void EasyMesh::AppendSimpleQuad(vec2 p1, vec2 p2, float z, int fade)
void EasyMesh::AppendSimpleQuad(vec2 p1, vec2 p2, float z, bool fade)
{
MeshType mt = MeshType::Quad;
MeshFaceType mft = MeshFaceType::QuadDefault;
@@ -2007,7 +2007,7 @@ void EasyMesh::AppendSimpleQuad(vec2 p1, vec2 p2, float z, int fade)
//-----------------------------------------------------------------------------
void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
float d1, float d2, float d12, float d22,
float sidemul, int offset)
float sidemul, bool offset)
{
//XXX : This operation is done to convert radius to diameter without changing all the code.
float r10 = d10 * .5f;
@@ -2046,7 +2046,7 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
p[10] = smat1 * (rotmat * vec3(r2 + r22, h * -.5f, 0.f));
p[11] = smat2 * (rotmat * p[10]);

if (offset & 1)
if (offset)
for (int n = 0; n < 12; n++)
p[n] = rotmat * p[n];



+ 40
- 39
src/easymesh/easymesh.h View File

@@ -616,58 +616,58 @@ public:
- ny : value of n for y.
- nz : value of n for z.
- xoff : value of xoff.
- absolute (def:1) : if (1) Multiply will use an absolute x.
- absolute (def:true) : if (true) Multiply will use an absolute x.
*/
void TaperX(float ny, float nz, float xoff, int absolute=1);
void TaperX(float ny, float nz, float xoff=0.f, bool absolute=true);
/* [cmd:tay] Same as TaperX, with Y */
void TaperY(float nx, float nz, float yoff, int absolute=1);
void TaperY(float nx, float nz, float yoff=0.f, bool absolute=true);
/* [cmd:taz] Same as TaperX, with Z */
void TaperZ(float nx, float ny, float zoff, int absolute=1);
void TaperZ(float nx, float ny, float zoff=0.f, bool absolute=true);
/* [cmd:twx] Twist vertices around x axis with x as rotation value as p = (RotateX(x * t + toff) * p)
- t : Angle multiplier.
- toff : Applied offset.
*/
void TwistX(float t, float toff);
void TwistX(float t, float toff=0.f);
/* [cmd:twy] Same as TwistX, with Y */
void TwistY(float t, float toff);
void TwistY(float t, float toff=0.f);
/* [cmd:twz] Same as TwistX, with Z */
void TwistZ(float t, float toff);
void TwistZ(float t, float toff=0.f);
/* [cmd:shx] Shear vertices using x value as shear quantity as y += (ny * x + xoff)
- ny : Value of n for y.
- nz : Value of n for z.
- xoff : Value of xoff.
- absolute (def:1) : if (1) Multiply will use an absolute x.
- absolute (def:true) : if (true) Multiply will use an absolute x.
*/
void ShearX(float ny, float nz, float xoff, int absolute=1);
void ShearX(float ny, float nz, float xoff=0.f, bool absolute=true);
/* [cmd:shy] Same as ShearX, with Y */
void ShearY(float nx, float nz, float yoff, int absolute=1);
void ShearY(float nx, float nz, float yoff=0.f, bool absolute=true);
/* [cmd:shz] Same as ShearX, with Z */
void ShearZ(float nx, float ny, float zoff, int absolute=1);
void ShearZ(float nx, float ny, float zoff=0.f, bool absolute=true);
/* [cmd:stx] Stretch vertices using x value as stretch quantity as y += (pow(x, ny) + xoff)
- ny : Value of n for y.
- nz : Value of n for z.
- xoff : Value of xoff.
*/
void StretchX(float ny, float nz, float xoff);
void StretchX(float ny, float nz, float xoff=0.f);
/* [cmd:sty] Same as StretchX, with Y */
void StretchY(float nx, float nz, float yoff);
void StretchY(float nx, float nz, float yoff=0.f);
/* [cmd:stz] Same as StretchX, with Z */
void StretchZ(float nx, float ny, float zoff);
void StretchZ(float nx, float ny, float zoff=0.f);
/* [cmd:bdxy] Bend vertices using x as bend quantity along y axis using p = (RotateY(x * t + toff) * p)
- t : Angle multiplier.
- xoff : Applied offset.
*/
void BendXY(float t, float toff);
void BendXY(float t, float toff=0.f);
/* [cmd:bdxz] Same as BendXY, with X & Z */
void BendXZ(float t, float toff);
void BendXZ(float t, float toff=0.f);
/* [cmd:bdyx] Same as BendXY, with Y & X */
void BendYX(float t, float toff);
void BendYX(float t, float toff=0.f);
/* [cmd:bdyz] Same as BendXY, with Y & Z */
void BendYZ(float t, float toff);
void BendYZ(float t, float toff=0.f);
/* [cmd:bdzx] Same as BendXY, with Z & X */
void BendZX(float t, float toff);
void BendZX(float t, float toff=0.f);
/* [cmd:bdzy] Same as BendXY, with Z & Y */
void BendZY(float t, float toff);
void BendZY(float t, float toff=0.f);
private:
struct MeshTransform
{
@@ -684,12 +684,13 @@ private:
inline MeshTransform(Value v) : m_value(v) {}
inline operator Value() { return m_value; }
};
void DoMeshTransform(MeshTransform ct, Axis axis0, Axis axis1, float n0, float n1, float noff, int absolute);
void DoMeshTransform(MeshTransform ct, Axis axis0, Axis axis1, float n0, float n1, float noff, bool absolute=false);
public:
/* [cmd:s/sx/sy/sz] Scale vertices
- s : scale quantity.
*/
void Scale(vec3 const &s);
void Scale(float s) { Scale(vec3(s)); }
/* [cmd:mx] Mirror vertices through X-plane
Acts as an OpenBrace
*/
@@ -733,12 +734,12 @@ public:
- h : Height of the cylinder.
- d1 : Lower diameter.
- d2 : Upper diameter.
- dualside : if (1) will also create inner sides : TOOD:TOREMOVE?? : needed ?
- smooth : if (1) will smooth normals : TOOD:TOREMOVE : smooth should be handled elsewhere
- close : if (1) will add discs to close the cylinder
- dualside : if (true) will also create inner sides : TOOD:TOREMOVE?? : needed ?
- smooth : if (true) will smooth normals : TOOD:TOREMOVE : smooth should be handled elsewhere
- close : if (true) will add discs to close the cylinder
*/
void AppendCylinder(int nsides, float h, float d1, float d2,
int dualside, int smooth, int close);
bool dualside=false, bool smooth=false, bool close=false);
/* [cmd:asph] Sphere centered on (0,0,0) with BBox [-.5*d][.5*d]
- ndivisions : number of subdivisions each Sphere triangle will sustain.
- d : Diameter.
@@ -759,9 +760,9 @@ public:
/* [cmd:ab] Box centered on (0,0,0) with BBox [-.5 * size][.5 * size]
- size : size of the box.
- chamf : size of the chamfer.
- smooth : if (1) will smooth normals : TOOD:TOREMOVE : smooth should be handled elsewhere
- smooth : if (true) will smooth normals : TOOD:TOREMOVE : smooth should be handled elsewhere
*/
void AppendBox(vec3 const &size, float chamf = 0.f);
void AppendBox(vec3 const &size, float chamf=0.f);
//Same as AppendBox
void AppendSmoothChamfBox(vec3 const &size, float chamf);
//Same as AppendBox
@@ -773,11 +774,11 @@ public:
- nbranches : Number of branches.
- d1 : double Length of the branches.
- d2 : double Length of the "branch" located between d1-branches.
- fade : if (1) in-between branches use Color2.
- fade2 : if (1) Star branches use Color2.
- fade : if (true) in-between branches use Color2.
- fade2 : if (true) Star branches use Color2.
*/
void AppendStar(int nbranches, float d1, float d2,
int fade = 0, int fade2 = 0);
bool fade=false, bool fade2=false);
/* [cmd:aes] Star centered on (0,0,0) contained within a disc of "max(max(d1, d2), max(d1 + extrad, d2 + extrad))" diameter.
Expanded star branches use Color2.
- nbranches : Number of branches.
@@ -785,26 +786,26 @@ public:
- d2 : Double Length of the "branch" located between r1-branches.
- extrad : Extra length added to expand all branches.
*/
void AppendExpandedStar(int nbranches, float d1, float d2, float extrad);
void AppendExpandedStar(int nbranches, float d1, float d2, float extrad=0.f);
/* [cmd:ad] Disc centered on (0,0,0) with d diameter.
- nbsides : Number of sides.
- d : Diameter.
- fade : if (1) Outer vertices will use Color2
- fade : if (true) Outer vertices will use Color2
*/
void AppendDisc(int nsides, float d, int fade = 0);
void AppendDisc(int nsides, float d, bool fade=false);
/* [cmd:at] Triangle centered on (0,0,0) contained within a disc of "d" diameter.
- d : diameter of the containing disc..
- fade : if (1) 2nd & 3rd Vertices will use Color2
- fade : if (true) 2nd & 3rd Vertices will use Color2
*/
void AppendSimpleTriangle(float d, int fade = 0);
void AppendSimpleTriangle(float d, bool fade=false);
/* [cmd:aq] Quad centered on (0,0,0) contained within BBox [-size*.5f, 0, -size*.5f][size*.5f, 0, size*.5f]
- size : Size of quad.
- fade : if (1) 3rd & 4th Vertices will use Color2
- fade : if (true) 3rd & 4th Vertices will use Color2
*/
void AppendSimpleQuad(float size, int fade = 0);
void AppendSimpleQuad(float size, bool fade=false);
private:
//complex version of above one
void AppendSimpleQuad(vec2 p1, vec2 p2, float z = 0.f, int fade = 0);
void AppendSimpleQuad(vec2 p1, vec2 p2, float z=0.f, bool fade=false);
public:
/* [cmd:acg] Gear centered on (0,0,0) contained within BBox [-.5*max(d1,d2), -.5*h, -.5*max(d1, d2)]
- h : Height of the Gear. [+.5*max(d1,d2), +.5*h, +.5*max(d1, d2)]
@@ -818,7 +819,7 @@ public:
- offset : useless
*/
void AppendCog(int nbsides, float h, float d10, float d20, float d1,
float d2, float d12, float d22, float sidemul, int offset);
float d2, float d12, float d22, float sidemul=1.f, bool offset=false);

//-------------------------------------------------------------------------
//TODO : Mesh Bone operations


+ 757
- 356
src/generated/easymesh-parser.cpp
File diff suppressed because it is too large
View File


+ 14
- 9
src/generated/easymesh-parser.h View File

@@ -111,15 +111,18 @@ namespace lol {
/* Line 34 of lalr1.cc */
#line 35 "easymesh/easymesh-parser.y"

float fval;
float fval;
int ival;
bool bval;
float vval[4];
int ivval[4];
/* Can't use uin32_t here for some reason */
unsigned u32val;
struct { float f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; } args;



/* Line 34 of lalr1.cc */
#line 123 "generated/easymesh-parser.h"
#line 126 "generated/easymesh-parser.h"
};
#else
typedef YYSTYPE semantic_type;
@@ -190,8 +193,10 @@ namespace lol {
T_COG = 313,
T_TORUS = 314,
T_ERROR = 315,
NUMBER = 316,
COLOR = 317
F_NUMBER = 316,
I_NUMBER = 317,
BOOLEAN = 318,
COLOR = 319
};

};
@@ -269,7 +274,7 @@ namespace lol {
typedef unsigned char token_number_type;
/* Tables. */
/// For a state, the index in \a yytable_ of its portion.
static const signed char yypact_[];
static const short int yypact_[];
static const signed char yypact_ninf_;

/// For a state, default rule to reduce.
@@ -314,9 +319,9 @@ namespace lol {
/// A `-1'-separated list of the rules' RHS.
static const rhs_number_type yyrhs_[];
/// For each rule, the index of the first RHS symbol in \a yyrhs_.
static const unsigned char yyprhs_[];
static const unsigned short int yyprhs_[];
/// For each rule, its source line number.
static const unsigned char yyrline_[];
static const unsigned short int yyrline_[];
/// For each scanner token number, its symbol number.
static const unsigned short int yytoken_number_[];
/// Report on the debug stream that the rule \a r is going to be reduced.
@@ -365,7 +370,7 @@ namespace lol {
} // lol

/* Line 34 of lalr1.cc */
#line 369 "generated/easymesh-parser.h"
#line 374 "generated/easymesh-parser.h"





+ 342
- 182
src/generated/easymesh-scanner.cpp View File

@@ -330,8 +330,8 @@ typedef unsigned char YY_CHAR;
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;

#define YY_NUM_RULES 69
#define YY_END_OF_BUFFER 70
#define YY_NUM_RULES 75
#define YY_END_OF_BUFFER 76
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -339,39 +339,60 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[112] =
static yyconst flex_int16_t yy_accept[309] =
{ 0,
0, 0, 70, 68, 67, 66, 68, 68, 63, 68,
62, 64, 65, 68, 68, 68, 68, 68, 32, 7,
0, 0, 62, 62, 0, 45, 46, 49, 0, 0,
52, 53, 56, 0, 3, 0, 34, 35, 36, 37,
8, 9, 10, 1, 0, 0, 0, 0, 29, 30,
31, 0, 0, 0, 4, 5, 6, 0, 0, 62,
0, 48, 50, 0, 0, 0, 57, 0, 0, 0,
0, 2, 17, 18, 19, 0, 0, 20, 21, 22,
11, 12, 13, 33, 14, 15, 16, 58, 47, 51,
54, 55, 23, 24, 25, 26, 27, 28, 43, 41,

40, 44, 39, 38, 59, 42, 0, 60, 0, 61,
0
0, 0, 76, 74, 73, 72, 74, 68, 69, 74,
67, 74, 74, 65, 70, 71, 74, 74, 74, 74,
74, 74, 32, 7, 0, 0, 65, 64, 0, 45,
46, 49, 0, 0, 52, 53, 56, 0, 0, 3,
0, 0, 0, 34, 35, 36, 0, 37, 0, 8,
9, 10, 1, 0, 0, 0, 0, 0, 29, 30,
31, 0, 0, 0, 0, 4, 5, 6, 0, 0,
0, 66, 0, 48, 0, 0, 50, 0, 0, 0,
57, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 17, 18, 19, 0, 0,

0, 0, 20, 21, 22, 0, 11, 12, 13, 0,
0, 33, 0, 14, 15, 16, 58, 0, 64, 47,
0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
54, 55, 23, 24, 25, 26, 27, 28, 0, 0,
43, 41, 40, 44, 0, 0, 0, 0, 0, 0,
0, 0, 0, 39, 0, 38, 0, 0, 0, 62,
0, 59, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
42, 0, 0, 0, 63, 0, 0, 0, 32, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 43, 0, 0, 44, 0, 0, 0, 0, 0,
0, 0, 0, 0, 60, 0, 0, 49, 0, 0,
0, 53, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 40, 0, 0, 0, 1, 0, 0,
61, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 7, 0, 0, 0, 0, 0, 0, 0,
0, 0, 46, 0, 0, 0, 56, 0, 0, 0,
0, 0, 0, 0, 41, 0, 0, 0, 0, 0,

0, 0, 0, 0, 0, 0, 0, 0
} ;

static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 4, 1, 1, 5, 1, 1, 1, 1, 6,
7, 1, 8, 4, 9, 10, 11, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 1, 1, 1,
1, 1, 1, 1, 13, 13, 13, 13, 14, 13,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 3, 1, 1, 4, 1, 1, 1, 1, 1,
1, 1, 5, 3, 6, 7, 1, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
1, 1, 1, 1, 9, 9, 9, 9, 10, 9,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11, 1, 12, 1, 1, 1, 13, 14, 15, 16,
15, 1, 16, 1, 1, 1, 17, 18, 19, 20,

17, 18, 19, 20, 1, 21, 1, 22, 23, 1,
24, 25, 26, 27, 28, 29, 30, 1, 31, 32,
33, 34, 1, 1, 1, 1, 1, 1, 1, 1,
21, 22, 23, 24, 25, 26, 1, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 1, 37, 38,
39, 40, 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,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -388,92 +409,192 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;

static yyconst flex_int32_t yy_meta[35] =
static yyconst flex_int32_t yy_meta[41] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
1, 1, 2, 2, 2, 2, 2, 2, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1
1, 2, 2, 2, 1, 1, 2, 2, 2, 2,
2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
} ;

static yyconst flex_int16_t yy_base[120] =
static yyconst flex_int16_t yy_base[318] =
{ 0,
0, 0, 141, 142, 142, 142, 0, 28, 30, 132,
32, 142, 142, 36, 123, 27, 11, 25, 51, 73,
0, 130, 53, 65, 73, 142, 74, 142, 109, 121,
142, 52, 111, 56, 142, 115, 142, 142, 142, 142,
142, 142, 142, 119, 62, 103, 109, 65, 142, 142,
142, 76, 99, 79, 142, 142, 142, 0, 121, 120,
102, 142, 142, 112, 111, 104, 142, 35, 68, 59,
90, 142, 142, 142, 142, 103, 92, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 0, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 97,

142, 142, 142, 142, 0, 142, 0, 0, 0, 142,
142, 115, 114, 113, 112, 70, 54, 46, 39
0, 0, 385, 386, 386, 386, 0, 386, 386, 31,
32, 372, 372, 35, 386, 386, 30, 33, 22, 365,
30, 41, 63, 87, 0, 369, 47, 62, 58, 386,
49, 43, 346, 360, 386, 54, 348, 50, 348, 359,
352, 347, 340, 386, 386, 386, 352, 386, 336, 386,
386, 386, 75, 335, 57, 70, 342, 73, 386, 386,
386, 76, 82, 331, 92, 386, 386, 386, 0, 125,
106, 386, 336, 386, 120, 335, 386, 347, 346, 339,
386, 83, 105, 90, 342, 333, 127, 326, 326, 333,
340, 329, 386, 117, 338, 386, 386, 386, 324, 329,

121, 331, 386, 386, 386, 330, 386, 386, 386, 321,
328, 386, 314, 386, 386, 386, 0, 335, 334, 386,
315, 130, 319, 305, 315, 305, 122, 118, 316, 386,
386, 386, 386, 386, 386, 386, 386, 386, 128, 317,
309, 83, 308, 306, 314, 304, 316, 297, 310, 307,
299, 295, 292, 386, 291, 386, 290, 291, 289, 386,
287, 0, 283, 289, 296, 291, 283, 285, 298, 297,
283, 295, 278, 285, 288, 119, 124, 132, 287, 287,
386, 288, 280, 271, 386, 270, 275, 280, 135, 281,
272, 138, 274, 262, 277, 141, 268, 144, 0, 260,

268, 273, 274, 255, 269, 258, 254, 250, 268, 251,
250, 386, 248, 251, 386, 147, 254, 150, 254, 248,
247, 243, 251, 257, 0, 237, 243, 386, 242, 251,
234, 386, 234, 238, 245, 386, 230, 235, 238, 233,
234, 227, 234, 153, 223, 0, 230, 236, 235, 230,
229, 229, 218, 386, 215, 229, 218, 386, 230, 225,
386, 224, 223, 222, 225, 222, 213, 222, 203, 212,
203, 206, 156, 201, 213, 204, 207, 209, 210, 207,
198, 203, 386, 191, 202, 206, 386, 187, 188, 197,
192, 183, 199, 188, 188, 193, 196, 182, 189, 180,

176, 170, 189, 172, 175, 170, 165, 386, 200, 199,
196, 198, 197, 151, 147, 84, 73
} ;

static yyconst flex_int16_t yy_def[120] =
static yyconst flex_int16_t yy_def[318] =
{ 0,
111, 1, 111, 111, 111, 111, 112, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
113, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 114, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 115, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,

111, 111, 111, 111, 116, 111, 117, 118, 119, 111,
0, 111, 111, 111, 111, 111, 111, 111, 111
308, 1, 308, 308, 308, 308, 309, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 310, 308, 308, 308, 311, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 312, 308,
311, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,

308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 313, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 314, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 315, 308,

308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 316, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 317, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,

308, 308, 308, 308, 308, 308, 308, 0, 308, 308,
308, 308, 308, 308, 308, 308, 308
} ;

static yyconst flex_int16_t yy_nxt[177] =
static yyconst flex_int16_t yy_nxt[427] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 4, 4,
12, 13, 14, 15, 16, 4, 4, 4, 4, 4,
4, 4, 17, 4, 4, 4, 18, 19, 20, 4,
4, 4, 4, 4, 22, 23, 22, 23, 22, 23,
110, 25, 37, 38, 39, 40, 35, 109, 25, 26,
27, 28, 29, 30, 36, 108, 41, 42, 43, 22,
23, 31, 25, 32, 33, 44, 65, 93, 94, 25,
45, 107, 24, 46, 25, 47, 66, 59, 59, 48,
60, 25, 49, 50, 51, 52, 61, 68, 69, 70,
97, 98, 62, 73, 74, 75, 78, 79, 80, 95,

53, 96, 99, 54, 55, 56, 57, 81, 82, 83,
85, 86, 87, 105, 88, 58, 21, 100, 106, 101,
104, 102, 103, 92, 91, 90, 89, 60, 60, 84,
77, 76, 72, 71, 67, 64, 63, 24, 34, 24,
111, 3, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111
4, 5, 4, 6, 7, 8, 9, 10, 11, 12,
13, 14, 4, 4, 15, 16, 17, 18, 19, 4,
4, 20, 4, 4, 4, 4, 4, 21, 4, 4,
4, 4, 22, 23, 24, 4, 4, 4, 4, 4,
26, 26, 27, 27, 26, 40, 27, 30, 31, 32,
33, 34, 38, 39, 43, 41, 26, 47, 27, 72,
72, 35, 75, 36, 37, 73, 48, 44, 45, 46,
49, 74, 79, 28, 261, 70, 76, 95, 50, 51,
52, 53, 70, 54, 80, 246, 55, 82, 83, 84,
56, 92, 93, 57, 96, 97, 98, 58, 110, 99,

59, 60, 61, 62, 100, 102, 106, 72, 72, 181,
103, 104, 105, 107, 108, 109, 113, 111, 182, 63,
64, 133, 134, 65, 66, 67, 68, 137, 138, 114,
115, 116, 118, 118, 150, 151, 119, 121, 122, 123,
124, 125, 135, 141, 136, 155, 164, 173, 225, 171,
174, 126, 199, 127, 128, 156, 172, 133, 134, 165,
142, 135, 143, 136, 144, 176, 177, 178, 166, 137,
138, 219, 59, 60, 61, 96, 97, 98, 107, 108,
109, 114, 115, 116, 44, 45, 46, 50, 51, 52,
103, 104, 105, 66, 67, 68, 71, 71, 162, 117,

69, 25, 131, 181, 307, 306, 305, 130, 77, 304,
303, 302, 301, 156, 300, 299, 298, 297, 296, 112,
48, 295, 294, 293, 292, 291, 290, 289, 288, 287,
286, 285, 284, 283, 282, 93, 281, 280, 279, 278,
277, 276, 275, 274, 120, 273, 272, 271, 270, 269,
268, 267, 266, 265, 264, 263, 262, 260, 259, 258,
257, 256, 255, 254, 253, 132, 252, 81, 251, 250,
249, 248, 247, 245, 244, 243, 242, 241, 240, 239,
238, 237, 236, 235, 234, 233, 232, 231, 35, 230,
229, 228, 227, 226, 224, 223, 222, 154, 221, 220,

218, 217, 216, 215, 214, 213, 212, 211, 210, 209,
208, 207, 206, 205, 204, 203, 202, 201, 74, 200,
30, 198, 197, 196, 195, 194, 193, 192, 191, 190,
189, 188, 187, 186, 185, 184, 183, 180, 179, 175,
170, 169, 168, 167, 163, 119, 119, 161, 160, 159,
158, 157, 154, 153, 152, 149, 148, 147, 146, 145,
140, 139, 132, 131, 130, 129, 120, 112, 101, 94,
91, 90, 89, 88, 87, 86, 85, 81, 78, 77,
28, 42, 29, 28, 308, 3, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,

308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308
} ;

static yyconst flex_int16_t yy_chk[177] =
static yyconst flex_int16_t yy_chk[427] =
{ 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, 1, 1,
1, 1, 1, 1, 8, 8, 9, 9, 11, 11,
119, 11, 17, 17, 17, 18, 16, 118, 11, 14,
14, 14, 14, 14, 16, 117, 18, 18, 18, 23,
23, 14, 23, 14, 14, 19, 32, 68, 68, 23,
19, 116, 24, 19, 24, 19, 32, 25, 25, 19,
25, 24, 19, 19, 19, 20, 27, 34, 34, 34,
70, 70, 27, 45, 45, 45, 48, 48, 48, 69,

20, 69, 71, 20, 20, 20, 20, 52, 52, 52,
54, 54, 54, 115, 114, 113, 112, 71, 100, 71,
77, 71, 76, 66, 65, 64, 61, 60, 59, 53,
47, 46, 44, 36, 33, 30, 29, 22, 15, 10,
3, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
111, 111, 111, 111, 111, 111
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
10, 11, 10, 11, 14, 19, 14, 17, 17, 17,
17, 17, 18, 18, 21, 19, 27, 22, 27, 29,
29, 17, 32, 17, 17, 31, 22, 21, 21, 21,
22, 31, 36, 28, 317, 28, 32, 55, 22, 22,
22, 23, 28, 23, 36, 316, 23, 38, 38, 38,
23, 53, 53, 23, 55, 55, 55, 23, 63, 56,

23, 23, 23, 24, 56, 58, 62, 71, 71, 142,
58, 58, 58, 62, 62, 62, 65, 63, 142, 24,
24, 82, 82, 24, 24, 24, 24, 84, 84, 65,
65, 65, 70, 70, 94, 94, 70, 75, 75, 75,
75, 75, 83, 87, 83, 101, 122, 128, 315, 127,
128, 75, 314, 75, 75, 101, 127, 176, 176, 122,
87, 177, 87, 177, 87, 139, 139, 139, 122, 178,
178, 189, 189, 189, 189, 192, 192, 192, 196, 196,
196, 198, 198, 198, 216, 216, 216, 218, 218, 218,
244, 244, 244, 273, 273, 273, 311, 311, 313, 312,

310, 309, 307, 306, 305, 304, 303, 302, 301, 300,
299, 298, 297, 296, 295, 294, 293, 292, 291, 290,
289, 288, 286, 285, 284, 282, 281, 280, 279, 278,
277, 276, 275, 274, 272, 271, 270, 269, 268, 267,
266, 265, 264, 263, 262, 260, 259, 257, 256, 255,
253, 252, 251, 250, 249, 248, 247, 245, 243, 242,
241, 240, 239, 238, 237, 235, 234, 233, 231, 230,
229, 227, 226, 224, 223, 222, 221, 220, 219, 217,
214, 213, 211, 210, 209, 208, 207, 206, 205, 204,
203, 202, 201, 200, 197, 195, 194, 193, 191, 190,

188, 187, 186, 184, 183, 182, 180, 179, 175, 174,
173, 172, 171, 170, 169, 168, 167, 166, 165, 164,
163, 161, 159, 158, 157, 155, 153, 152, 151, 150,
149, 148, 147, 146, 145, 144, 143, 141, 140, 129,
126, 125, 124, 123, 121, 119, 118, 113, 111, 110,
106, 102, 100, 99, 95, 92, 91, 90, 89, 88,
86, 85, 80, 79, 78, 76, 73, 64, 57, 54,
49, 47, 43, 42, 41, 40, 39, 37, 34, 33,
26, 20, 13, 12, 3, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,

308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308, 308, 308, 308, 308,
308, 308, 308, 308, 308, 308
} ;

/* The intent behind this definition is that it'll catch
@@ -522,7 +643,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 526 "generated/easymesh-scanner.cpp"
#line 647 "generated/easymesh-scanner.cpp"

#define INITIAL 0

@@ -630,12 +751,11 @@ YY_DECL
#line 44 "easymesh/easymesh-scanner.l"



/* reset location at the beginning of yylex() */
/* reset location at the beginning of yylex() */
yylloc->step();


#line 639 "generated/easymesh-scanner.cpp"
#line 759 "generated/easymesh-scanner.cpp"

if ( !(yy_init) )
{
@@ -688,13 +808,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 >= 112 )
if ( yy_current_state >= 309 )
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 != 111 );
while ( yy_current_state != 308 );
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);

@@ -716,292 +836,294 @@ do_action: /* This label is used only to access EOF actions. */

case 1:
YY_RULE_SETUP
#line 51 "easymesh/easymesh-scanner.l"
#line 50 "easymesh/easymesh-scanner.l"
{ return token::T_COLOR; }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 52 "easymesh/easymesh-scanner.l"
#line 51 "easymesh/easymesh-scanner.l"
{ return token::T_BGCOLOR; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 54 "easymesh/easymesh-scanner.l"
#line 53 "easymesh/easymesh-scanner.l"
{ return token::T_CHAMFER; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 55 "easymesh/easymesh-scanner.l"
#line 54 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATEX; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 56 "easymesh/easymesh-scanner.l"
#line 55 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATEY; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 57 "easymesh/easymesh-scanner.l"
#line 56 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATEZ; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 58 "easymesh/easymesh-scanner.l"
#line 57 "easymesh/easymesh-scanner.l"
{ return token::T_TRANSLATE; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 59 "easymesh/easymesh-scanner.l"
#line 58 "easymesh/easymesh-scanner.l"
{ return token::T_ROTATEX; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 60 "easymesh/easymesh-scanner.l"
#line 59 "easymesh/easymesh-scanner.l"
{ return token::T_ROTATEY; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 61 "easymesh/easymesh-scanner.l"
#line 60 "easymesh/easymesh-scanner.l"
{ return token::T_ROTATEZ; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 62 "easymesh/easymesh-scanner.l"
#line 61 "easymesh/easymesh-scanner.l"
{ return token::T_TAPERX; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 63 "easymesh/easymesh-scanner.l"
#line 62 "easymesh/easymesh-scanner.l"
{ return token::T_TAPERY; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 64 "easymesh/easymesh-scanner.l"
#line 63 "easymesh/easymesh-scanner.l"
{ return token::T_TAPERZ; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 65 "easymesh/easymesh-scanner.l"
#line 64 "easymesh/easymesh-scanner.l"
{ return token::T_TWISTX; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 66 "easymesh/easymesh-scanner.l"
#line 65 "easymesh/easymesh-scanner.l"
{ return token::T_TWISTY; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 67 "easymesh/easymesh-scanner.l"
#line 66 "easymesh/easymesh-scanner.l"
{ return token::T_TWISTZ; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 68 "easymesh/easymesh-scanner.l"
#line 67 "easymesh/easymesh-scanner.l"
{ return token::T_SHEARX; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 69 "easymesh/easymesh-scanner.l"
#line 68 "easymesh/easymesh-scanner.l"
{ return token::T_SHEARY; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 70 "easymesh/easymesh-scanner.l"
#line 69 "easymesh/easymesh-scanner.l"
{ return token::T_SHEARZ; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 71 "easymesh/easymesh-scanner.l"
#line 70 "easymesh/easymesh-scanner.l"
{ return token::T_STRETCHX; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 72 "easymesh/easymesh-scanner.l"
#line 71 "easymesh/easymesh-scanner.l"
{ return token::T_STRETCHY; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 73 "easymesh/easymesh-scanner.l"
#line 72 "easymesh/easymesh-scanner.l"
{ return token::T_STRETCHZ; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 74 "easymesh/easymesh-scanner.l"
#line 73 "easymesh/easymesh-scanner.l"
{ return token::T_BENDXY; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 75 "easymesh/easymesh-scanner.l"
#line 74 "easymesh/easymesh-scanner.l"
{ return token::T_BENDXZ; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 76 "easymesh/easymesh-scanner.l"
#line 75 "easymesh/easymesh-scanner.l"
{ return token::T_BENDYX; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 77 "easymesh/easymesh-scanner.l"
#line 76 "easymesh/easymesh-scanner.l"
{ return token::T_BENDYZ; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 78 "easymesh/easymesh-scanner.l"
#line 77 "easymesh/easymesh-scanner.l"
{ return token::T_BENDZX; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 79 "easymesh/easymesh-scanner.l"
#line 78 "easymesh/easymesh-scanner.l"
{ return token::T_BENDZY; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 80 "easymesh/easymesh-scanner.l"
#line 79 "easymesh/easymesh-scanner.l"
{ return token::T_SCALEX; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 81 "easymesh/easymesh-scanner.l"
#line 80 "easymesh/easymesh-scanner.l"
{ return token::T_SCALEY; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 82 "easymesh/easymesh-scanner.l"
#line 81 "easymesh/easymesh-scanner.l"
{ return token::T_SCALEZ; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 83 "easymesh/easymesh-scanner.l"
#line 82 "easymesh/easymesh-scanner.l"
{ return token::T_SCALE; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 84 "easymesh/easymesh-scanner.l"
#line 83 "easymesh/easymesh-scanner.l"
{ return token::T_TOGGLESCALEWINDING; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 85 "easymesh/easymesh-scanner.l"
#line 84 "easymesh/easymesh-scanner.l"
{ return token::T_MIRRORX; }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 86 "easymesh/easymesh-scanner.l"
#line 85 "easymesh/easymesh-scanner.l"
{ return token::T_MIRRORY; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 87 "easymesh/easymesh-scanner.l"
#line 86 "easymesh/easymesh-scanner.l"
{ return token::T_MIRRORZ; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 88 "easymesh/easymesh-scanner.l"
#line 87 "easymesh/easymesh-scanner.l"
{ return token::T_RADIALJITTER; }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 89 "easymesh/easymesh-scanner.l"
#line 88 "easymesh/easymesh-scanner.l"
{ return token::T_SPLITTRIANGLE; }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 90 "easymesh/easymesh-scanner.l"
#line 89 "easymesh/easymesh-scanner.l"
{ return token::T_SMOOTHMESH; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 92 "easymesh/easymesh-scanner.l"
#line 91 "easymesh/easymesh-scanner.l"
{ return token::T_CSGUNION; }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 93 "easymesh/easymesh-scanner.l"
#line 92 "easymesh/easymesh-scanner.l"
{ return token::T_CSGSUBSTRACT; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 94 "easymesh/easymesh-scanner.l"
#line 93 "easymesh/easymesh-scanner.l"
{ return token::T_CSGSUBSTRACTLOSS; }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 95 "easymesh/easymesh-scanner.l"
#line 94 "easymesh/easymesh-scanner.l"
{ return token::T_CSGAND; }
YY_BREAK
case 44:
YY_RULE_SETUP
#line 96 "easymesh/easymesh-scanner.l"
#line 95 "easymesh/easymesh-scanner.l"
{ return token::T_CSGXOR; }
YY_BREAK
case 45:
YY_RULE_SETUP
#line 98 "easymesh/easymesh-scanner.l"
#line 97 "easymesh/easymesh-scanner.l"
{ return token::T_BOX; }
YY_BREAK
case 46:
YY_RULE_SETUP
#line 99 "easymesh/easymesh-scanner.l"
#line 98 "easymesh/easymesh-scanner.l"
{ return token::T_CYLINDER; }
YY_BREAK
case 47:
YY_RULE_SETUP
#line 100 "easymesh/easymesh-scanner.l"
#line 99 "easymesh/easymesh-scanner.l"
{ return token::T_CAPSULE; }
YY_BREAK
case 48:
YY_RULE_SETUP
#line 101 "easymesh/easymesh-scanner.l"
#line 100 "easymesh/easymesh-scanner.l"
{ return token::T_COG; }
YY_BREAK
case 49:
YY_RULE_SETUP
#line 102 "easymesh/easymesh-scanner.l"
#line 101 "easymesh/easymesh-scanner.l"
{ return token::T_DISC; }
YY_BREAK
case 50:
YY_RULE_SETUP
#line 103 "easymesh/easymesh-scanner.l"
#line 102 "easymesh/easymesh-scanner.l"
{ return token::T_EXPANDEDSTAR; }
YY_BREAK
case 51:
YY_RULE_SETUP
#line 104 "easymesh/easymesh-scanner.l"
#line 103 "easymesh/easymesh-scanner.l"
{ return token::T_FLATCHAMFBOX; }
YY_BREAK
case 52:
YY_RULE_SETUP
#line 105 "easymesh/easymesh-scanner.l"
#line 104 "easymesh/easymesh-scanner.l"
{ return token::T_QUAD; }
YY_BREAK
case 53:
YY_RULE_SETUP
#line 106 "easymesh/easymesh-scanner.l"
#line 105 "easymesh/easymesh-scanner.l"
{ return token::T_STAR; }
YY_BREAK
case 54:
YY_RULE_SETUP
#line 107 "easymesh/easymesh-scanner.l"
#line 106 "easymesh/easymesh-scanner.l"
{ return token::T_SMOOTHCHAMFBOX; }
YY_BREAK
case 55:
YY_RULE_SETUP
#line 108 "easymesh/easymesh-scanner.l"
#line 107 "easymesh/easymesh-scanner.l"
{ return token::T_SPHERE; }
YY_BREAK
case 56:
YY_RULE_SETUP
#line 109 "easymesh/easymesh-scanner.l"
#line 108 "easymesh/easymesh-scanner.l"
{ return token::T_TRIANGLE; }
YY_BREAK
case 57:
YY_RULE_SETUP
#line 110 "easymesh/easymesh-scanner.l"
#line 109 "easymesh/easymesh-scanner.l"
{ return token::T_TORUS; }
YY_BREAK
/* ======= BASE DATA TYPES ========================================= */
/* COLOR */
case 58:
YY_RULE_SETUP
#line 112 "easymesh/easymesh-scanner.l"
#line 113 "easymesh/easymesh-scanner.l"
{
uint32_t tmp = std::strtol(yytext + 1, nullptr, 16);
yylval->u32val = 0x11000000u * (tmp >> 8)
@@ -1012,7 +1134,7 @@ YY_RULE_SETUP
YY_BREAK
case 59:
YY_RULE_SETUP
#line 119 "easymesh/easymesh-scanner.l"
#line 120 "easymesh/easymesh-scanner.l"
{
uint32_t tmp = std::strtol(yytext + 1, nullptr, 16);
yylval->u32val = 0x11000000u * (tmp >> 12)
@@ -1023,7 +1145,7 @@ YY_RULE_SETUP
YY_BREAK
case 60:
YY_RULE_SETUP
#line 126 "easymesh/easymesh-scanner.l"
#line 127 "easymesh/easymesh-scanner.l"
{
yylval->u32val = 0xffu
| 0x100u * (uint32_t)std::strtol(yytext + 1, nullptr, 16);
@@ -1031,54 +1153,92 @@ YY_RULE_SETUP
YY_BREAK
case 61:
YY_RULE_SETUP
#line 130 "easymesh/easymesh-scanner.l"
#line 131 "easymesh/easymesh-scanner.l"
{
yylval->u32val = (uint32_t)std::strtol(yytext + 1, nullptr, 16);
return token::COLOR; }
YY_BREAK
/* ======= BASE DATA TYPES ========================================= */
/* BOOL */
case 62:
YY_RULE_SETUP
#line 133 "easymesh/easymesh-scanner.l"
{
yylval->fval = std::atof(yytext); return token::NUMBER; }
#line 137 "easymesh/easymesh-scanner.l"
{ yylval->bval = true; return token::BOOLEAN; }
YY_BREAK
case 63:
YY_RULE_SETUP
#line 135 "easymesh/easymesh-scanner.l"
{ return token_type('-'); }
#line 138 "easymesh/easymesh-scanner.l"
{ yylval->bval = false; return token::BOOLEAN; }
YY_BREAK
/* FLOAT */
case 64:
YY_RULE_SETUP
#line 136 "easymesh/easymesh-scanner.l"
{ return token_type('['); }
#line 140 "easymesh/easymesh-scanner.l"
{
yylval->fval = (float)std::atof(yytext); return token::F_NUMBER; }
YY_BREAK
/* INT */
case 65:
YY_RULE_SETUP
#line 137 "easymesh/easymesh-scanner.l"
{ return token_type(']'); }
#line 143 "easymesh/easymesh-scanner.l"
{
yylval->ival = std::atoi(yytext); return token::I_NUMBER; }
YY_BREAK
/* ======= COMMENTS ======= */
case 66:
/* rule 66 can match eol */
YY_RULE_SETUP
#line 138 "easymesh/easymesh-scanner.l"
#line 147 "easymesh/easymesh-scanner.l"
{ /* ignore this */ }
YY_BREAK
/* Semantics tokens */
case 67:
/* rule 67 can match eol */
YY_RULE_SETUP
#line 139 "easymesh/easymesh-scanner.l"
{ /* ignore this */ }
#line 150 "easymesh/easymesh-scanner.l"
{ return token_type('-'); }
YY_BREAK
case 68:
YY_RULE_SETUP
#line 140 "easymesh/easymesh-scanner.l"
{ return token::T_ERROR; }
#line 151 "easymesh/easymesh-scanner.l"
{ return token_type('('); }
YY_BREAK
case 69:
YY_RULE_SETUP
#line 142 "easymesh/easymesh-scanner.l"
#line 152 "easymesh/easymesh-scanner.l"
{ return token_type(')'); }
YY_BREAK
case 70:
YY_RULE_SETUP
#line 153 "easymesh/easymesh-scanner.l"
{ return token_type('['); }
YY_BREAK
case 71:
YY_RULE_SETUP
#line 154 "easymesh/easymesh-scanner.l"
{ return token_type(']'); }
YY_BREAK
case 72:
YY_RULE_SETUP
#line 155 "easymesh/easymesh-scanner.l"
{ /* ignore this */ }
YY_BREAK
case 73:
/* rule 73 can match eol */
YY_RULE_SETUP
#line 156 "easymesh/easymesh-scanner.l"
{ /* ignore this */ }
YY_BREAK
case 74:
YY_RULE_SETUP
#line 157 "easymesh/easymesh-scanner.l"
{ return token::T_ERROR; }
YY_BREAK
case 75:
YY_RULE_SETUP
#line 159 "easymesh/easymesh-scanner.l"
ECHO;
YY_BREAK
#line 1082 "generated/easymesh-scanner.cpp"
#line 1242 "generated/easymesh-scanner.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();

@@ -1460,7 +1620,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 >= 112 )
if ( yy_current_state >= 309 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1488,11 +1648,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 >= 112 )
if ( yy_current_state >= 309 )
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 == 111);
yy_is_jam = (yy_current_state == 308);

return yy_is_jam ? 0 : yy_current_state;
}
@@ -1979,7 +2139,7 @@ void EasyMeshfree (void * ptr )

#define YYTABLES_NAME "yytables"

#line 142 "easymesh/easymesh-scanner.l"
#line 159 "easymesh/easymesh-scanner.l"





+ 1
- 1
test/data/mesh-buffer.txt View File

@@ -1,4 +1,4 @@
[sc#f8f afcb 1 1 1 0]
[sc#f8f ab 1 splt 3 twy 90]
// splt 5 twy 90 0
//[sc#f8f afcb 10 10 10 .25 tx 0 splt 3 twy 1.6 0 ]


+ 4
- 2
test/meshviewer.cpp View File

@@ -212,8 +212,8 @@ public:
is_pos = m_controller->GetKey(KEY_CAM_POS).IsDown();
is_fov = m_controller->GetKey(KEY_CAM_FOV).IsDown();

vec2 tmp = vec2((float)m_controller->GetKey(KEY_CAM_UP ).IsDown() - (float)m_controller->GetKey(KEY_CAM_DOWN).IsDown(),
((float)m_controller->GetKey(KEY_CAM_RIGHT ).IsDown() - (float)m_controller->GetKey(KEY_CAM_LEFT).IsDown()));
tmp = vec2((float)m_controller->GetKey(KEY_CAM_UP ).IsDown() - (float)m_controller->GetKey(KEY_CAM_DOWN).IsDown(),
((float)m_controller->GetKey(KEY_CAM_RIGHT ).IsDown() - (float)m_controller->GetKey(KEY_CAM_LEFT).IsDown()));
#endif //!__native_client__

//Base data
@@ -367,6 +367,7 @@ public:
String cmd = f.ReadString();
f.Close();

/*
for (int i = 0; i < cmd.Count() - 1; i++)
{
if (cmd[i] == '/' && cmd[i + 1] == '/')
@@ -384,6 +385,7 @@ public:
i--;
}
}
*/

if (cmd.Count()
&& (!m_cmdlist.Count() || cmd != m_cmdlist.Last()))


+ 7
- 1
test/meshviewer.vcxproj View File

@@ -60,6 +60,12 @@
<None Include="data\mesh-buffer.txt">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</None>
<None Include="meshviewer_index.html">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</None>
<None Include="meshviewer_nacl.nmf">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</None>
</ItemGroup>
<ItemGroup>
<LolFxCompile Include="shinyfur.lolfx" />
@@ -85,4 +91,4 @@
<ImportGroup Label="ExtensionTargets">
<Import Project="$(SolutionDir)\Lol.Fx.targets" />
</ImportGroup>
</Project>
</Project>

Loading…
Cancel
Save