feat: GLTF/GLB export with normals + B-Rep tessellation + pipeline example
CI / Build & Test (push) Failing after 32s
CI / Release Build (push) Failing after 31s

This commit is contained in:
茂之钳
2026-07-24 09:06:12 +00:00
parent b3269b4f09
commit 40440fcc3e
8 changed files with 521 additions and 29 deletions
+22 -2
View File
@@ -1,11 +1,31 @@
#pragma once
#include "vde/mesh/halfedge_mesh.h"
#include "vde/brep/brep.h"
#include <string>
#include <vector>
#include <optional>
namespace vde::foundation {
/// Export mesh to glTF 2.0 (JSON + optional embedded binary)
/// GLTF export options
struct GltfOptions {
bool binary = true; // GLB (single file) vs glTF (JSON + .bin)
bool include_normals = true; // Compute and export vertex normals
bool include_colors = false; // Per-vertex colors
std::vector<float> vertex_colors; // RGB per vertex (if include_colors)
};
/// Export mesh to glTF 2.0 / GLB
/// Returns true on success
bool write_gltf(const std::string& filepath, const mesh::HalfedgeMesh& mesh);
bool write_gltf(const std::string& filepath, const mesh::HalfedgeMesh& mesh,
const GltfOptions& options = GltfOptions{});
/// Export B-Rep model to GLB by tessellating faces
/// @param filepath Output file (.glb recommended)
/// @param model B-Rep model to export
/// @param tessellation_res Resolution for curved surfaces (segments per edge)
/// @return true on success
bool write_brep_gltf(const std::string& filepath, const brep::BrepModel& model,
int tessellation_res = 32);
} // namespace vde::foundation