feat: 测试覆盖扩展 + 文档更新

This commit is contained in:
茂之钳
2026-07-23 12:36:39 +00:00
parent 41a8992332
commit f2203c7255
42 changed files with 3448 additions and 106 deletions
+19 -1
View File
@@ -7,8 +7,26 @@ namespace vde::foundation {
struct ObjMeshData {
std::vector<Point3D> vertices;
std::vector<Point2D> texcoords;
std::vector<Vector3D> normals;
std::vector<std::vector<int>> faces; // vertex indices (1-based in file, 0-based here)
/// Vertex indices per face (0-based internally).
/// Always populated regardless of face format.
std::vector<std::vector<int>> faces;
/// Texcoord indices per face (0-based). Empty if the file had no vt data.
/// Same length as faces; each sub-vector same length as corresponding face.
std::vector<std::vector<int>> face_texcoords;
/// Normal indices per face (0-based). Empty if the file had no vn data.
std::vector<std::vector<int>> face_normals;
/// Material name per face group (appears before the faces that use it).
/// The i-th entry gives the material active for the i-th face.
std::vector<std::string> face_materials;
/// Helpers
[[nodiscard]] bool has_texcoords() const { return !texcoords.empty(); }
};
ObjMeshData read_obj(const std::string& filepath);
+6
View File
@@ -10,7 +10,13 @@ struct StlTriangle {
Point3D v0, v1, v2;
};
/// Auto-detect format (binary or ASCII) and read.
std::vector<StlTriangle> read_stl(const std::string& filepath);
/// Always write binary STL.
void write_stl(const std::string& filepath, const std::vector<StlTriangle>& tris);
/// Write ASCII STL (human-readable).
void write_stl_ascii(const std::string& filepath, const std::vector<StlTriangle>& tris);
} // namespace vde::foundation