summaryrefslogtreecommitdiff
path: root/lighting.hpp
blob: 627de66c5d0321e8bbd55ddcad82bf5c4dbe94f3 (plain) (blame)
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
34
35
36
37
38
39
40
41
#ifndef lighting_hpp
#define lighting_hpp

#include "maths.hpp"
#include "video.hpp"

struct Arena;
struct Model_Resources;
struct Model_Scene;
struct World;

struct Caster {
	m4f vp;
};

struct Lighting {
	static constexpr int max_lights = 128;
	static constexpr int max_shadows = 16;
	static constexpr int shadow_res = 512;
	Staged_Buffer lights;
	Texture_Id shadows;
	Texture_Id shadow_slices[max_shadows];
	Caster casters[max_shadows];
	int light_count, caster_count;
	void init(Device* dev);
	void destroy(Device* dev);
	void update(Device* dev, Context& ctx, World& w);
	void write_buf(void* ptr, World& w);
};

struct Light {
	v3f colour;
	float brightness;
	bool caster;
};

struct Sun_Light : Light {
	v3f dir;
};

#endif