summaryrefslogtreecommitdiff
path: root/gfx/gl/billboardPainter.h
blob: 617f4311524030959fda024cb6bddf93730dd75d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
};