summaryrefslogtreecommitdiff
path: root/frontend/_shared/OrthographicRenderer.h
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2021-03-17 23:10:55 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2021-03-17 23:10:55 -0400
commitc29a911cd1a3f23f66478f205cace14487aadc56 (patch)
tree43308a2b186314c74e04441f5470a652cf607540 /frontend/_shared/OrthographicRenderer.h
parent1a08dd2bd6839f0be4b12dc5317ab0b00ca23ae1 (diff)
Beginning to build out the orthographic renderer, and updated styles
Diffstat (limited to 'frontend/_shared/OrthographicRenderer.h')
-rw-r--r--frontend/_shared/OrthographicRenderer.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/frontend/_shared/OrthographicRenderer.h b/frontend/_shared/OrthographicRenderer.h
new file mode 100644
index 0000000..e04b5ec
--- /dev/null
+++ b/frontend/_shared/OrthographicRenderer.h
@@ -0,0 +1,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();
+};