Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::ShaderLibrary Class Reference

Manages a collection of shaders for efficient reuse and lookup. More...

#include <Shader.h>

Inherits Raven::RefCounted.

Public Member Functions

ILLUMINE_API void Shutdown ()
ILLUMINE_API void Add (const std::string &name, const Ref< Shader > &shader)
 Add a shader to the library with a custom name.
ILLUMINE_API void Add (const Ref< Shader > &shader)
 Add a shader to the library using its internal name.
ILLUMINE_API Ref< ShaderLoad (const std::string &filepath)
 Load and add a shader by file path, using its internal name.
ILLUMINE_API Ref< ShaderLoad (const std::string &name, const std::string &filepath)
 Load and add a shader by file path with a custom name.
ILLUMINE_API Ref< ShaderGet (const std::string &name)
 Retrieve a shader by name.
ILLUMINE_API bool Exists (const std::string &name) const
 Checks if a shader exists in the library.
NodeStrMap< Ref< Shader > > & GetShaders ()
Public Member Functions inherited from Raven::RefCounted
 RefCounted ()
virtual ~RefCounted ()
void IncRefCount ()
void DecRefCount ()
u32 GetRefCount () const

Static Public Member Functions

static ILLUMINE_API Ref< ShaderLibraryCreate ()
 Factory method to create a new ShaderLibrary instance.

Detailed Description

Manages a collection of shaders for efficient reuse and lookup.

Allows adding, loading, and retrieving shaders by name, preventing duplicate loads. Acts as a cache and centralized management point.

Member Function Documentation

◆ Add() [1/2]

void Raven::ShaderLibrary::Add ( const Ref< Shader > & shader)

Add a shader to the library using its internal name.

Parameters
shaderShader reference to add.

◆ Add() [2/2]

void Raven::ShaderLibrary::Add ( const std::string & name,
const Ref< Shader > & shader )

Add a shader to the library with a custom name.

Parameters
nameName to associate with the shader.
shaderShader reference to add.

◆ Create()

Ref< ShaderLibrary > Raven::ShaderLibrary::Create ( )
static

Factory method to create a new ShaderLibrary instance.

Returns
Reference to a new ShaderLibrary.

◆ Exists()

bool Raven::ShaderLibrary::Exists ( const std::string & name) const

Checks if a shader exists in the library.

Parameters
nameShader name to check.
Returns
True if exists, false otherwise.

◆ Get()

Ref< Shader > Raven::ShaderLibrary::Get ( const std::string & name)

Retrieve a shader by name.

Parameters
nameName of the shader.
Returns
Reference to the Shader.

◆ GetShaders()

NodeStrMap< Ref< Shader > > & Raven::ShaderLibrary::GetShaders ( )
inline

◆ Load() [1/2]

Ref< Shader > Raven::ShaderLibrary::Load ( const std::string & filepath)

Load and add a shader by file path, using its internal name.

Parameters
filepathPath to the shader file.
Returns
Reference to the loaded Shader.

◆ Load() [2/2]

Ref< Shader > Raven::ShaderLibrary::Load ( const std::string & name,
const std::string & filepath )

Load and add a shader by file path with a custom name.

Parameters
nameName to associate with the shader.
filepathPath to the shader file.
Returns
Reference to the loaded Shader.

◆ Shutdown()

void Raven::ShaderLibrary::Shutdown ( )

The documentation for this class was generated from the following files: