ResourceRealizer class
Turns a document's resources into live, GPU-backed Geometry and Material objects, memoizing each so a resource shared by many nodes is realized once.
Procedural and payload-backed geometry, parameter materials, and embedded
rgba8 textures realize synchronously. External image assets, encoded
(PNG/JPEG) image payloads, and fmat materials need decoding or asset
loading, so they are resolved by preload (await it before realizing);
the synchronous path falls back to a placeholder for them.
Constructors
- ResourceRealizer(SceneDocument document, {AssetBundle? bundle, EnvironmentAssetLoader? environmentLoader, TextureAssetLoader? textureLoader})
-
Creates a realizer over
document.bundle(default rootBundle) resolves external image assets andfmatmaterials during preload.environmentLoaderbuilds an AssetEnvironment from outside the bundle (the editor loads a user-picked file from disk).textureLoaderdecodes a TextureResource.asset from outside the bundle the same way.
Properties
- bundle → AssetBundle
-
The asset bundle external assets and
fmatmaterials load from.final - document → SceneDocument
-
The document whose resources are realized.
final
- environmentLoader → EnvironmentAssetLoader?
-
Loads an AssetEnvironment from outside the asset bundle, or null to use
the bundle. See
EnvironmentAssetLoader.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textureLoader → TextureAssetLoader?
-
Decodes a TextureResource.asset from outside the asset bundle, or null
to use the bundle. See
TextureAssetLoader.final
Methods
-
environment(
LocalId id) → EnvironmentSettings? -
The realized look for an EnvironmentResource
id, or null whenidis not an environment resource. Environments are GPU-bound and async, so they are built in preload; this returns the cached result. -
geometry(
LocalId id) → Geometry -
The live geometry for resource
id, realized and memoized on first use. The result is stamped with its origin so the serializer can recover it. -
material(
LocalId id) → Material -
The live material for resource
id, realized and memoized on first use. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
preload(
{bool includeEnvironments = true}) → Future< void> -
Resolves the resources that need asynchronous work (external image
assets, encoded image payloads, and
fmatmaterials), caching them so the synchronous realize path finds them ready. -
texture(
LocalId id) → Texture -
The live texture for resource
id, realized and memoized on first use. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited