diff options
author | mattkae <mattkae@protonmail.com> | 2023-04-03 06:35:27 -0400 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2023-04-03 06:35:27 -0400 |
commit | 5d3ff36045bfb11af0f373d5ecee7c9b54e4c4f9 (patch) | |
tree | 1877c85fc652603312c1093ff31678ab807616b2 /themes/src/SummerTheme.cpp | |
parent | 9e21251ea16e594c8ef416cf8a6b8ebbbb42a858 (diff) |
Folderized all of the seasons and loading the shaders from a remote source
Diffstat (limited to 'themes/src/SummerTheme.cpp')
-rw-r--r-- | themes/src/SummerTheme.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/themes/src/SummerTheme.cpp b/themes/src/SummerTheme.cpp deleted file mode 100644 index 20bb310..0000000 --- a/themes/src/SummerTheme.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "SummerTheme.h" -#include "Renderer2d.h" -#include "list.h" -#include "mathlib.h" -#include <vector> - -void SummerTheme::load(Renderer2d* renderer) { - renderer->clearColor = Vector4(0, 181, 286, 255.f).toNormalizedColor(); - sun.sectors = 180; - sun.radius = renderer->context->width / 4.f; - sun.load(renderer); -} - -void SummerTheme::update(f32 dtSeconds) { - sun.update(dtSeconds); -} - -void SummerTheme::render(Renderer2d* renderer) { - sun.render(renderer); -} - -void SummerTheme::unload() { - sun.unload(); -} - -void Sun::load(Renderer2d* renderer) { - matte::List<Vertex2D> vertices; - matte::List<u32> indices; - Vector4 sunColor = Vector4(249, 215, 28, 255).toNormalizedColor(); - vertices.add({ Vector2(0, 0), sunColor, Mat4x4() }); - - f32 radiansPerSector = (2.f * PI) / sectors; - for (i32 i = 0; i <= sectors; i++) { - f32 radians = radiansPerSector * i; - f32 cosAngle = cosf(radians); - f32 sinAngle = sinf(radians); - Vector2 vertex = Vector2(radius * cosAngle, radius * sinAngle); - vertices.add({ vertex, sunColor, Mat4x4() }); - - u32 first = i; - u32 second = 0; - u32 third = i + 1; - indices.add(first); - indices.add(second); - indices.add(third); - } - - mesh.load(&vertices.data[0], vertices.numElements, &indices.data[0], indices.numElements, renderer); - mesh.model = Mat4x4().translateByVec2(Vector2(renderer->context->width / 2.f, renderer->context->height / 2.f)); - vertices.deallocate(); - indices.deallocate(); -} - -void Sun::update(f32 dtSeconds) { - -} - -void Sun::render(Renderer2d* renderer) { - setShaderMat4(renderer->uniforms.model, mesh.model); - glBindVertexArray(mesh.vao); - glDrawElements(GL_TRIANGLES, mesh.numIndices, GL_UNSIGNED_INT, 0); - glBindVertexArray(0); -} - -void Sun::unload() { - mesh.unload(); -} |