# moderngl_window.resources

class moderngl_window.resources.base.BaseRegistry

  Base class for all resource pools

  add(meta: ResourceDescription) → None

    Adds a resource description without loading it. The resource is loaded and returned when `load_pool()` is called.

    Parameters:

      meta (ResourceDescription) – The resource description

  property count: int

    The number of resource descriptions added. This is only relevant when using add and load_pool.

    Type:

      int

  load(meta: ResourceDescription) → Any

    Loads a resource using the configured finders and loaders.

    Parameters:

      meta (ResourceDescription) – The resource description

  load_pool() → Generator[tuple[ResourceDescription, Any], None, None]

    Loads all the data files using the configured finders.

    This is only relevant when resource have been added to this pool using `add()`.

    Returns:

      Generator of (meta, resource) tuples

  property loaders: Generator[type[BaseLoader], None, None]

    Loader classes for this resource type

    Type:

      Generator

  resolve_loader(meta: ResourceDescription) → None

    Attempts to assign a loader class to a ResourceDescription.

    Parameters:

      - meta (`ResourceDescription`)

      - instance (The resource description)

  settings_attr = ''

    The name of the attribute in `Settings` containting a list of loader classes.

    Type:

      str

class moderngl_window.resources.data.DataFiles

  Bases: `BaseRegistry`

  Registry for requested data files

  load(meta: ResourceDescription) → Any

    Load data file with the configured loaders.

    Parameters:

      meta (`DataDescription`) – the resource description

    Returns:

      The loaded resource

    Return type:

      Any

  settings_attr = 'DATA_LOADERS'

    The name of the attribute in `Settings` containting a list of loader classes.

    Type:

      str

class moderngl_window.resources.programs.Programs

  Bases: `BaseRegistry`

  Handle program loading

  load(meta: ResourceDescription) → Program

    Loads a shader program with the configured loaders

    Parameters:

      - meta (`ProgramDescription`)

      - description (The resource)

    Returns:

      The shader program

    Return type:

      moderngl.Program

  resolve_loader(meta: ResourceDescription) → None

    Resolve program loader.

    Determines if the references resource is a single or multiple glsl files unless `kind` is specified.

    Parameters:

      meta (ProgramDescription) – The resource description

  settings_attr = 'PROGRAM_LOADERS'

    The name of the attribute in `Settings` containting a list of loader classes.

    Type:

      str

class moderngl_window.resources.scenes.Scenes

  Bases: `BaseRegistry`

  Handles scene loading

  load(meta: ResourceDescription) → Scene

    Load a scene with the configured loaders.

    Parameters:

      - meta (`SceneDescription`)

      - description (The resource)

    Returns:

      The loaded scene

    Return type:

      `Scene`

  settings_attr = 'SCENE_LOADERS'

    The name of the attribute in `Settings` containting a list of loader classes.

    Type:

      str

class moderngl_window.resources.textures.Textures

  Bases: `BaseRegistry`

  Handles texture resources

  load(meta: ResourceDescription) → Texture | TextureArray | TextureCube | Texture3D

    Loads a texture with the configured loaders.

    Parameters:

      - meta (`TextureDescription`)

      - description (The resource)

    Returns:

      2d texture

    Return type:

      moderngl.Texture

    Returns:

      texture array if `layers` is supplied

    Return type:

      moderngl.TextureArray

  settings_attr = 'TEXTURE_LOADERS'

    The name of the attribute in `Settings` containting a list of loader classes.

    Type:

      str