#ifndef Renderer_h__ #define Renderer_h__ #include #include #include #include #include #include "Camera.h" #include "ShaderProgram.h" #include "Model.h" #include "Components/PointLight.h" #include "Skybox.h" class Renderer { public: glm::mat4 viewMatrix; glm::mat4 projectionMatrix; int HEIGHT, WIDTH; std::list> ModelsToRender; int Lights; 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::list> AABBsToRender; Renderer(); void Initialize(); void Draw(double dt); void DrawText(); void AddModelToDraw(Model* model, glm::vec3 position, glm::quat orientation, glm::vec3 scale, bool visible, bool shadowCaster); 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; } bool DrawBounds() const { return m_DrawBounds; } void DrawBounds(bool val) { m_DrawBounds = val; } void DrawSkybox(); private: GLFWwindow* m_Window; GLint m_glVersion[2]; GLchar* m_glVendor; bool m_VSync; bool m_DrawNormals; bool m_DrawWireframe; bool m_DrawBounds; std::shared_ptr m_Skybox; int m_ShadowMapRes; glm::vec3 m_SunPosition; glm::vec3 m_SunTarget; glm::mat4 m_SunProjection; GLuint m_DebugAABB; GLuint m_ScreenQuad; GLuint m_ShadowFrameBuffer; GLuint m_ShadowDepthTexture; GLuint m_fDiffuseTexture; GLuint m_fPositionTexture; GLuint m_fNormalsTexture; GLuint m_fBlendTexture; GLuint m_fb; GLuint m_fDepthBuffer; GLenum draw_bufs[2]; std::shared_ptr m_Camera; ShaderProgram m_ShaderProgram; ShaderProgram m_FirstPassProgram; ShaderProgram m_SecondPassProgram; ShaderProgram m_ShaderProgramNormals; ShaderProgram m_ShaderProgramShadows; ShaderProgram m_ShaderProgramShadowsDrawDepth; ShaderProgram m_ShaderProgramDebugAABB; ShaderProgram m_ShaderProgramSkybox; void ClearStuff(); void DrawScene(); void DrawModels(ShaderProgram &shader); void DrawShadowMap(); void CreateShadowMap(int resolution); void FrameBufferTextures(); void DrawFBO(); void BindFragDataLocation(); GLuint CreateQuad(); void DrawDebugShadowMap(); GLuint CreateAABB(); GLuint CreateSkybox(void); }; #endif // Renderer_h__