| 164 | } |
| 165 | |
| 166 | void PLYWriter::add_face_elements_header(Mesh& mesh, p_ply& ply) { |
| 167 | const size_t num_faces = mesh.get_num_faces(); |
| 168 | assert_success(ply_add_element(ply, "face", num_faces), "Add face failed"); |
| 169 | assert_success(ply_add_list_property(ply, "vertex_indices", PLY_UCHAR, |
| 170 | PLY_INT), "Add face vertex indices failed"); |
| 171 | |
| 172 | for (NameArray::const_iterator itr = m_face_attr_names.begin(); |
| 173 | itr != m_face_attr_names.end(); itr++) { |
| 174 | std::string name = strip_prefix(*itr, "face_"); |
| 175 | const VectorF& attr = mesh.get_attribute(*itr); |
| 176 | const size_t per_face_size = attr.size() / num_faces; |
| 177 | e_ply_type ply_type = m_scalar; |
| 178 | if (name == "red" || name == "green" || name == "blue") { |
| 179 | ply_type = PLY_UCHAR; |
| 180 | } |
| 181 | if (per_face_size == 1) { |
| 182 | assert_success(ply_add_scalar_property(ply, name.c_str(), ply_type), |
| 183 | "Add per face scalar attribute failed"); |
| 184 | } else { |
| 185 | if (name == "corner_texture") { |
| 186 | name = "texcoord"; |
| 187 | } |
| 188 | assert_success(ply_add_list_property(ply, name.c_str(), PLY_UCHAR, |
| 189 | ply_type), "Add per face vector attribute failed"); |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | void PLYWriter::add_voxel_elements_header(Mesh& mesh, p_ply& ply) { |
| 195 | const size_t num_voxels = mesh.get_num_voxels(); |
nothing calls this directly
no test coverage detected