#pragma once #include "../Pipeline.hpp" #include #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 { /// Handle OpenGL rendering passes and params class Pipeline final: public render::Pipeline { public: Pipeline(const options&); Pipeline(Pipeline &&) = delete; Pipeline(const Pipeline &) = delete; Pipeline &operator=(Pipeline &&) = delete; Pipeline &operator=(const Pipeline &) = delete; ~Pipeline(); glm::vec3 LightInvDir = glm::vec3(0.5f, 2, 2); glm::vec3 FogColor; GLfloat FogDepth; /// Sphere bending /// offset.xyz radius.w glm::vec4 SphereProj; /// Ratio between spherical and cartesian float Curvature; 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; } /// Start new frame and setup void beginFrame() override; /// Get started world program std::function beginWorldPass(); /// Get started entity program std::function&)> beginEntityPass(); /// Draw cube indicator size_t drawIndicatorCube(glm::mat4 model); /// Apply postprocessing void endPass() override; void swapBuffer(GLFWwindow *) override; void setClearColor(glm::vec4) override; /// Apply camera matrices void lookFrom(const Camera&) override; void reloadShaders(const pass::VoxelProgram::options &); void reloadTextures(const std::string &, float mipMapLOD, float anisotropy); private: 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; void loadTextures(const std::string &, float mipMapLOD, float anisotropy); void unloadTextures(); }; }