Jamie Slowgrove - PGG Assignment 2
 All Classes Namespaces Files Functions Variables Typedefs Macros
Model.h
Go to the documentation of this file.
1 #include <iostream>
2 #include <glm.hpp>
3 #include <gtc/type_ptr.hpp>
4 #include <gtc/matrix_transform.hpp>
5 #include <unordered_map>
6 #include "glew.h"
7 #include "Shader.h"
8 #include "Object.h"
9 
14 class Model
15 {
16 private:
22  glm::vec3 position;
24  glm::mat4 matrix;
27 
33  void initialiseVAO(std::string objFileName, std::unordered_map<std::string, Object*> &objects);
34 
41  void initialiseShaders(std::string vertexShaderFileName, std::string fragmentShaderFileName,
42  std::unordered_map<std::string, Shader*> &shaders);
43 
44 public:
54  Model(std::string vertexShaderFileName, std::string fragmentShaderFileName, std::string objFileName,
55  std::unordered_map<std::string, Object*> &objects, std::unordered_map<std::string, Shader*> &shaders);
56 
67  Model(std::string vertexShaderFileName, std::string fragmentShaderFileName, std::string objFileName,
68  std::unordered_map<std::string, Object*> &objects, std::unordered_map<std::string, Shader*> &shaders,
69  std::string material);
70 
75  ~Model();
76 
82  void draw(glm::mat4 &viewMatrix, glm::mat4 &projMatrix);
83 
88  void setPosition(glm::vec3 position);
89 
96  void setPosition(float x, float y, float z);
97 
102  void rotate(glm::vec3 rotation);
103 
108  void rotateX(float angle);
109 
114  void rotateY(float angle);
115 
120  void rotateZ(float angle);
121 
126  void scale(glm::vec3 scaleVector);
127 };
void rotateZ(float angle)
Definition: Model.cpp:198
std::string material
Definition: Model.h:26
GLdouble GLdouble z
Definition: glew.h:1558
glm::mat4 matrix
Definition: Model.h:24
void draw(glm::mat4 &viewMatrix, glm::mat4 &projMatrix)
Definition: Model.cpp:108
Creates a Model from an object and a shader.
Definition: Model.h:14
void rotateY(float angle)
Definition: Model.cpp:189
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1251
void initialiseShaders(std::string vertexShaderFileName, std::string fragmentShaderFileName, std::unordered_map< std::string, Shader * > &shaders)
Definition: Model.cpp:84
void setPosition(glm::vec3 position)
Definition: Model.cpp:143
void initialiseVAO(std::string objFileName, std::unordered_map< std::string, Object * > &objects)
Definition: Model.cpp:44
GLsizei GLsizei GLuint * shaders
Definition: glew.h:1826
Object * obj
Definition: Model.h:20
Shader * shader
Definition: Model.h:18
~Model()
Definition: Model.cpp:37
void rotateX(float angle)
Definition: Model.cpp:180
void scale(glm::vec3 scaleVector)
Definition: Model.cpp:207
Creates a Shader for use with OpenGL. Creates a Shader from an text file, this can then be used with ...
Definition: Shader.h:13
GLint GLint GLint GLint GLint x
Definition: glew.h:1251
Creates an object for use with OpenGL. Creates an object from an text file, this can then be used wit...
Definition: Object.h:16
GLdouble angle
Definition: glew.h:8878
void rotate(glm::vec3 rotation)
Definition: Model.cpp:169
Model(std::string vertexShaderFileName, std::string fragmentShaderFileName, std::string objFileName, std::unordered_map< std::string, Object * > &objects, std::unordered_map< std::string, Shader * > &shaders)
Definition: Model.cpp:6
glm::vec3 position
Definition: Model.h:22
GLsizei const GLchar *const * string
Definition: glew.h:1843