Files
OpenSpace/modules/blackhole/rendering/renderableblackhole.h
2025-02-28 14:03:12 +01:00

50 lines
1.4 KiB
C++

#ifndef __OPENSPACE_MODULE_BLACKHOLE___RENDERABLECANVAS___H__
#define __OPENSPACE_MODULE_BLACKHOLE___RENDERABLECANVAS___H__
#include <openspace/rendering/renderable.h>
#include <modules/blackhole/rendering/viewport.h>
#include <ghoul/opengl/uniformcache.h>
#include <ghoul/opengl/textureunit.h>
namespace openspace {
class RenderableBlackHole : public Renderable {
public:
explicit RenderableBlackHole(const ghoul::Dictionary& dictionary);
~RenderableBlackHole() override = default;
void initialize() override;
void initializeGL() override;
void deinitializeGL() override;
bool isReady() const override;
void render(const RenderData& data, RendererTasks& rendererTask) override;
void update(const UpdateData& data) override;
static documentation::Documentation Documentation();
private:
void bindFramebuffer();
bool bindTexture(GLint chacheRegistry, ghoul::opengl::TextureUnit& textureUnit, std::unique_ptr<ghoul::opengl::Texture>& texture);
void drawQuad();
void setupShaders();
void setupQuad();
void loadEnvironmentTexture();
ghoul::opengl::ProgramObject* _program = nullptr;
ViewPort _viewport;
GLuint _framebuffer = 0;
GLuint _quadVao = 0;
GLuint _quadVbo = 0;
UniformCache(enviromentTexture, viewGrid) _uniformCache;
std::unique_ptr<ghoul::opengl::Texture> _enviromentTexture;
};
} // openspace namespace
#endif //__OPENSPACE_MODULE_BLACKHOLE___RENDERABLECANVAS___H__