All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Luminous::Shader Class Reference

A single shader (vertex, fragment, etc) written GLSL. More...

#include <Luminous/Shader.hpp>

Public Types

enum  Type {
  Vertex, Fragment, Geometry, TessControl,
  TessEval, Compute
}
 Type of the shader. More...
 

Public Member Functions

LUMINOUS_API const QString & filename () const
 Returns the source code file for the shader. More...
 
LUMINOUS_API RenderResource::Hash hash () const
 Hash for the shader which is calculated based on source code of shader. More...
 
LUMINOUS_API bool loadText (const QString &filename)
 Reads shader from the given file. More...
 
LUMINOUS_API Shaderoperator= (Shader &&s)
 
LUMINOUS_API void setText (const QByteArray &src)
 Sets source code for the shader. More...
 
LUMINOUS_API Shader (Type type)
 Constructor of shader. More...
 
LUMINOUS_API Shader (Shader &&s)
 Move constructor of shader. More...
 
LUMINOUS_API const QByteArray & text () const
 Returns the source code of the shader. More...
 
LUMINOUS_API Type type () const
 Returns the type of the shader. More...
 
LUMINOUS_API ~Shader ()
 Destructor of shader.
 

Detailed Description

A single shader (vertex, fragment, etc) written GLSL.

Member Enumeration Documentation

Type of the shader.

Enumerator
Vertex 

Vertex shader.

Fragment 

Fragment shader.

Geometry 

Geometry shader.

TessControl 

Tessellation control shader.

TessEval 

Tessellation evaluation shader.

Compute 

Compute shader.

Constructor & Destructor Documentation

LUMINOUS_API Luminous::Shader::Shader ( Type  type)

Constructor of shader.

Parameters
typeType of the shader
LUMINOUS_API Luminous::Shader::Shader ( Shader &&  s)

Move constructor of shader.

Parameters
sShader to move

Member Function Documentation

LUMINOUS_API const QString& Luminous::Shader::filename ( ) const

Returns the source code file for the shader.

Returns
Filename of the source code. Empty if not read from file
LUMINOUS_API RenderResource::Hash Luminous::Shader::hash ( ) const

Hash for the shader which is calculated based on source code of shader.

Returns
Hash for shader
LUMINOUS_API bool Luminous::Shader::loadText ( const QString &  filename)

Reads shader from the given file.

Parameters
filenameFile where shader is read
Returns
Was the read successful
LUMINOUS_API Shader& Luminous::Shader::operator= ( Shader &&  s)
Parameters
s
Returns
Reference to this
LUMINOUS_API void Luminous::Shader::setText ( const QByteArray &  src)

Sets source code for the shader.

Parameters
srcSource code for the shader
LUMINOUS_API const QByteArray& Luminous::Shader::text ( ) const

Returns the source code of the shader.

Returns
Source code of the shader
LUMINOUS_API Type Luminous::Shader::type ( ) const

Returns the type of the shader.

Returns
Type of the shader