![]() |
Vis 2 Demo
1.0
Technical illustration type real-time rendering of geometry
|
This class manages the transport of information from the application to the shader program. More...
Public Member Functions | |
ShaderController (Shader *_shader_program, unsigned int _shader_type) | |
Constructor. More... | |
~ShaderController () | |
An empty destructor. More... | |
int | setupShaderInVars (GLuint _position_buffer_handle, GLuint _normal_buffer_handle, GLuint _uv_buffer_handle, GLuint _index_buffer_handle) |
Function for connecting data streams (geometry -> shader) More... | |
GLuint | getVAOHandle () const |
This function returns the handle of the created VAO suited for this particular shader. More... | |
void | assignTexture (Texture *_texture, const unsigned int _slot) |
Function for assigning textures. More... | |
void | setLightSource (const glm::vec3 _light_pos, const glm::vec3 _light_col, const unsigned int _slot) |
Function for setting the position and color of light souces. More... | |
void | setViewData (const glm::vec3 _viewer_pos, const glm::vec3 _viewer_lookAt) |
Function for setting the position and target of the camera. More... | |
void | setNearFar (float _near, float _far) |
Function for setting the view frustum near and far planes (for a logarithmic depth buffer) More... | |
void | setBlurParams (const int _use_gaussian, const int _gauss_kernel_size, const int _blur_dist) |
Function for setting up blurring shaders. More... | |
void | setMaskingParams (const glm::vec3 _masking_color, const glm::vec3 _exculde_color, const float _masking_tolerance, const int _use_prev_pass) |
Function for setting up masking shaders. More... | |
void | setPeelingParams (float _window_w, float _window_h) |
Function for setting up peeling shaders. More... | |
void | setPeelingBlendParams (const float _alpha, const glm::vec3 _bcgrd_col) |
Function for setting the transparency of layers to blend. More... | |
void | setBlendAllParams (const glm::vec3 &_neighb_shading_col) |
Function for assigning a shading color to the complex blend shader. More... | |
int | updateShaderUniforms (glm::mat4 &_projectionMatrix, glm::mat4 &_modelMatrix, const glm::vec3 &_obj_color, const glm::vec3 &_contour_color) |
Function for connecting data streams (environment -> shader) More... | |
Public Attributes | |
Shader * | shader_Ptr |
is the pointer to the shader program More... | |
const unsigned int | shader_type |
is the type of the shader program, i.e VIS2_SHADER_TYPE_SOLID_COLOR More... | |
Private Member Functions | |
ShaderController (const ShaderController &) | |
Hidden copy-constructor. More... | |
Private Attributes | |
bool | shader_InVars_setup_done |
is true, if the setup of the in vars was successful, false otherwise More... | |
bool | shader_Uniforms_update_done |
is true, if the update of the uniforms was successful, false otherwise More... | |
GLuint | vao_handle |
handle to the Vertex Array Object (VAO) containing the geometry Vertex Buffer Objects (VBO) More... | |
bool | vao_setup_done |
signifies if the setup of the VAO was completed More... | |
bool | texture_loaded [VIS2_NR_TEXTURE_SLOTS] |
is an array of binary flags indicating, if the texture was loaded More... | |
Texture * | texture_slots [VIS2_NR_TEXTURE_SLOTS] |
is an array of textures (the complex blend shader needs 5 textures) More... | |
glm::vec3 | vec_diffuse_color |
is the color of the object (id or other) More... | |
glm::vec3 | vec_light_pos_0 |
is the position of light source 0 (slot 0) More... | |
glm::vec3 | vec_light_pos_1 |
is the position of light source 1 (slot 1) More... | |
glm::vec3 | vec_light_col_0 |
is the color of light source 0 (slot 0) More... | |
glm::vec3 | vec_light_col_1 |
is the color of light source 1 (slot 1) More... | |
glm::vec3 | vec_viewer_pos |
is the position of the camera / viewer More... | |
glm::vec3 | vec_viewer_lookAt |
is the target at which the camera / viewer is looking More... | |
float | near_plane |
is the far plane of the projection matrix More... | |
float | far_plane |
is the near plane of the projection matrix More... | |
int | use_gauss |
1 = use Gaussian kernel, 0 = use the blur distance instead More... | |
int | gauss_kernel_size |
the size of the gaussian kernel in a BLUR shader More... | |
int | blur_distance |
is the filter radius for blurring the mask in a BLUR shader More... | |
glm::vec3 | masking_color |
is the color to be masked More... | |
glm::vec3 | exculde_color |
is the background color, that is not to be masked (saves performance) More... | |
float | masking_tolerance |
is the allowed distance from the detected color to the target color for masking to take place More... | |
int | use_prev_pass |
if 1 then the result from the previous masking pass is added, if 0 - not More... | |
float | window_w |
is the viewport width More... | |
float | window_h |
is the viewport height More... | |
float | depth_peel_blend [4] |
holds the blending coefficients based on the object alpha for the DEPTH PEEL BLEND shader More... | |
glm::vec3 | depth_peel_bcgrd_col |
is the background color for the DEPTH PEEL BLEND shader More... | |
glm::vec3 | blend_all_neighb_color |
This class manages the transport of information from the application to the shader program.
This class contains the functionality for passing all in and uniform parameters to
a shader program according to its type.
Definition at line 57 of file ShaderController.h.
ShaderController::ShaderController | ( | Shader * | _shader_program, |
unsigned int | _shader_type | ||
) |
Constructor.
The constructor requires
[in] | _shader_program | as the shader program to be controlled, and |
[in] | _shader_type | as its type. |
Definition at line 5 of file ShaderController.cpp.
ShaderController::~ShaderController | ( | ) |
An empty destructor.
Definition at line 32 of file ShaderController.cpp.
|
private |
Hidden copy-constructor.
void ShaderController::assignTexture | ( | Texture * | _texture, |
const unsigned int | _slot | ||
) |
Function for assigning textures.
[in] | _texture | is the texture to be assigned to |
[in] | _slot. |
Definition at line 100 of file ShaderController.cpp.
|
inline |
This function returns the handle of the created VAO suited for this particular shader.
Definition at line 87 of file ShaderController.h.
void ShaderController::setBlendAllParams | ( | const glm::vec3 & | _neighb_shading_col | ) |
Function for assigning a shading color to the complex blend shader.
[in] | _neighb_shading_col | is the color to be used for the neighbors of the selected object in the complex blend shader. |
Definition at line 190 of file ShaderController.cpp.
void ShaderController::setBlurParams | ( | const int | _use_gaussian, |
const int | _gauss_kernel_size, | ||
const int | _blur_dist | ||
) |
Function for setting up blurring shaders.
[in] | _use_gaussian | : if true, the Gaussian kernel is used, otherwize - the blur distance, |
[in] | _gauss_kernel_size | is the size of the Gaussian kernel, |
[in] | _blur_dist | is the sampling radius for blurring. |
Definition at line 146 of file ShaderController.cpp.
void ShaderController::setLightSource | ( | const glm::vec3 | _light_pos, |
const glm::vec3 | _light_col, | ||
const unsigned int | _slot | ||
) |
Function for setting the position and color of light souces.
[in] | _light_pos | is position, |
[in] | _light_col | - the color of the light source in |
[in] | _slot. |
Definition at line 112 of file ShaderController.cpp.
void ShaderController::setMaskingParams | ( | const glm::vec3 | _masking_color, |
const glm::vec3 | _exculde_color, | ||
const float | _masking_tolerance, | ||
const int | _use_prev_pass | ||
) |
Function for setting up masking shaders.
[in] | _masking_color | is the color to be masked, |
[in] | _exculde_color | is the color to be excluded from masking, |
[in] | _masking_tolerance | is the color tolerance for the masking process, |
[in] | _use_prev_pass | signifies, whether the result from a previous pass should be added. |
Definition at line 156 of file ShaderController.cpp.
void ShaderController::setNearFar | ( | float | _near, |
float | _far | ||
) |
Function for setting the view frustum near and far planes (for a logarithmic depth buffer)
[in] | _near | is the near plane, |
[in] | _far | is the far plane. |
Definition at line 139 of file ShaderController.cpp.
void ShaderController::setPeelingBlendParams | ( | const float | _alpha, |
const glm::vec3 | _bcgrd_col | ||
) |
Function for setting the transparency of layers to blend.
[in] | _alpha | is the desired alpha value: 1 is opaque, 0 is completely transparent. |
[in] | _bcgrd_col | is the background color. |
Definition at line 173 of file ShaderController.cpp.
void ShaderController::setPeelingParams | ( | float | _window_w, |
float | _window_h | ||
) |
Function for setting up peeling shaders.
Passes the viewport size to the depth peeling fragment shader for fragment coordinate normalization.
[in] | _window_w | is the width of the viewport, |
[in] | _window_h | is the height of the viewport. |
Definition at line 167 of file ShaderController.cpp.
int ShaderController::setupShaderInVars | ( | GLuint | _position_buffer_handle, |
GLuint | _normal_buffer_handle, | ||
GLuint | _uv_buffer_handle, | ||
GLuint | _index_buffer_handle | ||
) |
Function for connecting data streams (geometry -> shader)
This function passes the locations of the geometry buffers to the shader program
according to the shader type. It creates a vao_handle to the vertex array object
which then binds the vertex buffer object handles passed as input parameters.
[in] | _position_buffer_handle | is the handle to the vertex coordinates in object space, |
[in] | _normal_buffer_handle | is the handle to the vertex normals in object space, |
[in] | _uv_buffer_handle | is the handle to the texture coordinates in object space, |
[in] | _index_buffer_handle | is the handle to the the face indices for each polygon. |
Definition at line 37 of file ShaderController.cpp.
void ShaderController::setViewData | ( | const glm::vec3 | _viewer_pos, |
const glm::vec3 | _viewer_lookAt | ||
) |
Function for setting the position and target of the camera.
[in] | _viewer_pos | is its position, |
[in] | _viewer_lookAt | - its target. |
Definition at line 133 of file ShaderController.cpp.
int ShaderController::updateShaderUniforms | ( | glm::mat4 & | _projectionMatrix, |
glm::mat4 & | _modelMatrix, | ||
const glm::vec3 & | _obj_color, | ||
const glm::vec3 & | _contour_color | ||
) |
Function for connecting data streams (environment -> shader)
This function passes the locations of the geometry-independent variables to the shader program
according to the shader type.
[in] | _projectionMatrix | is the current projection matrix, |
[in] | _modelMatrix | is the current model matrix, |
[in] | _obj_color | is the object color of the geometric object, |
[in] | _contour_color | is the color to use in edge detecting shaders. |
Definition at line 195 of file ShaderController.cpp.
|
private |
Definition at line 219 of file ShaderController.h.
|
private |
is the filter radius for blurring the mask in a BLUR shader
Definition at line 206 of file ShaderController.h.
|
private |
is the background color for the DEPTH PEEL BLEND shader
Definition at line 217 of file ShaderController.h.
|
private |
holds the blending coefficients based on the object alpha for the DEPTH PEEL BLEND shader
Definition at line 216 of file ShaderController.h.
|
private |
is the background color, that is not to be masked (saves performance)
Definition at line 209 of file ShaderController.h.
|
private |
is the near plane of the projection matrix
Definition at line 202 of file ShaderController.h.
|
private |
the size of the gaussian kernel in a BLUR shader
Definition at line 205 of file ShaderController.h.
|
private |
is the color to be masked
Definition at line 208 of file ShaderController.h.
|
private |
is the allowed distance from the detected color to the target color for masking to take place
Definition at line 210 of file ShaderController.h.
|
private |
is the far plane of the projection matrix
Definition at line 201 of file ShaderController.h.
|
private |
is true, if the setup of the in vars was successful, false otherwise
Definition at line 180 of file ShaderController.h.
Shader* vis2::ShaderController::shader_Ptr |
is the pointer to the shader program
Definition at line 173 of file ShaderController.h.
const unsigned int vis2::ShaderController::shader_type |
is the type of the shader program, i.e VIS2_SHADER_TYPE_SOLID_COLOR
Definition at line 174 of file ShaderController.h.
|
private |
is true, if the update of the uniforms was successful, false otherwise
Definition at line 181 of file ShaderController.h.
|
private |
is an array of binary flags indicating, if the texture was loaded
Definition at line 187 of file ShaderController.h.
|
private |
is an array of textures (the complex blend shader needs 5 textures)
Definition at line 188 of file ShaderController.h.
|
private |
1 = use Gaussian kernel, 0 = use the blur distance instead
Definition at line 204 of file ShaderController.h.
|
private |
if 1 then the result from the previous masking pass is added, if 0 - not
Definition at line 211 of file ShaderController.h.
|
private |
handle to the Vertex Array Object (VAO) containing the geometry Vertex Buffer Objects (VBO)
Definition at line 184 of file ShaderController.h.
|
private |
signifies if the setup of the VAO was completed
Definition at line 185 of file ShaderController.h.
|
private |
is the color of the object (id or other)
Definition at line 190 of file ShaderController.h.
|
private |
is the color of light source 0 (slot 0)
Definition at line 195 of file ShaderController.h.
|
private |
is the color of light source 1 (slot 1)
Definition at line 196 of file ShaderController.h.
|
private |
is the position of light source 0 (slot 0)
Definition at line 192 of file ShaderController.h.
|
private |
is the position of light source 1 (slot 1)
Definition at line 193 of file ShaderController.h.
|
private |
is the target at which the camera / viewer is looking
Definition at line 199 of file ShaderController.h.
|
private |
is the position of the camera / viewer
Definition at line 198 of file ShaderController.h.
|
private |
is the viewport height
Definition at line 214 of file ShaderController.h.
|
private |
is the viewport width
Definition at line 213 of file ShaderController.h.