feat: GLTF/GLB export with normals + B-Rep tessellation + pipeline example
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user