glTF is a format for distribution of 3D models optimized for being used in software
This page hosts a formal specification of GL Transmission Format, binary container using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
digraph {
rankdir=LR;
node [shape=plaintext];
subgraph cluster__gltf_binary {
label="GltfBinary";
graph[style=dotted];
gltf_binary__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="header_pos">0</TD><TD PORT="header_size">12</TD><TD>Header</TD><TD PORT="header_type">header</TD></TR>
<TR><TD PORT="chunks_pos">12</TD><TD PORT="chunks_size">...</TD><TD>Chunk</TD><TD PORT="chunks_type">chunks</TD></TR>
<TR><TD COLSPAN="4" PORT="chunks__repeat">repeat to end of stream</TD></TR>
</TABLE>>];
subgraph cluster__header {
label="GltfBinary::Header";
graph[style=dotted];
header__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="magic_pos">0</TD><TD PORT="magic_size">4</TD><TD></TD><TD PORT="magic_type">magic</TD></TR>
<TR><TD PORT="version_pos">4</TD><TD PORT="version_size">4</TD><TD>u4le</TD><TD PORT="version_type">version</TD></TR>
<TR><TD PORT="length_pos">8</TD><TD PORT="length_size">4</TD><TD>u4le</TD><TD PORT="length_type">length</TD></TR>
</TABLE>>];
}
subgraph cluster__chunk {
label="GltfBinary::Chunk";
graph[style=dotted];
chunk__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="len_data_pos">0</TD><TD PORT="len_data_size">4</TD><TD>u4le</TD><TD PORT="len_data_type">len_data</TD></TR>
<TR><TD PORT="type_pos">4</TD><TD PORT="type_size">4</TD><TD>u4le→ChunkType</TD><TD PORT="type_type">type</TD></TR>
<TR><TD PORT="data_pos">8</TD><TD PORT="data_size">...</TD><TD>switch (type)</TD><TD PORT="data_type">data</TD></TR>
</TABLE>>];
chunk__seq_data_switch [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#F0F2E4">case</TD><TD BGCOLOR="#F0F2E4">type</TD></TR>
<TR><TD>:chunk_type_json</TD><TD PORT="case0">Json</TD></TR>
<TR><TD>:chunk_type_bin</TD><TD PORT="case1">Bin</TD></TR>
</TABLE>>];
}
subgraph cluster__json {
label="GltfBinary::Json";
graph[style=dotted];
json__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="data_pos">0</TD><TD PORT="data_size">⇲</TD><TD>str(UTF-8)</TD><TD PORT="data_type">data</TD></TR>
</TABLE>>];
}
subgraph cluster__bin {
label="GltfBinary::Bin";
graph[style=dotted];
bin__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR>
<TR><TD PORT="data_pos">0</TD><TD PORT="data_size">⇲</TD><TD></TD><TD PORT="data_type">data</TD></TR>
</TABLE>>];
}
}
gltf_binary__seq:header_type -> header__seq [style=bold];
gltf_binary__seq:chunks_type -> chunk__seq [style=bold];
chunk__seq:data_type -> chunk__seq_data_switch [style=bold];
chunk__seq_data_switch:case0 -> json__seq [style=bold];
chunk__seq_data_switch:case1 -> bin__seq [style=bold];
chunk__seq:type_type -> chunk__seq:data_type [color="#404040"];
}