Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class AnimatedModelCache

    Singleton cache managing shared AnimatedModelData instances with reference counting. Ensures each unique GLB file is loaded into GPU memory only once.

    Inheritance
    object
    AnimatedModelCache
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: PopcorningGuineaPig.Engine.Gameplay
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public sealed class AnimatedModelCache : IDisposable

    Constructors

    | Edit this page View Source

    AnimatedModelCache()

    Declaration
    public AnimatedModelCache()

    Properties

    | Edit this page View Source

    CachedCount

    Number of unique models currently cached.

    Declaration
    public int CachedCount { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Dispose()

    Disposes all cached AnimatedModelData entries (engine shutdown cleanup).

    Declaration
    public void Dispose()
    | Edit this page View Source

    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).
    GPU upload overhead and embedded textures are NOT counted here — they live in the asset registry's texture estimator. Intended for diagnostics; O(N) over cached models.
    Declaration
    public long EstimateMemoryBytes()
    Returns
    Type Description
    long
    | Edit this page View Source

    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
    | Edit this page View Source

    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

    Implements

    IDisposable
    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.