Selaa lähdekoodia

EZMEsh : Tweaked SetColor syntax - Added QuadWeighting option

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 11 vuotta sitten
vanhempi
commit
46f0c2d7f0
9 muutettua tiedostoa jossa 1347 lisäystä ja 1109 poistoa
  1. +20
    -5
      src/easymesh/easymesh-parser.y
  2. +5
    -3
      src/easymesh/easymesh-scanner.l
  3. +227
    -135
      src/easymesh/easymesh.cpp
  4. +33
    -23
      src/easymesh/easymesh.h
  5. +659
    -576
      src/generated/easymesh-parser.cpp
  6. +67
    -65
      src/generated/easymesh-parser.h
  7. +310
    -297
      src/generated/easymesh-scanner.cpp
  8. +19
    -1
      test/data/mesh-buffer.txt
  9. +7
    -4
      test/easymeshdictionnary.js

+ 20
- 5
src/easymesh/easymesh-parser.y Näytä tiedosto

@@ -45,12 +45,12 @@

%start mesh_description

%token T_LOOP T_COLOR T_BCOLOR T_VCOLOR
%token T_LOOP T_COLOR T_ACOLOR 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
%token T_TRANSLATEZ T_ROTATEZ T_TAPERZ T_TWISTZ T_SHEARZ T_STRETCHZ T_BENDZX T_BENDZY T_SCALEZ T_MIRRORZ
%token T_TRANSLATE T_ROTATE T_SCALE T_TOGGLESCALEWINDING T_RADIALJITTER T_SPLITTRIANGLE T_SMOOTHMESH
%token T_TRANSLATE T_ROTATE T_SCALE T_TOGGLESCALEWINDING T_TOGGLEQUADWEIGHTING T_RADIALJITTER T_SPLITTRIANGLE T_SMOOTHMESH
%token T_DUPLICATE
%token T_CSGUNION T_CSGSUBSTRACT T_CSGSUBSTRACTLOSS T_CSGAND T_CSGXOR
%token T_CHAMFER
@@ -70,6 +70,7 @@
%type <fval> fv
%type <ival> iv
/* Vector types */
%type <vval> v2
%type <vval> v3
%type <vval> v4
/* Special types */
@@ -147,11 +148,16 @@ color_command:
| 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_BCOLOR fv fv fv fv { mc.m_mesh.SetCurColor2(vec4($2, $3, $4, $5)); }
| T_BCOLOR v4 { mc.m_mesh.SetCurColor2(vec4($2[0], $2[1], $2[2], $2[3])); }
| T_ACOLOR fv fv fv fv { mc.m_mesh.SetCurColorA(vec4($2, $3, $4, $5)); }
| T_ACOLOR v4 { mc.m_mesh.SetCurColorA(vec4($2[0], $2[1], $2[2], $2[3])); }
| T_ACOLOR COLOR { uint32_t x = $2;
ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff);
mc.m_mesh.SetCurColorA(vec4(v) * (1.f / 255.f)); }
| T_BCOLOR fv fv fv fv { mc.m_mesh.SetCurColorB(vec4($2, $3, $4, $5)); }
| T_BCOLOR v4 { mc.m_mesh.SetCurColorB(vec4($2[0], $2[1], $2[2], $2[3])); }
| 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)); }
mc.m_mesh.SetCurColorB(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;
@@ -226,6 +232,7 @@ transform_command:
| 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_TOGGLEQUADWEIGHTING { mc.m_mesh.ToggleQuadWeighting(); }
;

primitive_command:
@@ -262,6 +269,9 @@ primitive_command:
| 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); }
| T_COG iv fv v2 v2 v2 fv bv { mc.m_mesh.AppendCog($2, $3, $4[0], $4[1], $5[0], $5[1], $6[0], $6[1], $7, $8); }
| T_COG iv fv v2 v2 v2 fv { mc.m_mesh.AppendCog($2, $3, $4[0], $4[1], $5[0], $5[1], $6[0], $6[1], $7); }
| T_COG iv fv v2 v2 v2 { mc.m_mesh.AppendCog($2, $3, $4[0], $4[1], $5[0], $5[1], $6[0], $6[1]); }
;

/* Base Number types */
@@ -280,6 +290,11 @@ iv:
;

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

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


+ 5
- 3
src/easymesh/easymesh-scanner.l Näytä tiedosto

@@ -54,10 +54,12 @@ typedef lol::EasyMeshParser::token_type token_type;
(csgx|csgxor) { return token::T_CSGXOR; }

(lp|loop) { return token::T_LOOP; }
(tsw|scalewinding) { return token::T_TOGGLESCALEWINDING; }
(tsw|tglscalewind) { return token::T_TOGGLESCALEWINDING; }
(tqw|tglquadweight) { return token::T_TOGGLEQUADWEIGHTING; }
(sc|setcolor) { return token::T_COLOR; }
(scb|setbcolor) { return token::T_BCOLOR; }
(scv|setcolorvert) { return token::T_VCOLOR; }
(sca|setcolora) { return token::T_ACOLOR; }
(scb|setcolorb) { return token::T_BCOLOR; }
(scv|setcolorv) { return token::T_VCOLOR; }

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


+ 227
- 135
src/easymesh/easymesh.cpp Näytä tiedosto

@@ -519,14 +519,19 @@ void EasyMesh::ExecuteCmdStack()
EZM_CALL_FUNC(ToggleScaleWinding);
break;
}
case EasyMeshCmdType::SetColor:
case EasyMeshCmdType::QuadWeighting:
{
EZM_CALL_FUNC(SetCurColor, vec4);
EZM_CALL_FUNC(ToggleQuadWeighting);
break;
}
case EasyMeshCmdType::SetColor2:
case EasyMeshCmdType::SetColorA:
{
EZM_CALL_FUNC(SetCurColor2, vec4);
EZM_CALL_FUNC(SetCurColorA, vec4);
break;
}
case EasyMeshCmdType::SetColorB:
{
EZM_CALL_FUNC(SetCurColorB, vec4);
break;
}
case EasyMeshCmdType::SetVertColor:
@@ -1126,30 +1131,49 @@ void EasyMesh::ToggleScaleWinding()
BD()->Toggle(MeshBuildOperation::ScaleWinding);
}

//-----------------------------------------------------------------------------
void EasyMesh::ToggleQuadWeighting()
{
if (BD()->IsEnabled(MeshBuildOperation::CommandRecording))
{
BD()->CmdStack().AddCmd(EasyMeshCmdType::QuadWeighting);
return;
}

BD()->Toggle(MeshBuildOperation::QuadWeighting);
}

//-----------------------------------------------------------------------------
void EasyMesh::SetCurColor(vec4 const &color)
{
SetCurColorA(color);
SetCurColorB(color);
}

//-----------------------------------------------------------------------------
void EasyMesh::SetCurColorA(vec4 const &color)
{
if (BD()->IsEnabled(MeshBuildOperation::CommandRecording))
{
BD()->CmdStack().AddCmd(EasyMeshCmdType::SetColor);
BD()->CmdStack().AddCmd(EasyMeshCmdType::SetColorA);
BD()->CmdStack() << color;
return;
}

BD()->Color() = color;
BD()->ColorA() = color;
}

//-----------------------------------------------------------------------------
void EasyMesh::SetCurColor2(vec4 const &color)
void EasyMesh::SetCurColorB(vec4 const &color)
{
if (BD()->IsEnabled(MeshBuildOperation::CommandRecording))
{
BD()->CmdStack().AddCmd(EasyMeshCmdType::SetColor2);
BD()->CmdStack().AddCmd(EasyMeshCmdType::SetColorB);
BD()->CmdStack() << color;
return;
}

BD()->Color2() = color;
BD()->ColorB() = color;
}

//-----------------------------------------------------------------------------
@@ -1169,7 +1193,7 @@ void EasyMesh::SetVertColor(vec4 const &color)
//-----------------------------------------------------------------------------
void EasyMesh::AddVertex(vec3 const &coord)
{
m_vert.Push(VertexData(coord, vec3(0.f, 1.f, 0.f), BD()->Color()));
m_vert.Push(VertexData(coord, vec3(0.f, 1.f, 0.f), BD()->ColorA()));
m_state = MeshRender::NeedConvert;
}

@@ -1183,38 +1207,81 @@ void EasyMesh::AddDuplicateVertex(int i)
//-----------------------------------------------------------------------------
void EasyMesh::AddLerpVertex(int i, int j, float alpha)
{
m_vert.Push(VertexData(
lol::lerp(m_vert[i].m_coord, m_vert[j].m_coord, alpha),
lol::lerp(m_vert[i].m_normal, m_vert[j].m_normal, alpha),
lol::lerp(m_vert[i].m_color, m_vert[j].m_color, alpha),
lol::lerp(m_vert[i].m_texcoord, m_vert[j].m_texcoord, alpha),
((alpha < .5f) ? (m_vert[i].m_bone_id) : (m_vert[j].m_bone_id)), /* FIXME ? */
lol::lerp(m_vert[i].m_bone_weight, m_vert[j].m_bone_weight, alpha)));
AddLerpVertex(m_vert[i], m_vert[j], alpha);
}
//-----------------------------------------------------------------------------
void EasyMesh::AddLerpVertex(VertexData &vi, VertexData &vj, float alpha)
{
m_vert.Push(GetLerpVertex(vi, vj, alpha));
m_state = MeshRender::NeedConvert;
}

//-----------------------------------------------------------------------------
VertexData EasyMesh::GetLerpVertex(int i, int j, float alpha)
{
return GetLerpVertex(m_vert[i], m_vert[j], alpha);
}

//-----------------------------------------------------------------------------
VertexData EasyMesh::GetLerpVertex(VertexData &vi, VertexData &vj, float alpha)
{
return VertexData(
lol::lerp(vi.m_coord, vj.m_coord, alpha),
lol::lerp(vi.m_normal, vj.m_normal, alpha),
lol::lerp(vi.m_color, vj.m_color, alpha),
lol::lerp(vi.m_texcoord, vj.m_texcoord, alpha),
((alpha < .5f) ? (vi.m_bone_id) : (vj.m_bone_id)), /* FIXME ? */
lol::lerp(vi.m_bone_weight, vj.m_bone_weight, alpha));
}

//-----------------------------------------------------------------------------
void EasyMesh::AppendQuad(int i1, int i2, int i3, int i4, int base)
{
m_indices << base + i1;
m_indices << base + i2;
m_indices << base + i3;
if (BD()->IsEnabled(MeshBuildOperation::QuadWeighting) &&
!BD()->IsEnabled(MeshBuildOperation::IgnoreQuadWeighting))
{
int i5 = m_vert.Count();
AddLerpVertex(GetLerpVertex(base + i1, base + i3, .5f),
GetLerpVertex(base + i2, base + i4, .5f), .5f);
m_indices << i1 + base;
m_indices << i2 + base;
m_indices << i5;

m_indices << base + i4;
m_indices << base + i1;
m_indices << base + i3;
m_indices << i2 + base;
m_indices << i3 + base;
m_indices << i5;

m_indices << i4 + base;
m_indices << i1 + base;
m_indices << i5;

m_indices << i5;
m_indices << i3 + base;
m_indices << i4 + base;
}
else
{
m_indices << base + i1;
m_indices << base + i2;
m_indices << base + i3;

m_indices << base + i4;
m_indices << base + i1;
m_indices << base + i3;
}
}

//-----------------------------------------------------------------------------
void EasyMesh::AppendQuadDuplicateVerts(int i1, int i2, int i3, int i4, int base)
{
m_indices << m_vert.Count(); AddDuplicateVertex(base + i1);
m_indices << m_vert.Count(); AddDuplicateVertex(base + i2);
m_indices << m_vert.Count(); AddDuplicateVertex(base + i3);
int vbase = m_vert.Count();
AddDuplicateVertex(base + i1);
AddDuplicateVertex(base + i2);
AddDuplicateVertex(base + i3);
AddDuplicateVertex(base + i4);

m_indices << m_vert.Count(); AddDuplicateVertex(base + i4);
m_indices << m_vert.Count(); AddDuplicateVertex(base + i1);
m_indices << m_vert.Count(); AddDuplicateVertex(base + i3);
AppendQuad(0, 1, 2, 3, vbase);
}

//-----------------------------------------------------------------------------
@@ -1726,8 +1793,8 @@ void EasyMesh::AppendCylinder(int nsides, float h, float d1, float d2,
float r2 = d2 * .5f;

//SAVE
vec4 Saved_Color = BD()->Color();
vec4 Saved_Color2 = BD()->Color2();
vec4 Saved_ColorA = BD()->ColorA();
vec4 Saved_ColorB = BD()->ColorB();
vec2 Save_texcoord_offset = BD()->TexCoordOffset();
vec2 Save_texcoord_scale = BD()->TexCoordScale();

@@ -1749,14 +1816,29 @@ void EasyMesh::AppendCylinder(int nsides, float h, float d1, float d2,
n = mat3::rotate(180.0f / nsides, 0.f, 1.f, 0.f) * n;
n = normalize(n);

/* FIXME: normals should be flipped in two-sided mode, but that
* means duplicating the vertices again... */
//Two passes necessary to ensure "weighted quad" compatibility
//First pass : Add vertices
for (int i = 0; i < nsides; i++)
{
/* FIXME: normals should be flipped in two-sided mode, but that
* means duplicating the vertices again... */
AddVertex(p1); SetCurVertNormal(n); SetCurVertTexCoord(uv1); SetCurVertTexCoord2(uv1);
AddVertex(p2); SetCurVertNormal(n); SetCurVertTexCoord(uv2); SetCurVertTexCoord2(uv2);
SetCurVertColor(BD()->Color2());
AddVertex(p2); SetCurVertNormal(n); SetCurVertTexCoord(uv2); SetCurVertTexCoord2(uv2); SetCurVertColor(BD()->ColorB());

p1 = rotmat * p1; uv1 += uvadd;
p2 = rotmat * p2; uv2 += uvadd;

if (!smooth)
{
AddVertex(p1); SetCurVertNormal(n); SetCurVertTexCoord(uv1); SetCurVertTexCoord2(uv1);
AddVertex(p2); SetCurVertNormal(n); SetCurVertTexCoord(uv2); SetCurVertTexCoord2(uv2); SetCurVertColor(BD()->ColorB());
}

n = rotmat * n;
}
//Second pass : Build quad
for (int i = 0; i < nsides; i++)
{
if (smooth)
{
int j = (i + 1) % nsides;
@@ -1764,22 +1846,13 @@ void EasyMesh::AppendCylinder(int nsides, float h, float d1, float d2,
if (dualside)
AppendQuad(i * 2, i * 2 + 1, j * 2 + 1, j * 2, vbase);
}

p1 = rotmat * p1; uv1 += uvadd;
p2 = rotmat * p2; uv2 += uvadd;

if (!smooth)
else
{
AddVertex(p1); SetCurVertNormal(n); SetCurVertTexCoord(uv1); SetCurVertTexCoord2(uv1);
AddVertex(p2); SetCurVertNormal(n); SetCurVertTexCoord(uv2); SetCurVertTexCoord2(uv2);
SetCurVertColor(BD()->Color2());

AppendQuad(i * 4 + 2, i * 4 + 3, i * 4 + 1, i * 4, vbase);
if (dualside)
AppendQuad(i * 4, i * 4 + 1, i * 4 + 3, i * 4 + 2, vbase);
}

n = rotmat * n;
}

if (close)
@@ -1788,20 +1861,20 @@ void EasyMesh::AppendCylinder(int nsides, float h, float d1, float d2,
OpenBrace();
//LOWER DISC
SetTexCoordData(vec2(.0f, .5f), vec2(.5f, .5f));
SetCurColor(BD()->Color());
SetCurColorA(BD()->ColorA());
AppendDisc(nsides, d1);
Translate(vec3(.0f, h, .0f));
RotateX(180.0f);
//UPPER DISC
SetTexCoordData(vec2(.5f, .5f), vec2(.5f, .5f));
SetCurColor(BD()->Color2());
SetCurColorA(BD()->ColorB());
AppendDisc(nsides, d2);
Translate(vec3(.0f, h * .5f, .0f));
CloseBrace();
}
//RESTORE
SetCurColor(Saved_Color);
SetCurColor2(Saved_Color2);
SetCurColorA(Saved_ColorA);
SetCurColorB(Saved_ColorB);
SetTexCoordData(Save_texcoord_offset, Save_texcoord_scale);
}

@@ -2175,13 +2248,13 @@ void EasyMesh::AppendBox(vec3 const &size, float chamf, bool smooth)
SetCurVertTexCoord(BD()->TexCoord(mt, tl, mft));
SetCurVertTexCoord2(BD()->TexCoord2(mt, tr, mft));

/* The 6 quads on each side of the box */
for (int i = 0; i < 24; i += 4)
AppendQuad(i, i + 1, i + 2, i + 3, vbase);

ComputeNormals(ibase, m_indices.Count() - ibase);
ibase = m_indices.Count();

//Build the box at the end : The 6 quads on each side of the box.
for (int i = 0; i < 24; i += 4)
AppendQuad(i, i + 1, i + 2, i + 3, vbase);

/* The 8 quads at each edge of the box */
if (chamf)
{
@@ -2195,11 +2268,11 @@ void EasyMesh::AppendBox(vec3 const &size, float chamf, bool smooth)
for (int i = 0; i < 48; i += 4)
{
if (smooth)
AppendQuad(quadlist[i], quadlist[i + 1],
AppendQuad(quadlist[i], quadlist[i + 1],
quadlist[i + 2], quadlist[i + 3], vbase);
else
AppendQuadDuplicateVerts(quadlist[i], quadlist[i + 1],
quadlist[i + 2], quadlist[i + 3], vbase);
AppendQuadDuplicateVerts(quadlist[i], quadlist[i + 1],
quadlist[i + 2], quadlist[i + 3], vbase);
}
}

@@ -2215,11 +2288,9 @@ void EasyMesh::AppendBox(vec3 const &size, float chamf, bool smooth)
for (int i = 0; i < 24; i += 3)
{
if (smooth)
AppendTriangle(trilist[i], trilist[i + 1],
trilist[i + 2], vbase);
AppendTriangle(trilist[i], trilist[i + 1], trilist[i + 2], vbase);
else
AppendTriangleDuplicateVerts(trilist[i], trilist[i + 1],
trilist[i + 2], vbase);
AppendTriangleDuplicateVerts(trilist[i], trilist[i + 1], trilist[i + 2], vbase);
}
}

@@ -2238,6 +2309,9 @@ void EasyMesh::AppendStar(int nbranches, float d1, float d2,
return;
}

//Should ignore quad weight, as it does not destroy star symmetry
BD()->Enable(MeshBuildOperation::IgnoreQuadWeighting);

//XXX : This operation is done to convert radius to diameter without changing all the code.
float r1 = d1 * .5f;
float r2 = d2 * .5f;
@@ -2260,18 +2334,21 @@ void EasyMesh::AppendStar(int nbranches, float d1, float d2,
{
AddVertex(p1); SetCurVertTexCoord(uv1.xz + vec2(.5f)); SetCurVertTexCoord2(uv1.xz + vec2(.5f));
if (fade2)
SetCurVertColor(BD()->Color2());
SetCurVertColor(BD()->ColorB());

AddVertex(p2); SetCurVertTexCoord(uv2.xz + vec2(.5f)); SetCurVertTexCoord2(uv2.xz + vec2(.5f));
if (fade)
SetCurVertColor(BD()->Color2());
SetCurVertColor(BD()->ColorB());

AppendQuad(0, 2 * i + 1, 2 * i + 2, (2 * i + 3) % (2 * nbranches),
vbase);
//Append quad at the end
AppendQuad(0, 2 * i + 1, 2 * i + 2, (2 * i + 3) % (2 * nbranches), vbase);

p1 = rotmat * p1; uv1 = rotmat * uv1;
p2 = rotmat * p2; uv2 = rotmat * uv2;
}

//Restore
BD()->Disable(MeshBuildOperation::IgnoreQuadWeighting);
}

//-----------------------------------------------------------------------------
@@ -2284,6 +2361,9 @@ void EasyMesh::AppendExpandedStar(int nbranches, float d1, float d2, float extra
return;
}

//Should ignore quad weight, as it does not destroy star symmetry
BD()->Enable(MeshBuildOperation::IgnoreQuadWeighting);

//XXX : This operation is done to convert radius to diameter without changing all the code.
float r1 = d1 * .5f;
float r2 = d2 * .5f;
@@ -2310,10 +2390,11 @@ void EasyMesh::AppendExpandedStar(int nbranches, float d1, float d2, float extra
{
AddVertex(p1); SetCurVertTexCoord(uv1.xz + vec2(.5f)); SetCurVertTexCoord2(uv1.xz + vec2(.5f));
AddVertex(p2); SetCurVertTexCoord(uv2.xz + vec2(.5f)); SetCurVertTexCoord2(uv2.xz + vec2(.5f));
AddVertex(p3); SetCurVertTexCoord(uv3.xz + vec2(.5f)); SetCurVertTexCoord2(uv3.xz + vec2(.5f)); SetCurVertColor(BD()->Color2());
AddVertex(p4); SetCurVertTexCoord(uv4.xz + vec2(.5f)); SetCurVertTexCoord2(uv4.xz + vec2(.5f)); SetCurVertColor(BD()->Color2());
AddVertex(p3); SetCurVertTexCoord(uv3.xz + vec2(.5f)); SetCurVertTexCoord2(uv3.xz + vec2(.5f)); SetCurVertColor(BD()->ColorB());
AddVertex(p4); SetCurVertTexCoord(uv4.xz + vec2(.5f)); SetCurVertTexCoord2(uv4.xz + vec2(.5f)); SetCurVertColor(BD()->ColorB());

int j = (i + 1) % nbranches;
//
AppendQuad(0, 4 * i + 1, 4 * i + 2, 4 * j + 1, vbase);
AppendQuad(4 * i + 1, 4 * i + 3, 4 * i + 4, 4 * i + 2, vbase);
AppendQuad(4 * j + 1, 4 * i + 2, 4 * i + 4, 4 * j + 3, vbase);
@@ -2323,6 +2404,9 @@ void EasyMesh::AppendExpandedStar(int nbranches, float d1, float d2, float extra
p3 = rotmat * p3; uv3 = rotmat * uv3;
p4 = rotmat * p4; uv4 = rotmat * uv4;
}

//Restore
BD()->Disable(MeshBuildOperation::IgnoreQuadWeighting);
}

//-----------------------------------------------------------------------------
@@ -2350,7 +2434,7 @@ void EasyMesh::AppendDisc(int nsides, float d, bool fade)
{
AddVertex(p1); SetCurVertTexCoord(uv.xz + vec2(.5f, .5f)); SetCurVertTexCoord2(uv.xz + vec2(.5f, .5f));
if (fade)
SetCurVertColor(BD()->Color2());
SetCurVertColor(BD()->ColorB());
AppendTriangle(0, i + 1, ((i + 1) % nsides) + 1, vbase);
p1 = rotmat * p1;
uv = rotmat * uv;
@@ -2377,11 +2461,11 @@ void EasyMesh::AppendSimpleTriangle(float d, bool fade)
p = m * p;
AddVertex(p); SetCurVertTexCoord(vec2(0.f, 1.f)); SetCurVertTexCoord2(vec2(0.f, 1.f));
if (fade)
SetCurVertColor(BD()->Color2());
SetCurVertColor(BD()->ColorB());
p = m * p;
AddVertex(p); SetCurVertTexCoord(vec2(1.f, 1.f)); SetCurVertTexCoord2(vec2(1.f, 1.f));
if (fade)
SetCurVertColor(BD()->Color2());
SetCurVertColor(BD()->ColorB());

AppendTriangle(0, 1, 2, m_vert.Count() - 3);
}
@@ -2420,13 +2504,13 @@ void EasyMesh::AppendSimpleQuad(vec2 p1, vec2 p2, float z, bool fade)
TexCoordPos tl = TexCoordPos::TL;
SetCurVertTexCoord(BD()->TexCoord(mt, tl, mft));
SetCurVertTexCoord2(BD()->TexCoord2(mt, tl, mft));
if (fade) SetCurVertColor(BD()->Color2());
if (fade) SetCurVertColor(BD()->ColorB());
//--
AddVertex(vec3(p1.x, z, -p1.y));
TexCoordPos tr = TexCoordPos::TR;
SetCurVertTexCoord(BD()->TexCoord(mt, tr, mft));
SetCurVertTexCoord2(BD()->TexCoord2(mt, tr, mft));
if (fade) SetCurVertColor(BD()->Color2());
if (fade) SetCurVertColor(BD()->ColorB());

AppendQuad(0, 1, 2, 3, m_vert.Count() - 4);
ComputeNormals(m_indices.Count() - 6, 6);
@@ -2434,7 +2518,7 @@ void EasyMesh::AppendSimpleQuad(vec2 p1, vec2 p2, float z, bool fade)

//-----------------------------------------------------------------------------
void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
float d1, float d2, float d12, float d22,
float d11, float d21, float d12, float d22,
float sidemul, bool offset)
{
if (BD()->IsEnabled(MeshBuildOperation::CommandRecording))
@@ -2442,7 +2526,7 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
BD()->CmdStack().AddCmd(EasyMeshCmdType::AppendCog);
BD()->CmdStack() << nbsides << h
<< d10 << d20
<< d1 << d2
<< d11 << d21
<< d12 << d22
<< sidemul << offset;
return;
@@ -2451,8 +2535,8 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
//XXX : This operation is done to convert radius to diameter without changing all the code.
float r10 = d10 * .5f;
float r20 = d20 * .5f;
float r1 = d1 * .5f;
float r2 = d2 * .5f;
float r11 = d11 * .5f;
float r21 = d21 * .5f;
float r12 = d12 * .5f;
float r22 = d22 * .5f;

@@ -2472,17 +2556,17 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
//Upper points
p[0] = vec3(r10, h * .5f, 0.f);
p[1] = rotmat * p[0];
p[2] = vec3(r1, h * .5f, 0.f);
p[2] = vec3(r11, h * .5f, 0.f);
p[3] = rotmat * p[2];
p[4] = smat1 * (rotmat * vec3(r1 + r12, h * .5f, 0.f));
p[4] = smat1 * (rotmat * vec3(r11 + r12, h * .5f, 0.f));
p[5] = smat2 * (rotmat * p[4]);

//Lower points
p[6] = vec3(r20, h * -.5f, 0.f);
p[7] = rotmat * p[6];
p[8] = vec3(r2, h * -.5f, 0.f);
p[8] = vec3(r21, h * -.5f, 0.f);
p[9] = rotmat * p[8];
p[10] = smat1 * (rotmat * vec3(r2 + r22, h * -.5f, 0.f));
p[10] = smat1 * (rotmat * vec3(r21 + r22, h * -.5f, 0.f));
p[11] = smat2 * (rotmat * p[10]);

if (offset)
@@ -2492,7 +2576,7 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
rotmat = rotmat * rotmat;

//UV base computation
float maxr = max(max(r1 + r12, r2 + r22), max(r10, r20));
float maxr = max(max(r11 + r12, r21 + r22), max(r10, r20));
float InLn = length(p[1] - p[0]);
float CogLn[8] = { .0f, .0f, .0f, .0f, .0f, .0f, .0f, .0f };
for (int i = 0; i < 3; i++)
@@ -2588,60 +2672,64 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
uv[ 9] = vec2(CogSz, 1.f) * CogUV[0] + CogUV[1]; CogSz -= CogLn[0];
uv[ 8] = vec2(0.f, 1.f) * CogUV[0] + CogUV[1];

#define DEF_J_K_Q \
int j = 3 * 12 * i, \
k = 3 * 12 * ((i + 1) % nbsides); \
int q[] = { \
/* The top and bottom faces */ \
j, j, j, j, \
j, j, j, j, \
j, j, k, k, \
k, k, j, j, \
j, j, j, k, \
k, j, j, j, \
/* The inner side quads */ \
j, j, j, j, \
j, k, k, j, \
/* The outer side quads */ \
j, j, j, j, \
j, j, j, j, \
j, j, j, j, \
k, j, j, k \
};
int m[] = { /* The top and bottom faces */
0, 2, 3, 1,
7, 9, 8, 6,
1, 3, 2, 0,
6, 8, 9, 7,
3, 4, 5, 2,
8, 11, 10, 9,
/* The inner side quads */
0, 1, 7, 6,
1, 0, 6, 7,
/* The outer side quads */
3, 2, 8, 9,
4, 3, 9, 10,
5, 4, 10, 11,
2, 5, 11, 8
};
int a[] = { /* The top and bottom faces */
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
/* The inner side quads */
1, 1, 1, 1,
2, 2, 2, 2,
/* The outer side quads */
1, 1, 1, 1,
1, 2, 2, 1,
1, 2, 2, 1,
2, 2, 2, 2
};
//Gear generation loop
//Two passes necessary to ensure "weighted quad" compatibility
//First pass : Add vertices
for (int i = 0; i < nbsides; i++)
{
int j = 3 * 12 * i,
k = 3 * 12 * ((i + 1) % nbsides);

int q[] = { /* The top and bottom faces */
j, j, j, j,
j, j, j, j,
j, j, k, k,
k, k, j, j,
j, j, j, k,
k, j, j, j,
/* The inner side quads */
j, j, j, j,
j, k, k, j,
/* The outer side quads */
j, j, j, j,
j, j, j, j,
j, j, j, j,
k, j, j, k
};
int m[] = { /* The top and bottom faces */
0, 2, 3, 1,
7, 9, 8, 6,
1, 3, 2, 0,
6, 8, 9, 7,
3, 4, 5, 2,
8, 11, 10, 9,
/* The inner side quads */
0, 1, 7, 6,
1, 0, 6, 7,
/* The outer side quads */
3, 2, 8, 9,
4, 3, 9, 10,
5, 4, 10, 11,
2, 5, 11, 8
};
int a[] = { /* The top and bottom faces */
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
/* The inner side quads */
1, 1, 1, 1,
2, 2, 2, 2,
/* The outer side quads */
1, 1, 1, 1,
1, 2, 2, 1,
1, 2, 2, 1,
2, 2, 2, 2
};
DEF_J_K_Q;

/* Each vertex will share three faces, so three different
* normals, therefore we add each vertex three times. */
@@ -2683,9 +2771,16 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
}
}
if (d >= 6)
SetCurVertColor(BD()->Color2());
SetCurVertColor(BD()->ColorB());
}

for (int n = 0; n < 12; n++)
p[n] = rotmat * p[n];
}
//Second pass : Build quad
for (int i = 0; i < nbsides; i++)
{
DEF_J_K_Q;
int l = -4;
while ((l += 4) < 48)
AppendQuad(q[l + 0] + m[l + 0] * 3 + a[l + 0],
@@ -2693,9 +2788,6 @@ void EasyMesh::AppendCog(int nbsides, float h, float d10, float d20,
q[l + 2] + m[l + 2] * 3 + a[l + 2],
q[l + 3] + m[l + 3] * 3 + a[l + 3],
vbase);

for (int n = 0; n < 12; n++)
p[n] = rotmat * p[n];
}

ComputeNormals(ibase, m_indices.Count() - ibase);


+ 33
- 23
src/easymesh/easymesh.h Näytä tiedosto

@@ -201,9 +201,11 @@ struct MeshBuildOperation
enum Value
{
//When this flag is up, negative scaling will not invert faces.
ScaleWinding = (1 << 0),
CommandRecording = (1 << 1),
CommandExecution = (1 << 2),
ScaleWinding = (1 << 0),
CommandRecording = (1 << 1),
CommandExecution = (1 << 2),
QuadWeighting = (1 << 3),
IgnoreQuadWeighting = (1 << 4),

All = 0xffffffff
}
@@ -226,8 +228,9 @@ struct EasyMeshCmdType
CloseBrace,

ScaleWinding,
SetColor,
SetColor2,
QuadWeighting,
SetColorA,
SetColorB,
SetVertColor,

Translate,
@@ -355,8 +358,8 @@ class EasyMeshBuildData
public:
EasyMeshBuildData()
{
m_color = vec4(0.f, 0.f, 0.f, 1.f);
m_color2 = vec4(0.f, 0.f, 0.f, 1.f);
m_color_a = vec4(0.f, 0.f, 0.f, 1.f);
m_color_b = vec4(0.f, 0.f, 0.f, 1.f);
m_texcoord_offset = vec2(0.f);
m_texcoord_offset2 = vec2(0.f);
m_texcoord_scale = vec2(1.f);
@@ -372,8 +375,8 @@ public:
inline CommandStack &CmdStack() { return m_stack; }
inline int &Cmdi() { return m_cmd_i; }
inline Array<int, int> &LoopStack(){ return m_loop_stack; }
inline vec4 &Color() { return m_color; }
inline vec4 &Color2() { return m_color2; }
inline vec4 &ColorA() { return m_color_a; }
inline vec4 &ColorB() { return m_color_b; }
inline vec2 &TexCoordOffset() { return m_texcoord_offset; }
inline vec2 &TexCoordScale() { return m_texcoord_scale; }
inline vec2 &TexCoordOffset2() { return m_texcoord_offset2; }
@@ -561,8 +564,8 @@ public:
CommandStack m_stack;
int m_cmd_i;
Array<int, int> m_loop_stack;
vec4 m_color;
vec4 m_color2;
vec4 m_color_a;
vec4 m_color_b;
vec2 m_texcoord_offset;
vec2 m_texcoord_offset2;
vec2 m_texcoord_scale;
@@ -695,12 +698,16 @@ public:
void OpenBrace();
/* [cmd:]] Merge current vertices with previous context */
void CloseBrace();
/* [cmd:tsw] When activated, on negative-scaling, normal-vector correction will not occur */
/* [cmd:tsw] When active, on negative-scaling, normal-vector correction will not occur */
void ToggleScaleWinding();
/* [cmd:sc] Set base color */
/* [cmd:tqw] When active, quad will have a fifth center vertex */
void ToggleQuadWeighting();
/* [cmd:sc] Set both color */
void SetCurColor(vec4 const &color);
/* [cmd:scb] Set base color 2 */
void SetCurColor2(vec4 const &color);
/* [cmd:sca] Set base color A */
void SetCurColorA(vec4 const &color);
/* [cmd:scb] Set base color B */
void SetCurColorB(vec4 const &color);
/* [cmd:scv] Sets all vertices in this scope color. */
void SetVertColor(vec4 const &color);

@@ -711,6 +718,9 @@ private:
void AddVertex(vec3 const &coord);
void AddDuplicateVertex(int i);
void AddLerpVertex(int i, int j, float alpha);
void AddLerpVertex(VertexData &vi, VertexData &vj, float alpha);
VertexData GetLerpVertex(int i, int j, float alpha);
VertexData GetLerpVertex(VertexData &vi,VertexData &vj, float alpha);
void AppendQuad(int i1, int i2, int i3, int i4, int base);
void AppendQuadDuplicateVerts(int i1, int i2, int i3, int i4, int base);
void AppendTriangle(int i1, int i2, int i3, int base);
@@ -917,13 +927,13 @@ public:
- nbranches : Number of branches.
- d1 : double Length of the branches.
- d2 : double Length of the "branch" located between d1-branches.
- fade : if (true) in-between branches use Color2.
- fade2 : if (true) Star branches use Color2.
- fade : if (true) in-between branches use ColorB.
- fade2 : if (true) Star branches use ColorB.
*/
void AppendStar(int nbranches, float d1, float d2,
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.
Expanded star branches use ColorB.
- nbranches : Number of branches.
- d1 : Double Length of the branches.
- d2 : Double Length of the "branch" located between r1-branches.
@@ -933,17 +943,17 @@ public:
/* [cmd:ad] Disc centered on (0,0,0) with d diameter.
- nbsides : Number of sides.
- d : Diameter.
- fade : if (true) Outer vertices will use Color2
- fade : if (true) Outer vertices will use ColorB
*/
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 (true) 2nd & 3rd Vertices will use Color2
- fade : if (true) 2nd & 3rd Vertices will use ColorB
*/
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 (true) 3rd & 4th Vertices will use Color2
- fade : if (true) 3rd & 4th Vertices will use ColorB
*/
void AppendSimpleQuad(float size, bool fade=false);
private:
@@ -961,8 +971,8 @@ public:
- sidemul : multiplier for the size of the cogs.
- offset : useless
*/
void AppendCog(int nbsides, float h, float d10, float d20, float d1,
float d2, float d12, float d22, float sidemul=1.f, bool offset=false);
void AppendCog(int nbsides, float h, float d10, float d20, float d11,
float d21, float d12, float d22, float sidemul=0.f, bool offset=false);

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


+ 659
- 576
src/generated/easymesh-parser.cpp
File diff suppressed because it is too large
Näytä tiedosto


+ 67
- 65
src/generated/easymesh-parser.h Näytä tiedosto

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

};
@@ -375,7 +377,7 @@ namespace lol {
} // lol

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





+ 310
- 297
src/generated/easymesh-scanner.cpp
File diff suppressed because it is too large
Näytä tiedosto


+ 19
- 1
test/data/mesh-buffer.txt Näytä tiedosto

@@ -8,7 +8,25 @@ clearcolor #000
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 scv#00f dup [ ry 90 scv#f00 ] ] ]
tqw
//CMD TEST
//sc#0f0 ab 1
//sc#0f0 afcb 1 -.2
//sc#0f0 acg 8 1 1 1 2 2 1.5 1.5 -.4
//sc#0f0 as 6 1 2
//sc#0f0 scb#f00 aes 6 1 2 2
//sc#0f0 ac 6 1 1
//sc#0f0 aq 1
//splt 2 smth 4 0 1
//[sc#0f0 ac 3 .5 .4 0 false false true ty .25 [ad 3 .4 sy -1] ty .5 ac 3 1 .1 .1 false false true ty .5 dup [ rz 90 ry 90 scv#00f dup [ ry 90 scv#f00 ] ] ]
//[sc#fff ab 1 tx 2]
//[sc#fff ab 1 tx .5 ty .5]
//[sc#fff ab 1 tx -.5 ty -.5]
//smth 3 1 1 smth 8 0 1
//[sc#fff loop 4 [ [loop 4 [ab 1 tx 2]] tz 2]]


+ 7
- 4
test/easymeshdictionnary.js Näytä tiedosto

@@ -9,6 +9,7 @@ CmdVar("color", ["Red/Green/Blue/{Alpha}",
"HEXA: #ABC{D}", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#AABBCC{DD}",
"FLOAT:&nbsp;f f f f", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(f f f f)", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(f)"]);
CmdVar("vec3", ["X/Y/Z as float", "&nbsp;f f f", "(f f f)", "(f)"]);
CmdVar("vec2", ["X/Y/Z as float", "&nbsp;f f", "(f f)", "(f)"]);

//-------------------------------------------------------------------------
//Mesh CSG operations
@@ -22,8 +23,10 @@ CmdType(["csgx", "csgxor"], "Performs a Xor operation as :\n(current_scope_Outs
//-------------------------------------------------------------------------
//Mesh Base operations
//-------------------------------------------------------------------------
CmdType(["tsw", "scalewinding"], "When activated, on negative-scaling,\nnormal-vector correction will not occur");
CmdType(["sc", "setcolor"], "Set A color", [CmdArg("color", "color")]);
CmdType(["tsw", "tglscalewind"], "When active, on negative-scaling,\nnormal-vector correction will not occur\nDefault : Inactive");
CmdType(["tqw", "tglquadweight"], "When active, quad will have a fifth center vertex\nDefault : Inactive");
CmdType(["sc", "setcolor"], "Set A & B color", [CmdArg("color", "color")]);
CmdType(["sca", "setcolora"], "Set A 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")]);
CmdType(["lp", "loop"], "Performs a loop with the code in the braces.\nDoesn't open a new scope.", [CmdArg("int", "loopnb"), CmdArg("[ ]", "Loop command")]);
@@ -91,5 +94,5 @@ CmdType(["ad", "adddisc"], "Disc centered on (0,0,0) with d diameter.", [CmdArg(
CmdType(["at", "addtriangle"], "Triangle centered on (0,0,0)\nContained in a disc of d diameter.", [CmdArg("float", "d"), CmdArg("bool", "fade", "false")]);
CmdType(["aq", "addquad"], "Quad centered on (0,0,0) with BBox:\nMin: [-size * .5f, 0,-size * .5f]\nMax: [ size * .5f, 0, size * .5f]", [CmdArg("float", "size"), CmdArg("bool", "fade", "false")]);
CmdType(["acg", "addcog"], "Gear centered on (0,0,0) with BBox:\nMin: [-.5 * max(d1, d2),-.5 * h,-.5 * max(d1, d2)]\nMax: [ .5 * max(d1, d2), .5 * h, .5 * max(d1, d2)]",
[CmdArg("float", "h"), CmdArg("float", "d10"), CmdArg("float", "d20"), CmdArg("float", "d1"), CmdArg("float", "d2"), CmdArg("float", "d12"), CmdArg("float", "d22"),
CmdArg("float", "sidemul", "1.0"), CmdArg("bool", "offset", "false")]);
[CmdArg("float", "h"), CmdArg("vec2", "d10d20"), CmdArg("vec2", "d11d21"), CmdArg("vec2", "d12d22"),
CmdArg("float", "sidemul", "0.0"), CmdArg("bool", "offset", "false")]);

Ladataan…
Peruuta
Tallenna