Ignore:
Timestamp:
Nov 26, 2012, 11:54:01 AM (7 years ago)
Author:
touky
Message:

Added tsw (ToggleScaleWinding) command in EasyMesh Parser to make old-school celShading contour.

Location:
trunk/src/easymesh
Files:
4 edited

Legend:

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

    r1875 r2116  
    4848%token T_TRANSLATEY T_ROTATEY T_TAPERY T_SCALEY T_MIRRORY
    4949%token T_TRANSLATEZ T_ROTATEZ T_TAPERZ T_SCALEZ T_MIRRORZ
    50 %token T_TRANSLATE T_SCALE
     50%token T_TRANSLATE T_SCALE T_TOGGLESCALEWINDING
    5151%token T_CHAMFER
    5252
     
    135135  | T_MIRRORY           { mc.m_mesh.MirrorY(); }
    136136  | T_MIRRORZ           { mc.m_mesh.MirrorZ(); }
     137  | T_TOGGLESCALEWINDING { mc.m_mesh.ToggleScaleWinding(); }
    137138    ;
    138139
  • trunk/src/easymesh/easymesh-scanner.l

    r1910 r2116  
    6767sz    { return token::T_SCALEZ; }
    6868s     { return token::T_SCALE; }
     69tsw       { return token::T_TOGGLESCALEWINDING; }
    6970mx    { return token::T_MIRRORX; }
    7071my    { return token::T_MIRRORY; }
  • trunk/src/easymesh/easymesh.cpp

    r2077 r2116  
    4242
    4343EasyMesh::EasyMesh()
    44   : m_color(0), m_color2(0)
     44  : m_color(0), m_color2(0), m_ignore_winding_on_scale(0)
    4545{
    4646    m_cursors.Push(0, 0);
     
    131131}
    132132
     133void EasyMesh::ToggleScaleWinding()
     134{
     135    m_ignore_winding_on_scale = !m_ignore_winding_on_scale;
     136}
     137
    133138void EasyMesh::SetCurColor(vec4 const &color)
    134139{
     
    321326
    322327    /* Flip winding if the scaling involves mirroring */
    323     if (s.x * s.y * s.z < 0)
     328    if (!m_ignore_winding_on_scale && s.x * s.y * s.z < 0)
    324329    {
    325330        for (int i = m_cursors.Last().m2; i < m_indices.Count(); i += 3)
  • trunk/src/easymesh/easymesh.h

    r1875 r2116  
    3636    void CloseBrace();
    3737
     38        void ToggleScaleWinding();
    3839    void SetCurColor(vec4 const &color);
    3940    void SetCurColor2(vec4 const &color);
     
    9495    Array<vec3, vec3, vec4> m_vert;
    9596    Array<int, int> m_cursors;
     97        bool m_ignore_winding_on_scale;
    9698
    9799    /* FIXME: put this in a separate class so that we can copy meshes. */
Note: See TracChangeset for help on using the changeset viewer.