summaryrefslogtreecommitdiff
path: root/ui/sceneRenderer.h
blob: c06fa8357cbcbca8d1bd7e2e4732924b80170045 (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
30
31
32
33
#pragma once

#include "gfx/gl/camera.h"
#include "gfx/gl/program.h"
#include "gfx/gl/sceneShader.h"
#include "lib/glArrays.h"
#include <functional>
#include <glm/fwd.hpp>

class SceneRenderer {
public:
	explicit SceneRenderer(glm::ivec2 size, GLuint output);

	void render(std::function<void(const SceneShader &)> content) const;

	Camera camera;

private:
	glm::ivec2 size;
	GLuint output;
	glFrameBuffer gBuffer;
	glTexture gPosition, gNormal, gAlbedoSpec;
	glRenderBuffer depth;
	class DeferredLightProgram : public Program {
	public:
		using Program::Program;
		using Program::use;
	};
	DeferredLightProgram lighting;
	glVertexArray displayVAO;
	glBuffer displayVBO;
	SceneShader shader;
};