summaryrefslogtreecommitdiff
path: root/frontend/shared_cpp/OrthographicRenderer.h
blob: e04b5ecb4cc537730315be3475be9241601ba704 (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
34
35
36
37
38
39
40
41
#pragma once

#include "types.h"
#include "Shader.h"
#include "mathlib.h"

struct OrthographicRenderer {
	Mat4x4 projection;
	uint32 shader;

	struct {
		int32 position;
		int32 color;
	} attributes;

	struct {
		int32 projection;
		int32 model;
	} uniforms;

	void load();
	void render();
	void unload();
};

struct OrthographicVertex {
	Vector2 position;
	Vector2 color;
};

template <uint32 N>
struct OrthographicShape {
	uint32 vao;
	uint32 vbo;
	OrthographicVertex vertices[N];
	Mat4x4 model;

	void load(OrthographicRenderer* renderer);
	void render(OrthographicRenderer* renderer);
	void unload();
};