Files
ViewDesignEngine/include/vde/foundation/io_gltf.h
T
茂之钳 40440fcc3e
CI / Build & Test (push) Failing after 32s
CI / Release Build (push) Failing after 31s
feat: GLTF/GLB export with normals + B-Rep tessellation + pipeline example
2026-07-24 09:06:12 +00:00

32 lines
1.1 KiB
C++

#pragma once
#include "vde/mesh/halfedge_mesh.h"
#include "vde/brep/brep.h"
#include <string>
#include <vector>
#include <optional>
namespace vde::foundation {
/// 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,
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