diff options
author | mattkae <mattkae@protonmail.com> | 2022-06-22 21:04:35 -0400 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2022-06-22 21:04:35 -0400 |
commit | ada7e2de99de2b87f5a1ca3ba7f1896c8a664d21 (patch) | |
tree | 56a7d79df5d3929db33288c5a94a5403d6efc045 /themes | |
parent | 29059f552223d70bdab287b0d121567cec0ed6c7 (diff) |
Remove leftover files
Diffstat (limited to 'themes')
-rw-r--r-- | themes/TreeShape.h~ | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/themes/TreeShape.h~ b/themes/TreeShape.h~ deleted file mode 100644 index 14ea765..0000000 --- a/themes/TreeShape.h~ +++ /dev/null @@ -1,104 +0,0 @@ -#include "Renderer2d.h" -#include "types.h" -#include "mathlib.h" - -struct TreeBranch { - float32 width = 0.f; - float32 height = 0.f; - Vector2 position; // Center point - Vector2 direction = Vector2 { 1.f, 0.f }; - Vector4 color = Vector4 { 1.f, 0.f, 0.f, 1.f }; - - void fillVertices(Renderer2dVertex* vertices) { - vertices[0] = { - Vector2 { position.x - width / 2.f, position.y }, - color - }; - vertices[1] = { - Vector2 { position.x + width / 2.f, position.y }, - color - }; - vertices[2] = { - Vector2 { position.x - width / 2.f, position.y + height }, - color - }; - vertices[3] = { - Vector2 { position.x - width / 2.f, position.y + height }, - color - }; - vertices[4] = { - Vector2 { position.x + width / 2.f, position.y + height }, - color - }; - vertices[5] = { - Vector2 { position.x + width / 2.f, position.y }, - color - }; - } -}; - -struct TreeShape { - Renderer2dShape shape; - - float32 height = 100.f; // Height of the whole tree - float32 width = 50.f; // Width of the whole tree - int32 divisionsPerBranch = 2; // How many branches to split into at each branch split - int32 numBranchLevels = 8; // How many branch levels to display - float32 animateTimeSeconds = 2.f; // How long it takes the tree to form - - void load(Renderer2d* renderer) { - int32 numBranches = divisionsPerBranch * numBranchLevels; - TreeBranch* branches = new TreeBranch[numBranches]; - TreeBranch trunk = branches[0]; - - int32 numVertices = 6 * numBranches; - Renderer2dVertex* vertices = new Renderer2dVertex[numVertices]; - - - - trunk.width = width; - trunk.height = height; - trunk.position = Vector2 { 0.f, 0.f }; - trunk.direction = Vector2 { 1.f, 0.f }; - trunk.fillVertices(&vertices[0]); - - shape.load(vertices, numVertices, renderer); - - delete[] branches; - delete[] vertices; - } - - void createBranch(TreeBranch* branchList, int32 numBranches, int32* branchIndex, int32 branchLevel, float32 width, float32 height, Vector2 position, Vector2 direction, Renderer2dVertex* vertices) { - branch->width = width; - branch->height = height; - branch->position = position; - branch->direction = direction; - branch->fillIinVertices(&vertices[&branchIndex * 6]); - - if (branchLevel == numBranchLevels) { - return; - } - - float32 branchWidth = width / divisionsPerBranch; - float32 branchHeight = height / divisionsPerBranch; - Vector2 branchPosition = branch->position + (height * branch->direction); - - for (int division = 0; division < divisionsPerBranch; division++) { - (*branchIndex)++; - createBranch(branchList, numBranches, branchIndex, branchLevel + 1, branchWidth, branchHeight, - } - } - - void update(float32 dtSeconds) { - - } - - void render(Renderer2d* renderer) { - shape.render(renderer); - } - - void unload() { - shape.unload(); - } -}; - |