GlbWriter class final

Writes small glTF files for tests, so fixtures are generated, not checked-in binaries.

Add accessors, meshes, materials, nodes and images, then call toGlb (one file) or toGltf (JSON with the buffer as a data: URI).

Constructors

GlbWriter()

Properties

hashCode → int
The hash code for this object.
no setterinherited
json → Map<String, dynamic>
The glTF JSON being built; tests may add to it directly.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addAnimation(Map<String, dynamic> animation) → int
Adds an animation (raw glTF JSON: channels, samplers, name).
addFloats(List<double> values, String type, {bool withBounds = false}) → int
Adds float data as an accessor of type (VEC3, …). Positions get min/max when withBounds.
addImage(Uint8List bytes, {String mimeType = 'image/png'}) → int
Adds an embedded image of mimeType.
addInts(List<int> values, String type, int componentType, {bool normalized = false, bool indices = false}) → int
Adds integer data of componentType (5121 ubyte, 5122 short, 5123 ushort, 5125 uint), optionally normalized.
addMaterial(Map<String, dynamic> material) → int
Adds a material from raw glTF JSON.
addMesh(List<Map<String, dynamic>> primitives, {String? name}) → int
Adds a mesh of primitives (raw glTF JSON).
addNode(Map<String, dynamic> node) → int
Adds a node (raw glTF JSON).
addSkin(Map<String, dynamic> skin) → int
Adds a skin (raw glTF JSON: joints, inverseBindMatrices, …).
addSparse(int count, String type, List<int> indices, List<double> values) → int
Adds an accessor of count zeros whose indices are replaced by values (a sparse accessor with no bufferView).
addTexture(int image, {Map<String, dynamic>? sampler}) → int
Adds a texture of image.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setScene(List<int> roots) → void
Sets the scene to roots.
toGlb() → Uint8List
The model as one .glb.
toGltf({String? bufferUri}) → (String, Uint8List)
The model as .gltf JSON with its buffer inline as a data: URI, or as bufferUri when given (the caller serves those bytes).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited