MeshLib Documentation
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
29MRMESH_API Expected<Json::Value> deserializeJsonValue( const std::filesystem::path& path );
30
34MRMESH_API Expected<void> serializeMesh( const Mesh& mesh, const std::filesystem::path& path, const FaceBitSet* selection = nullptr,
35 const char * saveMeshFormat = ".mrmesh" );
36
38MRMESH_API void serializeToJson( const Vector2i& vec, Json::Value& root );
39MRMESH_API void serializeToJson( const Vector2f& vec, Json::Value& root );
40MRMESH_API void serializeToJson( const Vector3i& vec, Json::Value& root );
41MRMESH_API void serializeToJson( const Vector3f& vec, Json::Value& root );
42MRMESH_API void serializeToJson( const Vector4f& vec, Json::Value& root );
43MRMESH_API void serializeToJson( const Box3i& box, Json::Value& root );
44MRMESH_API void serializeToJson( const Box3f& box, Json::Value& root );
45MRMESH_API void serializeToJson( const Color& col, Json::Value& root );
46MRMESH_API void serializeToJson( const Matrix2f& matrix, Json::Value& root, bool skipIdentity = true );
47MRMESH_API void serializeToJson( const Matrix3f& matrix, Json::Value& root, bool skipIdentity = true );
48MRMESH_API void serializeToJson( const AffineXf2f& xf, Json::Value& root, bool skipIdentity = true );
49MRMESH_API void serializeToJson( const AffineXf3f& xf, Json::Value& root, bool skipIdentity = true );
50MRMESH_API void serializeToJson( const BitSet& bitset, Json::Value& root );
51MRMESH_API Expected<void> serializeToJson( const Mesh& mesh, Json::Value& root );
52MRMESH_API void serializeToJson( const Plane3f& plane, Json::Value& root );
53MRMESH_API void serializeToJson( const TriPointf& tp, Json::Value& root );
54MRMESH_API void serializeToJson( const MeshTexture& texture, Json::Value& root );
55MRMESH_API void serializeToJson( const std::vector<TextureId>& texturePerFace, Json::Value& root );
56MRMESH_API void serializeToJson( const std::vector<UVCoord>& uvCoords, Json::Value& root );
57MRMESH_API void serializeToJson( const std::vector<Color>& colors, Json::Value& root );
60MRMESH_API void serializeToJson( const MeshTriPoint& mtp, const MeshTopology& topology, Json::Value& root );
61MRMESH_API void serializeToJson( const PointOnFace& pf, Json::Value& root );
62
65MRMESH_API void serializeViaVerticesToJson( const UndirectedEdgeBitSet& edges, const MeshTopology & topology, Json::Value& root );
66MRMESH_API void deserializeViaVerticesFromJson( const Json::Value& root, UndirectedEdgeBitSet& edges, const MeshTopology & topology );
67
69MRMESH_API void deserializeFromJson( const Json::Value& root, Vector2i& vec );
70MRMESH_API void deserializeFromJson( const Json::Value& root, Vector2f& vec );
71MRMESH_API void deserializeFromJson( const Json::Value& root, Vector3i& vec );
72MRMESH_API void deserializeFromJson( const Json::Value& root, Vector3f& vec );
73MRMESH_API void deserializeFromJson( const Json::Value& root, Vector4f& vec );
74MRMESH_API void deserializeFromJson( const Json::Value& root, Color& col );
75MRMESH_API void deserializeFromJson( const Json::Value& root, Matrix2f& matrix );
76MRMESH_API void deserializeFromJson( const Json::Value& root, Matrix3f& matrix );
77MRMESH_API void deserializeFromJson( const Json::Value& root, AffineXf2f& xf );
78MRMESH_API void deserializeFromJson( const Json::Value& root, AffineXf3f& xf );
79MRMESH_API void deserializeFromJson( const Json::Value& root, BitSet& bitset );
80MRMESH_API Expected<Mesh> deserializeFromJson( const Json::Value& root, VertColors* colors = nullptr );
81MRMESH_API void deserializeFromJson( const Json::Value& root, Plane3f& plane );
82MRMESH_API void deserializeFromJson( const Json::Value& root, TriPointf& tp );
83MRMESH_API void deserializeFromJson( const Json::Value& root, MeshTexture& texture );
84MRMESH_API void deserializeFromJson( const Json::Value& root, std::vector<TextureId>& texturePerFace );
85MRMESH_API void deserializeFromJson( const Json::Value& root, std::vector<UVCoord>& uvCoords );
86MRMESH_API void deserializeFromJson( const Json::Value& root, std::vector<Color>& colors );
89MRMESH_API void deserializeFromJson( const Json::Value& root, MeshTriPoint& mtp, const MeshTopology& topology );
90MRMESH_API void deserializeFromJson( const Json::Value& root, PointOnFace& pf );
91
93
94} // namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
container of bits
Definition MRMesh/MRBitSet.h:27
Definition MRMesh/MRMeshTopology.h:18
MRMESH_API Expected< Json::Value > deserializeJsonValue(std::istream &in)
MRMESH_API void deserializeFromJson(const Json::Value &root, Vector2i &vec)
loads an object from json value
MRMESH_API Expected< void > serializeMesh(const Mesh &mesh, const std::filesystem::path &path, const FaceBitSet *selection=nullptr, const char *saveMeshFormat=".mrmesh")
MRMESH_API void serializeViaVerticesToJson(const UndirectedEdgeBitSet &edges, const MeshTopology &topology, Json::Value &root)
MRMESH_API void deserializeViaVerticesFromJson(const Json::Value &root, UndirectedEdgeBitSet &edges, const MeshTopology &topology)
MRMESH_API void serializeToJson(const Vector2i &vec, Json::Value &root)
saves an object into json value
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:58
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4< double > SymMatrix3< double > AffineXf2f
Definition MRMesh/MRMeshFwd.h:202
Definition MRColor.h:9
Definition MRMeshTexture.h:13
Definition MRMesh/MRMeshTriPoint.h:23
Definition MRMesh/MRMesh.h:23
Definition MRMesh/MRPointOnFace.h:11