#ifndef Renderer_h__ #define Renderer_h__ #include #include #include #include #include #include "OpenGL.h" #include #include #include #include #include #include #include "glerror.h" #include "Camera.h" #include "ShaderProgram.h" #include "Model.h" #include "Components/PointLight.h" class Renderer { public: glm::mat4 viewMatrix; glm::mat4 projectionMatrix; int HEIGHT, WIDTH; struct ModelData { std::shared_ptr model; glm::mat4 ModelMatrix; ModelData(std::shared_ptr _model, glm::mat4 _modelMatrix) : model(_model), ModelMatrix(_modelMatrix) {} }; std::vector ModelsToRender; std::vector Light_position; std::vector Light_specular; std::vector Light_diffuse; std::vector Light_constantAttenuation; std::vector Light_linearAttenuation; std::vector Light_quadraticAttenuation; std::vector Light_spotExponent; std::vector> AABBsToRender; Renderer(); void Initialize(); void Draw(double dt); void DrawText(); void AddModelToDraw(std::shared_ptr model, glm::vec3 position, glm::quat orientation, glm::vec3 scale); void AddTextToDraw(); void AddPointLightToDraw( glm::vec3 _position, glm::vec3 _specular, glm::vec3 _diffuse, float _constantAttenuation, float _linearAttenuation, float _quadraticAttenuation, float _spotExponent ); void AddAABBToDraw(glm::vec3 origin, glm::vec3 volumeVector, bool colliding); void LoadContent(); GLFWwindow* GetWindow() const { return m_Window; } std::shared_ptr 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; glm::vec3 m_SunPosition; glm::vec3 m_SunTarget; glm::mat4 m_SunProjection; GLuint m_DebugAABB; GLuint m_ScreenQuad; GLuint m_ShadowFrameBuffer; GLuint m_ShadowDepthTexture; std::shared_ptr m_Camera; ShaderProgram m_ShaderProgram; ShaderProgram m_ShaderProgramNormals; ShaderProgram m_ShaderProgramShadows; ShaderProgram m_ShaderProgramShadowsDrawDepth; ShaderProgram m_ShaderProgramDebugAABB; void DrawScene(); void DrawModels(ShaderProgram &shader); void DrawShadowMap(); void CreateShadowMap(int resolution); GLuint CreateQuad(); void DrawDebugShadowMap(); GLuint CreateAABB(); }; #endif // Renderer_h__