diff options
author | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-31 13:54:11 -0400 |
---|---|---|
committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-10-31 13:54:11 -0400 |
commit | 5c613a10364f30bd6add25f7950433f0c482c3ca (patch) | |
tree | af8f6e481b6400329eca12bd8cdb35e0237d63af /shared_cpp/Renderer2d.h | |
parent | a214b4f8977a4b115710b5c9d152b392ac8e24f7 (diff) |
(mkosarek) Working undamped spring motion
Diffstat (limited to 'shared_cpp/Renderer2d.h')
-rw-r--r-- | shared_cpp/Renderer2d.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/shared_cpp/Renderer2d.h b/shared_cpp/Renderer2d.h new file mode 100644 index 0000000..afde20e --- /dev/null +++ b/shared_cpp/Renderer2d.h @@ -0,0 +1,43 @@ +#pragma once + +#include "WebglContext.h" +#include "types.h" +#include "Shader.h" +#include "mathlib.h" + +struct WebglContext; + +struct Renderer2d { + Mat4x4 projection; + uint32 shader; + + struct { + int32 position; + int32 color; + } attributes; + + struct { + int32 projection; + int32 model; + } uniforms; + + void load(WebglContext* context); + void render(); + void unload(); +}; + +struct Vertex2d { + Vector2 position; + Vector4 color; +}; + +struct Mesh2d { + uint32 vao; + uint32 vbo; + uint32 numVertices = 0; + Mat4x4 model; + + void load(Vertex2d* vertices, uint32 numVertices, Renderer2d* renderer, GLenum loadType = GL_STATIC_DRAW); + void render(Renderer2d* renderer, GLenum drawType = GL_TRIANGLES); + void unload(); +}; |