fromGlbBytes static method
Future<Node>
fromGlbBytes(
- Uint8List bytes, {
- GltfWarningCallback? onWarning,
- int? maxTextureSize,
Load a glTF binary (GLB) model directly from raw bytes.
No offline conversion is required, useful for runtime use cases such
as user-uploaded models, network-loaded assets, or model editors.
onWarning, when given, receives non-fatal import issues (an
unrecognized extension, an image that fell back to a placeholder);
without it they print instead.
maxTextureSize, when given, caps the longest side of every texture. A
larger image is scaled down as it decodes, keeping its aspect ratio, so
its full-size pixels are never held.
Example:
final bytes = await rootBundle.load('assets/dash.glb');
final node = await Node.fromGlbBytes(bytes.buffer.asUint8List());
Implementation
static Future<Node> fromGlbBytes(
Uint8List bytes, {
GltfWarningCallback? onWarning,
int? maxTextureSize,
}) {
return importGlb(
bytes,
onWarning: onWarning,
maxTextureSize: maxTextureSize,
);
}