Ghettomerge

This commit is contained in:
Tobias Dahl
2014-03-11 22:32:49 +01:00
parent 33dbcc10a1
commit bb6cc1a23e
41 changed files with 892 additions and 648 deletions
+19 -12
View File
@@ -7,12 +7,7 @@
#include <sstream>
#include <vector>
#define _CRT_SECURE_NO_WARNINGS
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <glext.h>
#define GLM_FORCE_RADIANS
#include "OpenGL.h"
#include <glm/glm.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/matrix_transform.hpp>
@@ -29,7 +24,7 @@
class Renderer
{
public:
ShaderProgram m_ShaderProgram;
glm::mat4 viewMatrix;
glm::mat4 projectionMatrix;
@@ -37,10 +32,10 @@ public:
struct ModelData
{
Model* model;
std::shared_ptr<Model> model;
glm::mat4 ModelMatrix;
ModelData(Model* _model, glm::mat4 _modelMatrix) : model(_model), ModelMatrix(_modelMatrix)
{}
ModelData(std::shared_ptr<Model> _model, glm::mat4 _modelMatrix)
: model(_model), ModelMatrix(_modelMatrix) {}
};
std::vector<ModelData*> ModelsToRender;
@@ -58,7 +53,7 @@ public:
void Draw(double dt);
void DrawText();
void AddModelToDraw(Model*, glm::vec3, glm::quat);
void AddModelToDraw(std::shared_ptr<Model> model, glm::vec3 position, glm::quat orientation);
void AddTextToDraw();
void AddPointLightToDraw(
glm::vec3 _position,
@@ -75,14 +70,26 @@ public:
GLFWwindow* GetWindow() const { return m_Window; }
std::shared_ptr<Camera> GetCamera() const { return m_Camera; }
bool DrawNormals() const { return m_DrawNormals; }
void DrawNormals(bool val) { m_DrawNormals = val; }
bool DrawWireframe() const { return m_DrawWireframe; }
void DrawWireframe(bool val) { m_DrawWireframe = val; }
private:
GLFWwindow* m_Window;
GLint m_glVersion[2];
GLchar* m_glVendor;
bool m_VSync;
bool m_DrawNormals;
bool m_DrawWireframe;
std::shared_ptr<Camera> m_Camera;
GLuint vertexArrayObject;
ShaderProgram m_ShaderProgram;
ShaderProgram m_ShaderProgramNormals;
void DrawModels();
};
#endif // Renderer_h__