Creates a Model from an object and a shader. More...
#include <Model.h>

Public Member Functions | |
| Model (std::string vertexShaderFileName, std::string fragmentShaderFileName, std::string objFileName, std::unordered_map< std::string, Object * > &objects, std::unordered_map< std::string, Shader * > &shaders) | |
| Model (std::string vertexShaderFileName, std::string fragmentShaderFileName, std::string objFileName, std::unordered_map< std::string, Object * > &objects, std::unordered_map< std::string, Shader * > &shaders, std::string material) | |
| ~Model () | |
| void | draw (glm::mat4 &viewMatrix, glm::mat4 &projMatrix) |
| void | setPosition (glm::vec3 position) |
| void | setPosition (float x, float y, float z) |
| void | rotate (glm::vec3 rotation) |
| void | rotateX (float angle) |
| void | rotateY (float angle) |
| void | rotateZ (float angle) |
| void | scale (glm::vec3 scaleVector) |
Private Member Functions | |
| void | initialiseVAO (std::string objFileName, std::unordered_map< std::string, Object * > &objects) |
| void | initialiseShaders (std::string vertexShaderFileName, std::string fragmentShaderFileName, std::unordered_map< std::string, Shader * > &shaders) |
Private Attributes | |
| Shader * | shader |
| Object * | obj |
| glm::vec3 | position |
| glm::mat4 | matrix |
| std::string | material |
Creates a Model from an object and a shader.
| Model::Model | ( | std::string | vertexShaderFileName, |
| std::string | fragmentShaderFileName, | ||
| std::string | objFileName, | ||
| std::unordered_map< std::string, Object * > & | objects, | ||
| std::unordered_map< std::string, Shader * > & | shaders | ||
| ) |
Constructs a Model Object. Creates a Model Object using the shader file locations, the obj file location and OpenGL.
| vertexShaderFileName | The name of the vertex shader file. |
| fragmentShaderFileName | The name of the fragment shader file. |
| objFileName | The name of the obj file. |
| objects | A reference to the loaded Object files |
| shaders | A reference to the loaded Shader files |

| Model::Model | ( | std::string | vertexShaderFileName, |
| std::string | fragmentShaderFileName, | ||
| std::string | objFileName, | ||
| std::unordered_map< std::string, Object * > & | objects, | ||
| std::unordered_map< std::string, Shader * > & | shaders, | ||
| std::string | material | ||
| ) |
Constructs a Model Object. Creates a Model Object using the shader file locations, the obj file location and OpenGL.
| vertexShaderFileName | The name of the vertex shader file. |
| fragmentShaderFileName | The name of the fragment shader file. |
| objFileName | The name of the obj file. |
| objects | A reference to the loaded Object files |
| shaders | A reference to the loaded Shader files |
| material | The name of the material to texture with. |

| Model::~Model | ( | ) |
| void Model::draw | ( | glm::mat4 & | viewMatrix, |
| glm::mat4 & | projMatrix | ||
| ) |
Draw the Model to the screen.
| viewMatrix | A reference to the camera view matrix. |
| projMatrix | A reference to the camera projection matrix. |


|
private |
Initialise the shaders.
| vertexShaderFileName | The name of the vertex shader file. |
| fragmentShaderFileName | The name of the fragment shader file. |
| shaders | A reference to the loaded Shader files |

|
private |
| void Model::rotate | ( | glm::vec3 | rotation | ) |
Rotate the Model.
| rotation | The rotation angles (Euler angles [Radians]). |

| void Model::rotateX | ( | float | angle | ) |
Rotate the Model along the X axis.
| angle | The rotation angle (Euler angle [Radians]). |

| void Model::rotateY | ( | float | angle | ) |
Rotate the Model along the Y axis.
| angle | The rotation angle (Euler angle [Radians]). |

| void Model::rotateZ | ( | float | angle | ) |
Rotate the Model along the Z axis.
| angle | The rotation angle (Euler angle [Radians]). |

| void Model::scale | ( | glm::vec3 | scaleVector | ) |
| void Model::setPosition | ( | glm::vec3 | position | ) |
Setter # Sets the position of the Model.
| position | The new position. |

| void Model::setPosition | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Setter # Sets the position of the Model.
| x | The X position. |
| z | The Y position. |
| y | The Z position. |
|
private |
The material name
|
private |
The matrix for the Model
|
private |
The Position of the Model
1.8.8