From 40a924db3664318615a9a3f11ee25c206cb77fe1 Mon Sep 17 00:00:00 2001 From: mattkae Date: Sun, 1 May 2022 21:44:04 -0400 Subject: Renderer3d basics --- themes/Renderer3d.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 themes/Renderer3d.h (limited to 'themes/Renderer3d.h') diff --git a/themes/Renderer3d.h b/themes/Renderer3d.h new file mode 100644 index 0000000..add41d7 --- /dev/null +++ b/themes/Renderer3d.h @@ -0,0 +1,46 @@ +#ifndef RENDERER3D_H +#define RENDERER3D_H +#include "mathlib.h" +#include "list.h" +#include "types.h" +#include + +struct Vertex3d { + Vector4 position; + Vector4 color; +}; + +struct Mesh3d { + u32 vao; + u32 vbo; + u32 ebo; + matte::List vertices; + matte::List indices; + Mat4x4 model; +}; + +struct WebglContext; +struct Renderer3D { + WebglContext* context = NULL; + Mat4x4 projection; + u32 shader; + Vector4 clearColor; + + struct { + i32 position; + i32 color; + } attributes; + + struct { + i32 projection; + i32 model; + } uniforms; + + void load(WebglContext* context); + void render(); + void unload(); +}; + +Mesh3d Mesh3d_fromObj(std::string content); + +#endif \ No newline at end of file -- cgit v1.2.1