formats library
The formats a model arrives in and leaves in: the document every decoder
produces, the materials it names, the readers and writers for glTF/GLB,
OBJ, STL, USDZ and the engine's own .f3d and .fmat, the FBX decoder that
recognises a file and refuses it with a reason, the image codecs, and the
KTX2 container a compressed texture sits in.
A library of flutter3d_core, importable on its own. A modeller's
document layer, the server an agent starts with dart run, a service that
checks an uploaded asset and a plain dart test all read a .glb or a
.ktx2; none of them resolves a Flutter SDK, and none of them has to import
the renderer to do it. This was flutter3d_formats (and flutter3d_fbx)
until the package boundary turned out to protect nothing a library does not.
The line is drawn at bytes. This library turns bytes into a document.
The KTX2 reader stops at vkFormat, a Khronos number; mapping it to the
hardware's own TextureFormat is the engine's Ktx2Texture, which is why
flutter3d_core.dart exports this library with this one's Ktx2Texture
hidden. What fetches the bytes — the asset bundle, the isolate — and what
uploads the result is the renderer's.
Classes
- AnimationClip
- A named set of tracks that play together.
- AnimationMask
- The joints one animation layer writes, by node index.
- AnimationTrack
- One animated property of one node.
- AssetRequest
- What a resolver is being asked for.
- AssetSource
- Where a model and its sibling files live.
- CheckedModelWriter
-
A writer whose files this package can also read, so a write can be checked
by reading it back — what
exportCheckeddoes. - ColorHint
- A colour of channels components — three for a tint, four when the fourth is opacity.
- DecodedImage
-
A PNG decoded down to plain RGBA8 — top row first, four bytes a pixel,
width * height * 4bytes long. - DocumentAsset
- What the source file said about itself, as opposed to what it contains.
- DocumentDifference
- One thing a round trip did not preserve.
- DracoAttribute
- One decoded attribute.
- DracoAttributeType
-
Draco's
GeometryAttribute::Type. - DracoMesh
- What a decoded primitive carries.
- EncodedImage
- An image still in its source encoding (PNG, JPEG, …).
- EnumHint
- One of values, and nothing else.
- EnumHintValue
- One choice in an EnumHint: what is written into the file, and what a person reads in the list.
- ExportReport
- One write, read back and checked against what went in.
- F3dAttributeFlags
-
Bit positions inside a
surfaceAttributesrecord — one per nameVertexLayout's own attributes use. - F3dDecoder
-
.f3dthrough the same ModelDecoder boundary an application's own formats come through, so every built-in reader is one: seebuiltInModelDecoder. - F3dDocument
-
A
.f3dfile, read as a ModelDocument. - F3dModelWriter
-
.f3d, the engine's own container. - F3dMorphFlags
- Which optional streams a morph target record carries.
- F3dRecord
- Fixed record sizes, in bytes. All multiples of four.
- F3dSamplingFlags
-
Bit positions inside a texture binding's
samplingFlags. - F3dSection
- Section kinds.
- F3dWriter
-
Serializes any ModelDocument into the
.f3dcontainer. - FbxDecoder
-
A
ModelDecoderfor Autodesk's FBX — the skeleton this package's ownpubspec.yamldescribes: recognises the format, and says plainly that reading one is not built here yet. - GlbContainer
- A parsed glTF container: the JSON document plus the optional binary chunk.
- GlbModelWriter
- A self-contained glTF binary.
- GltfAccessorReader
- Reads accessors out of the resolved glTF buffers.
- GltfAsset
- The decoded result of a glTF or GLB file.
- GltfLoader
- Decodes glTF 2.0 and GLB into engine geometry.
- GltfWriter
- Serializes any ModelDocument into glTF's binary container.
- Ktx2ColorModel
-
The data format descriptor's
colorModel, for the values that matter whenvkFormatis undefined —gfx-78n. - Ktx2GlobalDataField
-
The Basis Universal "supercompression global data" a
supercompressionScheme == basisLZfile carries: the endpoint and selector codebooks, the per-block bitstream's Huffman tables, and oneImageDescper image telling where in the level's own bytes the RGB (and optionally alpha) slice lives. - Ktx2HeaderField
- Byte offsets of the header fields, relative to kKtx2HeaderOffset.
- Ktx2ImageDescField
- Ktx2IndexField
- Byte offsets of the Index section's fields, relative to kKtx2IndexOffset — the pointers to the data format descriptor, the key/value data, and (for a Basis Universal file) the supercompression global data this stage now reads.
- Ktx2SupercompressionScheme
-
supercompressionSchemevalues this format defines. - Ktx2Texture
- A KTX2 file, read down to what a texture upload needs: dimensions, the raw vkFormat its mip bytes are in, and each level's bytes.
- LightingModel
- A lighting model: one pre-built fragment shader and what the engine may bind to it.
- MaterialBinary
-
+ - * /, with GLSL's broadcasting: a float beside a vector spreads. - MaterialBindings
-
What describeMaterial found, in the shape
LightingModeltakes. - MaterialBuiltin
- A function the language knows, its type rule and how to compute it.
- MaterialCall
- A call to one of MaterialBuiltin.all.
- MaterialConstant
-
A literal, and the one place a
vec3(1.0, 0.0, 0.0)that is entirely constant ends up: the parser folds a constructor whose arguments are all literals, because a parameter is a constant too and folding is what makes a variant's value reach the shader as a number. - MaterialConstruct
-
vec3(...),vec4(...)and the rest, with arguments that are not all constant. - MaterialDocument
- A material as a file of its own, rather than as part of a model.
- MaterialExpression
- An expression, typed by the parser rather than by whoever reads it later.
- MaterialHint
- A kind with the words that go around it.
- MaterialHintKind
- What a control for one value should look like.
- MaterialInput
- One value the fragment body can read.
- MaterialInputRef
- One of kMaterialInputs.
- MaterialLet
-
let name = expr;— single assignment, so nothing here is a variable. - MaterialLocalRef
-
A
letbound earlier in the body. - MaterialNegate
-
Unary minus. The only unary operator, because
!needs a bool type the language has not got. - MaterialParameter
- One declared parameter: a name, a type and the value a variant that says nothing about it gets.
- MaterialParamRef
- A declared parameter, before a variant has said what it is.
- MaterialProgram
- A material read from source: its name, what it declares, and its body.
- MaterialReturn
-
return expr;— avec4, rgb being the light the surface emits and a its opacity, which is whatWriteSurfacetakes. - MaterialSample
-
sample(slot, uv). - MaterialStatement
- MaterialSurfaceValues
- What a fragment of the surface being shaded is, for evaluateMaterial.
- MaterialSwizzle
-
.x,.rgb,.xy— component indices into the target. - MaterialTextureSlot
- One texture slot the material samples, by the name the engine binds it under.
- MaterialType
- A type in the material language.
- MaterialVariant
- One compiled entry point: a program with its parameters pinned.
- ModelCamera
-
A camera decoded from glTF's own
cameras, or held for a writer to encode into it —fmt-28's own row, the other half beside ModelLight. - ModelCameraProjection
-
How a decoded camera projects — glTF's own two, perspective and
orthographic, and no others: the core specification defines exactly
these two
camera.typevalues. - ModelDecoder
- A decoder for a format the engine does not ship.
- ModelDocument
- A decoded model, whatever format it came from.
- ModelLight
-
A punctual light, decoded from
KHR_lights_punctualor held for a writer to encode into it —fmt-28's own row. - ModelLoadRequest
- Everything a decode needs, in one sendable object.
- ModelLod
-
One level of detail a node offers in place of its own full surface list
—
pro-eng-06's own row. - ModelNode
- A node in a decoded model's hierarchy.
- ModelOrthographicCamera
-
camera.orthographic— a view volume's own half-extents, both planes required. - ModelPerspectiveCamera
-
camera.perspective— a field of view and a near plane, an aspect ratio and a far plane that both may be absent. - ModelSkin
- A skeleton: which nodes are joints, and how each undoes the bind pose.
- ModelSurface
- One drawable piece of a decoded model.
- ModelWrite
- What one write produced.
- ModelWriter
- A format a ModelDocument can be written as.
- MtlMaterial
-
A material exactly as written in a
.mtlfile. - ObjDocument
- The decoded contents of an OBJ file.
- ObjLoader
-
Decodes Wavefront OBJ, optionally with its
.mtlmaterial libraries. - ObjModelWriter
-
Wavefront OBJ, with its
.mtlbeside it when the document names a material. - ObjWriter
-
Encodes any ModelDocument as Wavefront OBJ, with its
.mtlbeside it. - PlainModelDocument
- A ModelDocument assembled by hand, from plain lists.
- RangeHint
- A number with two ends and, when it is not continuous, an increment.
- Rgba8Image
-
A decoded source image: tightly packed RGBA8, row-major, top row first —
exactly what
ui.Image.toByteData(format: rawStraightRgba)hands the engine's own texture upload path, and what every encoder inencode/takes in. - SplatCloud
- A fitted cloud, in the units the file stored.
- StlLoader
- Decodes STL, binary or ASCII.
- StlModelWriter
- STL, binary or ASCII.
- StlWriter
-
Encodes any ModelDocument as STL, binary or ASCII —
fmt-20's own row. - SurfaceMaterial
- Format-neutral description of how a surface looks.
- TextureBinding
- A reference from a material to one of the document's images.
- TextureHint
- A path to an image, and what a file picker should offer.
- TextureSampling
- Filtering and wrapping requested for a texture.
- TextureTransform
-
KHR_texture_transform's three fields — see TextureBinding.transform. - UniversalTarget
- What a universal level can be turned into at load.
- UsdzModelWriter
-
.usdz— geometry only, the spike UsdzWriter describes. Not a CheckedModelWriter: nothing here reads a.usdz. - UsdzWriter
-
Encodes a ModelDocument as
.usdz—fmt-27's own row, and a spike rather than the feature-complete writer every other format here has: geometry only, no materials, no hierarchy past oneMeshprim per surface. What decides whether it grows past that is stated in the plan as a question — is there demand — and a spike is exactly the size of thing that can answer it without committing to the rest up front. - UsdzZip
-
A ZIP archive holding
entriesuncompressed, each one's data padded to start at a 64-byte offset — the one structural rule.usdzadds on top of an ordinary ZIP. - VkFormat
-
The subset of Vulkan's
VkFormatthis loader maps to a TextureFormat. - WrittenFile
- One file a write produced.
Enums
- AnimationInterpolation
- How a track's values are blended between keyframes.
- AnimationPath
- Which node property a track drives.
- GltfAccessorType
-
glTF accessor
typevalues. - GltfComponentType
-
glTF
componentTypevalues. - GltfPrimitiveMode
- glTF primitive topology.
- ModelFormat
- Which decoder to use.
- ModelLightType
-
The shape a light's falloff takes —
KHR_lights_punctual's own three, and no others, since the extension defines exactly these three and a fourth is not a thing a decoded document can honestly claim to hold. - ObjNormals
- How to fill in normals that the file does not provide.
- StlNormals
- How a facet's normal is chosen.
- SurfaceAlphaMode
- How a surface treats the alpha channel.
- TextureWrap
Constants
-
builtInModelExtensions
→ const Map<
String, ModelFormat> - Every file suffix a built-in reader answers to, and which reader.
-
builtInModelWriters
→ const List<
ModelWriter> - Every writer this package ships, in the order a menu would offer them.
- kF3dHeaderBytes → const int
- kF3dMagic → const int
-
F3D\n, chosen so a file opened in a text editor announces itself on line one and the trailing newline stops the magic from running into what follows. - kF3dSectionEntryBytes → const int
- kF3dVersion → const int
- Bumped when an existing record changes meaning. Adding a section does not need it — an old reader skips what it does not recognise.
- kFmatVersion → const int
- The version this reader writes and the only one it accepts.
- kKtx2HeaderBytes → const int
- kKtx2HeaderOffset → const int
-
kKtx2Identifier
→ const List<
int> -
AB 4B 54 58 20 32 30 BB 0D 0A 1A 0A— the twelve-byte identifier every KTX2 file starts with. - kKtx2IndexBytes → const int
- kKtx2IndexOffset → const int
- kKtx2LevelIndexEntryBytes → const int
- kKtx2LevelIndexOffset → const int
-
kMaterialInputs
→ const List<
MaterialInput> - Every input, and the single list of them.
-
kMaterialTextureBindings
→ const List<
String> -
What the engine binds, and therefore the only names a
texturedeclaration may point at. - kSplatShC0 → const double
- The spherical-harmonic normalisation the 3D Gaussian Splatting papers and every exporter after them use for the zeroth band.
- kUniversalBlockKey → const String
- The KTX2 key/value key that says a file's blocks are these.
- kUniversalBlockRgb → const String
- The key's value for a texture whose alpha is opaque throughout.
- kUniversalBlockRgba → const String
- The key's value for a texture that carries alpha.
Properties
-
builtInMaterialHints
→ Map<
String, MaterialHint> -
Hints for the fields every material has, held here rather than written into
every file.
final
Functions
-
applyBinary(
String op, List< double> a, List<double> b) → List<double> -
+ - * /on two values, with GLSL's broadcasting. -
broadcastArguments(
List< List< arguments, MaterialBuiltin builtin) → List<double> >List< double> > - Spreads a one-component argument across the widest one, for the builtins that take a float beside a vector.
-
buildMipChain(
Rgba8Image base, {bool srgb = false, bool isNormalMap = false, double? alphaTestThreshold}) → List< Rgba8Image> -
Builds a full mip chain from
basedown to a 1×1 level, each level a proper Kaiser-windowed resample of the one above rather than a box average —ap-08indoc/asset-pipeline-plan.md. -
builtInModelDecoder(
ModelFormat format, ModelLoadRequest request) → ModelDecoder -
The decoder this package ships for
format, configured fromrequest. -
canDecodeFileName(
String fileName, {List< ModelDecoder> decoders = const <ModelDecoder>[]}) → bool -
Whether a file called
fileNameis one decodeModelBytes would read on its name alone — a built-in suffix, or one ofdecodersclaiming it. -
checkMaterialSurface(
Map< String, List< inputs) → voiddouble> > -
Throws ArgumentError unless
inputsanswers every name in kMaterialInputs, with the right number of components. -
compareModelDocuments(
ModelDocument source, ModelDocument readBack, {double tolerance = 0.0, bool allowVertexReorder = false}) → List< DocumentDifference> -
What
readBacklost or changed againstsource. Empty means the round trip held. -
decodeDataUri(
String uri) → Uint8List -
Decodes a
data:URI payload. -
decodeDraco(
Uint8List bytes) → DracoMesh -
Decodes
bytes, the contents of the buffer view a primitive'sKHR_draco_mesh_compressionextension points at. -
decodeImagePure(
Uint8List encoded) → Future< Rgba8Image?> -
Decodes
encodedinto straight RGBA8 pixels with no Flutter SDK and nodart:uibehind it —mcp-04n: the headless half offlutter3d_core's ownImageDecodertypedef, which this function's signature already matches structurally without needing to import it (flutter3d_formatssits belowflutter3d_corein the dependency order, so the import would run backwards). -
decodeJpeg(
Uint8List bytes) → DecodedImage? -
bytesdecoded, or null on anything this reader cannot make sense of: a missingSOI, a precision or frame type this reader does not support, a Huffman code with no match, or entropy data that runs out before every MCU is accounted for. -
decodeModel(
ModelLoadRequest request) → Future< ModelDocument> - Decodes a model on the calling isolate.
-
decodeModelBytes(
ModelLoadRequest request, Uint8List bytes, AssetUriResolver resolveUri) → Future< ModelDocument> - Decodes already-read bytes with an explicit resolver.
-
decodePng(
Uint8List bytes) → DecodedImage? -
bytesdecoded, or null on anything this reader cannot make sense of: a signature that does not match, a chunk running past the end of the file, a colour type or bit depth combination the PNG specification does not allow, interlacing, or anIDATstream zlibInflate itself refuses. -
decodeUniversalBlock(
Uint8List blocks, int index) → List< (int, int, int, int)> -
The sixteen texels of block
index, row-major — what the legs with no structural shortcut start from, and what a test compares against. -
describeMaterial(
MaterialProgram program) → MaterialBindings -
What the engine may bind to
program's compiled shader. -
emitMaterialFragment(
MaterialProgram program) → String -
The
.fragsource forprogram, which should already be specialised. -
encodeAstc4x4(
Rgba8Image image) → Uint8List -
Encodes
imageas ASTC 4×4 LDR (vkFormat.astc4x4UNormBlock): one 16-byte block per 4×4 tile — mat-30's own gap on top offmt-22's BC1/BC3/ETC2 trio,doc/asset-pipeline-plan.md'sap-07. -
encodeAstc4x4Block(
List< (int, int, int, int)> pixels) → Uint8List -
Encodes one 4×4 block (row-major, alpha ignored) as sixteen bytes: the
11-bit
_kBlockMode, a 2-bit partition count of zero (one partition), a 4-bit CEM of_kCemLdrRgbDirect, six_kColorBits-wide endpoint channel values, then sixteen_kWeightBits-wide per-texel weights packed downward from bit 127 — 17 + 48 from the bottom and 48 from the top, leaving the fifteen bits between them zero. -
encodeBc1(
Rgba8Image image) → Uint8List -
Encodes
imageas BC1 (vkFormat.bc1RgbaUNormBlock): one 8-byte block per 4×4 tile, two RGB565 endpoints and sixteen 2-bit palette picks. -
encodeBc3(
Rgba8Image image) → Uint8List -
Encodes
imageas BC3 (vkFormat.bc3UNormBlock): sixteen bytes per 4×4 tile — an eight-byte alpha block, then the same eight-byte colour blockencodeBc1Blockwrites, in that order. -
encodeCompressedPng(
int width, int height, Uint8List rgba) → Uint8List -
rgba(width×height, four bytes a pixel, top row first — the same shape DecodedImage.rgba reads back) written as an 8-bit RGBA PNG. -
encodeEtc2Rgb8(
Rgba8Image image) → Uint8List -
Encodes
imageas ETC2 RGB8 (vkFormat.etc2R8g8b8UNormBlock): one 8-byte block per 4×4 tile. -
encodeEtc2Rgb8Block(
List< (int, int, int, int)> pixels) → Uint8List - Encodes one 4×4 block (row-major, alpha ignored) as the eight bytes of an ETC1-compatible ETC2 RGB8 block — flip = 0, top and bottom 4×2 halves each with their own base colour and modifier table.
-
encodeUniversalBlock(
List< (int, int, int, int)> pixels) → Uint8List -
Encodes one 4×4 block (sixteen
(r, g, b, a)tuples, row-major). -
encodeUniversalBlocks(
Rgba8Image image) → Uint8List -
Encodes
imageas universal blocks, one per 4×4 tile. -
evaluateMaterial(
MaterialProgram program, MaterialSurfaceValues surface) → List< double> -
The colour
programreturns for one fragment: rgb the light the surface emits, a its opacity. -
exportChecked(
ModelDocument document, CheckedModelWriter writer, {String name = 'model'}) → Future< ExportReport> -
Writes
documentthroughwriter, reads the files back through the same writer and compares at CheckedModelWriter.tolerance. -
exportToF3d(
ModelDocument document, {String name = 'model'}) → ExportReport -
Writes
documentto this engine's own.f3dcontainer, reads the result back and compares. Synchronous, unlike the other three:.f3dis read as a view over its own bytes rather than decoded, and nothing in that path is asynchronous either. -
exportToGlb(
ModelDocument document, {String name = 'model'}) → Future< ExportReport> -
Writes
documentas glTF, reads the result back and compares — a binary format, so the round trip is held to a tolerance of0.0. -
exportToObj(
ModelDocument document, {String name = 'model'}) → Future< ExportReport> -
Writes
documentas OBJ (with its.mtlbeside it, when the document names a material), reads the result back and compares — held toObjWriter.decimals' own precision rather than0.0, since a decimal text format rounds on the way out by design. -
exportToStl(
ModelDocument document, {String name = 'model'}) → Future< ExportReport> -
Writes
documentas binary STL, reads the result back and compares. -
hasConflictingTextureTransforms(
SurfaceMaterial material) → bool -
Whether the textures of
materialname transforms that cannot all be honoured by one set of coordinates — the case a caller warns about. -
hdrSizeOf(
Uint8List bytes) → ({int height, int width})? -
How big
bytessays it is, without decoding a pixel of it —ux-49. -
inflate(
Uint8List data) → Uint8List? -
A raw DEFLATE stream, with no zlib wrapper around it — zlibInflate's
own worker, public because a caller that already has the wrapper
stripped (or none at all, as in a raw
.deflatestream) should not have to fake one back on to call this. -
isBasisUniversalKtx2(
Uint8List bytes) → bool -
True when
bytesis a KTX2 file whosevkFormatis undefined — a Basis Universal file, whose pixels are a transcode rather than a copy. -
isBinaryStl(
Uint8List bytes) → bool -
True when
bytesis a binary STL file. -
isF3dFile(
Uint8List bytes) → bool -
True when
bytesbegins with the.f3dmagic. -
isFmat(
Uint8List bytes) → bool -
Whether
byteslook like a.fmat. -
isKtx2BasisUniversal(
Uint8List bytes) → bool -
Whether
bytesis a KTX2 file Basis Universal produced —fmt-21's own row, the check that decides whether a texture can travel asKHR_texture_basisuor has to be embedded the ordinary way instead. -
isKtx2File(
Uint8List bytes) → bool -
True when
bytesbegins with the KTX2 identifier. -
looksLikeAsciiStl(
Uint8List bytes) → bool -
True when
byteslooks like the text dialect:solid(any case), once leading whitespace is skipped. -
modelWriterNamed(
String asked, {List< ModelWriter> writers = builtInModelWriters}) → ModelWriter? -
The writer in
writersthataskednames — by ModelWriter.name first, then by ModelWriter.suffix, with or without its dot, ignoring case — or null when none does. -
parseMaterial(
String source) → MaterialProgram -
Reads
sourceas one material. -
parseMtl(
String text, {List< String> ? warnings}) → Map<String, MtlMaterial> -
Parses a
.mtllibrary. -
parseSplatPly(
Uint8List bytes) → SplatCloud -
The cloud in
bytes, or a thrown SplatPlyException saying why not. -
readFmat(
Uint8List bytes, {String name = ''}) → MaterialDocument -
Reads a
.fmatmaterial. -
readHdr(
Uint8List bytes) → HdrImage -
bytesas an HDR image. -
recognizedModelFormat(
String fileName) → ModelFormat? -
The format
fileName's own extension names, or null when it names none of the four this package reads. -
safeRelativeAssetPath(
String uri) → String -
A reference inside a model is always relative to the model. An absolute path
or a
..segment means the file is reaching outside its directory, which is worth refusing rather than resolving. -
The one transform every texture of
materialasks for, or null. -
sniffImageMimeType(
Uint8List bytes) → String? - Guesses an image's MIME type from its leading bytes.
-
sniffModelFormat(
Uint8List bytes) → ModelFormat - Guesses a format from the leading bytes.
-
specialiseMaterial(
MaterialProgram program, MaterialVariant variant) → MaterialProgram -
programwithvariant's parameter values folded in, ready to emit or to evaluate. -
splatChannel(
double coefficient) → double - A zeroth-band spherical-harmonic coefficient as a colour channel.
-
splatOpacity(
double logit) → double -
logitthrough the logistic function, which is how a file stores opacity. -
surfaceMaterialFromJson(
Map< String, Object?> json, {String? name, List<String> ? warnings, TextureBinding? baseColorTexture, TextureBinding? normalTexture, TextureBinding? metallicRoughnessTexture, TextureBinding? occlusionTexture, TextureBinding? emissiveTexture}) → SurfaceMaterial -
The inverse of surfaceMaterialToJson: a SurfaceMaterial built from
json's own scalar and colour fields, withnameas the fallback for a document that names itself no other way and the five texture bindings supplied by the caller — already resolved against whatever documentjsoncame from, the same division surfaceMaterialToJson draws. -
surfaceMaterialToJson(
SurfaceMaterial surface) → Map< String, Object?> -
surface's own scalar and colour fields, keyed the way writeFmat nests them into a.fmat— everything but its texture slots, which surfaceMaterialFromJson takes as separate, already-resolved arguments rather than reading here. -
toGltfFilters(
TextureSampling sampling) → (int, int) -
The
(magFilter, minFilter)GL constant pair a glTF writer should emit forsampling— the exact inverse of_decodeSampler's filter half, so a document decoded from glTF and written back out names the same constant it arrived with, mipmap variant included. -
transcodeUniversal(
Uint8List blocks, UniversalTarget target, {required int width, required int height}) → Uint8List -
blocksastarget, ready to upload. -
universalBlockFormat(
Uint8List bytes) → ({bool hasAlpha})? -
Whether
bytesis a universal-block file and whether it carries alpha, or null when it is an ordinary KTX2. -
validateGltfExport(
Uint8List bytes, {AssetUriResolver? resolveUri, double tolerance = 1e-5}) → Future< List< String> > -
Reads
bytesas glTF/GLB and checks every accessor's declaredmin/maxagainst the values it actually holds. -
withTextureTransform(
MeshData mesh, TextureTransform transform) → MeshData -
meshwithtransformapplied to its texture coordinates. -
writeFmat(
MaterialDocument document) → String -
Writes
documentback out, so a tool that edits a material can save it. -
writeKtx2(
{required int vkFormat, required int pixelWidth, required int pixelHeight, required List< Uint8List> levels, Map<String, String> keyValues = const <String, String>{}}) → Uint8List -
Assembles a KTX2 file from already-encoded mip levels — the writer half
of
ktx2_loader.dart, and the reasonap-07indoc/asset-pipeline-plan.mdlives beside it rather than influtter3d_build: both read and write the same container, in the same package, with no Flutter SDK behind either. -
writeKtx2WithMips(
Rgba8Image base, {bool srgb = false, bool isNormalMap = false, double? alphaTestThreshold}) → Uint8List -
ap-08's own glue: builds the mip chain overbaseand writes every level through writeKtx2 in one call, so a caller that wants a ready-to-load file does not have to know that a chain and a writer are two different pieces. -
zlibCompress(
Uint8List data) → Uint8List -
datacompressed as a complete zlib (RFC 1950) stream — the two-byte header, one final DEFLATE block, and the trailing Adler-32_adler32computes over the uncompressed bytes, which every real decoder checks even though this package's own zlibInflate does not. -
zlibInflate(
Uint8List zlib) → Uint8List? -
zlibdecompressed — the zlib header (RFC 1950) stripped and read, and the raw DEFLATE stream behind it inflated. Returns null rather than throwing on anything short, malformed, or naming a compression method or a block type this does not decode — the same "no size to answer with" conventionimageDimensionsalready uses for a truncated header, so a caller has one shape to check either way.
Typedefs
-
AssetUriResolver
= Future<
Uint8List> Function(AssetRequest request) - Resolves a URI referenced from inside an asset to its bytes.
- HdrImage = ({int height, Float32List rgb, int width})
- A decoded Radiance image: three floats a pixel, row 0 at the top.
Exceptions / Errors
- DracoException
- Thrown when a stream is not one this decodes, with the reason in it.
- F3dFormatException
-
Raised when a file is not a
.f3d, is truncated, or claims a version this build does not understand. - HdrFormatException
-
What a file that is not a readable
.hdris answered with. - Ktx2FormatException
- Raised when bytes are not a KTX2 file, are truncated, or use a feature this stage of the loader does not read yet — see the library doc comment for exactly which those are.
- MaterialSyntaxError
- A material source that could not be read, with where it went wrong.
- SplatPlyException
- Thrown when a file is not a PLY this can read, with the reason in it.