summaryrefslogtreecommitdiff
path: root/themes/src/Renderer3d.h
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-12-23 12:47:10 -0500
committermattkae <mattkae@protonmail.com>2022-12-23 12:47:10 -0500
commit7228b2e1a2d0a8399facce3493d71a3569d250d5 (patch)
tree8eb5e4b686bf68fa12fcbb270ef88dd29aa1d704 /themes/src/Renderer3d.h
parentf63d0af456f76d713e56ca17be114fba0af22f6c (diff)
Improved the makefile considerably
Diffstat (limited to 'themes/src/Renderer3d.h')
-rw-r--r--themes/src/Renderer3d.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/themes/src/Renderer3d.h b/themes/src/Renderer3d.h
new file mode 100644
index 0000000..7e89c93
--- /dev/null
+++ b/themes/src/Renderer3d.h
@@ -0,0 +1,56 @@
+#ifndef RENDERER3D_H
+#define RENDERER3D_H
+#include "mathlib.h"
+#include "list.h"
+#include "types.h"
+#include <string>
+
+struct Renderer3D;
+
+struct Vertex3d {
+ Vector4 position;
+ Vector4 color;
+ Vector4 normal;
+};
+
+struct Mesh3d {
+ u32 vao;
+ u32 vbo;
+ u32 ebo;
+ matte::List<Vertex3d> vertices;
+ matte::List<u32> indices;
+ Mat4x4 model;
+
+ void load(Renderer3D* renderer);
+ void render(Renderer3D* renderer);
+ void unload();
+};
+
+struct WebglContext;
+struct Renderer3D {
+ WebglContext* context = NULL;
+ Mat4x4 projection;
+ Mat4x4 view;
+ u32 shader;
+ Vector4 clearColor;
+
+ struct {
+ i32 position;
+ i32 color;
+ i32 normal;
+ } attributes;
+
+ struct {
+ i32 projection;
+ i32 view;
+ i32 model;
+ } uniforms;
+
+ void load(WebglContext* context);
+ void render();
+ void unload();
+};
+
+Mesh3d Mesh3d_fromObj(Renderer3D* renderer, const char* content, const i32 len);
+
+#endif