| 54 | } |
| 55 | |
| 56 | void parse_ply(const std::string& filename, PLYParser* parser) { |
| 57 | p_ply ply = ply_open(filename.c_str(), NULL, 0, NULL); |
| 58 | assert_success(ply != NULL); |
| 59 | assert_success(ply_read_header(ply)); |
| 60 | |
| 61 | const char* elem_name; |
| 62 | const char* prop_name; |
| 63 | long num_elements; |
| 64 | p_ply_element element = ply_get_next_element(ply, NULL); |
| 65 | while (element != NULL) { |
| 66 | assert_success(ply_get_element_info(element, &elem_name, &num_elements)); |
| 67 | |
| 68 | p_ply_property property = ply_get_next_property(element, NULL); |
| 69 | while (property != NULL) { |
| 70 | assert_success(ply_get_property_info(property, &prop_name, NULL, NULL, NULL)); |
| 71 | |
| 72 | ply_set_read_cb(ply, elem_name, prop_name, ply_parser_call_back, parser, 0); |
| 73 | parser->add_property(elem_name, prop_name, num_elements); |
| 74 | |
| 75 | property = ply_get_next_property(element, property); |
| 76 | } |
| 77 | element = ply_get_next_element(ply, element); |
| 78 | } |
| 79 | assert_success(ply_read(ply)); |
| 80 | ply_close(ply); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | using namespace PLYParserHelper; |
no test coverage detected