Expand description
Binary glTF 2.0 (GLB) export of a RenderScene.
to_glb writes one self-contained .glb file that any glTF viewer
opens. The JSON chunk is built with serde_json; no glTF library is
used.
§Layout
- One root node, named
IFCX, holds the scene’soriginas its translation and, by default, the rotation from IFCX’s Z-up to glTF’s Y-up axes. Itsextrasrecord the origin in the file’s coordinates (ifcxOrigin) and the up axis written (ifcxUpAxis). - Each
Instancebecomes one child node of the root, named by the instance path, with the instance’s render matrix andextras.ifcxNodeset toInstance::node. A node with several kinds of geometry gives one glTF node per kind, all with the same name. - Each pair of geometry buffer and material becomes one glTF mesh, which every instance of that pair references. Each buffer is written once, so instances share vertex data even across materials.
- Meshes are
TRIANGLESwithPOSITION,NORMAL, andu32indices; lines areLINESwith indices; points arePOINTSwithCOLOR_0when they have colours.POSITIONaccessors carryminandmax. - Materials used by an instance map onto
pbrMetallicRoughness: aBasicMaterialis its colour with opacity as alpha, metallic 0, roughness 1, andBLENDwhen not opaque; aGltfMaterialkeeps its factors,alphaMode,alphaCutoff, anddoubleSided. Texture references are not written, since the scene does not load them. Factors and colours are clamped to0..=1, as glTF requires, andalphaCutoffto a finite number of at least 0 (0.5for NaN). With the scene’s own finite coordinates (seeSceneWarningKind::OutOfRange), every number in the JSON chunk is finite, so it never holdsnull. - Every buffer view starts on a 4-byte boundary, and both chunks are padded to 4 bytes, the JSON chunk with spaces.
Structs§
- GlbOptions
- Options for
to_glb.
Enums§
- GlbError
- Why a scene could not be written as GLB.
Functions§
- to_glb
- Writes
sceneas a binary glTF 2.0 file.