pub fn to_glb(
scene: &RenderScene,
options: &GlbOptions,
) -> Result<Vec<u8>, GlbError>Expand description
Writes scene as a binary glTF 2.0 file.
use openbim_ifcx::{compose, flatten, IfcxNode};
use openbim_ifcx_geometry::glb::{to_glb, GlbOptions};
use openbim_ifcx_geometry::scene::{RenderScene, SceneOptions};
let nodes: Vec<IfcxNode> = serde_json::from_str(r#"[
{"path": "panel", "attributes": {"usd::usdgeom::mesh": {
"points": [[0, 0, 0], [1, 0, 0], [0, 1, 0]], "faceVertexIndices": [0, 1, 2]}}}
]"#)?;
let scene = RenderScene::from_composition(&compose(&flatten(&nodes))?, &SceneOptions::default());
let glb = to_glb(&scene, &GlbOptions::default())?;
assert_eq!(&glb[..4], b"glTF");
assert_eq!(glb.len() % 4, 0);