summaryrefslogtreecommitdiff
path: root/themes/TreeShape.cpp
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2021-10-23 09:50:55 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2021-10-23 09:50:55 -0400
commitac9c187740797c5f8105b052bc057d274edc4be1 (patch)
treeaa03267c14044ff2a4ea25d72954f409b7d9b637 /themes/TreeShape.cpp
parent5ee0e7a8dbd647b79073beee88e82870e181b363 (diff)
(mkosarek) Better reemerging
Diffstat (limited to 'themes/TreeShape.cpp')
-rw-r--r--themes/TreeShape.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/themes/TreeShape.cpp b/themes/TreeShape.cpp
index 49f6a99..797ceca 100644
--- a/themes/TreeShape.cpp
+++ b/themes/TreeShape.cpp
@@ -95,6 +95,7 @@ void TreeShape::createBranch(TreeLoadData* ld, TreeBranchLoadData* generationDat
TreeBranchUpdateData* branchUpdateData = &updateData[*branchIndex];
branchUpdateData->tier = branchLevel;
+ branchUpdateData->periodOffset = randomFloatBetween(0.f, 2.f * PI);
branchUpdateData->period = randomFloatBetween(3.f, 5.f);
branchUpdateData->amplitude = randomFloatBetween(0.01f, 0.05f);
branchUpdateData->branchToFollow = parent;
@@ -155,8 +156,8 @@ void TreeShape::update(float32 dtSeconds) {
int32 startParentIndex = bIdx * 6;
- branchUpdataData->currentOffset.x = branchUpdataData->amplitude * sinf(branchUpdataData->period * timeElapsedSeconds);
- branchUpdataData->currentOffset.y = branchUpdataData->amplitude * sinf(branchUpdataData->period * timeElapsedSeconds);
+ branchUpdataData->currentOffset.x = branchUpdataData->amplitude * cosf(branchUpdataData->periodOffset + branchUpdataData->period * timeElapsedSeconds);
+ branchUpdataData->currentOffset.y = branchUpdataData->amplitude * sinf(branchUpdataData->periodOffset + branchUpdataData->period * timeElapsedSeconds);
if (branchUpdataData->branchToFollow != NULL) {
branchUpdataData->currentOffset += branchUpdataData->branchToFollow->currentOffset;