ViewDesignEngine  3.1.0
高性能 CAD 计算几何引擎
serializer.h
浏览该文件的文档.
1 #pragma once
3 #include <vector>
4 #include <cstdint>
5 #include <string>
6 
7 namespace vde::foundation {
8 
19  uint32_t vertex_count;
21  uint32_t face_count;
23  std::vector<double> vertices;
25  std::vector<int32_t> face_indices;
27  std::vector<int32_t> face_valence;
28 };
29 
47 public:
59  static std::vector<uint8_t> serialize(const mesh::HalfedgeMesh& mesh);
60 
73  static mesh::HalfedgeMesh deserialize(const std::vector<uint8_t>& data);
74 
87  static bool write_file(const std::string& path, const mesh::HalfedgeMesh& mesh);
88 
101  static mesh::HalfedgeMesh read_file(const std::string& path);
102 };
103 
109 constexpr uint64_t VDE_MAGIC = 0x56444547454F4D00ULL; // "VDEGEOM\0"
110 
116 constexpr uint32_t VDE_FORMAT_VERSION = 1;
117 
118 } // namespace vde::foundation
二进制序列化器
Definition: serializer.h:46
static mesh::HalfedgeMesh read_file(const std::string &path)
从文件读取并反序列化
static bool write_file(const std::string &path, const mesh::HalfedgeMesh &mesh)
序列化并写入文件
static std::vector< uint8_t > serialize(const mesh::HalfedgeMesh &mesh)
序列化网格到二进制缓冲区
static mesh::HalfedgeMesh deserialize(const std::vector< uint8_t > &data)
从二进制缓冲区反序列化网格
半边数据结构三角网格
Definition: halfedge_mesh.h:54
自适应双精度谓词后端(默认)
Definition: error_codes.h:4
constexpr uint32_t VDE_FORMAT_VERSION
VDE 二进制格式当前版本号
Definition: serializer.h:116
constexpr uint64_t VDE_MAGIC
VDE 二进制文件魔数:"VDEGEOM\0"
Definition: serializer.h:109
二进制序列化格式的网格数据结构
Definition: serializer.h:17
uint32_t vertex_count
顶点数量
Definition: serializer.h:19
std::vector< int32_t > face_indices
面顶点索引,扁平排列:v0_0 v0_1 v0_2 v1_0 v1_1 v1_2 ...
Definition: serializer.h:25
std::vector< int32_t > face_valence
每面的顶点数(当前固定为 3,即纯三角形网格)
Definition: serializer.h:27
std::vector< double > vertices
顶点坐标,扁平排列:x0 y0 z0 x1 y1 z1 ...
Definition: serializer.h:23
uint32_t face_count
面数量
Definition: serializer.h:21