summaryrefslogtreecommitdiff
path: root/debugdraw.hpp
blob: e5142dc514a146cf406735fa0720f3438a201cb4 (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
42
#ifndef debugdraw_hpp
#define debugdraw_hpp

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

struct Camera;

struct Line_Renderer {
	static constexpr int max_lines = 1024;
	Staged_Buffer vb, cb;
	Shader* shader;
	int vert_binding, cbuffer_binding;
	int cur;
	int w, h;
	v3f cur_col;

	struct Vertex {
		float x, y, z;
		float r, g, b;
	}* verts;

	struct CBuffer {
		m4f vp;
	};

	void init(Device* dev, Asset_Arena* assets);

	void destroy(Device* dev);
	void begin(int wi, int he);
	void colour(const v3f& c);
	void add_line(const v3f& s, const v3f& e);
	void add_box(const AABB& b);
	void flush(
		const Camera& cam,
		Device* dev,
		Arena* a,
		Render_Pass& rp
	);
};

#endif