| 296 | } |
| 297 | |
| 298 | void OBJReader::parseOBJ() { |
| 299 | |
| 300 | srule comment = comment_p("#"); |
| 301 | |
| 302 | // see |
| 303 | // http://local.wasp.uwa.edu.au/~pbourke/dataformats/obj/ |
| 304 | |
| 305 | // vertices |
| 306 | srule vertex = ("v" >> real_p >> real_p >> real_p) [bind(&OBJReader::parseVertex, this, _1, _2)]; |
| 307 | srule vertex_texture = ("vt" >> real_p >> real_p) [bind(&OBJReader::parseTextureCoordinate, this, _1, _2)]; |
| 308 | srule vertex_normal = ("vn" >> real_p >> real_p >> real_p) [bind(&OBJReader::parseNormal, this, _1, _2)]; |
| 309 | //srule vertex_parameter_space = "vp" >> real_p >> real_p >> real_p; |
| 310 | |
| 311 | // srule cs_types = ("bmatrix" | "bezier" | "bspline" | "cardinal" | "taylor"); |
| 312 | // srule vertex_curve_or_surface = "cstype" >> "rat" >> cs_types; |
| 313 | // srule vertex_degree = "deg" >> real_p >> real_p; |
| 314 | // srule vertex_basis_matrix = "bmat"; |
| 315 | // srule vertex_step_size = "step" >> int_p >> int_p; |
| 316 | srule vertex_type = vertex | vertex_texture | vertex_normal; |
| 317 | |
| 318 | // elements |
| 319 | srule point = "p" >> real_p >> *(real_p); |
| 320 | srule line = "l" >> int_p >> int_p >> *(int_p); |
| 321 | srule face = (ch_p('f') >> *(anychar_p))[bind(&OBJReader::parseFace, this, _1, _2)]; |
| 322 | // srule curve = "curv"; |
| 323 | // srule curve_2d = "curv2"; |
| 324 | // srule surface = "surf"; |
| 325 | srule element = point | line | face; |
| 326 | |
| 327 | // free-form curve / surface statements |
| 328 | // srule parameter = "parm"; |
| 329 | // srule trim_loop = "trim"; |
| 330 | // srule hole_loop = "hole"; |
| 331 | // srule special_curve = "scrv"; |
| 332 | // srule special_point = "sp"; |
| 333 | // srule end_statement = "end"; |
| 334 | |
| 335 | // connectivity |
| 336 | //srule connect = "con"; |
| 337 | |
| 338 | // grouping |
| 339 | srule group_name = ("g" >> *(anychar_p))[bind(&OBJReader::parseGroup, this, _1, _2)]; |
| 340 | // srule smoothing_group = "s"; |
| 341 | // srule merging_group = "mg"; |
| 342 | srule object_name = "o" >> int_p; |
| 343 | srule grouping = group_name | object_name; |
| 344 | |
| 345 | // display and render attributes |
| 346 | // srule bevel_interpretation = "bevel"; |
| 347 | // srule color_interpolation = "c_interp"; |
| 348 | // srule dissolve_interpolation = "d_interp"; |
| 349 | // srule level_of_detail = "lod"; |
| 350 | // srule material_name = "usemtl"; |
| 351 | // srule material_library = "mtllib"; |
| 352 | // srule shadow_casting = "shadow_obj"; |
| 353 | // srule ray_tracing = "trace_obj"; |
| 354 | // srule curve_approximation_technique = "ctech"; |
| 355 | // srule surface_approximation_technique = "stech"; |