MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / add_face_elements_header

Method add_face_elements_header

src/IO/PLYWriter.cpp:166–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void 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
194void PLYWriter::add_voxel_elements_header(Mesh& mesh, p_ply& ply) {
195 const size_t num_voxels = mesh.get_num_voxels();

Callers

nothing calls this directly

Calls 10

ply_add_elementFunction · 0.85
ply_add_list_propertyFunction · 0.85
strip_prefixFunction · 0.85
ply_add_scalar_propertyFunction · 0.85
assert_successFunction · 0.70
get_num_facesMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
get_attributeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected