Bläddra i källkod

EZMesh : Added SCVert command

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 11 år sedan
förälder
incheckning
6e996f41aa
7 ändrade filer med 955 tillägg och 903 borttagningar
  1. +6
    -1
      src/easymesh/easymesh-parser.y
  2. +3
    -2
      src/easymesh/easymesh-scanner.l
  3. +574
    -538
      src/generated/easymesh-parser.cpp
  4. +64
    -63
      src/generated/easymesh-parser.h
  5. +299
    -290
      src/generated/easymesh-scanner.cpp
  6. +6
    -7
      test/data/mesh-buffer.txt
  7. +3
    -2
      test/easymeshdictionnary.js

+ 6
- 1
src/easymesh/easymesh-parser.y Visa fil

@@ -45,7 +45,7 @@

%start mesh_description

%token T_COLOR T_BCOLOR
%token T_COLOR T_BCOLOR T_VCOLOR

%token T_TRANSLATEX T_ROTATEX T_TAPERX T_TWISTX T_SHEARX T_STRETCHX T_BENDXY T_BENDXZ T_SCALEX T_MIRRORX
%token T_TRANSLATEY T_ROTATEY T_TAPERY T_TWISTY T_SHEARY T_STRETCHY T_BENDYX T_BENDYZ T_SCALEY T_MIRRORY
@@ -147,6 +147,11 @@ color_command:
| T_BCOLOR 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)); }
| T_VCOLOR fv fv fv fv { mc.m_mesh.SetVertColor(vec4($2, $3, $4, $5)); }
| T_VCOLOR v4 { mc.m_mesh.SetVertColor(vec4($2[0], $2[1], $2[2], $2[3])); }
| T_VCOLOR COLOR { uint32_t x = $2;
ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
mc.m_mesh.SetVertColor(vec4(v) * (1.f / 255.f)); }
;

transform_command:


+ 3
- 2
src/easymesh/easymesh-scanner.l Visa fil

@@ -48,14 +48,15 @@ typedef lol::EasyMeshParser::token_type token_type;
%}

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

(tsw|scalewinding) { return token::T_TOGGLESCALEWINDING; }
(sc|setcolor) { return token::T_COLOR; }
(scb|setbcolor) { return token::T_BCOLOR; }
(scv|setcolorvert) { return token::T_VCOLOR; }

(tx|translatex) { return token::T_TRANSLATEX; }
(ty|translatey) { return token::T_TRANSLATEY; }


+ 574
- 538
src/generated/easymesh-parser.cpp
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 64
- 63
src/generated/easymesh-parser.h Visa fil

@@ -138,68 +138,69 @@ namespace lol {
T_END = 0,
T_COLOR = 258,
T_BCOLOR = 259,
T_TRANSLATEX = 260,
T_ROTATEX = 261,
T_TAPERX = 262,
T_TWISTX = 263,
T_SHEARX = 264,
T_STRETCHX = 265,
T_BENDXY = 266,
T_BENDXZ = 267,
T_SCALEX = 268,
T_MIRRORX = 269,
T_TRANSLATEY = 270,
T_ROTATEY = 271,
T_TAPERY = 272,
T_TWISTY = 273,
T_SHEARY = 274,
T_STRETCHY = 275,
T_BENDYX = 276,
T_BENDYZ = 277,
T_SCALEY = 278,
T_MIRRORY = 279,
T_TRANSLATEZ = 280,
T_ROTATEZ = 281,
T_TAPERZ = 282,
T_TWISTZ = 283,
T_SHEARZ = 284,
T_STRETCHZ = 285,
T_BENDZX = 286,
T_BENDZY = 287,
T_SCALEZ = 288,
T_MIRRORZ = 289,
T_TRANSLATE = 290,
T_ROTATE = 291,
T_SCALE = 292,
T_TOGGLESCALEWINDING = 293,
T_RADIALJITTER = 294,
T_SPLITTRIANGLE = 295,
T_SMOOTHMESH = 296,
T_DUPLICATE = 297,
T_CSGUNION = 298,
T_CSGSUBSTRACT = 299,
T_CSGSUBSTRACTLOSS = 300,
T_CSGAND = 301,
T_CSGXOR = 302,
T_CHAMFER = 303,
T_CYLINDER = 304,
T_BOX = 305,
T_SMOOTHCHAMFBOX = 306,
T_FLATCHAMFBOX = 307,
T_SPHERE = 308,
T_CAPSULE = 309,
T_STAR = 310,
T_EXPANDEDSTAR = 311,
T_DISC = 312,
T_TRIANGLE = 313,
T_QUAD = 314,
T_COG = 315,
T_TORUS = 316,
T_ERROR = 317,
F_NUMBER = 318,
I_NUMBER = 319,
BOOLEAN = 320,
COLOR = 321
T_VCOLOR = 260,
T_TRANSLATEX = 261,
T_ROTATEX = 262,
T_TAPERX = 263,
T_TWISTX = 264,
T_SHEARX = 265,
T_STRETCHX = 266,
T_BENDXY = 267,
T_BENDXZ = 268,
T_SCALEX = 269,
T_MIRRORX = 270,
T_TRANSLATEY = 271,
T_ROTATEY = 272,
T_TAPERY = 273,
T_TWISTY = 274,
T_SHEARY = 275,
T_STRETCHY = 276,
T_BENDYX = 277,
T_BENDYZ = 278,
T_SCALEY = 279,
T_MIRRORY = 280,
T_TRANSLATEZ = 281,
T_ROTATEZ = 282,
T_TAPERZ = 283,
T_TWISTZ = 284,
T_SHEARZ = 285,
T_STRETCHZ = 286,
T_BENDZX = 287,
T_BENDZY = 288,
T_SCALEZ = 289,
T_MIRRORZ = 290,
T_TRANSLATE = 291,
T_ROTATE = 292,
T_SCALE = 293,
T_TOGGLESCALEWINDING = 294,
T_RADIALJITTER = 295,
T_SPLITTRIANGLE = 296,
T_SMOOTHMESH = 297,
T_DUPLICATE = 298,
T_CSGUNION = 299,
T_CSGSUBSTRACT = 300,
T_CSGSUBSTRACTLOSS = 301,
T_CSGAND = 302,
T_CSGXOR = 303,
T_CHAMFER = 304,
T_CYLINDER = 305,
T_BOX = 306,
T_SMOOTHCHAMFBOX = 307,
T_FLATCHAMFBOX = 308,
T_SPHERE = 309,
T_CAPSULE = 310,
T_STAR = 311,
T_EXPANDEDSTAR = 312,
T_DISC = 313,
T_TRIANGLE = 314,
T_QUAD = 315,
T_COG = 316,
T_TORUS = 317,
T_ERROR = 318,
F_NUMBER = 319,
I_NUMBER = 320,
BOOLEAN = 321,
COLOR = 322
};

};
@@ -373,7 +374,7 @@ namespace lol {
} // lol

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





+ 299
- 290
src/generated/easymesh-scanner.cpp
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 6
- 7
test/data/mesh-buffer.txt Visa fil

@@ -1,6 +1,6 @@
addlight 0.0 position (1 -1 1) color #fff
addlight 0.0 position (-1 -1 -1) color #fff
clearcolor #f00
clearcolor #000
//addlight 0.0 position (1 0 1) color #0ff
//addlight 0.0 position (-0.2 -1 -0.5) color (.0 .2 .5 1)

@@ -8,16 +8,15 @@ clearcolor #f00
custom setmesh "
[sc#0f0 scb#0f0 ac 3 .5 .4 0 ty .25 [ad 3 .4 sy -1] ty .5 ac 3 1 .1 .1 ty .5 dup [ rz 90 ry 90 dup [ ry 90 ] ] ]
[sc#0f0 scb#0f0 ac 3 .5 .4 0 ty .25 [ad 3 .4 sy -1] ty .5 ac 3 1 .1 .1 ty .5 dup [ rz 90 ry 90 scv#00f dup [ ry 90 scv#f00 ] ] ]
[sc#fff ab .1]
//[sc#f00 scb#f00 ac 3 .5 .4 0 ty .25 [ad 3 .4 sy -1] ty .5 ac 3 1 .1 .1 ty .5 rz -90]
//[sc#00f scb#00f ac 3 .5 .4 0 ty .25 [ad 3 .4 sy -1] ty .5 ac 3 1 .1 .1 ty .5 rx 90]
//[sc#fff ab .1]
[sc#f00 ab .2 tx 1]
[sc#0f0 ab .2 ty 1]
[sc#00f ab .2 tz 1]
//[sc#f00 ab .2 tx 1]
//[sc#0f0 ab .2 ty 1]
//[sc#00f ab .2 tz 1]
//sc#0f0 ab 2 ty 1.5 ab 2
//sc#00f ab 2 ty 1.5 ab 2


+ 3
- 2
test/easymeshdictionnary.js Visa fil

@@ -1,7 +1,7 @@
//-------------------------------------------------------------------------
//Command vars operations
//-------------------------------------------------------------------------
CmdVar("[ ]", ["Opens a new context,\nevery operations between the braces\nwill only be done to the vertices added\nsince the start of this context."]);
CmdVar("[ ]", ["Opens a new scope,\nevery operations between the braces\nwill only be done to the vertices added\nsince the start of this scope."]);
CmdVar("float", ["Fraction value", "0.0"]);
CmdVar("int", ["No decimal value", "0"]);
CmdVar("bool", ["Boolean value", "true/false", "1/0"]);
@@ -24,7 +24,8 @@ CmdType(["csgx", "csgxor"], "Performs a Xor operation as (m0_Outside/m0_Inside-
//-------------------------------------------------------------------------
CmdType(["tsw", "scalewinding"], "When activated, on negative-scaling,\nnormal-vector correction will not occur");
CmdType(["sc", "setcolor"], "Set A color", [CmdArg("color", "color")]);
CmdType(["scb", "setbgcolor"], "Set B color", [CmdArg("color", "color")]);
CmdType(["scb", "setcolorb"], "Set B color", [CmdArg("color", "color")]);
CmdType(["scv", "setcolorv"], "Set the color of all vertices in this scope", [CmdArg("color", "color")]);

//-------------------------------------------------------------------------
//Mesh transform operations


Laddar…
Avbryt
Spara