Shader Tool
Small shader visualiser.
st::DocumentManager Class Reference

Manages the shaders files. More...

#include <DocumentManager.hpp>

Public Member Functions

 DocumentManager (string path, string editor, vector< shared_ptr< Shader > > shaders)
 Inits the DocumentManager and copies a template shader into the shadrers folder. More...
 
bool loadShader (bool open=false)
 Reloads the current set shader. More...
 
bool loadShader (string path, bool open=false)
 Loads a new shader. More...
 
bool createFromTemplate (string name)
 Creates a new shader file from the configured template. More...
 
bool saveShader (string name)
 Renames the current shader. More...
 
void openShader ()
 Opens the current shader with the configured text editor. More...
 
shared_ptr< ShadergetShader ()
 

Public Attributes

const string shaders_path
 

Private Attributes

Shader shader
 
vector< shared_ptr< Shader > > default_shaders
 
string text_editor
 

Detailed Description

Manages the shaders files.

Constructor & Destructor Documentation

◆ DocumentManager()

st::DocumentManager::DocumentManager ( string  path,
string  editor,
vector< shared_ptr< Shader > >  shaders 
)
inline

Inits the DocumentManager and copies a template shader into the shadrers folder.

The template is copied to make sure the templates are never overwritten.

Member Function Documentation

◆ createFromTemplate()

bool st::DocumentManager::createFromTemplate ( string  name)

Creates a new shader file from the configured template.

◆ getShader()

shared_ptr<Shader> st::DocumentManager::getShader ( )
inline

◆ loadShader() [1/2]

bool st::DocumentManager::loadShader ( bool  open = false)

Reloads the current set shader.

Parameters
openWether or not open the shader with the text editor.

◆ loadShader() [2/2]

bool st::DocumentManager::loadShader ( string  path,
bool  open = false 
)

Loads a new shader.

If the shader file is not found, creates a new one in the provided path from the template.

Parameters
openWether or not open the shader with the text editor.

◆ openShader()

void st::DocumentManager::openShader ( )

Opens the current shader with the configured text editor.

◆ saveShader()

bool st::DocumentManager::saveShader ( string  name)

Renames the current shader.

This prevents the shader from being overwritten if it is the "newShader".

Parameters
nameName of the new shader. Must not have extension.

Member Data Documentation

◆ default_shaders

vector< shared_ptr <Shader > > st::DocumentManager::default_shaders
private

◆ shader

Shader st::DocumentManager::shader
private

◆ shaders_path

const string st::DocumentManager::shaders_path

◆ text_editor

string st::DocumentManager::text_editor
private

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