scg3  0.6
scg::ShaderCoreFactory Class Reference

A factory to create shader cores. More...

#include "ShaderCoreFactory.h"

Collaboration diagram for scg::ShaderCoreFactory:
[legend]

Public Member Functions

 ShaderCoreFactory ()
 
 ShaderCoreFactory (const std::string &filePath)
 
virtual ~ShaderCoreFactory ()
 
void addFilePath (const std::string &filePath)
 
ShaderCoreSP createColorShader ()
 
ShaderCoreSP createGouraudShader ()
 
ShaderCoreSP createShaderFromSourceFiles (const std::vector< ShaderFile > &shaderFiles)
 
ShaderCoreSP createShaderFromSourceFiles (std::vector< ShaderFile > &&shaderFiles)
 

Protected Member Functions

int loadSourceFile_ (GLuint shader, const std::string &fileName) const
 

Protected Attributes

std::vector< std::string > filePaths_
 

Detailed Description

A factory to create shader cores.

Examples
scg3_table_scene_example.cpp.

Definition at line 56 of file ShaderCoreFactory.h.

Constructor & Destructor Documentation

◆ ShaderCoreFactory() [1/2]

scg::ShaderCoreFactory::ShaderCoreFactory ( )

Constructor.

◆ ShaderCoreFactory() [2/2]

scg::ShaderCoreFactory::ShaderCoreFactory ( const std::string &  filePath)

Constructor with one or more file paths to be searched for shader files. More than one file paths can be defined using ';' or ',' as delimiter.

Example: addFilePath("../shaders1;../shaders2")

◆ ~ShaderCoreFactory()

virtual scg::ShaderCoreFactory::~ShaderCoreFactory ( )
virtual

Destructor.

Member Function Documentation

◆ addFilePath()

void scg::ShaderCoreFactory::addFilePath ( const std::string &  filePath)

Add one or more file paths to be searched for shader files. More than one file paths can be defined using ';' or ',' as delimiter.

Example: addFilePath("../shaders1;../shaders2")

◆ createColorShader()

ShaderCoreSP scg::ShaderCoreFactory::createColorShader ( )

Create a simple shader program without lighting.

attributes: vVertex, vColor
uniforms: mvpMatrix

◆ createGouraudShader()

ShaderCoreSP scg::ShaderCoreFactory::createGouraudShader ( )

Create a simple shader program with Gouraud shading for a single light without texturing.

attributes: vVertex, vNormal
uniforms: modelViewMatrix, projectionMatrix, mvpMatrix, normalMatrix
UBOs: LightBlock, MaterialBlock

◆ createShaderFromSourceFiles() [1/2]

ShaderCoreSP scg::ShaderCoreFactory::createShaderFromSourceFiles ( const std::vector< ShaderFile > &  shaderFiles)

Load shaders from source files, compile, and link to create a shader program.

Parameters
shaderFilesvector of shader files, each consisting of a file name (to be searched for in known file paths) and a shader type (GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, or GL_GEOMETRY_SHADER).

◆ createShaderFromSourceFiles() [2/2]

ShaderCoreSP scg::ShaderCoreFactory::createShaderFromSourceFiles ( std::vector< ShaderFile > &&  shaderFiles)

Load shaders from source files, compile, and link to create a shader program.

Parameters
shaderFilesvector of shader files, each consisting of a file name (to be searched for in known file paths) and a shader type (GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, or GL_GEOMETRY_SHADER).

◆ loadSourceFile_()

int scg::ShaderCoreFactory::loadSourceFile_ ( GLuint  shader,
const std::string &  fileName 
) const
protected

Load shader from source file.

Parameters
shaderindex the shader shall be attached to
fileNamefile name to be searched for in known file paths

Member Data Documentation

◆ filePaths_

std::vector<std::string> scg::ShaderCoreFactory::filePaths_
protected

Definition at line 134 of file ShaderCoreFactory.h.


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