#pragma once #include #include #include "pass/MainProgram.hpp" #include "pass/SkyProgram.hpp" #include "pass/Context.hpp" class Camera; /// Handle rendering passes and params class Renderer { public: /// Rendering options struct options { /// Main pass pass::MainProgram::options main; /// Display skybox bool skybox = false; /// Display only wires bool wireframe = false; /// Texture pack name std::string textures = "1024-realistic"; /// Textures quality float mipMapLOD = -.5; /// Depth color ImVec4 clear_color; }; Renderer(const options&); Renderer(Renderer &&) = delete; Renderer(const Renderer &) = delete; Renderer &operator=(Renderer &&) = delete; Renderer &operator=(const Renderer &) = delete; ~Renderer(); glm::vec3 LightInvDir = glm::vec3(0.5f, 2, 2); glm::vec3 FogColor; GLfloat FogDepth; bool SkyEnable; glm::mat4 getProjectionMatrix() const { return ProjectionMatrix; } glm::mat4 getViewMatrix() const { return ViewMatrix; } GLuint getTextureAtlas() const { return TextureAtlas; } GLuint getNormalAtlas() const { return NormalAtlas; } GLuint getHOSAtlas() const { return HOSAtlas; } GLuint getSkyTexture() const { return Skybox; } /// Get main pass with context pass::Context getPass(); /// Apply postprocessing void postProcess(); /// Apply camera matrices void lookFrom(const Camera&); void reloadShaders(const pass::MainProgram::options &); void reloadTextures(const std::string &, float mipMapLOD = 0); private: GLuint VertexArrayID; pass::MainProgram *MainPass; pass::SkyProgram *SkyPass; glm::mat4 ProjectionMatrix; glm::mat4 ViewMatrix; GLuint TextureAtlas; GLuint NormalAtlas; GLuint HOSAtlas; GLuint Skybox; void loadTextures(const std::string &, float mipMapLOD = 0); void unloadTextures(); };