![]() |
scg3
0.6
|
The central render state that collects information about the current shader, transformations, matrix stacks, light and color properties. More...
#include "RenderState.h"
Public Member Functions | |
RenderState () | |
virtual | ~RenderState () |
void | init () |
int | getNLights () const |
GLuint | getLightUBO () const |
ColorCore * | getColor () |
void | setColor (ColorCore *core) |
ShaderCore * | getShader () |
void | setShader (ShaderCore *core) |
const glm::mat4 & | getViewTransform () const |
void | setViewTransform (const glm::mat4 &viewTransform) |
const glm::mat4 & | getProjection () const |
void | setProjection (const glm::mat4 &projection) |
const glm::mat4 & | getMVPMatrix () const |
const glm::mat4 & | getModelMatrix () const |
void | setLighting (bool isLightingEnabled) |
bool | isLightingEnabled () const |
void | addLight () |
void | removeLight () |
void | setGlobalAmbientLight (const glm::vec4 &globalAmbientLight) |
void | applyProjectionViewTransform () |
void | passToShader () |
Public Attributes | |
MatrixStack | modelViewStack |
MatrixStack | projectionStack |
MatrixStack | textureStack |
MatrixStack | colorStack |
Protected Attributes | |
ColorCore * | colorCore_ |
ShaderCore * | shaderCore_ |
glm::mat4 | projection_ |
glm::mat4 | viewTransform_ |
glm::mat4 | tempMatrix_ |
bool | isLightingEnabled_ |
GLint | nLights_ |
GLuint | lightUBO_ |
glm::vec4 | globalAmbientLight_ |
The central render state that collects information about the current shader, transformations, matrix stacks, light and color properties.
The light properties are stored in a uniform buffer object (UBO). A few member functions are defined in the header file to allow inlining. The matrix stacks are public member variables that are accessed as, e.g.,
RenderState* renderState; renderState->modelViewStack.pushMatrix();
Definition at line 107 of file RenderState.h.
scg::RenderState::RenderState | ( | ) |
Constructor.
|
virtual |
Destructor.
void scg::RenderState::addLight | ( | ) |
Add light, i.e., increase the number of lights.
void scg::RenderState::applyProjectionViewTransform | ( | ) |
Apply projection and view transformation before rendering the scene, to be called by Renderer.
ColorCore* scg::RenderState::getColor | ( | ) |
Get color core.
GLuint scg::RenderState::getLightUBO | ( | ) | const |
Get light uniforma buffer object (UBO).
|
inline |
Get current model matrix.
Definition at line 194 of file RenderState.h.
|
inline |
Get current model-view-projection matrix.
Definition at line 187 of file RenderState.h.
int scg::RenderState::getNLights | ( | ) | const |
Get number of active lights.
|
inline |
Get camera projection that is applied before rendering the scene.
Definition at line 173 of file RenderState.h.
ShaderCore* scg::RenderState::getShader | ( | ) |
Get shader core.
|
inline |
Get view transformation that is applied before rendering the scene.
Definition at line 159 of file RenderState.h.
void scg::RenderState::init | ( | ) |
Inittailize state, create light uniform buffer object (UBO).
bool scg::RenderState::isLightingEnabled | ( | ) | const |
Check if lighting is enabled.
void scg::RenderState::passToShader | ( | ) |
Pass current modelview, projection, normal, texture, color matrices to shader, to be called before rendering any geometry.
void scg::RenderState::removeLight | ( | ) |
Remove light, i.e., decrease the number of lights.
void scg::RenderState::setColor | ( | ColorCore * | core | ) |
Set color core.
void scg::RenderState::setGlobalAmbientLight | ( | const glm::vec4 & | globalAmbientLight | ) |
Set global ambient light intensity to be applied independent of light sources.
void scg::RenderState::setLighting | ( | bool | isLightingEnabled | ) |
Enable or disable lighting (light sources and global ambient light).
Default: enabled
|
inline |
Set camera projection that is applied before rendering the scene.
Definition at line 180 of file RenderState.h.
void scg::RenderState::setShader | ( | ShaderCore * | core | ) |
Set shader core.
|
inline |
Get view transformation that is applied before rendering the scene.
Definition at line 166 of file RenderState.h.
|
protected |
Definition at line 250 of file RenderState.h.
MatrixStack scg::RenderState::colorStack |
Definition at line 246 of file RenderState.h.
|
protected |
Definition at line 258 of file RenderState.h.
|
protected |
Definition at line 255 of file RenderState.h.
|
protected |
Definition at line 257 of file RenderState.h.
MatrixStack scg::RenderState::modelViewStack |
Definition at line 243 of file RenderState.h.
|
protected |
Definition at line 256 of file RenderState.h.
|
protected |
Definition at line 252 of file RenderState.h.
MatrixStack scg::RenderState::projectionStack |
Definition at line 244 of file RenderState.h.
|
protected |
Definition at line 251 of file RenderState.h.
|
mutableprotected |
Definition at line 254 of file RenderState.h.
MatrixStack scg::RenderState::textureStack |
Definition at line 245 of file RenderState.h.
|
protected |
Definition at line 253 of file RenderState.h.