ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TriangleMeshIO.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <AutoIO.h>
11 
12 #include <memory>
13 #include <string>
14 #include <vector>
15 
16 class ccMesh;
17 namespace cloudViewer {
18 namespace io {
19 
22 std::shared_ptr<ccMesh> CreateMeshFromFile(const std::string &filename,
23  bool print_progress = false);
24 
28 bool ReadTriangleMesh(const std::string &filename,
29  ccMesh &mesh,
30  ReadTriangleMeshOptions params = {});
31 
39 bool WriteTriangleMesh(const std::string &filename,
40  const ccMesh &mesh,
41  bool write_ascii = false,
42  bool compressed = false,
43  bool write_vertex_normals = true,
44  bool write_vertex_colors = true,
45  bool write_triangle_uvs = true,
46  bool print_progress = false);
47 
48 // Currently enable_post_processing not used in ReadTriangleMeshFromPLY.
49 bool ReadTriangleMeshFromPLY(const std::string &filename,
50  ccMesh &mesh,
51  const ReadTriangleMeshOptions &params);
52 
53 bool WriteTriangleMeshToPLY(const std::string &filename,
54  const ccMesh &mesh,
55  bool write_ascii,
56  bool compressed,
57  bool write_vertex_normals,
58  bool write_vertex_colors,
59  bool write_triangle_uvs,
60  bool print_progress);
61 
62 bool ReadTriangleMeshFromSTL(const std::string &filename,
63  ccMesh &mesh,
64  bool print_progress);
65 
66 bool WriteTriangleMeshToSTL(const std::string &filename,
67  const ccMesh &mesh,
68  bool write_ascii,
69  bool compressed,
70  bool write_vertex_normals,
71  bool write_vertex_colors,
72  bool write_triangle_uvs,
73  bool print_progress);
74 
75 bool ReadTriangleMeshFromOBJ(const std::string &filename,
76  ccMesh &mesh,
77  const ReadTriangleMeshOptions &params);
78 
79 bool WriteTriangleMeshToOBJ(const std::string &filename,
80  const ccMesh &mesh,
81  bool write_ascii,
82  bool compressed,
83  bool write_vertex_normals,
84  bool write_vertex_colors,
85  bool write_triangle_uvs,
86  bool print_progress);
87 
88 bool ReadTriangleMeshUsingASSIMP(const std::string &filename,
89  ccMesh &mesh,
90  const ReadTriangleMeshOptions &params);
91 
92 // Currently enable_post_processing not used in ReadTriangleMeshFromOFF.
93 bool ReadTriangleMeshFromOFF(const std::string &filename,
94  ccMesh &mesh,
95  const ReadTriangleMeshOptions &params);
96 
97 bool WriteTriangleMeshToOFF(const std::string &filename,
98  const ccMesh &mesh,
99  bool write_ascii,
100  bool compressed,
101  bool write_vertex_normals,
102  bool write_vertex_colors,
103  bool write_triangle_uvs,
104  bool print_progress);
105 
106 // Currently enable_post_processing not used in ReadTriangleMeshFromGLTF.
107 bool ReadTriangleMeshFromGLTF(const std::string &filename,
108  ccMesh &mesh,
109  const ReadTriangleMeshOptions &params);
110 
111 bool WriteTriangleMeshToGLTF(const std::string &filename,
112  const ccMesh &mesh,
113  bool write_ascii,
114  bool compressed,
115  bool write_vertex_normals,
116  bool write_vertex_colors,
117  bool write_triangle_uvs,
118  bool print_progress);
119 
128  std::vector<unsigned int> &indices);
129 
130 } // namespace io
131 } // namespace cloudViewer
IsAscii write_ascii
Compressed compressed
std::string filename
cmdLineReadable * params[]
Triangular mesh.
Definition: ecvMesh.h:35
bool ReadTriangleMeshFromOBJ(const std::string &filename, ccMesh &mesh, const ReadTriangleMeshOptions &)
bool ReadTriangleMeshFromOFF(const std::string &filename, ccMesh &mesh, const ReadTriangleMeshOptions &params)
bool WriteTriangleMesh(const std::string &filename, const ccMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
bool ReadTriangleMeshFromGLTF(const std::string &filename, ccMesh &mesh, const ReadTriangleMeshOptions &params)
std::shared_ptr< ccMesh > CreateMeshFromFile(const std::string &filename, bool print_progress)
bool AddTrianglesByEarClipping(ccMesh &mesh, std::vector< unsigned int > &indices)
bool ReadTriangleMeshUsingASSIMP(const std::string &filename, ccMesh &mesh, const ReadTriangleMeshOptions &params)
Definition: FileASSIMP.cpp:163
bool WriteTriangleMeshToSTL(const std::string &filename, const ccMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
bool WriteTriangleMeshToPLY(const std::string &filename, const ccMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
bool ReadTriangleMeshFromPLY(const std::string &filename, ccMesh &mesh, const ReadTriangleMeshOptions &params)
bool ReadTriangleMeshFromSTL(const std::string &filename, ccMesh &mesh, bool print_progress)
bool WriteTriangleMeshToGLTF(const std::string &filename, const ccMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
bool WriteTriangleMeshToOBJ(const std::string &filename, const ccMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
bool ReadTriangleMesh(const std::string &filename, ccMesh &mesh, ReadTriangleMeshOptions params)
bool WriteTriangleMeshToOFF(const std::string &filename, const ccMesh &mesh, bool write_ascii, bool compressed, bool write_vertex_normals, bool write_vertex_colors, bool write_triangle_uvs, bool print_progress)
Generic file read and write utility for python interface.