summaryrefslogtreecommitdiff
path: root/gfx/gl/billboardPainter.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/billboardPainter.h')
-rw-r--r--gfx/gl/billboardPainter.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/gfx/gl/billboardPainter.h b/gfx/gl/billboardPainter.h
new file mode 100644
index 0000000..617f431
--- /dev/null
+++ b/gfx/gl/billboardPainter.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "gfx/models/mesh.h"
+#include "gfx/models/texture.h"
+#include "glFramebuffer.h"
+#include "program.h"
+
+class LightDirection;
+
+class BillboardPainter {
+public:
+ template<typename T> static constexpr T VIEW_ANGLES = 8;
+
+ BillboardPainter();
+
+ static void configureBillBoardTextures(glTextures<GL_TEXTURE_2D_ARRAY, 3> &, ImageDimensions);
+ void setView(Angle angle, const glm::mat4 &);
+ [[nodiscard]] Angle getAngle() const;
+ void renderBillBoard(const glTextures<GL_TEXTURE_2D_ARRAY, 3> &, const MeshBase &, Texture::AnyPtr texture) const;
+
+private:
+ mutable glFramebuffer fbo;
+ Program program;
+ Program::RequiredUniformLocation viewProjectionLoc {program, "viewProjection"};
+ Program::RequiredUniformLocation viewLoc {program, "view"};
+
+ Angle angle;
+ glm::mat4 view;
+};