Class AnimatedModelCache
Singleton cache managing shared AnimatedModelData instances with reference counting. Ensures each unique GLB file is loaded into GPU memory only once.
Implements
Inherited Members
Namespace: PopcorningGuineaPig.Engine.Gameplay
Assembly: PopcorningGuineaPig.Engine.dll
Syntax
public sealed class AnimatedModelCache : IDisposable
Constructors
| Edit this page View SourceAnimatedModelCache()
Declaration
public AnimatedModelCache()
Properties
| Edit this page View SourceCachedCount
Number of unique models currently cached.
Declaration
public int CachedCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceDispose()
Disposes all cached AnimatedModelData entries (engine shutdown cleanup).
Declaration
public void Dispose()
EstimateMemoryBytes()
Conservatively estimates the bytes consumed by cached AnimatedModelData entries. Per-cache-entry estimate sums:
- Mesh vertex buffers across all meshes (32 bytes/vertex for position+normal+uv).
- Index buffer (4 bytes/index, triangle list).
- Skeletal animation pose data (animationCount * boneCount * frameCount * 64 bytes per Raylib Transform).
Declaration
public long EstimateMemoryBytes()
Returns
| Type | Description |
|---|---|
| long |
GetOrLoad(string)
Returns an existing AnimatedModelData for the given path (incrementing ref count), or creates a new one if not yet cached.
Declaration
public AnimatedModelData GetOrLoad(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath |
Returns
| Type | Description |
|---|---|
| AnimatedModelData |
Release(AnimatedModelData)
Decrements the reference count for the given data. When ref count reaches 0, the data is disposed and removed from the cache.
Declaration
public void Release(AnimatedModelData data)
Parameters
| Type | Name | Description |
|---|---|---|
| AnimatedModelData | data |