Jamie Slowgrove - PGG Assignment 2
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Model Class Reference

Creates a Model from an object and a shader. More...

#include <Model.h>

Collaboration diagram for Model:
Collaboration graph

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

Shadershader
 
Objectobj
 
glm::vec3 position
 
glm::mat4 matrix
 
std::string material
 

Detailed Description

Creates a Model from an object and a shader.

Author
Jamie Slowgrove

Constructor & Destructor Documentation

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.

Parameters
vertexShaderFileNameThe name of the vertex shader file.
fragmentShaderFileNameThe name of the fragment shader file.
objFileNameThe name of the obj file.
objectsA reference to the loaded Object files
shadersA reference to the loaded Shader files

Here is the call graph for this function:

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.

Parameters
vertexShaderFileNameThe name of the vertex shader file.
fragmentShaderFileNameThe name of the fragment shader file.
objFileNameThe name of the obj file.
objectsA reference to the loaded Object files
shadersA reference to the loaded Shader files
materialThe name of the material to texture with.

Here is the call graph for this function:

Model::~Model ( )

Destructs a Model Object. Destructs the Model Object deleting the Model Object from memory.

Member Function Documentation

void Model::draw ( glm::mat4 &  viewMatrix,
glm::mat4 &  projMatrix 
)

Draw the Model to the screen.

Parameters
viewMatrixA reference to the camera view matrix.
projMatrixA reference to the camera projection matrix.

Here is the call graph for this function:

Here is the caller graph for this function:

void Model::initialiseShaders ( std::string  vertexShaderFileName,
std::string  fragmentShaderFileName,
std::unordered_map< std::string, Shader * > &  shaders 
)
private

Initialise the shaders.

Parameters
vertexShaderFileNameThe name of the vertex shader file.
fragmentShaderFileNameThe name of the fragment shader file.
shadersA reference to the loaded Shader files

Here is the caller graph for this function:

void Model::initialiseVAO ( std::string  objFileName,
std::unordered_map< std::string, Object * > &  objects 
)
private

Initialise the object for the Model.

Parameters
objFileNameThe name of the obj file.
objectsA reference to the loaded Object files

Here is the caller graph for this function:

void Model::rotate ( glm::vec3  rotation)

Rotate the Model.

Parameters
rotationThe rotation angles (Euler angles [Radians]).

Here is the caller graph for this function:

void Model::rotateX ( float  angle)

Rotate the Model along the X axis.

Parameters
angleThe rotation angle (Euler angle [Radians]).

Here is the caller graph for this function:

void Model::rotateY ( float  angle)

Rotate the Model along the Y axis.

Parameters
angleThe rotation angle (Euler angle [Radians]).

Here is the caller graph for this function:

void Model::rotateZ ( float  angle)

Rotate the Model along the Z axis.

Parameters
angleThe rotation angle (Euler angle [Radians]).

Here is the caller graph for this function:

void Model::scale ( glm::vec3  scaleVector)

Scale the Model.

Parameters
scaleVectorThe new scale of the Model.

Here is the caller graph for this function:

void Model::setPosition ( glm::vec3  position)

Setter # Sets the position of the Model.

Parameters
positionThe new position.

Here is the caller graph for this function:

void Model::setPosition ( float  x,
float  y,
float  z 
)

Setter # Sets the position of the Model.

Parameters
xThe X position.
zThe Y position.
yThe Z position.

Member Data Documentation

std::string Model::material
private

The material name

glm::mat4 Model::matrix
private

The matrix for the Model

Object* Model::obj
private

The object for the Model

glm::vec3 Model::position
private

The Position of the Model

Shader* Model::shader
private

The Shader for the Model


The documentation for this class was generated from the following files: