summaryrefslogtreecommitdiff
path: root/gfx/gl/billboardPainter.h
blob: 4ce7b1042bb99920df7d52f6006d06b11f5b0172 (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
#pragma once

#include "gfx/gl/program.h"
#include "gfx/models/mesh.h"
#include "gfx/models/texture.h"
#include "glArrays.h"

class LightDirection;

class BillboardPainter {
public:
	template<typename T> static constexpr T VIEW_ANGLES = 8;

	BillboardPainter();

	[[nodiscard]]
	static glTextures<3> createBillBoardTextures(GLsizei width, GLsizei height);
	void setView(const glm::mat4 &);
	void renderBillBoard(const glTextures<3> &, const MeshBase &, Texture::AnyPtr texture) const;

private:
	glFrameBuffer fbo;
	Program program;
	Program::RequiredUniformLocation viewProjectionLoc {program, "viewProjection"};
	Program::RequiredUniformLocation viewLoc {program, "view"};

	glm::mat4 view;
};