SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ShaderFilesManager Class Reference
Inheritance diagram for ShaderFilesManager:
Inheritance graph
[legend]

Public Member Functions

void removeAllShaderFiles ()
 
void removeUnusedShaderFiles ()
 
SharedShader loadShader (const std::string &full_path, unsigned type)
 Loads a single shader.
 
SharedShader getShaderFile (const std::string &file, unsigned type)
 Get a shader file.
 

Private Types

typedef std::shared_ptr< GLuint > SharedShader
 

Private Member Functions

const std::string & getHeader ()
 Returns a string with the content of header.txt (which contains basic shader defines).
 
void readFile (const std::string &file, std::ostringstream &code, bool not_header=true)
 
SharedShader addShaderFile (const std::string &full_path, unsigned type)
 Loads a single shader file, and add it to the loaded (cached) list.
 

Private Attributes

std::unordered_map< std::string, SharedShader > m_shader_files_loaded
 Map from a filename in full path to a shader indentifier.
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< ShaderFilesManager >
static ShaderFilesManagergetInstance ()
 Used to get the instance.
 
static void kill ()
 Used to kill the singleton, if needed.
 
- Protected Member Functions inherited from Singleton< ShaderFilesManager >
 Singleton ()
 Constructor.
 
virtual ~Singleton ()
 Destructor.
 

Member Function Documentation

◆ addShaderFile()

ShaderFilesManager::SharedShader ShaderFilesManager::addShaderFile ( const std::string &  full_path,
unsigned  type 
)
private

Loads a single shader file, and add it to the loaded (cached) list.

Parameters
fileFilename of the shader to load.
typeType of the shader.

◆ getShaderFile()

ShaderFilesManager::SharedShader ShaderFilesManager::getShaderFile ( const std::string &  file,
unsigned  type 
)

Get a shader file.

If the shader is not already in the cache it will be loaded and cached.

Parameters
fileFilename of the shader to load.
typeType of the shader.

◆ loadShader()

ShaderFilesManager::SharedShader ShaderFilesManager::loadShader ( const std::string &  full_path,
unsigned  type 
)

Loads a single shader.

This is NOT cached, use addShaderFile for that.

Parameters
fileFilename of the shader to load.
typeType of the shader.

Member Data Documentation

◆ m_shader_files_loaded

std::unordered_map<std::string, SharedShader> ShaderFilesManager::m_shader_files_loaded
private

Map from a filename in full path to a shader indentifier.

Used for caching shaders.


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