The functions and elements of an Obstacle. More...
#include <Obstacle.h>
Public Member Functions | |
Obstacle (std::string _objFileName) | |
Constructor for Obstacle. | |
~Obstacle () | |
Destructor for Obstacle. | |
void | createMesh (const std::string _objFileName) |
Create a mesh for the Obstacle. | |
void | drawMesh () |
Draws the mesh. | |
ngl::Obj * | getMesh () |
An accessor to get the m_mesh variable. | |
ngl::Vec3 | getPosition () const |
An accessor to get the m_position variable. | |
ngl::Vec3 | getRotation () const |
An accessor to get the m_rotation variable. | |
ngl::Vec3 | getScale () const |
An accessor to get the m_scale variable. | |
ngl::Transformation * | getTransMatrix () |
An accessor to get the m_transMatrix variable. | |
ngl::Vec3 | multTransMatrixAndVertex (ngl::Vec3 _vertex) |
Multiplies the transformation matrix by a vertex and return the new vertex. | |
void | setPosition (ngl::Vec3 _pos) |
Sets the obstacle's position. | |
void | setPosition (const float _x, const float _y, const float _z) |
Sets the obstacle's position. | |
void | setRotation (ngl::Vec3 _rotation) |
Sets the obstacle's rotation. | |
void | setScale (ngl::Vec3 _scale) |
Sets the obstacle's scale. | |
void | setTransMatrix (ngl::Transformation _matrix) |
Sets the obstacle's transformation matrix. | |
Private Attributes | |
ngl::Obj * | m_mesh |
The mesh of the obstacle. | |
ngl::Vec3 | m_position |
The position of the obstacle. | |
ngl::Vec3 | m_rotation |
The rotation of the obstacle. | |
ngl::Vec3 | m_scale |
The scale of the obstacle. | |
ngl::Transformation | m_transMatrix |
The transformation matrix of the obstacle. |
The functions and elements of an Obstacle.
Obstacle::Obstacle | ( | std::string | _objFileName | ) |
Destructor for Obstacle.
1. De-allocate memory.
void Obstacle::createMesh | ( | const std::string | _objFileName | ) |
Create a mesh for the Obstacle.
[in] | _objFileName | the file name of the obj file. |
1. Initialize the mesh object.
2. Create the vertex array object for the mesh.
void Obstacle::drawMesh | ( | ) |
Draws the mesh.
1. Draw the mesh.
ngl::Obj* Obstacle::getMesh | ( | ) | [inline] |
An accessor to get the m_mesh variable.
ngl::Vec3 Obstacle::getPosition | ( | ) | const [inline] |
An accessor to get the m_position variable.
ngl::Vec3 Obstacle::getRotation | ( | ) | const [inline] |
An accessor to get the m_rotation variable.
ngl::Vec3 Obstacle::getScale | ( | ) | const [inline] |
An accessor to get the m_scale variable.
ngl::Transformation* Obstacle::getTransMatrix | ( | ) | [inline] |
An accessor to get the m_transMatrix variable.
ngl::Vec3 Obstacle::multTransMatrixAndVertex | ( | ngl::Vec3 | _vertex | ) |
Multiplies the transformation matrix by a vertex and return the new vertex.
[in] | _vertex | the vertex |
1. Multiply the vertex by the obstacle's transformation matrix to get the location of the vertex in world space.
void Obstacle::setPosition | ( | ngl::Vec3 | _pos | ) | [inline] |
Sets the obstacle's position.
[in] | _pos | a vector to be set to the m_position variable. |
void Obstacle::setPosition | ( | const float | _x, |
const float | _y, | ||
const float | _z | ||
) |
Sets the obstacle's position.
[in] | _x | the obstacle's x position |
[in] | _y | the obstacle's y position |
[in] | _z | the obstacle's z position |
1. Set the position based on the parameters.
void Obstacle::setRotation | ( | ngl::Vec3 | _rotation | ) | [inline] |
Sets the obstacle's rotation.
[in] | _rotation | a vector to be set to the m_rotation variable. |
void Obstacle::setScale | ( | ngl::Vec3 | _scale | ) | [inline] |
Sets the obstacle's scale.
[in] | _scale | a vector to be set to the m_scale variable. |
void Obstacle::setTransMatrix | ( | ngl::Transformation | _matrix | ) | [inline] |
Sets the obstacle's transformation matrix.
[in] | _matrix | a matrix to be set to the obstacle's transformation matrix variable (m_transMatrix). |