diff options
| author | Matt Kosarek <matt.kosarek@canonical.com> | 2026-02-19 16:58:58 -0500 |
|---|---|---|
| committer | Matt Kosarek <matt.kosarek@canonical.com> | 2026-02-19 16:58:58 -0500 |
| commit | da0eedbf1733e40613215ecd117e1a4e049089ad (patch) | |
| tree | d83d5dc63b50efbd45084d692ae037cbe0f02b25 /themes/src/renderer_2d.h | |
| parent | 4d1beea73810af4641d074f974ad9c196a7e8d6e (diff) | |
Removed photo gallery + added cute little grass rendering for the rabbit and a nice gradient backgroundHEADmaster
Diffstat (limited to 'themes/src/renderer_2d.h')
| -rw-r--r-- | themes/src/renderer_2d.h | 90 |
1 files changed, 44 insertions, 46 deletions
diff --git a/themes/src/renderer_2d.h b/themes/src/renderer_2d.h index d572533..16c5cbe 100644 --- a/themes/src/renderer_2d.h +++ b/themes/src/renderer_2d.h @@ -1,61 +1,59 @@ #pragma once -#include "webgl_context.h" -#include "types.h" -#include "shader.h" #include "mathlib.h" +#include "shader.h" +#include "types.h" +#include "webgl_context.h" struct WebglContext; /// Responsible for rendering Mesh2Ds struct Renderer2d { - WebglContext* context = NULL; - Mat4x4 projection; - u32 shader; - Vector4 clearColor; - - struct { - i32 position; - i32 color; - - // TODO: vMatrix is not standard and does not belong here - i32 vMatrix; - } attributes; - - struct { - i32 projection; - i32 model; - } uniforms; - - /// Load with the provided context and shader programs. If the shaders are NULL, the default - /// shader is used - void load(WebglContext* context, const char* vertexShader = NULL, const char* fragmentShader = NULL); - void render(); - void unload(); - f32 get_width(); - f32 get_height(); + WebglContext *context = NULL; + Mat4x4 projection; + u32 shader; + Vector4 clearColor; + + struct { + i32 position; + i32 color; + + // TODO: vMatrix is not standard and does not belong here + i32 vMatrix; + } attributes; + + struct { + i32 projection; + i32 model; + } uniforms; + + /// Load with the provided context and shader programs. If the shaders are + /// NULL, the default shader is used + void load(WebglContext *context, const char *vertexShader = NULL, + const char *fragmentShader = NULL); + void render(); + void unload(); + f32 get_width(); + f32 get_height(); }; struct Vertex2D { - Vector2 position; - Vector4 color; - Mat4x4 vMatrix; + Vector2 position; + Vector4 color; + Mat4x4 vMatrix; }; struct Mesh2D { - u32 vao; - u32 vbo; - u32 ebo = 0; - u32 numVertices = 0; - u32 numIndices = 0; - Mat4x4 model; - - void load(Vertex2D* vertices, u32 numVertices, Renderer2d* renderer); - void load(Vertex2D* vertices, - u32 numVertices, - u32* indices, - u32 numIndices, - Renderer2d* renderer); - void render(Renderer2d* renderer, GLenum drawType = GL_TRIANGLES); - void unload(); + u32 vao; + u32 vbo; + u32 ebo = 0; + u32 numVertices = 0; + u32 numIndices = 0; + Mat4x4 model; + + void load(Vertex2D *vertices, u32 numVertices, Renderer2d *renderer); + void load(Vertex2D *vertices, u32 numVertices, u32 *indices, u32 numIndices, + Renderer2d *renderer); + void render(Renderer2d *renderer, GLenum drawType = GL_TRIANGLES); + void unload(); }; |
