Ktx2Texture class final
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.
vkFormat, not TextureFormat. ap-01 in
doc/asset-pipeline-plan.md: this class used to carry the engine's own
TextureFormat, and carrying it here would put flutter3d_hardware —
and the Flutter SDK it needs — on this package's own dependency graph,
the thing flatDartPackages exists to keep off it. Reading a container
and knowing which pixel formats a specific GPU backend accepts are two
different questions; this answers only the first, honestly, in the
container's own vocabulary — the Khronos VkFormat numbers, not an
engine's. flutter3d's own Ktx2Texture wraps this one and does the
second: see its own doc comment for why the exact same wrapping act,
with the exact same reasoning, is not new to this session.
See ktx2_format.dart for the layout and for exactly which files this
stage refuses rather than misreads.
levels are views over the bytes passed to parse — ByteData.view has
no alignment requirement, unlike Uint32List.view/Float32List.view, so
unlike .f3d's loader this needs no copying fallback for an odd offset.
Constructors
- Ktx2Texture.parse(Uint8List bytes, {UniversalTarget? universalTarget})
-
Reads
bytesas a KTX2 file.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
levels
→ List<
ByteData> -
Level 0 (the base, largest image) first.
final
- pixelHeight → int
-
final
- pixelWidth → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- vkFormat → int
-
The Khronos
VkFormatnumber the mip bytes are in — see VkFormat for the subset this container ever carries. A Basis Universal file, ETC1S or UASTC, comes out of here as plain RGBA8, so this is VkFormat.r8g8b8a8UNorm for those paths too: one vocabulary for "what format are these bytes in", whichever path produced them.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited