CSEngine
|
This class provides utility functions for shaders. More...
#include <ShaderUtil.h>
Public Member Functions | |
ShaderUtil () | |
Constructor for the ShaderUtil class. | |
~ShaderUtil () | |
Destructor for the ShaderUtil class. | |
Static Public Member Functions | |
static GLProgramHandle * | CreateProgramHandle (const GLchar *vertexSource, const GLchar *fragmentSource, GLProgramHandle *handle=nullptr) |
Creates a program handle. | |
static GLuint | createProgram (const GLchar *vertexSource, const GLchar *fragmentSource, const GLProgramHandle &handle) |
Creates a program. | |
static GLuint | createProgram (GLuint vertexShader, GLuint fragmentShader, const GLProgramHandle &handle) |
static GLuint | loadShader (GLenum shaderType, const char *pSource, const GLProgramHandle &handle) |
Loads a shader. | |
static std::map< std::string, std::string > | GetImportantVariables (const GLchar *source) |
Gets the important variables from the shader source code. | |
static void | BindVariables (GLProgramHandle *handle) |
Binds variables to the shader. | |
static void | BindCameraToShader (const GLProgramHandle &handle, const mat4 &camera, const vec3 &cameraPosition, const mat4 &projection, const mat4 &transform) |
Binds the camera data to the shader. | |
static void | BindAttributeToShader (const GLProgramHandle &handle, const GLMeshID &meshId) |
Binds the attributes to the shader. | |
static void | BindSkinningDataToShader (const GLProgramHandle &handle, const GLMeshID &meshId, const std::vector< mat4 > &jointMatrix) |
Binds the skinning data to the shader. | |
static void | BindAttributeToPlane () |
static void | BindAttributeToCubeMap () |
This class provides utility functions for shaders.
This class provides utility functions for shaders. It can be used to create a program handle, create a program, bind variables and attributes to the shader, and bind skinning data.
Definition at line 21 of file ShaderUtil.h.
|
default |
Constructor for the ShaderUtil class.
Constructor for the ShaderUtil class.
|
default |
Destructor for the ShaderUtil class.
Destructor for the ShaderUtil class.
|
static |
Definition at line 313 of file ShaderUtil.cpp.
|
static |
Definition at line 309 of file ShaderUtil.cpp.
|
static |
Binds the attributes to the shader.
Binds the attributes to the shader.
handle | The program handle to use. |
meshId | The ID of the mesh. |
Definition at line 267 of file ShaderUtil.cpp.
|
static |
Binds the camera data to the shader.
Binds the camera data to the shader.
handle | The program handle to use. |
camera | The camera transformation matrix. |
cameraPosition | The position of the camera. |
projection | The projection matrix. |
transform | The transformation matrix. |
Definition at line 249 of file ShaderUtil.cpp.
Referenced by CSE::DeferredRenderGroup::RenderGbuffer().
|
static |
Binds the skinning data to the shader.
Binds the skinning data to the shader.
handle | The program handle to use. |
meshId | The ID of the mesh. |
jointMatrix | The joint transformation matrices. |
Definition at line 317 of file ShaderUtil.cpp.
|
static |
Binds variables to the shader.
Binds variables to the shader.
handle | The program handle to use. |
Definition at line 186 of file ShaderUtil.cpp.
Referenced by CreateProgramHandle().
|
static |
Creates a program.
Creates a program with the given vertex and fragment shaders and the given program handle.
vertexShader | The vertex shader. |
fragmentShader | The fragment shader. |
handle | The program handle to use. |
Definition at line 52 of file ShaderUtil.cpp.
References createProgram(), and loadShader().
Referenced by createProgram(), and CreateProgramHandle().
|
static |
Definition at line 66 of file ShaderUtil.cpp.
|
static |
Creates a program handle.
Creates a program handle with the given vertex and fragment shaders.
vertexSource | The vertex shader source code. |
fragmentSource | The fragment shader source code. |
handle | The program handle to use. |
Definition at line 24 of file ShaderUtil.cpp.
References BindVariables(), createProgram(), and GetImportantVariables().
|
static |
Gets the important variables from the shader source code.
Gets the important variables from the shader source code.
source | The shader source code. |
Definition at line 142 of file ShaderUtil.cpp.
Referenced by CreateProgramHandle().
|
static |
Loads a shader.
Loads a shader with the given shader type and source code and the given program handle.
shaderType | The type of shader to load. |
pSource | The source code of the shader. |
handle | The program handle to use. |
Definition at line 106 of file ShaderUtil.cpp.
Referenced by createProgram().