| @@ -49,7 +49,7 @@ | |||||
| %token T_TRANSLATEX T_ROTATEX T_TAPERX T_TWISTX T_SHEARX T_STRETCHX T_BENDXY T_BENDXZ T_SCALEX T_MIRRORX | %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_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_TRANSLATEZ T_ROTATEZ T_TAPERZ T_TWISTZ T_SHEARZ T_STRETCHZ T_BENDZX T_BENDZY T_SCALEZ T_MIRRORZ | ||||
| %token T_TRANSLATE T_SCALE T_TOGGLESCALEWINDING T_RADIALJITTER T_SPLITTRIANGLE T_SMOOTHMESH | |||||
| %token T_TRANSLATE T_ROTATE T_SCALE T_TOGGLESCALEWINDING T_RADIALJITTER T_SPLITTRIANGLE T_SMOOTHMESH | |||||
| %token T_CSGUNION T_CSGSUBSTRACT T_CSGSUBSTRACTLOSS T_CSGAND T_CSGXOR | %token T_CSGUNION T_CSGSUBSTRACT T_CSGSUBSTRACTLOSS T_CSGAND T_CSGXOR | ||||
| %token T_CHAMFER | %token T_CHAMFER | ||||
| @@ -101,14 +101,6 @@ mesh_expression: | |||||
| | mesh_open mesh_expression_list mesh_close | | mesh_open mesh_expression_list mesh_close | ||||
| ; | ; | ||||
| mesh_open: | |||||
| '[' { mc.m_mesh.OpenBrace(); } | |||||
| ; | |||||
| mesh_close: | |||||
| ']' { mc.m_mesh.CloseBrace(); } | |||||
| ; | |||||
| mesh_command_list: | mesh_command_list: | ||||
| mesh_command | mesh_command | ||||
| | mesh_command_list mesh_command | | mesh_command_list mesh_command | ||||
| @@ -118,6 +110,23 @@ mesh_command: | |||||
| color_command | color_command | ||||
| | transform_command | | transform_command | ||||
| | primitive_command | | primitive_command | ||||
| | csg_command | |||||
| ; | |||||
| csg_command: | |||||
| 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(); } | |||||
| ; | |||||
| mesh_open: | |||||
| '[' { mc.m_mesh.OpenBrace(); } | |||||
| ; | |||||
| mesh_close: | |||||
| ']' { mc.m_mesh.CloseBrace(); } | |||||
| ; | ; | ||||
| color_command: | color_command: | ||||
| @@ -126,16 +135,15 @@ color_command: | |||||
| | T_COLOR COLOR { uint32_t x = $2; | | T_COLOR COLOR { uint32_t x = $2; | ||||
| ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); | ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); | ||||
| mc.m_mesh.SetCurColor(vec4(v) * (1.f / 255.f)); } | 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; | |||||
| | 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_BCOLOR COLOR { uint32_t x = $2; | |||||
| ivec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); | 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.SetCurColor2(vec4(v) * (1.f / 255.f)); } | ||||
| ; | ; | ||||
| transform_command: | transform_command: | ||||
| T_CHAMFER fv { mc.m_mesh.Chamfer($2); } | |||||
| | T_TRANSLATEX fv { mc.m_mesh.Translate(vec3($2, 0.f, 0.f)); } | |||||
| 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_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_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 fv fv fv { mc.m_mesh.Translate(vec3($2, $3, $4)); } | ||||
| @@ -143,6 +151,9 @@ transform_command: | |||||
| | T_ROTATEX fv { mc.m_mesh.RotateX($2); } | | T_ROTATEX fv { mc.m_mesh.RotateX($2); } | ||||
| | T_ROTATEY fv { mc.m_mesh.RotateY($2); } | | T_ROTATEY fv { mc.m_mesh.RotateY($2); } | ||||
| | T_ROTATEZ fv { mc.m_mesh.RotateZ($2); } | | T_ROTATEZ fv { mc.m_mesh.RotateZ($2); } | ||||
| | T_ROTATE fv fv fv fv { mc.m_mesh.RotateZ($2, vec3($3, $4, $5)); } | |||||
| | T_ROTATE fv vec3 { mc.m_mesh.RotateZ($2, vec3($3[0], $3[1], $3[2])); } | |||||
| | T_RADIALJITTER fv { mc.m_mesh.RadialJitter($2); } | |||||
| | T_TAPERX fv fv fv bv { mc.m_mesh.TaperX($2, $3, $4, $5); } | | 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 fv { mc.m_mesh.TaperX($2, $3, $4); } | ||||
| | T_TAPERX fv fv { mc.m_mesh.TaperX($2, $3); } | | T_TAPERX fv fv { mc.m_mesh.TaperX($2, $3); } | ||||
| @@ -194,15 +205,10 @@ transform_command: | |||||
| | T_MIRRORX { mc.m_mesh.MirrorX(); } | | T_MIRRORX { mc.m_mesh.MirrorX(); } | ||||
| | T_MIRRORY { mc.m_mesh.MirrorY(); } | | T_MIRRORY { mc.m_mesh.MirrorY(); } | ||||
| | T_MIRRORZ { mc.m_mesh.MirrorZ(); } | | T_MIRRORZ { mc.m_mesh.MirrorZ(); } | ||||
| | T_RADIALJITTER fv { mc.m_mesh.RadialJitter($2); } | |||||
| | T_CHAMFER fv { mc.m_mesh.Chamfer($2); } | |||||
| | T_SPLITTRIANGLE iv { mc.m_mesh.SplitTriangles($2); } | | T_SPLITTRIANGLE iv { mc.m_mesh.SplitTriangles($2); } | ||||
| | T_SMOOTHMESH iv iv iv { mc.m_mesh.SmoothMesh($2, $3, $4); } | | T_SMOOTHMESH iv iv iv { mc.m_mesh.SmoothMesh($2, $3, $4); } | ||||
| | T_TOGGLESCALEWINDING { mc.m_mesh.ToggleScaleWinding(); } | | 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: | primitive_command: | ||||
| @@ -210,6 +216,9 @@ primitive_command: | |||||
| | 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 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 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_CYLINDER iv fv fv fv { mc.m_mesh.AppendCylinder($2, $3, $4, $5); } | ||||
| | 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_BOX fv fv fv fv { mc.m_mesh.AppendBox(vec3($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 fv fv { mc.m_mesh.AppendBox(vec3($2, $3, $4)); } | ||||
| | T_BOX fv { mc.m_mesh.AppendBox(vec3($2, $2, $2)); } | | T_BOX fv { mc.m_mesh.AppendBox(vec3($2, $2, $2)); } | ||||
| @@ -221,14 +230,12 @@ primitive_command: | |||||
| | T_FLATCHAMFBOX fv fv fv fv { mc.m_mesh.AppendFlatChamfBox(vec3($2, $3, $4), $5); } | | 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 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_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 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 bv { mc.m_mesh.AppendStar($2, $3, $4, $5); } | ||||
| | T_STAR iv fv fv { mc.m_mesh.AppendStar($2, $3, $4); } | | 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 fv { mc.m_mesh.AppendExpandedStar($2, $3, $4, $5); } | ||||
| | T_EXPANDEDSTAR iv fv fv { mc.m_mesh.AppendExpandedStar($2, $3, $4); } | | 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 bv { mc.m_mesh.AppendDisc($2, $3, $4); } | ||||
| | T_DISC iv fv { mc.m_mesh.AppendDisc($2, $3); } | | T_DISC iv fv { mc.m_mesh.AppendDisc($2, $3); } | ||||
| | T_TRIANGLE fv bv { mc.m_mesh.AppendSimpleTriangle($2, $3); } | | T_TRIANGLE fv bv { mc.m_mesh.AppendSimpleTriangle($2, $3); } | ||||
| @@ -47,10 +47,16 @@ typedef lol::EasyMeshParser::token_type token_type; | |||||
| yylloc->step(); | yylloc->step(); | ||||
| %} | %} | ||||
| (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; } | |||||
| (tsw|scalewinding) { return token::T_TOGGLESCALEWINDING; } | |||||
| (sc|setcolor) { return token::T_COLOR; } | (sc|setcolor) { return token::T_COLOR; } | ||||
| (scb|setbgcolor) { return token::T_BGCOLOR; } | |||||
| (scb|setbcolor) { return token::T_BCOLOR; } | |||||
| (ch|chamfer) { return token::T_CHAMFER; } | |||||
| (tx|translatex) { return token::T_TRANSLATEX; } | (tx|translatex) { return token::T_TRANSLATEX; } | ||||
| (ty|translatey) { return token::T_TRANSLATEY; } | (ty|translatey) { return token::T_TRANSLATEY; } | ||||
| (tz|translatez) { return token::T_TRANSLATEZ; } | (tz|translatez) { return token::T_TRANSLATEZ; } | ||||
| @@ -58,6 +64,8 @@ typedef lol::EasyMeshParser::token_type token_type; | |||||
| (rx|rotatex) { return token::T_ROTATEX; } | (rx|rotatex) { return token::T_ROTATEX; } | ||||
| (ry|rotatey) { return token::T_ROTATEY; } | (ry|rotatey) { return token::T_ROTATEY; } | ||||
| (rz|rotatez) { return token::T_ROTATEZ; } | (rz|rotatez) { return token::T_ROTATEZ; } | ||||
| (r|rotate) { return token::T_ROTATE; } | |||||
| (rj|radialjitter) { return token::T_RADIALJITTER; } | |||||
| (tax|taperx) { return token::T_TAPERX; } | (tax|taperx) { return token::T_TAPERX; } | ||||
| (tay|tapery) { return token::T_TAPERY; } | (tay|tapery) { return token::T_TAPERY; } | ||||
| (taz|taperz) { return token::T_TAPERZ; } | (taz|taperz) { return token::T_TAPERZ; } | ||||
| @@ -80,33 +88,26 @@ typedef lol::EasyMeshParser::token_type token_type; | |||||
| (sy|scaley) { return token::T_SCALEY; } | (sy|scaley) { return token::T_SCALEY; } | ||||
| (sz|scalez) { return token::T_SCALEZ; } | (sz|scalez) { return token::T_SCALEZ; } | ||||
| (s|scale) { return token::T_SCALE; } | (s|scale) { return token::T_SCALE; } | ||||
| (tsw|scalewinding) { return token::T_TOGGLESCALEWINDING; } | |||||
| (mx|mirrorx) { return token::T_MIRRORX; } | (mx|mirrorx) { return token::T_MIRRORX; } | ||||
| (my|mirrory) { return token::T_MIRRORY; } | (my|mirrory) { return token::T_MIRRORY; } | ||||
| (mz|mirrorz) { return token::T_MIRRORZ; } | (mz|mirrorz) { return token::T_MIRRORZ; } | ||||
| (rj|radialjitter) { return token::T_RADIALJITTER; } | |||||
| (ch|chamfer) { return token::T_CHAMFER; } | |||||
| (splt|splittriangle) { return token::T_SPLITTRIANGLE; } | (splt|splittriangle) { return token::T_SPLITTRIANGLE; } | ||||
| (smth|smooth) { return token::T_SMOOTHMESH; } | (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; } | (ac|addcylinder) { return token::T_CYLINDER; } | ||||
| (asph|addsphere) { return token::T_SPHERE; } | |||||
| (acap|addcapsule) { return token::T_CAPSULE; } | (acap|addcapsule) { return token::T_CAPSULE; } | ||||
| (acg|addcog) { return token::T_COG; } | |||||
| (ad|adddisc) { return token::T_DISC; } | |||||
| (aes|addexpandedstar) { return token::T_EXPANDEDSTAR; } | |||||
| (ato|addtorus) { return token::T_TORUS; } | |||||
| (ab|addbox) { return token::T_BOX; } | |||||
| (ascb|addsmoothchamfbox) { return token::T_SMOOTHCHAMFBOX; } | |||||
| (afcb|addflatchamfbox) { return token::T_FLATCHAMFBOX; } | (afcb|addflatchamfbox) { return token::T_FLATCHAMFBOX; } | ||||
| (aq|addquad) { return token::T_QUAD; } | |||||
| (as|addstar) { return token::T_STAR; } | (as|addstar) { return token::T_STAR; } | ||||
| (ascb|addsmoothchamfbox) { return token::T_SMOOTHCHAMFBOX; } | |||||
| (asph|adsphere) { return token::T_SPHERE; } | |||||
| (aes|addexpandedstar) { return token::T_EXPANDEDSTAR; } | |||||
| (ad|adddisc) { return token::T_DISC; } | |||||
| (at|addtriangle) { return token::T_TRIANGLE; } | (at|addtriangle) { return token::T_TRIANGLE; } | ||||
| (ato|addtorus) { return token::T_TORUS; } | |||||
| (aq|addquad) { return token::T_QUAD; } | |||||
| (acg|addcog) { return token::T_COG; } | |||||
| %{ /* ======= BASE DATA TYPES ========================================= */ %} | %{ /* ======= BASE DATA TYPES ========================================= */ %} | ||||
| %{ /* COLOR */ %} | %{ /* COLOR */ %} | ||||
| @@ -558,22 +558,25 @@ public: | |||||
| /* [cmd:csgx] Performs a Xor operation as (m0_Outside/m0_Inside-inverted + m1_Outside/m1_Inside-inverted) */ | /* [cmd:csgx] Performs a Xor operation as (m0_Outside/m0_Inside-inverted + m1_Outside/m1_Inside-inverted) */ | ||||
| void CsgXor() { MeshCsg(CSGUsage::Xor); } | void CsgXor() { MeshCsg(CSGUsage::Xor); } | ||||
| //------------------------------------------------------------------------- | |||||
| //Mesh Base operations | |||||
| //------------------------------------------------------------------------- | |||||
| public: | public: | ||||
| /* [cmd:[] from this point onward, any operation will not be performed on previous vertices */ | /* [cmd:[] from this point onward, any operation will not be performed on previous vertices */ | ||||
| void OpenBrace(); | void OpenBrace(); | ||||
| /* [cmd:]] Merge current vertices with previous context */ | /* [cmd:]] Merge current vertices with previous context */ | ||||
| void CloseBrace(); | void CloseBrace(); | ||||
| /* [cmd:tsw] When activation, on negative-scaling, normal fixing will not occur */ | |||||
| /* [cmd:tsw] When activated, on negative-scaling, normal-vector correction will not occur */ | |||||
| void ToggleScaleWinding(); | void ToggleScaleWinding(); | ||||
| /* [cmd:sc] Set vertices color */ | |||||
| /* [cmd:sc] Set base color */ | |||||
| void SetCurColor(vec4 const &color); | void SetCurColor(vec4 const &color); | ||||
| /* [cmd:scb] Set vertices color 2 */ | |||||
| /* [cmd:scb] Set base color 2 */ | |||||
| void SetCurColor2(vec4 const &color); | void SetCurColor2(vec4 const &color); | ||||
| private: | |||||
| //------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
| //Internal : Basic triangle/vertex operations | //Internal : Basic triangle/vertex operations | ||||
| //------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
| private: | |||||
| void AddVertex(vec3 const &coord); | void AddVertex(vec3 const &coord); | ||||
| void AddDuplicateVertex(int i); | void AddDuplicateVertex(int i); | ||||
| void AddLerpVertex(int i, int j, float alpha); | void AddLerpVertex(int i, int j, float alpha); | ||||
| @@ -586,8 +589,9 @@ public: //DEBUG | |||||
| void ComputeTexCoord(float uv_scale, int uv_offset); | void ComputeTexCoord(float uv_scale, int uv_offset); | ||||
| //------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
| //Vertices operations | |||||
| //Internal : Vertices operations | |||||
| //------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
| private: | |||||
| void SetVertColor(vec4 const &color); | void SetVertColor(vec4 const &color); | ||||
| void SetTexCoordData(vec2 const &new_offset, vec2 const &new_scale); | void SetTexCoordData(vec2 const &new_offset, vec2 const &new_scale); | ||||
| void SetTexCoordData2(vec2 const &new_offset, vec2 const &new_scale); | void SetTexCoordData2(vec2 const &new_offset, vec2 const &new_scale); | ||||
| @@ -617,11 +621,11 @@ public: | |||||
| - axis : rotation axis. | - axis : rotation axis. | ||||
| */ | */ | ||||
| void Rotate(float angle, vec3 const &axis); | void Rotate(float angle, vec3 const &axis); | ||||
| /* [cmd:rj] Randomly move vertices along Origin-to-vertex as o2v *= (1.0 + rand(r)) | |||||
| /* [cmd:rj] Randomly move vertices along Origin-to-vertex as f(vtx) = vtx + o2v * (1.0 + rand(r)) | |||||
| - r : jitter maximum value. | - r : jitter maximum value. | ||||
| */ | */ | ||||
| void RadialJitter(float r); | void RadialJitter(float r); | ||||
| /* [cmd:tax] multiply axis y&z by x as y *= (1.0 + (ny * x + xoff)) | |||||
| /* [cmd:tax] multiply axis y&z by x as f(y) = y * (1.0 + (ny * x + xoff)) | |||||
| - ny : value of n for y. | - ny : value of n for y. | ||||
| - nz : value of n for z. | - nz : value of n for z. | ||||
| - xoff : value of xoff. | - xoff : value of xoff. | ||||
| @@ -632,7 +636,7 @@ public: | |||||
| void TaperY(float nx, float nz, float yoff=0.f, bool absolute=true); | void TaperY(float nx, float nz, float yoff=0.f, bool absolute=true); | ||||
| /* [cmd:taz] Same as TaperX, with Z */ | /* [cmd:taz] Same as TaperX, with Z */ | ||||
| void TaperZ(float nx, float ny, float zoff=0.f, bool absolute=true); | 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) | |||||
| /* [cmd:twx] Twist vertices around x axis with x as rotation value as f(p) = (RotateX(x * t + toff) * p) | |||||
| - t : Angle multiplier. | - t : Angle multiplier. | ||||
| - toff : Applied offset. | - toff : Applied offset. | ||||
| */ | */ | ||||
| @@ -641,7 +645,7 @@ public: | |||||
| void TwistY(float t, float toff=0.f); | void TwistY(float t, float toff=0.f); | ||||
| /* [cmd:twz] Same as TwistX, with Z */ | /* [cmd:twz] Same as TwistX, with Z */ | ||||
| void TwistZ(float t, float toff=0.f); | void TwistZ(float t, float toff=0.f); | ||||
| /* [cmd:shx] Shear vertices using x value as shear quantity as y += (ny * x + xoff) | |||||
| /* [cmd:shx] Shear vertices using x value as shear quantity as f(y) = y + (ny * x + xoff) | |||||
| - ny : Value of n for y. | - ny : Value of n for y. | ||||
| - nz : Value of n for z. | - nz : Value of n for z. | ||||
| - xoff : Value of xoff. | - xoff : Value of xoff. | ||||
| @@ -652,7 +656,7 @@ public: | |||||
| void ShearY(float nx, float nz, float yoff=0.f, bool absolute=true); | void ShearY(float nx, float nz, float yoff=0.f, bool absolute=true); | ||||
| /* [cmd:shz] Same as ShearX, with Z */ | /* [cmd:shz] Same as ShearX, with Z */ | ||||
| void ShearZ(float nx, float ny, float zoff=0.f, bool absolute=true); | 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) | |||||
| /* [cmd:stx] Stretch vertices using x value as stretch quantity as f(y) = y + (pow(x, ny) + xoff) | |||||
| - ny : Value of n for y. | - ny : Value of n for y. | ||||
| - nz : Value of n for z. | - nz : Value of n for z. | ||||
| - xoff : Value of xoff. | - xoff : Value of xoff. | ||||
| @@ -662,7 +666,7 @@ public: | |||||
| void StretchY(float nx, float nz, float yoff=0.f); | void StretchY(float nx, float nz, float yoff=0.f); | ||||
| /* [cmd:stz] Same as StretchX, with Z */ | /* [cmd:stz] Same as StretchX, with Z */ | ||||
| void StretchZ(float nx, float ny, float zoff=0.f); | 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) | |||||
| /* [cmd:bdxy] Bend vertices using x as bend quantity along y axis using f(p) = (RotateY(x * t + toff) * p) | |||||
| - t : Angle multiplier. | - t : Angle multiplier. | ||||
| - xoff : Applied offset. | - xoff : Applied offset. | ||||
| */ | */ | ||||
| @@ -716,11 +720,11 @@ public: | |||||
| Acts as an OpenBrace | Acts as an OpenBrace | ||||
| */ | */ | ||||
| void DupAndScale(vec3 const &s); | void DupAndScale(vec3 const &s); | ||||
| /* [cmd:ch] Performs a chamfer operation //TODO : Make it work. | |||||
| /* [cmd:ch] Performs a chamfer operation //TODO : Make it work | |||||
| - f : Chamfer quantity. | - f : Chamfer quantity. | ||||
| */ | */ | ||||
| void Chamfer(float f); | void Chamfer(float f); | ||||
| /* [cmd:splt] split triangles in 4 smaller ones. | |||||
| /* [cmd:splt] split triangles in 4 smaller ones | |||||
| - pass : Number of pass applied. | - pass : Number of pass applied. | ||||
| */ | */ | ||||
| void SplitTriangles(int pass); | void SplitTriangles(int pass); | ||||
| @@ -728,11 +732,11 @@ private: | |||||
| void SplitTriangles(int pass, VertexDictionnary *vert_dict); | void SplitTriangles(int pass, VertexDictionnary *vert_dict); | ||||
| public: | public: | ||||
| /* [cmd:smth] Smooth the mesh by subdivising it. | /* [cmd:smth] Smooth the mesh by subdivising it. | ||||
| - main_pass : a main pass is made of (n0 split then n1 smooth) repeat. | |||||
| - split_per_main_pass : n0 value in above explanation. | |||||
| - smooth_per_main_pass : n1 value in above explanation. | |||||
| - pass : a pass is made of (n0 split then n1 smooth) repeat. | |||||
| - split_per_pass : n0 value in above explanation. | |||||
| - smooth_per_pass : n1 value in above explanation. | |||||
| */ | */ | ||||
| void SmoothMesh(int main_pass, int split_per_main_pass, int smooth_per_main_pass); | |||||
| void SmoothMesh(int pass, int split_per_pass, int smooth_per_pass); | |||||
| //------------------------------------------------------------------------- | //------------------------------------------------------------------------- | ||||
| //Mesh shape operations | //Mesh shape operations | ||||
| @@ -769,7 +773,6 @@ public: | |||||
| /* [cmd:ab] Box centered on (0,0,0) with BBox [-.5 * size][.5 * size] | /* [cmd:ab] Box centered on (0,0,0) with BBox [-.5 * size][.5 * size] | ||||
| - size : size of the box. | - size : size of the box. | ||||
| - chamf : size of the chamfer. | - chamf : size of the chamfer. | ||||
| - 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 | //Same as AppendBox | ||||
| @@ -0,0 +1,91 @@ | |||||
| //------------------------------------------------------------------------- | |||||
| //Command vars operations | |||||
| //------------------------------------------------------------------------- | |||||
| CmdVar("float", ["Fraction value", "0.0"]); | |||||
| CmdVar("int", ["No decimal value", "0"]); | |||||
| CmdVar("bool", ["Boolean value", "true/false", "1/0"]); | |||||
| CmdVar("color", ["Red/Green/Blue/{Alpha}", | |||||
| "HEXA: #ABC{D}", " #AABBCC{DD}", | |||||
| "FLOAT: f f f f", " (f f f f)", " (f)"]); | |||||
| CmdVar("vec3", ["X/Y/Z as float", " f f f", "(f f f)", "(f)"]); | |||||
| //------------------------------------------------------------------------- | |||||
| //Mesh CSG operations | |||||
| //------------------------------------------------------------------------- | |||||
| CmdType(["csgu", "csgunion"], "Performs a Union operation as (mesh0_Outside + mesh1_Outside)"); | |||||
| CmdType(["csgs", "csgsubstract"], "Performs a Substract operation as (mesh0_Outside + mesh1_Inside-inverted)"); | |||||
| CmdType(["csgsl", "csgsubstractloss"], "Performs a Substract operation without keeping the mesh1 part"); | |||||
| CmdType(["csga", "csgand"], "Performs an And operation as (mesh0_Inside + mesh1_Inside)"); | |||||
| CmdType(["csgx", "csgxor"], "Performs a Xor operation as (m0_Outside/m0_Inside-inverted + m1_Outside/m1_Inside-inverted)"); | |||||
| //------------------------------------------------------------------------- | |||||
| //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(["scb", "setbgcolor"], "Set B color", [CmdArg("color", "color")]); | |||||
| //------------------------------------------------------------------------- | |||||
| //Mesh transform operations | |||||
| //------------------------------------------------------------------------- | |||||
| CmdType(["tx", "translatex"], "Translate vertices along the X axis", [CmdArg("float", "n")]); | |||||
| CmdType(["ty", "translatey"], "Translate vertices along the Y axis", [CmdArg("float", "n")]); | |||||
| CmdType(["tz", "translatez"], "Translate vertices along the Z axis", [CmdArg("float", "n")]); | |||||
| CmdType(["t", "translate"], "Translate vertices", [CmdArg("vec3", "v")]); | |||||
| CmdType(["rx", "rotatex"], "Rotate vertices along the X axis", [CmdArg("float", "degree")]); | |||||
| CmdType(["ry", "rotatey"], "Rotate vertices along the Y axis", [CmdArg("float", "degree")]); | |||||
| CmdType(["rz", "rotatez"], "Rotate vertices along the Z axis", [CmdArg("float", "degree")]); | |||||
| CmdType(["r", "rotate"], "Rotate vertices along the given axis", [CmdArg("float", "degree"), CmdArg("vec3", "axis")]); | |||||
| CmdType(["rj", "radialjitter"], "Randomly move vertices along Origin-to-vertex as f(vtx) = vtx + o2v * (1.0 + rand(r))", [CmdArg("float", "r")]); | |||||
| CmdType(["tax", "taperx"], "multiply axis y/z by f(x)\nf(z) = z * (1.0 + (nz * f(x) + xoff))\nf(x) = absolute ? abs_x : x", [CmdArg("float", "ny"), CmdArg("float", "nz"), CmdArg("float", "xoff", "0.0"), CmdArg("bool", "absolute", "true")]); | |||||
| CmdType(["tay", "tapery"], "multiply axis x/z by f(y)\nf(x) = x * (1.0 + (nx * f(y) + yoff))\nf(y) = absolute ? abs_y : y", [CmdArg("float", "nx"), CmdArg("float", "nz"), CmdArg("float", "yoff", "0.0"), CmdArg("bool", "absolute", "true")]); | |||||
| CmdType(["taz", "taperz"], "multiply axis x/y by f(z)\nf(y) = y * (1.0 + (ny * f(z) + zoff))\nf(z) = absolute ? abs_z : z", [CmdArg("float", "nx"), CmdArg("float", "ny"), CmdArg("float", "zoff", "0.0"), CmdArg("bool", "absolute", "true")]); | |||||
| CmdType(["twx", "twistx"], "Twist vertices around x axis with x as rotation value\nf(p) = (RotateX(x * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["twy", "twisty"], "Twist vertices around y axis with y as rotation value\nf(p) = (RotateY(y * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["twz", "twistz"], "Twist vertices around z axis with z as rotation value\nf(p) = (RotateZ(z * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["shx", "shearx"], "Shear vertices using x value as shear quantity\nf(z) = z + (nz * f(x) + xoff)\nf(x) = absolute ? abs_x : x", [CmdArg("float", "ny"), CmdArg("float", "nz"), CmdArg("float", "xoff", "0.0"), CmdArg("bool", "absolute", "true")]); | |||||
| CmdType(["shy", "sheary"], "Shear vertices using y value as shear quantity\nf(x) = x + (nx * f(y) + yoff)\nf(y) = absolute ? abs_y : y", [CmdArg("float", "nx"), CmdArg("float", "nz"), CmdArg("float", "yoff", "0.0"), CmdArg("bool", "absolute", "true")]); | |||||
| CmdType(["shz", "shearz"], "Shear vertices using z value as shear quantity\nf(y) = y + (ny * f(z) + zoff)\nf(z) = absolute ? abs_z : z", [CmdArg("float", "nx"), CmdArg("float", "ny"), CmdArg("float", "zoff", "0.0"), CmdArg("bool", "absolute", "true")]); | |||||
| CmdType(["stx", "stretchx"], "Stretch vertices using x value as stretch quantity\nf(z) = z + (pow(x, nz) + xoff)", [CmdArg("float", "ny"), CmdArg("float", "nz"), CmdArg("float", "xoff", "0.0")]); | |||||
| CmdType(["sty", "stretchy"], "Stretch vertices using y value as stretch quantity\nf(x) = x + (pow(y, nx) + yoff)", [CmdArg("float", "nx"), CmdArg("float", "nz"), CmdArg("float", "yoff", "0.0")]); | |||||
| CmdType(["stz", "stretchz"], "Stretch vertices using z value as stretch quantity\nf(y) = y + (pow(z, ny) + zoff)", [CmdArg("float", "nx"), CmdArg("float", "ny"), CmdArg("float", "zoff", "0.0")]); | |||||
| CmdType(["bdxy", "bendxy"], "Bend vertices using x as bend quantity along y axis\nf(p) = (RotateY(x * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["bdxz", "bendxz"], "Bend vertices using x as bend quantity along z axis\nf(p) = (RotateZ(x * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["bdyx", "bendyx"], "Bend vertices using y as bend quantity along x axis\nf(p) = (RotateX(y * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["bdyz", "bendyz"], "Bend vertices using y as bend quantity along z axis\nf(p) = (RotateZ(y * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["bdzx", "bendzx"], "Bend vertices using z as bend quantity along x axis\nf(p) = (RotateX(z * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["bdzy", "bendzy"], "Bend vertices using z as bend quantity along y axis\nf(p) = (RotateY(z * t + toff) * p)", [CmdArg("float", "t"), CmdArg("float", "toff", "0.0")]); | |||||
| CmdType(["sx", "scalex"], "Scale vertices", [CmdArg("vec3", "s")]); | |||||
| CmdType(["sy", "scaley"], "Scale vertices", [CmdArg("vec3", "s")]); | |||||
| CmdType(["sz", "scalez"], "Scale vertices", [CmdArg("vec3", "s")]); | |||||
| CmdType(["s", "scale"], "Uniformly Scale vertices", [CmdArg("float", "s")]); | |||||
| CmdType(["mx", "mirrorx"], "Mirror vertices through X-plane"); | |||||
| CmdType(["my", "mirrory"], "Mirror vertices through Y-plane"); | |||||
| CmdType(["mz", "mirrorz"], "Mirror vertices through Z-plane"); | |||||
| CmdType(["ch", "chamfer"], "DOES NOT WORK: Performs a chamfer operation", [CmdArg("float", "f")]); | |||||
| CmdType(["splt", "splittriangle"], "split triangles in 4 smaller ones", [CmdArg("int", "pass")]); | |||||
| CmdType(["smth", "smooth"], "Smooth the mesh by subdivising it", [CmdArg("int", "pass"), CmdArg("int", "split_per_pass"), CmdArg("int", "smooth_per_pass")]); | |||||
| //------------------------------------------------------------------------- | |||||
| //Mesh shape operations | |||||
| //------------------------------------------------------------------------- | |||||
| CmdType(["ac", "addcylinder"], "Cylinder 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("int", "nsides"), CmdArg("float", "h"), CmdArg("float", "d1"), CmdArg("float", "d2"), | |||||
| CmdArg("bool", "dualsides", "false"), CmdArg("bool", "smooth", "false"), CmdArg("bool", "close", "false")]); | |||||
| CmdType(["asph", "addsphere"], "Sphere centered on (0,0,0) with BBox:\nMin: [-.5 * d]\nMax: [ .5 * d]", [CmdArg("int", "ndivisions"), CmdArg("float", "d")]); | |||||
| CmdType(["acap", "addcapsule"], "Capsule centered on (0,0,0) with BBox:\nMin: [-.5 * d,-(.5 * d + h),-.5 * d]\nMax: [ .5 * d, (.5 * d + h), .5 * d]", [CmdArg("int", "ndivisions"), CmdArg("float", "h"), CmdArg("float", "d")]); | |||||
| CmdType(["ato", "addtorus"], "Torus centered on (0,0,0) with BBox:\nMax: [-.5 * d2]\nMax: [ .5 * d2]", [CmdArg("int", "ndivisions"), CmdArg("float", "d1"), CmdArg("float", "d2")]); | |||||
| CmdType(["ab", "addbox"], "Box centered on (0,0,0) with BBox:\nMin: [-.5 * size]\nMax: [ .5 * size]", [CmdArg("vec3", "size"), CmdArg("float", "chamf", "0.0")]); | |||||
| CmdType(["ascb", "addsmoothchamfbox"], "Box centered on (0,0,0) with BBox:\nMin: [-.5 * size]\nMax: [ .5 * size]", [CmdArg("vec3", "size"), CmdArg("float", "chamf")]); | |||||
| CmdType(["afcb", "addflatchamfbox"], "Box centered on (0,0,0) with BBox:\nMin: [-.5 * size]\nMax: [ .5 * size]", [CmdArg("vec3", "size"), CmdArg("float", "chamf")]); | |||||
| CmdType(["as", "addstar"], "Append a Star centered on (0,0,0)\nContained in a disc of max(d1, d2) diameter.", | |||||
| [CmdArg("int", "nbranches"), CmdArg("float", "d1"), CmdArg("float", "d2"), | |||||
| CmdArg("bool", "fade", "false"), CmdArg("bool", "fade2", "false")]); | |||||
| CmdType(["aes", "addexpandedstar"], "Star centered on (0,0,0)\nContained in a disc of max(max(d1, d2), max(d1 + extrad, d2 + extrad)) diameter.\nExpanded star branches use Color2.", | |||||
| [CmdArg("int", "nbranches"), CmdArg("float", "d1"), CmdArg("float", "d2"), CmdArg("float", "extrad", "0.0")]); | |||||
| CmdType(["ad", "adddisc"], "Disc centered on (0,0,0) with d diameter.", [CmdArg("int", "nsides"), CmdArg("float", "d"), CmdArg("bool", "fade", "false")]); | |||||
| 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")]); | |||||
| @@ -0,0 +1,158 @@ | |||||
| function TypeDictionnary(m_name) | |||||
| { | |||||
| this.m_name = m_name; | |||||
| this.m_cmds = new Array(); | |||||
| this.m_vars = new Array(); | |||||
| } | |||||
| //----------------------------------------------------------------------------- | |||||
| //Command Var object | |||||
| //----------------------------------------------------------------------------- | |||||
| function CmdVarObj() { } | |||||
| function CmdVar(m_type, m_syntax) | |||||
| { | |||||
| var current_mesh_dict = GetCmdDictionnary(); | |||||
| new_obj = new CmdVarObj(); | |||||
| new_obj.m_type = m_type; | |||||
| new_obj.m_syntax = m_syntax; | |||||
| new_obj.ToString = function() | |||||
| { | |||||
| var res = m_type + ' '; | |||||
| if (m_syntax != undefined) | |||||
| for (var i = 0; i < m_syntax.length; i++) | |||||
| res += m_syntax[i] + ' '; | |||||
| } | |||||
| current_mesh_dict.m_vars[current_mesh_dict.m_vars.length] = new_obj; | |||||
| } | |||||
| //----------------------------------------------------------------------------- | |||||
| //Command Argument object | |||||
| //----------------------------------------------------------------------------- | |||||
| function CmdArgObj() { } | |||||
| function CmdArg(m_type, m_name, m_optional) | |||||
| { | |||||
| new_obj = new CmdArgObj(); | |||||
| new_obj.m_type = m_type; | |||||
| new_obj.m_name = m_name; | |||||
| new_obj.m_optional = m_optional; | |||||
| new_obj.ToString = function() | |||||
| { | |||||
| if (m_optional != undefined) | |||||
| return m_type + ' ' + m_name + ' = ' + m_optional; | |||||
| return m_type + ' ' + m_name; | |||||
| } | |||||
| return new_obj; | |||||
| } | |||||
| //----------------------------------------------------------------------------- | |||||
| //Command Typing object | |||||
| //----------------------------------------------------------------------------- | |||||
| function CmdTypeObj() { } | |||||
| function CmdType(m_name, m_comment, m_arg) | |||||
| { | |||||
| var current_mesh_dict = GetCmdDictionnary(); | |||||
| new_obj = new CmdTypeObj(); | |||||
| new_obj.m_name = m_name; | |||||
| new_obj.m_comment = m_comment; | |||||
| new_obj.m_arg = m_arg; | |||||
| new_obj.ToString = function() | |||||
| { | |||||
| var str = m_name.toString() + ' [' + m_comment + ']'; | |||||
| if (m_arg != undefined) | |||||
| { | |||||
| str += '{'; | |||||
| var found_optional = false; | |||||
| for (var vi = 0; vi < m_arg.length; vi++) | |||||
| { | |||||
| if (m_arg[vi].m_optional != undefined && found_optional == false) | |||||
| { | |||||
| str += ' ['; | |||||
| found_optional = true; | |||||
| } | |||||
| if (vi != 0) | |||||
| str += ', '; | |||||
| str += m_arg[vi].ToString(); | |||||
| } | |||||
| if (found_optional == true) | |||||
| str += ']'; | |||||
| str += '}'; | |||||
| } | |||||
| return str; | |||||
| } | |||||
| new_obj.CheckCommand = function(check_name) | |||||
| { | |||||
| if (m_name != undefined && check_name.length > 0) | |||||
| { | |||||
| for (var i = 0; i < m_name.length; i++) | |||||
| { | |||||
| if (m_name[i] != undefined) | |||||
| { | |||||
| var pattern = new RegExp("^[ ]*" + check_name + "[a-z]*"); | |||||
| if (pattern.test(m_name[i])) | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| current_mesh_dict.m_cmds[current_mesh_dict.m_cmds.length] = new_obj; | |||||
| } | |||||
| //----------------------------------------------------------------------------- | |||||
| //Tries to find a matching command in the dictionnary based on the current cursor location in the given TextArea. | |||||
| //----------------------------------------------------------------------------- | |||||
| function FindMatchingCommand(src_text_area) | |||||
| { | |||||
| if (src_text_area != undefined) | |||||
| { | |||||
| var current_mesh_dict = GetCmdDictionnary(); | |||||
| var found_match = ""; | |||||
| var check = true; | |||||
| var cursor = Math.min(src_text_area.selectionStart, src_text_area.value.length - 1); | |||||
| //Weird test to ensure we don't start searching on the next line or on the next word. | |||||
| if (!src_text_area.value[cursor].match(/^[ \n]$/)) | |||||
| cursor++; | |||||
| cursor = Math.min(cursor, src_text_area.value.length - 1); | |||||
| var o = 0; | |||||
| while (check && o < 10) | |||||
| { | |||||
| //Move backward to find the first letter on this line | |||||
| for (; cursor > 0; cursor--) | |||||
| if (src_text_area.value[cursor].match(/^[a-z\n]+$/)) | |||||
| break; | |||||
| //Move backward to find the start of the command | |||||
| for (; cursor > 0; cursor--) | |||||
| if (!src_text_area.value[cursor - 1].match(/^[#0-9a-z]+$/)) | |||||
| break; | |||||
| //If the cursor is on a "#" and the previous is a " ", we're on a color, repeat the operation | |||||
| if (cursor > 0 && src_text_area.value[cursor - 1].match(/[ ]/) && | |||||
| src_text_area.value[cursor].match(/[#]/)) | |||||
| check = true; | |||||
| else | |||||
| check = false; | |||||
| o++; | |||||
| } | |||||
| //Move forward to find the end of the word | |||||
| for (; cursor < src_text_area.value.length; cursor++) | |||||
| { | |||||
| if (src_text_area.value[cursor].match(/^[a-z]+$/)) | |||||
| found_match += src_text_area.value[cursor]; | |||||
| else | |||||
| break; | |||||
| } | |||||
| //Try to match the command with the dictionnary | |||||
| var match_data = new Object(); | |||||
| match_data.match = found_match; | |||||
| match_data.match_list = new Array(); | |||||
| for (cursor = 0; cursor < current_mesh_dict.m_cmds.length; cursor++) | |||||
| if (current_mesh_dict.m_cmds[cursor].CheckCommand(found_match)) | |||||
| match_data.match_list[match_data.match_list.length] = cursor; | |||||
| return match_data; | |||||
| } | |||||
| } | |||||
| @@ -1,7 +1,18 @@ | |||||
| [sc#f8f ab 1 splt 4 twy 90] | |||||
| sc#f8f afcb 1 1 1 0 | |||||
| //test | |||||
| //[sc#f8f ab 1 splt 4 twy 90] | |||||
| // splt 5 twy 90 0 | // splt 5 twy 90 0 | ||||
| //[sc#f8f afcb 10 10 10 .25 tx 0 splt 4 twy 1.6 0 ] | //[sc#f8f afcb 10 10 10 .25 tx 0 splt 4 twy 1.6 0 ] | ||||
| //sc#fff | //sc#fff | ||||
| @@ -24,8 +24,10 @@ using namespace lol; | |||||
| static int const TEXTURE_WIDTH = 256; | static int const TEXTURE_WIDTH = 256; | ||||
| #define R_M 2.f | #define R_M 2.f | ||||
| #define WIDTH (770.f * R_M) | |||||
| #define HEIGHT (200.f * R_M) | |||||
| #define DEFAULT_WIDTH (770.f * R_M) | |||||
| #define DEFAULT_HEIGHT (200.f * R_M) | |||||
| #define WIDTH ((float)Video::GetSize().x) | |||||
| #define HEIGHT ((float)Video::GetSize().y) | |||||
| #define SCREEN_W (10.f / WIDTH) | #define SCREEN_W (10.f / WIDTH) | ||||
| #define SCREEN_LIMIT 1.1f | #define SCREEN_LIMIT 1.1f | ||||
| #define RATIO_HW (HEIGHT / WIDTH) | #define RATIO_HW (HEIGHT / WIDTH) | ||||
| @@ -522,7 +524,7 @@ int main(int argc, char **argv) | |||||
| { | { | ||||
| System::Init(argc, argv); | System::Init(argc, argv); | ||||
| Application app("MeshViewer", ivec2((int)WIDTH, (int)HEIGHT), 60.0f); | |||||
| Application app("MeshViewer", ivec2((int)DEFAULT_WIDTH, (int)DEFAULT_HEIGHT), 60.0f); | |||||
| if (argc > 1) | if (argc > 1) | ||||
| new MeshViewer(argv[1]); | new MeshViewer(argv[1]); | ||||
| else | else | ||||
| @@ -60,12 +60,14 @@ | |||||
| <None Include="data\mesh-buffer.txt"> | <None Include="data\mesh-buffer.txt"> | ||||
| <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> | ||||
| </None> | </None> | ||||
| <None Include="EasyMeshDictionnary.js" /> | |||||
| <None Include="meshviewer_index.html"> | <None Include="meshviewer_index.html"> | ||||
| <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> | ||||
| </None> | </None> | ||||
| <None Include="meshviewer_nacl.nmf"> | <None Include="meshviewer_nacl.nmf"> | ||||
| <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> | ||||
| </None> | </None> | ||||
| <None Include="TypeDictionnary.js" /> | |||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <LolFxCompile Include="shinyfur.lolfx" /> | <LolFxCompile Include="shinyfur.lolfx" /> | ||||
| @@ -1,4 +1,4 @@ | |||||
| <!DOCTYPE html> | |||||
| <DOCTYPE html> | |||||
| <html> | <html> | ||||
| <!-- | <!-- | ||||
| @@ -10,66 +10,268 @@ | |||||
| <head> | <head> | ||||
| <style type="text/css"> | <style type="text/css"> | ||||
| progress { | |||||
| body | |||||
| { | |||||
| font:12px Consolas; | |||||
| } | |||||
| #status_field | |||||
| { | |||||
| font:12px Consolas; | |||||
| } | |||||
| button | |||||
| { | |||||
| font:14px Consolas; | |||||
| } | |||||
| textarea | |||||
| { | |||||
| font:14px Consolas; | |||||
| } | |||||
| progress | |||||
| { | |||||
| background-color: #f3f3f3; | background-color: #f3f3f3; | ||||
| border: 0; | border: 0; | ||||
| height: 18px; | |||||
| height: 18px; | |||||
| width: 200px; | |||||
| border-radius: 9px; | border-radius: 9px; | ||||
| } | } | ||||
| progress::-webkit-progress-bar { | |||||
| progress::-webkit-progress-bar | |||||
| { | |||||
| background-color: #f3f3f3; | background-color: #f3f3f3; | ||||
| border: 1px solid #000000; | border: 1px solid #000000; | ||||
| padding: 2px 2px; | padding: 2px 2px; | ||||
| height: 20px; | height: 20px; | ||||
| border-radius: 0px; | border-radius: 0px; | ||||
| } | } | ||||
| progress::-webkit-progress-value { | |||||
| progress::-webkit-progress-value | |||||
| { | |||||
| background-color: #22BB22; | background-color: #22BB22; | ||||
| border: 0px; | border: 0px; | ||||
| height: 14px; | height: 14px; | ||||
| border-radius: 0px; | border-radius: 0px; | ||||
| } | } | ||||
| #listener { | |||||
| #listener | |||||
| { | |||||
| position: relative; | position: relative; | ||||
| } | } | ||||
| #progress_bar { | |||||
| #progress_bar | |||||
| { | |||||
| position: absolute; | position: absolute; | ||||
| top: 40%; | top: 40%; | ||||
| left: 40%; | left: 40%; | ||||
| z-index: 3; | z-index: 3; | ||||
| } | } | ||||
| #nacl_div { | |||||
| nacl_div | |||||
| { | |||||
| position: absolute; | position: absolute; | ||||
| top: 2px; | top: 2px; | ||||
| left: 2px; | left: 2px; | ||||
| z-index: -1; | z-index: -1; | ||||
| } | } | ||||
| #BGCanvas { | |||||
| #BGCanvas | |||||
| { | |||||
| border:1px solid #000000; | border:1px solid #000000; | ||||
| } | } | ||||
| #DIV_command0 | |||||
| { | |||||
| margin-left: 5px; | |||||
| } | |||||
| </style> | </style> | ||||
| <!-- | |||||
| --> | |||||
| <title>Mesh Viewer NaCl</title> | |||||
| <script type="text/javascript"> | |||||
| NaClModule = null; // Global application object. | |||||
| MeshCodeModule = null; | |||||
| statusText = 'NO-STATUS'; | |||||
| <title>Mesh Viewer NaCl</title> | |||||
| <script src="./TypeDictionnary.js"></script> | |||||
| <script type="text/javascript"> | |||||
| var EasyMeshDict = new TypeDictionnary("EasyMesh"); | |||||
| function GetCmdDictionnary() { return EasyMeshDict; } | |||||
| </script> | |||||
| <script src="./EasyMeshDictionnary.js"></script> | |||||
| <script type="text/javascript"> | |||||
| nacl_div = null; // Global application object. | |||||
| nacl_module = null; // Global application object. | |||||
| mesh_code_module = null; | |||||
| code_helper_cmd = [null, null]; | |||||
| code_helper_arg = null; | |||||
| code_helper_cmt = null; | |||||
| code_helper_var = null; | |||||
| code_helper_alpha = null; | |||||
| status_text = 'NO-STATUS'; | |||||
| window.setTimeout("Tick()", 100); | window.setTimeout("Tick()", 100); | ||||
| window.setTimeout("Init()", 100); | |||||
| function Tick() { | |||||
| window.setTimeout("Tick()", 100); | |||||
| function Init() | |||||
| { | |||||
| nacl_div = document.getElementById('DIV_nacl_div'); | |||||
| mesh_code_module = document.getElementById('DIV_MeshCode'); | |||||
| code_helper_cmd[0] = document.getElementById('DIV_command0'); | |||||
| code_helper_cmd[1] = document.getElementById('DIV_command1'); | |||||
| code_helper_arg = document.getElementById('DIV_args'); | |||||
| code_helper_cmt = document.getElementById('DIV_comment'); | |||||
| code_helper_var = document.getElementById('DIV_var_usage'); | |||||
| code_helper_alpha = document.getElementById('DIV_alphabet'); | |||||
| code_helper_alpha.innerHTML = ' ['; | |||||
| for (var a = 'a'.charCodeAt(0); a <= 'z'.charCodeAt(0); a++) | |||||
| { | |||||
| var stop = false; | |||||
| for (var i = 0; !stop && i < EasyMeshDict.m_cmds.length; i++) | |||||
| { | |||||
| for (var j = 0; j < EasyMeshDict.m_cmds[i].m_name.length; j++) | |||||
| { | |||||
| if (EasyMeshDict.m_cmds[i].m_name[j][0] == String.fromCharCode(a)) | |||||
| { | |||||
| code_helper_alpha.innerHTML += '<b>' + String.fromCharCode(a) + '</b>'; | |||||
| stop = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| if (!stop) | |||||
| code_helper_alpha.innerHTML += '.'; | |||||
| } | |||||
| code_helper_alpha.innerHTML += '] <br> '; | |||||
| } | |||||
| function Tick() | |||||
| { | |||||
| window.setTimeout("Tick()", 100); | |||||
| /* -- cmd lookup code. */ | |||||
| if (mesh_code_module != undefined) | |||||
| { | |||||
| var cmd_size = 8; | |||||
| var found = FindMatchingCommand(mesh_code_module); | |||||
| if (found.match_list.length > 0) | |||||
| { | |||||
| var type_list = new Array(); | |||||
| code_helper_cmd[0].innerHTML = ""; | |||||
| code_helper_cmd[1].innerHTML = ""; | |||||
| code_helper_arg.innerHTML = ""; | |||||
| code_helper_cmt.innerHTML = ""; | |||||
| //Go through the found matches and show them. | |||||
| for (var i = 0; i < found.match_list.length; i++) | |||||
| { | |||||
| var cur_match = EasyMeshDict.m_cmds[found.match_list[i]]; | |||||
| code_helper_cmd[0].innerHTML += '['; | |||||
| var max = cur_match.m_name.length; | |||||
| var word = 0; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| var mth = found.match; | |||||
| var cmd = cur_match.m_name[j]; | |||||
| //Matching start caracters should be bold | |||||
| if (mth == cmd.slice(0, mth.length)) | |||||
| { | |||||
| code_helper_cmd[word].innerHTML += ' '; | |||||
| code_helper_cmd[word].innerHTML += '<b>' + mth + '</b>'; | |||||
| code_helper_cmd[word].innerHTML += cmd.slice(mth.length, cmd.length); | |||||
| word++; | |||||
| } | |||||
| } | |||||
| //Complete empty command by <br> so commands in the two columns are on the same line | |||||
| word = (word > 0)?(2):(0); | |||||
| while (word-- > 0) | |||||
| code_helper_cmd[word].innerHTML += "<br>"; | |||||
| //Go through the arguments and show them | |||||
| if (found.match_list.length < 4 && i == 0) | |||||
| { | |||||
| code_helper_arg.innerHTML += " > "; | |||||
| if (cur_match.m_arg != undefined) | |||||
| { | |||||
| max = cur_match.m_arg.length; | |||||
| var found_optional = false; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| if (cur_match.m_arg[j].m_optional != undefined && found_optional == false) | |||||
| { | |||||
| var tab = '<br>'; for (var l = 0; l < 5; l++) tab += ' '; | |||||
| code_helper_arg.innerHTML += tab + 'Opt: ['; | |||||
| found_optional = true; | |||||
| } | |||||
| else if (j > 0) | |||||
| code_helper_arg.innerHTML += ', '; | |||||
| //Types are bold | |||||
| code_helper_arg.innerHTML += '<b>' + cur_match.m_arg[j].m_type + '</b> '; | |||||
| type_list[type_list.length] = cur_match.m_arg[j].m_type; | |||||
| //Names are not | |||||
| code_helper_arg.innerHTML += cur_match.m_arg[j].m_name; | |||||
| if (cur_match.m_arg[j].m_optional != undefined) | |||||
| code_helper_arg.innerHTML += ' = <b>' + cur_match.m_arg[j].m_optional + '</b>'; | |||||
| } | |||||
| if (found_optional == true) | |||||
| code_helper_arg.innerHTML += '] '; | |||||
| code_helper_arg.innerHTML += ' <br>'; | |||||
| } | |||||
| //Add the comment | |||||
| if (cur_match.m_comment != undefined) | |||||
| { | |||||
| var tb_i = 16; var in_i = 8; | |||||
| var tab = '<br>'; | |||||
| if (cur_match.m_arg == undefined) { tb_i -= 8; in_i -= 8; } | |||||
| for (var l = 0; l < in_i; l++) code_helper_arg.innerHTML += ' '; | |||||
| for (var l = 0; l < tb_i; l++) tab += ' '; | |||||
| code_helper_arg.innerHTML += cur_match.m_comment + ' '; | |||||
| while (code_helper_arg.innerHTML.indexOf('\n') > -1) | |||||
| code_helper_arg.innerHTML = code_helper_arg.innerHTML.replace('\n', tab); | |||||
| } | |||||
| } | |||||
| } | |||||
| //Go through the type list and bold the used ones. | |||||
| if (EasyMeshDict.m_vars != undefined) | |||||
| { | |||||
| code_helper_var.innerHTML = ""; | |||||
| var max = EasyMeshDict.m_vars.length; | |||||
| for (var j = 0; j < max; j++) | |||||
| { | |||||
| var cur_var = EasyMeshDict.m_vars[j]; | |||||
| code_helper_var.innerHTML += " > "; | |||||
| var k = 0; | |||||
| for (; k < type_list.length; k++) | |||||
| if (cur_var.m_type == type_list[k]) | |||||
| break; | |||||
| //Bold the used variables | |||||
| if (k < type_list.length) | |||||
| code_helper_var.innerHTML += "<b>" + cur_var.m_type + "</b>"; | |||||
| else | |||||
| code_helper_var.innerHTML += cur_var.m_type; | |||||
| if (cur_var.m_syntax != undefined) | |||||
| { | |||||
| var align_size = 9; | |||||
| var cmd_size = cur_var.m_type.length + 3; | |||||
| for (var m = 0; m < cur_var.m_syntax.length; m++) | |||||
| { | |||||
| for (var l = 0; l < align_size - cmd_size; l++) | |||||
| code_helper_var.innerHTML += " "; | |||||
| code_helper_var.innerHTML += cur_var.m_syntax[m] + "<br>"; | |||||
| cmd_size = 0; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| code_helper_cmd[0].innerHTML = "[ ... "; | |||||
| code_helper_cmd[1].innerHTML = ""; | |||||
| code_helper_arg.innerHTML = ""; | |||||
| code_helper_cmt.innerHTML = ""; | |||||
| } | |||||
| } | |||||
| /* -- */ | |||||
| } | } | ||||
| // Indicate load success. | // Indicate load success. | ||||
| function moduleDidLoad() { | function moduleDidLoad() { | ||||
| NaClModule = document.getElementById('ID_NaClModule'); | |||||
| MeshCodeModule = document.getElementById('ID_MeshCode'); | |||||
| nacl_module = document.getElementById('ID_NaClModule'); | |||||
| mesh_code_module = document.getElementById('DIV_MeshCode'); | |||||
| updateStatus('Rock n\' Roll !!'); | updateStatus('Rock n\' Roll !!'); | ||||
| var progress_bar = document.getElementById('progress_bar'); | |||||
| progress_bar.style.visibility="hidden"; | |||||
| var progress_bar = document.getElementById('progress_bar'); | |||||
| progress_bar.style.visibility = "hidden"; | |||||
| } | } | ||||
| // The 'message' event handler. This handler is fired when the NaCl module | // The 'message' event handler. This handler is fired when the NaCl module | ||||
| @@ -84,7 +286,7 @@ progress::-webkit-progress-value { | |||||
| // status message indicating that the module is still loading. Otherwise, | // status message indicating that the module is still loading. Otherwise, | ||||
| // do not change the status message. | // do not change the status message. | ||||
| function pageDidLoad() { | function pageDidLoad() { | ||||
| if (NaClModule == null) { | |||||
| if (nacl_module == null) { | |||||
| updateStatus('Please wait, loading ...'); | updateStatus('Please wait, loading ...'); | ||||
| } else { | } else { | ||||
| // It's possible that the Native Client module onload event fired | // It's possible that the Native Client module onload event fired | ||||
| @@ -99,83 +301,116 @@ progress::-webkit-progress-value { | |||||
| // exists, then set its HTML to the status message as well. | // exists, then set its HTML to the status message as well. | ||||
| // opt_message The message test. If this is null or undefined, then | // opt_message The message test. If this is null or undefined, then | ||||
| // attempt to set the element with id 'statusField' to the value of | // attempt to set the element with id 'statusField' to the value of | ||||
| // |statusText|. | |||||
| // |status_text|. | |||||
| function updateStatus(opt_message) { | function updateStatus(opt_message) { | ||||
| if (opt_message) | if (opt_message) | ||||
| statusText = opt_message; | |||||
| status_text = opt_message; | |||||
| var statusField = document.getElementById('status_field'); | var statusField = document.getElementById('status_field'); | ||||
| if (statusField) { | if (statusField) { | ||||
| statusField.innerHTML = statusText; | |||||
| statusField.innerHTML = status_text; | |||||
| } | } | ||||
| } | } | ||||
| function moduleCrash(event) | |||||
| { | |||||
| alert("Module has crashed !"); | |||||
| //nacl_module.src = null; | |||||
| } | |||||
| function moduleLoadProgress(event) | function moduleLoadProgress(event) | ||||
| { | { | ||||
| var progressBar = document.getElementById("p"); | var progressBar = document.getElementById("p"); | ||||
| var statusField = document.getElementById('status_field'); | var statusField = document.getElementById('status_field'); | ||||
| if (event.lengthComputable) { | |||||
| if (event.lengthComputable) | |||||
| { | |||||
| progressBar.max = event.total; | progressBar.max = event.total; | ||||
| progressBar.value = event.loaded; | progressBar.value = event.loaded; | ||||
| var load_progress = ((event.loaded / event.total) * 100.0); | |||||
| status_field.innerHTML = 'Please wait, loading [' + load_progress.toFixed(0) + '%]'; | |||||
| var load_progress = ((event.loaded / event.total) * 100.0); | |||||
| status_field.innerHTML = 'Please wait, loading [' + load_progress.toFixed(0) + '%]'; | |||||
| } | } | ||||
| else { | |||||
| else | |||||
| { | |||||
| progressBar.value = -1; | progressBar.value = -1; | ||||
| status_field.innerHTML = 'Computing progress ...' | status_field.innerHTML = 'Computing progress ...' | ||||
| } | } | ||||
| } | } | ||||
| //Called by the "Send Mesh Command !" button | |||||
| function SendMeshData() | function SendMeshData() | ||||
| { | { | ||||
| if (NaClModule) | |||||
| NaClModule.postMessage(MeshCodeModule.value); | |||||
| if (nacl_module) | |||||
| nacl_module.postMessage(mesh_code_module.value); | |||||
| else | else | ||||
| alert("Module not loaded"); | alert("Module not loaded"); | ||||
| } | } | ||||
| </script> | </script> | ||||
| </head> | </head> | ||||
| <body onload="pageDidLoad()"> | <body onload="pageDidLoad()"> | ||||
| <h1>Mesh Viewer : Native Client version.</h1> | <h1>Mesh Viewer : Native Client version.</h1> | ||||
| <p> | <p> | ||||
| <div id="final_div"> | |||||
| <div id="final_div"> | |||||
| <div id="listener" align="center" style="width:770px;height:200px"> | <div id="listener" align="center" style="width:770px;height:200px"> | ||||
| <canvas id="BGCanvas" width="772" height="202"> | |||||
| test | |||||
| </canvas> | |||||
| <canvas id="BGCanvas" width="772" height="202"></canvas> | |||||
| <div id="progress_bar"> | <div id="progress_bar"> | ||||
| <div id="status_field">NO-STATUS</div> | <div id="status_field">NO-STATUS</div> | ||||
| <progress id=p align="left"></progress> | |||||
| <progress id="p" align="left" width="200"></progress> | |||||
| </div> | </div> | ||||
| <div id="nacl_div"> | |||||
| <div id="DIV_nacl_div"> | |||||
| <!-- | |||||
| <param name="wmode" value="opaque"/> | <param name="wmode" value="opaque"/> | ||||
| <embed name="nacl_module" | <embed name="nacl_module" | ||||
| id="ID_NaClModule" | |||||
| width=770 height=200 | |||||
| src="meshviewer_nacl.nmf" | |||||
| type="application/x-nacl" /> | |||||
| id="ID_NaClModule" | |||||
| width=770 height=200 | |||||
| src="meshviewer_nacl.nmf" | |||||
| type="application/x-nacl" /> | |||||
| --> | |||||
| </div> | </div> | ||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| var listener = document.getElementById('listener'); | var listener = document.getElementById('listener'); | ||||
| listener.addEventListener('load', moduleDidLoad, true); | listener.addEventListener('load', moduleDidLoad, true); | ||||
| listener.addEventListener('progress', moduleLoadProgress, true); | listener.addEventListener('progress', moduleLoadProgress, true); | ||||
| listener.addEventListener('message', handleMessage, true); | listener.addEventListener('message', handleMessage, true); | ||||
| listener.addEventListener('crash', moduleCrash, true); | |||||
| </script> | </script> | ||||
| </div> | </div> | ||||
| </div> | |||||
| </div> | |||||
| </p> | </p> | ||||
| <h2>Status</h2> | |||||
| <div id="tick_field"></div> | |||||
| <div id="bouton"> | |||||
| <textarea id="ID_MeshCode" rows="5" cols="80"> | |||||
| //This is a comment | |||||
| sc#f8f afcb 1 1 1 0 | |||||
| </textarea> | |||||
| </div> | |||||
| <div> | |||||
| <button onclick="SendMeshData()">Update Mesh</button> | |||||
| </div> | |||||
| <div><button onclick="SendMeshData()">Send Mesh Command !</button></div> | |||||
| <table border="0" cellpadding="0" cellspacing="0"> | |||||
| <tr> | |||||
| <td> | |||||
| <div id="bouton"> | |||||
| <textarea autofocus id="DIV_MeshCode" rows="6" cols="94" style="font: 14px Consolas; resize: none;">//This is a comment | |||||
| sc#f8f afcb 1 1 1 0</textarea> | |||||
| </div> | |||||
| </td> | |||||
| <td valign="top" rowspan="3"> </td> | |||||
| <td valign="top" rowspan="3"> | |||||
| <div><b><u>Variable Types usage :</u></b></div> | |||||
| <div id="DIV_var_usage"></div> | |||||
| </td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td> | |||||
| <div id="DIV_alphabet"></div> | |||||
| </td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td valign="top"> | |||||
| <table border="0" cellpadding="0" cellspacing="0"> | |||||
| <tr> | |||||
| <td valign="top"><div id="DIV_command0"></div></td> | |||||
| <td valign="top"><div id="DIV_command1"></div></td> | |||||
| <td valign="top"><div id="DIV_args" ></div></td> | |||||
| <td valign="top"><div id="DIV_comment" ></div></td> | |||||
| </tr> | |||||
| </table> | |||||
| </td> | |||||
| </tr> | |||||
| </table> | |||||
| </body> | </body> | ||||
| </html> | </html> | ||||