Loading...
Searching...
No Matches
hellfire::ShaderManager Class Reference

#include <ShaderManager.h>

Collaboration diagram for hellfire::ShaderManager:

Classes

struct  ShaderVariant
 

Public Member Functions

std::string clean_shader_content (const std::string &content, const std::string &filepath)
 
uint32_t load_shader (const ShaderVariant &variant)
 
uint32_t get_shader_for_material (Material &material)
 
uint32_t get_shader (const std::string &key) const
 
bool has_shader (const std::string &key) const
 
void add_automatic_defines (const Material &material, std::unordered_set< std::string > &defines)
 
uint32_t load_shader_from_files (const std::string &vertex_path, const std::string &fragment_path)
 
void clear_cache ()
 
 ~ShaderManager ()
 
std::vector< uint32_t > get_all_shader_ids () const
 

Private Member Functions

std::string process_includes (const std::string &source, const std::string &base_path="shaders/")
 
std::string load_include_file (const std::string &path, const std::string &base_path)
 
std::string get_directory_from_path (const std::string &file_path)
 
std::string process_defines (const std::string &source, const std::unordered_set< std::string > &defines)
 
std::string trim (const std::string &str)
 
std::string load_shader_file (const std::string &path)
 
uint32_t compile_shader_program (const std::string &vertex_source, const std::string &fragment_source)
 

Private Attributes

std::unordered_map< std::string, std::string > include_cache_
 
std::unordered_map< std::string, uint32_t > compiled_shaders_
 

Friends

class Application
 

Detailed Description

Definition at line 18 of file ShaderManager.h.

Constructor & Destructor Documentation

◆ ~ShaderManager()

hellfire::ShaderManager::~ShaderManager ( )
inline

Definition at line 67 of file ShaderManager.h.

Member Function Documentation

◆ add_automatic_defines()

void hellfire::ShaderManager::add_automatic_defines ( const Material material,
std::unordered_set< std::string > &  defines 
)

Definition at line 241 of file ShaderManager.cpp.

◆ clean_shader_content()

std::string hellfire::ShaderManager::clean_shader_content ( const std::string &  content,
const std::string &  filepath 
)

Definition at line 154 of file ShaderManager.cpp.

◆ clear_cache()

void hellfire::ShaderManager::clear_cache ( )

Definition at line 282 of file ShaderManager.cpp.

◆ compile_shader_program()

uint32_t hellfire::ShaderManager::compile_shader_program ( const std::string &  vertex_source,
const std::string &  fragment_source 
)
private

Definition at line 301 of file ShaderManager.cpp.

◆ get_all_shader_ids()

std::vector< uint32_t > hellfire::ShaderManager::get_all_shader_ids ( ) const

Definition at line 292 of file ShaderManager.cpp.

◆ get_directory_from_path()

std::string hellfire::ShaderManager::get_directory_from_path ( const std::string &  file_path)
private

Definition at line 65 of file ShaderManager.cpp.

◆ get_shader()

uint32_t hellfire::ShaderManager::get_shader ( const std::string &  key) const

Definition at line 236 of file ShaderManager.cpp.

◆ get_shader_for_material()

uint32_t hellfire::ShaderManager::get_shader_for_material ( Material material)

Definition at line 211 of file ShaderManager.cpp.

◆ has_shader()

bool hellfire::ShaderManager::has_shader ( const std::string &  key) const
inline

Definition at line 56 of file ShaderManager.h.

◆ load_include_file()

std::string hellfire::ShaderManager::load_include_file ( const std::string &  path,
const std::string &  base_path 
)
private

Definition at line 44 of file ShaderManager.cpp.

◆ load_shader()

uint32_t hellfire::ShaderManager::load_shader ( const ShaderVariant variant)

Definition at line 175 of file ShaderManager.cpp.

◆ load_shader_file()

std::string hellfire::ShaderManager::load_shader_file ( const std::string &  path)
private

Definition at line 122 of file ShaderManager.cpp.

◆ load_shader_from_files()

uint32_t hellfire::ShaderManager::load_shader_from_files ( const std::string &  vertex_path,
const std::string &  fragment_path 
)

Definition at line 262 of file ShaderManager.cpp.

◆ process_defines()

std::string hellfire::ShaderManager::process_defines ( const std::string &  source,
const std::unordered_set< std::string > &  defines 
)
private

Definition at line 73 of file ShaderManager.cpp.

◆ process_includes()

std::string hellfire::ShaderManager::process_includes ( const std::string &  source,
const std::string &  base_path = "shaders/" 
)
private

Definition at line 25 of file ShaderManager.cpp.

◆ trim()

std::string hellfire::ShaderManager::trim ( const std::string &  str)
private

Definition at line 115 of file ShaderManager.cpp.

Friends And Related Symbol Documentation

◆ Application

friend class Application
friend

Definition at line 74 of file ShaderManager.h.

Member Data Documentation

◆ compiled_shaders_

std::unordered_map<std::string, uint32_t> hellfire::ShaderManager::compiled_shaders_
private

Definition at line 21 of file ShaderManager.h.

◆ include_cache_

std::unordered_map<std::string, std::string> hellfire::ShaderManager::include_cache_
private

Definition at line 20 of file ShaderManager.h.


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