toGltf method
The model as .gltf JSON with its buffer inline as a data: URI, or
as bufferUri when given (the caller serves those bytes).
Implementation
(String, Uint8List) toGltf({String? bufferUri}) {
final bin = _buffer();
final out = Map<String, dynamic>.of(json)
..['buffers'] = [
{
'byteLength': bin.length,
'uri':
bufferUri ??
'data:application/octet-stream;base64,${base64Encode(bin)}',
},
];
return (jsonEncode(out), bin);
}