Raven Engine v0.1
Loading...
Searching...
No Matches
MaterialRegistry.h File Reference

Central registry for loading, creating, and managing material assets. More...

#include "FileWatch.hpp"
#include "Raven/Raven.h"
#include "Renderer/Material.h"
#include <glaze/glaze.hpp>

Classes

struct  Raven::MaterialHandle
 Opaque handle referencing a material in the registry. More...
struct  Raven::TextureSlot
 Lightweight descriptor of a texture binding inside a material. More...
struct  Raven::MaterialAsset
 Serializable description of a material. More...
struct  glz::meta< Raven::MaterialAsset >
class  Raven::MaterialRegistry
 Central manager for material lifetimes and asset persistence. More...

Namespaces

namespace  Raven

Detailed Description

Central registry for loading, creating, and managing material assets.

Author
PhilikusHD

The MaterialRegistry provides an indirection layer between engine systems and actual Material instances. It maintains versioned handles to materials, handles persistence (serialize/deserialize via JSON with Glaze), and ensures safe reuse of GPU indices and slot entries.

Key responsibilities:

  • Load material definitions from disk (*.json).
  • Create transient runtime-only materials.
  • Persist and reload material assets for iteration workflows.
  • Track materials via lightweight MaterialHandles, which remain valid as long as their slot version matches.

Integration notes:

  • Internally, the registry stores materials in a slot vector. Freed slots are recycled via a free-list while bumping a version counter.
  • GPU indices are assigned sequentially for backend binding.
  • Assets may be hot-reloaded (planned) via file watchers.