Graphics3DModels class final
The models a game's scenes use, each loaded once per asset path: read from bundle, parsed, uploaded with uploader.
Constructors
- Graphics3DModels(AssetBundle bundle, ModelUploader uploader)
-
A cache loading through
bundleand uploading withuploader.
Properties
- bundle → AssetBundle
-
Where model files are read from.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
listeners
→ List<
void Function(String path)> -
Called each time a model finishes loading, and when one is let go:
to be loaded again (reload) or no longer kept (retainOnly,
clear).
final
-
paths
→ Iterable<
String> -
Every path asked for so far.
no setter
-
readOverride
↔ Future<
Uint8List?> Function(String path)? -
Reads a file in place of bundle when it returns bytes; null falls
back to the bundle. An editor sets it to read the project's files,
which the bundle — a snapshot from when the app was built — may not
have yet.
getter/setter pair
-
reloadListeners
→ List<
void Function(String path)> -
Called once a model reload asked for has loaded again — once per
reload, after listeners — so what was made from the old file (3-D
physics' mesh colliders) is made again from the new one.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uploader → ModelUploader
-
Uploads parsed models.
final
Methods
-
clear(
) → void - Lets go of every model that has loaded (or failed to), as retainOnly with nothing kept.
-
dataOf(
String path) → ModelData? -
The parsed data of the model at
path, once loaded. -
errorOf(
String path) → Object? -
Why the model at
pathdid not load, or null. -
get(
String path) → GpuModel? -
The model at
pathonce it has loaded; null before that (the first call starts loading it) or when it failed to load. -
load(
String path) → Future< GpuModel> -
Loads the model at
path, or returns the load already under way. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String path) → Future< Uint8List> -
The bytes of the file at
path, through readOverride or bundle. -
reload(
String path) → void -
Loads the model at
pathagain (its file or its cooked copy changed): until the new one arrives get is null for it. Tells listeners now and as it arrives, and reloadListeners once it has. Nothing happens for a path never asked for. -
retainOnly(
Iterable< String> keep) → int -
Lets go of every model not at a path in
keep— what a level no longer draws leaves the GPU — and tells listeners of each. A model still loading is kept; one asked for again loads again. Returns how many went. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited