Ignore:
Timestamp:
Jan 17, 2013, 9:49:29 PM (7 years ago)
Author:
touky
Message:

Added CSG v0.001a : not optimized, too much operation makes it slow. triangle count is not optimized.
Useage : "...[.... csg*]" equals "current mesh -CSG- the mesh in the braces".
Keywords : CsgUnion<csgu>, CsgSubstract<csgs>, CsgAnd<csga>, CsgXor<csgx>
TODO : cleanup useless code.
TODO : Some bugs are still present, some face that disappear should not.
TODO : Correct epsilon useage (see geometry files).
TODO : Coplanar face are not handled -at all-.
TODO : Vertex count goes through the roof in case of a Xor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/easymesh/easymesh-parser.y

    r2183 r2226  
    33// Lol Engine
    44//
    5 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
    6 //            (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
    7 //            (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
     5// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
     6//            (c) 2009-2013 Cédric Lecacheur <jordx@free.fr>
     7//            (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
    88//   This program is free software; you can redistribute it and/or
    99//   modify it under the terms of the Do What The Fuck You Want To
     
    4949%token T_TRANSLATEZ T_ROTATEZ T_TAPERZ T_SCALEZ T_MIRRORZ
    5050%token T_TRANSLATE T_SCALE T_TOGGLESCALEWINDING
     51%token T_CSGUNION T_CSGSUBSTRACT T_CSGAND T_CSGXOR
    5152%token T_CHAMFER
    5253
     
    117118
    118119transform_command:
    119     T_CHAMFER args1     { mc.m_mesh.Chamfer($2.f0); }
    120   | T_TRANSLATEX args1  { mc.m_mesh.Translate(vec3($2.f0, 0, 0)); }
    121   | T_TRANSLATEY args1  { mc.m_mesh.Translate(vec3(0, $2.f0, 0)); }
    122   | T_TRANSLATEZ args1  { mc.m_mesh.Translate(vec3(0, 0, $2.f0)); }
    123   | T_TRANSLATE args3   { mc.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); }
    124   | T_ROTATEX args1     { mc.m_mesh.RotateX($2.f0); }
    125   | T_ROTATEY args1     { mc.m_mesh.RotateY($2.f0); }
    126   | T_ROTATEZ args1     { mc.m_mesh.RotateZ($2.f0); }
    127   | T_TAPERX args3      { mc.m_mesh.TaperX($2.f0, $2.f1, $2.f2); }
    128   | T_TAPERY args3      { mc.m_mesh.TaperY($2.f0, $2.f1, $2.f2); }
    129   | T_TAPERZ args3      { mc.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); }
    130   | T_SCALEX args1      { mc.m_mesh.Scale(vec3($2.f0, 1.0, 1.0)); }
    131   | T_SCALEY args1      { mc.m_mesh.Scale(vec3(1.0, $2.f0, 1.0)); }
    132   | T_SCALEZ args1      { mc.m_mesh.Scale(vec3(1.0, 1.0, $2.f0)); }
    133   | T_SCALE args3       { mc.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); }
    134   | T_MIRRORX           { mc.m_mesh.MirrorX(); }
    135   | T_MIRRORY           { mc.m_mesh.MirrorY(); }
    136   | T_MIRRORZ           { mc.m_mesh.MirrorZ(); }
    137   | T_TOGGLESCALEWINDING { mc.m_mesh.ToggleScaleWinding(); }
     120    T_CHAMFER args1        { mc.m_mesh.Chamfer($2.f0); }
     121  | T_TRANSLATEX args1     { mc.m_mesh.Translate(vec3($2.f0, 0, 0)); }
     122  | T_TRANSLATEY args1     { mc.m_mesh.Translate(vec3(0, $2.f0, 0)); }
     123  | T_TRANSLATEZ args1     { mc.m_mesh.Translate(vec3(0, 0, $2.f0)); }
     124  | T_TRANSLATE args3      { mc.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); }
     125  | T_ROTATEX args1        { mc.m_mesh.RotateX($2.f0); }
     126  | T_ROTATEY args1        { mc.m_mesh.RotateY($2.f0); }
     127  | T_ROTATEZ args1        { mc.m_mesh.RotateZ($2.f0); }
     128  | T_TAPERX args3         { mc.m_mesh.TaperX($2.f0, $2.f1, $2.f2); }
     129  | T_TAPERY args3         { mc.m_mesh.TaperY($2.f0, $2.f1, $2.f2); }
     130  | T_TAPERZ args3         { mc.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); }
     131  | T_SCALEX args1         { mc.m_mesh.Scale(vec3($2.f0, 1.0, 1.0)); }
     132  | T_SCALEY args1         { mc.m_mesh.Scale(vec3(1.0, $2.f0, 1.0)); }
     133  | T_SCALEZ args1         { mc.m_mesh.Scale(vec3(1.0, 1.0, $2.f0)); }
     134  | T_SCALE args3          { mc.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); }
     135  | T_MIRRORX              { mc.m_mesh.MirrorX(); }
     136  | T_MIRRORY              { mc.m_mesh.MirrorY(); }
     137  | T_MIRRORZ              { mc.m_mesh.MirrorZ(); }
     138  | T_TOGGLESCALEWINDING   { mc.m_mesh.ToggleScaleWinding(); }
     139  | T_CSGUNION             { mc.m_mesh.CsgUnion(); }
     140  | T_CSGSUBSTRACT         { mc.m_mesh.CsgSubstract(); }
     141  | T_CSGAND               { mc.m_mesh.CsgAnd(); }
     142  | T_CSGXOR               { mc.m_mesh.CsgXor(); }
    138143    ;
    139144
Note: See TracChangeset for help on using the changeset viewer.