Interface IAssetRegistry
public interface IAssetRegistry : IDisposable
- Inherited Members
Methods
EstimateTextureBytes()
Estimates the total bytes consumed by all registered textures by iterating texture pixel format and dimensions. O(N) over registered textures. Intended for diagnostic snapshots — NOT for the per-frame render loop.
long EstimateTextureBytes()
Returns
Remarks
Thread contract: enumerates the underlying texture dictionary. MUST be
called on the main thread between frames; concurrent registration will
throw InvalidOperationException.
EstimateTextureBytesByScene()
Returns texture bytes grouped by scene tag (Story 12.3). Untagged assets are aggregated under the empty-string key. O(N) over registered textures — intended for diagnostic snapshots.
IReadOnlyDictionary<string, long> EstimateTextureBytesByScene()
Returns
Remarks
Thread contract: enumerates the texture dictionary. Same constraint as EstimateTextureBytes() — main thread, between frames.
GetAssetCounts()
Returns the current count of registered assets in each category. O(1) — reads dictionary counts only, no enumeration.
AssetCounts GetAssetCounts()
Returns
Remarks
Thread contract: registration mutates the internal dictionaries; reads
MUST occur on the main thread between frames (i.e., outside any registration
path). Concurrent registration on a worker thread will throw
InvalidOperationException from the dictionary enumerator in
EstimateTextureBytes(); this method is count-only and safer
but is documented under the same constraint for consistency.
GetAssetCountsByScene()
Returns asset counts grouped by scene tag (Story 12.3). The empty-string key holds untagged assets. O(N) over registrations.
IReadOnlyDictionary<string, AssetCounts> GetAssetCountsByScene()
Returns
GetAsset<T>(string)
T GetAsset<T>(string id) where T : struct
Parameters
idstring
Returns
- T
Type Parameters
T
GetFont(string)
Font? GetFont(string id)
Parameters
idstring
Returns
- Font?
GetModelAsset(string)
AnimatedModelData? GetModelAsset(string id)
Parameters
idstring
Returns
GetShader(string)
Shader? GetShader(string id)
Parameters
idstring
Returns
- Shader?
GetShaderCount()
Returns the count of registered shaders. Shader GPU memory is opaque to the engine, so byte estimation is intentionally not provided. O(1).
int GetShaderCount()
Returns
GetSoundAsset(string)
IAudioSource? GetSoundAsset(string id)
Parameters
idstring
Returns
- IAudioSource
RegisterAsset(string, string, AssetType)
void RegisterAsset(string id, string path, AssetType type)
Parameters
RegisterAsset(string, string, AssetType, string?)
Registers an asset and tags it with a scene identifier so per-scene
memory breakdowns are possible (Story 12.3 Task 1 — diagnostics
snapshots report bytes attributed by source scene). When
sceneTag is null or empty the asset is treated as
untagged ("shared" in snapshot reports). Tags are free-form and chosen
by the caller — SceneLoader uses Scene.GetType().Name.
void RegisterAsset(string id, string path, AssetType type, string? sceneTag)
Parameters
RegisterShader(string, string?, string?)
void RegisterShader(string id, string? vertexPath, string? fragmentPath)
Parameters
RegisterShader(string, string?, string?, string?)
Registers a shader with a scene tag for per-scene attribution. See RegisterAsset(string, string, AssetType, string?) for the tag contract.
void RegisterShader(string id, string? vertexPath, string? fragmentPath, string? sceneTag)