flutter3d library
A 3D engine, written against a graphics vocabulary rather than a graphics API.
Everything a consumer needs is exported here. The layout behind it is not arbitrary and is worth knowing before reaching past this file:
- This package names no graphics API. It depends on
flutter3d_hardwareand nothing below it, so an application chooses a backend package today — and hands it toRenderer.create. That is checked, not intended:tool/structure.dart's "the engine names no backend" rule, which scans this package'slib/. The rule named here until now — "the hardware layer names no graphics API" — scansflutter3d_hardwareand says nothing whatever about this file's claim. geometry,scene,assetsandrender/key_sortneed no device at all, which is what lets bounds, culling, framing, picking, decoding and sorting be unit tested without one.
The shader bundle is still an asset of this package, and that is a known
wrinkle rather than a decision: a compiled bundle is one backend's output,
so it belongs with
the backend that can read it. The GLSL it is built from is shared. Moving it
is a question about where shader sources live, which is worth answering on
its own rather than as a side effect of the package split.
packages/flutter3d_impeller/tool/build_shaders.sh builds it — beside the
backend that needs it, not beside this package — and it has to be rebuilt
after every Flutter SDK change.
Classes
- AbsolutePixels
- A fixed size, for anything whose extent is its own business — a shadow atlas is the same size whatever the window is doing.
- AmbientOcclusionSettings
- Screen-space ambient occlusion.
- AnimationClip
- A named set of tracks that play together.
- AnimationLayer
- A clip played over part of a skeleton, on top of whatever the base is doing.
- AnimationMask
- The joints one animation layer writes, by node index.
- AnimationPlayer
- Plays AnimationClips onto animation targets.
- AnimationTarget
- What a player can drive.
- AnimationTrack
- One animated property of one node.
- AssetRequest
- What a resolver is being asked for.
- AssetSource
- Where a model and its sibling files live.
- AutoExposureSettings
- How the frame's own brightness decides its exposure.
- BakedPoses
- A clip's worth of joint matrices, ready to become a texture.
- BlendState
- How a draw is combined with what the attachment already holds.
- BloomSettings
- BufferLayout
- One buffer's worth of attributes, and how far apart its elements are.
- BundleAssetSource
- A model in the Flutter asset bundle.
- CameraNode
- A camera placed in the scene graph.
- CapsuleShape
- Capsule: a cylinder of height closed by two hemispheres of radius.
- CheckerboardTexture
- Two-tone checkerboard.
- ColorHint
- A colour of channels components — three for a tint, four when the fourth is opacity.
- ColorTarget
- One colour attachment of a pass.
- CommandEncoder
- A pass somebody opened, and must therefore close.
- CompiledFrameGraph
- The result: the nodes to run, in order, what was dropped, and how long each resource has to stay alive.
- ConeShape
- Cone with the apex at +Y: a cylinder whose top radius is zero.
- ContributorFrame
- Everything something drawing into someone else's pass is given.
- ContributorRegistry
- The contributors a renderer draws, and the order it draws them in.
- CpuMesh
- A mesh that lives only on the CPU.
- CuboidShape
- Axis-aligned box centred on the origin.
- CylinderShape
- Cylinder or truncated cone, centred on the origin, axis along Y.
- DebugColors
- Colours used by the built-in overlays, so a screenshot is readable without a legend.
- DebugDraw
- Accumulates debug line segments into one reusable interleaved buffer.
- DebugDrawOptions
- Which debug overlays to build for a frame.
- DepthTarget
- The depth and stencil attachment of a pass.
- DerivedShape
- A shape defined by delegating to another one.
- DeviceMesh
- A MeshData that has been uploaded to a device.
- DiscShape
- Flat annulus in the XZ plane facing +Y. An innerRadius of 0 gives a disc.
- DrawableGeometry
- A mesh that has reached the device and can therefore be drawn.
- DrawItem
- One entry in a render list.
- 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.
- EnvironmentMap
- Builds the cube a surface reflects: one environment, convolved by roughness.
- ExposureAdapter
- The exposure as it stands, and where it is going.
- ExposureMeter
-
The other end of
luminance.frag's encoding, and the arithmetic that turns a texture of stops into one exposure. - F3dDocument
-
A
.f3dfile, read as a ModelDocument. - 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. - FileAssetSource
- A model on the filesystem. Unavailable on web, which is why it is a separate source rather than a flag.
- FogSettings
- Distance fog.
- FrameFraction
- A fraction of the frame: full size at one, half at two.
- FrameGraph
- Collects nodes, then works out the frame.
- FrameGraphNode
- A pass, and the only thing an extension has to implement to become one.
- FramePassState
- Counters and bound state shared across everything encoded into one pass.
- FrameResourceIds
- Everything the frame produces or hands around.
- FrameResources
- The textures a frame's nodes read and write, acquired late and released early.
- FrameResult
- One rendered frame.
- FrameTextureSource
- Where a frame's textures come from, and where they go back to.
- FullscreenDraw
- One full-screen pass, described rather than assembled.
- GeometryBuffer
- A range of device memory holding vertices or indices.
- GlbContainer
- A parsed glTF container: the JSON document plus the optional binary chunk.
- 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.
- GraphicsDevice
- Everything the engine needs a graphics backend for.
- HitResult
- What a ray hit.
- ImmediateTextureSource
- A source that returns textures to the pool at once.
- InputAttribute
- One input of a vertex stage, and where in its buffer it starts.
- InstancedMeshNode
- One mesh drawn many times in one call, each copy with a transform and a colour of its own.
- 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, an engine TextureFormat, and each mip level's bytes.
- LatheShape
- A surface of revolution: a profile polyline swept around the Y axis.
- LayeredShaderLibrary
- Two libraries consulted in order, the first winning.
- LightBuffer
- The scene's active lights, packed the way the fragment shaders read them.
- LightingModel
- A lighting model: one pre-built fragment shader and what the engine may bind to it.
- LightNode
- A light placed in the scene graph.
- LoadedShaderLibrary
- A library a device built from bytes it was handed, and can rebuild.
- LodGroup
- Picks one of several meshes by how much of the screen the object covers.
- LodLevel
- One level of detail: a mesh and the screen size below which it takes over.
- LookSettings
- How much of the frame's light spills into a glow. The look put on the frame after it has been tone mapped.
- Material
- Surface appearance as plain data.
- MaterialDecoder
- A reader for a material format the engine does not ship.
- MaterialDocument
- A material as a file of its own, rather than as part of a model.
- MaterialHint
- A kind with the words that go around it.
- MaterialHintKind
- What a control for one value should look like.
- MaterialSortIds
- Assigns small dense integers to materials for use as a sort key.
- MeshBuilder
- Accumulates vertices and indices into growing typed arrays.
- MeshData
- CPU-side geometry: interleaved vertices plus indices.
- MeshGeometry
- What the scene needs to know about a mesh, without knowing where it lives.
- MeshNode
- A node that draws a mesh.
- MipChain
- Builds the levels below the base, from half size down to one by one.
- ModelAsset
- An immutable, GPU-resident model that can be placed in a scene any number of times.
- ModelDecoder
- A decoder for a format the engine does not ship.
- ModelDocument
- A decoded model, whatever format it came from.
- ModelInstance
- One placement of a ModelAsset in a scene.
- ModelLoadRequest
- Everything a decode needs, in one sendable object.
- ModelNode
- A node in a decoded model's hierarchy.
- ModelPart
- One drawable piece of a model: geometry, appearance, and where it sits relative to the model's own origin.
- ModelSkin
- A skeleton: which nodes are joints, and how each undoes the bind pose.
- ModelSurface
- One drawable piece of a decoded model.
- MorphBlend
- Blends a mesh's morph targets into a copy of its vertices.
- MorphSink
- A mesh whose morph weights an animation can drive.
- MorphState
- What one drawn mesh is morphing towards, and by how much.
- MorphTarget
- One shape a mesh can be blended towards, as deltas from its base vertices.
- MorphTexture
-
A mesh's morph deltas, packed the way
lib/morph.glslreads them. - MtlMaterial
-
A material exactly as written in a
.mtlfile. - NodeFrame
- Everything a node is given to build its pass from.
- ObjDocument
- The decoded contents of an OBJ file.
- ObjLoader
-
Decodes Wavefront OBJ, optionally with its
.mtlmaterial libraries. - OrbitController
- Turntable controls: orbit a node around a target point.
- OrthographicProjection
- PackedIndices
- Indices packed for GPU upload.
- PassContributor
- Something that draws inside a pass it does not own.
- PassEncoder
- A pass that is open, into which draws are recorded.
- PassState
- A pass's rasteriser state. Unset fields are not emitted.
- PerspectiveProjection
- PipelineHandle
- A vertex and a fragment stage, linked into something that can be bound.
- PlaneShape
- Subdivided plane in the XZ plane, normal pointing at +Y.
- ProbeFace
- Where each face looks and which way is up, in the order the faces are stored: +X, −X, +Y, −Y, +Z, −Z.
- ProceduralTexture
- A texture generated in code.
- Projection
- How a camera maps eye space onto clip space.
- RangeHint
- A number with two ends and, when it is not continuous, an increment.
- Ray
- A ray: an origin and a direction.
- Raycaster
- Casts rays against a Scene on the CPU.
- ReflectionProbeNode
- A point the scene is reflected from.
- ReflectionSettings
- Screen-space reflections.
- Renderer
- Draws a Scene through one or more RenderViews.
- RenderList
- Visible draws for one view, split into opaque and transparent halves.
- RenderNode
- Something that declares what it touches, owns a pass, and draws it.
- RenderNodeRegistry
- The nodes a renderer runs, and the order it runs them in.
- RenderPassDescriptor
- Everything a pass draws into.
- RenderServices
- What the renderer lends a contributor or a node.
- RenderSettings
- Scene-wide shading knobs that are not per-material.
- RenderTargetPool
- Reuses textures across frames, keyed by what makes them interchangeable.
- RenderTargetSpec
- What makes two render targets interchangeable.
- RenderView
- One camera rendering one target.
-
ResourceCache<
K, V> - A reference-counted cache of asynchronously loaded resources.
- ResourceDesc
- What a node is asking for when it writes a resource.
-
ResourceHandle<
V> - A borrowed reference to a cached resource.
- ResourceSize
- How large a resource is, relative to the frame or in its own right.
- ResourceVersion
- A resource as it stands between one write of it and the next.
- SamplerOptions
- How a texture is sampled.
- Scene
- A scene: a hierarchy of nodes plus flat registries of what is in it.
- SceneBvh
- A bounding volume hierarchy over bounding spheres.
- SceneNode
- A node in the scene graph: a name, a place in the hierarchy, and a transform.
- SceneShadows
- The shadow textures one scene draw samples, as the frame answered for them.
- ScreenRect
- A rectangle of a render target, in pixels.
- ShaderBundle
- A loadable shader bundle: a name, the SDK it was compiled on, the stages it claims, and a compiled section per backend that needs one.
- ShaderBundleStage
- One entry point a bundle claims to hold.
- ShaderHandle
- One compiled stage of a pipeline — a vertex or a fragment program.
- ShaderLibrary
- The stages a compiled bundle holds, addressed by name.
- ShaderLightType
- Light type codes as the shader reads them.
- ShadowAssignment
- Who owns which row, and whether the static atlas is stale.
- ShadowCandidate
- A light asking for a row this frame.
- ShadowFaceScheduler
- Which faces of the atlas are redrawn this frame.
- ShadowSettings
- ShadowSlotAllocator
- Hands out atlas rows, and tries hard not to move them.
- Shape
- A parameterized generator of geometry.
- Skeleton
- A posed skeleton: joint nodes plus the matrices that undo their bind pose.
- SkyDome
- An inside-out sphere, which is a sky the camera sits at the centre of.
- SkyGradient
- The cheapest description of a sky that still reads as one: three stops and a scattering lobe around the sun.
- SkyLook
- Where a SkyColour is being asked to look.
- SkySettings
- What the sky looks like, and whether there is one.
- SolidColorTexture
- A single flat colour.
- SphereShape
- UV sphere, a revolved meridian arc.
- StencilState
- How the stencil test treats the draws that follow, for one face.
- SurfaceMaterial
- Format-neutral description of how a surface looks.
- TextureAllocator
- Makes a texture. The one thing a pool cannot do on its own.
- TextureBinding
- A reference from a material to one of the document's images.
- TextureBlockLayout
- The block footprint and byte cost of a compressed TextureFormat — blockWidth by blockHeight pixels, bytesPerBlock bytes, however many channels or bits per channel the format packs into that block.
- TextureHandle
- A texture some backend owns, described in the engine's own vocabulary.
- TextureHint
- A path to an image, and what a file picker should offer.
- TextureSampling
- Filtering and wrapping requested for a texture.
- TorusShape
- Torus: a closed circular profile revolved around Y.
- VertexAttribute
- Describes a single vertex attribute.
- VertexLayout
- An ordered set of attributes making up an interleaved vertex.
- VertexLayoutSpec
- Every buffer a pipeline reads vertices from, in slot order.
- ViewModelNode
- Draws the first-person view model over the finished scene.
- ViewportRect
- Normalized viewport rectangle.
- VkFormat
-
The subset of Vulkan's
VkFormatthis loader maps to a TextureFormat. - XraySettings
- Silhouettes of what the walls hide.
Enums
- AnimationInterpolation
- How a track's values are blended between keyframes.
- AnimationPath
- Which node property a track drives.
- AnimationWrap
- How a clip behaves when it runs off its end.
- BlendFactor
- One term of a blend equation.
- BlendOperation
- How the two blend terms are combined.
- CompareFunction
- The test a depth or stencil comparison performs.
- CullMode
- Which faces the rasteriser discards.
- DepthRange
- What a backend's clip space maps depth onto.
- FramebufferOrigin
- Where a render target's first row of pixels is.
- FramePhase
- Where in the frame an application's node is registered.
- GeometryUsage
- What a buffer will be bound as.
- GltfAccessorType
-
glTF accessor
typevalues. - GltfComponentType
-
glTF
componentTypevalues. - GltfPrimitiveMode
- glTF primitive topology.
- IndexType
- The width of one index.
- LightType
- LoadAction
- What happens to an attachment's existing contents when a pass begins.
- MaterialAlphaMode
-
How a material treats the alpha channel, mirroring glTF's
alphaMode. - MinMagFilter
- Filtering between texels.
- MipFilter
- Filtering between mip levels.
- ModelFormat
- Which decoder to use.
- ObjNormals
- How to fill in normals that the file does not provide.
- PolygonMode
- Whether primitives are filled or drawn as edges.
- PrimitiveType
- How vertices are assembled into primitives.
- ResourceOrigin
- Where the pixels behind a bound resource came from.
- SamplerAddressMode
- What sampling outside the 0..1 range does.
- ShadowCasterFaces
- Directional shadow mapping settings. Which faces of a caster are drawn into a shadow map.
- ShadowCastingMode
- How a mesh takes part in the shadow passes.
- SortMode
- How a sub-list of draws is ordered.
- StencilFace
- Which side of a triangle a stencil configuration applies to.
- StencilOperation
- What happens to a stencil value once the stencil and depth tests have decided a fragment's fate.
- StorageMode
- Where an allocation lives and how it may be used.
- StoreAction
- What happens to an attachment's contents when a pass ends.
- SurfaceAlphaMode
- How a surface treats the alpha channel.
- TextureFormat
- The layout of one texel.
- TextureType
- What shape a texture is.
- TextureWrap
- VertexFormat
- The type of one vertex attribute, and how much room it takes.
- VertexStepMode
- Whether a buffer advances once per vertex or once per instance.
- WindingOrder
- Which winding counts as front-facing, wound in clip space: a transform that mirrors reverses the facing without touching the order the vertices arrived in, and every backend decides after the vertex stage rather than before it.
Extension Types
- ResourceId
- Something a node reads or writes, addressed by name.
Extensions
- DebugDrawGizmos on DebugDraw
- The shape-level overlays — boxes, axes, normals, frusta, spheres, light gizmos — and buildForScene, which assembles them from a Scene.
- MeshTangents on MeshData
- Tangent generation, split out of MeshData because Lengyel's method is a self-contained algorithm that only ever touches MeshData's public surface — an extension keeps it that way rather than granting it access to private state it does not need.
- ModelAssetInstantiate on ModelAsset
-
instantiateand its helpers, added to ModelAsset. - PassStateApply on PassEncoder
- Applies a PassState to an encoder.
- TextureFormatCompression on TextureFormat
- Whether a TextureFormat is stored in fixed-size blocks rather than one value per texel, and — for the formats where it is — how big those blocks are.
- TextureFormatStencil on TextureFormat
- Whether a TextureFormat carries an eight-bit stencil beside its depth.
Constants
- 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
- kMaxPayload → const int
- Largest payload the packing can represent.
- kNoHit → const double
- Returned instead of a distance when nothing was hit.
- kPayloadBits → const int
- Number of low bits reserved for the payload an entry carries alongside its key.
- kPayloadMask → const int
- Mask for the payload half of a packed entry.
- kRadixThreshold → const int
- Below this many entries a comparison sort wins.
- kSortKeyBits → const int
- Bits available to the sort key itself.
-
readbackFormats
→ const Set<
TextureFormat> -
The formats a readback hands back as they are: four bytes per pixel, one
per channel, which is what
GraphicsDevice.readbackpromises.
Properties
-
builtInMaterialHints
→ Map<
String, MaterialHint> -
Hints for the fields every material has, held here rather than written into
every file.
final
- kNeutralColor → Vector4
-
Opaque white: a vertex colour multiplies the surface, so this is the value
that changes nothing.
final
- kNeutralJoints → Vector4
-
Every vertex bound to joint zero.
final
- kNeutralTangent → Vector4
-
A unit tangent along +X with a positive bitangent sign.
final
- kNeutralWeights → Vector4
-
All the influence on the first joint.
final
Functions
-
advanceTime(
{required double time, required double deltaSeconds, required double length, required AnimationWrap wrap, required bool reversing}) → ({bool reversing, bool stopped, double time}) - Where a playhead lands after a step, and what the wrap did to it.
-
animationTrackKey(
AnimationTrack track) → int - Where a track sits in a pose: one number for a node and a path together.
-
assetUriResolver(
String baseAssetPath, {AssetBundle? bundle}) → AssetUriResolver - Resolves asset URIs against the Flutter asset bundle.
-
bindMaterial(
MaterialDocument document, {required GraphicsDevice device, required AssetUriResolver resolveUri, LightingModel lighting = LightingModel.pbr, List< String> ? warnings}) → Future<Material> - Turns a read material into one the renderer can draw with.
-
buildsMipChain(
GraphicsDevice device, TextureSampling sampling, int width, int height) → bool - Whether an image of this size, sampled this way, gets a mip chain.
-
decodeDataUri(
String uri) → Uint8List -
Decodes a
data:URI payload. -
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.
-
decodeModelInIsolate(
ModelLoadRequest request) → Future< ModelDocument> - Decodes a model on a background isolate.
-
describeEmptyFrame(
Scene scene, List< RenderView> views) → String? -
Why
scenedrew nothing throughviews, or null when something did draw. -
ensureSphereCapacity(
Float32List current, int count) → Float32List -
Grows
currentto holdcountspheres, reusing it when it already does. -
fileUriResolver(
String baseDirectory) → AssetUriResolver - Resolves asset URIs relative to a directory on disk.
-
followCamera(
MeshNode sky, CameraNode camera) → void -
Moves
skyto wherecamerais, which is what makes a ten-metre sphere a sky rather than a ball. -
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. -
isF3dFile(
Uint8List bytes) → bool -
True when
bytesbegins with the.f3dmagic. -
isFmat(
Uint8List bytes) → bool -
Whether
byteslook like a.fmat. -
isKtx2File(
Uint8List bytes) → bool -
True when
bytesbegins with the KTX2 identifier. -
loadMaterial(
AssetSource source, {required GraphicsDevice device, List< MaterialDecoder> decoders = const <MaterialDecoder>[], LightingModel lighting = LightingModel.pbr, List<String> ? warnings}) → Future<Material> - Reads and binds in one call, which is what an application usually wants.
-
loadMaterialDocument(
AssetSource source, {List< MaterialDecoder> decoders = const <MaterialDecoder>[]}) → Future<MaterialDocument> -
Reads the material at
source, with no device involved. -
lookAtRightHanded(
Vector3 eye, Vector3 target, Vector3 up) → Matrix4 -
A right-handed look-at whose camera looks down its own −Z, which is what
PerspectiveProjectionand this engine's[0, 1]depth convention expect. -
packSceneSpheres(
List< MeshNode> meshes, Float32List out) → int - Packs a scene's world bounding spheres for SceneBvh.
-
paintSky(
MeshData mesh, SkyColour colour) → void -
Writes
colourinto every vertex ofmesh, by the direction it sits in. -
parseMtl(
String text, {List< String> ? warnings}) → Map<String, MtlMaterial> -
Parses a
.mtllibrary. -
probeFaceIsMirrored(
FramebufferOrigin origin) → bool - Whether the view probeFaceViewProjection builds reverses the winding of every triangle drawn through it.
-
probeFaceViewProjection(
int face, Vector3 position, {required double near, required double far, required FramebufferOrigin origin, required DepthRange depthRange}) → Matrix4 -
The view-projection that draws
faceof a probe atpositioninto a cube face a sampler reads correctly, in the clip space of a backend with the givenoriginanddepthRange. -
radixSortPackedKeys(
Int64List buffer, Int64List scratch, int count, {Uint32List? counts}) → void - Least-significant-digit radix sort over bytes, stable by construction.
-
rayAabb(
Ray ray, Aabb3 box) → double -
Distance along
raytobox, or kNoHit. -
raySphere(
Ray ray, Vector3 centre, double radius) → double -
Distance along
rayto a sphere, or kNoHit. Inside counts as0. -
rayTriangle(
Ray ray, Vector3 a, Vector3 b, Vector3 c, {Vector2? outUv, bool cullBackFace = false}) → double - Möller–Trumbore ray/triangle intersection.
-
readbackRegionOf(
TextureHandle texture, ScreenRect? region) → ScreenRect -
The region a readback of
texturewill copy, or an ArgumentError saying why there is none. -
readFmat(
Uint8List bytes, {String name = ''}) → MaterialDocument -
Reads a
.fmatmaterial. -
samplerOptionsFor(
TextureSampling info) → SamplerOptions - Maps decoded sampling settings onto the engine's sampler description.
-
skyNode(
MeshGeometry mesh, {String name = 'sky'}) → MeshNode -
A node holding
mesh, flagged so that it behaves as a sky. -
sniffModelFormat(
Uint8List bytes) → ModelFormat - Guesses a format from the leading bytes.
-
sortPackedKeys(
Int64List buffer, Int64List scratch, int count, {Uint32List? counts}) → void -
Sorts the first
countpacked entries ofbufferascending. -
toDepthRange(
Matrix4 projection, DepthRange range) → Matrix4 -
projectionexpressed forrange. -
toFramebufferOrigin(
Matrix4 projection, FramebufferOrigin origin) → Matrix4 -
projectionadjusted for whereoriginputs row zero. -
uploadEncodedImage(
GraphicsDevice device, Uint8List encoded, {TextureSampling sampling = const TextureSampling(), void report(String message)?}) → Future< TextureHandle?> -
Decodes an encoded image (PNG, JPEG, KTX2, …) and uploads it through
device. -
viewAxisOf(
Matrix4 viewProjection, [Vector3? out]) → Vector3 -
Which way
viewProjectionlooks, as a unit vector in world space. -
writeFmat(
MaterialDocument document) → String -
Writes
documentback out, so a tool that edits a material can save it.
Typedefs
-
AssetUriResolver
= Future<
Uint8List> Function(AssetRequest request) - Resolves a URI referenced from inside an asset to its bytes.
- SkyColour = Vector4 Function(SkyLook look)
- The colour of the sky in the direction asked about.
Exceptions / Errors
- F3dFormatException
-
Raised when a file is not a
.f3d, is truncated, or claims a version this build does not understand. - FrameGraphError
- A graph that failed to compile, with the reason a person can act on.
- 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.
- ShaderBundleRefused
- Raised when a device will not load a bundle, and says which and why.