TextureRegistry class
Texture store for the Player: a cellmap texture
hash → decoded ui.Image map, plus a cached identity ui.ImageShader per
image for drawVertices. Mirrors the sibling ports' hash-keyed texture map
(Godot _textures, Web IResourceManager.getTexture, Unity material map).
The hash must come from ss_runtime_hash_string / cellmap.name_hash (==
DrawBatch.texture_hash) — never re-implement FNV-1a on the Dart side.
Framebuffer blend selection and Paint construction are render concerns
that live on the render side (render/blend.dart + the internal player), not
here — this class only resolves textures. SsTextureLoader populates it
(embedded + reference modes).
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Drops every entry without releasing it — for a registry whose images are owned elsewhere. Prefer dispose unless the caller is handing the textures on to something else.
-
clearOverride(
int textureHash) → bool -
Clears the runtime replacement for
textureHash(revert to the loaded original). Returns whether one was actually set. The override image is the caller's and is never disposed here. -
contains(
int textureHash) → bool -
Whether a texture is already registered for
textureHash. Lets a loader skip re-decoding an atlas a sibling pack has already brought in (a root and its instance children routinely share one cellmap). -
dispose(
) → void - Releases every decoded image and cached shader, then empties the maps.
-
flushRetired(
) → void - Disposes shaders retired by setOverride / clearOverride. Called once per top-level frame (before the backend begins the frame), the point at which the previous frame's recorded picture is guaranteed to have rasterised — so a live swap can never dispose a shader a pending picture still reads.
-
hasOverride(
int textureHash) → bool -
Whether a runtime replacement is currently set for
textureHash. -
imageFor(
int textureHash) → Image? -
The effective image for
textureHash— the runtime setOverride if one is set, otherwise the loaded original. Null when neither exists. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overrideImageFor(
int textureHash) → Image? -
The runtime replacement set for
textureHash(the override VALUE only, never the loaded original), or null when none is set — mirrors ForGodot'sget_cellmap_texture. -
register(
int textureHash, Image image, {FilterQuality filterQuality = ui.FilterQuality.low, TileMode tileMode = ui.TileMode.clamp}) → void -
Registers (or replaces) the decoded image for a
cellmaptexture hash, together with its sampling. Both are the app's choice, never the cellmap'sfilterMode/wrapMode:filterQualityis bilinear ui.FilterQuality.low by default (ui.FilterQuality.none for crisp pixel art), andtileModeis clamp. Baked into the ui.ImageShader sodrawVerticeshonours it — otherwise the shader inheritsPaint.filterQuality, which defaults to ui.FilterQuality.none and makes every scaled/rotated sprite jaggy. -
setOverride(
int textureHash, Image image, {FilterQuality? filterQuality, TileMode? tileMode}) → void -
Sets a runtime replacement for
textureHash: every subsequent lookup (imageFor / shaderFor) returnsimagein place of the loaded original.imageis not owned by the registry — keep it alive while it is set and dispose it yourself once it is cleared or replaced. -
shaderFor(
int textureHash) → ImageShader? -
The identity-matrix ui.ImageShader for a texture hash (cached), or null
when no image is registered.
drawVerticessamples it in image-pixel space, so the Brain's texture-pixel UVs are passed straight through. Tile mode + filter quality are the ones given to register. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited