OglShapeRenderer class is an implementation of MbsShapeRenderer that render a MbsShape3D using Open GL.
More...
#include <OglShapeRenderer.hh>
|
| OglShapeRenderer (std::string vertex_file, std::string fragment_file, MbsWorld3D *w, OglWorldRenderer *world_rend) |
| Constructor. More...
|
|
virtual | ~OglShapeRenderer () |
| destructor of the OglShapeRenderer More...
|
|
virtual void | Init (std::vector< glm::vec3 > vertices, std::vector< glm::vec3 > colors, std::vector< glm::vec3 > normals, std::vector< unsigned int > indexes) |
| Init the current shape renderer: create Ogl object necessary to represnet the shape. More...
|
|
virtual void | Update (glm::mat4 model_mat, glm::mat4 MVP, glm::mat3 M_inv_trans, MbsWorld3D *world_3d, float shiny_mat, glm::vec3 const &specular_mat, float transparency) |
| Execute the necessary code to render this shape: Update the Ogl transform and add it to the pipeline. More...
|
|
virtual void | ShadowDepth (int index) |
| update of the shadow depth buffer More...
|
|
virtual void | SetModelMat (glm::mat4 const &model_mat) |
| set the model matrix More...
|
|
|
void | LightsInit (float shiny_mat, glm::vec3 const &specular_mat, float transparency) |
| initalize the lights More...
|
|
void | LightsUpdate () |
| update the lights More...
|
|
std::string | StringLoc (const char *fieldName, size_t index) |
| generate a string to get the location of a specific field (to communicate with fragment shader), without property More...
|
|
std::string | StringLoc (const char *fieldName, const char *propertyName, size_t index) |
| generate a string to get the location of a specific field (to communicate with fragment shader), with property More...
|
|
void | MVPDepth (int index) |
| update mvpDepth and depthBiasMVP (uniform matrices for shadow shaders) More...
|
|
OglShapeRenderer class is an implementation of MbsShapeRenderer that render a MbsShape3D using Open GL.
◆ OglShapeRenderer()
Constructor.
constructor of an OglShapeRenderer
OglShapeRenderer implements the necessary functions to render a MbsShape3D using OpenGL.
- Parameters
-
[in] | vertex_file | vertex shader file to load (with path) |
[in] | fragment_file | fragment shader file to load (with path) |
[in] | world_3d | 3D world |
[in] | wr | the MbsWorldRenderer object associated to this renderer |
◆ ~OglShapeRenderer()
◆ Init()
void Init |
( |
std::vector< glm::vec3 > |
vertices, |
|
|
std::vector< glm::vec3 > |
colors, |
|
|
std::vector< glm::vec3 > |
normals, |
|
|
std::vector< unsigned int > |
indexes |
|
) |
| |
|
virtual |
Init the current shape renderer: create Ogl object necessary to represnet the shape.
initialize the shape renderer by giving the parameters of the shape (vertices, colors, normals, ...)
- Parameters
-
[in] | vertices | the vertices of the shape that must be rendered by this ShapeRenderer |
[in] | colors | the colors associated to the vertices defined in vertices |
[in] | normals | the normals associated to the vertices defined in vertices |
[in] | indexes | the vertex indices defining the triangles of the shape (i.e. the connectivity) |
Implements MbsShapeRenderer.
◆ LightsInit()
void LightsInit |
( |
float |
shiny_mat, |
|
|
glm::vec3 const & |
specular_mat, |
|
|
float |
transparency |
|
) |
| |
|
protected |
◆ LightsUpdate()
◆ MVPDepth()
void MVPDepth |
( |
int |
index | ) |
|
|
protected |
update mvpDepth and depthBiasMVP (uniform matrices for shadow shaders)
- Parameters
-
[in] | index | ID of the current active light, and so the current depth texture |
◆ SetModelMat()
virtual void SetModelMat |
( |
glm::mat4 const & |
model_mat | ) |
|
|
inlinevirtual |
◆ ShadowDepth()
void ShadowDepth |
( |
int |
index | ) |
|
|
virtual |
update of the shadow depth buffer
- Parameters
-
[in] | index | ID of the current active light, and so the current depth texture |
Implements MbsShapeRenderer.
◆ StringLoc() [1/2]
std::string StringLoc |
( |
const char * |
fieldName, |
|
|
const char * |
propertyName, |
|
|
size_t |
index |
|
) |
| |
|
protected |
generate a string to get the location of a specific field (to communicate with fragment shader), with property
- Parameters
-
[in] | fieldName | name of the field |
[in] | propertyName | name of the property |
[in] | index | ID |
- Returns
- requested string
◆ StringLoc() [2/2]
std::string StringLoc |
( |
const char * |
fieldName, |
|
|
size_t |
index |
|
) |
| |
|
protected |
generate a string to get the location of a specific field (to communicate with fragment shader), without property
- Parameters
-
[in] | fieldName | name of the field |
[in] | index | ID |
- Returns
- requested string
◆ Update()
void Update |
( |
glm::mat4 |
model_mat, |
|
|
glm::mat4 |
MVP, |
|
|
glm::mat3 |
M_inv_trans, |
|
|
MbsWorld3D * |
world_3d, |
|
|
float |
shiny_mat, |
|
|
glm::vec3 const & |
specular_mat, |
|
|
float |
transparency |
|
) |
| |
|
virtual |
Execute the necessary code to render this shape: Update the Ogl transform and add it to the pipeline.
update the shape position
- Parameters
-
[in] | model_mat | the transformation matrix setting the position/orientation of the shape |
[in] | MVP | the transformation matrix from the model to the view |
[in] | M_inv_trans | the inverse of the transformation matrix |
[in] | world_3d | the MbsWorld3D in which the shape must be rendered |
[in] | shiny_mat | the shiny_mat property of the shape |
[in] | specular_mat | the specular_mat property of the shape |
[in] | transparency | the transparency property of the shape |
Implements MbsShapeRenderer.
◆ biasMatrix
◆ cameraID
◆ depth_frag_sh
std::string depth_frag_sh |
|
protected |
fragment depth shader path
◆ depth_ratio_width
std::vector<float> depth_ratio_width |
|
protected |
ration between the X and Y width components of the depth texture
◆ depth_semi_x_width
std::vector<int> depth_semi_x_width |
|
protected |
X semi width of the shadow map depth textures (in pixels)
◆ depth_semi_y_width
std::vector<int> depth_semi_y_width |
|
protected |
X semi width of the shadow map depth textures (in pixels)
◆ depth_shader
◆ depth_vert_sh
std::string depth_vert_sh |
|
protected |
◆ depthBiasID
std::vector<GLuint> depthBiasID |
|
protected |
◆ depthBiasMVP
std::vector<glm::mat4> depthBiasMVP |
|
protected |
◆ depthTexture
std::vector<GLuint> depthTexture |
|
protected |
◆ frameBuffer
std::vector<GLuint> frameBuffer |
|
protected |
◆ light_init
flag to know if the ligth is initialized
◆ lightAmbID
std::vector<GLuint> lightAmbID |
|
protected |
ID of the light ambiance.
◆ lightAttID
std::vector<GLuint> lightAttID |
|
protected |
ID of the light attenuation.
◆ lightColID
std::vector<GLuint> lightColID |
|
protected |
◆ lightConAngID
std::vector<GLuint> lightConAngID |
|
protected |
ID of the light cone angle (for spots)
◆ lightConDirID
std::vector<GLuint> lightConDirID |
|
protected |
ID of the light cone direction (for spots)
◆ lightPosID
std::vector<GLuint> lightPosID |
|
protected |
ID of the light position.
◆ MInvTransID
ID of transpose and inverse of the model matrix.
◆ model_mat
model matrix ==> the same as the one stored in MbsShape3D
◆ modelMatID
◆ mvpDepth
std::vector<glm::mat4> mvpDepth |
|
protected |
◆ mvpDepthID
std::vector<GLuint> mvpDepthID |
|
protected |
ID of the depth matrices MVP.
◆ mvpID
◆ nb_indexes
size of the indexes vector
◆ nbLightsID
ID of the number of lights.
◆ sh_lights
◆ shader
◆ shader_flag
◆ shadowBiasID
std::vector<GLuint> shadowBiasID |
|
protected |
◆ shadowMapID
std::vector<GLuint> shadowMapID |
|
protected |
◆ shininessID
ID of the shininess (shape material)
◆ specularID
ID of the specular value (shape material)
◆ spreadID
std::vector<GLuint> spreadID |
|
protected |
ID of the spread factor for Poisson disk.
◆ transID
◆ VAO_id
◆ VBO_color_id
◆ VBO_indexes_id
◆ VBO_normal_id
◆ VBO_vertex_id
◆ world_3d
◆ world_rend
reference to the world renderer that creat this shape renderer
The documentation for this class was generated from the following files: