Stellarium 0.14.3
|
A simple shader cache class that gives us the correct shader depending on desired configuration. More...
#include <ShaderManager.hpp>
Public Types | |
enum | ATTLOC { ATTLOC_VERTEX, ATTLOC_NORMAL, ATTLOC_TEXCOORD, ATTLOC_TANGENT, ATTLOC_BITANGENT } |
Enum for OpenGL shader attribute locations. More... | |
enum | UNIFORM { UNIFORM_MAT_MODELVIEW, UNIFORM_MAT_PROJECTION, UNIFORM_MAT_MVP, UNIFORM_MAT_NORMAL, UNIFORM_MAT_SHADOW0, UNIFORM_MAT_SHADOW1, UNIFORM_MAT_SHADOW2, UNIFORM_MAT_SHADOW3, UNIFORM_MAT_CUBEMVP, UNIFORM_TEX_DIFFUSE, UNIFORM_TEX_EMISSIVE, UNIFORM_TEX_BUMP, UNIFORM_TEX_HEIGHT, UNIFORM_TEX_SHADOW0, UNIFORM_TEX_SHADOW1, UNIFORM_TEX_SHADOW2, UNIFORM_TEX_SHADOW3, UNIFORM_MTL_SHININESS, UNIFORM_MTL_ALPHA, UNIFORM_MIX_AMBIENT, UNIFORM_MIX_DIFFUSE, UNIFORM_MIX_SPECULAR, UNIFORM_MIX_TORCHDIFFUSE, UNIFORM_MIX_EMISSIVE, UNIFORM_LIGHT_DIRECTION_VIEW, UNIFORM_TORCH_ATTENUATION, UNIFORM_VEC_COLOR, UNIFORM_VEC_SPLITDATA, UNIFORM_VEC_LIGHTORTHOSCALE, UNIFORM_FLOAT_ALPHA_THRESH } |
Enum for OpenGL shader uniform locations (faster than accessing by string each time) More... | |
Public Member Functions | |
QOpenGLShaderProgram * | getShader (const GlobalShaderParameters &globals, const OBJ::Material *mat=NULL) |
Returns a shader that supports the specified operations. Must be called within a GL context. More... | |
QOpenGLShaderProgram * | getDebugShader () |
Returns the Frustum/Boundingbox Debug shader. More... | |
QOpenGLShaderProgram * | getCubeShader () |
Returns the cubemapping shader. More... | |
QOpenGLShaderProgram * | getTextureShader () |
Returns the basic texturing shader. More... | |
GLint | uniformLocation (const QOpenGLShaderProgram *shad, UNIFORM uni) |
Returns the location of this uniform for this shader, or -1 if this uniform does not exist. More... | |
void | clearCache () |
Clears the shaders that have been created by this manager. Must be called within a GL context. More... | |
A simple shader cache class that gives us the correct shader depending on desired configuration.
It also contains a uniform cache to avoid unnecessary glUniformLocation calls
Definition at line 49 of file ShaderManager.hpp.
enum ShaderMgr::ATTLOC |
Enum for OpenGL shader attribute locations.
Definition at line 56 of file ShaderManager.hpp.
enum ShaderMgr::UNIFORM |
Enum for OpenGL shader uniform locations (faster than accessing by string each time)
Enumerator | |
---|---|
UNIFORM_MAT_MODELVIEW |
Defines the ModelView matrix. |
UNIFORM_MAT_PROJECTION |
Defines the Projection matrix. |
UNIFORM_MAT_MVP |
Defines the combined ModelViewProjection matrix, used if shader needs no separation of the 2 for a bit of a speedup. |
UNIFORM_MAT_NORMAL |
Defines the 3x3 Normal matrix (transpose of the inverse MV matrix) |
UNIFORM_MAT_SHADOW0 |
The shadow matrices (4x 4x4 Matrices) |
UNIFORM_MAT_CUBEMVP |
The first cube MVP (array mat4, total 6) |
UNIFORM_TEX_DIFFUSE |
Defines the Diffuse texture slot. |
UNIFORM_TEX_EMISSIVE |
Defines the emissive texture slot. |
UNIFORM_TEX_BUMP |
Defines the Bump texture slot. |
UNIFORM_TEX_HEIGHT |
Defines the Height texture slot. |
UNIFORM_TEX_SHADOW0 |
Shadow maps, 4x. |
UNIFORM_MTL_SHININESS |
Material specular shininess (exponent) |
UNIFORM_MTL_ALPHA |
Material global transparency. |
UNIFORM_MIX_AMBIENT |
(Light ambient + const factor) * Material ambient or diffuse, depending on Illum model |
UNIFORM_MIX_DIFFUSE |
Light directional * Material diffuse. |
UNIFORM_MIX_SPECULAR |
Light specular * Material specular color. |
UNIFORM_MIX_TORCHDIFFUSE |
Torch color * mat diffuse. |
UNIFORM_MIX_EMISSIVE |
Material emissive color * light emissive. |
UNIFORM_LIGHT_DIRECTION_VIEW |
Light direction vector (view space) |
UNIFORM_TORCH_ATTENUATION |
Torchlight attenuation factor (1 float, like in the second model at http://framebunker.com/blog/lighting-2-attenuation/) |
UNIFORM_VEC_COLOR |
simple color vec4 |
UNIFORM_VEC_SPLITDATA |
Squared frustum splits (vec4) |
UNIFORM_VEC_LIGHTORTHOSCALE |
Scaling of each frustum's light ortho projection (4xvec2) |
UNIFORM_FLOAT_ALPHA_THRESH |
Alpha test threshold. |
Definition at line 71 of file ShaderManager.hpp.
void ShaderMgr::clearCache | ( | ) |
Clears the shaders that have been created by this manager. Must be called within a GL context.
|
inline |
Returns the cubemapping shader.
Definition at line 277 of file ShaderManager.hpp.
|
inline |
Returns the Frustum/Boundingbox Debug shader.
Definition at line 272 of file ShaderManager.hpp.
|
inline |
Returns a shader that supports the specified operations. Must be called within a GL context.
Definition at line 228 of file ShaderManager.hpp.
|
inline |
Returns the basic texturing shader.
Definition at line 282 of file ShaderManager.hpp.
|
inline |
Returns the location of this uniform for this shader, or -1 if this uniform does not exist.
This is cached to elimate the overhead of the glGet calls
Definition at line 287 of file ShaderManager.hpp.