32 lines
1.1 KiB
C++
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
|