MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSerializer.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRVector2.h"
5#include "MRVector3.h"
6#include "MRVector4.h"
7#include "MRMatrix2.h"
8#include "MRColor.h"
9#include "MRPlane3.h"
10#include "MRIOFilters.h"
11#include "MRProgressCallback.h"
12#include "MRExpected.h"
13#include <filesystem>
14
15namespace Json
16{
17class Value;
18}
19
20namespace MR
21{
22
26
28MRMESH_API Expected<void> serializeJsonValue( const Json::Value& root, std::ostream& out ); // important on Windows: in stream must be open in binary mode
29MRMESH_API Expected<void> serializeJsonValue( const Json::Value& root, const std::filesystem::path& path );
30
31MRMESH_API Expected<Json::Value> deserializeJsonValue( std::istream& in ); // important on Windows: in stream must be open in binary mode
34MRMESH_API Expected<Json::Value> deserializeJsonValue( const std::filesystem::path& path );
35
39MRMESH_API Expected<void> serializeMesh( const Mesh& mesh, const std::filesystem::path& path, const FaceBitSet* selection = nullptr,
40 const char * serializeFormat = ".mrmesh" );
41
43MRMESH_API void serializeToJson( const Vector2i& vec, Json::Value& root );
44MRMESH_API void serializeToJson( const Vector2f& vec, Json::Value& root );
45MRMESH_API void serializeToJson( const Vector3i& vec, Json::Value& root );
46MRMESH_API void serializeToJson( const Vector3f& vec, Json::Value& root );
47MRMESH_API void serializeToJson( const Vector4f& vec, Json::Value& root );
48MRMESH_API void serializeToJson( const Box3i& box, Json::Value& root );
49MRMESH_API void serializeToJson( const Box3f& box, Json::Value& root );
50MRMESH_API void serializeToJson( const Color& col, Json::Value& root );
51MRMESH_API void serializeToJson( const Matrix2f& matrix, Json::Value& root, bool skipIdentity = true );
52MRMESH_API void serializeToJson( const Matrix3f& matrix, Json::Value& root, bool skipIdentity = true );
53MRMESH_API void serializeToJson( const AffineXf2f& xf, Json::Value& root, bool skipIdentity = true );
54MRMESH_API void serializeToJson( const AffineXf3f& xf, Json::Value& root, bool skipIdentity = true );
55MRMESH_API void serializeToJson( const BitSet& bitset, Json::Value& root );
56MRMESH_API Expected<void> serializeToJson( const Mesh& mesh, Json::Value& root );
57MRMESH_API void serializeToJson( const Plane3f& plane, Json::Value& root );
58MRMESH_API void serializeToJson( const TriPointf& tp, Json::Value& root );
59MRMESH_API void serializeToJson( const MeshTexture& texture, Json::Value& root );
60MRMESH_API void serializeToJson( const std::vector<TextureId>& texturePerFace, Json::Value& root );
61MRMESH_API void serializeToJson( const std::vector<UVCoord>& uvCoords, Json::Value& root );
62MRMESH_API void serializeToJson( const std::vector<Color>& colors, Json::Value& root );
65MRMESH_API void serializeToJson( const MeshTriPoint& mtp, const MeshTopology& topology, Json::Value& root );
66MRMESH_API void serializeToJson( const PointOnFace& pf, Json::Value& root );
67
70MRMESH_API void serializeViaVerticesToJson( const UndirectedEdgeBitSet& edges, const MeshTopology & topology, Json::Value& root );
71MRMESH_API void deserializeViaVerticesFromJson( const Json::Value& root, UndirectedEdgeBitSet& edges, const MeshTopology & topology );
72
74MRMESH_API void deserializeFromJson( const Json::Value& root, Vector2i& vec );
75MRMESH_API void deserializeFromJson( const Json::Value& root, Vector2f& vec );
76MRMESH_API void deserializeFromJson( const Json::Value& root, Vector3i& vec );
77MRMESH_API void deserializeFromJson( const Json::Value& root, Vector3f& vec );
78MRMESH_API void deserializeFromJson( const Json::Value& root, Vector4f& vec );
79MRMESH_API void deserializeFromJson( const Json::Value& root, Color& col );
80MRMESH_API void deserializeFromJson( const Json::Value& root, Matrix2f& matrix );
81MRMESH_API void deserializeFromJson( const Json::Value& root, Matrix3f& matrix );
82MRMESH_API void deserializeFromJson( const Json::Value& root, AffineXf2f& xf );
83MRMESH_API void deserializeFromJson( const Json::Value& root, AffineXf3f& xf );
84MRMESH_API void deserializeFromJson( const Json::Value& root, BitSet& bitset );
85MRMESH_API Expected<Mesh> deserializeFromJson( const Json::Value& root, VertColors* colors = nullptr );
86MRMESH_API void deserializeFromJson( const Json::Value& root, Plane3f& plane );
87MRMESH_API void deserializeFromJson( const Json::Value& root, TriPointf& tp );
88MRMESH_API void deserializeFromJson( const Json::Value& root, MeshTexture& texture );
89MRMESH_API void deserializeFromJson( const Json::Value& root, std::vector<TextureId>& texturePerFace );
90MRMESH_API void deserializeFromJson( const Json::Value& root, std::vector<UVCoord>& uvCoords );
91MRMESH_API void deserializeFromJson( const Json::Value& root, std::vector<Color>& colors );
94MRMESH_API void deserializeFromJson( const Json::Value& root, MeshTriPoint& mtp, const MeshTopology& topology );
95MRMESH_API void deserializeFromJson( const Json::Value& root, PointOnFace& pf );
96
98
99} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:80
Definition MRMesh/MRBitSet.h:28
Definition MRMesh/MRMeshTopology.h:19
MRMESH_API Expected< Json::Value > deserializeJsonValue(std::istream &in)
MRMESH_API Expected< std::string > serializeJsonValue(const Json::Value &root)
MRMESH_API void serializeViaVerticesToJson(const UndirectedEdgeBitSet &edges, const MeshTopology &topology, Json::Value &root)
MRMESH_API Expected< void > serializeMesh(const Mesh &mesh, const std::filesystem::path &path, const FaceBitSet *selection=nullptr, const char *serializeFormat=".mrmesh")
MRMESH_API void deserializeViaVerticesFromJson(const Json::Value &root, UndirectedEdgeBitSet &edges, const MeshTopology &topology)
Definition MRCameraOrientationPlugin.h:8
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:29
MRMESH_API void serializeToJson(const EndMillCutter &cutter, Json::Value &root)
tl::expected< T, E > Expected
Definition MRExpected.h:25
MRMESH_API Expected< void > deserializeFromJson(const Json::Value &root, EndMillCutter &cutter)
Definition MRMesh/MRColor.h:9
Definition MRMeshTexture.h:13
Definition MRMesh/MRMeshTriPoint.h:23
Definition MRMesh/MRMesh.h:23
a point located on some mesh's face
Definition MRMesh/MRPointOnFace.h:11