Changeset 2226
- Timestamp:
- Jan 17, 2013, 9:49:29 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Makefile.am
r2225 r2226 31 31 \ 32 32 easymesh/easymesh.cpp easymesh/easymesh.h \ 33 easymesh/csgbsp.cpp easymesh/csgbsp.h \ 33 34 easymesh/shiny.lolfx \ 34 35 easymesh/easymesh-compiler.cpp easymesh/easymesh-compiler.h \ -
trunk/src/core.h
r2225 r2226 133 133 #include "image/image.h" 134 134 #include "application/application.h" 135 #include "easymesh/csgbsp.h" 135 136 #include "easymesh/easymesh.h" 136 137 -
trunk/src/easymesh/easymesh-compiler.cpp
r2183 r2226 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>5 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>6 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>4 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 5 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 6 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 7 7 // This program is free software; you can redistribute it and/or 8 8 // modify it under the terms of the Do What The Fuck You Want To -
trunk/src/easymesh/easymesh-compiler.h
r2183 r2226 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>5 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>6 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>4 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 5 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 6 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 7 7 // This program is free software; you can redistribute it and/or 8 8 // modify it under the terms of the Do What The Fuck You Want To -
trunk/src/easymesh/easymesh-parser.y
r2183 r2226 3 3 // Lol Engine 4 4 // 5 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>6 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>7 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>5 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 6 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 7 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 8 8 // This program is free software; you can redistribute it and/or 9 9 // modify it under the terms of the Do What The Fuck You Want To … … 49 49 %token T_TRANSLATEZ T_ROTATEZ T_TAPERZ T_SCALEZ T_MIRRORZ 50 50 %token T_TRANSLATE T_SCALE T_TOGGLESCALEWINDING 51 %token T_CSGUNION T_CSGSUBSTRACT T_CSGAND T_CSGXOR 51 52 %token T_CHAMFER 52 53 … … 117 118 118 119 transform_command: 119 T_CHAMFER args1 { mc.m_mesh.Chamfer($2.f0); } 120 | T_TRANSLATEX args1 { mc.m_mesh.Translate(vec3($2.f0, 0, 0)); } 121 | T_TRANSLATEY args1 { mc.m_mesh.Translate(vec3(0, $2.f0, 0)); } 122 | T_TRANSLATEZ args1 { mc.m_mesh.Translate(vec3(0, 0, $2.f0)); } 123 | T_TRANSLATE args3 { mc.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); } 124 | T_ROTATEX args1 { mc.m_mesh.RotateX($2.f0); } 125 | T_ROTATEY args1 { mc.m_mesh.RotateY($2.f0); } 126 | T_ROTATEZ args1 { mc.m_mesh.RotateZ($2.f0); } 127 | T_TAPERX args3 { mc.m_mesh.TaperX($2.f0, $2.f1, $2.f2); } 128 | T_TAPERY args3 { mc.m_mesh.TaperY($2.f0, $2.f1, $2.f2); } 129 | T_TAPERZ args3 { mc.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); } 130 | T_SCALEX args1 { mc.m_mesh.Scale(vec3($2.f0, 1.0, 1.0)); } 131 | T_SCALEY args1 { mc.m_mesh.Scale(vec3(1.0, $2.f0, 1.0)); } 132 | T_SCALEZ args1 { mc.m_mesh.Scale(vec3(1.0, 1.0, $2.f0)); } 133 | T_SCALE args3 { mc.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); } 134 | T_MIRRORX { mc.m_mesh.MirrorX(); } 135 | T_MIRRORY { mc.m_mesh.MirrorY(); } 136 | T_MIRRORZ { mc.m_mesh.MirrorZ(); } 137 | T_TOGGLESCALEWINDING { mc.m_mesh.ToggleScaleWinding(); } 120 T_CHAMFER args1 { mc.m_mesh.Chamfer($2.f0); } 121 | T_TRANSLATEX args1 { mc.m_mesh.Translate(vec3($2.f0, 0, 0)); } 122 | T_TRANSLATEY args1 { mc.m_mesh.Translate(vec3(0, $2.f0, 0)); } 123 | T_TRANSLATEZ args1 { mc.m_mesh.Translate(vec3(0, 0, $2.f0)); } 124 | T_TRANSLATE args3 { mc.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); } 125 | T_ROTATEX args1 { mc.m_mesh.RotateX($2.f0); } 126 | T_ROTATEY args1 { mc.m_mesh.RotateY($2.f0); } 127 | T_ROTATEZ args1 { mc.m_mesh.RotateZ($2.f0); } 128 | T_TAPERX args3 { mc.m_mesh.TaperX($2.f0, $2.f1, $2.f2); } 129 | T_TAPERY args3 { mc.m_mesh.TaperY($2.f0, $2.f1, $2.f2); } 130 | T_TAPERZ args3 { mc.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); } 131 | T_SCALEX args1 { mc.m_mesh.Scale(vec3($2.f0, 1.0, 1.0)); } 132 | T_SCALEY args1 { mc.m_mesh.Scale(vec3(1.0, $2.f0, 1.0)); } 133 | T_SCALEZ args1 { mc.m_mesh.Scale(vec3(1.0, 1.0, $2.f0)); } 134 | T_SCALE args3 { mc.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); } 135 | T_MIRRORX { mc.m_mesh.MirrorX(); } 136 | T_MIRRORY { mc.m_mesh.MirrorY(); } 137 | T_MIRRORZ { mc.m_mesh.MirrorZ(); } 138 | T_TOGGLESCALEWINDING { mc.m_mesh.ToggleScaleWinding(); } 139 | T_CSGUNION { mc.m_mesh.CsgUnion(); } 140 | T_CSGSUBSTRACT { mc.m_mesh.CsgSubstract(); } 141 | T_CSGAND { mc.m_mesh.CsgAnd(); } 142 | T_CSGXOR { mc.m_mesh.CsgXor(); } 138 143 ; 139 144 -
trunk/src/easymesh/easymesh-scanner.l
r2183 r2226 3 3 // Lol Engine 4 4 // 5 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>6 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>7 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>5 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 6 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 7 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 8 8 // This program is free software; you can redistribute it and/or 9 9 // modify it under the terms of the Do What The Fuck You Want To … … 71 71 my { return token::T_MIRRORY; } 72 72 mz { return token::T_MIRRORZ; } 73 74 csgu { return token::T_CSGUNION; } 75 csgs { return token::T_CSGSUBSTRACT; } 76 csga { return token::T_CSGAND; } 77 csgx { return token::T_CSGXOR; } 73 78 74 79 ab { return token::T_BOX; } -
trunk/src/easymesh/easymesh.cpp
r2211 r2226 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>5 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>6 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>4 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 5 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 6 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 7 7 // This program is free software; you can redistribute it and/or 8 8 // modify it under the terms of the Do What The Fuck You Want To … … 76 76 m_gpu.modelview = m_gpu.shader->GetUniformLocation("in_ModelView"); 77 77 m_gpu.view = m_gpu.shader->GetUniformLocation("in_View"); 78 78 m_gpu.invview = m_gpu.shader->GetUniformLocation("in_Inv_View"); 79 79 m_gpu.proj = m_gpu.shader->GetUniformLocation("in_Proj"); 80 80 m_gpu.normalmat = m_gpu.shader->GetUniformLocation("in_NormalMat"); … … 142 142 } 143 143 144 145 //------------------- 146 // "Collisions" functions 147 //------------------- 148 #define VX_ALONE -2 149 #define VX_MASTER -1 150 151 //helpers func to retrieve a vertex. 152 int FindVertexInDict(int search_idx, Array< int, int > const &vertex_dict) 153 { 154 //Resolve current vertex idx in the dictionnary (if exist) 155 for (int j = 0; j < vertex_dict.Count(); j++) 156 if (vertex_dict[j].m1 == search_idx) 157 return j; 158 return -1; 159 } 160 161 //helpers func to retrieve a triangle. 162 int FindTriangleInDict(int search_idx, Array< int, Array< vec3, vec3, vec3 > > const &triangle_isec) 163 { 164 //Resolve current vertex idx in the dictionnary (if exist) 165 for (int j = 0; j < triangle_isec.Count(); j++) 166 if (triangle_isec[j].m1 == search_idx) 167 return j; 168 return -1; 169 } 170 171 //Will update the given list with all the vertices on the same spot. 172 void EasyMesh::UpdateVertexDict(Array< int, int > &vertex_dict) 173 { 174 //First, build the vertex Dictionnary 175 for (int i = 0; i < m_vert.Count(); i++) 176 { 177 int CurIdx = FindVertexInDict(i, vertex_dict); 178 179 //go through all vertices and do the match-up. 180 if (CurIdx == -1) 181 { 182 for (int j = i + 1; j < m_vert.Count(); j++) 183 { 184 if (sqlength(m_vert[i].m1 - m_vert[j].m1) < CSG_EPSILON) 185 { 186 if (CurIdx == -1) 187 { 188 CurIdx = vertex_dict.Count(); 189 vertex_dict.Push(i, VX_MASTER); 190 } 191 vertex_dict.Push(j, CurIdx); 192 } 193 } 194 } 195 } 196 } 197 198 void EasyMesh::MeshCsg(int csg_operation) 199 { 200 //A vertex dictionnary for vertices on the same spot. 201 Array< int, int > vertex_dict; 202 //This list keeps track of the triangle that will need deletion at the end. 203 Array< int > triangle_to_kill; 204 //Listing for each triangle of the vectors intersecting it. <tri_Id, <Point0, Point1, tri_isec_Normal>> 205 Array< int, Array< vec3, vec3, vec3 > > triangle_isec; 206 //keep a track of the intersection point on the triangle. <pos, side_id> 207 Array< vec3, int > triangle_vertex; 208 for (int k = 0; k < 10; k++) 209 triangle_vertex.Push(vec3(.0f), 0); 210 211 //bsp infos 212 CsgBsp mesh_bsp_0; 213 CsgBsp mesh_bsp_1; 214 215 //BSP BUILD : We use the brace logic, csg should be used as : "[ exp .... [exp .... csg]]" 216 int cursor_start = (m_cursors.Count() < 2)?(0):(m_cursors[(m_cursors.Count() - 2)].m2); 217 for (int mesh_id = 0; mesh_id < 2; mesh_id++) 218 { 219 int start_point = (mesh_id == 0)?(cursor_start):(m_cursors.Last().m2); 220 int end_point = (mesh_id == 0)?(m_cursors.Last().m2):(m_indices.Count()); 221 CsgBsp &mesh_bsp = (mesh_id == 0)?(mesh_bsp_0):(mesh_bsp_1); 222 for (int i = start_point; i < end_point; i += 3) 223 mesh_bsp.AddTriangleToTree(i, m_vert[m_indices[i]].m1, m_vert[m_indices[i + 1]].m1, m_vert[m_indices[i + 2]].m1); 224 } 225 226 //BSP Useage : let's crunch all triangles on the correct BSP 227 int indices_count = m_indices.Count(); 228 for (int mesh_id = 0; mesh_id < 2; mesh_id++) 229 { 230 int start_point = (mesh_id == 0)?(cursor_start):(m_cursors.Last().m2); 231 int end_point = (mesh_id == 0)?(m_cursors.Last().m2):(indices_count); 232 CsgBsp &mesh_bsp = (mesh_id == 0)?(mesh_bsp_1):(mesh_bsp_0); 233 Array< vec3, int, int, float > vert_list; 234 Array< int, int, int, int > tri_list; 235 vec3 n0(.0f); vec3 n1(.0f); 236 vec4 c0(.0f); vec4 c1(.0f); 237 238 //Reserve some memory 239 vert_list.Reserve(3); 240 tri_list.Reserve(3); 241 242 for (int i = start_point; i < end_point; i += 3) 243 { 244 int Result = mesh_bsp.TestTriangleToTree(m_vert[m_indices[i]].m1, m_vert[m_indices[i + 1]].m1, m_vert[m_indices[i + 2]].m1, vert_list, tri_list); 245 int tri_base_idx = m_indices.Count(); 246 247 //one split has been done, we need to had the new vertices & the new triangles. 248 if (Result == 1) 249 { 250 triangle_to_kill.Push(i); 251 #if 1 252 int base_idx = m_vert.Count(); 253 for (int k = 3; k < vert_list.Count(); k++) 254 { 255 int P0 = (vert_list[k].m2 < 3)?(m_indices[i + vert_list[k].m2]):(base_idx + vert_list[k].m2 - 3); 256 int P1 = (vert_list[k].m3 < 3)?(m_indices[i + vert_list[k].m3]):(base_idx + vert_list[k].m3 - 3); 257 258 AddVertex(vert_list[k].m1); 259 260 //Normal : bad calculations there. 261 n0 = m_vert[P0].m2; 262 n1 = m_vert[P1].m2; 263 SetCurVertNormal(normalize(n0 + (n1 - n0) * vert_list[k].m4)); 264 265 #if 1 266 //Color 267 c0 = m_vert[P0].m3; 268 c1 = m_vert[P1].m3; 269 vec4 res = c0 + ((c1 - c0) * vert_list[k].m4); 270 SetCurVertColor(res); 271 #else 272 if (mesh_id == 0) 273 SetCurVertColor(vec4(1.0f, .0f, .0f, 1.0f)); 274 else 275 SetCurVertColor(vec4(.0f, 1.0f, 1.0f, 1.0f)); 276 #endif 277 } 278 for (int k = 0; k < tri_list.Count(); k++) 279 { 280 int P0 = (tri_list[k].m2 < 3)?(m_indices[i + tri_list[k].m2]):(base_idx + (tri_list[k].m2 - 3)); 281 int P1 = (tri_list[k].m3 < 3)?(m_indices[i + tri_list[k].m3]):(base_idx + (tri_list[k].m3 - 3)); 282 int P2 = (tri_list[k].m4 < 3)?(m_indices[i + tri_list[k].m4]):(base_idx + (tri_list[k].m4 - 3)); 283 AppendTriangle(P0, P1, P2, 0); 284 } 285 #endif 286 } 287 #if 1 288 //Main case 289 if (Result >= 0) 290 { 291 for (int k = 0; k < tri_list.Count(); k++) 292 { 293 int tri_idx = ((tri_list.Count() == 1)?(i):(tri_base_idx + k * 3)); 294 295 //Triangle Kill Test 296 if (//csgu : CSGUnion() -> m0_Outside + m1_Outside 297 (csg_operation == CSG_UNION && tri_list[k].m1 == LEAF_BACK) || 298 //csgs : CSGSubstract() -> m0_Outside + m1_Inside-inverted 299 (csg_operation == CSG_SUBSTRACT && 300 ((mesh_id == 0 && tri_list[k].m1 == LEAF_BACK) || 301 (mesh_id == 1 && tri_list[k].m1 == LEAF_FRONT))) || 302 //csga : CSGAnd() -> Inside + Inside 303 (csg_operation == CSG_AND && tri_list[k].m1 == LEAF_FRONT)) 304 { 305 triangle_to_kill.Push(tri_idx); 306 } 307 308 //Triangle Invert Test 309 if (//csgs : CSGSubstract() -> m0_Outside + m1_Inside-inverted 310 (csg_operation == CSG_SUBSTRACT && mesh_id == 1 && tri_list[k].m1 == LEAF_BACK) || 311 //csgx : CSGXor() -> Outside/Inside-inverted + Outside/Inside-inverted 312 (csg_operation == CSG_XOR && tri_list[k].m1 == LEAF_BACK)) 313 { 314 //a Xor means we will share vertices with the outside, so duplicate the vertices. 315 //TODO : This operation disconnect all triangle, in some cases, not a good thing. 316 if (csg_operation == CSG_XOR) 317 { 318 for (int l = 0; l < 3; l++) 319 { 320 AddDuplicateVertex(m_indices[tri_idx + l]); 321 m_indices[tri_idx + l] = m_vert.Count() - 1; 322 } 323 } 324 m_indices[tri_idx + 1] += m_indices[tri_idx + 2]; 325 m_indices[tri_idx + 2] = m_indices[tri_idx + 1] - m_indices[tri_idx + 2]; 326 m_indices[tri_idx + 1] = m_indices[tri_idx + 1] - m_indices[tri_idx + 2]; 327 ComputeNormals(tri_idx, 3); 328 } 329 } 330 } 331 #endif 332 vert_list.Empty(); 333 tri_list.Empty(); 334 } 335 } 336 337 for (int i = 0; i < m_vert.Count(); i++) 338 if (length(m_vert[i].m2) < 1.0f) 339 i = i; 340 341 int dir = 1; 342 for (int i = 0; i >= 0 && i < triangle_to_kill.Count() - 1; i += dir) 343 { 344 if (triangle_to_kill[i] < triangle_to_kill[i + 1] && dir < 0) 345 dir = 1; 346 if (triangle_to_kill[i] == triangle_to_kill[i + 1]) 347 { 348 triangle_to_kill.Remove(i); 349 dir = -1; 350 } 351 if (triangle_to_kill[i] > triangle_to_kill[i + 1]) 352 { 353 triangle_to_kill[i] += triangle_to_kill[i + 1]; 354 triangle_to_kill[i + 1] = triangle_to_kill[i] - triangle_to_kill[i + 1]; 355 triangle_to_kill[i] = triangle_to_kill[i] - triangle_to_kill[i + 1]; 356 dir = -1; 357 } 358 if (i == 0 && dir == -1) 359 dir = 1; 360 } 361 for (int i = triangle_to_kill.Count() - 1; i >= 0; i--) 362 m_indices.Remove(triangle_to_kill[i], 3); 363 364 m_cursors.Last().m1 = m_vert.Count(); 365 m_cursors.Last().m2 = m_indices.Count(); 366 367 #if 0 368 UpdateVertexDict(vertex_dict); 369 370 for (int t0 = 0; t0 < m_indices.Count(); t0 += 3) 371 { 372 for (int t1 = t0 + 3; t1 < m_indices.Count(); t1 += 3) 373 { 374 int CommonVertices = 0; 375 //Search for common vertices, if > 1 the two triangle share a side, so no split is required. 376 for (int k = 0; k < 3; k++) 377 { 378 int ref_master = FindVertexInDict(m_indices[t0 + k], vertex_dict); 379 if (ref_master != -1) 380 { 381 if (vertex_dict[ref_master].m2 != VX_MASTER) 382 ref_master = vertex_dict[ref_master].m2; 383 for (int l = 0; l < 3; l++) 384 { 385 int test_master = FindVertexInDict(m_indices[t1 + l], vertex_dict); 386 if (test_master != -1) 387 { 388 if (vertex_dict[test_master].m2 != VX_MASTER) 389 test_master = vertex_dict[test_master].m2; 390 if (test_master == ref_master) 391 { 392 CommonVertices++; 393 break; 394 } 395 } 396 } 397 } 398 } 399 400 if (CommonVertices < 2) 401 { 402 vec3 iP0, iP1; 403 //Build the triangle intersection list 404 if (TriangleIsectTriangle(m_vert[m_indices[t0]].m1, m_vert[m_indices[t0 + 1]].m1, m_vert[m_indices[t0 + 2]].m1, 405 m_vert[m_indices[t1]].m1, m_vert[m_indices[t1 + 1]].m1, m_vert[m_indices[t1 + 2]].m1, 406 iP0, iP1)) 407 { 408 int CurIdx = FindTriangleInDict(t0, triangle_isec); 409 if (CurIdx == -1) 410 { 411 CurIdx = triangle_isec.Count(); 412 triangle_isec.Push(t0, Array<vec3, vec3, vec3>()); 413 } 414 triangle_isec[CurIdx].m2.Push(iP0, iP1, vec3(.0f)); 415 CurIdx = FindTriangleInDict(t1, triangle_isec); 416 if (CurIdx == -1) 417 { 418 CurIdx = triangle_isec.Count(); 419 triangle_isec.Push(t1, Array<vec3, vec3, vec3>()); 420 } 421 triangle_isec[CurIdx].m2.Push(iP0, iP1, vec3(.0f)); 422 } 423 } 424 } 425 } 426 427 /* seems to be counter-productive in some rare cases. */ 428 /* 429 //Every intersection has been found, let's remove those that exist twice. 430 for(int i = 0; i < triangle_isec.Count(); i++) 431 { 432 for(int j = 0; j < triangle_isec[i].m2.Count(); j++) 433 { 434 for(int k = j + 1; k < triangle_isec[i].m2.Count(); k++) 435 { 436 //if the two Dir-vector are parallel & the fist Dir-vector is parallel to the (P0, P1)-vector, this is the same intersection, so kill it. 437 if (abs(dot(normalize(triangle_isec[i].m2[j].m2 - triangle_isec[i].m2[j].m1), 438 normalize(triangle_isec[i].m2[k].m2 - triangle_isec[i].m2[k].m1))) 439 >= 1.0 && 440 abs(dot(normalize(triangle_isec[i].m2[j].m2 - triangle_isec[i].m2[j].m1), 441 normalize(triangle_isec[i].m2[k].m1 - triangle_isec[i].m2[j].m1))) 442 >= 1.0 ) 443 triangle_isec[i].m2.Remove(k--); 444 } 445 } 446 } 447 */ 448 449 //Now, the triangle intersection tab should be nice and cosy, so we can start actually cutting some triangles. 450 vec3 isecV[2] = { vec3(.0f), vec3(.0f) }; 451 int isecI[2] = { -1, -1 }; 452 int v_idx0 = 0; int v_idx1 = 0; 453 int new_v_idx[2] = { 0, 0 }; 454 vec3 n0(.0f); vec3 n1(.0f); 455 vec4 c0(.0f); vec4 c1(.0f); 456 for(int i = 0; i < triangle_isec.Count(); i++) 457 { 458 int tri_idx = triangle_isec[i].m1; 459 for(int j = 0; j < triangle_isec[i].m2.Count(); j++) 460 { 461 //Get intersection on actual triangle sides. 462 if (RayIsectTriangleSide(m_vert[m_indices[tri_idx]].m1, m_vert[m_indices[tri_idx + 1]].m1, m_vert[m_indices[tri_idx + 2]].m1, 463 triangle_isec[i].m2[j].m1, triangle_isec[i].m2[j].m2, 464 isecV[0], isecI[0], isecV[1], isecI[1])) 465 { 466 //Check if the found intersections point are in the triangle. If not, ignore. 467 //Cases are : 468 // 1) at least one dot is negative (one point in the triangle). 469 // 2) the two dot are positive but the intersection point are on all parts of the triangle, and therefore negative. 470 //If one of the point is on one side, some calculations tweak are needed. 471 //If the two points are on the triangle sides, just go with it. 472 bool should_proceed_with_cutting = true; 473 //find out if points are on one of the side 474 int p0_tri_idx = ((sqlength(triangle_isec[i].m2[j].m1 - isecV[0]) < CSG_EPSILON)?(0):( 475 (sqlength(triangle_isec[i].m2[j].m1 - isecV[1]) < CSG_EPSILON)?(1):(-1))); 476 int p1_tri_idx = ((sqlength(triangle_isec[i].m2[j].m2 - isecV[0]) < CSG_EPSILON)?(0):( 477 (sqlength(triangle_isec[i].m2[j].m2 - isecV[1]) < CSG_EPSILON)?(1):(-1))); 478 if (p0_tri_idx < 0 || p1_tri_idx < 0) 479 { 480 float dot0 = (p0_tri_idx >= 0)?(1.0f):(dot(triangle_isec[i].m2[j].m1 - isecV[0], 481 triangle_isec[i].m2[j].m1 - isecV[1])); 482 float dot1 = (p1_tri_idx >= 0)?(1.0f):(dot(triangle_isec[i].m2[j].m2 - isecV[0], 483 triangle_isec[i].m2[j].m2 - isecV[1])); 484 float dot2 = dot(triangle_isec[i].m2[j].m1 - isecV[(p0_tri_idx == -1)?(0):(1 - p0_tri_idx)], 485 triangle_isec[i].m2[j].m2 - isecV[(p1_tri_idx == -1)?(0):(1 - p1_tri_idx)]); 486 should_proceed_with_cutting = (((dot0 < .0f) || dot1 < .0f) || (dot0 > .0f && dot1 > .0f && dot2 < .0f)); 487 } 488 if (should_proceed_with_cutting) 489 { 490 //Add the new vertices 491 int b_idx = 0; 492 for(int k = 0; k < 2; k++) 493 { 494 if (b_idx == isecI[k]) 495 b_idx++; 496 497 new_v_idx[k] = m_vert.Count(); 498 AddVertex(isecV[k]); 499 //bad calculations of normal there. 500 n0 = m_vert[m_indices[tri_idx + isecI[k]]].m2; 501 n1 = m_vert[m_indices[tri_idx + (isecI[k] + 1) % 3]].m2; 502 SetCurVertNormal(normalize((n0 + n1) * .5f)); 503 //color 504 #if 0 505 c0 = m_vert[m_indices[tri_idx + isecI[k]]].m3; 506 c1 = m_vert[m_indices[tri_idx + (isecI[k] + 1) % 3]].m3; 507 SetCurVertColor((c0 + c1) * .5f); 508 #else 509 SetCurVertColor(vec4(1.0f, 0.0f, 0.0f, 1.0f)); 510 #endif 511 } 512 513 //small trick, b_idx is the side index that has no intersection. 514 v_idx0 = (b_idx == 1)?(1):(0); 515 v_idx1 = (b_idx == 1)?(0):(1); 516 517 //Add the new triangles 518 AppendTriangle(m_indices[tri_idx + b_idx], new_v_idx[v_idx0], new_v_idx[v_idx1], 0); 519 AppendTriangle(m_indices[tri_idx + ((b_idx + 2) % 3)], new_v_idx[v_idx1], new_v_idx[v_idx0], 0); 520 //Replace the current triangle by on of the new one, instead of erasing it. 521 m_indices[tri_idx + ((b_idx + 2) % 3)] = new_v_idx[v_idx0]; 522 523 if (j + 1 < triangle_isec[i].m2.Count()) 524 { 525 triangle_isec[i].m2.Remove(j--); 526 //add the two new triangle to the checklist. 527 triangle_isec.Push(m_indices.Count() - 6, triangle_isec[i].m2); 528 triangle_isec.Push(m_indices.Count() - 3, triangle_isec[i].m2); 529 } 530 } 531 } 532 } 533 } 534 #endif 535 //DONE for the splitting ! 536 } 537 538 539 //------------------- 540 144 541 void EasyMesh::ToggleScaleWinding() 145 542 { … … 435 832 * is a vertex at [0 1 0] and [0 -1 0] after normalisation. */ 436 833 float phi = 0.5f + 0.5f * sqrt(5.f); 437 mat3 mat = mat3::rotate(asin(1.f / sqrt(2.f + phi)) * (180.f / M_PI),834 mat3 mat = mat3::rotate(asin(1.f / sqrt(2.f + phi)) * (180.f / (float)M_PI), 438 835 vec3(0.f, 0.f, 1.f)); 439 836 for (int i = 0; i < 4; i++) … … 539 936 int i2 = (i + di) % nidiv; 540 937 int j2 = (j + dj) % njdiv; 541 float x = 0.5f * (r1 + r2) + 0.5 * (r2 - r1) *lol::cos(2.0 * M_PI * i2 / nidiv);542 float y = 0.5f * (r2 - r1) * lol::sin(2.0 * M_PI * i2 / nidiv);938 float x = 0.5f * (r1 + r2) + 0.5f * (r2 - r1) * (float)lol::cos(2.0 * M_PI * i2 / nidiv); 939 float y = 0.5f * (r2 - r1) * (float)lol::sin(2.0 * M_PI * i2 / nidiv); 543 940 float z = 0.0f; 544 941 545 float ca = lol::cos(2.0 * M_PI * j2 / njdiv);546 float sa = lol::sin(2.0 * M_PI * j2 / njdiv);942 float ca = (float)lol::cos(2.0 * M_PI * j2 / njdiv); 943 float sa = (float)lol::sin(2.0 * M_PI * j2 / njdiv); 547 944 float x2 = x * ca - z * sa; 548 945 float z2 = z * ca + x * sa; -
trunk/src/easymesh/easymesh.h
r2209 r2226 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>5 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>6 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>4 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 5 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 6 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 7 7 // This program is free software; you can redistribute it and/or 8 8 // modify it under the terms of the Do What The Fuck You Want To … … 33 33 void Render(mat4 const &model, float damage = 0.f); 34 34 35 private: 36 void UpdateVertexDict(Array< int, int > &vertex_dict); 37 //DEBUG 38 public: 39 #define CSG_UNION 0 40 #define CSG_SUBSTRACT 1 41 #define CSG_AND 2 42 #define CSG_XOR 3 43 44 void MeshCsg(int csg_operation); 45 void CsgUnion() { MeshCsg(CSG_UNION); } 46 void CsgSubstract() { MeshCsg(CSG_SUBSTRACT); } 47 void CsgAnd() { MeshCsg(CSG_AND); } 48 void CsgXor() { MeshCsg(CSG_XOR); } 49 50 public: 35 51 void OpenBrace(); 36 52 void CloseBrace(); 37 53 38 54 void ToggleScaleWinding(); 39 55 void SetCurColor(vec4 const &color); 40 56 void SetCurColor2(vec4 const &color); … … 93 109 vec4 m_color, m_color2; 94 110 Array<uint16_t> m_indices; 111 //<coord, norm, color> 95 112 Array<vec3, vec3, vec4> m_vert; 113 //<vert count, indices count> 96 114 Array<int, int> m_cursors; 97 115 bool m_ignore_winding_on_scale; 98 116 99 117 /* FIXME: put this in a separate class so that we can copy meshes. */ -
trunk/src/easymesh/shiny.lolfx
r2149 r2226 66 66 /* World properties */ 67 67 float ambient_mul = 0.5; 68 vec3 ambient_color = vec3(0. 0, 0.0, 0.0);68 vec3 ambient_color = vec3(0.5, 0.5, 0.5); 69 69 vec3 diffuse_color = vec3(0.4, 0.4, 0.4); 70 70 vec3 specular_color = vec3(1.0, 1.0, 0.6); -
trunk/src/generated/easymesh-parser.cpp
r2183 r2226 1 /* A Bison parser, made by GNU Bison 2. 5. */1 /* A Bison parser, made by GNU Bison 2.4.2. */ 2 2 3 3 /* Skeleton implementation for Bison LALR(1) parsers in C++ 4 4 5 Copyright (C) 2002-201 1Free Software Foundation, Inc.5 Copyright (C) 2002-2010 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify … … 36 36 /* First part of user declarations. */ 37 37 38 /* Line 293of lalr1.cc */38 /* Line 310 of lalr1.cc */ 39 39 #line 1 "easymesh/easymesh-parser.y" 40 40 … … 42 42 // Lol Engine 43 43 // 44 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>45 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>46 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>44 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 45 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 46 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 47 47 // This program is free software; you can redistribute it and/or 48 48 // modify it under the terms of the Do What The Fuck You Want To … … 62 62 63 63 64 /* Line 293of lalr1.cc */64 /* Line 310 of lalr1.cc */ 65 65 #line 66 "generated/easymesh-parser.cpp" 66 66 … … 70 70 /* User implementation prologue. */ 71 71 72 /* Line 299of lalr1.cc */73 #line 6 5"easymesh/easymesh-parser.y"72 /* Line 316 of lalr1.cc */ 73 #line 66 "easymesh/easymesh-parser.y" 74 74 75 75 #include "easymesh/easymesh-compiler.h" … … 79 79 80 80 81 /* Line 299of lalr1.cc */81 /* Line 316 of lalr1.cc */ 82 82 #line 83 "generated/easymesh-parser.cpp" 83 83 … … 94 94 #endif 95 95 96 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].97 If N is 0, then set CURRENT to the empty location which ends98 the previous symbol: RHS[0] (always defined). */99 100 #define YYRHSLOC(Rhs, K) ((Rhs)[K])101 #ifndef YYLLOC_DEFAULT102 # define YYLLOC_DEFAULT(Current, Rhs, N) \103 do \104 if (N) \105 { \106 (Current).begin = YYRHSLOC (Rhs, 1).begin; \107 (Current).end = YYRHSLOC (Rhs, N).end; \108 } \109 else \110 { \111 (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \112 } \113 while (false)114 #endif115 116 96 /* Suppress unused-variable warnings by "using" E. */ 117 97 #define YYUSE(e) ((void) (e)) … … 165 145 namespace lol { 166 146 167 /* Line 382 of lalr1.cc */ 168 #line 169 "generated/easymesh-parser.cpp" 147 /* Line 379 of lalr1.cc */ 148 #line 149 "generated/easymesh-parser.cpp" 149 #if YYERROR_VERBOSE 169 150 170 151 /* Return YYSTR after stripping away unnecessary quotes and … … 205 186 } 206 187 188 #endif 207 189 208 190 /// Build a parser object. … … 305 287 #endif 306 288 307 inline bool308 EasyMeshParser::yy_pact_value_is_default_ (int yyvalue)309 {310 return yyvalue == yypact_ninf_;311 }312 313 inline bool314 EasyMeshParser::yy_table_value_is_error_ (int yyvalue)315 {316 return yyvalue == yytable_ninf_;317 }318 319 289 int 320 290 EasyMeshParser::parse () … … 338 308 location_type yylloc; 339 309 /// The locations where the error started and ended. 340 location_type yyerror_range[ 3];310 location_type yyerror_range[2]; 341 311 342 312 /// $$. … … 376 346 /* Try to take a decision without lookahead. */ 377 347 yyn = yypact_[yystate]; 378 if (yy _pact_value_is_default_ (yyn))348 if (yyn == yypact_ninf_) 379 349 goto yydefault; 380 350 … … 409 379 if (yyn <= 0) 410 380 { 411 if (yy _table_value_is_error_ (yyn))412 381 if (yyn == 0 || yyn == yytable_ninf_) 382 goto yyerrlab; 413 383 yyn = -yyn; 414 384 goto yyreduce; … … 466 436 case 7: 467 437 468 /* Line 6 90of lalr1.cc */469 #line 89"easymesh/easymesh-parser.y"438 /* Line 677 of lalr1.cc */ 439 #line 90 "easymesh/easymesh-parser.y" 470 440 { mc.m_mesh.OpenBrace(); } 471 441 break; … … 473 443 case 8: 474 444 475 /* Line 6 90of lalr1.cc */476 #line 9 3"easymesh/easymesh-parser.y"445 /* Line 677 of lalr1.cc */ 446 #line 94 "easymesh/easymesh-parser.y" 477 447 { mc.m_mesh.CloseBrace(); } 478 448 break; … … 480 450 case 14: 481 451 482 /* Line 6 90of lalr1.cc */483 #line 10 8"easymesh/easymesh-parser.y"452 /* Line 677 of lalr1.cc */ 453 #line 109 "easymesh/easymesh-parser.y" 484 454 { mc.m_mesh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } 485 455 break; … … 487 457 case 15: 488 458 489 /* Line 6 90of lalr1.cc */490 #line 1 09"easymesh/easymesh-parser.y"459 /* Line 677 of lalr1.cc */ 460 #line 110 "easymesh/easymesh-parser.y" 491 461 { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val); 492 462 vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); … … 496 466 case 16: 497 467 498 /* Line 6 90of lalr1.cc */499 #line 11 2"easymesh/easymesh-parser.y"468 /* Line 677 of lalr1.cc */ 469 #line 113 "easymesh/easymesh-parser.y" 500 470 { mc.m_mesh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } 501 471 break; … … 503 473 case 17: 504 474 505 /* Line 6 90of lalr1.cc */506 #line 11 3"easymesh/easymesh-parser.y"475 /* Line 677 of lalr1.cc */ 476 #line 114 "easymesh/easymesh-parser.y" 507 477 { uint32_t x = (yysemantic_stack_[(2) - (2)].u32val); 508 478 vec4 v(x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff); … … 512 482 case 18: 513 483 514 /* Line 6 90of lalr1.cc */515 #line 1 19"easymesh/easymesh-parser.y"484 /* Line 677 of lalr1.cc */ 485 #line 120 "easymesh/easymesh-parser.y" 516 486 { mc.m_mesh.Chamfer((yysemantic_stack_[(2) - (2)].args).f0); } 517 487 break; … … 519 489 case 19: 520 490 521 /* Line 6 90of lalr1.cc */522 #line 12 0"easymesh/easymesh-parser.y"491 /* Line 677 of lalr1.cc */ 492 #line 121 "easymesh/easymesh-parser.y" 523 493 { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } 524 494 break; … … 526 496 case 20: 527 497 528 /* Line 6 90of lalr1.cc */529 #line 12 1"easymesh/easymesh-parser.y"498 /* Line 677 of lalr1.cc */ 499 #line 122 "easymesh/easymesh-parser.y" 530 500 { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } 531 501 break; … … 533 503 case 21: 534 504 535 /* Line 6 90of lalr1.cc */536 #line 12 2"easymesh/easymesh-parser.y"505 /* Line 677 of lalr1.cc */ 506 #line 123 "easymesh/easymesh-parser.y" 537 507 { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } 538 508 break; … … 540 510 case 22: 541 511 542 /* Line 6 90of lalr1.cc */543 #line 12 3"easymesh/easymesh-parser.y"512 /* Line 677 of lalr1.cc */ 513 #line 124 "easymesh/easymesh-parser.y" 544 514 { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 545 515 break; … … 547 517 case 23: 548 518 549 /* Line 6 90of lalr1.cc */550 #line 12 4"easymesh/easymesh-parser.y"519 /* Line 677 of lalr1.cc */ 520 #line 125 "easymesh/easymesh-parser.y" 551 521 { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); } 552 522 break; … … 554 524 case 24: 555 525 556 /* Line 6 90of lalr1.cc */557 #line 12 5"easymesh/easymesh-parser.y"526 /* Line 677 of lalr1.cc */ 527 #line 126 "easymesh/easymesh-parser.y" 558 528 { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); } 559 529 break; … … 561 531 case 25: 562 532 563 /* Line 6 90of lalr1.cc */564 #line 12 6"easymesh/easymesh-parser.y"533 /* Line 677 of lalr1.cc */ 534 #line 127 "easymesh/easymesh-parser.y" 565 535 { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); } 566 536 break; … … 568 538 case 26: 569 539 570 /* Line 6 90of lalr1.cc */571 #line 12 7"easymesh/easymesh-parser.y"540 /* Line 677 of lalr1.cc */ 541 #line 128 "easymesh/easymesh-parser.y" 572 542 { mc.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 573 543 break; … … 575 545 case 27: 576 546 577 /* Line 6 90of lalr1.cc */578 #line 12 8"easymesh/easymesh-parser.y"547 /* Line 677 of lalr1.cc */ 548 #line 129 "easymesh/easymesh-parser.y" 579 549 { mc.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 580 550 break; … … 582 552 case 28: 583 553 584 /* Line 6 90of lalr1.cc */585 #line 1 29"easymesh/easymesh-parser.y"554 /* Line 677 of lalr1.cc */ 555 #line 130 "easymesh/easymesh-parser.y" 586 556 { mc.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 587 557 break; … … 589 559 case 29: 590 560 591 /* Line 6 90of lalr1.cc */592 #line 13 0"easymesh/easymesh-parser.y"561 /* Line 677 of lalr1.cc */ 562 #line 131 "easymesh/easymesh-parser.y" 593 563 { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 1.0, 1.0)); } 594 564 break; … … 596 566 case 30: 597 567 598 /* Line 6 90of lalr1.cc */599 #line 13 1"easymesh/easymesh-parser.y"568 /* Line 677 of lalr1.cc */ 569 #line 132 "easymesh/easymesh-parser.y" 600 570 { mc.m_mesh.Scale(vec3(1.0, (yysemantic_stack_[(2) - (2)].args).f0, 1.0)); } 601 571 break; … … 603 573 case 31: 604 574 605 /* Line 6 90of lalr1.cc */606 #line 13 2"easymesh/easymesh-parser.y"575 /* Line 677 of lalr1.cc */ 576 #line 133 "easymesh/easymesh-parser.y" 607 577 { mc.m_mesh.Scale(vec3(1.0, 1.0, (yysemantic_stack_[(2) - (2)].args).f0)); } 608 578 break; … … 610 580 case 32: 611 581 612 /* Line 6 90of lalr1.cc */613 #line 13 3"easymesh/easymesh-parser.y"582 /* Line 677 of lalr1.cc */ 583 #line 134 "easymesh/easymesh-parser.y" 614 584 { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 615 585 break; … … 617 587 case 33: 618 588 619 /* Line 6 90of lalr1.cc */620 #line 13 4"easymesh/easymesh-parser.y"589 /* Line 677 of lalr1.cc */ 590 #line 135 "easymesh/easymesh-parser.y" 621 591 { mc.m_mesh.MirrorX(); } 622 592 break; … … 624 594 case 34: 625 595 626 /* Line 6 90of lalr1.cc */627 #line 13 5"easymesh/easymesh-parser.y"596 /* Line 677 of lalr1.cc */ 597 #line 136 "easymesh/easymesh-parser.y" 628 598 { mc.m_mesh.MirrorY(); } 629 599 break; … … 631 601 case 35: 632 602 633 /* Line 6 90of lalr1.cc */634 #line 13 6"easymesh/easymesh-parser.y"603 /* Line 677 of lalr1.cc */ 604 #line 137 "easymesh/easymesh-parser.y" 635 605 { mc.m_mesh.MirrorZ(); } 636 606 break; … … 638 608 case 36: 639 609 640 /* Line 6 90of lalr1.cc */641 #line 13 7"easymesh/easymesh-parser.y"610 /* Line 677 of lalr1.cc */ 611 #line 138 "easymesh/easymesh-parser.y" 642 612 { mc.m_mesh.ToggleScaleWinding(); } 643 613 break; … … 645 615 case 37: 646 616 647 /* Line 690 of lalr1.cc */ 617 /* Line 677 of lalr1.cc */ 618 #line 139 "easymesh/easymesh-parser.y" 619 { mc.m_mesh.CsgUnion(); } 620 break; 621 622 case 38: 623 624 /* Line 677 of lalr1.cc */ 625 #line 140 "easymesh/easymesh-parser.y" 626 { mc.m_mesh.CsgSubstract(); } 627 break; 628 629 case 39: 630 631 /* Line 677 of lalr1.cc */ 648 632 #line 141 "easymesh/easymesh-parser.y" 633 { mc.m_mesh.CsgAnd(); } 634 break; 635 636 case 40: 637 638 /* Line 677 of lalr1.cc */ 639 #line 142 "easymesh/easymesh-parser.y" 640 { mc.m_mesh.CsgXor(); } 641 break; 642 643 case 41: 644 645 /* Line 677 of lalr1.cc */ 646 #line 146 "easymesh/easymesh-parser.y" 649 647 { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 650 648 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, … … 652 650 break; 653 651 654 case 38:655 656 /* Line 6 90of lalr1.cc */657 #line 14 4"easymesh/easymesh-parser.y"652 case 42: 653 654 /* Line 677 of lalr1.cc */ 655 #line 149 "easymesh/easymesh-parser.y" 658 656 { mc.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 659 657 break; 660 658 661 case 39:662 663 /* Line 6 90of lalr1.cc */664 #line 1 45"easymesh/easymesh-parser.y"659 case 43: 660 661 /* Line 677 of lalr1.cc */ 662 #line 150 "easymesh/easymesh-parser.y" 665 663 { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 666 664 (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } 667 665 break; 668 666 669 case 4 0:670 671 /* Line 6 90of lalr1.cc */672 #line 1 47"easymesh/easymesh-parser.y"667 case 44: 668 669 /* Line 677 of lalr1.cc */ 670 #line 152 "easymesh/easymesh-parser.y" 673 671 { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 674 672 (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } 675 673 break; 676 674 677 case 4 1:678 679 /* Line 6 90of lalr1.cc */680 #line 1 49"easymesh/easymesh-parser.y"675 case 45: 676 677 /* Line 677 of lalr1.cc */ 678 #line 154 "easymesh/easymesh-parser.y" 681 679 { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0, 682 680 vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } 683 681 break; 684 682 685 case 4 2:686 687 /* Line 6 90of lalr1.cc */688 #line 15 1"easymesh/easymesh-parser.y"683 case 46: 684 685 /* Line 677 of lalr1.cc */ 686 #line 156 "easymesh/easymesh-parser.y" 689 687 { mc.m_mesh.AppendCapsule((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 690 688 break; 691 689 692 case 4 3:693 694 /* Line 6 90of lalr1.cc */695 #line 15 2"easymesh/easymesh-parser.y"690 case 47: 691 692 /* Line 677 of lalr1.cc */ 693 #line 157 "easymesh/easymesh-parser.y" 696 694 { mc.m_mesh.AppendTorus((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 697 695 break; 698 696 699 case 4 4:700 701 /* Line 6 90of lalr1.cc */702 #line 15 3"easymesh/easymesh-parser.y"697 case 48: 698 699 /* Line 677 of lalr1.cc */ 700 #line 158 "easymesh/easymesh-parser.y" 703 701 { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, 704 702 (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } 705 703 break; 706 704 707 case 4 5:708 709 /* Line 6 90of lalr1.cc */710 #line 1 55"easymesh/easymesh-parser.y"705 case 49: 706 707 /* Line 677 of lalr1.cc */ 708 #line 160 "easymesh/easymesh-parser.y" 711 709 { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 712 710 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } 713 711 break; 714 712 715 case 46:716 717 /* Line 6 90of lalr1.cc */718 #line 1 57"easymesh/easymesh-parser.y"713 case 50: 714 715 /* Line 677 of lalr1.cc */ 716 #line 162 "easymesh/easymesh-parser.y" 719 717 { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } 720 718 break; 721 719 722 case 47:723 724 /* Line 6 90of lalr1.cc */725 #line 1 58"easymesh/easymesh-parser.y"720 case 51: 721 722 /* Line 677 of lalr1.cc */ 723 #line 163 "easymesh/easymesh-parser.y" 726 724 { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } 727 725 break; 728 726 729 case 48:730 731 /* Line 6 90of lalr1.cc */732 #line 1 59"easymesh/easymesh-parser.y"727 case 52: 728 729 /* Line 677 of lalr1.cc */ 730 #line 164 "easymesh/easymesh-parser.y" 733 731 { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } 734 732 break; 735 733 736 case 49:737 738 /* Line 6 90of lalr1.cc */739 #line 16 0"easymesh/easymesh-parser.y"734 case 53: 735 736 /* Line 677 of lalr1.cc */ 737 #line 165 "easymesh/easymesh-parser.y" 740 738 { mc.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 741 739 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, (yysemantic_stack_[(2) - (2)].args).f4, (yysemantic_stack_[(2) - (2)].args).f5, (yysemantic_stack_[(2) - (2)].args).f6, … … 743 741 break; 744 742 745 case 5 0:746 747 /* Line 6 90of lalr1.cc */748 #line 1 65"easymesh/easymesh-parser.y"743 case 54: 744 745 /* Line 677 of lalr1.cc */ 746 #line 170 "easymesh/easymesh-parser.y" 749 747 { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } 750 748 break; 751 749 752 case 5 1:753 754 /* Line 6 90of lalr1.cc */755 #line 1 66"easymesh/easymesh-parser.y"750 case 55: 751 752 /* Line 677 of lalr1.cc */ 753 #line 171 "easymesh/easymesh-parser.y" 756 754 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(2) - (2)].fval); } 757 755 break; 758 756 759 case 5 2:760 761 /* Line 6 90of lalr1.cc */762 #line 1 67"easymesh/easymesh-parser.y"757 case 56: 758 759 /* Line 677 of lalr1.cc */ 760 #line 172 "easymesh/easymesh-parser.y" 763 761 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(2) - (2)].fval); } 764 762 break; 765 763 766 case 5 3:767 768 /* Line 6 90of lalr1.cc */769 #line 1 68"easymesh/easymesh-parser.y"764 case 57: 765 766 /* Line 677 of lalr1.cc */ 767 #line 173 "easymesh/easymesh-parser.y" 770 768 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(2) - (2)].fval); } 771 769 break; 772 770 773 case 5 4:774 775 /* Line 6 90of lalr1.cc */776 #line 1 69"easymesh/easymesh-parser.y"771 case 58: 772 773 /* Line 677 of lalr1.cc */ 774 #line 174 "easymesh/easymesh-parser.y" 777 775 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(2) - (2)].fval); } 778 776 break; 779 777 780 case 5 5:781 782 /* Line 6 90of lalr1.cc */783 #line 17 0"easymesh/easymesh-parser.y"778 case 59: 779 780 /* Line 677 of lalr1.cc */ 781 #line 175 "easymesh/easymesh-parser.y" 784 782 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(2) - (2)].fval); } 785 783 break; 786 784 787 case 56:788 789 /* Line 6 90of lalr1.cc */790 #line 17 1"easymesh/easymesh-parser.y"785 case 60: 786 787 /* Line 677 of lalr1.cc */ 788 #line 176 "easymesh/easymesh-parser.y" 791 789 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(2) - (2)].fval); } 792 790 break; 793 791 794 case 57:795 796 /* Line 6 90of lalr1.cc */797 #line 17 2"easymesh/easymesh-parser.y"792 case 61: 793 794 /* Line 677 of lalr1.cc */ 795 #line 177 "easymesh/easymesh-parser.y" 798 796 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(2) - (2)].fval); } 799 797 break; 800 798 801 case 58:802 803 /* Line 6 90of lalr1.cc */804 #line 17 3"easymesh/easymesh-parser.y"799 case 62: 800 801 /* Line 677 of lalr1.cc */ 802 #line 178 "easymesh/easymesh-parser.y" 805 803 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f8 = (yysemantic_stack_[(2) - (2)].fval); } 806 804 break; 807 805 808 case 59:809 810 /* Line 6 90of lalr1.cc */811 #line 17 4"easymesh/easymesh-parser.y"806 case 63: 807 808 /* Line 677 of lalr1.cc */ 809 #line 179 "easymesh/easymesh-parser.y" 812 810 { (yyval.args) = (yysemantic_stack_[(2) - (1)].args); (yyval.args).f9 = (yysemantic_stack_[(2) - (2)].fval); } 813 811 break; 814 812 815 case 6 0:816 817 /* Line 6 90of lalr1.cc */818 #line 1 77"easymesh/easymesh-parser.y"813 case 64: 814 815 /* Line 677 of lalr1.cc */ 816 #line 182 "easymesh/easymesh-parser.y" 819 817 { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } 820 818 break; 821 819 822 case 6 1:823 824 /* Line 6 90of lalr1.cc */825 #line 1 78"easymesh/easymesh-parser.y"820 case 65: 821 822 /* Line 677 of lalr1.cc */ 823 #line 183 "easymesh/easymesh-parser.y" 826 824 { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } 827 825 break; … … 829 827 830 828 831 /* Line 6 90of lalr1.cc */832 #line 83 3"generated/easymesh-parser.cpp"829 /* Line 677 of lalr1.cc */ 830 #line 831 "generated/easymesh-parser.cpp" 833 831 default: 834 832 break; 835 833 } 836 /* User semantic actions sometimes alter yychar, and that requires837 that yytoken be updated with the new translation. We take the838 approach of translating immediately before every use of yytoken.839 One alternative is translating here after every semantic action,840 but that translation would be missed if the semantic action841 invokes YYABORT, YYACCEPT, or YYERROR immediately after altering842 yychar. In the case of YYABORT or YYACCEPT, an incorrect843 destructor might then be invoked immediately. In the case of844 YYERROR, subsequent parser actions might lead to an incorrect845 destructor call or verbose syntax error message before the846 lookahead is translated. */847 834 YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); 848 835 … … 868 855 `------------------------------------*/ 869 856 yyerrlab: 870 /* Make sure we have latest lookahead translation. See comments at871 user semantic actions for why this is necessary. */872 yytoken = yytranslate_ (yychar);873 874 857 /* If not already recovering from an error, report this error. */ 875 858 if (!yyerrstatus_) 876 859 { 877 860 ++yynerrs_; 878 if (yychar == yyempty_)879 yytoken = yyempty_;880 861 error (yylloc, yysyntax_error_ (yystate, yytoken)); 881 862 } 882 863 883 yyerror_range[ 1] = yylloc;864 yyerror_range[0] = yylloc; 884 865 if (yyerrstatus_ == 3) 885 866 { … … 916 897 goto yyerrorlab; 917 898 918 yyerror_range[ 1] = yylocation_stack_[yylen - 1];899 yyerror_range[0] = yylocation_stack_[yylen - 1]; 919 900 /* Do not reclaim the symbols of the rule which action triggered 920 901 this YYERROR. */ … … 933 914 { 934 915 yyn = yypact_[yystate]; 935 if ( !yy_pact_value_is_default_ (yyn))916 if (yyn != yypact_ninf_) 936 917 { 937 918 yyn += yyterror_; … … 948 929 YYABORT; 949 930 950 yyerror_range[ 1] = yylocation_stack_[0];931 yyerror_range[0] = yylocation_stack_[0]; 951 932 yydestruct_ ("Error: popping", 952 933 yystos_[yystate], … … 957 938 } 958 939 959 yyerror_range[ 2] = yylloc;940 yyerror_range[1] = yylloc; 960 941 // Using YYLLOC is tempting, but would change the location of 961 942 // the lookahead. YYLOC is available though. 962 YYLLOC_DEFAULT (yyloc, yyerror_range, 2);943 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); 963 944 yysemantic_stack_.push (yylval); 964 945 yylocation_stack_.push (yyloc); … … 983 964 yyreturn: 984 965 if (yychar != yyempty_) 985 { 986 /* Make sure we have latest lookahead translation. See comments 987 at user semantic actions for why this is necessary. */ 988 yytoken = yytranslate_ (yychar); 989 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, 990 &yylloc); 991 } 966 yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); 992 967 993 968 /* Do not reclaim the symbols of the rule which action triggered … … 1008 983 // Generate an error message. 1009 984 std::string 1010 EasyMeshParser::yysyntax_error_ (int yystate, int yytoken) 1011 { 1012 std::string yyres; 1013 // Number of reported tokens (one for the "unexpected", one per 1014 // "expected"). 1015 size_t yycount = 0; 1016 // Its maximum. 1017 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1018 // Arguments of yyformat. 1019 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1020 1021 /* There are many possibilities here to consider: 1022 - If this state is a consistent state with a default action, then 1023 the only way this function was invoked is if the default action 1024 is an error action. In that case, don't check for expected 1025 tokens because there are none. 1026 - The only way there can be no lookahead present (in yytoken) is 1027 if this state is a consistent state with a default action. 1028 Thus, detecting the absence of a lookahead is sufficient to 1029 determine that there is no unexpected or expected token to 1030 report. In that case, just report a simple "syntax error". 1031 - Don't assume there isn't a lookahead just because this state is 1032 a consistent state with a default action. There might have 1033 been a previous inconsistent state, consistent state with a 1034 non-default action, or user semantic action that manipulated 1035 yychar. 1036 - Of course, the expected token list depends on states to have 1037 correct lookahead information, and it depends on the parser not 1038 to perform extra reductions after fetching a lookahead from the 1039 scanner and before detecting a syntax error. Thus, state 1040 merging (from LALR or IELR) and default reductions corrupt the 1041 expected token list. However, the list is correct for 1042 canonical LR with one exception: it will still contain any 1043 token that will not be accepted due to an error action in a 1044 later state. 1045 */ 1046 if (yytoken != yyempty_) 985 EasyMeshParser::yysyntax_error_ (int yystate, int tok) 986 { 987 std::string res; 988 YYUSE (yystate); 989 #if YYERROR_VERBOSE 990 int yyn = yypact_[yystate]; 991 if (yypact_ninf_ < yyn && yyn <= yylast_) 1047 992 { 1048 yyarg[yycount++] = yytname_[yytoken]; 1049 int yyn = yypact_[yystate]; 1050 if (!yy_pact_value_is_default_ (yyn)) 1051 { 1052 /* Start YYX at -YYN if negative to avoid negative indexes in 1053 YYCHECK. In other words, skip the first -YYN actions for 1054 this state because they are default actions. */ 1055 int yyxbegin = yyn < 0 ? -yyn : 0; 1056 /* Stay within bounds of both yycheck and yytname. */ 1057 int yychecklim = yylast_ - yyn + 1; 1058 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; 1059 for (int yyx = yyxbegin; yyx < yyxend; ++yyx) 1060 if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ 1061 && !yy_table_value_is_error_ (yytable_[yyx + yyn])) 1062 { 1063 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1064 { 1065 yycount = 1; 1066 break; 1067 } 1068 else 1069 yyarg[yycount++] = yytname_[yyx]; 1070 } 1071 } 993 /* Start YYX at -YYN if negative to avoid negative indexes in 994 YYCHECK. */ 995 int yyxbegin = yyn < 0 ? -yyn : 0; 996 997 /* Stay within bounds of both yycheck and yytname. */ 998 int yychecklim = yylast_ - yyn + 1; 999 int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; 1000 int count = 0; 1001 for (int x = yyxbegin; x < yyxend; ++x) 1002 if (yycheck_[x + yyn] == x && x != yyterror_) 1003 ++count; 1004 1005 // FIXME: This method of building the message is not compatible 1006 // with internationalization. It should work like yacc.c does it. 1007 // That is, first build a string that looks like this: 1008 // "syntax error, unexpected %s or %s or %s" 1009 // Then, invoke YY_ on this string. 1010 // Finally, use the string as a format to output 1011 // yytname_[tok], etc. 1012 // Until this gets fixed, this message appears in English only. 1013 res = "syntax error, unexpected "; 1014 res += yytnamerr_ (yytname_[tok]); 1015 if (count < 5) 1016 { 1017 count = 0; 1018 for (int x = yyxbegin; x < yyxend; ++x) 1019 if (yycheck_[x + yyn] == x && x != yyterror_) 1020 { 1021 res += (!count++) ? ", expecting " : " or "; 1022 res += yytnamerr_ (yytname_[x]); 1023 } 1024 } 1072 1025 } 1073 1074 char const* yyformat = 0; 1075 switch (yycount) 1076 { 1077 #define YYCASE_(N, S) \ 1078 case N: \ 1079 yyformat = S; \ 1080 break 1081 YYCASE_(0, YY_("syntax error")); 1082 YYCASE_(1, YY_("syntax error, unexpected %s")); 1083 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1084 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1085 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1086 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1087 #undef YYCASE_ 1088 } 1089 1090 // Argument number. 1091 size_t yyi = 0; 1092 for (char const* yyp = yyformat; *yyp; ++yyp) 1093 if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) 1094 { 1095 yyres += yytnamerr_ (yyarg[yyi++]); 1096 ++yyp; 1097 } 1098 else 1099 yyres += *yyp; 1100 return yyres; 1026 else 1027 #endif 1028 res = YY_("syntax error"); 1029 return res; 1101 1030 } 1102 1031 … … 1104 1033 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 1105 1034 STATE-NUM. */ 1106 const signed char EasyMeshParser::yypact_ninf_ = - 48;1035 const signed char EasyMeshParser::yypact_ninf_ = -10; 1107 1036 const signed char 1108 1037 EasyMeshParser::yypact_[] = 1109 1038 { 1110 37, -27, 89, -32, -32, -32, -32, -48, -32, -32,1111 -32, -32, -48, -32, -32, -32, -32, -48, -32, -32,1112 - 48, -32, -32, -32, -32, -32, -32, -32, -32, -32,1113 -32, -32, -32, -32, -32, -48, 5, 13, 37, 37,1114 75, -48, -48, -48, -48, -48, -48, -32, -32, -32,1115 - 32, -48, -48, -48, -48, -48, -48, -48, -48, -48,1116 - 48, -48, -48, -48, -48, -48, -48, -48, -48, -48,1117 - 32, -32, -48, -48, -48, -48, -48, -48, -48, -48,1118 - 48, -48, -48, -32, -32, -32, -32, -48, -48, -48,1119 -48, -48, -25, -48, -48, -48, -48, -48, -48, -48,1120 - 48, -48, -48, -48, -48, -481039 -3, 18, 27, 16, 16, 16, 16, -10, 16, 16, 1040 16, 16, -10, 16, 16, 16, 16, -10, 16, 16, 1041 -10, -10, -10, -10, -10, 16, 16, 16, 16, 16, 1042 16, 16, 16, 16, 16, 16, 16, 16, 16, -10, 1043 40, 48, -3, -3, 79, -10, -10, -10, -10, -10, 1044 -10, 16, 16, 16, 16, -10, -10, -10, -10, -10, 1045 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, 1046 -10, -10, -10, -10, 16, 16, -10, -10, -10, -10, 1047 -10, -10, -10, -10, -10, -10, -10, 16, 16, 16, 1048 16, -10, -10, -10, -10, -10, 5, -10, -10, -10, 1049 -10, -10, -10, -10, -10, -10, -10, -10, -10, -10 1121 1050 }; 1122 1051 1123 /* YYDEFACT[S] -- default r eduction number in state S. Performed when1124 YYTABLE doesn't specify something else to do. Zero means the1125 default is anerror. */1052 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE 1053 doesn't specify something else to do. Zero means the default is an 1054 error. */ 1126 1055 const unsigned char 1127 1056 EasyMeshParser::yydefact_[] = … … 1129 1058 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 1130 1059 0, 0, 34, 0, 0, 0, 0, 35, 0, 0, 1131 36, 0, 0, 0,0, 0, 0, 0, 0, 0,1132 0, 0, 0, 0, 0, 7, 0, 0, 3, 0,1133 5, 9, 11, 12, 13, 60, 15, 0, 0, 0,1134 0, 14, 50, 17, 16, 19, 23, 26, 29, 20,1135 2 4, 27, 30, 21, 25, 28, 31, 22, 32, 18,1136 0, 0, 37, 38, 39, 40, 41, 42, 44, 45,1137 4 6, 47, 48, 0, 0, 0, 0, 49, 43, 1,1138 2, 4, 0, 10, 61, 51, 52, 53, 54, 55,1139 56, 57, 58, 59, 8, 61060 36, 37, 38, 39, 40, 0, 0, 0, 0, 0, 1061 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1062 0, 0, 3, 0, 5, 9, 11, 12, 13, 64, 1063 15, 0, 0, 0, 0, 14, 54, 17, 16, 19, 1064 23, 26, 29, 20, 24, 27, 30, 21, 25, 28, 1065 31, 22, 32, 18, 0, 0, 41, 42, 43, 44, 1066 45, 46, 48, 49, 50, 51, 52, 0, 0, 0, 1067 0, 53, 47, 1, 2, 4, 0, 10, 65, 55, 1068 56, 57, 58, 59, 60, 61, 62, 63, 8, 6 1140 1069 }; 1141 1070 … … 1144 1073 EasyMeshParser::yypgoto_[] = 1145 1074 { 1146 - 48, -48, -19, -48, -48, -48, -48, -15, -48, -48,1147 - 48, 109, -4, -1, 6, -7, 1, -48, -48, -48,1148 - 48, -471075 -10, -10, -4, -10, -10, -10, -10, 9, -10, -10, 1076 -10, 43, 36, 115, 122, 23, 26, -10, -10, -10, 1077 -10, -9 1149 1078 }; 1150 1079 … … 1153 1082 EasyMeshParser::yydefgoto_[] = 1154 1083 { 1155 -1, 36, 37, 38, 39, 105, 40, 41, 42, 43,1156 4 4, 48, 49, 50, 70, 71, 72, 84, 85, 86,1157 87, 521084 -1, 40, 41, 42, 43, 109, 44, 45, 46, 47, 1085 48, 52, 53, 54, 74, 75, 76, 88, 89, 90, 1086 91, 56 1158 1087 }; 1159 1088 1160 1089 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 1161 1090 positive, shift that token. If negative, reduce the rule which 1162 number is the opposite. If YYTABLE_NINF_, syntax error. */1091 number is the opposite. If zero, do what YYDEFACT says. */ 1163 1092 const signed char EasyMeshParser::yytable_ninf_ = -1; 1164 1093 const unsigned char 1165 1094 EasyMeshParser::yytable_[] = 1166 1095 { 1167 94, 95, 96, 97, 57, 89, 45, 51, 54, 61, 1168 47, 45, 46, 90, 65, 47, 104, 67, 68, 91, 1169 92, 78, 73, 98, 99, 93, 77, 81, 82, 80, 1170 74, 75, 76, 88, 83, 79, 100, 101, 102, 103, 1171 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1096 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1172 1097 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1173 1098 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1174 31, 32, 33, 34, 0, 0, 0, 35, 1, 2, 1175 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1176 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1177 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1178 33, 34, 55, 56, 0, 58, 0, 59, 60, 0, 1179 62, 0, 63, 64, 0, 66, 0, 45, 53, 0, 1180 69, 47 1099 31, 32, 33, 34, 35, 36, 37, 38, 95, 96, 1100 93, 39, 98, 99, 100, 101, 59, 60, 94, 62, 1101 108, 63, 64, 97, 66, 82, 67, 68, 49, 70, 1102 49, 50, 51, 87, 51, 102, 103, 0, 73, 49, 1103 57, 85, 86, 51, 0, 0, 0, 0, 104, 105, 1104 106, 107, 1, 2, 3, 4, 5, 6, 7, 8, 1105 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1106 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 1107 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 1108 61, 0, 0, 55, 58, 65, 0, 0, 0, 0, 1109 69, 0, 0, 71, 72, 0, 0, 0, 0, 0, 1110 0, 0, 77, 0, 0, 0, 81, 0, 0, 84, 1111 78, 79, 80, 92, 0, 83 1181 1112 }; 1182 1113 … … 1185 1116 EasyMeshParser::yycheck_[] = 1186 1117 { 1187 47, 48, 49, 50, 5, 0, 38, 1, 2, 10, 1188 42, 38, 39, 0, 15, 42, 41, 18, 19, 38, 1189 39, 28, 23, 70, 71, 40, 27, 31, 32, 30, 1190 24, 25, 26, 34, 33, 29, 83, 84, 85, 86, 1191 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1118 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1192 1119 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 1193 1120 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 1194 33, 34, 35, 36, -1, -1, -1, 40, 3, 4, 1195 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1196 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 1197 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 1198 35, 36, 3, 4, -1, 6, -1, 8, 9, -1, 1199 11, -1, 13, 14, -1, 16, -1, 38, 39, -1, 1200 21, 42 1121 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 1122 0, 44, 51, 52, 53, 54, 3, 4, 0, 6, 1123 45, 8, 9, 44, 11, 32, 13, 14, 42, 16, 1124 42, 43, 46, 37, 46, 74, 75, -1, 25, 42, 1125 43, 35, 36, 46, -1, -1, -1, -1, 87, 88, 1126 89, 90, 3, 4, 5, 6, 7, 8, 9, 10, 1127 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 1128 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1129 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 1130 5, -1, -1, 1, 2, 10, -1, -1, -1, -1, 1131 15, -1, -1, 18, 19, -1, -1, -1, -1, -1, 1132 -1, -1, 27, -1, -1, -1, 31, -1, -1, 34, 1133 28, 29, 30, 38, -1, 33 1201 1134 }; 1202 1135 … … 1209 1142 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 1210 1143 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 1211 32, 33, 34, 35, 36, 40, 44, 45, 46, 47,1212 4 9, 50, 51, 52, 53, 38, 39, 42, 54, 55,1213 56, 57, 64, 39, 57, 54, 54, 56, 54, 54,1214 5 4, 56, 54, 54, 54, 56, 54, 56, 56, 54,1215 5 7, 58, 59, 56, 57, 57, 57, 56, 58, 57,1216 56, 55, 55, 59, 60, 61, 62, 63, 56, 0,1217 0, 45, 45, 50, 64, 64, 64, 64, 64, 64,1218 6 4, 64, 64, 64, 41, 481144 32, 33, 34, 35, 36, 37, 38, 39, 40, 44, 1145 48, 49, 50, 51, 53, 54, 55, 56, 57, 42, 1146 43, 46, 58, 59, 60, 61, 68, 43, 61, 58, 1147 58, 60, 58, 58, 58, 60, 58, 58, 58, 60, 1148 58, 60, 60, 58, 61, 62, 63, 60, 61, 61, 1149 61, 60, 62, 61, 60, 59, 59, 63, 64, 65, 1150 66, 67, 60, 0, 0, 49, 49, 54, 68, 68, 1151 68, 68, 68, 68, 68, 68, 68, 68, 45, 52 1219 1152 }; 1220 1153 … … 1229 1162 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 1230 1163 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 1231 91, 93, 451164 295, 296, 297, 298, 91, 93, 45 1232 1165 }; 1233 1166 #endif … … 1237 1170 EasyMeshParser::yyr1_[] = 1238 1171 { 1239 0, 4 3, 44, 45, 45, 46, 46, 47, 48, 49,1240 49, 50, 50, 50, 51, 51, 51, 51, 52, 52,1241 5 2, 52, 52, 52, 52, 52, 52, 52, 52, 52,1242 5 2, 52, 52, 52, 52, 52, 52, 53, 53, 53,1243 5 3, 53, 53, 53, 53, 53, 53, 53, 53, 53,1244 5 4, 55, 56, 57, 58, 59, 60, 61, 62, 63,1245 64, 6 41172 0, 47, 48, 49, 49, 50, 50, 51, 52, 53, 1173 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 1174 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 1175 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 1176 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 1177 57, 57, 57, 57, 58, 59, 60, 61, 62, 63, 1178 64, 65, 66, 67, 68, 68 1246 1179 }; 1247 1180 … … 1253 1186 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1254 1187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1255 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1256 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1188 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1257 1189 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1258 1, 2 1190 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1191 2, 2, 2, 2, 1, 2 1259 1192 }; 1260 1193 … … 1269 1202 "T_ROTATEY", "T_TAPERY", "T_SCALEY", "T_MIRRORY", "T_TRANSLATEZ", 1270 1203 "T_ROTATEZ", "T_TAPERZ", "T_SCALEZ", "T_MIRRORZ", "T_TRANSLATE", 1271 "T_SCALE", "T_TOGGLESCALEWINDING", "T_CHAMFER", "T_CYLINDER", "T_BOX", 1204 "T_SCALE", "T_TOGGLESCALEWINDING", "T_CSGUNION", "T_CSGSUBSTRACT", 1205 "T_CSGAND", "T_CSGXOR", "T_CHAMFER", "T_CYLINDER", "T_BOX", 1272 1206 "T_SMOOTHCHAMFBOX", "T_FLATCHAMFBOX", "T_SPHERE", "T_CAPSULE", "T_STAR", 1273 1207 "T_EXPANDEDSTAR", "T_DISC", "T_TRIANGLE", "T_QUAD", "T_COG", "T_TORUS", … … 1286 1220 EasyMeshParser::yyrhs_[] = 1287 1221 { 1288 44, 0, -1, 45, 0, -1, 46, -1, 46, 45, 1289 -1, 49, -1, 47, 45, 48, -1, 40, -1, 41, 1290 -1, 50, -1, 49, 50, -1, 51, -1, 52, -1, 1291 53, -1, 3, 57, -1, 3, 39, -1, 4, 57, 1292 -1, 4, 39, -1, 23, 54, -1, 5, 54, -1, 1293 10, 54, -1, 15, 54, -1, 20, 56, -1, 6, 1294 54, -1, 11, 54, -1, 16, 54, -1, 7, 56, 1295 -1, 12, 56, -1, 17, 56, -1, 8, 54, -1, 1296 13, 54, -1, 18, 54, -1, 21, 56, -1, 9, 1297 -1, 14, -1, 19, -1, 22, -1, 24, 59, -1, 1298 25, 56, -1, 26, 57, -1, 27, 57, -1, 28, 1299 57, -1, 29, 56, -1, 36, 56, -1, 30, 58, 1300 -1, 31, 57, -1, 32, 56, -1, 33, 55, -1, 1301 34, 55, -1, 35, 63, -1, 64, -1, 54, 64, 1302 -1, 55, 64, -1, 56, 64, -1, 57, 64, -1, 1303 58, 64, -1, 59, 64, -1, 60, 64, -1, 61, 1304 64, -1, 62, 64, -1, 38, -1, 42, 64, -1 1222 48, 0, -1, 49, 0, -1, 50, -1, 50, 49, 1223 -1, 53, -1, 51, 49, 52, -1, 44, -1, 45, 1224 -1, 54, -1, 53, 54, -1, 55, -1, 56, -1, 1225 57, -1, 3, 61, -1, 3, 43, -1, 4, 61, 1226 -1, 4, 43, -1, 27, 58, -1, 5, 58, -1, 1227 10, 58, -1, 15, 58, -1, 20, 60, -1, 6, 1228 58, -1, 11, 58, -1, 16, 58, -1, 7, 60, 1229 -1, 12, 60, -1, 17, 60, -1, 8, 58, -1, 1230 13, 58, -1, 18, 58, -1, 21, 60, -1, 9, 1231 -1, 14, -1, 19, -1, 22, -1, 23, -1, 24, 1232 -1, 25, -1, 26, -1, 28, 63, -1, 29, 60, 1233 -1, 30, 61, -1, 31, 61, -1, 32, 61, -1, 1234 33, 60, -1, 40, 60, -1, 34, 62, -1, 35, 1235 61, -1, 36, 60, -1, 37, 59, -1, 38, 59, 1236 -1, 39, 67, -1, 68, -1, 58, 68, -1, 59, 1237 68, -1, 60, 68, -1, 61, 68, -1, 62, 68, 1238 -1, 63, 68, -1, 64, 68, -1, 65, 68, -1, 1239 66, 68, -1, 42, -1, 46, 68, -1 1305 1240 }; 1306 1241 … … 1313 1248 23, 26, 28, 30, 32, 35, 38, 41, 44, 47, 1314 1249 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 1315 80, 83, 86, 89, 91, 93, 95, 97, 100, 103,1316 10 6, 109, 112, 115, 118, 121, 124, 127, 130, 133,1317 13 6, 138, 141, 144, 147, 150, 153, 156, 159, 162,1318 16 5, 1671250 80, 83, 86, 89, 91, 93, 95, 97, 99, 101, 1251 103, 105, 108, 111, 114, 117, 120, 123, 126, 129, 1252 132, 135, 138, 141, 144, 146, 149, 152, 155, 158, 1253 161, 164, 167, 170, 173, 175 1319 1254 }; 1320 1255 … … 1323 1258 EasyMeshParser::yyrline_[] = 1324 1259 { 1325 0, 7 5, 75, 79, 80, 84, 85, 89, 93, 97,1326 9 8, 102, 103, 104, 108, 109, 112, 113, 119, 120,1327 12 1, 122, 123, 124, 125, 126, 127, 128, 129, 130,1328 13 1, 132, 133, 134, 135, 136, 137, 141, 144, 145,1329 14 7, 149, 151, 152, 153, 155, 157, 158, 159, 160,1330 16 5, 166, 167, 168, 169, 170, 171, 172, 173, 174,1331 17 7, 1781260 0, 76, 76, 80, 81, 85, 86, 90, 94, 98, 1261 99, 103, 104, 105, 109, 110, 113, 114, 120, 121, 1262 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 1263 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 1264 142, 146, 149, 150, 152, 154, 156, 157, 158, 160, 1265 162, 163, 164, 165, 170, 171, 172, 173, 174, 175, 1266 176, 177, 178, 179, 182, 183 1332 1267 }; 1333 1268 … … 1373 1308 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1374 1309 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1375 2, 2, 2, 2, 2, 4 2, 2, 2, 2, 2,1376 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1377 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1378 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1380 2, 4 0, 2, 41, 2, 2, 2, 2, 2, 2,1310 2, 2, 2, 2, 2, 46, 2, 2, 2, 2, 1311 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1312 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1313 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1314 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1315 2, 44, 2, 45, 2, 2, 2, 2, 2, 2, 1381 1316 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1382 1317 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, … … 1398 1333 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 1399 1334 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 1400 35, 36, 37, 38, 39 1335 35, 36, 37, 38, 39, 40, 41, 42, 43 1401 1336 }; 1402 1337 if ((unsigned int) t <= yyuser_token_number_max_) … … 1407 1342 1408 1343 const int EasyMeshParser::yyeof_ = 0; 1409 const int EasyMeshParser::yylast_ = 1 31;1344 const int EasyMeshParser::yylast_ = 155; 1410 1345 const int EasyMeshParser::yynnts_ = 22; 1411 1346 const int EasyMeshParser::yyempty_ = -2; 1412 const int EasyMeshParser::yyfinal_ = 89;1347 const int EasyMeshParser::yyfinal_ = 93; 1413 1348 const int EasyMeshParser::yyterror_ = 1; 1414 1349 const int EasyMeshParser::yyerrcode_ = 256; 1415 const int EasyMeshParser::yyntokens_ = 4 3;1416 1417 const unsigned int EasyMeshParser::yyuser_token_number_max_ = 29 4;1350 const int EasyMeshParser::yyntokens_ = 47; 1351 1352 const unsigned int EasyMeshParser::yyuser_token_number_max_ = 298; 1418 1353 const EasyMeshParser::token_number_type EasyMeshParser::yyundef_token_ = 2; 1419 1354 … … 1421 1356 } // lol 1422 1357 1423 /* Line 1 136of lalr1.cc */1424 #line 1 425"generated/easymesh-parser.cpp"1425 1426 1427 /* Line 1 138of lalr1.cc */1428 #line 18 1"easymesh/easymesh-parser.y"1358 /* Line 1053 of lalr1.cc */ 1359 #line 1360 "generated/easymesh-parser.cpp" 1360 1361 1362 /* Line 1055 of lalr1.cc */ 1363 #line 186 "easymesh/easymesh-parser.y" 1429 1364 1430 1365 -
trunk/src/generated/easymesh-parser.h
r2152 r2226 1 /* A Bison parser, made by GNU Bison 2. 5. */1 /* A Bison parser, made by GNU Bison 2.4.2. */ 2 2 3 3 /* Skeleton interface for Bison LALR(1) parsers in C++ 4 4 5 Copyright (C) 2002-201 1Free Software Foundation, Inc.5 Copyright (C) 2002-2010 Free Software Foundation, Inc. 6 6 7 7 This program is free software: you can redistribute it and/or modify … … 41 41 #include <iostream> 42 42 #include "stack.hh" 43 44 45 namespace lol { 46 47 /* Line 34 of lalr1.cc */ 48 #line 49 "generated/easymesh-parser.h" 49 class position; 50 class location; 51 52 } // lol 53 54 /* Line 34 of lalr1.cc */ 55 #line 56 "generated/easymesh-parser.h" 56 43 57 #include "location.hh" 44 58 … … 61 75 #endif 62 76 77 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 78 If N is 0, then set CURRENT to the empty location which ends 79 the previous symbol: RHS[0] (always defined). */ 80 81 #ifndef YYLLOC_DEFAULT 82 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 83 do { \ 84 if (N) \ 85 { \ 86 (Current).begin = (Rhs)[1].begin; \ 87 (Current).end = (Rhs)[N].end; \ 88 } \ 89 else \ 90 { \ 91 (Current).begin = (Current).end = (Rhs)[0].end; \ 92 } \ 93 } while (false) 94 #endif 95 63 96 64 97 namespace lol { 65 98 66 /* Line 3 5of lalr1.cc */67 #line 68"generated/easymesh-parser.h"99 /* Line 34 of lalr1.cc */ 100 #line 101 "generated/easymesh-parser.h" 68 101 69 102 /// A Bison parser. … … 76 109 { 77 110 78 /* Line 3 5of lalr1.cc */111 /* Line 34 of lalr1.cc */ 79 112 #line 36 "easymesh/easymesh-parser.y" 80 113 … … 86 119 87 120 88 /* Line 3 5of lalr1.cc */89 #line 90"generated/easymesh-parser.h"121 /* Line 34 of lalr1.cc */ 122 #line 123 "generated/easymesh-parser.h" 90 123 }; 91 124 #else … … 120 153 T_SCALE = 276, 121 154 T_TOGGLESCALEWINDING = 277, 122 T_CHAMFER = 278, 123 T_CYLINDER = 279, 124 T_BOX = 280, 125 T_SMOOTHCHAMFBOX = 281, 126 T_FLATCHAMFBOX = 282, 127 T_SPHERE = 283, 128 T_CAPSULE = 284, 129 T_STAR = 285, 130 T_EXPANDEDSTAR = 286, 131 T_DISC = 287, 132 T_TRIANGLE = 288, 133 T_QUAD = 289, 134 T_COG = 290, 135 T_TORUS = 291, 136 T_ERROR = 292, 137 NUMBER = 293, 138 COLOR = 294 155 T_CSGUNION = 278, 156 T_CSGSUBSTRACT = 279, 157 T_CSGAND = 280, 158 T_CSGXOR = 281, 159 T_CHAMFER = 282, 160 T_CYLINDER = 283, 161 T_BOX = 284, 162 T_SMOOTHCHAMFBOX = 285, 163 T_FLATCHAMFBOX = 286, 164 T_SPHERE = 287, 165 T_CAPSULE = 288, 166 T_STAR = 289, 167 T_EXPANDEDSTAR = 290, 168 T_DISC = 291, 169 T_TRIANGLE = 292, 170 T_QUAD = 293, 171 T_COG = 294, 172 T_TORUS = 295, 173 T_ERROR = 296, 174 NUMBER = 297, 175 COLOR = 298 139 176 }; 140 177 … … 210 247 location_stack_type yylocation_stack_; 211 248 212 /// Whether the given \c yypact_ value indicates a defaulted state.213 /// \param yyvalue the value to check214 static bool yy_pact_value_is_default_ (int yyvalue);215 216 /// Whether the given \c yytable_ value indicates a syntax error.217 /// \param yyvalue the value to check218 static bool yy_table_value_is_error_ (int yyvalue);219 220 249 /// Internal symbol numbers. 221 250 typedef unsigned char token_number_type; … … 225 254 static const signed char yypact_ninf_; 226 255 227 /// For a state, default r eduction number.256 /// For a state, default rule to reduce. 228 257 /// Unless\a yytable_ specifies something else to do. 229 258 /// Zero means the default is an error. … … 256 285 #endif 257 286 287 #if YYERROR_VERBOSE 258 288 /// Convert the symbol name \a n to a form suitable for a diagnostic. 259 static std::string yytnamerr_ (const char *n); 289 virtual std::string yytnamerr_ (const char *n); 290 #endif 260 291 261 292 #if YYDEBUG … … 315 346 } // lol 316 347 317 /* Line 3 5of lalr1.cc */318 #line 3 19"generated/easymesh-parser.h"348 /* Line 34 of lalr1.cc */ 349 #line 350 "generated/easymesh-parser.h" 319 350 320 351 -
trunk/src/generated/easymesh-scanner.cpp
r2183 r2226 331 331 (yy_c_buf_p) = yy_cp; 332 332 333 #define YY_NUM_RULES 46334 #define YY_END_OF_BUFFER 47333 #define YY_NUM_RULES 50 334 #define YY_END_OF_BUFFER 51 335 335 /* This struct is not used in this scanner, 336 336 but its presence is necessary. */ … … 340 340 flex_int32_t yy_nxt; 341 341 }; 342 static yyconst flex_int16_t yy_accept[ 75] =342 static yyconst flex_int16_t yy_accept[81] = 343 343 { 0, 344 0, 0, 47, 45, 44, 43, 45, 45, 40, 45,345 39, 41, 42, 45, 45, 45, 45, 17, 7, 0,346 0, 39, 39, 0, 22, 23, 26, 0, 0, 29,347 3 0, 33, 3, 19, 20, 21, 8, 9, 10, 1,348 14, 15, 16, 0, 0, 4, 5, 6, 0, 0,349 39, 0, 25, 27, 0, 0, 0, 34, 2, 11,350 12, 13, 18, 35, 24, 28, 31, 32, 36, 0,351 37, 0, 38, 0344 0, 0, 51, 49, 48, 47, 49, 49, 44, 49, 345 43, 45, 46, 49, 49, 49, 49, 17, 7, 0, 346 0, 43, 43, 0, 26, 27, 30, 0, 0, 33, 347 34, 37, 3, 0, 19, 20, 21, 8, 9, 10, 348 1, 14, 15, 16, 0, 0, 4, 5, 6, 0, 349 0, 43, 0, 29, 31, 0, 0, 0, 38, 0, 350 2, 11, 12, 13, 18, 39, 28, 32, 35, 36, 351 24, 23, 22, 25, 40, 0, 41, 0, 42, 0 352 352 } ; 353 353 … … 366 366 367 367 17, 18, 19, 20, 1, 1, 1, 1, 21, 1, 368 22, 23, 24, 25, 26, 27, 1, 1, 28, 29,369 3 0, 31, 1, 1, 1, 1, 1, 1, 1, 1,368 22, 23, 24, 25, 26, 27, 28, 1, 29, 30, 369 31, 32, 1, 1, 1, 1, 1, 1, 1, 1, 370 370 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 371 371 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … … 384 384 } ; 385 385 386 static yyconst flex_int32_t yy_meta[3 2] =386 static yyconst flex_int32_t yy_meta[33] = 387 387 { 0, 388 388 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 389 389 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 390 390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 391 1 391 1, 1 392 392 } ; 393 393 394 static yyconst flex_int16_t yy_base[8 3] =394 static yyconst flex_int16_t yy_base[89] = 395 395 { 0, 396 0, 0, 10 2, 103, 103, 103, 0, 25, 27, 93,397 29, 103, 103, 33, 80, 11, 14, 23, 48, 0,398 9 1, 48, 54, 61, 103, 57, 103, 72, 82, 103,399 57, 74, 103, 103, 103, 103, 103, 103, 103, 81,400 103, 103, 103, 52, 66, 103, 103, 103, 0, 85,401 84, 68, 103, 103, 76, 75, 68, 103, 103, 103,402 1 03, 103, 103, 0, 103, 103, 103, 103, 0,0,403 0, 0, 103, 103, 85, 84, 83, 82, 73, 71,404 66, 61396 0, 0, 109, 110, 110, 110, 0, 26, 28, 100, 397 30, 110, 110, 34, 19, 11, 23, 41, 61, 0, 398 99, 58, 59, 72, 110, 44, 110, 80, 90, 110, 399 47, 82, 110, 84, 110, 110, 110, 110, 110, 110, 400 88, 110, 110, 110, 51, 71, 110, 110, 110, 0, 401 90, 88, 72, 110, 110, 80, 76, 69, 110, 71, 402 110, 110, 110, 110, 110, 0, 110, 110, 110, 110, 403 110, 110, 110, 110, 0, 0, 0, 0, 110, 110, 404 86, 84, 83, 77, 62, 57, 44, 42 405 405 } ; 406 406 407 static yyconst flex_int16_t yy_def[8 3] =407 static yyconst flex_int16_t yy_def[89] = 408 408 { 0, 409 74, 1, 74, 74, 74, 74, 75, 74, 74, 74,410 74, 74, 74, 74, 74, 74, 74, 74, 74, 76,411 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,412 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,413 74, 74, 74, 74, 74, 74, 74, 74, 77, 74,414 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,415 74, 74, 74, 78, 74, 74, 74, 74, 79, 80,416 8 1, 82, 74, 0, 74, 74, 74, 74, 74, 74,417 74, 74409 80, 1, 80, 80, 80, 80, 81, 80, 80, 80, 410 80, 80, 80, 80, 80, 80, 80, 80, 80, 82, 411 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 412 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 413 80, 80, 80, 80, 80, 80, 80, 80, 80, 83, 414 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 415 80, 80, 80, 80, 80, 84, 80, 80, 80, 80, 416 80, 80, 80, 80, 85, 86, 87, 88, 80, 0, 417 80, 80, 80, 80, 80, 80, 80, 80 418 418 } ; 419 419 420 static yyconst flex_int16_t yy_nxt[1 35] =420 static yyconst flex_int16_t yy_nxt[143] = 421 421 { 0, 422 422 4, 5, 6, 7, 8, 9, 10, 11, 4, 4, 423 423 12, 13, 14, 4, 15, 4, 4, 4, 4, 4, 424 424 16, 4, 4, 4, 17, 18, 19, 4, 4, 4, 425 4, 21, 22, 21, 22, 21, 22, 40, 24, 34, 426 35, 36, 37, 38, 39, 24, 25, 26, 27, 28, 427 29, 41, 42, 43, 21, 22, 30, 24, 31, 32, 428 44, 23, 73, 24, 24, 50, 50, 72, 51, 52, 429 24, 56, 71, 45, 70, 53, 46, 47, 48, 57, 430 60, 61, 62, 69, 64, 49, 20, 68, 67, 66, 431 65, 51, 51, 63, 59, 58, 55, 54, 23, 33, 432 433 23, 74, 3, 74, 74, 74, 74, 74, 74, 74, 434 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 435 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 436 74, 74, 74, 74 425 4, 4, 21, 22, 21, 22, 21, 22, 33, 24, 426 35, 36, 37, 79, 34, 78, 24, 25, 26, 27, 427 28, 29, 38, 39, 40, 41, 53, 30, 77, 31, 428 32, 57, 54, 76, 21, 22, 23, 24, 24, 58, 429 42, 43, 44, 45, 24, 24, 51, 51, 75, 52, 430 62, 63, 64, 71, 66, 50, 46, 20, 70, 69, 431 47, 48, 49, 68, 67, 52, 72, 52, 73, 65, 432 433 74, 61, 60, 59, 56, 55, 23, 23, 80, 3, 434 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 435 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 436 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 437 80, 80 437 438 } ; 438 439 439 static yyconst flex_int16_t yy_chk[1 35] =440 static yyconst flex_int16_t yy_chk[143] = 440 441 { 0, 441 442 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 442 443 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 443 444 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 444 1, 8, 8, 9, 9, 11, 11, 18, 11, 16, 445 16, 16, 17, 17, 17, 11, 14, 14, 14, 14, 446 14, 18, 18, 18, 22, 22, 14, 22, 14, 14, 447 19, 23, 82, 23, 22, 24, 24, 81, 24, 26, 448 23, 31, 80, 19, 79, 26, 19, 19, 19, 31, 449 44, 44, 44, 78, 77, 76, 75, 57, 56, 55, 450 52, 51, 50, 45, 40, 32, 29, 28, 21, 15, 451 452 10, 3, 74, 74, 74, 74, 74, 74, 74, 74, 453 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 454 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 455 74, 74, 74, 74 445 1, 1, 8, 8, 9, 9, 11, 11, 15, 11, 446 16, 16, 16, 88, 15, 87, 11, 14, 14, 14, 447 14, 14, 17, 17, 17, 18, 26, 14, 86, 14, 448 14, 31, 26, 85, 22, 22, 23, 22, 23, 31, 449 18, 18, 18, 19, 22, 23, 24, 24, 84, 24, 450 45, 45, 45, 60, 83, 82, 19, 81, 58, 57, 451 19, 19, 19, 56, 53, 52, 60, 51, 60, 46, 452 453 60, 41, 34, 32, 29, 28, 21, 10, 3, 80, 454 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 455 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 456 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 457 80, 80 456 458 } ; 457 459 … … 468 470 // Lol Engine 469 471 // 470 // Copyright: (c) 2010-201 2Sam Hocevar <sam@hocevar.net>471 // (c) 2009-201 2Cédric Lecacheur <jordx@free.fr>472 // (c) 2009-201 2 BenjaminHuet <huet.benjamin@gmail.com>472 // Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> 473 // (c) 2009-2013 Cédric Lecacheur <jordx@free.fr> 474 // (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 473 475 // This program is free software; you can redistribute it and/or 474 476 // modify it under the terms of the Do What The Fuck You Want To … … 502 504 #define YY_NO_UNISTD_H 503 505 #define YY_USER_ACTION yylloc->columns(yyleng); 504 #line 50 5"generated/easymesh-scanner.cpp"506 #line 507 "generated/easymesh-scanner.cpp" 505 507 506 508 #define INITIAL 0 … … 615 617 616 618 617 #line 6 18"generated/easymesh-scanner.cpp"619 #line 620 "generated/easymesh-scanner.cpp" 618 620 619 621 if ( !(yy_init) ) … … 668 670 { 669 671 yy_current_state = (int) yy_def[yy_current_state]; 670 if ( yy_current_state >= 75)672 if ( yy_current_state >= 81 ) 671 673 yy_c = yy_meta[(unsigned int) yy_c]; 672 674 } … … 674 676 ++yy_cp; 675 677 } 676 while ( yy_current_state != 74);678 while ( yy_current_state != 80 ); 677 679 yy_cp = (yy_last_accepting_cpos); 678 680 yy_current_state = (yy_last_accepting_state); … … 802 804 YY_RULE_SETUP 803 805 #line 74 "easymesh/easymesh-scanner.l" 806 { return token::T_CSGUNION; } 807 YY_BREAK 808 case 23: 809 YY_RULE_SETUP 810 #line 75 "easymesh/easymesh-scanner.l" 811 { return token::T_CSGSUBSTRACT; } 812 YY_BREAK 813 case 24: 814 YY_RULE_SETUP 815 #line 76 "easymesh/easymesh-scanner.l" 816 { return token::T_CSGAND; } 817 YY_BREAK 818 case 25: 819 YY_RULE_SETUP 820 #line 77 "easymesh/easymesh-scanner.l" 821 { return token::T_CSGXOR; } 822 YY_BREAK 823 case 26: 824 YY_RULE_SETUP 825 #line 79 "easymesh/easymesh-scanner.l" 804 826 { return token::T_BOX; } 805 827 YY_BREAK 806 case 2 3:807 YY_RULE_SETUP 808 #line 75"easymesh/easymesh-scanner.l"828 case 27: 829 YY_RULE_SETUP 830 #line 80 "easymesh/easymesh-scanner.l" 809 831 { return token::T_CYLINDER; } 810 832 YY_BREAK 811 case 2 4:812 YY_RULE_SETUP 813 #line 76"easymesh/easymesh-scanner.l"833 case 28: 834 YY_RULE_SETUP 835 #line 81 "easymesh/easymesh-scanner.l" 814 836 { return token::T_CAPSULE; } 815 837 YY_BREAK 816 case 2 5:817 YY_RULE_SETUP 818 #line 77"easymesh/easymesh-scanner.l"838 case 29: 839 YY_RULE_SETUP 840 #line 82 "easymesh/easymesh-scanner.l" 819 841 { return token::T_COG; } 820 842 YY_BREAK 821 case 26:822 YY_RULE_SETUP 823 #line 78"easymesh/easymesh-scanner.l"843 case 30: 844 YY_RULE_SETUP 845 #line 83 "easymesh/easymesh-scanner.l" 824 846 { return token::T_DISC; } 825 847 YY_BREAK 826 case 27:827 YY_RULE_SETUP 828 #line 79"easymesh/easymesh-scanner.l"848 case 31: 849 YY_RULE_SETUP 850 #line 84 "easymesh/easymesh-scanner.l" 829 851 { return token::T_EXPANDEDSTAR; } 830 852 YY_BREAK 831 case 28:832 YY_RULE_SETUP 833 #line 8 0"easymesh/easymesh-scanner.l"853 case 32: 854 YY_RULE_SETUP 855 #line 85 "easymesh/easymesh-scanner.l" 834 856 { return token::T_FLATCHAMFBOX; } 835 857 YY_BREAK 836 case 29:837 YY_RULE_SETUP 838 #line 8 1"easymesh/easymesh-scanner.l"858 case 33: 859 YY_RULE_SETUP 860 #line 86 "easymesh/easymesh-scanner.l" 839 861 { return token::T_QUAD; } 840 862 YY_BREAK 841 case 3 0:842 YY_RULE_SETUP 843 #line 8 2"easymesh/easymesh-scanner.l"863 case 34: 864 YY_RULE_SETUP 865 #line 87 "easymesh/easymesh-scanner.l" 844 866 { return token::T_STAR; } 845 867 YY_BREAK 846 case 3 1:847 YY_RULE_SETUP 848 #line 8 3"easymesh/easymesh-scanner.l"868 case 35: 869 YY_RULE_SETUP 870 #line 88 "easymesh/easymesh-scanner.l" 849 871 { return token::T_SMOOTHCHAMFBOX; } 850 872 YY_BREAK 851 case 3 2:852 YY_RULE_SETUP 853 #line 8 4"easymesh/easymesh-scanner.l"873 case 36: 874 YY_RULE_SETUP 875 #line 89 "easymesh/easymesh-scanner.l" 854 876 { return token::T_SPHERE; } 855 877 YY_BREAK 856 case 3 3:857 YY_RULE_SETUP 858 #line 85"easymesh/easymesh-scanner.l"878 case 37: 879 YY_RULE_SETUP 880 #line 90 "easymesh/easymesh-scanner.l" 859 881 { return token::T_TRIANGLE; } 860 882 YY_BREAK 861 case 3 4:862 YY_RULE_SETUP 863 #line 86"easymesh/easymesh-scanner.l"883 case 38: 884 YY_RULE_SETUP 885 #line 91 "easymesh/easymesh-scanner.l" 864 886 { return token::T_TORUS; } 865 887 YY_BREAK 866 case 3 5:867 YY_RULE_SETUP 868 #line 88"easymesh/easymesh-scanner.l"888 case 39: 889 YY_RULE_SETUP 890 #line 93 "easymesh/easymesh-scanner.l" 869 891 { 870 892 uint32_t tmp = std::strtol(yytext + 1, NULL, 16); … … 875 897 return token::COLOR; } 876 898 YY_BREAK 877 case 36:878 YY_RULE_SETUP 879 #line 95"easymesh/easymesh-scanner.l"899 case 40: 900 YY_RULE_SETUP 901 #line 100 "easymesh/easymesh-scanner.l" 880 902 { 881 903 uint32_t tmp = std::strtol(yytext + 1, NULL, 16); … … 886 908 return token::COLOR; } 887 909 YY_BREAK 888 case 37:889 YY_RULE_SETUP 890 #line 10 2"easymesh/easymesh-scanner.l"910 case 41: 911 YY_RULE_SETUP 912 #line 107 "easymesh/easymesh-scanner.l" 891 913 { 892 914 yylval->u32val = 0xffu … … 894 916 return token::COLOR; } 895 917 YY_BREAK 896 case 38:897 YY_RULE_SETUP 898 #line 1 06"easymesh/easymesh-scanner.l"918 case 42: 919 YY_RULE_SETUP 920 #line 111 "easymesh/easymesh-scanner.l" 899 921 { 900 922 yylval->u32val = (uint32_t)std::strtol(yytext + 1, NULL, 16); 901 923 return token::COLOR; } 902 924 YY_BREAK 903 case 39:904 YY_RULE_SETUP 905 #line 1 09"easymesh/easymesh-scanner.l"925 case 43: 926 YY_RULE_SETUP 927 #line 114 "easymesh/easymesh-scanner.l" 906 928 { 907 929 yylval->fval = std::atof(yytext); return token::NUMBER; } 908 930 YY_BREAK 909 case 4 0:910 YY_RULE_SETUP 911 #line 11 1"easymesh/easymesh-scanner.l"931 case 44: 932 YY_RULE_SETUP 933 #line 116 "easymesh/easymesh-scanner.l" 912 934 { return token_type('-'); } 913 935 YY_BREAK 914 case 4 1:915 YY_RULE_SETUP 916 #line 11 2"easymesh/easymesh-scanner.l"936 case 45: 937 YY_RULE_SETUP 938 #line 117 "easymesh/easymesh-scanner.l" 917 939 { return token_type('['); } 918 940 YY_BREAK 919 case 4 2:920 YY_RULE_SETUP 921 #line 11 3"easymesh/easymesh-scanner.l"941 case 46: 942 YY_RULE_SETUP 943 #line 118 "easymesh/easymesh-scanner.l" 922 944 { return token_type(']'); } 923 945 YY_BREAK 924 case 4 3:925 YY_RULE_SETUP 926 #line 11 4"easymesh/easymesh-scanner.l"946 case 47: 947 YY_RULE_SETUP 948 #line 119 "easymesh/easymesh-scanner.l" 927 949 { /* ignore this */ } 928 950 YY_BREAK 929 case 4 4:930 /* rule 4 4can match eol */931 YY_RULE_SETUP 932 #line 1 15"easymesh/easymesh-scanner.l"951 case 48: 952 /* rule 48 can match eol */ 953 YY_RULE_SETUP 954 #line 120 "easymesh/easymesh-scanner.l" 933 955 { /* ignore this */ } 934 956 YY_BREAK 935 case 4 5:936 YY_RULE_SETUP 937 #line 1 16"easymesh/easymesh-scanner.l"957 case 49: 958 YY_RULE_SETUP 959 #line 121 "easymesh/easymesh-scanner.l" 938 960 { return token::T_ERROR; } 939 961 YY_BREAK 940 case 46:941 YY_RULE_SETUP 942 #line 1 18"easymesh/easymesh-scanner.l"962 case 50: 963 YY_RULE_SETUP 964 #line 123 "easymesh/easymesh-scanner.l" 943 965 ECHO; 944 966 YY_BREAK 945 #line 9 46"generated/easymesh-scanner.cpp"967 #line 968 "generated/easymesh-scanner.cpp" 946 968 case YY_STATE_EOF(INITIAL): 947 969 yyterminate(); … … 1325 1347 { 1326 1348 yy_current_state = (int) yy_def[yy_current_state]; 1327 if ( yy_current_state >= 75)1349 if ( yy_current_state >= 81 ) 1328 1350 yy_c = yy_meta[(unsigned int) yy_c]; 1329 1351 } … … 1353 1375 { 1354 1376 yy_current_state = (int) yy_def[yy_current_state]; 1355 if ( yy_current_state >= 75)1377 if ( yy_current_state >= 81 ) 1356 1378 yy_c = yy_meta[(unsigned int) yy_c]; 1357 1379 } 1358 1380 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1359 yy_is_jam = (yy_current_state == 74);1381 yy_is_jam = (yy_current_state == 80); 1360 1382 1361 1383 return yy_is_jam ? 0 : yy_current_state; … … 1844 1866 #define YYTABLES_NAME "yytables" 1845 1867 1846 #line 1 18"easymesh/easymesh-scanner.l"1868 #line 123 "easymesh/easymesh-scanner.l" 1847 1869 1848 1870 -
trunk/src/lolcore.vcxproj
r2225 r2226 241 241 <ClCompile Include="debug\stats.cpp" /> 242 242 <ClCompile Include="dict.cpp" /> 243 <ClCompile Include="easymesh\csgbsp.cpp" /> 243 244 <ClCompile Include="easymesh\easymesh-compiler.cpp" /> 244 245 <ClCompile Include="easymesh\easymesh.cpp" /> … … 556 557 <ClInclude Include="debug\stats.h" /> 557 558 <ClInclude Include="dict.h" /> 559 <ClInclude Include="easymesh\csgbsp.h" /> 558 560 <ClInclude Include="easymesh\easymesh-compiler.h" /> 559 561 <ClInclude Include="easymesh\easymesh.h" /> -
trunk/src/lolcore.vcxproj.filters
r2225 r2226 658 658 <Filter>math</Filter> 659 659 </ClCompile> 660 <ClCompile Include="easymesh\csgbsp.cpp"> 661 <Filter>easymesh</Filter> 662 </ClCompile> 660 663 </ItemGroup> 661 664 <ItemGroup> … … 1634 1637 <ClInclude Include="lol\math\geometry.h"> 1635 1638 <Filter>lol\math</Filter> 1639 </ClInclude> 1640 <ClInclude Include="easymesh\csgbsp.h"> 1641 <Filter>easymesh</Filter> 1636 1642 </ClInclude> 1637 1643 </ItemGroup> -
trunk/tutorial/05_easymesh.cpp
r2183 r2226 2 2 // Lol Engine - EasyMesh tutorial 3 3 // 4 // Copyright: (c) 2011-2012 Sam Hocevar <sam@hocevar.net> 4 // Copyright: (c) 2011-2013 Sam Hocevar <sam@hocevar.net> 5 // (c) 2012-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com> 5 6 // This program is free software; you can redistribute it and/or 6 7 // modify it under the terms of the Do What The Fuck You Want To … … 29 30 m_gears.Push(EasyMesh(), mat4(1.0f), 180.0f / 18); 30 31 31 m_gears[0].m1.Compile("sc#f9f scb#f9f acg 12 10 5 5 20 20 5 5 0.1 0 s .1 .1 .1"); 32 m_gears[0].m1.Compile("[sc#00f ab 8 1 8 ty -.25]\ 33 [sc#f9f scb#f9f acg 12 10 5 5 20 20 5 5 0.1 0 s .1 .1 .1 ty -.1 csgu]\ 34 [sc#fff scb#000 acg 12 10 10 10 20 20 5 5 0.1 0 s .05 .05 .05 tx -1.5 ty .3 csgu]\ 35 [sc#00f ab 5 3 9 tx 2.5 csgs]\ 36 [[ sc#fff ab 3 1.4 2 tx -2 tz -2 \ 37 [sc#fff ab 2.1 .7 1.1 ty .5 tx -1.4 tz -1.4 csgs] mz] csgu] \ 38 "); 39 //m_gears[0].m1.Compile("[sc#f9f scb#f9f acg 12 10 5 5 20 20 5 5 0.1 0 s .1 .1 .1 [sc#00f ab 3 1 2 ty .25 tx 1 csgs]]"); 32 40 m_gears[1].m1.Compile("sc#ff9 scb#ff9 acg 54 10 95 95 90 90 -5 -5 0.1 0 s .1 .1 .1"); 33 m_gears[2].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1"); 34 m_gears[3].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1"); 35 m_gears[4].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1"); 41 //m_gears[2].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1 [sc#00f scb#00f ab 2 2 2 tx 1.5]"); 42 //m_gears[3].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1 [sc#00f scb#00f ab 2 2 2 tx 1.5]"); 43 //m_gears[4].m1.Compile("sc#9ff scb#9ff acg 18 10 5 5 30 30 5 5 0.1 0 s .1 .1 .1 [sc#00f scb#00f ab 2 2 2 tx 1.5]"); 44 m_gears[2].m1.Compile("[sc#0f0 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#00f ab 2 2 2 tx 0 csgu]]"); 45 m_gears[3].m1.Compile("[sc#0f0 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#00f ab 2 2 2 tx 0 csgs]]"); 46 m_gears[4].m1.Compile("[sc#0f0 ab 2 2 2 t .8 .8 .8 rx 20 ry 20 [sc#00f ab 2 2 2 tx 0 csga]]"); 36 47 37 48 m_angle = 0; … … 40 51 vec3(0.f, 0.f, 0.f), 41 52 vec3(0, 1, 0)); 42 m_camera->SetPerspective( 70.f, 960.f, 600.f, .1f, 1000.f);53 m_camera->SetPerspective(30.f, 960.f, 600.f, .1f, 1000.f); 43 54 m_camera->SetTarget(vec3(0.f, -1.f, 0.f)); 44 m_camera->SetPosition(vec3(-15.f, 10.f, 0.f));55 m_camera->SetPosition(vec3(-15.f, 5.f, 0.f)); 45 56 Ticker::Ref(m_camera); 46 57 … … 59 70 m_angle += seconds * 70.0f; 60 71 m_mat = mat4::rotate(10.0f, vec3(0, 0, 1)) 61 * mat4::rotate(m_angle, vec3(0, 1, 0)); 72 * mat4::rotate(100, vec3(0, 1, 0)); 73 // * mat4::rotate(m_angle, vec3(0, 1, 0)); 62 74 63 m_gears[0].m3 += seconds * 150.0f;64 m_gears[1].m3 += seconds * 150.0f * -2 / 9;65 m_gears[2].m3 += seconds * 150.0f * -2 / 3;66 m_gears[3].m3 += seconds * 150.0f * -2 / 3;67 m_gears[4].m3 += seconds * 150.0f * -2 / 3;75 m_gears[0].m3 += seconds * 20.0f; 76 m_gears[1].m3 += seconds * 20.0f * -2 / 9; 77 m_gears[2].m3 += seconds * 20.0f * -2 / 3; 78 m_gears[3].m3 += seconds * 20.0f * -2 / 3; 79 m_gears[4].m3 += seconds * 20.0f * -2 / 3; 68 80 69 m_gears[0].m2 = mat4::translate(vec3(0, 0, 0)) 70 * mat4::rotate(m_gears[0].m3, vec3(0, 1, 0)); 81 m_gears[0].m2 = mat4::translate(vec3(0, -1, 0)) 82 * mat4::rotate(m_gears[0].m3 - 130.0f, vec3(0, 1, 0)) 83 * mat4::rotate(40.0f, vec3(0, 0, 1)); 71 84 m_gears[1].m2 = mat4::translate(vec3(0, 0, 0)) 72 85 * mat4::rotate(m_gears[1].m3, vec3(0, 1, 0)); 73 86 m_gears[2].m2 = mat4::translate(vec3(0, 0, 5.5f)) 74 * mat4::rotate(m_gears[2].m3, vec3(0, 1, 0)); 87 * mat4::rotate(m_gears[2].m3 - 40.0f, vec3(0, 1, 0)) 88 * mat4::rotate(90.0f, vec3(0, 0, 1)); 75 89 m_gears[3].m2 = mat4::translate(vec3(5.5f * lol::sqrt(3.f) * 0.5f, 0, -5.5f * 0.5f)) 76 * mat4::rotate(m_gears[3].m3, vec3(0, 1, 0)); 90 * mat4::rotate(m_gears[3].m3 - 140.0f, vec3(0, 1, 0)) 91 * mat4::rotate(-70.0f, vec3(0, 0, 1)); 77 92 m_gears[4].m2 = mat4::translate(vec3(-5.5f * lol::sqrt(3.f) * 0.5f, 0, -5.5f * 0.5f)) 78 * mat4::rotate(m_gears[4].m3 , vec3(0, 1, 0));93 * mat4::rotate(m_gears[4].m3 - 80.0f, vec3(0, 1, 0)); 79 94 } 80 95
Note: See TracChangeset
for help on using the changeset viewer.