Add Quick3DGltf: a native glTF 2.0 document model and parser
Introduce a new internal module containing a value-struct representation
of a glTF 2.0 document that mirrors the JSON schema, a parser for .gltf
JSON and the binary .glb container format, a resolver for data: URIs,
file paths and Qt resource paths, and typed accessor reading that
composes byte strides and sparse substitution and dequantizes normalized
integer data (which also covers KHR_mesh_quantization). Data for the
supported material extensions and KHR_lights_punctual is parsed into
typed members, unparsed extension objects remain available as raw JSON,
and an asset requiring an unsupported extension - notably
KHR_draco_mesh_compression and KHR_texture_basisu, whose decoders are
not shipped yet - fails with an error naming it. The module depends only
on QtCore and QtGui and is renderer-free, so tools and a future exporter
can use it, and it can later be considered for promotion to public API.
The parser resolves buffers eagerly and validates structure strictly, so
consumers can rely on the document being internally consistent:
out-of-range object references, accessors or buffer views extending past
their storage, truncated GLB containers and node hierarchy cycles all
fail the parse with a descriptive error, element counts are capped since
the specification gives no upper bound and the offset arithmetic needs
one, and buffer and image URIs that are not the relative references the
specification calls for are refused rather than loaded. Tolerable
violations are logged and repaired instead, matching the leniency of
other glTF consumers: a node with more than one parent or a scene root
that is not unique has the offending edge dropped, since the hierarchy
has to be a forest for consumers to recurse over it safely, but the rest
of the asset is still worth loading.
Task-number: QTBUG-148576
Change-Id: I1ef37bf2b313329f46d018c7d772c71e7463de6c
Reviewed-by: Christian Strømme <christian.stromme@qt.io>