MeshLib Documentation
Loading...
Searching...
No Matches
MRCtm.h
Go to the documentation of this file.
1#pragma once
2
3#include "config.h"
4#ifndef MRIOEXTRAS_NO_CTM
5#include "exports.h"
6
7#include <MRMesh/MRExpected.h>
11
12#include <filesystem>
13
14namespace MR
15{
16
17namespace MeshLoad
18{
19
21MRIOEXTRAS_API Expected<Mesh> fromCtm( const std::filesystem::path& file, const MeshLoadSettings& settings = {} );
22MRIOEXTRAS_API Expected<Mesh> fromCtm( std::istream& in, const MeshLoadSettings& settings = {} );
23
24} // namespace MeshLoad
25
26namespace MeshSave
27{
28
30{
31 enum class MeshCompression
32 {
33 None,
34 Lossless,
35 Lossy
36 };
40 float vertexPrecision = 1.0f / 1024.0f; //~= 0.00098
44 const char * comment = "MeshInspector.com";
45};
46
48MRIOEXTRAS_API Expected<void> toCtm( const Mesh & mesh, const std::filesystem::path & file, const CtmSaveOptions & options );
49MRIOEXTRAS_API Expected<void> toCtm( const Mesh & mesh, std::ostream & out, const CtmSaveOptions & options );
50MRIOEXTRAS_API Expected<void> toCtm( const Mesh & mesh, const std::filesystem::path & file, const SaveSettings & settings = {} );
51MRIOEXTRAS_API Expected<void> toCtm( const Mesh & mesh, std::ostream & out, const SaveSettings & settings = {} );
52
53} // namespace MeshSave
54
55namespace PointsLoad
56{
57
59MRIOEXTRAS_API Expected<PointCloud> fromCtm( const std::filesystem::path& file, const PointsLoadSettings& settings = {} );
60MRIOEXTRAS_API Expected<PointCloud> fromCtm( std::istream& in, const PointsLoadSettings& settings = {} );
61
62} // namespace PointsLoad
63
64namespace PointsSave
65{
66
68{
72 const char* comment = "MeshInspector Points";
73};
74
76MRIOEXTRAS_API Expected<void> toCtm( const PointCloud& points, const std::filesystem::path& file, const CtmSavePointsOptions& options );
77MRIOEXTRAS_API Expected<void> toCtm( const PointCloud& points, std::ostream& out, const CtmSavePointsOptions& options );
78MRIOEXTRAS_API Expected<void> toCtm( const PointCloud& points, const std::filesystem::path& file, const SaveSettings& settings = {} );
79MRIOEXTRAS_API Expected<void> toCtm( const PointCloud& points, std::ostream& out, const SaveSettings& settings = {} );
80
81} // namespace PointsSave
82
83} // namespace MR
84#endif
MRIOEXTRAS_API Expected< Mesh > fromCtm(const std::filesystem::path &file, const MeshLoadSettings &settings={})
loads from .ctm file
MRIOEXTRAS_API Expected< void > toCtm(const Mesh &mesh, const std::filesystem::path &file, const CtmSaveOptions &options)
saves in .ctm file
MRIOEXTRAS_API Expected< PointCloud > fromCtm(const std::filesystem::path &file, const PointsLoadSettings &settings={})
loads from .ctm file
MRIOEXTRAS_API Expected< void > toCtm(const PointCloud &points, const std::filesystem::path &file, const CtmSavePointsOptions &options)
saves in .ctm file
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:58
setting for mesh loading from external format, and locations of optional output data
Definition MRMeshLoadSettings.h:10
Definition MRCtm.h:30
int compressionLevel
LZMA compression: 0 - minimal compression, but fast; 9 - maximal compression, but slow.
Definition MRCtm.h:42
const char * comment
comment saved in the file
Definition MRCtm.h:44
float vertexPrecision
Definition MRCtm.h:40
MeshCompression meshCompression
Definition MRCtm.h:37
MeshCompression
Definition MRCtm.h:32
@ None
no compression at all, fast but not effective
@ Lossless
compression without any loss in vertex coordinates
@ Lossy
compression with loss in vertex coordinates
Definition MRMesh/MRMesh.h:23
Definition MRMesh/MRPointCloud.h:16
Definition MRPointsLoadSettings.h:10
const char * comment
comment saved in the file
Definition MRCtm.h:72
int compressionLevel
0 - minimal compression, but fast; 9 - maximal compression, but slow
Definition MRCtm.h:70
determines how to save points/lines/mesh
Definition MRSaveSettings.h:14