#pragma once #include "../Renderer.hpp" #include #include #include "pass/WorldProgram.hpp" #include "pass/EntityProgram.hpp" #include "pass/SkyProgram.hpp" #include "pass/ColorProgram.hpp" #include "buffer/Colored.hpp" namespace render::gl { /// OpenGL rendering class Renderer final: public render::Renderer { public: virtual ~Renderer(); static bool Load(Window& window, const renderOptions& options); glm::vec3 FogColor; GLfloat FogDepth; 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; } void beginFrame() override; std::function beginWorldPass() override; std::function&)> beginEntityPass() override; size_t drawIndicatorCube(glm::mat4 model) override; void endPass() override; void swapBuffer(Window&) override; void setClearColor(glm::vec4) override; void setCurvature(glm::vec4, float) override; glm::vec4 getSphereProj() const { return SphereProj; } float getCurvature() const { return Curvature; } /// Apply camera matrices void lookFrom(const Camera&) override; void reloadShaders(const pass::VoxelProgram::options &) override; void reloadTextures(const std::string &, float mipMapLOD, float anisotropy) override; void loadUI(Window &) override; static _FORCE_INLINE_ Renderer *Get() { return static_cast(render::Renderer::Get()); } private: Renderer(const renderOptions &options); GLuint VertexArrayID; std::unique_ptr WorldPass; std::unique_ptr EntityPass; std::unique_ptr SkyPass; std::unique_ptr IndicatorPass; buffer::Colored IndicatorCubeBuffer; glm::mat4 ProjectionMatrix; glm::mat4 ViewMatrix; GLuint TextureAtlas; GLuint NormalAtlas; GLuint HOSAtlas; GLuint Skybox; /// Sphere bending /// offset.xyz radius.w glm::vec4 SphereProj; /// Ratio between spherical and cartesian float Curvature; /// Draw skybox bool SkyEnable; void loadTextures(const std::string &, float mipMapLOD, float anisotropy); void unloadTextures(); }; }